]> git.proxmox.com Git - mirror_qemu.git/commitdiff
vfio: Check that IOMMU MR translates to system address space
authorAlexey Kardashevskiy <aik@ozlabs.ru>
Thu, 26 May 2016 15:43:23 +0000 (09:43 -0600)
committerAlex Williamson <alex.williamson@redhat.com>
Thu, 26 May 2016 17:12:09 +0000 (11:12 -0600)
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>
hw/vfio/common.c

index e2d5a8d9d5693a4798f5ca6e6f0785ed6143eba8..e51ed3a348d885e3528a33538294fee020b12e56 100644 (file)
@@ -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