Messages in this thread | | | Subject | Re: [PATCH v1 6/7] x86/kvm: Use bounce buffers for TD guest | From | Tom Lendacky <> | Date | Fri, 11 Jun 2021 09:52:49 -0500 |
| |
On 6/9/21 4:55 PM, Kuppuswamy Sathyanarayanan wrote: > From: "Kirill A. Shutemov" <kirill.shutemov@linux.intel.com> > diff --git a/arch/x86/mm/mem_encrypt_common.c b/arch/x86/mm/mem_encrypt_common.c > index 8053b43298ff..2da70f58b208 100644 > --- a/arch/x86/mm/mem_encrypt_common.c > +++ b/arch/x86/mm/mem_encrypt_common.c > @@ -9,6 +9,7 @@ > > #include <asm/mem_encrypt_common.h> > #include <linux/dma-mapping.h> > +#include <linux/swiotlb.h> > > /* Override for DMA direct allocation check - ARCH_HAS_FORCE_DMA_UNENCRYPTED */ > bool force_dma_unencrypted(struct device *dev) > @@ -21,3 +22,18 @@ bool force_dma_unencrypted(struct device *dev) > > return false; > } > + > +/* Architecture __weak replacement functions */ > +void __init mem_encrypt_init(void) > +{ > + /* > + * For TDX guest or SEV/SME, call into SWIOTLB to update > + * the SWIOTLB DMA buffers > + */ > + if (sme_me_mask || prot_guest_has(PR_GUEST_MEM_ENCRYPT)) > + swiotlb_update_mem_attributes(); > + > + if (sme_me_mask) > + amd_mem_encrypt_init();
The sme_me_mask is checked in amd_mem_encrypt_init(), so you should just invoke amd_mem_encrypt_init() unconditionally.
Thanks, Tom
> +} > + >
| |