0001
0002 #ifndef _XEN_EVENTS_H
0003 #define _XEN_EVENTS_H
0004
0005 #include <linux/interrupt.h>
0006 #include <linux/irq.h>
0007 #ifdef CONFIG_PCI_MSI
0008 #include <linux/msi.h>
0009 #endif
0010
0011 #include <xen/interface/event_channel.h>
0012 #include <asm/xen/hypercall.h>
0013 #include <asm/xen/events.h>
0014
0015 struct xenbus_device;
0016
0017 unsigned xen_evtchn_nr_channels(void);
0018
0019 int bind_evtchn_to_irq(evtchn_port_t evtchn);
0020 int bind_evtchn_to_irq_lateeoi(evtchn_port_t evtchn);
0021 int bind_evtchn_to_irqhandler(evtchn_port_t evtchn,
0022 irq_handler_t handler,
0023 unsigned long irqflags, const char *devname,
0024 void *dev_id);
0025 int bind_evtchn_to_irqhandler_lateeoi(evtchn_port_t evtchn,
0026 irq_handler_t handler,
0027 unsigned long irqflags, const char *devname,
0028 void *dev_id);
0029 int bind_virq_to_irq(unsigned int virq, unsigned int cpu, bool percpu);
0030 int bind_virq_to_irqhandler(unsigned int virq, unsigned int cpu,
0031 irq_handler_t handler,
0032 unsigned long irqflags, const char *devname,
0033 void *dev_id);
0034 int bind_ipi_to_irqhandler(enum ipi_vector ipi,
0035 unsigned int cpu,
0036 irq_handler_t handler,
0037 unsigned long irqflags,
0038 const char *devname,
0039 void *dev_id);
0040 int bind_interdomain_evtchn_to_irq_lateeoi(struct xenbus_device *dev,
0041 evtchn_port_t remote_port);
0042 int bind_interdomain_evtchn_to_irqhandler_lateeoi(struct xenbus_device *dev,
0043 evtchn_port_t remote_port,
0044 irq_handler_t handler,
0045 unsigned long irqflags,
0046 const char *devname,
0047 void *dev_id);
0048
0049
0050
0051
0052
0053
0054 void unbind_from_irqhandler(unsigned int irq, void *dev_id);
0055
0056
0057
0058
0059
0060 void xen_irq_lateeoi(unsigned int irq, unsigned int eoi_flags);
0061
0062 #define XEN_EOI_FLAG_SPURIOUS 0x00000001
0063
0064 #define XEN_IRQ_PRIORITY_MAX EVTCHN_FIFO_PRIORITY_MAX
0065 #define XEN_IRQ_PRIORITY_DEFAULT EVTCHN_FIFO_PRIORITY_DEFAULT
0066 #define XEN_IRQ_PRIORITY_MIN EVTCHN_FIFO_PRIORITY_MIN
0067 int xen_set_irq_priority(unsigned irq, unsigned priority);
0068
0069
0070
0071
0072 int evtchn_make_refcounted(evtchn_port_t evtchn);
0073 int evtchn_get(evtchn_port_t evtchn);
0074 void evtchn_put(evtchn_port_t evtchn);
0075
0076 void xen_send_IPI_one(unsigned int cpu, enum ipi_vector vector);
0077 void rebind_evtchn_irq(evtchn_port_t evtchn, int irq);
0078 int xen_set_affinity_evtchn(struct irq_desc *desc, unsigned int tcpu);
0079
0080 static inline void notify_remote_via_evtchn(evtchn_port_t port)
0081 {
0082 struct evtchn_send send = { .port = port };
0083 (void)HYPERVISOR_event_channel_op(EVTCHNOP_send, &send);
0084 }
0085
0086 void notify_remote_via_irq(int irq);
0087
0088 void xen_irq_resume(void);
0089
0090
0091 void xen_clear_irq_pending(int irq);
0092 void xen_set_irq_pending(int irq);
0093 bool xen_test_irq_pending(int irq);
0094
0095
0096
0097 void xen_poll_irq(int irq);
0098
0099
0100
0101 void xen_poll_irq_timeout(int irq, u64 timeout);
0102
0103
0104 unsigned int irq_from_evtchn(evtchn_port_t evtchn);
0105 int irq_from_virq(unsigned int cpu, unsigned int virq);
0106 evtchn_port_t evtchn_from_irq(unsigned irq);
0107
0108 int xen_set_callback_via(uint64_t via);
0109 void xen_evtchn_do_upcall(struct pt_regs *regs);
0110 void xen_hvm_evtchn_do_upcall(void);
0111
0112
0113 int xen_bind_pirq_gsi_to_irq(unsigned gsi,
0114 unsigned pirq, int shareable, char *name);
0115
0116 #ifdef CONFIG_PCI_MSI
0117
0118 int xen_allocate_pirq_msi(struct pci_dev *dev, struct msi_desc *msidesc);
0119
0120 int xen_bind_pirq_msi_to_irq(struct pci_dev *dev, struct msi_desc *msidesc,
0121 int pirq, int nvec, const char *name, domid_t domid);
0122 #endif
0123
0124
0125 int xen_destroy_irq(int irq);
0126
0127
0128 int xen_irq_from_pirq(unsigned pirq);
0129
0130
0131 int xen_pirq_from_irq(unsigned irq);
0132
0133
0134 int xen_irq_from_gsi(unsigned gsi);
0135
0136
0137 int xen_test_irq_shared(int irq);
0138
0139
0140 void xen_init_IRQ(void);
0141 #endif