WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

[Xen-devel] [PATCH 1/4] xen: handled remapped IRQs when enabling a pcifr

To: xen-devel@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-devel] [PATCH 1/4] xen: handled remapped IRQs when enabling a pcifront PCI device.
From: Ian Campbell <ian.campbell@xxxxxxxxxx>
Date: Tue, 11 Jan 2011 17:20:13 +0000
Cc: Jeremy Fitzhardinge <jeremy@xxxxxxxx>, Stefano Stabellini <stefano.stabellini@xxxxxxxxxxxxx>, Ian Campbell <ian.campbell@xxxxxxxxxx>, Konrad Rzeszutek Wilk <konrad.wilk@xxxxxxxxxx>
Delivery-date: Tue, 11 Jan 2011 09:22:22 -0800
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <1294766389.3831.5902.camel@xxxxxxxxxxxxxxxxxxxxxx>
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
References: <1294766389.3831.5902.camel@xxxxxxxxxxxxxxxxxxxxxx>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
This happens to not be an issue currently because we take pains to try
to ensure that the GSI-IRQ mapping is 1-1 in a PV guest and that
regular event channels do not clash. However a subsequent patch is
going to break this 1-1 mapping.

Signed-off-by: Ian Campbell <ian.campbell@xxxxxxxxxx>
Cc: Konrad Rzeszutek Wilk <konrad.wilk@xxxxxxxxxx>
Cc: Stefano Stabellini <stefano.stabellini@xxxxxxxxxxxxx>
Cc: Jeremy Fitzhardinge <jeremy@xxxxxxxx>
---
 arch/x86/pci/xen.c |   22 ++++++++++++++--------
 1 files changed, 14 insertions(+), 8 deletions(-)

diff --git a/arch/x86/pci/xen.c b/arch/x86/pci/xen.c
index 25cd4a0..2a12f3d 100644
--- a/arch/x86/pci/xen.c
+++ b/arch/x86/pci/xen.c
@@ -226,21 +226,27 @@ static int xen_pcifront_enable_irq(struct pci_dev *dev)
 {
        int rc;
        int share = 1;
+       u8 gsi;
 
-       dev_info(&dev->dev, "Xen PCI enabling IRQ: %d\n", dev->irq);
-
-       if (dev->irq < 0)
-               return -EINVAL;
+       rc = pci_read_config_byte(dev, PCI_INTERRUPT_LINE, &gsi);
+       if (rc < 0) {
+               dev_warn(&dev->dev, "Xen PCI: failed to read interrupt line: 
%d\n",
+                        rc);
+               return rc;
+       }
 
-       if (dev->irq < NR_IRQS_LEGACY)
+       if (gsi < NR_IRQS_LEGACY)
                share = 0;
 
-       rc = xen_allocate_pirq(dev->irq, share, "pcifront");
+       rc = xen_allocate_pirq(gsi, share, "pcifront");
        if (rc < 0) {
-               dev_warn(&dev->dev, "Xen PCI IRQ: %d, failed to register:%d\n",
-                        dev->irq, rc);
+               dev_warn(&dev->dev, "Xen PCI: failed to register GSI%d: %d\n",
+                        gsi, rc);
                return rc;
        }
+
+       dev->irq = rc;
+       dev_info(&dev->dev, "Xen PCI mapped GSI%d to IRQ%d\n", gsi, dev->irq);
        return 0;
 }
 
-- 
1.5.6.5


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel