thebeanogamer / rpms / qemu-kvm

Forked from rpms/qemu-kvm 5 months ago
Clone

Blame SOURCES/kvm-vfio-pass-device-to-vfio_mmap_bar-and-use-it-to-set-.patch

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