47 lines
1.7 KiB
Diff
47 lines
1.7 KiB
Diff
|
From 643d9c28ff8b15c333cc748c5e712659ad2a257c Mon Sep 17 00:00:00 2001
|
||
|
From: Zhenzhong Duan <zhenzhong.duan@intel.com>
|
||
|
Date: Mon, 13 Jun 2022 14:10:10 +0800
|
||
|
Subject: [PATCH 03/17] virtio-iommu: Add an assert check in translate routine
|
||
|
|
||
|
RH-Author: Eric Auger <eric.auger@redhat.com>
|
||
|
RH-MergeRequest: 105: virtio-iommu: Fix bypass mode for assigned devices
|
||
|
RH-Commit: [3/5] 19f309fd0beda40d65f51c454e37936658ac9f38 (eauger1/centos-qemu-kvm)
|
||
|
RH-Bugzilla: 2100106
|
||
|
RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
|
||
|
RH-Acked-by: Peter Xu <peterx@redhat.com>
|
||
|
RH-Acked-by: Cornelia Huck <cohuck@redhat.com>
|
||
|
|
||
|
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2100106
|
||
|
|
||
|
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>
|
||
|
(cherry picked from commit 23b5f0ff6d923d3bca11cf44eed3daf7a0a836a8)
|
||
|
Signed-off-by: Eric Auger <eric.auger@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 440a1c28a7..e970d4d5a6 100644
|
||
|
--- a/hw/virtio/virtio-iommu.c
|
||
|
+++ b/hw/virtio/virtio-iommu.c
|
||
|
@@ -866,6 +866,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);
|
||
|
--
|
||
|
2.31.1
|
||
|
|