All of lore.kernel.org
 help / color / mirror / Atom feed
From: Konstantin Khlebnikov <khlebnikov@openvz.org>
To: <kvm@vger.kernel.org>
Cc: <alex.williamson@redhat.com>
Subject: [PATCH] device-assignment: fix guest irq routing
Date: Sun, 27 Mar 2011 23:23:01 +0400	[thread overview]
Message-ID: <20110327192301.20148.17464.stgit@localhost6> (raw)

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;


                 reply	other threads:[~2011-03-27 19:29 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20110327192301.20148.17464.stgit@localhost6 \
    --to=khlebnikov@openvz.org \
    --cc=alex.williamson@redhat.com \
    --cc=kvm@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.