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