]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
x86/speculation: Retpoline should always be available on Skylake
authorAlexandre Chartre <alexandre.chartre@oracle.com>
Tue, 16 Oct 2018 18:19:46 +0000 (20:19 +0200)
committerBrian Maly <brian.maly@oracle.com>
Tue, 23 Oct 2018 19:14:57 +0000 (15:14 -0400)
Now that we can dynamically toggle retpoline on or off, retpoline
should always be available even on Skylake platforms, without
having to explicitly select retpoline at boot time.

Signed-off-by: Alexandre Chartre <alexandre.chartre@oracle.com>
Reviewed-by: Jamie Iles <jamie.iles@oracle.com>
Reviewed-by: Mihai Carabas <mihai.carabas@oracle.com>
Reviewed-by: Zhenzhong Duan <zhenzhong.duan@oracle.com>
(cherry picked from UEK5 commit 7bbc586ac477df24012552712df10ab9ae300919)

Orabug: 28801831

Signed-off-by: Alexandre Chartre <alexandre.chartre@oracle.com>
Reviewed-by: Jamie Iles <jamie.iles@oracle.com>
Reviewed-by: Mihai Carabas <mihai.carabas@oracle.com>
Reviewed-by: Zhenzhong Duan <zhenzhong.duan@oracle.com>
Signed-off-by: Brian Maly <brian.maly@oracle.com>
arch/x86/kernel/cpu/bugs_64.c
arch/x86/kernel/cpu/spec_ctrl.c

index bcf8bfd5adcf0030a8146b27fca2fd1aaa822832..7024d2908e778f01c1b2246f9f84849035714fe5 100644 (file)
@@ -435,13 +435,8 @@ static void retpoline_init(void)
         * Set the retpoline capability to advertise that that retpoline
         * is available, however the retpoline feature is enabled via
         * the retpoline_enabled_key static key.
-        *
-        * By default, we don't provide retpoline on Skylake. However,
-        * the feature will be provided if it is selected from the boot
-        * sequence.
         */
-       if (!is_skylake_era())
-               setup_force_cpu_cap(X86_FEATURE_RETPOLINE);
+       setup_force_cpu_cap(X86_FEATURE_RETPOLINE);
 
        if (boot_cpu_data.x86_vendor == X86_VENDOR_AMD) {
                if (!boot_cpu_has(X86_FEATURE_LFENCE_RDTSC))
@@ -769,14 +764,6 @@ static void __init spectre_v2_select_mitigation(void)
                }
        }
 
-       /*
-        * We are enabling retpoline so advertise the retpoline feature.
-        * This only needs to be done for Skylake because the feature
-        * is already provided on other platforms.
-        */
-       if (is_skylake_era())
-               setup_force_cpu_cap(X86_FEATURE_RETPOLINE);
-
        retpoline_enable();
 
 display:
index ad0958166f3590705352ecdac6e3e8ef8a153b9d..bbc18f59da463d4cc02e8068ac7d0dab439eab2c 100644 (file)
@@ -201,16 +201,6 @@ static ssize_t retpoline_enabled_write(struct file *file,
        if (enable > 1)
                return -EINVAL;
 
-       /*
-        * The retpoline feature is always present except on Skylake
-        * if the system wasn't explicitly booted with retpoline.
-        */
-       if (enable && !boot_cpu_has(X86_FEATURE_RETPOLINE)) {
-               pr_warn("Retpoline is disabled by default on Skylake-generation system.\n");
-               pr_warn("Use the 'spectre_v2=retpoline' parameter to boot with retpoline.\n");
-               return -EINVAL;
-       }
-
        if (enable) {
                if (test_taint(TAINT_NO_RETPOLINE))
                        pr_warn("Enabling retpoline with a module not compiled with retpoline compiler.\n");