Orange Pi5 kernel

Deprecated Linux kernel 5.10.110 for OrangePi 5/5B/5+ boards

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