1 /*
2  * lib_sw_fence.h - library routines for testing N:M synchronisation points
3  *
4  * Copyright (C) 2017 Intel Corporation
5  *
6  * This file is released under the GPLv2.
7  *
8  */
9 
10 #ifndef _LIB_SW_FENCE_H_
11 #define _LIB_SW_FENCE_H_
12 
13 #include <linux/timer.h>
14 
15 #include "../i915_sw_fence.h"
16 
17 #ifdef CONFIG_LOCKDEP
18 #define onstack_fence_init(fence)				\
19 do {								\
20 	static struct lock_class_key __key;			\
21 								\
22 	__onstack_fence_init((fence), #fence, &__key);	\
23 } while (0)
24 #else
25 #define onstack_fence_init(fence)				\
26 	__onstack_fence_init((fence), NULL, NULL)
27 #endif
28 
29 void __onstack_fence_init(struct i915_sw_fence *fence,
30 			  const char *name,
31 			  struct lock_class_key *key);
32 void onstack_fence_fini(struct i915_sw_fence *fence);
33 
34 struct timed_fence {
35 	struct i915_sw_fence fence;
36 	struct timer_list timer;
37 };
38 
39 void timed_fence_init(struct timed_fence *tf, unsigned long expires);
40 void timed_fence_fini(struct timed_fence *tf);
41 
42 #endif /* _LIB_SW_FENCE_H_ */
43