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

[Xen-devel] [PATCH 31/31] To enable MSI devices in a non-privileged PV domain use pci_frontend_enable_msi.



The return argument of pci_frontend_enable_msi provides the PIRQ
number allocated by Xen Hypervisor. We will use that to bind
the local IRQ number to it.

Tested succesfully with MSI devices.

Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@xxxxxxxxxx>
---
 drivers/xen/events.c |   19 +++++++++++++++++++
 1 files changed, 19 insertions(+), 0 deletions(-)

diff --git a/drivers/xen/events.c b/drivers/xen/events.c
index fd55b5b..f432c13 100644
--- a/drivers/xen/events.c
+++ b/drivers/xen/events.c
@@ -39,6 +39,7 @@
 #include <asm/sync_bitops.h>
 #include <asm/xen/hypercall.h>
 #include <asm/xen/hypervisor.h>
+#include <asm/xen/pci.h>
 
 #include <xen/xen-ops.h>
 #include <xen/events.h>
@@ -713,6 +714,24 @@ int xen_create_msi_irq(struct pci_dev *dev, struct 
msi_desc *msidesc, int type)
                        irq = -1;
                        goto out;
                }
+       } else {
+               int pirq = 0;
+               /* TODO: MSI-X not yet supported. */
+               if (type == PCI_CAP_ID_MSIX) {
+                       dev_warn(&dev->dev, "pcifront: MSI-X not supported.\n");
+                       rc = -ENODEV;
+               } else
+                       rc = pci_frontend_enable_msi(dev, &pirq);
+               if (rc) {
+                       printk(KERN_WARNING "xen map irq failed %d\n", rc);
+                       dynamic_irq_cleanup(irq);
+                       irq = -1;
+                       goto out;
+               }
+               map_irq.pirq = pirq;
+               map_irq.index = 0;
+               dev_info(&dev->dev, "Allocated IRQ %d (vector: %d)\n",
+                                    irq, map_irq.pirq);
        }
        irq_info[irq] = mk_pirq_info(0, map_irq.pirq, map_irq.index);
        if (domid)
-- 
1.6.2.5


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


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.