]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
x86: Move IBRS/IBPB feature detection to scattered.c
authorTim Chen <tim.c.chen@linux.intel.com>
Mon, 18 Dec 2017 18:16:26 +0000 (10:16 -0800)
committerKirtikar Kashyap <kirtikar.kashyap@oracle.com>
Fri, 12 Jan 2018 18:19:57 +0000 (10:19 -0800)
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 <tim.c.chen@linux.intel.com>
Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Reviewed-by: John Haxby <john.haxby@oracle.com>
Signed-off-by: Kirtikar Kashyap <kirtikar.kashyap@oracle.com>
arch/x86/kernel/cpu/intel.c
arch/x86/kernel/cpu/scattered.c

index f7c0167db1f714a184ce5343bf5549079ad174f0..50163fa9034f0d2f4db28767432a249ad9e0cb35 100644 (file)
@@ -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
index a903a94900c5a55cbaaa4ee70b6bbe69639f9729..77f1e0327d75f05981fda0a349774864ee7a8027 100644 (file)
@@ -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");
+               }
+       }
 }