vfio: allow to notify unmap for very large region
commitdfbd90e5b9b772b1c5a52bad9f6dbabb385a7dc2
authorPeter Xu <peterx@redhat.com>
Tue, 7 Feb 2017 08:28:05 +0000 (7 16:28 +0800)
committerMichael S. Tsirkin <mst@redhat.com>
Fri, 17 Feb 2017 19:52:31 +0000 (17 21:52 +0200)
treebdc09ff657a4167a4237fab3b4632fcd1b4b16ca
parent4a4b88fbe1a95e80a2e29830e69e1deded407fc1
vfio: allow to notify unmap for very large region

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.

Acked-by: Alex Williamson <alex.williamson@redhat.com>
Signed-off-by: Peter Xu <peterx@redhat.com>
Reviewed-by: David Gibson <david@gibson.dropbear.id.au>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
hw/vfio/common.c