From: Chuck Anderson Date: Mon, 26 Feb 2018 09:27:37 +0000 (-0800) Subject: retpoline: display IBPB feature status along with IBRS status X-Git-Tag: v4.1.12-124.31.3~1105 X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=d550e0c92e1987991428a4233e91a84f7bccbe03;p=users%2Fjedix%2Flinux-maple.git retpoline: display IBPB feature status along with IBRS status retpoline_enabled() lists if the IBRS mitigation is in use and if the kernel was compiled with retpoline. Add whether IBPB is in use to the list. Orabug: 27625404 Signed-off-by: Chuck Anderson Reviewed-by: Konrad Rzeszutek Wilk Reviewed-by: Darren Kenny --- diff --git a/arch/x86/kernel/cpu/bugs_64.c b/arch/x86/kernel/cpu/bugs_64.c index 21cad468d13e..30279fe2976f 100644 --- a/arch/x86/kernel/cpu/bugs_64.c +++ b/arch/x86/kernel/cpu/bugs_64.c @@ -431,8 +431,9 @@ retpoline_auto: mode = retp_compiler() ? SPECTRE_V2_RETPOLINE_GENERIC : SPECTRE_V2_RETPOLINE_MINIMAL; - pr_info("Options: %s%s\n", + pr_info("Options: %s%s%s\n", check_ibrs_inuse() ? "IBRS " : "", + check_ibpb_inuse() ? "IBPB " : "", retp_compiler() ? "retpoline" : ""); /* IBRS available. Lets see if we are compiled with retpoline. */ diff --git a/arch/x86/kernel/cpu/scattered.c b/arch/x86/kernel/cpu/scattered.c index 67a1ea0173d0..5d0cd6bcc459 100644 --- a/arch/x86/kernel/cpu/scattered.c +++ b/arch/x86/kernel/cpu/scattered.c @@ -161,16 +161,19 @@ void init_scattered_cpuid_features(struct cpuinfo_x86 *c, ignore = true; if (boot_cpu_has(X86_FEATURE_IBRS)) { - printk(KERN_INFO "FEATURE SPEC_CTRL Present%s\n", ignore ? " but ignored (Xen)": ""); - if (ignore) - return; - } else if (boot_cpu_has(X86_FEATURE_IBPB)) { - printk_once(KERN_INFO "FEATURE IBPB Present%s\n", ignore ? " but ignored (Xen)": ""); - if (ignore) - return; + printk_once(KERN_INFO "FEATURE SPEC_CTRL Present%s\n", + ignore ? " but ignored (Xen)": ""); } else { printk(KERN_INFO "FEATURE SPEC_CTRL Not Present\n"); } + if (boot_cpu_has(X86_FEATURE_IBPB)) { + printk_once(KERN_INFO "FEATURE IBPB Present%s\n", + ignore ? " but ignored (Xen)": ""); + } else { + printk(KERN_INFO "FEATURE IBPB Not Present\n"); + } + if (ignore) + return; } if ((cpu_has(c, X86_FEATURE_IBRS) ||