Blame SOURCES/kvm-intel_iommu-introduce-vtd_reset_caches.patch

7711c0
From 7fc26da32e430d69df4ca9f74047310583c97e79 Mon Sep 17 00:00:00 2001
7711c0
From: Peter Xu <peterx@redhat.com>
7711c0
Date: Thu, 8 Nov 2018 05:37:18 +0100
7711c0
Subject: [PATCH 11/22] intel_iommu: introduce vtd_reset_caches()
7711c0
MIME-Version: 1.0
7711c0
Content-Type: text/plain; charset=UTF-8
7711c0
Content-Transfer-Encoding: 8bit
7711c0
7711c0
RH-Author: Peter Xu <peterx@redhat.com>
7711c0
Message-id: <20181108053721.13162-5-peterx@redhat.com>
7711c0
Patchwork-id: 82955
7711c0
O-Subject: [RHEL-7.7 qemu-kvm-rhev PATCH 4/7] intel_iommu: introduce vtd_reset_caches()
7711c0
Bugzilla: 1627272
7711c0
RH-Acked-by: Auger Eric <eric.auger@redhat.com>
7711c0
RH-Acked-by: Michael S. Tsirkin <mst@redhat.com>
7711c0
RH-Acked-by: Philippe Mathieu-Daudé <philmd@redhat.com>
7711c0
7711c0
Provide the function and use it in vtd_init().  Used to reset both
7711c0
context entry cache and iotlb cache for the whole IOMMU unit.
7711c0
7711c0
Signed-off-by: Peter Xu <peterx@redhat.com>
7711c0
Reviewed-by: Eric Auger <eric.auger@redhat.com>
7711c0
Reviewed-by: Jason Wang <jasowang@redhat.com>
7711c0
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
7711c0
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
7711c0
(cherry picked from commit 06aba4ca52fd2c8718b8ba486f22f0aa7c99ed55)
7711c0
Signed-off-by: Peter Xu <peterx@redhat.com>
7711c0
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
7711c0
---
7711c0
 hw/i386/intel_iommu.c | 13 +++++++++----
7711c0
 1 file changed, 9 insertions(+), 4 deletions(-)
7711c0
7711c0
diff --git a/hw/i386/intel_iommu.c b/hw/i386/intel_iommu.c
7711c0
index aab86e9..48d0ba3 100644
7711c0
--- a/hw/i386/intel_iommu.c
7711c0
+++ b/hw/i386/intel_iommu.c
7711c0
@@ -227,6 +227,14 @@ static void vtd_reset_iotlb(IntelIOMMUState *s)
7711c0
     vtd_iommu_unlock(s);
7711c0
 }
7711c0
 
7711c0
+static void vtd_reset_caches(IntelIOMMUState *s)
7711c0
+{
7711c0
+    vtd_iommu_lock(s);
7711c0
+    vtd_reset_iotlb_locked(s);
7711c0
+    vtd_reset_context_cache_locked(s);
7711c0
+    vtd_iommu_unlock(s);
7711c0
+}
7711c0
+
7711c0
 static uint64_t vtd_get_iotlb_key(uint64_t gfn, uint16_t source_id,
7711c0
                                   uint32_t level)
7711c0
 {
7711c0
@@ -3160,10 +3168,7 @@ static void vtd_init(IntelIOMMUState *s)
7711c0
         s->cap |= VTD_CAP_CM;
7711c0
     }
7711c0
 
7711c0
-    vtd_iommu_lock(s);
7711c0
-    vtd_reset_context_cache_locked(s);
7711c0
-    vtd_reset_iotlb_locked(s);
7711c0
-    vtd_iommu_unlock(s);
7711c0
+    vtd_reset_caches(s);
7711c0
 
7711c0
     /* Define registers with default values and bit semantics */
7711c0
     vtd_define_long(s, DMAR_VER_REG, 0x10UL, 0, 0);
7711c0
-- 
7711c0
1.8.3.1
7711c0