From: Zhenzhong Duan <zhenzhong.duan@intel.com>
To: eric.auger@redhat.com
Cc: qemu-devel@nongnu.org, mst@redhat.com, jean-philippe@linaro.org,
pbonzini@redhat.com, yu.c.zhang@intel.com,
chuanxiao.dong@intel.com, tina.zhang@intel.com
Subject: [PATCH 3/3] virtio-iommu: Add an assert check in translate routine
Date: Mon, 13 Jun 2022 14:10:10 +0800 [thread overview]
Message-ID: <20220613061010.2674054-4-zhenzhong.duan@intel.com> (raw)
In-Reply-To: <20220613061010.2674054-1-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>
---
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 73d5bde9d122..7c122ab95780 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);
--
2.25.1
next prev parent reply other threads:[~2022-06-13 6:27 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-06-13 6:10 [PATCH 0/3] Add bypass mode support to assigned device Zhenzhong Duan
2022-06-13 6:10 ` [PATCH 1/3] virtio-iommu: " Zhenzhong Duan
2022-06-23 16:52 ` Eric Auger
2022-06-24 8:28 ` Duan, Zhenzhong
2022-06-13 6:10 ` [PATCH 2/3] virtio-iommu: Use recursive lock to avoid deadlock Zhenzhong Duan
2022-06-13 6:10 ` Zhenzhong Duan [this message]
2022-06-23 16:52 ` [PATCH 0/3] Add bypass mode support to assigned device Eric Auger
2022-06-24 7:36 ` Duan, Zhenzhong
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220613061010.2674054-4-zhenzhong.duan@intel.com \
--to=zhenzhong.duan@intel.com \
--cc=chuanxiao.dong@intel.com \
--cc=eric.auger@redhat.com \
--cc=jean-philippe@linaro.org \
--cc=mst@redhat.com \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=tina.zhang@intel.com \
--cc=yu.c.zhang@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).