From 6a79d01eaf3790c256ab851125d5c9b9736c3801 Mon Sep 17 00:00:00 2001 From: Tim Chen Date: Mon, 18 Dec 2017 10:16:26 -0800 Subject: [PATCH] x86: Move IBRS/IBPB feature detection to scattered.c Move IBRS/IBPB to scattered features for easier feature rescan. This help to rescan feature on microcode reload later. Orabug: 27344012 CVE: CVE-2017-5715 Signed-off-by: Tim Chen Signed-off-by: Konrad Rzeszutek Wilk Reviewed-by: John Haxby Signed-off-by: Kirtikar Kashyap --- arch/x86/kernel/cpu/intel.c | 14 -------------- arch/x86/kernel/cpu/scattered.c | 14 ++++++++++++++ 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/arch/x86/kernel/cpu/intel.c b/arch/x86/kernel/cpu/intel.c index f7c0167db1f71..50163fa9034f0 100644 --- a/arch/x86/kernel/cpu/intel.c +++ b/arch/x86/kernel/cpu/intel.c @@ -493,20 +493,6 @@ static void init_intel(struct cpuinfo_x86 *c) wrmsrl(MSR_IA32_ENERGY_PERF_BIAS, epb); } } - - if (!c->cpu_index) { - if (boot_cpu_has(X86_FEATURE_SPEC_CTRL)) { - printk(KERN_INFO "FEATURE SPEC_CTRL Present\n"); - set_ibrs_supported(); - set_ibpb_supported(); - if (ibrs_inuse) - sysctl_ibrs_enabled = 1; - if (ibpb_inuse) - sysctl_ibpb_enabled = 1; - } else { - printk(KERN_INFO "FEATURE SPEC_CTRL Not Present\n"); - } - } } #ifdef CONFIG_X86_32 diff --git a/arch/x86/kernel/cpu/scattered.c b/arch/x86/kernel/cpu/scattered.c index a903a94900c5a..77f1e0327d75f 100644 --- a/arch/x86/kernel/cpu/scattered.c +++ b/arch/x86/kernel/cpu/scattered.c @@ -84,4 +84,18 @@ void init_scattered_cpuid_features(struct cpuinfo_x86 *c) if (cap & 2) /* IBRS all the time */ set_cpu_cap(c, X86_FEATURE_IBRS_ATT); } + + if (!c->cpu_index) { + if (boot_cpu_has(X86_FEATURE_SPEC_CTRL)) { + printk(KERN_INFO "FEATURE SPEC_CTRL Present\n"); + set_ibrs_supported(); + set_ibpb_supported(); + if (ibrs_inuse) + sysctl_ibrs_enabled = 1; + if (ibpb_inuse) + sysctl_ibpb_enabled = 1; + } else { + printk(KERN_INFO "FEATURE SPEC_CTRL Not Present\n"); + } + } } -- 2.50.1