Blame view
arch/x86/xen/multicalls.h
1.75 KB
5ead97c84
|
1 2 |
#ifndef _XEN_MULTICALLS_H #define _XEN_MULTICALLS_H |
84cdee76b
|
3 |
#include <trace/events/xen.h> |
5ead97c84
|
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
#include "xen-ops.h" /* Multicalls */ struct multicall_space { struct multicall_entry *mc; void *args; }; /* Allocate room for a multicall and its args */ struct multicall_space __xen_mc_entry(size_t args); DECLARE_PER_CPU(unsigned long, xen_mc_irq_flags); /* Call to start a batch of multiple __xen_mc_entry()s. Must be paired with xen_mc_issue() */ static inline void xen_mc_batch(void) { |
06fc732c3
|
22 |
unsigned long flags; |
84cdee76b
|
23 |
|
5ead97c84
|
24 |
/* need to disable interrupts until this entry is complete */ |
06fc732c3
|
25 |
local_irq_save(flags); |
c796f213a
|
26 |
trace_xen_mc_batch(paravirt_get_lazy_mode()); |
780f36d8b
|
27 |
__this_cpu_write(xen_mc_irq_flags, flags); |
5ead97c84
|
28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
} static inline struct multicall_space xen_mc_entry(size_t args) { xen_mc_batch(); return __xen_mc_entry(args); } /* Flush all pending multicalls */ void xen_mc_flush(void); /* Issue a multicall if we're not in a lazy mode */ static inline void xen_mc_issue(unsigned mode) { |
c796f213a
|
42 |
trace_xen_mc_issue(mode); |
8965c1c09
|
43 |
if ((paravirt_get_lazy_mode() & mode) == 0) |
5ead97c84
|
44 45 46 |
xen_mc_flush(); /* restore flags saved in xen_mc_batch */ |
6dbde3530
|
47 |
local_irq_restore(percpu_read(xen_mc_irq_flags)); |
5ead97c84
|
48 |
} |
91e0c5f3d
|
49 50 |
/* Set up a callback to be called when the current batch is flushed */ void xen_mc_callback(void (*fn)(void *), void *data); |
400d34944
|
51 52 53 54 55 56 57 58 59 60 61 |
/* * Try to extend the arguments of the previous multicall command. The * previous command's op must match. If it does, then it attempts to * extend the argument space allocated to the multicall entry by * arg_size bytes. * * The returned multicall_space will return with mc pointing to the * command on success, or NULL on failure, and args pointing to the * newly allocated space. */ struct multicall_space xen_mc_extend_args(unsigned long op, size_t arg_size); |
5ead97c84
|
62 |
#endif /* _XEN_MULTICALLS_H */ |