[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <696ea7fe-3294-f21b-3bc0-3f8cc0a718e9@intel.com>
Date: Mon, 12 Jun 2023 08:39:23 -0700
From: Dave Hansen <dave.hansen@...el.com>
To: Michael Roth <michael.roth@....com>, kvm@...r.kernel.org
Cc: linux-coco@...ts.linux.dev, linux-mm@...ck.org,
linux-crypto@...r.kernel.org, x86@...nel.org,
linux-kernel@...r.kernel.org, tglx@...utronix.de, mingo@...hat.com,
jroedel@...e.de, thomas.lendacky@....com, hpa@...or.com,
ardb@...nel.org, pbonzini@...hat.com, seanjc@...gle.com,
vkuznets@...hat.com, jmattson@...gle.com, luto@...nel.org,
dave.hansen@...ux.intel.com, slp@...hat.com, pgonda@...gle.com,
peterz@...radead.org, srinivas.pandruvada@...ux.intel.com,
rientjes@...gle.com, dovmurik@...ux.ibm.com, tobin@....com,
bp@...en8.de, vbabka@...e.cz, kirill@...temov.name,
ak@...ux.intel.com, tony.luck@...el.com, marcorr@...gle.com,
sathyanarayanan.kuppuswamy@...ux.intel.com, alpergun@...gle.com,
dgilbert@...hat.com, jarkko@...nel.org, ashish.kalra@....com,
nikunj.dadhania@....com, liam.merwick@...cle.com,
zhi.a.wang@...el.com, Kim Phillips <kim.phillips@....com>
Subject: Re: [PATCH RFC v9 08/51] x86/speculation: Do not enable Automatic
IBRS if SEV SNP is enabled
On 6/11/23 21:25, Michael Roth wrote:
> A hardware limitation prevents the host from enabling Automatic IBRS
> when SNP is enabled. Instead, fall back to retpolines.
"Hardware limitation"? As in, it is a documented, architectural
restriction? Or, it's a CPU bug?
> diff --git a/arch/x86/kernel/cpu/bugs.c b/arch/x86/kernel/cpu/bugs.c
> index f9d060e71c3e..3fba3623ff64 100644
> --- a/arch/x86/kernel/cpu/bugs.c
> +++ b/arch/x86/kernel/cpu/bugs.c
> @@ -1507,7 +1507,12 @@ static void __init spectre_v2_select_mitigation(void)
>
> if (spectre_v2_in_ibrs_mode(mode)) {
> if (boot_cpu_has(X86_FEATURE_AUTOIBRS)) {
> - msr_set_bit(MSR_EFER, _EFER_AUTOIBRS);
> + if (!cpu_feature_enabled(X86_FEATURE_SEV_SNP)) {
> + msr_set_bit(MSR_EFER, _EFER_AUTOIBRS);
> + } else {
> + pr_err("SNP feature available, not enabling AutoIBRS on the host.\n");
> + mode = spectre_v2_select_retpoline();
> + }
I think this would be nicer if you did something like:
if (cpu_feature_enabled(X86_FEATURE_SEV_SNP))
setup_clear_cpu_cap(X86_FEATURE_AUTOIBRS);
somewhere _else_ in the code instead of smack-dab in the middle of the
mitigation selection.
Powered by blists - more mailing lists