]> git.ipfire.org Git - thirdparty/qemu.git/commit
hw/i386/amd_iommu: Fix device setup failure when PT is on.
authorSairaj Kodilkar <sarunkod@amd.com>
Fri, 16 May 2025 10:05:34 +0000 (15:35 +0530)
committerMichael Tokarev <mjt@tls.msk.ru>
Mon, 2 Jun 2025 20:53:54 +0000 (23:53 +0300)
commit8399ccb48041be54cec39b0c08494ea01ca84e4c
treebd2b4500d509f5b2550ad485638f6400d6030bbd
parent325d039d25f3626c0a52075e1d84e504f13e54c2
hw/i386/amd_iommu: Fix device setup failure when PT is on.

Commit c1f46999ef506 ("amd_iommu: Add support for pass though mode")
introduces the support for "pt" flag by enabling nodma memory when
"pt=off". This allowed VFIO devices to successfully register notifiers
by using nodma region.

But, This also broke things when guest is booted with the iommu=nopt
because, devices bypass the IOMMU and use untranslated addresses (IOVA) to
perform DMA reads/writes to the nodma memory region, ultimately resulting in
a failure to setup the devices in the guest.

Fix the above issue by always enabling the amdvi_dev_as->iommu memory region.
But this will once again cause VFIO devices to fail while registering the
notifiers with AMD IOMMU memory region.

Fixes: c1f46999ef506 ("amd_iommu: Add support for pass though mode")
Signed-off-by: Sairaj Kodilkar <sarunkod@amd.com>
Reviewed-by: Vasant Hegde <vasant.hegde@amd.com>
Message-Id: <20250516100535.4980-2-sarunkod@amd.com>
Fixes: c1f46999ef506 ("amd_iommu: Add support for pass though mode")
Signed-off-by: Sairaj Kodilkar <sarunkod@amd.com>
Reviewed-by: Vasant Hegde <vasant.hegde@amd.com>
(cherry picked from commit 31753d5a336fbb4e9246397f4b90b6f611f27f22)
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
hw/i386/amd_iommu.c