Re: [RFC v2 26/32] x86/mm: Move force_dma_unencrypted() to common code

From: Dave Hansen
Date: Thu May 13 2021 - 15:42:35 EST


On 5/13/21 12:38 PM, 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.

Ahh, forgot about that. The whole "x86/mm" subject threw me off.

>> 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

The *REALLY* nice thing is that it keeps you from having to create stub
functions or #ifdefs and yet the compiler can still optimize the code to
nothing.

Anyway, thanks for the clarification about it being in non-arch code.