qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH for 8.0 1/2] virtio-iommu: Add unmap on virtio_iommu_remap()


From: Eric Auger
Subject: [PATCH for 8.0 1/2] virtio-iommu: Add unmap on virtio_iommu_remap()
Date: Wed, 7 Dec 2022 14:36:45 +0100

following replay() callback documentation in memory.h we
shall first invalidate (notify with flag == IOMMU_NONE) and
then map for existing mappings. The code currently skips the
unmap and just do map. This may lead to duplicate mapping
attempts on VFIO side (leading to spurious -EEXIST DMA_MAP
failures). Add the unmap.

Signed-off-by: Eric Auger <eric.auger@redhat.com>
Fixes 308e5e1b5f8 ("virtio-iommu: Add replay() memory region callback")
---
 hw/virtio/virtio-iommu.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/hw/virtio/virtio-iommu.c b/hw/virtio/virtio-iommu.c
index 62e07ec2e4..30334c85aa 100644
--- a/hw/virtio/virtio-iommu.c
+++ b/hw/virtio/virtio-iommu.c
@@ -1034,6 +1034,7 @@ static gboolean virtio_iommu_remap(gpointer key, gpointer 
value, gpointer data)
 
     trace_virtio_iommu_remap(mr->parent_obj.name, interval->low, 
interval->high,
                              mapping->phys_addr);
+    virtio_iommu_notify_unmap(mr, interval->low, interval->high);
     virtio_iommu_notify_map(mr, interval->low, interval->high,
                             mapping->phys_addr, mapping->flags);
     return false;
-- 
2.37.3




reply via email to

[Prev in Thread] Current Thread [Next in Thread]