Blame SOURCES/kvm-hw-pci-host-gpex-Improve-INTX-to-gsi-routing-error-c.patch

9bac43
From 8c777547f451a6d93ae258bbc794be6752af05c4 Mon Sep 17 00:00:00 2001
9bac43
From: Auger Eric <eric.auger@redhat.com>
9bac43
Date: Mon, 6 Nov 2017 17:08:45 +0100
9bac43
Subject: [PATCH 9/9] hw/pci-host/gpex: Improve INTX to gsi routing error
9bac43
 checking
9bac43
9bac43
RH-Author: Auger Eric <eric.auger@redhat.com>
9bac43
Message-id: <1509988125-30275-5-git-send-email-eric.auger@redhat.com>
9bac43
Patchwork-id: 77511
9bac43
O-Subject: [RHV7.5 qemu-kvm-ma PATCH 4/4] hw/pci-host/gpex: Improve INTX to gsi routing error checking
9bac43
Bugzilla: 1460957
9bac43
RH-Acked-by: Alex Williamson <alex.williamson@redhat.com>
9bac43
RH-Acked-by: Laurent Vivier <lvivier@redhat.com>
9bac43
RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
9bac43
9bac43
We exposed gpex_set_irq_num() for machines to set the INTx to
9bac43
GSI routing. However if the machine forgets to call that
9bac43
function we currently do not check the association was properly
9bac43
done. Let's initialize gsi values to -1 and if this value is
9bac43
found in gpex_route_intx_pin_to_irq, set the routing mode as
9bac43
disabled.
9bac43
9bac43
Signed-off-by: Eric Auger <eric.auger@redhat.com>
9bac43
Message-id: 1508776211-22175-1-git-send-email-eric.auger@redhat.com
9bac43
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
9bac43
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
9bac43
(cherry picked from commit 168df2dea701bbf3118bdfea7794369dfa694d3d)
9bac43
Signed-off-by: Eric Auger <eric.auger@redhat.com>
9bac43
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
9bac43
---
9bac43
 hw/pci-host/gpex.c | 10 ++++++++--
9bac43
 1 file changed, 8 insertions(+), 2 deletions(-)
9bac43
9bac43
diff --git a/hw/pci-host/gpex.c b/hw/pci-host/gpex.c
9bac43
index 4090793..edf305b 100644
9bac43
--- a/hw/pci-host/gpex.c
9bac43
+++ b/hw/pci-host/gpex.c
9bac43
@@ -57,9 +57,14 @@ static PCIINTxRoute gpex_route_intx_pin_to_irq(void *opaque, int pin)
9bac43
 {
9bac43
     PCIINTxRoute route;
9bac43
     GPEXHost *s = opaque;
9bac43
+    int gsi = s->irq_num[pin];
9bac43
 
9bac43
-    route.mode = PCI_INTX_ENABLED;
9bac43
-    route.irq = s->irq_num[pin];
9bac43
+    route.irq = gsi;
9bac43
+    if (gsi < 0) {
9bac43
+        route.mode = PCI_INTX_DISABLED;
9bac43
+    } else {
9bac43
+        route.mode = PCI_INTX_ENABLED;
9bac43
+    }
9bac43
 
9bac43
     return route;
9bac43
 }
9bac43
@@ -81,6 +86,7 @@ static void gpex_host_realize(DeviceState *dev, Error **errp)
9bac43
     sysbus_init_mmio(sbd, &s->io_ioport);
9bac43
     for (i = 0; i < GPEX_NUM_IRQS; i++) {
9bac43
         sysbus_init_irq(sbd, &s->irq[i]);
9bac43
+        s->irq_num[i] = -1;
9bac43
     }
9bac43
 
9bac43
     pci->bus = pci_register_bus(dev, "pcie.0", gpex_set_irq,
9bac43
-- 
9bac43
1.8.3.1
9bac43