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

x86/cpufeatures: Make X86_FEATURE leaf 17 Linux-specific

That cpuinfo_x86.x86_capability[] element was supposed to mirror CPUID flags
from CPUID_0x80000007_EBX but that leaf has still to this day only three bits
defined in it. So move those bits to scattered.c and free the capability
element for synthetic flags.

No functional changes.

Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de>

+14 -10
+1 -1
arch/x86/include/asm/cpufeature.h
··· 30 30 CPUID_6_EAX, 31 31 CPUID_8000_000A_EDX, 32 32 CPUID_7_ECX, 33 - CPUID_8000_0007_EBX, 33 + CPUID_LNX_6, 34 34 CPUID_7_EDX, 35 35 CPUID_8000_001F_EAX, 36 36 CPUID_8000_0021_EAX,
+4 -1
arch/x86/include/asm/cpufeatures.h
··· 407 407 #define X86_FEATURE_ENQCMD (16*32+29) /* "enqcmd" ENQCMD and ENQCMDS instructions */ 408 408 #define X86_FEATURE_SGX_LC (16*32+30) /* "sgx_lc" Software Guard Extensions Launch Control */ 409 409 410 - /* AMD-defined CPU features, CPUID level 0x80000007 (EBX), word 17 */ 410 + /* 411 + * Linux-defined word for use with scattered/synthetic bits. 412 + */ 411 413 #define X86_FEATURE_OVERFLOW_RECOV (17*32+ 0) /* "overflow_recov" MCA overflow recovery support */ 412 414 #define X86_FEATURE_SUCCOR (17*32+ 1) /* "succor" Uncorrectable error containment and recovery */ 415 + 413 416 #define X86_FEATURE_SMCA (17*32+ 3) /* "smca" Scalable MCA */ 414 417 415 418 /* Intel-defined CPU features, CPUID level 0x00000007:0 (EDX), word 18 */
+2 -6
arch/x86/kernel/cpu/common.c
··· 1021 1021 c->x86_capability[CPUID_8000_0001_EDX] = edx; 1022 1022 } 1023 1023 1024 - if (c->extended_cpuid_level >= 0x80000007) { 1025 - cpuid(0x80000007, &eax, &ebx, &ecx, &edx); 1026 - 1027 - c->x86_capability[CPUID_8000_0007_EBX] = ebx; 1028 - c->x86_power = edx; 1029 - } 1024 + if (c->extended_cpuid_level >= 0x80000007) 1025 + c->x86_power = cpuid_edx(0x80000007); 1030 1026 1031 1027 if (c->extended_cpuid_level >= 0x80000008) { 1032 1028 cpuid(0x80000008, &eax, &ebx, &ecx, &edx);
+3
arch/x86/kernel/cpu/scattered.c
··· 44 44 { X86_FEATURE_SGX1, CPUID_EAX, 0, 0x00000012, 0 }, 45 45 { X86_FEATURE_SGX2, CPUID_EAX, 1, 0x00000012, 0 }, 46 46 { X86_FEATURE_SGX_EDECCSSA, CPUID_EAX, 11, 0x00000012, 0 }, 47 + { X86_FEATURE_OVERFLOW_RECOV, CPUID_EBX, 0, 0x80000007, 0 }, 48 + { X86_FEATURE_SUCCOR, CPUID_EBX, 1, 0x80000007, 0 }, 49 + { X86_FEATURE_SMCA, CPUID_EBX, 3, 0x80000007, 0 }, 47 50 { X86_FEATURE_HW_PSTATE, CPUID_EDX, 7, 0x80000007, 0 }, 48 51 { X86_FEATURE_CPB, CPUID_EDX, 9, 0x80000007, 0 }, 49 52 { X86_FEATURE_PROC_FEEDBACK, CPUID_EDX, 11, 0x80000007, 0 },
-1
arch/x86/kvm/reverse_cpuid.h
··· 78 78 [CPUID_6_EAX] = { 6, 0, CPUID_EAX}, 79 79 [CPUID_8000_000A_EDX] = {0x8000000a, 0, CPUID_EDX}, 80 80 [CPUID_7_ECX] = { 7, 0, CPUID_ECX}, 81 - [CPUID_8000_0007_EBX] = {0x80000007, 0, CPUID_EBX}, 82 81 [CPUID_7_EDX] = { 7, 0, CPUID_EDX}, 83 82 [CPUID_7_1_EAX] = { 7, 1, CPUID_EAX}, 84 83 [CPUID_12_EAX] = {0x00000012, 0, CPUID_EAX},
+4 -1
tools/arch/x86/include/asm/cpufeatures.h
··· 407 407 #define X86_FEATURE_ENQCMD (16*32+29) /* "enqcmd" ENQCMD and ENQCMDS instructions */ 408 408 #define X86_FEATURE_SGX_LC (16*32+30) /* "sgx_lc" Software Guard Extensions Launch Control */ 409 409 410 - /* AMD-defined CPU features, CPUID level 0x80000007 (EBX), word 17 */ 410 + /* 411 + * Linux-defined word for use with scattered/synthetic bits. 412 + */ 411 413 #define X86_FEATURE_OVERFLOW_RECOV (17*32+ 0) /* "overflow_recov" MCA overflow recovery support */ 412 414 #define X86_FEATURE_SUCCOR (17*32+ 1) /* "succor" Uncorrectable error containment and recovery */ 415 + 413 416 #define X86_FEATURE_SMCA (17*32+ 3) /* "smca" Scalable MCA */ 414 417 415 418 /* Intel-defined CPU features, CPUID level 0x00000007:0 (EDX), word 18 */