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

[Xen-devel] [PATCH 3/9] Alter 'xen_create_msi_irq' to respect an PIRQ override when in non-privileged PV mode.



Only privileged domains can get PCI INTx/MSI PIRQ values for a domain. As such,
'xen_create_msi_irq' in non-privileged mode needs to only do kernel IRQ 
book-keeping.
But, it still needs a PIRQ value to bind to its local IRQ - this PIRQ value is 
now
being passed in as an argument.

Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@xxxxxxxxxx>
---
 arch/x86/include/asm/xen/pci.h |    4 ++--
 arch/x86/xen/pci.c             |    2 +-
 drivers/xen/events.c           |   24 ++++++++++++++++--------
 3 files changed, 19 insertions(+), 11 deletions(-)

diff --git a/arch/x86/include/asm/xen/pci.h b/arch/x86/include/asm/xen/pci.h
index b72c858..4774ae0 100644
--- a/arch/x86/include/asm/xen/pci.h
+++ b/arch/x86/include/asm/xen/pci.h
@@ -5,7 +5,7 @@
 int xen_register_gsi(u32 gsi, int triggering, int polarity);
 int xen_create_msi_irq(struct pci_dev *dev,
                        struct msi_desc *msidesc,
-                       int type);
+                       int type, int pirq_override);
 int xen_destroy_irq(int irq);
 #else
 static inline int xen_register_gsi(u32 gsi, int triggering, int polarity)
@@ -15,7 +15,7 @@ static inline int xen_register_gsi(u32 gsi, int triggering, 
int polarity)
 
 static inline int xen_create_msi_irq(struct pci_dev *dev,
                                struct msi_desc *msidesc,
-                               int type)
+                               int type, int pirq_override)
 {
        return -1;
 }
diff --git a/arch/x86/xen/pci.c b/arch/x86/xen/pci.c
index 44d91ad..00b8b09 100644
--- a/arch/x86/xen/pci.c
+++ b/arch/x86/xen/pci.c
@@ -94,7 +94,7 @@ int xen_setup_msi_irqs(struct pci_dev *dev, int nvec, int 
type)
        struct msi_desc *msidesc;
 
        list_for_each_entry(msidesc, &dev->msi_list, list) {
-               irq = xen_create_msi_irq(dev, msidesc, type);
+               irq = xen_create_msi_irq(dev, msidesc, type, 0 /* for now. */);
                if (irq < 0)
                        return -1;
 
diff --git a/drivers/xen/events.c b/drivers/xen/events.c
index 48b806a..b791031 100644
--- a/drivers/xen/events.c
+++ b/drivers/xen/events.c
@@ -662,7 +662,8 @@ static int get_domid_for_dev(char *nodename, char *path, 
char *val, void *data)
        return 0;
 }
 
-int xen_create_msi_irq(struct pci_dev *dev, struct msi_desc *msidesc, int type)
+int xen_create_msi_irq(struct pci_dev *dev, struct msi_desc *msidesc,
+                      int type, int pirq_override)
 {
        int irq = 0;
        struct physdev_map_pirq map_irq;
@@ -703,17 +704,24 @@ int xen_create_msi_irq(struct pci_dev *dev, struct 
msi_desc *msidesc, int type)
        if (irq == -1)
                goto out;
 
-       if (xen_initial_domain()) {
+       /* Only the privileged domain can do this. For non-priv PV domains
+        * we have to make a call to pci_frontend_* before so that the priv
+        * domain can do it for us. The 'pirq_override' is its return value. */
+
+       if (xen_initial_domain())
                rc = HYPERVISOR_physdev_op(PHYSDEVOP_map_pirq, &map_irq);
-               if (rc) {
+       else {
+               rc = pirq_override ? 0 : -ENODEV;
+               map_irq.pirq = pirq_override;
+       }
+       if (rc) {
 
-                       printk(KERN_WARNING "xen map irq failed %d\n", rc);
+               printk(KERN_WARNING "xen map irq failed %d\n", rc);
 
-                       dynamic_irq_cleanup(irq);
+               dynamic_irq_cleanup(irq);
 
-                       irq = -1;
-                       goto out;
-               }
+               irq = -1;
+               goto out;
        }
        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®.