Re: [PATCH 9/9] iommu/amd: Set default domain to IDENTITY_DOMAIN when running in SEV guest
From: Suthikulpanit, Suravee
Date: Mon May 13 2024 - 08:18:12 EST
Jason,
On 5/1/2024 9:17 PM, Jason Gunthorpe wrote:
On Tue, Apr 30, 2024 at 03:24:30PM +0000, Suravee Suthikulpanit wrote:
Since SEV guest depends on the unencrypted swiotlb bounce buffer
to support DMA, the guest AMD IOMMU driver must be force to setup to
pass-through mode.
You should block the creation of paging domains as well if the HW
can't support them.
Sure, I'll add a logic to check and block domain creation.
But, is there actually a functional problem here? Doesn't swiotlb work
OK with iommu even with the encrypted memory cases? What is missing if
not?
Currently, SEV guest is default to use SWIOTLB. This does not have any
issues.
However, in order to support vcpus w/ x2APIC ID (> 255) in a guest, it
requires guest interrupt remapping support. This is achieved by adding
QEMU-emulated AMD or Intel vIOMMU models.
In case of AMD IOMMU, depending on the CONFIG_IOMMU_DEFAULT_PASSTHROUGH
kernel config, it would default to setup the v1 table for DMA remapping,
which is not supported in the SEV guest (since it requires to use SWIOTLB).
This patch is needed to avoid the need to have
CONFIG_IOMMU_DEFAULT_PASSTHROUGH=y, or specifying kernel command-line
option iommu=pt in the guest.
Thanks,
Suravee
Jason