52 lines
1.8 KiB
Diff
52 lines
1.8 KiB
Diff
From: Pawan Gupta <pawan.kumar.gupta@linux.intel.com>
|
|
Date: Wed, 23 Oct 2019 10:52:35 +0200
|
|
Subject: x86/cpu: Add a helper function x86_read_arch_cap_msr()
|
|
|
|
Add a helper function to read the IA32_ARCH_CAPABILITIES MSR.
|
|
|
|
Signed-off-by: Pawan Gupta <pawan.kumar.gupta@linux.intel.com>
|
|
Signed-off-by: Borislav Petkov <bp@suse.de>
|
|
Reviewed-by: Mark Gross <mgross@linux.intel.com>
|
|
Reviewed-by: Tony Luck <tony.luck@intel.com>
|
|
Tested-by: Neelima Krishnan <neelima.krishnan@intel.com>
|
|
Cc: Andy Lutomirski <luto@kernel.org>
|
|
Cc: "H. Peter Anvin" <hpa@zytor.com>
|
|
Cc: Ingo Molnar <mingo@redhat.com>
|
|
Cc: Peter Zijlstra <peterz@infradead.org>
|
|
Cc: Thomas Gleixner <tglx@linutronix.de>
|
|
Cc: x86-ml <x86@kernel.org>
|
|
[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);
|