46 lines
1.6 KiB
Diff
46 lines
1.6 KiB
Diff
From: speck for Pawan Gupta <speck@linutronix.de>
|
|
Date: Wed, 9 Oct 2019 16:23:56 -0700
|
|
Subject: TAAv6 2
|
|
|
|
Add a helper function to read IA32_ARCH_CAPABILITIES MSR. If the CPU
|
|
doesn't support this MSR return 0.
|
|
|
|
Signed-off-by: Pawan Gupta <pawan.kumar.gupta@linux.intel.com>
|
|
Reviewed-by: Mark Gross <mgross@linux.intel.com>
|
|
Reviewed-by: Tony Luck <tony.luck@intel.com>
|
|
Tested-by: Neelima Krishnan <neelima.krishnan@intel.com>
|
|
[bwh: Forward-ported on top of NX: Fix conflict (neighbouring changes)
|
|
in arch/x86/kernel/cpu/common.c]
|
|
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
|
|
---
|
|
arch/x86/kernel/cpu/common.c | 11 +++++++++--
|
|
1 file changed, 9 insertions(+), 2 deletions(-)
|
|
|
|
diff --git a/arch/x86/kernel/cpu/common.c b/arch/x86/kernel/cpu/common.c
|
|
index 128808dccd2f..cee109bd7f00 100644
|
|
--- a/arch/x86/kernel/cpu/common.c
|
|
+++ b/arch/x86/kernel/cpu/common.c
|
|
@@ -1018,13 +1018,20 @@ static bool __init cpu_matches(unsigned long which)
|
|
return m && !!(m->driver_data & which);
|
|
}
|
|
|
|
-static void __init cpu_set_bug_bits(struct cpuinfo_x86 *c)
|
|
+u64 x86_read_arch_cap_msr(void)
|
|
{
|
|
u64 ia32_cap = 0;
|
|
|
|
- if (cpu_has(c, X86_FEATURE_ARCH_CAPABILITIES))
|
|
+ if (boot_cpu_has(X86_FEATURE_ARCH_CAPABILITIES))
|
|
rdmsrl(MSR_IA32_ARCH_CAPABILITIES, ia32_cap);
|
|
|
|
+ return ia32_cap;
|
|
+}
|
|
+
|
|
+static void __init cpu_set_bug_bits(struct cpuinfo_x86 *c)
|
|
+{
|
|
+ u64 ia32_cap = x86_read_arch_cap_msr();
|
|
+
|
|
/* Set ITLB_MULTIHIT bug if cpu is not in the whitelist and not mitigated */
|
|
if (!cpu_matches(NO_ITLB_MULTIHIT) && !(ia32_cap & ARCH_CAP_PSCHANGE_MC_NO))
|
|
setup_force_cpu_bug(X86_BUG_ITLB_MULTIHIT);
|