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

x86/cpufeature: Move some of the scattered feature bits to x86_capability

Turn the CPUID leafs which are proper CPUID feature bit leafs into
separate ->x86_capability words.

Signed-off-by: Borislav Petkov <bp@suse.de>
Link: http://lkml.kernel.org/r/1449481182-27541-2-git-send-email-bp@alien8.de
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>

authored by

Borislav Petkov and committed by
Thomas Gleixner
2ccd71f1 0fa85119

+37 -42
+32 -22
arch/x86/include/asm/cpufeature.h
··· 12 12 #include <asm/disabled-features.h> 13 13 #endif 14 14 15 - #define NCAPINTS 14 /* N 32-bit words worth of info */ 15 + #define NCAPINTS 16 /* N 32-bit words worth of info */ 16 16 #define NBUGINTS 1 /* N 32-bit bug flags */ 17 17 18 18 /* ··· 181 181 182 182 /* 183 183 * Auxiliary flags: Linux defined - For features scattered in various 184 - * CPUID levels like 0x6, 0xA etc, word 7 184 + * CPUID levels like 0x6, 0xA etc, word 7. 185 + * 186 + * Reuse free bits when adding new feature flags! 185 187 */ 186 - #define X86_FEATURE_IDA ( 7*32+ 0) /* Intel Dynamic Acceleration */ 187 - #define X86_FEATURE_ARAT ( 7*32+ 1) /* Always Running APIC Timer */ 188 + 188 189 #define X86_FEATURE_CPB ( 7*32+ 2) /* AMD Core Performance Boost */ 189 190 #define X86_FEATURE_EPB ( 7*32+ 3) /* IA32_ENERGY_PERF_BIAS support */ 190 - #define X86_FEATURE_PLN ( 7*32+ 5) /* Intel Power Limit Notification */ 191 - #define X86_FEATURE_PTS ( 7*32+ 6) /* Intel Package Thermal Status */ 192 - #define X86_FEATURE_DTHERM ( 7*32+ 7) /* Digital Thermal Sensor */ 191 + 193 192 #define X86_FEATURE_HW_PSTATE ( 7*32+ 8) /* AMD HW-PState */ 194 193 #define X86_FEATURE_PROC_FEEDBACK ( 7*32+ 9) /* AMD ProcFeedbackInterface */ 195 - #define X86_FEATURE_HWP ( 7*32+ 10) /* "hwp" Intel HWP */ 196 - #define X86_FEATURE_HWP_NOTIFY ( 7*32+ 11) /* Intel HWP_NOTIFY */ 197 - #define X86_FEATURE_HWP_ACT_WINDOW ( 7*32+ 12) /* Intel HWP_ACT_WINDOW */ 198 - #define X86_FEATURE_HWP_EPP ( 7*32+13) /* Intel HWP_EPP */ 199 - #define X86_FEATURE_HWP_PKG_REQ ( 7*32+14) /* Intel HWP_PKG_REQ */ 194 + 200 195 #define X86_FEATURE_INTEL_PT ( 7*32+15) /* Intel Processor Trace */ 201 196 202 197 /* Virtualization flags: Linux defined, word 8 */ ··· 200 205 #define X86_FEATURE_FLEXPRIORITY ( 8*32+ 2) /* Intel FlexPriority */ 201 206 #define X86_FEATURE_EPT ( 8*32+ 3) /* Intel Extended Page Table */ 202 207 #define X86_FEATURE_VPID ( 8*32+ 4) /* Intel Virtual Processor ID */ 203 - #define X86_FEATURE_NPT ( 8*32+ 5) /* AMD Nested Page Table support */ 204 - #define X86_FEATURE_LBRV ( 8*32+ 6) /* AMD LBR Virtualization support */ 205 - #define X86_FEATURE_SVML ( 8*32+ 7) /* "svm_lock" AMD SVM locking MSR */ 206 - #define X86_FEATURE_NRIPS ( 8*32+ 8) /* "nrip_save" AMD SVM next_rip save */ 207 - #define X86_FEATURE_TSCRATEMSR ( 8*32+ 9) /* "tsc_scale" AMD TSC scaling support */ 208 - #define X86_FEATURE_VMCBCLEAN ( 8*32+10) /* "vmcb_clean" AMD VMCB clean bits support */ 209 - #define X86_FEATURE_FLUSHBYASID ( 8*32+11) /* AMD flush-by-ASID support */ 210 - #define X86_FEATURE_DECODEASSISTS ( 8*32+12) /* AMD Decode Assists support */ 211 - #define X86_FEATURE_PAUSEFILTER ( 8*32+13) /* AMD filtered pause intercept */ 212 - #define X86_FEATURE_PFTHRESHOLD ( 8*32+14) /* AMD pause filter threshold */ 208 + 213 209 #define X86_FEATURE_VMMCALL ( 8*32+15) /* Prefer vmmcall to vmcall */ 214 210 215 211 ··· 243 257 244 258 /* AMD-defined CPU features, CPUID level 0x80000008 (ebx), word 13 */ 245 259 #define X86_FEATURE_CLZERO (13*32+0) /* CLZERO instruction */ 260 + 261 + /* Thermal and Power Management Leaf, CPUID level 0x00000006 (eax), word 14 */ 262 + #define X86_FEATURE_DTHERM (14*32+ 0) /* Digital Thermal Sensor */ 263 + #define X86_FEATURE_IDA (14*32+ 1) /* Intel Dynamic Acceleration */ 264 + #define X86_FEATURE_ARAT (14*32+ 2) /* Always Running APIC Timer */ 265 + #define X86_FEATURE_PLN (14*32+ 4) /* Intel Power Limit Notification */ 266 + #define X86_FEATURE_PTS (14*32+ 6) /* Intel Package Thermal Status */ 267 + #define X86_FEATURE_HWP (14*32+ 7) /* Intel Hardware P-states */ 268 + #define X86_FEATURE_HWP_NOTIFY (14*32+ 8) /* HWP Notification */ 269 + #define X86_FEATURE_HWP_ACT_WINDOW (14*32+ 9) /* HWP Activity Window */ 270 + #define X86_FEATURE_HWP_EPP (14*32+10) /* HWP Energy Perf. Preference */ 271 + #define X86_FEATURE_HWP_PKG_REQ (14*32+11) /* HWP Package Level Request */ 272 + 273 + /* AMD SVM Feature Identification, CPUID level 0x8000000a (edx), word 15 */ 274 + #define X86_FEATURE_NPT (15*32+ 0) /* Nested Page Table support */ 275 + #define X86_FEATURE_LBRV (15*32+ 1) /* LBR Virtualization support */ 276 + #define X86_FEATURE_SVML (15*32+ 2) /* "svm_lock" SVM locking MSR */ 277 + #define X86_FEATURE_NRIPS (15*32+ 3) /* "nrip_save" SVM next_rip save */ 278 + #define X86_FEATURE_TSCRATEMSR (15*32+ 4) /* "tsc_scale" TSC scaling support */ 279 + #define X86_FEATURE_VMCBCLEAN (15*32+ 5) /* "vmcb_clean" VMCB clean bits support */ 280 + #define X86_FEATURE_FLUSHBYASID (15*32+ 6) /* flush-by-ASID support */ 281 + #define X86_FEATURE_DECODEASSISTS (15*32+ 7) /* Decode Assists support */ 282 + #define X86_FEATURE_PAUSEFILTER (15*32+10) /* filtered pause intercept */ 283 + #define X86_FEATURE_PFTHRESHOLD (15*32+12) /* pause filter threshold */ 246 284 247 285 /* 248 286 * BUG word(s)
+5
arch/x86/kernel/cpu/common.c
··· 618 618 cpuid_count(0x00000007, 0, &eax, &ebx, &ecx, &edx); 619 619 620 620 c->x86_capability[9] = ebx; 621 + 622 + c->x86_capability[14] = cpuid_eax(0x00000006); 621 623 } 622 624 623 625 /* Extended state features: level 0x0000000d */ ··· 680 678 681 679 if (c->extended_cpuid_level >= 0x80000007) 682 680 c->x86_power = cpuid_edx(0x80000007); 681 + 682 + if (c->extended_cpuid_level >= 0x8000000a) 683 + c->x86_capability[15] = cpuid_edx(0x8000000a); 683 684 684 685 init_scattered_cpuid_features(c); 685 686 }
-20
arch/x86/kernel/cpu/scattered.c
··· 31 31 const struct cpuid_bit *cb; 32 32 33 33 static const struct cpuid_bit cpuid_bits[] = { 34 - { X86_FEATURE_DTHERM, CR_EAX, 0, 0x00000006, 0 }, 35 - { X86_FEATURE_IDA, CR_EAX, 1, 0x00000006, 0 }, 36 - { X86_FEATURE_ARAT, CR_EAX, 2, 0x00000006, 0 }, 37 - { X86_FEATURE_PLN, CR_EAX, 4, 0x00000006, 0 }, 38 - { X86_FEATURE_PTS, CR_EAX, 6, 0x00000006, 0 }, 39 - { X86_FEATURE_HWP, CR_EAX, 7, 0x00000006, 0 }, 40 - { X86_FEATURE_HWP_NOTIFY, CR_EAX, 8, 0x00000006, 0 }, 41 - { X86_FEATURE_HWP_ACT_WINDOW, CR_EAX, 9, 0x00000006, 0 }, 42 - { X86_FEATURE_HWP_EPP, CR_EAX,10, 0x00000006, 0 }, 43 - { X86_FEATURE_HWP_PKG_REQ, CR_EAX,11, 0x00000006, 0 }, 44 34 { X86_FEATURE_INTEL_PT, CR_EBX,25, 0x00000007, 0 }, 45 35 { X86_FEATURE_APERFMPERF, CR_ECX, 0, 0x00000006, 0 }, 46 36 { X86_FEATURE_EPB, CR_ECX, 3, 0x00000006, 0 }, 47 37 { X86_FEATURE_HW_PSTATE, CR_EDX, 7, 0x80000007, 0 }, 48 38 { X86_FEATURE_CPB, CR_EDX, 9, 0x80000007, 0 }, 49 39 { X86_FEATURE_PROC_FEEDBACK, CR_EDX,11, 0x80000007, 0 }, 50 - { X86_FEATURE_NPT, CR_EDX, 0, 0x8000000a, 0 }, 51 - { X86_FEATURE_LBRV, CR_EDX, 1, 0x8000000a, 0 }, 52 - { X86_FEATURE_SVML, CR_EDX, 2, 0x8000000a, 0 }, 53 - { X86_FEATURE_NRIPS, CR_EDX, 3, 0x8000000a, 0 }, 54 - { X86_FEATURE_TSCRATEMSR, CR_EDX, 4, 0x8000000a, 0 }, 55 - { X86_FEATURE_VMCBCLEAN, CR_EDX, 5, 0x8000000a, 0 }, 56 - { X86_FEATURE_FLUSHBYASID, CR_EDX, 6, 0x8000000a, 0 }, 57 - { X86_FEATURE_DECODEASSISTS, CR_EDX, 7, 0x8000000a, 0 }, 58 - { X86_FEATURE_PAUSEFILTER, CR_EDX,10, 0x8000000a, 0 }, 59 - { X86_FEATURE_PFTHRESHOLD, CR_EDX,12, 0x8000000a, 0 }, 60 40 { 0, 0, 0, 0, 0 } 61 41 }; 62 42