[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <871r4j4fix.ffs@tglx>
Date: Sun, 17 Oct 2021 21:28:38 +0200
From: Thomas Gleixner <tglx@...utronix.de>
To: Kuppuswamy Sathyanarayanan
<sathyanarayanan.kuppuswamy@...ux.intel.com>,
Ingo Molnar <mingo@...hat.com>, Borislav Petkov <bp@...en8.de>,
x86@...nel.org, Paolo Bonzini <pbonzini@...hat.com>,
David Hildenbrand <david@...hat.com>,
Andrea Arcangeli <aarcange@...hat.com>,
Josh Poimboeuf <jpoimboe@...hat.com>,
"H . Peter Anvin" <hpa@...or.com>
Cc: Dave Hansen <dave.hansen@...el.com>,
Tony Luck <tony.luck@...el.com>,
Dan Williams <dan.j.williams@...el.com>,
Andi Kleen <ak@...ux.intel.com>,
Kirill Shutemov <kirill.shutemov@...ux.intel.com>,
Sean Christopherson <seanjc@...gle.com>,
Kuppuswamy Sathyanarayanan <knsathya@...nel.org>,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH v7 02/10] x86/tdx: Add early_is_tdx_guest() interface
On Tue, Oct 05 2021 at 13:41, Kuppuswamy Sathyanarayanan wrote:
> +
> +#define TDX_CPUID_LEAF_ID 0x21
> +
> +static int tdx_guest = -1;
> +
> +static inline bool early_cpuid_has_tdx_guest(void)
> +{
> + u32 eax = TDX_CPUID_LEAF_ID, sig[3] = {0};
> +
> + if (cpuid_eax(0) < TDX_CPUID_LEAF_ID)
> + return false;
> +
> + cpuid_count(TDX_CPUID_LEAF_ID, 0, &eax, &sig[0], &sig[2], &sig[1]);
> +
> + return !memcmp("IntelTDX ", sig, 12);
> +}
> +
> +bool early_is_tdx_guest(void)
> +{
> + if (tdx_guest < 0)
> + tdx_guest = early_cpuid_has_tdx_guest();
> +
> + return !!tdx_guest;
> +}
Sigh.
Powered by blists - more mailing lists