[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <dfb6b319-97ad-4c16-67ae-de4ce4ef415b@amd.com>
Date: Wed, 2 Jun 2021 13:19:07 -0500
From: Tom Lendacky <thomas.lendacky@....com>
To: Kuppuswamy Sathyanarayanan
<sathyanarayanan.kuppuswamy@...ux.intel.com>,
Peter Zijlstra <peterz@...radead.org>,
Andy Lutomirski <luto@...nel.org>,
Dave Hansen <dave.hansen@...el.com>,
Tony Luck <tony.luck@...el.com>, Borislav Petkov <bp@...en8.de>
Cc: Andi Kleen <ak@...ux.intel.com>,
Kirill Shutemov <kirill.shutemov@...ux.intel.com>,
Kuppuswamy Sathyanarayanan <knsathya@...nel.org>,
Dan Williams <dan.j.williams@...el.com>,
Raj Ashok <ashok.raj@...el.com>,
Sean Christopherson <seanjc@...gle.com>,
linux-kernel@...r.kernel.org
Subject: Re: [RFC v2-fix-v2 1/1] x86: Introduce generic protected guest
abstraction
On 6/1/21 4:14 PM, Kuppuswamy Sathyanarayanan wrote:
> Add a generic way to check if we run with an encrypted guest,
> without requiring x86 specific ifdefs. This can then be used in
> non architecture specific code.
>
> protected_guest_has() is used to check for protected guest
> feature flags.
>
> Originally-by: Andi Kleen <ak@...ux.intel.com>
> Signed-off-by: Kuppuswamy Sathyanarayanan <sathyanarayanan.kuppuswamy@...ux.intel.com>
> ---
> Changes since RFC v2-fix-v1:
> * Changed the title from "tdx: Introduce generic protected_guest
> abstraction" to "x86: Introduce generic protected guest"
> * Removed usage of ARCH_HAS_PROTECTED_GUEST and directly called TDX
> and AMD specific xx_protected_guest_has() variants from
> linux/protected_guest.h.
> * Added support for amd_protected_guest_has() helper function.
> * Removed redundant is_tdx_guest() check in tdx_protected_guest_has()
> function.
> * Fixed commit log to reflect the latest changes.
...
>
> +bool amd_protected_guest_has(unsigned long flag)
> +{
> + switch (flag) {
> + case VM_MEM_ENCRYPT:
> + case VM_MEM_ENCRYPT_ACTIVE:
> + return true;
> + }
> +
> + return false;
> +}
> +EXPORT_SYMBOL_GPL(amd_protected_guest_has);
This certainly doesn't capture all of the situations where true would need
to be returned. For example, SEV, but not SEV-ES, requires that string I/O
be unrolled, etc.
Thanks,
Tom
Powered by blists - more mailing lists