26ba25
From 898b7073aa58dbd144b929cf28a297908b8f45f2 Mon Sep 17 00:00:00 2001
26ba25
From: Peter Xu <peterx@redhat.com>
26ba25
Date: Fri, 12 Oct 2018 07:58:43 +0100
26ba25
Subject: [PATCH 13/17] intel-iommu: pass in address space when page walk
26ba25
26ba25
RH-Author: Peter Xu <peterx@redhat.com>
26ba25
Message-id: <20181012075846.25449-7-peterx@redhat.com>
26ba25
Patchwork-id: 82679
26ba25
O-Subject: [RHEL-8 qemu-kvm PATCH 6/9] intel-iommu: pass in address space when page walk
26ba25
Bugzilla: 1450712
26ba25
RH-Acked-by: Auger Eric <eric.auger@redhat.com>
26ba25
RH-Acked-by: Xiao Wang <jasowang@redhat.com>
26ba25
RH-Acked-by: Michael S. Tsirkin <mst@redhat.com>
26ba25
26ba25
We pass in the VTDAddressSpace too.  It'll be used in the follow up
26ba25
patches.
26ba25
26ba25
CC: QEMU Stable <qemu-stable@nongnu.org>
26ba25
Signed-off-by: Peter Xu <peterx@redhat.com>
26ba25
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
26ba25
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
26ba25
(cherry picked from commit 2f764fa87d2a81812b313dd6d998e10126292653)
26ba25
Signed-off-by: Peter Xu <peterx@redhat.com>
26ba25
Signed-off-by: Danilo C. L. de Paula <ddepaula@redhat.com>
26ba25
---
26ba25
 hw/i386/intel_iommu.c | 4 ++++
26ba25
 1 file changed, 4 insertions(+)
26ba25
26ba25
diff --git a/hw/i386/intel_iommu.c b/hw/i386/intel_iommu.c
26ba25
index e247269..a882894 100644
26ba25
--- a/hw/i386/intel_iommu.c
26ba25
+++ b/hw/i386/intel_iommu.c
26ba25
@@ -754,9 +754,11 @@ typedef int (*vtd_page_walk_hook)(IOMMUTLBEntry *entry, void *private);
26ba25
  * @hook_fn: hook func to be called when detected page
26ba25
  * @private: private data to be passed into hook func
26ba25
  * @notify_unmap: whether we should notify invalid entries
26ba25
+ * @as: VT-d address space of the device
26ba25
  * @aw: maximum address width
26ba25
  */
26ba25
 typedef struct {
26ba25
+    VTDAddressSpace *as;
26ba25
     vtd_page_walk_hook hook_fn;
26ba25
     void *private;
26ba25
     bool notify_unmap;
26ba25
@@ -1463,6 +1465,7 @@ static void vtd_iotlb_page_invalidate_notify(IntelIOMMUState *s,
26ba25
                     .private = (void *)&vtd_as->iommu,
26ba25
                     .notify_unmap = true,
26ba25
                     .aw = s->aw_bits,
26ba25
+                    .as = vtd_as,
26ba25
                 };
26ba25
 
26ba25
                 /*
26ba25
@@ -2943,6 +2946,7 @@ static void vtd_iommu_replay(IOMMUMemoryRegion *iommu_mr, IOMMUNotifier *n)
26ba25
                 .private = (void *)n,
26ba25
                 .notify_unmap = false,
26ba25
                 .aw = s->aw_bits,
26ba25
+                .as = vtd_as,
26ba25
             };
26ba25
 
26ba25
             vtd_page_walk(&ce, 0, ~0ULL, &info);
26ba25
-- 
26ba25
1.8.3.1
26ba25