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 __ORDERED_EVENTS_H
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  3) #define __ORDERED_EVENTS_H
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  4) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  5) #include <linux/types.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  6) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  7) struct perf_sample;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  8) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  9) struct ordered_event {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10) 	u64			timestamp;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11) 	u64			file_offset;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12) 	union perf_event	*event;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13) 	struct list_head	list;
^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) enum oe_flush {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17) 	OE_FLUSH__NONE,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18) 	OE_FLUSH__FINAL,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) 	OE_FLUSH__ROUND,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) 	OE_FLUSH__HALF,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) 	OE_FLUSH__TOP,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) 	OE_FLUSH__TIME,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25) struct ordered_events;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) typedef int (*ordered_events__deliver_t)(struct ordered_events *oe,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28) 					 struct ordered_event *event);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30) struct ordered_events_buffer {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31) 	struct list_head	list;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) 	struct ordered_event	event[];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35) struct ordered_events {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36) 	u64				 last_flush;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37) 	u64				 next_flush;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38) 	u64				 max_timestamp;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39) 	u64				 max_alloc_size;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40) 	u64				 cur_alloc_size;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41) 	struct list_head		 events;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42) 	struct list_head		 cache;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43) 	struct list_head		 to_free;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44) 	struct ordered_events_buffer	*buffer;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45) 	struct ordered_event		*last;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46) 	ordered_events__deliver_t	 deliver;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47) 	int				 buffer_idx;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48) 	unsigned int			 nr_events;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49) 	enum oe_flush			 last_flush_type;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 50) 	u32				 nr_unordered_events;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 51) 	bool				 copy_on_queue;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 52) 	void				*data;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 53) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 54) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 55) int ordered_events__queue(struct ordered_events *oe, union perf_event *event,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 56) 			  u64 timestamp, u64 file_offset);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 57) void ordered_events__delete(struct ordered_events *oe, struct ordered_event *event);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 58) int ordered_events__flush(struct ordered_events *oe, enum oe_flush how);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 59) int ordered_events__flush_time(struct ordered_events *oe, u64 timestamp);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 60) void ordered_events__init(struct ordered_events *oe, ordered_events__deliver_t deliver,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 61) 			  void *data);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 62) void ordered_events__free(struct ordered_events *oe);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 63) void ordered_events__reinit(struct ordered_events *oe);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 64) u64 ordered_events__first_time(struct ordered_events *oe);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 65) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 66) static inline
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 67) void ordered_events__set_alloc_size(struct ordered_events *oe, u64 size)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 68) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 69) 	oe->max_alloc_size = size;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 70) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 71) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 72) static inline
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 73) void ordered_events__set_copy_on_queue(struct ordered_events *oe, bool copy)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 74) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 75) 	oe->copy_on_queue = copy;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 76) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 77) #endif /* __ORDERED_EVENTS_H */