kvm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] device-assignment: fix guest irq routing
@ 2011-03-27 19:23 Konstantin Khlebnikov
  0 siblings, 0 replies; only message in thread
From: Konstantin Khlebnikov @ 2011-03-27 19:23 UTC (permalink / raw)
  To: kvm; +Cc: alex.williamson

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

Signed-off-by: Konstantin Khlebnikov <khlebnikov@openvz.org>
---
 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;


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2011-03-27 19:29 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-03-27 19:23 [PATCH] device-assignment: fix guest irq routing Konstantin Khlebnikov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).