aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorBorislav Petkov <bp@suse.de>2014-03-09 13:05:25 -0400
committerH. Peter Anvin <hpa@linux.intel.com>2014-03-13 18:35:09 -0400
commitc0a639ad0bc6b178b46996bd1f821a04643e2bde (patch)
tree1ffe363181917629c2ab2e67f9c11485891f803b /arch
parent8f86a7373a1c8ee52d3cc64adf7f2ace13fd24ed (diff)
x86, Intel: Convert to the new bit access MSR accessors
... and save some lines of code. Signed-off-by: Borislav Petkov <bp@suse.de> Link: http://lkml.kernel.org/r/1394384725-10796-4-git-send-email-bp@alien8.de Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
Diffstat (limited to 'arch')
-rw-r--r--arch/x86/include/uapi/asm/msr-index.h9
-rw-r--r--arch/x86/kernel/cpu/intel.c30
2 files changed, 13 insertions, 26 deletions
diff --git a/arch/x86/include/uapi/asm/msr-index.h b/arch/x86/include/uapi/asm/msr-index.h
index c19fc60ff062..045e6db6f58a 100644
--- a/arch/x86/include/uapi/asm/msr-index.h
+++ b/arch/x86/include/uapi/asm/msr-index.h
@@ -368,14 +368,16 @@
368#define THERM_LOG_THRESHOLD1 (1 << 9) 368#define THERM_LOG_THRESHOLD1 (1 << 9)
369 369
370/* MISC_ENABLE bits: architectural */ 370/* MISC_ENABLE bits: architectural */
371#define MSR_IA32_MISC_ENABLE_FAST_STRING (1ULL << 0) 371#define MSR_BIT_FAST_STRING 0
372#define MSR_IA32_MISC_ENABLE_FAST_STRING (1ULL << MSR_BIT_FAST_STRING)
372#define MSR_IA32_MISC_ENABLE_TCC (1ULL << 1) 373#define MSR_IA32_MISC_ENABLE_TCC (1ULL << 1)
373#define MSR_IA32_MISC_ENABLE_EMON (1ULL << 7) 374#define MSR_IA32_MISC_ENABLE_EMON (1ULL << 7)
374#define MSR_IA32_MISC_ENABLE_BTS_UNAVAIL (1ULL << 11) 375#define MSR_IA32_MISC_ENABLE_BTS_UNAVAIL (1ULL << 11)
375#define MSR_IA32_MISC_ENABLE_PEBS_UNAVAIL (1ULL << 12) 376#define MSR_IA32_MISC_ENABLE_PEBS_UNAVAIL (1ULL << 12)
376#define MSR_IA32_MISC_ENABLE_ENHANCED_SPEEDSTEP (1ULL << 16) 377#define MSR_IA32_MISC_ENABLE_ENHANCED_SPEEDSTEP (1ULL << 16)
377#define MSR_IA32_MISC_ENABLE_MWAIT (1ULL << 18) 378#define MSR_IA32_MISC_ENABLE_MWAIT (1ULL << 18)
378#define MSR_IA32_MISC_ENABLE_LIMIT_CPUID (1ULL << 22) 379#define MSR_BIT_LIMIT_CPUID 22
380#define MSR_IA32_MISC_ENABLE_LIMIT_CPUID (1ULL << MSR_BIT_LIMIT_CPUID);
379#define MSR_IA32_MISC_ENABLE_XTPR_DISABLE (1ULL << 23) 381#define MSR_IA32_MISC_ENABLE_XTPR_DISABLE (1ULL << 23)
380#define MSR_IA32_MISC_ENABLE_XD_DISABLE (1ULL << 34) 382#define MSR_IA32_MISC_ENABLE_XD_DISABLE (1ULL << 34)
381 383
@@ -385,7 +387,8 @@
385#define MSR_IA32_MISC_ENABLE_SPLIT_LOCK_DISABLE (1ULL << 4) 387#define MSR_IA32_MISC_ENABLE_SPLIT_LOCK_DISABLE (1ULL << 4)
386#define MSR_IA32_MISC_ENABLE_L3CACHE_DISABLE (1ULL << 6) 388#define MSR_IA32_MISC_ENABLE_L3CACHE_DISABLE (1ULL << 6)
387#define MSR_IA32_MISC_ENABLE_SUPPRESS_LOCK (1ULL << 8) 389#define MSR_IA32_MISC_ENABLE_SUPPRESS_LOCK (1ULL << 8)
388#define MSR_IA32_MISC_ENABLE_PREFETCH_DISABLE (1ULL << 9) 390#define MSR_BIT_PRF_DIS 9
391#define MSR_IA32_MISC_ENABLE_PREFETCH_DISABLE (1ULL << MSR_BIT_PRF_DIS)
389#define MSR_IA32_MISC_ENABLE_FERR (1ULL << 10) 392#define MSR_IA32_MISC_ENABLE_FERR (1ULL << 10)
390#define MSR_IA32_MISC_ENABLE_FERR_MULTIPLEX (1ULL << 10) 393#define MSR_IA32_MISC_ENABLE_FERR_MULTIPLEX (1ULL << 10)
391#define MSR_IA32_MISC_ENABLE_TM2 (1ULL << 13) 394#define MSR_IA32_MISC_ENABLE_TM2 (1ULL << 13)
diff --git a/arch/x86/kernel/cpu/intel.c b/arch/x86/kernel/cpu/intel.c
index 5cd9bfabd645..44ca6317af43 100644
--- a/arch/x86/kernel/cpu/intel.c
+++ b/arch/x86/kernel/cpu/intel.c
@@ -31,11 +31,7 @@ static void early_init_intel(struct cpuinfo_x86 *c)
31 31
32 /* Unmask CPUID levels if masked: */ 32 /* Unmask CPUID levels if masked: */
33 if (c->x86 > 6 || (c->x86 == 6 && c->x86_model >= 0xd)) { 33 if (c->x86 > 6 || (c->x86 == 6 && c->x86_model >= 0xd)) {
34 rdmsrl(MSR_IA32_MISC_ENABLE, misc_enable); 34 if (msr_clear_bit(MSR_IA32_MISC_ENABLE, MSR_BIT_LIMIT_CPUID) > 0) {
35
36 if (misc_enable & MSR_IA32_MISC_ENABLE_LIMIT_CPUID) {
37 misc_enable &= ~MSR_IA32_MISC_ENABLE_LIMIT_CPUID;
38 wrmsrl(MSR_IA32_MISC_ENABLE, misc_enable);
39 c->cpuid_level = cpuid_eax(0); 35 c->cpuid_level = cpuid_eax(0);
40 get_cpu_cap(c); 36 get_cpu_cap(c);
41 } 37 }
@@ -129,16 +125,9 @@ static void early_init_intel(struct cpuinfo_x86 *c)
129 * Ingo Molnar reported a Pentium D (model 6) and a Xeon 125 * Ingo Molnar reported a Pentium D (model 6) and a Xeon
130 * (model 2) with the same problem. 126 * (model 2) with the same problem.
131 */ 127 */
132 if (c->x86 == 15) { 128 if (c->x86 == 15)
133 rdmsrl(MSR_IA32_MISC_ENABLE, misc_enable); 129 if (msr_clear_bit(MSR_IA32_MISC_ENABLE, MSR_BIT_FAST_STRING) > 0)
134 130 pr_info("kmemcheck: Disabling fast string operations\n");
135 if (misc_enable & MSR_IA32_MISC_ENABLE_FAST_STRING) {
136 printk(KERN_INFO "kmemcheck: Disabling fast string operations\n");
137
138 misc_enable &= ~MSR_IA32_MISC_ENABLE_FAST_STRING;
139 wrmsrl(MSR_IA32_MISC_ENABLE, misc_enable);
140 }
141 }
142#endif 131#endif
143 132
144 /* 133 /*
@@ -197,8 +186,6 @@ static void intel_smp_check(struct cpuinfo_x86 *c)
197 186
198static void intel_workarounds(struct cpuinfo_x86 *c) 187static void intel_workarounds(struct cpuinfo_x86 *c)
199{ 188{
200 unsigned long lo, hi;
201
202#ifdef CONFIG_X86_F00F_BUG 189#ifdef CONFIG_X86_F00F_BUG
203 /* 190 /*
204 * All current models of Pentium and Pentium with MMX technology CPUs 191 * All current models of Pentium and Pentium with MMX technology CPUs
@@ -229,12 +216,9 @@ static void intel_workarounds(struct cpuinfo_x86 *c)
229 * Hardware prefetcher may cause stale data to be loaded into the cache. 216 * Hardware prefetcher may cause stale data to be loaded into the cache.
230 */ 217 */
231 if ((c->x86 == 15) && (c->x86_model == 1) && (c->x86_mask == 1)) { 218 if ((c->x86 == 15) && (c->x86_model == 1) && (c->x86_mask == 1)) {
232 rdmsr(MSR_IA32_MISC_ENABLE, lo, hi); 219 if (msr_set_bit(MSR_IA32_MISC_ENABLE, MSR_BIT_PRF_DIS) > 0) {
233 if ((lo & MSR_IA32_MISC_ENABLE_PREFETCH_DISABLE) == 0) { 220 pr_info("CPU: C0 stepping P4 Xeon detected.\n");
234 printk (KERN_INFO "CPU: C0 stepping P4 Xeon detected.\n"); 221 pr_info("CPU: Disabling hardware prefetching (Errata 037)\n");
235 printk (KERN_INFO "CPU: Disabling hardware prefetching (Errata 037)\n");
236 lo |= MSR_IA32_MISC_ENABLE_PREFETCH_DISABLE;
237 wrmsr(MSR_IA32_MISC_ENABLE, lo, hi);
238 } 222 }
239 } 223 }
240 224