events.h 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. #ifndef _XEN_EVENTS_H
  2. #define _XEN_EVENTS_H
  3. #include <linux/interrupt.h>
  4. #include <xen/interface/event_channel.h>
  5. #include <asm/xen/hypercall.h>
  6. #include <asm/xen/events.h>
  7. int bind_evtchn_to_irq(unsigned int evtchn);
  8. int bind_evtchn_to_irqhandler(unsigned int evtchn,
  9. irq_handler_t handler,
  10. unsigned long irqflags, const char *devname,
  11. void *dev_id);
  12. int bind_virq_to_irqhandler(unsigned int virq, unsigned int cpu,
  13. irq_handler_t handler,
  14. unsigned long irqflags, const char *devname,
  15. void *dev_id);
  16. int bind_ipi_to_irqhandler(enum ipi_vector ipi,
  17. unsigned int cpu,
  18. irq_handler_t handler,
  19. unsigned long irqflags,
  20. const char *devname,
  21. void *dev_id);
  22. /*
  23. * Common unbind function for all event sources. Takes IRQ to unbind from.
  24. * Automatically closes the underlying event channel (even for bindings
  25. * made with bind_evtchn_to_irqhandler()).
  26. */
  27. void unbind_from_irqhandler(unsigned int irq, void *dev_id);
  28. void xen_send_IPI_one(unsigned int cpu, enum ipi_vector vector);
  29. int resend_irq_on_evtchn(unsigned int irq);
  30. void rebind_evtchn_irq(int evtchn, int irq);
  31. static inline void notify_remote_via_evtchn(int port)
  32. {
  33. struct evtchn_send send = { .port = port };
  34. (void)HYPERVISOR_event_channel_op(EVTCHNOP_send, &send);
  35. }
  36. extern void notify_remote_via_irq(int irq);
  37. extern void xen_irq_resume(void);
  38. /* Clear an irq's pending state, in preparation for polling on it */
  39. void xen_clear_irq_pending(int irq);
  40. void xen_set_irq_pending(int irq);
  41. bool xen_test_irq_pending(int irq);
  42. /* Poll waiting for an irq to become pending. In the usual case, the
  43. irq will be disabled so it won't deliver an interrupt. */
  44. void xen_poll_irq(int irq);
  45. /* Determine the IRQ which is bound to an event channel */
  46. unsigned irq_from_evtchn(unsigned int evtchn);
  47. /* Xen HVM evtchn vector callback */
  48. extern void xen_hvm_callback_vector(void);
  49. extern int xen_have_vector_callback;
  50. int xen_set_callback_via(uint64_t via);
  51. void xen_evtchn_do_upcall(struct pt_regs *regs);
  52. void xen_hvm_evtchn_do_upcall(void);
  53. #endif /* _XEN_EVENTS_H */