Message ID | 20221207133646.635760-2-eric.auger@redhat.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | virtio-iommu: Fix Replay | expand |
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;
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(+)