summaryrefslogtreecommitdiffstats
path: root/arch/x86/pci
diff options
context:
space:
mode:
authorStefano Stabellini <stefano.stabellini@eu.citrix.com>2010-06-24 16:42:04 +0100
committerStefano Stabellini <stefano.stabellini@eu.citrix.com>2010-10-22 21:25:41 +0100
commit42a1de56f35a9c87932f45439dc1b09c8da0cc95 (patch)
tree4be6a92222ef2efabd1705cd6b3adb7832f7f9a9 /arch/x86/pci
parent01557baff6e9c371d4c96e01089dca32cf347500 (diff)
downloadlinux-42a1de56f35a9c87932f45439dc1b09c8da0cc95.tar.gz
linux-42a1de56f35a9c87932f45439dc1b09c8da0cc95.tar.bz2
linux-42a1de56f35a9c87932f45439dc1b09c8da0cc95.zip
xen: implement xen_hvm_register_pirq
xen_hvm_register_pirq allows the kernel to map a GSI into a Xen pirq and receive the interrupt as an event channel from that point on. Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com> Reviewed-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Diffstat (limited to 'arch/x86/pci')
-rw-r--r--arch/x86/pci/xen.c38
1 files changed, 38 insertions, 0 deletions
diff --git a/arch/x86/pci/xen.c b/arch/x86/pci/xen.c
index 4e371065ce41..08e3cdccdfa8 100644
--- a/arch/x86/pci/xen.c
+++ b/arch/x86/pci/xen.c
@@ -17,6 +17,44 @@
#include <xen/events.h>
#include <asm/xen/pci.h>
+#ifdef CONFIG_ACPI
+static int xen_hvm_register_pirq(u32 gsi, int triggering)
+{
+ int rc, irq;
+ struct physdev_map_pirq map_irq;
+ int shareable = 0;
+ char *name;
+
+ if (!xen_hvm_domain())
+ return -1;
+
+ map_irq.domid = DOMID_SELF;
+ map_irq.type = MAP_PIRQ_TYPE_GSI;
+ map_irq.index = gsi;
+ map_irq.pirq = -1;
+
+ rc = HYPERVISOR_physdev_op(PHYSDEVOP_map_pirq, &map_irq);
+ if (rc) {
+ printk(KERN_WARNING "xen map irq failed %d\n", rc);
+ return -1;
+ }
+
+ if (triggering == ACPI_EDGE_SENSITIVE) {
+ shareable = 0;
+ name = "ioapic-edge";
+ } else {
+ shareable = 1;
+ name = "ioapic-level";
+ }
+
+ irq = xen_map_pirq_gsi(map_irq.pirq, gsi, shareable, name);
+
+ printk(KERN_DEBUG "xen: --> irq=%d, pirq=%d\n", irq, map_irq.pirq);
+
+ return irq;
+}
+#endif
+
#if defined(CONFIG_PCI_MSI)
#include <linux/msi.h>