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 11/12] xen: events: use xen_bind_pirq_msi_to_irq from

To: Konrad Rzeszutek Wilk <konrad.wilk@xxxxxxxxxx>
Subject: [Xen-devel] [PATCH 11/12] xen: events: use xen_bind_pirq_msi_to_irq from xen_create_msi_irq
From: Ian Campbell <ian.campbell@xxxxxxxxxx>
Date: Fri, 18 Feb 2011 16:43:36 +0000
Cc: Jeremy Fitzhardinge <jeremy@xxxxxxxx>, xen-devel@xxxxxxxxxxxxxxxxxxx, Ian Campbell <ian.campbell@xxxxxxxxxx>, Stefano Stabellini <Stefano.Stabellini@xxxxxxxxxxxxx>
Delivery-date: Fri, 18 Feb 2011 08:56:49 -0800
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <1298047386.16356.3620.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: <1298047386.16356.3620.camel@xxxxxxxxxxxxxxxxxxxxxx>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
Signed-off-by: Ian Campbell <ian.campbell@xxxxxxxxxx>
---
 arch/x86/pci/xen.c   |    4 ++--
 drivers/xen/events.c |   36 +++++++-----------------------------
 include/xen/events.h |    2 +-
 3 files changed, 10 insertions(+), 32 deletions(-)

diff --git a/arch/x86/pci/xen.c b/arch/x86/pci/xen.c
index df178a7..1a8133a 100644
--- a/arch/x86/pci/xen.c
+++ b/arch/x86/pci/xen.c
@@ -106,7 +106,7 @@ static int xen_hvm_setup_msi_irqs(struct pci_dev *dev, int 
nvec, int type)
                        dev_dbg(&dev->dev,
                                "xen: msi already bound to pirq=%d\n", pirq);
                }
-               irq = xen_bind_pirq_msi_to_irq(dev, msidesc, pirq,
+               irq = xen_bind_pirq_msi_to_irq(dev, msidesc, pirq, 0,
                                               (type == PCI_CAP_ID_MSIX) ?
                                               "msi-x" : "msi");
                if (irq < 0)
@@ -145,7 +145,7 @@ static int xen_setup_msi_irqs(struct pci_dev *dev, int 
nvec, int type)
                goto error;
        i = 0;
        list_for_each_entry(msidesc, &dev->msi_list, list) {
-               irq = xen_bind_pirq_msi_to_irq(dev, msidesc, v[i],
+               irq = xen_bind_pirq_msi_to_irq(dev, msidesc, v[i], 0,
                                               (type == PCI_CAP_ID_MSIX) ?
                                               "pcifront-msi-x" :
                                               "pcifront-msi");
diff --git a/drivers/xen/events.c b/drivers/xen/events.c
index d4d0987..fd3580a 100644
--- a/drivers/xen/events.c
+++ b/drivers/xen/events.c
@@ -652,7 +652,7 @@ int xen_allocate_pirq_msi(struct pci_dev *dev, struct 
msi_desc *msidesc)
 }
 
 int xen_bind_pirq_msi_to_irq(struct pci_dev *dev, struct msi_desc *msidesc,
-                            int pirq, const char *name)
+                            int pirq, int vector, const char *name)
 {
        int irq, ret;
 
@@ -665,7 +665,7 @@ int xen_bind_pirq_msi_to_irq(struct pci_dev *dev, struct 
msi_desc *msidesc,
        set_irq_chip_and_handler_name(irq, &xen_pirq_chip,
                                      handle_level_irq, name);
 
-       irq_info[irq] = mk_pirq_info(0, pirq, 0, 0);
+       irq_info[irq] = mk_pirq_info(0, pirq, 0, vector);
        pirq_to_irq[pirq] = irq;
        ret = set_irq_msi(irq, msidesc);
        if (ret < 0)
@@ -681,7 +681,6 @@ error_irq:
 
 int xen_create_msi_irq(struct pci_dev *dev, struct msi_desc *msidesc, int type)
 {
-       int ret, irq = -1;
        struct physdev_map_pirq map_irq;
        int rc;
        int pos;
@@ -709,34 +708,13 @@ int xen_create_msi_irq(struct pci_dev *dev, struct 
msi_desc *msidesc, int type)
        rc = HYPERVISOR_physdev_op(PHYSDEVOP_map_pirq, &map_irq);
        if (rc) {
                dev_warn(&dev->dev, "xen map irq failed %d\n", rc);
-               goto out;
+               return -1;
        }
 
-       spin_lock(&irq_mapping_update_lock);
-
-       irq = xen_allocate_irq_dynamic();
-
-       if (irq == -1)
-               goto out;
-
-       irq_info[irq] = mk_pirq_info(0, map_irq.pirq, 0, map_irq.index);
-       pirq_to_irq[map_irq.pirq] = irq;
-
-       set_irq_chip_and_handler_name(irq, &xen_pirq_chip,
-                       handle_level_irq,
-                       (type == PCI_CAP_ID_MSIX) ? "msi-x":"msi");
-
-       ret = set_irq_msi(irq, msidesc);
-       if (ret)
-               goto out_irq;
-
-out:
-       spin_unlock(&irq_mapping_update_lock);
-       return irq;
-out_irq:
-       spin_unlock(&irq_mapping_update_lock);
-       xen_free_irq(irq);
-       return -1;
+       return xen_bind_pirq_msi_to_irq(dev, msidesc,
+                                       map_irq.pirq, map_irq.index,
+                                       (type == PCI_CAP_ID_MSIX) ?
+                                       "msi-x" : "msi");
 }
 #endif
 
diff --git a/include/xen/events.h b/include/xen/events.h
index 72310ed..7151f36 100644
--- a/include/xen/events.h
+++ b/include/xen/events.h
@@ -83,7 +83,7 @@ int xen_map_pirq_gsi(unsigned pirq, unsigned gsi, int 
shareable, char *name);
 #ifdef CONFIG_PCI_MSI
 int xen_allocate_pirq_msi(struct pci_dev *dev, struct msi_desc *msidesc);
 int xen_bind_pirq_msi_to_irq(struct pci_dev *dev, struct msi_desc *msidesc,
-                            int pirq, const char *name);
+                            int pirq, int vector, const char *name);
 int xen_create_msi_irq(struct pci_dev *dev, struct msi_desc *msidesc, int 
type);
 #endif
 
-- 
1.5.6.5


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

<Prev in Thread] Current Thread [Next in Thread>