From: Alexandre Chartre Date: Tue, 16 Oct 2018 18:19:46 +0000 (+0200) Subject: x86/speculation: Retpoline should always be available on Skylake X-Git-Tag: v4.1.12-124.31.3~460 X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=7970e78bdfee4108e6aa6c0a9ec520aa0639fa92;p=users%2Fjedix%2Flinux-maple.git x86/speculation: Retpoline should always be available on Skylake 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 Reviewed-by: Jamie Iles Reviewed-by: Mihai Carabas Reviewed-by: Zhenzhong Duan (cherry picked from UEK5 commit 7bbc586ac477df24012552712df10ab9ae300919) Orabug: 28801831 Signed-off-by: Alexandre Chartre Reviewed-by: Jamie Iles Reviewed-by: Mihai Carabas Reviewed-by: Zhenzhong Duan Signed-off-by: Brian Maly --- diff --git a/arch/x86/kernel/cpu/bugs_64.c b/arch/x86/kernel/cpu/bugs_64.c index bcf8bfd5adcf..7024d2908e77 100644 --- a/arch/x86/kernel/cpu/bugs_64.c +++ b/arch/x86/kernel/cpu/bugs_64.c @@ -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: diff --git a/arch/x86/kernel/cpu/spec_ctrl.c b/arch/x86/kernel/cpu/spec_ctrl.c index ad0958166f35..bbc18f59da46 100644 --- a/arch/x86/kernel/cpu/spec_ctrl.c +++ b/arch/x86/kernel/cpu/spec_ctrl.c @@ -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");