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) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  2)  * Sync File validation framework and debug infomation
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  3)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  4)  * Copyright (C) 2012 Google, Inc.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  5)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  6)  * This program is distributed in the hope that it will be useful,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  7)  * but WITHOUT ANY WARRANTY; without even the implied warranty of
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  8)  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  9)  * GNU General Public License for more details.
^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) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13) #ifndef _LINUX_SYNC_H
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14) #define _LINUX_SYNC_H
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16) #include <linux/list.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17) #include <linux/rbtree.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18) #include <linux/spinlock.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) #include <linux/dma-fence.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) #include <linux/sync_file.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) #include <uapi/linux/sync_file.h>
^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 sync_timeline - sync object
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26)  * @kref:		reference count on fence.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27)  * @name:		name of the sync_timeline. Useful for debugging
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28)  * @lock:		lock protecting @pt_list and @value
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29)  * @pt_tree:		rbtree of active (unsignaled/errored) sync_pts
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30)  * @pt_list:		list of active (unsignaled/errored) sync_pts
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31)  * @sync_timeline_list:	membership in global sync_timeline_list
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33) struct sync_timeline {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34) 	struct kref		kref;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35) 	char			name[32];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37) 	/* protected by lock */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38) 	u64			context;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39) 	int			value;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41) 	struct rb_root		pt_tree;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42) 	struct list_head	pt_list;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43) 	spinlock_t		lock;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45) 	struct list_head	sync_timeline_list;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48) static inline struct sync_timeline *dma_fence_parent(struct dma_fence *fence)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 50) 	return container_of(fence->lock, struct sync_timeline, lock);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 51) }
^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)  * struct sync_pt - sync_pt object
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 55)  * @base: base fence object
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 56)  * @link: link on the sync timeline's list
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 57)  * @node: node in the sync timeline's tree
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 58)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 59) struct sync_pt {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 60) 	struct dma_fence base;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 61) 	struct list_head link;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 62) 	struct rb_node node;
^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) extern const struct file_operations sw_sync_debugfs_fops;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 66) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 67) #ifdef CONFIG_SW_SYNC_DEBUG
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 68) void sync_timeline_debug_add(struct sync_timeline *obj);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 69) void sync_timeline_debug_remove(struct sync_timeline *obj);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 70) void sync_file_debug_add(struct sync_file *fence);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 71) void sync_file_debug_remove(struct sync_file *fence);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 72) #else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 73) static inline void sync_timeline_debug_add(struct sync_timeline *obj) {}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 74) static inline void sync_timeline_debug_remove(struct sync_timeline *obj) {}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 75) static inline void sync_file_debug_add(struct sync_file *fence) {}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 76) static inline void sync_file_debug_remove(struct sync_file *fence) {}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 77) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 78) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 79) #endif /* _LINUX_SYNC_H */