1 #ifndef _XEN_MULTICALLS_H
2 #define _XEN_MULTICALLS_H
4 #include <trace/events/xen.h>
11 struct multicall_entry
*mc
;
15 /* Allocate room for a multicall and its args */
16 struct multicall_space
__xen_mc_entry(size_t args
);
18 DECLARE_PER_CPU(unsigned long, xen_mc_irq_flags
);
20 /* Call to start a batch of multiple __xen_mc_entry()s. Must be
21 paired with xen_mc_issue() */
22 static inline void xen_mc_batch(void)
26 /* need to disable interrupts until this entry is complete */
27 local_irq_save(flags
);
28 trace_xen_mc_batch(paravirt_get_lazy_mode());
29 __this_cpu_write(xen_mc_irq_flags
, flags
);
32 static inline struct multicall_space
xen_mc_entry(size_t args
)
35 return __xen_mc_entry(args
);
38 /* Flush all pending multicalls */
39 void xen_mc_flush(void);
41 /* Issue a multicall if we're not in a lazy mode */
42 static inline void xen_mc_issue(unsigned mode
)
44 trace_xen_mc_issue(mode
);
46 if ((paravirt_get_lazy_mode() & mode
) == 0)
49 /* restore flags saved in xen_mc_batch */
50 local_irq_restore(this_cpu_read(xen_mc_irq_flags
));
53 /* Set up a callback to be called when the current batch is flushed */
54 void xen_mc_callback(void (*fn
)(void *), void *data
);
57 * Try to extend the arguments of the previous multicall command. The
58 * previous command's op must match. If it does, then it attempts to
59 * extend the argument space allocated to the multicall entry by
62 * The returned multicall_space will return with mc pointing to the
63 * command on success, or NULL on failure, and args pointing to the
64 * newly allocated space.
66 struct multicall_space
xen_mc_extend_args(unsigned long op
, size_t arg_size
);
68 #endif /* _XEN_MULTICALLS_H */