summaryrefslogtreecommitdiffstats
path: root/include/xen
diff options
context:
space:
mode:
authorJeremy Fitzhardinge <jeremy@xensource.com>2007-07-17 18:37:05 -0700
committerJeremy Fitzhardinge <jeremy@goop.org>2007-07-18 08:47:42 -0700
commite46cdb66c8fc1c8d61cfae0f219ff47ac4b9d531 (patch)
tree7d9cdfef91e69fcfcba762a5a70cd58900308a5b /include/xen
parent3b827c1b3aadf3adb4c602d19863f2d24e7cbc18 (diff)
downloadlinux-e46cdb66c8fc1c8d61cfae0f219ff47ac4b9d531.tar.gz
linux-e46cdb66c8fc1c8d61cfae0f219ff47ac4b9d531.tar.bz2
linux-e46cdb66c8fc1c8d61cfae0f219ff47ac4b9d531.zip
xen: event channels
Xen implements interrupts in terms of event channels. Each guest domain gets 1024 event channels which can be used for a variety of purposes, such as Xen timer events, inter-domain events, inter-processor events (IPI) or for real hardware IRQs. Within the kernel, we map the event channels to IRQs, and implement the whole interrupt handling using a Xen irq_chip. Rather than setting NR_IRQ to 1024 under PARAVIRT in order to accomodate Xen, we create a dynamic mapping between event channels and IRQs. Ideally, Linux will eventually move towards dynamically allocating per-irq structures, and we can use a 1:1 mapping between event channels and irqs. Signed-off-by: Jeremy Fitzhardinge <jeremy@xensource.com> Signed-off-by: Chris Wright <chrisw@sous-sol.org> Cc: Ingo Molnar <mingo@elte.hu> Cc: Eric W. Biederman <ebiederm@xmission.com>
Diffstat (limited to 'include/xen')
-rw-r--r--include/xen/events.h28
1 files changed, 28 insertions, 0 deletions
diff --git a/include/xen/events.h b/include/xen/events.h
new file mode 100644
index 000000000000..77f71c906823
--- /dev/null
+++ b/include/xen/events.h
@@ -0,0 +1,28 @@
+#ifndef _XEN_EVENTS_H
+#define _XEN_EVENTS_H
+
+#include <linux/irq.h>
+
+int bind_evtchn_to_irqhandler(unsigned int evtchn,
+ irqreturn_t (*handler)(int, void *),
+ unsigned long irqflags, const char *devname,
+ void *dev_id);
+int bind_virq_to_irqhandler(unsigned int virq, unsigned int cpu,
+ irqreturn_t (*handler)(int, void *),
+ unsigned long irqflags, const char *devname, void *dev_id);
+
+/*
+ * Common unbind function for all event sources. Takes IRQ to unbind from.
+ * Automatically closes the underlying event channel (even for bindings
+ * made with bind_evtchn_to_irqhandler()).
+ */
+void unbind_from_irqhandler(unsigned int irq, void *dev_id);
+
+static inline void notify_remote_via_evtchn(int port)
+{
+ struct evtchn_send send = { .port = port };
+ (void)HYPERVISOR_event_channel_op(EVTCHNOP_send, &send);
+}
+
+extern void notify_remote_via_irq(int irq);
+#endif /* _XEN_EVENTS_H */