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