9ae3a8
From 4adaef467772d0131b96e6dc2533b13afd8254a9 Mon Sep 17 00:00:00 2001
9ae3a8
From: Alex Williamson <alex.williamson@redhat.com>
9ae3a8
Date: Fri, 29 Sep 2017 21:44:01 +0200
9ae3a8
Subject: [PATCH 01/27] vfio: pass device to vfio_mmap_bar and use it to set
9ae3a8
 owner
9ae3a8
9ae3a8
RH-Author: Alex Williamson <alex.williamson@redhat.com>
9ae3a8
Message-id: <20170929214401.16765.56856.stgit@gimli.home>
9ae3a8
Patchwork-id: 76759
9ae3a8
O-Subject: [RHEL-7.5 qemu-kvm PATCH 01/16] vfio: pass device to vfio_mmap_bar and use it to set owner
9ae3a8
Bugzilla: 1494181
9ae3a8
RH-Acked-by: Paolo Bonzini <pbonzini@redhat.com>
9ae3a8
RH-Acked-by: Auger Eric <eric.auger@redhat.com>
9ae3a8
RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
9ae3a8
9ae3a8
From: Paolo Bonzini <pbonzini@redhat.com>
9ae3a8
9ae3a8
Upstream: 5cb022a1bfaa0c15a13d3266bc6d683cc1f44d7f
9ae3a8
RHEL: Update vfio_mmap_bar() parameters, but RHEL memory API doesn't
9ae3a8
      support an owner, this makes later patches apply more cleanly.
9ae3a8
9ae3a8
Cc: Alex Williamson <alex.williamson@redhat.com>
9ae3a8
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
9ae3a8
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
9ae3a8
---
9ae3a8
 hw/misc/vfio.c | 7 ++++---
9ae3a8
 1 file changed, 4 insertions(+), 3 deletions(-)
9ae3a8
9ae3a8
diff --git a/hw/misc/vfio.c b/hw/misc/vfio.c
9ae3a8
index 4fdc09a..363c646 100644
9ae3a8
--- a/hw/misc/vfio.c
9ae3a8
+++ b/hw/misc/vfio.c
9ae3a8
@@ -2570,7 +2570,8 @@ static void vfio_unmap_bar(VFIODevice *vdev, int nr)
9ae3a8
     memory_region_destroy(&bar->mem);
9ae3a8
 }
9ae3a8
 
9ae3a8
-static int vfio_mmap_bar(VFIOBAR *bar, MemoryRegion *mem, MemoryRegion *submem,
9ae3a8
+static int vfio_mmap_bar(VFIODevice *vdev, VFIOBAR *bar,
9ae3a8
+                         MemoryRegion *mem, MemoryRegion *submem,
9ae3a8
                          void **map, size_t size, off_t offset,
9ae3a8
                          const char *name)
9ae3a8
 {
9ae3a8
@@ -2654,7 +2655,7 @@ static void vfio_map_bar(VFIODevice *vdev, int nr)
9ae3a8
     }
9ae3a8
 
9ae3a8
     strncat(name, " mmap", sizeof(name) - strlen(name) - 1);
9ae3a8
-    if (vfio_mmap_bar(bar, &bar->mem,
9ae3a8
+    if (vfio_mmap_bar(vdev, bar, &bar->mem,
9ae3a8
                       &bar->mmap_mem, &bar->mmap, size, 0, name)) {
9ae3a8
         error_report("%s unsupported. Performance may be slow", name);
9ae3a8
     }
9ae3a8
@@ -2668,7 +2669,7 @@ static void vfio_map_bar(VFIODevice *vdev, int nr)
9ae3a8
         size = start < bar->size ? bar->size - start : 0;
9ae3a8
         strncat(name, " msix-hi", sizeof(name) - strlen(name) - 1);
9ae3a8
         /* VFIOMSIXInfo contains another MemoryRegion for this mapping */
9ae3a8
-        if (vfio_mmap_bar(bar, &bar->mem, &vdev->msix->mmap_mem,
9ae3a8
+        if (vfio_mmap_bar(vdev, bar, &bar->mem, &vdev->msix->mmap_mem,
9ae3a8
                           &vdev->msix->mmap, size, start, name)) {
9ae3a8
             error_report("%s unsupported. Performance may be slow", name);
9ae3a8
         }
9ae3a8
-- 
9ae3a8
1.8.3.1
9ae3a8