From: Peter Xu <peterx@redhat.com>
To: qemu-devel@nongnu.org
Cc: Alex Williamson <alex.williamson@redhat.com>, peterx@redhat.com
Subject: [Qemu-devel] [PATCH RFC 3/3] vfio: allow to notify unmap for very large region
Date: Thu, 19 Jan 2017 17:25:32 +0800 [thread overview]
Message-ID: <1484817932-14452-4-git-send-email-peterx@redhat.com> (raw)
In-Reply-To: <1484817932-14452-1-git-send-email-peterx@redhat.com>
Linux vfio driver supports to do VFIO_IOMMU_UNMAP_DMA for a very big
region. This can be leveraged by QEMU IOMMU implementation to cleanup
existing page mappings for an entire iova address space (by notifying
with an IOTLB with extremely huge addr_mask). However current
vfio_iommu_map_notify() does not allow that. It make sure that all the
translated address in IOTLB is falling into RAM range.
The check makes sense, but it should only be a sensible checker for
mapping operations, and mean little for unmap operations.
This patch moves this check into map logic only, so that we'll get
faster unmap handling (no need to translate again), and also we can then
better support unmapping a very big region when it covers non-ram ranges
or even not-existing ranges.
Signed-off-by: Peter Xu <peterx@redhat.com>
---
hw/vfio/common.c | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/hw/vfio/common.c b/hw/vfio/common.c
index ce55dff..4d90844 100644
--- a/hw/vfio/common.c
+++ b/hw/vfio/common.c
@@ -354,11 +354,10 @@ static void vfio_iommu_map_notify(IOMMUNotifier *n, IOMMUTLBEntry *iotlb)
return;
}
- if (!vfio_get_vaddr(iotlb, &vaddr, &read_only)) {
- return;
- }
-
if ((iotlb->perm & IOMMU_RW) != IOMMU_NONE) {
+ if (!vfio_get_vaddr(iotlb, &vaddr, &read_only)) {
+ return;
+ }
ret = vfio_dma_map(container, iova,
iotlb->addr_mask + 1, vaddr,
read_only);
--
2.7.4
next prev parent reply other threads:[~2017-01-19 9:26 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-01-19 9:25 [Qemu-devel] [PATCH RFC 0/3] vfio: allow to notify unmap for very big region Peter Xu
2017-01-19 9:25 ` [Qemu-devel] [PATCH RFC 1/3] vfio: trace map/unmap for notify as well Peter Xu
2017-01-19 9:25 ` [Qemu-devel] [PATCH RFC 2/3] vfio: introduce vfio_get_vaddr() Peter Xu
2017-01-19 9:25 ` Peter Xu [this message]
2017-01-19 17:54 ` [Qemu-devel] [PATCH RFC 0/3] vfio: allow to notify unmap for very big region Alex Williamson
2017-01-20 3:43 ` Peter Xu
2017-01-20 4:21 ` Alex Williamson
2017-01-20 4:45 ` Peter Xu
2017-01-20 12:27 ` Peter Xu
2017-01-20 17:14 ` Alex Williamson
2017-01-22 2:59 ` Peter Xu
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=1484817932-14452-4-git-send-email-peterx@redhat.com \
--to=peterx@redhat.com \
--cc=alex.williamson@redhat.com \
--cc=qemu-devel@nongnu.org \
/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).