Blame SOURCES/kvm-hw-vfio-pci-generalize-mask-unmask-to-any-IRQ-index.patch

5d360b
From c7e1a8da5c3576d962c10c7afc11b0146f6b9adc Mon Sep 17 00:00:00 2001
5d360b
From: Alex Williamson <alex.williamson@redhat.com>
5d360b
Date: Fri, 29 Sep 2017 21:44:24 +0200
5d360b
Subject: [PATCH 03/27] hw/vfio/pci: generalize mask/unmask to any IRQ index
5d360b
5d360b
RH-Author: Alex Williamson <alex.williamson@redhat.com>
5d360b
Message-id: <20170929214424.16765.25345.stgit@gimli.home>
5d360b
Patchwork-id: 76761
5d360b
O-Subject: [RHEL-7.5 qemu-kvm PATCH 03/16] hw/vfio/pci: generalize mask/unmask to any IRQ index
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: Eric Auger <eric.auger@linaro.org>
5d360b
5d360b
Upstream: 079eb19cbb3079536788dfd58832824804815e48
5d360b
5d360b
To prepare for platform device introduction, rename vfio_mask_intx
5d360b
and vfio_unmask_intx into vfio_mask_single_irqindex and respectively
5d360b
unmask_single_irqindex. Also use a nex index parameter.
5d360b
5d360b
With that name and prototype the function will be usable for other
5d360b
indexes than VFIO_PCI_INTX_IRQ_INDEX.
5d360b
5d360b
Signed-off-by: Eric Auger <eric.auger@linaro.org>
5d360b
Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
5d360b
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
5d360b
---
5d360b
 hw/misc/vfio.c | 20 ++++++++++----------
5d360b
 1 file changed, 10 insertions(+), 10 deletions(-)
5d360b
5d360b
diff --git a/hw/misc/vfio.c b/hw/misc/vfio.c
5d360b
index a1ca883..ed9b8c4 100644
5d360b
--- a/hw/misc/vfio.c
5d360b
+++ b/hw/misc/vfio.c
5d360b
@@ -288,12 +288,12 @@ static void vfio_disable_irqindex(VFIOPCIDevice *vdev, int index)
5d360b
 /*
5d360b
  * INTx
5d360b
  */
5d360b
-static void vfio_unmask_intx(VFIOPCIDevice *vdev)
5d360b
+static void vfio_unmask_single_irqindex(VFIOPCIDevice *vdev, int index)
5d360b
 {
5d360b
     struct vfio_irq_set irq_set = {
5d360b
         .argsz = sizeof(irq_set),
5d360b
         .flags = VFIO_IRQ_SET_DATA_NONE | VFIO_IRQ_SET_ACTION_UNMASK,
5d360b
-        .index = VFIO_PCI_INTX_IRQ_INDEX,
5d360b
+        .index = index,
5d360b
         .start = 0,
5d360b
         .count = 1,
5d360b
     };
5d360b
@@ -302,12 +302,12 @@ static void vfio_unmask_intx(VFIOPCIDevice *vdev)
5d360b
 }
5d360b
 
5d360b
 #ifdef CONFIG_KVM /* Unused outside of CONFIG_KVM code */
5d360b
-static void vfio_mask_intx(VFIOPCIDevice *vdev)
5d360b
+static void vfio_mask_single_irqindex(VFIOPCIDevice *vdev, int index)
5d360b
 {
5d360b
     struct vfio_irq_set irq_set = {
5d360b
         .argsz = sizeof(irq_set),
5d360b
         .flags = VFIO_IRQ_SET_DATA_NONE | VFIO_IRQ_SET_ACTION_MASK,
5d360b
-        .index = VFIO_PCI_INTX_IRQ_INDEX,
5d360b
+        .index = index,
5d360b
         .start = 0,
5d360b
         .count = 1,
5d360b
     };
5d360b
@@ -376,7 +376,7 @@ static void vfio_eoi(VFIOPCIDevice *vdev)
5d360b
 
5d360b
     vdev->intx.pending = false;
5d360b
     qemu_set_irq(vdev->pdev.irq[vdev->intx.pin], 0);
5d360b
-    vfio_unmask_intx(vdev);
5d360b
+    vfio_unmask_single_irqindex(vdev, VFIO_PCI_INTX_IRQ_INDEX);
5d360b
 }
5d360b
 
5d360b
 static void vfio_enable_intx_kvm(VFIOPCIDevice *vdev)
5d360b
@@ -399,7 +399,7 @@ static void vfio_enable_intx_kvm(VFIOPCIDevice *vdev)
5d360b
 
5d360b
     /* Get to a known interrupt state */
5d360b
     qemu_set_fd_handler(irqfd.fd, NULL, NULL, vdev);
5d360b
-    vfio_mask_intx(vdev);
5d360b
+    vfio_mask_single_irqindex(vdev, VFIO_PCI_INTX_IRQ_INDEX);
5d360b
     vdev->intx.pending = false;
5d360b
     qemu_set_irq(vdev->pdev.irq[vdev->intx.pin], 0);
5d360b
 
5d360b
@@ -437,7 +437,7 @@ static void vfio_enable_intx_kvm(VFIOPCIDevice *vdev)
5d360b
     }
5d360b
 
5d360b
     /* Let'em rip */
5d360b
-    vfio_unmask_intx(vdev);
5d360b
+    vfio_unmask_single_irqindex(vdev, VFIO_PCI_INTX_IRQ_INDEX);
5d360b
 
5d360b
     vdev->intx.kvm_accel = true;
5d360b
 
5d360b
@@ -454,7 +454,7 @@ fail_irqfd:
5d360b
     event_notifier_cleanup(&vdev->intx.unmask);
5d360b
 fail:
5d360b
     qemu_set_fd_handler(irqfd.fd, vfio_intx_interrupt, NULL, vdev);
5d360b
-    vfio_unmask_intx(vdev);
5d360b
+    vfio_unmask_single_irqindex(vdev, VFIO_PCI_INTX_IRQ_INDEX);
5d360b
 #endif
5d360b
 }
5d360b
 
5d360b
@@ -475,7 +475,7 @@ static void vfio_disable_intx_kvm(VFIOPCIDevice *vdev)
5d360b
      * Get to a known state, hardware masked, QEMU ready to accept new
5d360b
      * interrupts, QEMU IRQ de-asserted.
5d360b
      */
5d360b
-    vfio_mask_intx(vdev);
5d360b
+    vfio_mask_single_irqindex(vdev, VFIO_PCI_INTX_IRQ_INDEX);
5d360b
     vdev->intx.pending = false;
5d360b
     qemu_set_irq(vdev->pdev.irq[vdev->intx.pin], 0);
5d360b
 
5d360b
@@ -493,7 +493,7 @@ static void vfio_disable_intx_kvm(VFIOPCIDevice *vdev)
5d360b
     vdev->intx.kvm_accel = false;
5d360b
 
5d360b
     /* If we've missed an event, let it re-fire through QEMU */
5d360b
-    vfio_unmask_intx(vdev);
5d360b
+    vfio_unmask_single_irqindex(vdev, VFIO_PCI_INTX_IRQ_INDEX);
5d360b
 
5d360b
     DPRINTF("%s(%04x:%02x:%02x.%x) KVM INTx accel disabled\n",
5d360b
             __func__, vdev->host.domain, vdev->host.bus,
5d360b
-- 
5d360b
1.8.3.1
5d360b