mirror of
https://github.com/torvalds/linux.git
synced 2024-11-26 14:12:06 +00:00
14442a159c
Add support for generating VMX feature names in capflags.c and use the resulting x86_vmx_flags to print the VMX flags in /proc/cpuinfo. Don't print VMX flags if no bits are set in word 0, which holds Pin Controls. Pin Control's INTR and NMI exiting are fundamental pillars of VMX, if they are not supported then the CPU is broken, it does not actually support VMX, or the kernel wasn't built with support for the target CPU. Print the features in a dedicated "vmx flags" line to avoid polluting the common "flags" and to avoid having to prefix all flags with "vmx_", which results in horrendously long names. Keep synthetic VMX flags in cpufeatures to preserve /proc/cpuinfo's ABI for those flags. This means that "flags" and "vmx flags" will have duplicate entries for tpr_shadow (virtual_tpr), vnmi, ept, flexpriority, vpid and ept_ad, but caps the pollution of "flags" at those six VMX features. The vendor-specific code that populates the synthetic flags will be consolidated in a future patch to further minimize the lasting damage. Signed-off-by: Sean Christopherson <sean.j.christopherson@intel.com> Signed-off-by: Borislav Petkov <bp@suse.de> Link: https://lkml.kernel.org/r/20191221044513.21680-12-sean.j.christopherson@intel.com
51 lines
1.2 KiB
C
51 lines
1.2 KiB
C
// SPDX-License-Identifier: GPL-2.0-or-later
|
|
/* ----------------------------------------------------------------------- *
|
|
*
|
|
* Copyright 2008 rPath, Inc. - All Rights Reserved
|
|
*
|
|
* ----------------------------------------------------------------------- */
|
|
|
|
/*
|
|
* This is a host program to preprocess the CPU strings into a
|
|
* compact format suitable for the setup code.
|
|
*/
|
|
|
|
#include <stdio.h>
|
|
|
|
#include "../include/asm/required-features.h"
|
|
#include "../include/asm/disabled-features.h"
|
|
#include "../include/asm/cpufeatures.h"
|
|
#include "../include/asm/vmxfeatures.h"
|
|
#include "../kernel/cpu/capflags.c"
|
|
|
|
int main(void)
|
|
{
|
|
int i, j;
|
|
const char *str;
|
|
|
|
printf("static const char x86_cap_strs[] =\n");
|
|
|
|
for (i = 0; i < NCAPINTS; i++) {
|
|
for (j = 0; j < 32; j++) {
|
|
str = x86_cap_flags[i*32+j];
|
|
|
|
if (i == NCAPINTS-1 && j == 31) {
|
|
/* The last entry must be unconditional; this
|
|
also consumes the compiler-added null
|
|
character */
|
|
if (!str)
|
|
str = "";
|
|
printf("\t\"\\x%02x\\x%02x\"\"%s\"\n",
|
|
i, j, str);
|
|
} else if (str) {
|
|
printf("#if REQUIRED_MASK%d & (1 << %d)\n"
|
|
"\t\"\\x%02x\\x%02x\"\"%s\\0\"\n"
|
|
"#endif\n",
|
|
i, j, i, j, str);
|
|
}
|
|
}
|
|
}
|
|
printf("\t;\n");
|
|
return 0;
|
|
}
|