MERGE-master-patchset-edits
[linux-2.6/openmoko-kernel.git] / arch / x86 / xen / multicalls.h
blob858938241616ab88ff53700a4463c698c11dad3d
1 #ifndef _XEN_MULTICALLS_H
2 #define _XEN_MULTICALLS_H
4 #include "xen-ops.h"
6 /* Multicalls */
7 struct multicall_space
9 struct multicall_entry *mc;
10 void *args;
13 /* Allocate room for a multicall and its args */
14 struct multicall_space __xen_mc_entry(size_t args);
16 DECLARE_PER_CPU(unsigned long, xen_mc_irq_flags);
18 /* Call to start a batch of multiple __xen_mc_entry()s. Must be
19 paired with xen_mc_issue() */
20 static inline void xen_mc_batch(void)
22 /* need to disable interrupts until this entry is complete */
23 local_irq_save(__get_cpu_var(xen_mc_irq_flags));
26 static inline struct multicall_space xen_mc_entry(size_t args)
28 xen_mc_batch();
29 return __xen_mc_entry(args);
32 /* Flush all pending multicalls */
33 void xen_mc_flush(void);
35 /* Issue a multicall if we're not in a lazy mode */
36 static inline void xen_mc_issue(unsigned mode)
38 if ((paravirt_get_lazy_mode() & mode) == 0)
39 xen_mc_flush();
41 /* restore flags saved in xen_mc_batch */
42 local_irq_restore(x86_read_percpu(xen_mc_irq_flags));
45 /* Set up a callback to be called when the current batch is flushed */
46 void xen_mc_callback(void (*fn)(void *), void *data);
49 * Try to extend the arguments of the previous multicall command. The
50 * previous command's op must match. If it does, then it attempts to
51 * extend the argument space allocated to the multicall entry by
52 * arg_size bytes.
54 * The returned multicall_space will return with mc pointing to the
55 * command on success, or NULL on failure, and args pointing to the
56 * newly allocated space.
58 struct multicall_space xen_mc_extend_args(unsigned long op, size_t arg_size);
60 #endif /* _XEN_MULTICALLS_H */