[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <YQsX54MPVYFuLmFr@google.com>
Date: Wed, 4 Aug 2021 22:42:47 +0000
From: Sean Christopherson <seanjc@...gle.com>
To: "Kuppuswamy, Sathyanarayanan"
<sathyanarayanan.kuppuswamy@...ux.intel.com>
Cc: Dave Hansen <dave.hansen@...el.com>,
Thomas Gleixner <tglx@...utronix.de>,
Ingo Molnar <mingo@...hat.com>, Borislav Petkov <bp@...en8.de>,
Peter Zijlstra <peterz@...radead.org>,
Andy Lutomirski <luto@...nel.org>,
Peter H Anvin <hpa@...or.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>,
Kuppuswamy Sathyanarayanan <knsathya@...nel.org>,
x86@...nel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH v5 04/12] x86/tdx: Add protected guest support for TDX
guest
On Wed, Aug 04, 2021, Kuppuswamy, Sathyanarayanan wrote:
>
> On 8/4/21 3:03 PM, Dave Hansen wrote:
> > > > +#include <asm/processor.h>
> > > > +#include <asm/tdx.h>
> > > > +
> > > > #ifndef __ASSEMBLY__
> > > > static inline bool prot_guest_has(unsigned int attr)
> > > > {
> > > > if (sme_me_mask)
> > > > return amd_prot_guest_has(attr);
> > > > + else if (boot_cpu_data.x86_vendor == X86_VENDOR_INTEL)
> > > Why not "boot_cpu_has(X86_FEATURE_TDX_GUEST)"?
> > Even better: cpu_feature_enabled(X86_FEATURE_TDX_GUEST). That gets you
> > both static patching*and* compile-time optimization if you hook
Ah, I keep forgetting it can be compiled out.
> > X86_FEATURE_TDX_GUEST into disabled-features.h.
>
> This is how Borislav preferred it. tdx_prot_guest_has() internally uses
> cpu_feature_enabled(X86_FEATURE_TDX_GUEST) to return the status.
>
> I think the intention is to keep the first call generic (non TDX
> specific). So that it can be extended for other use cases.
What other possible use case is there for invoking tdx_prot_guest_has() beyond
running as a TDX guest? If it were e.g. intel_prot_guest_has() then I would at
least understand the code, if not agree with the sub-optimal approach, but as is
it makes no sense.
Given amd_prot_guest_has(), my guess is Boris intended intel_prot_guest_has()...
Powered by blists - more mailing lists