[PATCH] device-assignment: fix guest irq routing

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



For guest IRQ assign use emulated interrupt pin, not the real one.

Signed-off-by: Konstantin Khlebnikov <khlebnikov@xxxxxxxxxx>
---
 hw/device-assignment.c |   12 +++++-------
 hw/device-assignment.h |    1 -
 2 files changed, 5 insertions(+), 8 deletions(-)

diff --git a/hw/device-assignment.c b/hw/device-assignment.c
index db82e73..4e7ea18 100644
--- a/hw/device-assignment.c
+++ b/hw/device-assignment.c
@@ -964,13 +964,15 @@ static int assign_device(AssignedDevice *dev)
 static int assign_irq(AssignedDevice *dev)
 {
     struct kvm_assigned_irq assigned_irq_data;
-    int irq, r = 0;
+    int pin, irq, r = 0;
+
+    pin = pci_get_byte(dev->dev.config + PCI_INTERRUPT_PIN);
 
     /* Interrupt PIN 0 means don't use INTx */
-    if (assigned_dev_pci_read_byte(&dev->dev, PCI_INTERRUPT_PIN) == 0)
+    if (pin == 0)
         return 0;
 
-    irq = pci_map_irq(&dev->dev, dev->intpin);
+    irq = pci_map_irq(&dev->dev, pin - 1);
     irq = piix_get_irq(irq);
 
 #ifdef TARGET_IA64
@@ -1705,7 +1707,6 @@ static void reset_assigned_device(DeviceState *dev)
 static int assigned_initfn(struct PCIDevice *pci_dev)
 {
     AssignedDevice *dev = DO_UPCAST(AssignedDevice, dev, pci_dev);
-    uint8_t e_device, e_intx;
     int r;
 
     if (!kvm_enabled()) {
@@ -1732,9 +1733,6 @@ static int assigned_initfn(struct PCIDevice *pci_dev)
         goto out;
 
     /* handle interrupt routing */
-    e_device = (dev->dev.devfn >> 3) & 0x1f;
-    e_intx = dev->dev.config[0x3d] - 1;
-    dev->intpin = e_intx;
     dev->run = 0;
     dev->girq = -1;
     dev->h_segnr = dev->host.seg;
diff --git a/hw/device-assignment.h b/hw/device-assignment.h
index 86af0a9..c5afdaf 100644
--- a/hw/device-assignment.h
+++ b/hw/device-assignment.h
@@ -84,7 +84,6 @@ typedef struct AssignedDevice {
     PCIDevice dev;
     PCIHostDevice host;
     uint32_t features;
-    int intpin;
     uint8_t debug_flags;
     AssignedDevRegion v_addrs[PCI_NUM_REGIONS - 1];
     PCIDevRegions real_device;

--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux