[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <3dbc579b2a3163de983547351c9563a495b1234b.camel@intel.com>
Date: Mon, 30 Jun 2025 11:34:21 +0000
From: "Huang, Kai" <kai.huang@...el.com>
To: "thomas.lendacky@....com" <thomas.lendacky@....com>, "bp@...en8.de"
<bp@...en8.de>
CC: "kvm@...r.kernel.org" <kvm@...r.kernel.org>, "ashish.kalra@....com"
<ashish.kalra@....com>, "Hansen, Dave" <dave.hansen@...el.com>,
"kirill.shutemov@...ux.intel.com" <kirill.shutemov@...ux.intel.com>, "Chatre,
Reinette" <reinette.chatre@...el.com>, "seanjc@...gle.com"
<seanjc@...gle.com>, "pbonzini@...hat.com" <pbonzini@...hat.com>,
"mingo@...hat.com" <mingo@...hat.com>, "Yamahata, Isaku"
<isaku.yamahata@...el.com>, "linux-kernel@...r.kernel.org"
<linux-kernel@...r.kernel.org>, "tglx@...utronix.de" <tglx@...utronix.de>,
"nik.borisov@...e.com" <nik.borisov@...e.com>, "hpa@...or.com"
<hpa@...or.com>, "peterz@...radead.org" <peterz@...radead.org>,
"sagis@...gle.com" <sagis@...gle.com>, "Edgecombe, Rick P"
<rick.p.edgecombe@...el.com>, "x86@...nel.org" <x86@...nel.org>, "Williams,
Dan J" <dan.j.williams@...el.com>
Subject: Re: [PATCH v3 1/6] x86/sme: Use percpu boolean to control wbinvd
during kexec
On Sat, 2025-06-28 at 12:04 -0500, Tom Lendacky wrote:
> On 6/28/25 07:50, Borislav Petkov wrote:
> > On Thu, Jun 26, 2025 at 10:48:47PM +1200, Kai Huang wrote:
> >
>
> > > + * support SME. This provides support for performing a successful
> > > + * kexec when going from SME inactive to SME active (or vice-versa).
> > > + *
> > > + * The cache must be cleared so that if there are entries with the
> > > + * same physical address, both with and without the encryption bit,
> > > + * they don't race each other when flushed and potentially end up
> > > + * with the wrong entry being committed to memory.
> > > + *
> > > + * Test the CPUID bit directly because the machine might've cleared
> > > + * X86_FEATURE_SME due to cmdline options.
> >
> > Where?
> >
> > That same function does the clearing later...
>
> I think he means that if this function does clear X86_FEATURE_SME during
> the BSP boot, then when the APs boot they won't see the feature set, so
> you have to check the CPUID information directly. So maybe that can better
> worded.
>
> I did verify that booting with mem_encrypt=off will start with
> X86_FEATURE_SME set, the BSP will clear it and then all APs will not see
> it set after that.
I think I actually mean it could be cleared by 'clearcpuid' commandline. :-)
IIUC the AP taking out feature bits that are not set in BSP happens at the
end of identify_cpu(), so it happens after early_detect_mem_encrypt(), which
is called in init_amd().
So the mem_encrypt=off will eventually clear the X86_FEATURE_SME, but when
early_detect_mem_encrypt() for BSP and AP, IIRC it will still see the
X86_FEATURE_SME bit.
But IIUC the 'clearcpuid' commandline could still just make
early_detect_mem_encrypt() unable to see X86_FEATURE_SME bit on the SME
capable platform.
Powered by blists - more mailing lists