[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20220221135334.zzcozxu6vyskxjzo@black.fi.intel.com>
Date: Mon, 21 Feb 2022 16:53:34 +0300
From: "Kirill A. Shutemov" <kirill.shutemov@...ux.intel.com>
To: Cyrill Gorcunov <gorcunov@...il.com>
Cc: tglx@...utronix.de, mingo@...hat.com, bp@...en8.de,
dave.hansen@...el.com, luto@...nel.org, peterz@...radead.org,
sathyanarayanan.kuppuswamy@...ux.intel.com, aarcange@...hat.com,
ak@...ux.intel.com, dan.j.williams@...el.com, david@...hat.com,
hpa@...or.com, jgross@...e.com, jmattson@...gle.com,
joro@...tes.org, jpoimboe@...hat.com, knsathya@...nel.org,
pbonzini@...hat.com, sdeep@...are.com, seanjc@...gle.com,
tony.luck@...el.com, vkuznets@...hat.com, wanpengli@...cent.com,
x86@...nel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCHv3 13/32] x86/tdx: Detect TDX at early kernel
decompression time
On Mon, Feb 21, 2022 at 02:37:29PM +0300, Cyrill Gorcunov wrote:
> On Fri, Feb 18, 2022 at 07:16:59PM +0300, Kirill A. Shutemov wrote:
> ...
> >
> > +
> > +void early_tdx_detect(void)
> > +{
> > + u32 eax, sig[3];
> > +
> > + cpuid_count(TDX_CPUID_LEAF_ID, 0, &eax, &sig[0], &sig[2], &sig[1]);
> > +
> > + if (memcmp(TDX_IDENT, sig, 12))
> > + return;
>
> Maybe worth to guard ourself, like
>
> BUILD_BUG_ON(sizeof(sig) != (sizeof(TDX_IDENT)-1));
> if (memcmp(TDX_IDENT, sig, sizeof(sig))
> return;
Sure. Will do.
--
Kirill A. Shutemov
Powered by blists - more mailing lists