diff --git a/arch/x86/include/asm/cpufeatures.h b/arch/x86/include/asm/cpufeatures.h index dbe104df339b..ca9ab8a7a4ee 100644 --- a/arch/x86/include/asm/cpufeatures.h +++ b/arch/x86/include/asm/cpufeatures.h @@ -3,18 +3,37 @@ #define _ASM_X86_CPUFEATURES_H /* - * Defines x86 CPU feature bits + * Defines x86 CPU feature bits. + */ + +/* + * Number of words of features and bugs, respectively. + * + * These should be even, as these arrays can be accessed by bitmask operations that + * use "unsigned long", which is 64 bits on x86-64. + * + * These must be expressed as decimal constants as they are read + * by scripts. */ #define NCAPINTS 22 /* N 32-bit words worth of info */ #define NBUGINTS 2 /* N 32-bit bug flags */ +#if (NCAPINTS | NBUGINTS) & 1 +# error "NCAPINTS and NBUGINTS must be even, just increment any odd number by one" +#endif + /* - * Note: If the comment begins with a quoted string, that string is used - * in /proc/cpuinfo instead of the macro name. Otherwise, this feature - * bit is not displayed in /proc/cpuinfo at all. + * Note: If the comment begins with a quoted string, that string is + * displayed in /proc/cpuinfo. Otherwise, this feature bit is not + * displayed in /proc/cpuinfo at all. + * + * This string should be in lower case and match C identifier rules. * * When adding new features here that depend on other features, * please update the table in kernel/cpu/cpuid-deps.c as well. + * + * As this file is read by scripts, the format of each of these lines + * must be strictly followed. */ /* Intel-defined CPU features, CPUID level 0x00000001 (EDX), word 0 */