[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <YKKzCOW9u6q06E5I@google.com>
Date: Mon, 17 May 2021 18:16:40 +0000
From: Sean Christopherson <seanjc@...gle.com>
To: Andi Kleen <ak@...ux.intel.com>
Cc: Dave Hansen <dave.hansen@...el.com>,
"Kuppuswamy, Sathyanarayanan"
<sathyanarayanan.kuppuswamy@...ux.intel.com>,
"Kirill A. Shutemov" <kirill@...temov.name>,
Peter Zijlstra <peterz@...radead.org>,
Andy Lutomirski <luto@...nel.org>,
Dan Williams <dan.j.williams@...el.com>,
Tony Luck <tony.luck@...el.com>,
Kirill Shutemov <kirill.shutemov@...ux.intel.com>,
Kuppuswamy Sathyanarayanan <knsathya@...nel.org>,
Raj Ashok <ashok.raj@...el.com>, linux-kernel@...r.kernel.org
Subject: Re: [RFC v2 26/32] x86/mm: Move force_dma_unencrypted() to common
code
On Thu, May 13, 2021, Andi Kleen wrote:
>
> On 5/13/2021 10:49 AM, Dave Hansen wrote:
> > On 5/13/21 9:40 AM, Kuppuswamy, Sathyanarayanan wrote:
> > > +#define PROTECTED_GUEST_BITMAP_LEN 128
> > > +
> > > +/* Protected Guest vendor types */
> > > +#define GUEST_TYPE_TDX (1)
> > > +#define GUEST_TYPE_SEV (2)
> > > +
> > > +/* Protected Guest features */
> > > +#define MEMORY_ENCRYPTION (20)
> > I was assuming we'd reuse the X86_FEATURE infrastructure somehow. Is
> > there a good reason not to?
>
> This for generic code. Would be a gigantic lift and lots of refactoring to
> move that out.
What generic code needs access to SEV vs. TDX? force_dma_unencrypted() is called
from generic code, but its implementation is x86 specific.
> > That gives us all the compile-time optimization (via
> > en/disabled-features.h) and static branches for "free".
>
> There's no user so far which is anywhere near performance critical, so that
> would be total overkil
SEV already has the sev_enable_key static key that it uses for unrolling string
I/O, so there's at least one (debatable) case that wants to use static branches.
For SEV-ES and TDX, there's a better argument as using X86_FEATURE_* would unlock
alternatives.
> BTW right now I'm not even sure we need the bitmap for anything, but I guess
> it doesn't hurt.
>
> -Andi
>
>
Powered by blists - more mailing lists