#ifndef _XEN_MULTICALLS_H1#define _XEN_MULTICALLS_H23#include "xen-ops.h"45/* Multicalls */6struct multicall_space7{8struct multicall_entry *mc;9void *args;10};1112/* Allocate room for a multicall and its args */13struct multicall_space __xen_mc_entry(size_t args);1415DECLARE_PER_CPU(unsigned long, xen_mc_irq_flags);1617/* Call to start a batch of multiple __xen_mc_entry()s. Must be18paired with xen_mc_issue() */19static inline void xen_mc_batch(void)20{21unsigned long flags;22/* need to disable interrupts until this entry is complete */23local_irq_save(flags);24__this_cpu_write(xen_mc_irq_flags, flags);25}2627static inline struct multicall_space xen_mc_entry(size_t args)28{29xen_mc_batch();30return __xen_mc_entry(args);31}3233/* Flush all pending multicalls */34void xen_mc_flush(void);3536/* Issue a multicall if we're not in a lazy mode */37static inline void xen_mc_issue(unsigned mode)38{39if ((paravirt_get_lazy_mode() & mode) == 0)40xen_mc_flush();4142/* restore flags saved in xen_mc_batch */43local_irq_restore(percpu_read(xen_mc_irq_flags));44}4546/* Set up a callback to be called when the current batch is flushed */47void xen_mc_callback(void (*fn)(void *), void *data);4849/*50* Try to extend the arguments of the previous multicall command. The51* previous command's op must match. If it does, then it attempts to52* extend the argument space allocated to the multicall entry by53* arg_size bytes.54*55* The returned multicall_space will return with mc pointing to the56* command on success, or NULL on failure, and args pointing to the57* newly allocated space.58*/59struct multicall_space xen_mc_extend_args(unsigned long op, size_t arg_size);6061#endif /* _XEN_MULTICALLS_H */626364