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

From: Kuppuswamy, Sathyanarayanan
Date: Mon Jun 07 2021 - 18:26:59 EST




On 6/7/21 1:14 PM, Borislav Petkov wrote:
On Mon, Jun 07, 2021 at 10:55:44PM +0300, Kirill A. Shutemov wrote:
I think conversions like this are wrong: relocate_kernel(), which got
called here, only knows how to deal with SME, not how to handle some
generic case.

What do you mean wrong? Wrong for TDX?

If so, then that can be

protected_guest_has(SME)

or so, which would be false on Intel.

I agree. Since most of the code changed in this patch is
not applicable to TDX, it might need product specific or
new function specific flags.


And this patch was only a mechanical conversion to see how it would look
like.

If code is written to handle a specific technology we need to stick
with a check that makes it clear. Trying to make sound generic only
leads to confusion.

Sure, fine by me.

And I don't want a zoo of gazillion small checking functions per
technology. sev_<something>, tdx_<something>, yadda yadda.

So stuff better be unified. Even if you'd have vendor-specific defines
you hand into that function - and you will have such - it is still much
saner than what it turns into with the AMD side of things.

Agree. Currently we share code with AMD SEV in memory encryption support and
string I/O handling code. So defining common flag for such code is
useful.



--
Sathyanarayanan Kuppuswamy
Linux Kernel Developer