Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

tools/include: Sync x86 CPU feature headers with the kernel sources

To pick up the changes from:

598c2fafc06f ("perf/x86/amd/lbr: Use freeze based on availability")
7f274e609f3d ("x86/cpufeatures: Add new word for scattered features")

This should address these tools/perf build warnings:

Warning: Kernel ABI header differences:
diff -u tools/arch/x86/include/asm/disabled-features.h arch/x86/include/asm/disabled-features.h
diff -u tools/arch/x86/include/asm/required-features.h arch/x86/include/asm/required-features.h
diff -u tools/arch/x86/include/asm/cpufeatures.h arch/x86/include/asm/cpufeatures.h

Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Dave Hansen <dave.hansen@linux.intel.com>
Cc: "H. Peter Anvin" <hpa@zytor.com>
Cc: x86@kernel.org
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Link: https://lore.kernel.org/r/20240408185520.1550865-6-namhyung@kernel.org

+23 -8
+12 -5
tools/arch/x86/include/asm/cpufeatures.h
··· 13 13 /* 14 14 * Defines x86 CPU feature bits 15 15 */ 16 - #define NCAPINTS 21 /* N 32-bit words worth of info */ 16 + #define NCAPINTS 22 /* N 32-bit words worth of info */ 17 17 #define NBUGINTS 2 /* N 32-bit bug flags */ 18 18 19 19 /* ··· 81 81 #define X86_FEATURE_K6_MTRR ( 3*32+ 1) /* AMD K6 nonstandard MTRRs */ 82 82 #define X86_FEATURE_CYRIX_ARR ( 3*32+ 2) /* Cyrix ARRs (= MTRRs) */ 83 83 #define X86_FEATURE_CENTAUR_MCR ( 3*32+ 3) /* Centaur MCRs (= MTRRs) */ 84 - 85 - /* CPU types for specific tunings: */ 86 84 #define X86_FEATURE_K8 ( 3*32+ 4) /* "" Opteron, Athlon64 */ 87 - /* FREE, was #define X86_FEATURE_K7 ( 3*32+ 5) "" Athlon */ 85 + #define X86_FEATURE_ZEN5 ( 3*32+ 5) /* "" CPU based on Zen5 microarchitecture */ 88 86 #define X86_FEATURE_P3 ( 3*32+ 6) /* "" P3 */ 89 87 #define X86_FEATURE_P4 ( 3*32+ 7) /* "" P4 */ 90 88 #define X86_FEATURE_CONSTANT_TSC ( 3*32+ 8) /* TSC ticks at a constant rate */ ··· 95 97 #define X86_FEATURE_SYSENTER32 ( 3*32+15) /* "" sysenter in IA32 userspace */ 96 98 #define X86_FEATURE_REP_GOOD ( 3*32+16) /* REP microcode works well */ 97 99 #define X86_FEATURE_AMD_LBR_V2 ( 3*32+17) /* AMD Last Branch Record Extension Version 2 */ 98 - /* FREE, was #define X86_FEATURE_LFENCE_RDTSC ( 3*32+18) "" LFENCE synchronizes RDTSC */ 100 + #define X86_FEATURE_CLEAR_CPU_BUF ( 3*32+18) /* "" Clear CPU buffers using VERW */ 99 101 #define X86_FEATURE_ACC_POWER ( 3*32+19) /* AMD Accumulated Power Mechanism */ 100 102 #define X86_FEATURE_NOPL ( 3*32+20) /* The NOPL (0F 1F) instructions */ 101 103 #define X86_FEATURE_ALWAYS ( 3*32+21) /* "" Always-present feature */ ··· 460 462 #define X86_FEATURE_SRSO_NO (20*32+29) /* "" CPU is not affected by SRSO */ 461 463 462 464 /* 465 + * Extended auxiliary flags: Linux defined - for features scattered in various 466 + * CPUID levels like 0x80000022, etc. 467 + * 468 + * Reuse free bits when adding new feature flags! 469 + */ 470 + #define X86_FEATURE_AMD_LBR_PMC_FREEZE (21*32+ 0) /* AMD LBR and PMC Freeze */ 471 + 472 + /* 463 473 * BUG word(s) 464 474 */ 465 475 #define X86_BUG(x) (NCAPINTS*32 + (x)) ··· 514 508 /* BUG word 2 */ 515 509 #define X86_BUG_SRSO X86_BUG(1*32 + 0) /* AMD SRSO bug */ 516 510 #define X86_BUG_DIV0 X86_BUG(1*32 + 1) /* AMD DIV0 speculation bug */ 511 + #define X86_BUG_RFDS X86_BUG(1*32 + 2) /* CPU is vulnerable to Register File Data Sampling */ 517 512 #endif /* _ASM_X86_CPUFEATURES_H */
+9 -2
tools/arch/x86/include/asm/disabled-features.h
··· 123 123 # define DISABLE_FRED (1 << (X86_FEATURE_FRED & 31)) 124 124 #endif 125 125 126 + #ifdef CONFIG_KVM_AMD_SEV 127 + #define DISABLE_SEV_SNP 0 128 + #else 129 + #define DISABLE_SEV_SNP (1 << (X86_FEATURE_SEV_SNP & 31)) 130 + #endif 131 + 126 132 /* 127 133 * Make sure to add features to the correct mask 128 134 */ ··· 153 147 DISABLE_ENQCMD) 154 148 #define DISABLED_MASK17 0 155 149 #define DISABLED_MASK18 (DISABLE_IBT) 156 - #define DISABLED_MASK19 0 150 + #define DISABLED_MASK19 (DISABLE_SEV_SNP) 157 151 #define DISABLED_MASK20 0 158 - #define DISABLED_MASK_CHECK BUILD_BUG_ON_ZERO(NCAPINTS != 21) 152 + #define DISABLED_MASK21 0 153 + #define DISABLED_MASK_CHECK BUILD_BUG_ON_ZERO(NCAPINTS != 22) 159 154 160 155 #endif /* _ASM_X86_DISABLED_FEATURES_H */
+2 -1
tools/arch/x86/include/asm/required-features.h
··· 99 99 #define REQUIRED_MASK18 0 100 100 #define REQUIRED_MASK19 0 101 101 #define REQUIRED_MASK20 0 102 - #define REQUIRED_MASK_CHECK BUILD_BUG_ON_ZERO(NCAPINTS != 21) 102 + #define REQUIRED_MASK21 0 103 + #define REQUIRED_MASK_CHECK BUILD_BUG_ON_ZERO(NCAPINTS != 22) 103 104 104 105 #endif /* _ASM_X86_REQUIRED_FEATURES_H */