multicalls.h 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. #ifndef _XEN_MULTICALLS_H
  2. #define _XEN_MULTICALLS_H
  3. #include "xen-ops.h"
  4. /* Multicalls */
  5. struct multicall_space
  6. {
  7. struct multicall_entry *mc;
  8. void *args;
  9. };
  10. /* Allocate room for a multicall and its args */
  11. struct multicall_space __xen_mc_entry(size_t args);
  12. DECLARE_PER_CPU(unsigned long, xen_mc_irq_flags);
  13. /* Call to start a batch of multiple __xen_mc_entry()s. Must be
  14. paired with xen_mc_issue() */
  15. static inline void xen_mc_batch(void)
  16. {
  17. /* need to disable interrupts until this entry is complete */
  18. local_irq_save(__get_cpu_var(xen_mc_irq_flags));
  19. }
  20. static inline struct multicall_space xen_mc_entry(size_t args)
  21. {
  22. xen_mc_batch();
  23. return __xen_mc_entry(args);
  24. }
  25. /* Flush all pending multicalls */
  26. void xen_mc_flush(void);
  27. /* Issue a multicall if we're not in a lazy mode */
  28. static inline void xen_mc_issue(unsigned mode)
  29. {
  30. if ((xen_get_lazy_mode() & mode) == 0)
  31. xen_mc_flush();
  32. /* restore flags saved in xen_mc_batch */
  33. local_irq_restore(x86_read_percpu(xen_mc_irq_flags));
  34. }
  35. #endif /* _XEN_MULTICALLS_H */