Re: [RFC v2-fix-v2 1/1] x86: Introduce generic protected guest abstraction

From: Kuppuswamy, Sathyanarayanan
Date: Wed Jun 02 2021 - 14:25:51 EST




On 6/2/21 11:15 AM, Tom Lendacky wrote:
The original suggestion from Boris, IIRC, was for protected_guest_has()
function (below) to be:

if (intel)
return intel_protected_guest_has();

Yes. But for Intel, I think currently we can only check for is_tdx_guest() here.

if (is_tdx_guest())
return intel_protected_guest_has();

So if we use is_tdx_guest(), it is better to call tdx_protected_guest_has() here.

Once we start using protected_guest_has for other Intel technologies, may be
we can generalize it. Let me know your comments.

else if (amd)
return amd_protected_guest_has();
else
return false;

And then you could check for TDX or SME/SEV in the respective functions.

--
Sathyanarayanan Kuppuswamy
Linux Kernel Developer