Re: [PATCH 08/12] x86: centralize setting SWIOTLB_FORCE when guest memory encryption is enabled

Andrew Cooper
2022-03-01T11:40:39Z

On 01/03/2022 10:53, Christoph Hellwig wrote:
> diff --git a/arch/x86/kernel/pci-dma.c b/arch/x86/kernel/pci-dma.c
> index 2ac0ef9c2fb76..7ab7002758396 100644
> --- a/arch/x86/kernel/pci-dma.c
> +++ b/arch/x86/kernel/pci-dma.c
> @@ -53,6 +53,13 @@ static void __init pci_swiotlb_detect(void)
> if (cc_platform_has(CC_ATTR_HOST_MEM_ENCRYPT))
> x86_swiotlb_enable = true;
>
> + /*
> + * Guest with guest memory encryption must always do I/O through a
> + * bounce buffer as the hypervisor can't access arbitrary VM memory.

This isn't really "must".  The guest is perfectly capable of sharing
memory with the hypervisor.

It's just that for now, bounce buffering is allegedly faster, and the
simple way of getting it working.

~Andrew