aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexey Kardashevskiy <aik@ozlabs.ru>2016-05-26 09:43:23 -0600
committerAlex Williamson <alex.williamson@redhat.com>2016-05-26 11:12:09 -0600
commitf1f9365019bb257af087b454972c396bb0d53b26 (patch)
treee02a27eb786f558f39d0d2e09a4f35ed95f9c56b
parentd78c19b5cf4821d0c198f4132a085bdbf19dda4c (diff)
vfio: Check that IOMMU MR translates to system address space
At the moment IOMMU MR only translate to the system memory. However if some new code changes this, we will need clear indication why it is not working so here is the check. Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru> Reviewed-by: David Gibson <david@gibson.dropbear.id.au> Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
-rw-r--r--hw/vfio/common.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/hw/vfio/common.c b/hw/vfio/common.c
index e2d5a8d9d5..e51ed3a348 100644
--- a/hw/vfio/common.c
+++ b/hw/vfio/common.c
@@ -269,6 +269,12 @@ static void vfio_iommu_map_notify(Notifier *n, void *data)
trace_vfio_iommu_map_notify(iova, iova + iotlb->addr_mask);
+ if (iotlb->target_as != &address_space_memory) {
+ error_report("Wrong target AS \"%s\", only system memory is allowed",
+ iotlb->target_as->name ? iotlb->target_as->name : "none");
+ return;
+ }
+
/*
* The IOMMU TLB entry we have just covers translation through
* this IOMMU to its immediate target. We need to translate