MSR cleanups, v2
Borislav Petkov
maintainercover MSR cleanups, v2
From: Borislav Petkov <[email protected]>
Here's v2, all feedback from last time should be addressed. Patches boot fine on an Intel and AMD box.
I've also got them in a nice pullable form, if that is preferred:
--
The following changes since commit b01d4e68933ec23e43b1046fa35d593cefcf37d1:
x86: fix compile error due to X86_TRAP_NMI use in asm files (2014-03-07 18:58:40 -0800)
are available in the git repository at:
git://git.kernel.org/pub/scm/linux/kernel/git/bp/bp.git tags/msrs
for you to fetch changes up to b685c3e2f627f7c800aa4a34bd6f8438eaed8b3b:
x86, Intel: Convert to the new MSR accessors (2014-03-09 12:06:50 +0100)
----------------------------------------------------------------
Aggregation of MSR toggling bits functionality into common functions.
----------------------------------------------------------------
Borislav Petkov (3):
x86: Add another set of MSR accessor functions x86, AMD: Convert to the new MSR accessors x86, Intel: Convert to the new MSR accessors
arch/x86/include/asm/msr.h | 2 + arch/x86/include/uapi/asm/msr-index.h | 9 ++-- arch/x86/kernel/cpu/amd.c | 48 +++++-------------- arch/x86/kernel/cpu/intel.c | 30 +++--------- arch/x86/lib/msr.c | 89 ++++++++++++++++++++++++++++++++++- 5 files changed, 115 insertions(+), 63 deletions(-)
Changelog:
---------
v1:
Hi guys,
this is just a preview of what I think we talked about. I'm sending it out now to gather some feedback before I go and test it more thoroughly (it boots in a guest though :)).
Thanks.
Signature · 1 line
1.9.0
Borislav Petkov
maintainerPATCH 1/3 x86: Add another set of MSR accessor functions
From: Borislav Petkov <[email protected]>
We very often need to set or clear a bit in an MSR as a result of doing some sort of a hardware configuration. Add generic versions of that repeated functionality in order to save us a bunch of duplicated code in the early CPU vendor detection/config code.
--- arch/x86/include/asm/msr.h | 2 ++ arch/x86/lib/msr.c | 89 +++++++++++++++++++++++++++++++++++++++++++++- 2 files changed, 90 insertions(+), 1 deletion(-)
arch/x86/include/asm/msr.h +2 -0
@@ -214,6 +214,8 @@ do { \struct msr *msrs_alloc (void );void msrs_free (struct msr *msrs); +int msr_set_bit (u32 msr,u8 bit); +int msr_clear_bit (u32 msr,u8 bit);#ifdef CONFIG_SMP int rdmsr_on_cpu (unsigned int cpu,u32 msr_no,u32 *l,u32 *h);
arch/x86/lib/msr.c +88 -1
98 lines not on this page · raw message
Signature · 1 line
1.9.0
tip-bot for Borislav Petkov
merge bot[tip:x86/cpu] x86: Add another set of MSR accessor functions
x86: Add another set of MSR accessor functions
Commit-ID: 22085a66c2fab6cf9b9393c056a3600a6b4735de Gitweb: http://git.kernel.org/tip/22085a66c2fab6cf9b9393c056a3600a6b4735de Author: Borislav Petkov <[email protected]> AuthorDate: Sun, 9 Mar 2014 18:05:23 +0100 Committer: H. Peter Anvin <[email protected]> CommitDate: Thu, 13 Mar 2014 15:34:45 -0700
x86: Add another set of MSR accessor functions
We very often need to set or clear a bit in an MSR as a result of doing some sort of a hardware configuration. Add generic versions of that repeated functionality in order to save us a bunch of duplicated code in the early CPU vendor detection/config code.
--- arch/x86/include/asm/msr.h | 2 ++ arch/x86/lib/msr.c | 89 +++++++++++++++++++++++++++++++++++++++++++++- 2 files changed, 90 insertions(+), 1 deletion(-)
arch/x86/include/asm/msr.h +2 -0
@@ -214,6 +214,8 @@ do { \struct msr *msrs_alloc (void );void msrs_free (struct msr *msrs); +int msr_set_bit (u32 msr,u8 bit); +int msr_clear_bit (u32 msr,u8 bit);#ifdef CONFIG_SMP int rdmsr_on_cpu (unsigned int cpu,u32 msr_no,u32 *l,u32 *h);
arch/x86/lib/msr.c +88 -1
98 lines not on this page · raw message
Borislav Petkov
maintainerPATCH 2/3 x86, AMD: Convert to the new MSR accessors
In reply to Borislav PetkovFrom: Borislav Petkov <[email protected]>
... and save us a bunch of code.
--- arch/x86/kernel/cpu/amd.c | 48 ++++++++++++----------------------------------- 1 file changed, 12 insertions(+), 36 deletions(-)
arch/x86/kernel/cpu/amd.c +12 -36
@@ -233,9 +233,7 @@ static void init_amd_k7(struct cpuinfo_x86 *c)if (c->x86_model >=6 && c->x86_model <=10 ) {if (!cpu_has (c,X86_FEATURE_XMM )) {printk (KERN_INFO "Enabling disabled K7/SSE Support.\n" ); -rdmsr (MSR_K7_HWCR , l, h); - l &= ~0x00008000 ; -wrmsr (MSR_K7_HWCR , l, h); +msr_clear_bit (MSR_K7_HWCR ,15 );set_cpu_cap (c,X86_FEATURE_XMM ); } }
@@ -509,14 +507,8 @@ static void early_init_amd(struct cpuinfo_x86 *c)#endif /* F16h erratum 793, CVE-2013-6885 */ -if (c->x86 ==0x16 && c->x86_model <=0xf ) { -u64 val; - -rdmsrl (MSR_AMD64_LS_CFG , val); -if (!(val &BIT (15 ))) -wrmsrl (MSR_AMD64_LS_CFG , val |BIT (15 )); - } - +if (c->x86 ==0x16 && c->x86_model <=0xf ) +msr_set_bit (MSR_AMD64_LS_CFG ,15 ); }static const int amd_erratum_383[];
@@ -536,11 +528,8 @@ static void init_amd(struct cpuinfo_x86 *c)* Errata 63 for SH-B3 steppings * Errata 122 for all steppings (F+ have it disabled by default) */ -if (c->x86 ==0xf ) { -rdmsrl (MSR_K7_HWCR , value); - value |=1 <<6 ; -wrmsrl (MSR_K7_HWCR , value); - } +if (c->x86 ==0xf ) +msr_set_bit (MSR_K7_HWCR ,6 );#endif early_init_amd (c);
@@ -623,14 +612,11 @@ static void init_amd(struct cpuinfo_x86 *c) (c->x86_model >= 0x10) && (c->x86_model <= 0x1f) && !cpu_has(c, X86_FEATURE_TOPOEXT)) { -if (!rdmsrl_safe (0xc0011005 , &value)) { - value |=1ULL <<54 ; -wrmsrl_safe (0xc0011005 , value); +if (msr_set_bit (0xc0011005 ,54 ) >0 ) {rdmsrl (0xc0011005 , value); -if (value & (1ULL <<54 )) { +if (value &BIT_64 (54 )) {set_cpu_cap (c,X86_FEATURE_TOPOEXT ); - printk(KERN_INFO FW_INFO "CPU: Re-enabling " - "disabled Topology Extensions Support\n"); +pr_info (FW_INFO "CPU: Re-enabling disabled Topology Extensions Support.\n" ); } } }
@@ -709,19 +695,12 @@ static void init_amd(struct cpuinfo_x86 *c)* Disable GART TLB Walk Errors on Fam10h. We do this here * because this is always needed when GART is enabled, even in a * kernel which has no MCE support built in. -* BIOS should disable GartTlbWlk Errors themself. If -* it doesn't do it here as suggested by the BKDG. +* BIOS should disable GartTlbWlk Errors already. If +* it doesn't, do it here as suggested by the BKDG. * * Fixes: https://bugzilla.kernel.org/show_bug.cgi?id=33012 */ -u64 mask; -int err; - - err =rdmsrl_safe (MSR_AMD64_MCx_MASK (4 ), &mask); -if (err ==0 ) { - mask |= (1 <<10 ); -wrmsrl_safe (MSR_AMD64_MCx_MASK (4 ), mask); - } +msr_set_bit (MSR_AMD64_MCx_MASK (4 ),10 );/* * On family 10h BIOS may not have properly enabled WC+ support,
@@ -733,10 +712,7 @@ static void init_amd(struct cpuinfo_x86 *c)* NOTE: we want to use the _safe accessors so as not to #GP kvm * guests on older kvm hosts. */ - -rdmsrl_safe (MSR_AMD64_BU_CFG2 , &value); - value &= ~(1ULL <<24 ); -wrmsrl_safe (MSR_AMD64_BU_CFG2 , value); +msr_clear_bit (MSR_AMD64_BU_CFG2 ,24 );if (cpu_has_amd_erratum (c, amd_erratum_383))set_cpu_bug (c,X86_BUG_AMD_TLB_MMATCH );
Signature · 1 line
1.9.0
tip-bot for Borislav Petkov
merge bot[tip:x86/cpu] x86, AMD: Convert to the new bit access MSR accessors
x86, AMD: Convert to the new bit access MSR accessors
Commit-ID: 8f86a7373a1c8ee52d3cc64adf7f2ace13fd24ed Gitweb: http://git.kernel.org/tip/8f86a7373a1c8ee52d3cc64adf7f2ace13fd24ed Author: Borislav Petkov <[email protected]> AuthorDate: Sun, 9 Mar 2014 18:05:24 +0100 Committer: H. Peter Anvin <[email protected]> CommitDate: Thu, 13 Mar 2014 15:35:03 -0700
x86, AMD: Convert to the new bit access MSR accessors
... and save us a bunch of code.
--- arch/x86/kernel/cpu/amd.c | 48 ++++++++++++----------------------------------- 1 file changed, 12 insertions(+), 36 deletions(-)
arch/x86/kernel/cpu/amd.c +12 -36
@@ -233,9 +233,7 @@ static void init_amd_k7(struct cpuinfo_x86 *c)if (c->x86_model >=6 && c->x86_model <=10 ) {if (!cpu_has (c,X86_FEATURE_XMM )) {printk (KERN_INFO "Enabling disabled K7/SSE Support.\n" ); -rdmsr (MSR_K7_HWCR , l, h); - l &= ~0x00008000 ; -wrmsr (MSR_K7_HWCR , l, h); +msr_clear_bit (MSR_K7_HWCR ,15 );set_cpu_cap (c,X86_FEATURE_XMM ); } }
@@ -509,14 +507,8 @@ static void early_init_amd(struct cpuinfo_x86 *c)#endif /* F16h erratum 793, CVE-2013-6885 */ -if (c->x86 ==0x16 && c->x86_model <=0xf ) { -u64 val; - -rdmsrl (MSR_AMD64_LS_CFG , val); -if (!(val &BIT (15 ))) -wrmsrl (MSR_AMD64_LS_CFG , val |BIT (15 )); - } - +if (c->x86 ==0x16 && c->x86_model <=0xf ) +msr_set_bit (MSR_AMD64_LS_CFG ,15 ); }static const int amd_erratum_383[];
@@ -536,11 +528,8 @@ static void init_amd(struct cpuinfo_x86 *c)* Errata 63 for SH-B3 steppings * Errata 122 for all steppings (F+ have it disabled by default) */ -if (c->x86 ==0xf ) { -rdmsrl (MSR_K7_HWCR , value); - value |=1 <<6 ; -wrmsrl (MSR_K7_HWCR , value); - } +if (c->x86 ==0xf ) +msr_set_bit (MSR_K7_HWCR ,6 );#endif early_init_amd (c);
@@ -623,14 +612,11 @@ static void init_amd(struct cpuinfo_x86 *c) (c->x86_model >= 0x10) && (c->x86_model <= 0x1f) && !cpu_has(c, X86_FEATURE_TOPOEXT)) { -if (!rdmsrl_safe (0xc0011005 , &value)) { - value |=1ULL <<54 ; -wrmsrl_safe (0xc0011005 , value); +if (msr_set_bit (0xc0011005 ,54 ) >0 ) {rdmsrl (0xc0011005 , value); -if (value & (1ULL <<54 )) { +if (value &BIT_64 (54 )) {set_cpu_cap (c,X86_FEATURE_TOPOEXT ); - printk(KERN_INFO FW_INFO "CPU: Re-enabling " - "disabled Topology Extensions Support\n"); +pr_info (FW_INFO "CPU: Re-enabling disabled Topology Extensions Support.\n" ); } } }
@@ -709,19 +695,12 @@ static void init_amd(struct cpuinfo_x86 *c)* Disable GART TLB Walk Errors on Fam10h. We do this here * because this is always needed when GART is enabled, even in a * kernel which has no MCE support built in. -* BIOS should disable GartTlbWlk Errors themself. If -* it doesn't do it here as suggested by the BKDG. +* BIOS should disable GartTlbWlk Errors already. If +* it doesn't, do it here as suggested by the BKDG. * * Fixes: https://bugzilla.kernel.org/show_bug.cgi?id=33012 */ -u64 mask; -int err; - - err =rdmsrl_safe (MSR_AMD64_MCx_MASK (4 ), &mask); -if (err ==0 ) { - mask |= (1 <<10 ); -wrmsrl_safe (MSR_AMD64_MCx_MASK (4 ), mask); - } +msr_set_bit (MSR_AMD64_MCx_MASK (4 ),10 );/* * On family 10h BIOS may not have properly enabled WC+ support,
@@ -733,10 +712,7 @@ static void init_amd(struct cpuinfo_x86 *c)* NOTE: we want to use the _safe accessors so as not to #GP kvm * guests on older kvm hosts. */ - -rdmsrl_safe (MSR_AMD64_BU_CFG2 , &value); - value &= ~(1ULL <<24 ); -wrmsrl_safe (MSR_AMD64_BU_CFG2 , value); +msr_clear_bit (MSR_AMD64_BU_CFG2 ,24 );if (cpu_has_amd_erratum (c, amd_erratum_383))set_cpu_bug (c,X86_BUG_AMD_TLB_MMATCH );
Borislav Petkov
maintainerPATCH 3/3 x86, Intel: Convert to the new MSR accessors
In reply to Borislav PetkovFrom: Borislav Petkov <[email protected]>
... and save some lines of code.
--- arch/x86/include/uapi/asm/msr-index.h | 9 ++++++--- arch/x86/kernel/cpu/intel.c | 30 +++++++----------------------- 2 files changed, 13 insertions(+), 26 deletions(-)
arch/x86/include/uapi/asm/msr-index.h +6 -3
@@ -368,14 +368,16 @@#define THERM_LOG_THRESHOLD1 (1 << 9)/* MISC_ENABLE bits: architectural */ -#define MSR_IA32_MISC_ENABLE_FAST_STRING (1ULL << 0) +#define MSR_BIT_FAST_STRING 0 +#define MSR_IA32_MISC_ENABLE_FAST_STRING (1ULL << MSR_BIT_FAST_STRING)#define MSR_IA32_MISC_ENABLE_TCC (1ULL << 1)#define MSR_IA32_MISC_ENABLE_EMON (1ULL << 7)#define MSR_IA32_MISC_ENABLE_BTS_UNAVAIL (1ULL << 11)#define MSR_IA32_MISC_ENABLE_PEBS_UNAVAIL (1ULL << 12)#define MSR_IA32_MISC_ENABLE_ENHANCED_SPEEDSTEP (1ULL << 16)#define MSR_IA32_MISC_ENABLE_MWAIT (1ULL << 18) -#define MSR_IA32_MISC_ENABLE_LIMIT_CPUID (1ULL << 22) +#define MSR_BIT_LIMIT_CPUID 22 +#define MSR_IA32_MISC_ENABLE_LIMIT_CPUID (1ULL << MSR_BIT_LIMIT_CPUID);#define MSR_IA32_MISC_ENABLE_XTPR_DISABLE (1ULL << 23)#define MSR_IA32_MISC_ENABLE_XD_DISABLE (1ULL << 34)
@@ -385,7 +387,8 @@#define MSR_IA32_MISC_ENABLE_SPLIT_LOCK_DISABLE (1ULL << 4)#define MSR_IA32_MISC_ENABLE_L3CACHE_DISABLE (1ULL << 6)#define MSR_IA32_MISC_ENABLE_SUPPRESS_LOCK (1ULL << 8) -#define MSR_IA32_MISC_ENABLE_PREFETCH_DISABLE (1ULL << 9) +#define MSR_BIT_PRF_DIS 9 +#define MSR_IA32_MISC_ENABLE_PREFETCH_DISABLE (1ULL << MSR_BIT_PRF_DIS)#define MSR_IA32_MISC_ENABLE_FERR (1ULL << 10)#define MSR_IA32_MISC_ENABLE_FERR_MULTIPLEX (1ULL << 10)#define MSR_IA32_MISC_ENABLE_TM2 (1ULL << 13)
arch/x86/kernel/cpu/intel.c +7 -23
@@ -31,11 +31,7 @@ static void early_init_intel(struct cpuinfo_x86 *c)/* Unmask CPUID levels if masked: */ if (c->x86 >6 || (c->x86 ==6 && c->x86_model >=0xd )) { -rdmsrl (MSR_IA32_MISC_ENABLE , misc_enable); - -if (misc_enable &MSR_IA32_MISC_ENABLE_LIMIT_CPUID ) { - misc_enable &= ~MSR_IA32_MISC_ENABLE_LIMIT_CPUID ; -wrmsrl (MSR_IA32_MISC_ENABLE , misc_enable); +if (msr_clear_bit (MSR_IA32_MISC_ENABLE ,MSR_BIT_LIMIT_CPUID ) >0 ) { c->cpuid_level =cpuid_eax (0 );get_cpu_cap (c); }
@@ -129,16 +125,9 @@ static void early_init_intel(struct cpuinfo_x86 *c)* Ingo Molnar reported a Pentium D (model 6) and a Xeon * (model 2) with the same problem. */ -if (c->x86 ==15 ) { -rdmsrl (MSR_IA32_MISC_ENABLE , misc_enable); - -if (misc_enable &MSR_IA32_MISC_ENABLE_FAST_STRING ) { -printk (KERN_INFO "kmemcheck: Disabling fast string operations\n" ); - - misc_enable &= ~MSR_IA32_MISC_ENABLE_FAST_STRING ; -wrmsrl (MSR_IA32_MISC_ENABLE , misc_enable); - } - } +if (c->x86 ==15 ) +if (msr_clear_bit (MSR_IA32_MISC_ENABLE ,MSR_BIT_FAST_STRING ) >0 ) +pr_info ("kmemcheck: Disabling fast string operations\n" );#endif /*
@@ -197,8 +186,6 @@ static void intel_smp_check(struct cpuinfo_x86 *c)static void intel_workarounds (struct cpuinfo_x86 *c) { -unsigned long lo, hi; -#ifdef CONFIG_X86_F00F_BUG /* * All current models of Pentium and Pentium with MMX technology CPUs
@@ -229,12 +216,9 @@ static void intel_workarounds(struct cpuinfo_x86 *c)* Hardware prefetcher may cause stale data to be loaded into the cache. */ if ((c->x86 ==15 ) && (c->x86_model ==1 ) && (c->x86_mask ==1 )) { -rdmsr (MSR_IA32_MISC_ENABLE , lo, hi); -if ((lo &MSR_IA32_MISC_ENABLE_PREFETCH_DISABLE ) ==0 ) { -printk (KERN_INFO "CPU: C0 stepping P4 Xeon detected.\n" ); -printk (KERN_INFO "CPU: Disabling hardware prefetching (Errata 037)\n" ); - lo |=MSR_IA32_MISC_ENABLE_PREFETCH_DISABLE ; -wrmsr (MSR_IA32_MISC_ENABLE , lo, hi); +if (msr_set_bit (MSR_IA32_MISC_ENABLE ,MSR_BIT_PRF_DIS ) >0 ) { +pr_info ("CPU: C0 stepping P4 Xeon detected.\n" ); +pr_info ("CPU: Disabling hardware prefetching (Errata 037)\n" ); } }
Signature · 1 line
1.9.0
tip-bot for Borislav Petkov
merge bot[tip:x86/cpu] x86, Intel: Convert to the new bit access MSR accessors
x86, Intel: Convert to the new bit access MSR accessors
Commit-ID: c0a639ad0bc6b178b46996bd1f821a04643e2bde Gitweb: http://git.kernel.org/tip/c0a639ad0bc6b178b46996bd1f821a04643e2bde Author: Borislav Petkov <[email protected]> AuthorDate: Sun, 9 Mar 2014 18:05:25 +0100 Committer: H. Peter Anvin <[email protected]> CommitDate: Thu, 13 Mar 2014 15:35:09 -0700
x86, Intel: Convert to the new bit access MSR accessors
... and save some lines of code.
--- arch/x86/include/uapi/asm/msr-index.h | 9 ++++++--- arch/x86/kernel/cpu/intel.c | 30 +++++++----------------------- 2 files changed, 13 insertions(+), 26 deletions(-)
arch/x86/include/uapi/asm/msr-index.h +6 -3
@@ -368,14 +368,16 @@#define THERM_LOG_THRESHOLD1 (1 << 9)/* MISC_ENABLE bits: architectural */ -#define MSR_IA32_MISC_ENABLE_FAST_STRING (1ULL << 0) +#define MSR_BIT_FAST_STRING 0 +#define MSR_IA32_MISC_ENABLE_FAST_STRING (1ULL << MSR_BIT_FAST_STRING)#define MSR_IA32_MISC_ENABLE_TCC (1ULL << 1)#define MSR_IA32_MISC_ENABLE_EMON (1ULL << 7)#define MSR_IA32_MISC_ENABLE_BTS_UNAVAIL (1ULL << 11)#define MSR_IA32_MISC_ENABLE_PEBS_UNAVAIL (1ULL << 12)#define MSR_IA32_MISC_ENABLE_ENHANCED_SPEEDSTEP (1ULL << 16)#define MSR_IA32_MISC_ENABLE_MWAIT (1ULL << 18) -#define MSR_IA32_MISC_ENABLE_LIMIT_CPUID (1ULL << 22) +#define MSR_BIT_LIMIT_CPUID 22 +#define MSR_IA32_MISC_ENABLE_LIMIT_CPUID (1ULL << MSR_BIT_LIMIT_CPUID);#define MSR_IA32_MISC_ENABLE_XTPR_DISABLE (1ULL << 23)#define MSR_IA32_MISC_ENABLE_XD_DISABLE (1ULL << 34)
@@ -385,7 +387,8 @@#define MSR_IA32_MISC_ENABLE_SPLIT_LOCK_DISABLE (1ULL << 4)#define MSR_IA32_MISC_ENABLE_L3CACHE_DISABLE (1ULL << 6)#define MSR_IA32_MISC_ENABLE_SUPPRESS_LOCK (1ULL << 8) -#define MSR_IA32_MISC_ENABLE_PREFETCH_DISABLE (1ULL << 9) +#define MSR_BIT_PRF_DIS 9 +#define MSR_IA32_MISC_ENABLE_PREFETCH_DISABLE (1ULL << MSR_BIT_PRF_DIS)#define MSR_IA32_MISC_ENABLE_FERR (1ULL << 10)#define MSR_IA32_MISC_ENABLE_FERR_MULTIPLEX (1ULL << 10)#define MSR_IA32_MISC_ENABLE_TM2 (1ULL << 13)
arch/x86/kernel/cpu/intel.c +7 -23
@@ -31,11 +31,7 @@ static void early_init_intel(struct cpuinfo_x86 *c)/* Unmask CPUID levels if masked: */ if (c->x86 >6 || (c->x86 ==6 && c->x86_model >=0xd )) { -rdmsrl (MSR_IA32_MISC_ENABLE , misc_enable); - -if (misc_enable &MSR_IA32_MISC_ENABLE_LIMIT_CPUID ) { - misc_enable &= ~MSR_IA32_MISC_ENABLE_LIMIT_CPUID ; -wrmsrl (MSR_IA32_MISC_ENABLE , misc_enable); +if (msr_clear_bit (MSR_IA32_MISC_ENABLE ,MSR_BIT_LIMIT_CPUID ) >0 ) { c->cpuid_level =cpuid_eax (0 );get_cpu_cap (c); }
@@ -129,16 +125,9 @@ static void early_init_intel(struct cpuinfo_x86 *c)* Ingo Molnar reported a Pentium D (model 6) and a Xeon * (model 2) with the same problem. */ -if (c->x86 ==15 ) { -rdmsrl (MSR_IA32_MISC_ENABLE , misc_enable); - -if (misc_enable &MSR_IA32_MISC_ENABLE_FAST_STRING ) { -printk (KERN_INFO "kmemcheck: Disabling fast string operations\n" ); - - misc_enable &= ~MSR_IA32_MISC_ENABLE_FAST_STRING ; -wrmsrl (MSR_IA32_MISC_ENABLE , misc_enable); - } - } +if (c->x86 ==15 ) +if (msr_clear_bit (MSR_IA32_MISC_ENABLE ,MSR_BIT_FAST_STRING ) >0 ) +pr_info ("kmemcheck: Disabling fast string operations\n" );#endif /*
@@ -197,8 +186,6 @@ static void intel_smp_check(struct cpuinfo_x86 *c)static void intel_workarounds (struct cpuinfo_x86 *c) { -unsigned long lo, hi; -#ifdef CONFIG_X86_F00F_BUG /* * All current models of Pentium and Pentium with MMX technology CPUs
@@ -229,12 +216,9 @@ static void intel_workarounds(struct cpuinfo_x86 *c)* Hardware prefetcher may cause stale data to be loaded into the cache. */ if ((c->x86 ==15 ) && (c->x86_model ==1 ) && (c->x86_mask ==1 )) { -rdmsr (MSR_IA32_MISC_ENABLE , lo, hi); -if ((lo &MSR_IA32_MISC_ENABLE_PREFETCH_DISABLE ) ==0 ) { -printk (KERN_INFO "CPU: C0 stepping P4 Xeon detected.\n" ); -printk (KERN_INFO "CPU: Disabling hardware prefetching (Errata 037)\n" ); - lo |=MSR_IA32_MISC_ENABLE_PREFETCH_DISABLE ; -wrmsr (MSR_IA32_MISC_ENABLE , lo, hi); +if (msr_set_bit (MSR_IA32_MISC_ENABLE ,MSR_BIT_PRF_DIS ) >0 ) { +pr_info ("CPU: C0 stepping P4 Xeon detected.\n" ); +pr_info ("CPU: Disabling hardware prefetching (Errata 037)\n" ); } }