diff options
author | Zhenzhong Duan <zhenzhong.duan@intel.com> | 2022-06-13 14:10:10 +0800 |
---|---|---|
committer | Michael S. Tsirkin <mst@redhat.com> | 2022-06-16 12:54:58 -0400 |
commit | 23b5f0ff6d923d3bca11cf44eed3daf7a0a836a8 (patch) | |
tree | dbbe2c773253fdd8524fa9c4b5126be99ee6f341 | |
parent | 08f2030a2e46f1e93d186b3a683e5caef1df562b (diff) | |
download | qemu-23b5f0ff6d923d3bca11cf44eed3daf7a0a836a8.zip qemu-23b5f0ff6d923d3bca11cf44eed3daf7a0a836a8.tar.gz qemu-23b5f0ff6d923d3bca11cf44eed3daf7a0a836a8.tar.bz2 |
virtio-iommu: Add an assert check in translate routine
With address space switch supported, dma access translation only
happen after endpoint is attached to a non-bypass domain.
Signed-off-by: Zhenzhong Duan <zhenzhong.duan@intel.com>
Message-Id: <20220613061010.2674054-4-zhenzhong.duan@intel.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
-rw-r--r-- | hw/virtio/virtio-iommu.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/hw/virtio/virtio-iommu.c b/hw/virtio/virtio-iommu.c index 73d5bde..7c122ab 100644 --- a/hw/virtio/virtio-iommu.c +++ b/hw/virtio/virtio-iommu.c @@ -865,6 +865,10 @@ static IOMMUTLBEntry virtio_iommu_translate(IOMMUMemoryRegion *mr, hwaddr addr, qemu_rec_mutex_lock(&s->mutex); ep = g_tree_lookup(s->endpoints, GUINT_TO_POINTER(sid)); + + if (bypass_allowed) + assert(ep && ep->domain && !ep->domain->bypass); + if (!ep) { if (!bypass_allowed) { error_report_once("%s sid=%d is not known!!", __func__, sid); |