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

From: Kuppuswamy, Sathyanarayanan
Date: Mon May 17 2021 - 14:27:43 EST




On 5/17/21 11:16 AM, Sean Christopherson wrote:
What generic code needs access to SEV vs. TDX? force_dma_unencrypted() is called
from generic code, but its implementation is x86 specific.

When the hardening the drivers for TDX usage, we will have requirement to check
for is_protected_guest() to add code specific to protected guests. Since this will
be outside arch/x86, we need common framework for it.

Few examples are,
* ACPI sleep driver uses WBINVD (when doing cache flushes). We want to skip it for
TDX.
* Forcing virtio to use dma API when running with untrusted host.

--
Sathyanarayanan Kuppuswamy
Linux Kernel Developer