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 3/9] Alter 'xen_create_msi_irq' to respect an PIRQ ov

To: xen-devel@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-devel] [PATCH 3/9] Alter 'xen_create_msi_irq' to respect an PIRQ override when in non-privileged PV mode.
From: Konrad Rzeszutek Wilk <konrad.wilk@xxxxxxxxxx>
Date: Mon, 9 Nov 2009 16:17:33 -0500
Cc: Jeremy Fitzhardinge <jeremy@xxxxxxxx>, Konrad Rzeszutek Wilk <konrad.wilk@xxxxxxxxxx>
Delivery-date: Mon, 09 Nov 2009 13:26:34 -0800
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <1257801459-19404-3-git-send-email-konrad.wilk@xxxxxxxxxx>
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: <1257801459-19404-1-git-send-email-konrad.wilk@xxxxxxxxxx> <1257801459-19404-2-git-send-email-konrad.wilk@xxxxxxxxxx> <1257801459-19404-3-git-send-email-konrad.wilk@xxxxxxxxxx>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
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