[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 07/10] virtio-iommu: Add an assert check in translate routine
From: |
Michael S. Tsirkin |
Subject: |
[PULL 07/10] virtio-iommu: Add an assert check in translate routine |
Date: |
Thu, 16 Jun 2022 12:57:42 -0400 |
From: Zhenzhong Duan <zhenzhong.duan@intel.com>
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>
---
hw/virtio/virtio-iommu.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/hw/virtio/virtio-iommu.c b/hw/virtio/virtio-iommu.c
index 73d5bde9d1..7c122ab957 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);
--
MST
- [PULL 00/10] virtio,pc,pci: fixes,cleanups,features, Michael S. Tsirkin, 2022/06/16
- [PULL 01/10] pci-bridge/cxl_upstream: Add a CXL switch upstream port, Michael S. Tsirkin, 2022/06/16
- [PULL 02/10] pci-bridge/cxl_downstream: Add a CXL switch downstream port, Michael S. Tsirkin, 2022/06/16
- [PULL 03/10] docs/cxl: Add switch documentation, Michael S. Tsirkin, 2022/06/16
- [PULL 04/10] virtio/vhost-user: Fix wrong vhost notifier GPtrArray size, Michael S. Tsirkin, 2022/06/16
- [PULL 06/10] virtio-iommu: Use recursive lock to avoid deadlock, Michael S. Tsirkin, 2022/06/16
- [PULL 05/10] virtio-iommu: Add bypass mode support to assigned device, Michael S. Tsirkin, 2022/06/16
- [PULL 07/10] virtio-iommu: Add an assert check in translate routine,
Michael S. Tsirkin <=
- [PULL 10/10] acpi/erst: fix fallthrough code upon validation failure, Michael S. Tsirkin, 2022/06/16
- [PULL 09/10] vhost: also check queue state in the vhost_dev_set_log error routine, Michael S. Tsirkin, 2022/06/16
- [PULL 08/10] crypto: Introduce RSA algorithm, Michael S. Tsirkin, 2022/06/16
- Re: [PULL 00/10] virtio,pc,pci: fixes,cleanups,features, Richard Henderson, 2022/06/16