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 28/31] For non-privileged domains, implement a pcibio

To: xen-devel@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-devel] [PATCH 28/31] For non-privileged domains, implement a pcibios_enable_irq (xen_pcifront_enable_irq) function.
From: Konrad Rzeszutek Wilk <konrad.wilk@xxxxxxxxxx>
Date: Thu, 5 Nov 2009 16:33:36 -0500
Cc: Jeremy Fitzhardinge <jeremy@xxxxxxxx>, Konrad Rzeszutek Wilk <konrad.wilk@xxxxxxxxxx>
Delivery-date: Thu, 05 Nov 2009 13:56:36 -0800
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <1257456819-782-28-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: <1257456819-782-1-git-send-email-konrad.wilk@xxxxxxxxxx> <1257456819-782-2-git-send-email-konrad.wilk@xxxxxxxxxx> <1257456819-782-3-git-send-email-konrad.wilk@xxxxxxxxxx> <1257456819-782-4-git-send-email-konrad.wilk@xxxxxxxxxx> <1257456819-782-5-git-send-email-konrad.wilk@xxxxxxxxxx> <1257456819-782-6-git-send-email-konrad.wilk@xxxxxxxxxx> <1257456819-782-7-git-send-email-konrad.wilk@xxxxxxxxxx> <1257456819-782-8-git-send-email-konrad.wilk@xxxxxxxxxx> <1257456819-782-9-git-send-email-konrad.wilk@xxxxxxxxxx> <1257456819-782-10-git-send-email-konrad.wilk@xxxxxxxxxx> <1257456819-782-11-git-send-email-konrad.wilk@xxxxxxxxxx> <1257456819-782-12-git-send-email-konrad.wilk@xxxxxxxxxx> <1257456819-782-13-git-send-email-konrad.wilk@xxxxxxxxxx> <1257456819-782-14-git-send-email-konrad.wilk@xxxxxxxxxx> <1257456819-782-15-git-send-email-konrad.wilk@xxxxxxxxxx> <1257456819-782-16-git-send-email-konrad.wilk@xxxxxxxxxx> <1257456819-782-17-git-send-email-konrad.wilk@xxxxxxxxxx> <1257456819-782-18-git-send-email-konrad.wilk@xxxxxxxxxx> <1257456819-782-19-git-send-email-konrad.wilk@xxxxxxxxxx> <1257456819-782-20-git-send-email-konrad.wilk@xxxxxxxxxx> <1257456819-782-21-git-send-email-konrad.wilk@xxxxxxxxxx> <1257456819-782-22-git-send-email-konrad.wilk@xxxxxxxxxx> <1257456819-782-23-git-send-email-konrad.wilk@xxxxxxxxxx> <1257456819-782-24-git-send-email-konrad.wilk@xxxxxxxxxx> <1257456819-782-25-git-send-email-konrad.wilk@xxxxxxxxxx> <1257456819-782-26-git-send-email-konrad.wilk@xxxxxxxxxx> <1257456819-782-27-git-send-email-konrad.wilk@xxxxxxxxxx> <1257456819-782-28-git-send-email-konrad.wilk@xxxxxxxxxx>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
This function calls the 'xen_allocate_pirq' which does the 
majority of work: allocate a free IRQ descriptor, setup an IRQ chip, etc.

Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@xxxxxxxxxx>
---
 arch/x86/pci/xen.c   |   15 +++++++++++++++
 drivers/xen/events.c |   12 ++++++++++--
 2 files changed, 25 insertions(+), 2 deletions(-)

diff --git a/arch/x86/pci/xen.c b/arch/x86/pci/xen.c
index 1b922aa..c4580b8 100644
--- a/arch/x86/pci/xen.c
+++ b/arch/x86/pci/xen.c
@@ -14,8 +14,23 @@
 
 #include <asm/xen/hypervisor.h>
 
+#include <xen/events.h>
+
 static int xen_pcifront_enable_irq(struct pci_dev *dev)
 {
+       int rc;
+
+       dev_info(&dev->dev, "Xen PCI enabling IRQ: %d\n", dev->irq);
+
+       if (dev->irq < 0)
+               return -EINVAL;
+
+       rc = xen_allocate_pirq(dev->irq, "pcifront");
+       if (rc < 0) {
+               dev_warn(&dev->dev, "Xen PCI IRQ: %d, failed to register:%d\n",
+                        dev->irq, rc);
+               return rc;
+       }
        return 0;
 }
 
diff --git a/drivers/xen/events.c b/drivers/xen/events.c
index b2c1b09..40bcbde 100644
--- a/drivers/xen/events.c
+++ b/drivers/xen/events.c
@@ -561,7 +561,9 @@ int xen_allocate_pirq(unsigned gsi, char *name)
                goto out;       /* XXX need refcount? */
        }
 
-       if (identity_mapped_irq(gsi)) {
+       /* If we are a PV guest, we don't have GSIs (no ACPI passed). Therefore
+        * we are using the !xen_initial_domain() to drop in the function.*/
+       if (identity_mapped_irq(gsi) || !xen_initial_domain()) {
                irq = gsi;
                irq_to_desc_alloc_node(irq, 0);
                dynamic_irq_init(irq);
@@ -572,7 +574,13 @@ int xen_allocate_pirq(unsigned gsi, char *name)
                                      handle_level_irq, name);
 
        irq_op.irq = gsi;
-       if (HYPERVISOR_physdev_op(PHYSDEVOP_alloc_irq_vector, &irq_op)) {
+       irq_op.vector = 0;
+
+       /* Only the privileged domain can do this. For non-priv, the pcifront
+        * driver provides a PCI bus that does the call to do exactly
+        * this in the priv domain. */
+       if (xen_initial_domain() &&
+           HYPERVISOR_physdev_op(PHYSDEVOP_alloc_irq_vector, &irq_op)) {
                dynamic_irq_cleanup(irq);
                irq = -ENOSPC;
                goto out;
-- 
1.6.2.5


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

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