yeahuh / rpms / qemu-kvm

Forked from rpms/qemu-kvm 2 years ago
Clone

Blame SOURCES/kvm-intel-iommu-pass-in-address-space-when-page-walk.patch

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