Skip to content

Commit ddde4ab

Browse files
committed
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>
1 parent 3a86608 commit ddde4ab

File tree

6 files changed

+14
-10
lines changed

6 files changed

+14
-10
lines changed

arch/x86/include/asm/cpufeature.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ enum cpuid_leafs
3030
CPUID_6_EAX,
3131
CPUID_8000_000A_EDX,
3232
CPUID_7_ECX,
33-
CPUID_8000_0007_EBX,
33+
CPUID_LNX_6,
3434
CPUID_7_EDX,
3535
CPUID_8000_001F_EAX,
3636
CPUID_8000_0021_EAX,

arch/x86/include/asm/cpufeatures.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -407,9 +407,12 @@
407407
#define X86_FEATURE_ENQCMD (16*32+29) /* "enqcmd" ENQCMD and ENQCMDS instructions */
408408
#define X86_FEATURE_SGX_LC (16*32+30) /* "sgx_lc" Software Guard Extensions Launch Control */
409409

410-
/* AMD-defined CPU features, CPUID level 0x80000007 (EBX), word 17 */
410+
/*
411+
* Linux-defined word for use with scattered/synthetic bits.
412+
*/
411413
#define X86_FEATURE_OVERFLOW_RECOV (17*32+ 0) /* "overflow_recov" MCA overflow recovery support */
412414
#define X86_FEATURE_SUCCOR (17*32+ 1) /* "succor" Uncorrectable error containment and recovery */
415+
413416
#define X86_FEATURE_SMCA (17*32+ 3) /* "smca" Scalable MCA */
414417

415418
/* Intel-defined CPU features, CPUID level 0x00000007:0 (EDX), word 18 */

arch/x86/kernel/cpu/common.c

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1021,12 +1021,8 @@ void get_cpu_cap(struct cpuinfo_x86 *c)
10211021
c->x86_capability[CPUID_8000_0001_EDX] = edx;
10221022
}
10231023

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);
10301026

10311027
if (c->extended_cpuid_level >= 0x80000008) {
10321028
cpuid(0x80000008, &eax, &ebx, &ecx, &edx);

arch/x86/kernel/cpu/scattered.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,9 @@ static const struct cpuid_bit cpuid_bits[] = {
4444
{ X86_FEATURE_SGX1, CPUID_EAX, 0, 0x00000012, 0 },
4545
{ X86_FEATURE_SGX2, CPUID_EAX, 1, 0x00000012, 0 },
4646
{ 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 },
4750
{ X86_FEATURE_HW_PSTATE, CPUID_EDX, 7, 0x80000007, 0 },
4851
{ X86_FEATURE_CPB, CPUID_EDX, 9, 0x80000007, 0 },
4952
{ X86_FEATURE_PROC_FEEDBACK, CPUID_EDX, 11, 0x80000007, 0 },

arch/x86/kvm/reverse_cpuid.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,6 @@ static const struct cpuid_reg reverse_cpuid[] = {
7878
[CPUID_6_EAX] = { 6, 0, CPUID_EAX},
7979
[CPUID_8000_000A_EDX] = {0x8000000a, 0, CPUID_EDX},
8080
[CPUID_7_ECX] = { 7, 0, CPUID_ECX},
81-
[CPUID_8000_0007_EBX] = {0x80000007, 0, CPUID_EBX},
8281
[CPUID_7_EDX] = { 7, 0, CPUID_EDX},
8382
[CPUID_7_1_EAX] = { 7, 1, CPUID_EAX},
8483
[CPUID_12_EAX] = {0x00000012, 0, CPUID_EAX},

tools/arch/x86/include/asm/cpufeatures.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -407,9 +407,12 @@
407407
#define X86_FEATURE_ENQCMD (16*32+29) /* "enqcmd" ENQCMD and ENQCMDS instructions */
408408
#define X86_FEATURE_SGX_LC (16*32+30) /* "sgx_lc" Software Guard Extensions Launch Control */
409409

410-
/* AMD-defined CPU features, CPUID level 0x80000007 (EBX), word 17 */
410+
/*
411+
* Linux-defined word for use with scattered/synthetic bits.
412+
*/
411413
#define X86_FEATURE_OVERFLOW_RECOV (17*32+ 0) /* "overflow_recov" MCA overflow recovery support */
412414
#define X86_FEATURE_SUCCOR (17*32+ 1) /* "succor" Uncorrectable error containment and recovery */
415+
413416
#define X86_FEATURE_SMCA (17*32+ 3) /* "smca" Scalable MCA */
414417

415418
/* Intel-defined CPU features, CPUID level 0x00000007:0 (EDX), word 18 */

0 commit comments

Comments
 (0)