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 __PERF_BLOCK_RANGE_H
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  3) #define __PERF_BLOCK_RANGE_H
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  4) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  5) #include <stdbool.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  6) #include <linux/rbtree.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  7) #include <linux/types.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  8) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  9) struct symbol;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12)  * struct block_range - non-overlapping parts of basic blocks
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13)  * @node:	treenode
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14)  * @start:	inclusive start of range
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15)  * @end:	inclusive end of range
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16)  * @is_target:	@start is a jump target
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17)  * @is_branch:	@end is a branch instruction
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18)  * @coverage:	number of blocks that cover this range
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19)  * @taken:	number of times the branch is taken (requires @is_branch)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20)  * @pred:	number of times the taken branch was predicted
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) struct block_range {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23) 	struct rb_node node;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25) 	struct symbol *sym;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) 	u64 start;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28) 	u64 end;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30) 	int is_target, is_branch;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) 	u64 coverage;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33) 	u64 entry;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34) 	u64 taken;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35) 	u64 pred;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38) static inline struct block_range *block_range__next(struct block_range *br)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40) 	struct rb_node *n = rb_next(&br->node);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41) 	if (!n)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42) 		return NULL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43) 	return rb_entry(n, struct block_range, node);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46) struct block_range_iter {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47) 	struct block_range *start;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48) 	struct block_range *end;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 50) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 51) static inline struct block_range *block_range_iter(struct block_range_iter *iter)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 52) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 53) 	return iter->start;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 54) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 55) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 56) static inline bool block_range_iter__next(struct block_range_iter *iter)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 57) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 58) 	if (iter->start == iter->end)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 59) 		return false;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 60) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 61) 	iter->start = block_range__next(iter->start);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 62) 	return true;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 63) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 64) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 65) static inline bool block_range_iter__valid(struct block_range_iter *iter)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 66) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 67) 	if (!iter->start || !iter->end)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 68) 		return false;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 69) 	return true;
^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) extern struct block_range *block_range__find(u64 addr);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 73) extern struct block_range_iter block_range__create(u64 start, u64 end);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 74) extern double block_range__coverage(struct block_range *br);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 75) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 76) #endif /* __PERF_BLOCK_RANGE_H */