diff options
author | Maarten Lankhorst <maarten.lankhorst@canonical.com> | 2014-07-01 06:57:37 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2014-07-08 16:36:14 -0400 |
commit | 0ba6b8fb91fc051535c7612f6241c8197d92323b (patch) | |
tree | 94d403c4d80ad8b1974ec075047d4838ab6c9f7c | |
parent | 0f0d8406fb9c3c5ed1b1609a0f51c504c5b37aea (diff) |
reservation: add support for fences to enable cross-device synchronisation
Signed-off-by: Maarten Lankhorst <maarten.lankhorst@canonical.com>
Acked-by: Sumit Semwal <sumit.semwal@linaro.org>
Acked-by: Daniel Vetter <daniel@ffwll.ch>
Reviewed-by: Rob Clark <robdclark@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r-- | include/linux/reservation.h | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/include/linux/reservation.h b/include/linux/reservation.h index 813dae960ebd..f3f57460a205 100644 --- a/include/linux/reservation.h +++ b/include/linux/reservation.h | |||
@@ -6,7 +6,7 @@ | |||
6 | * Copyright (C) 2012 Texas Instruments | 6 | * Copyright (C) 2012 Texas Instruments |
7 | * | 7 | * |
8 | * Authors: | 8 | * Authors: |
9 | * Rob Clark <rob.clark@linaro.org> | 9 | * Rob Clark <robdclark@gmail.com> |
10 | * Maarten Lankhorst <maarten.lankhorst@canonical.com> | 10 | * Maarten Lankhorst <maarten.lankhorst@canonical.com> |
11 | * Thomas Hellstrom <thellstrom-at-vmware-dot-com> | 11 | * Thomas Hellstrom <thellstrom-at-vmware-dot-com> |
12 | * | 12 | * |
@@ -40,22 +40,40 @@ | |||
40 | #define _LINUX_RESERVATION_H | 40 | #define _LINUX_RESERVATION_H |
41 | 41 | ||
42 | #include <linux/ww_mutex.h> | 42 | #include <linux/ww_mutex.h> |
43 | #include <linux/fence.h> | ||
44 | #include <linux/slab.h> | ||
43 | 45 | ||
44 | extern struct ww_class reservation_ww_class; | 46 | extern struct ww_class reservation_ww_class; |
45 | 47 | ||
46 | struct reservation_object { | 48 | struct reservation_object { |
47 | struct ww_mutex lock; | 49 | struct ww_mutex lock; |
50 | |||
51 | struct fence *fence_excl; | ||
52 | struct fence **fence_shared; | ||
53 | u32 fence_shared_count, fence_shared_max; | ||
48 | }; | 54 | }; |
49 | 55 | ||
50 | static inline void | 56 | static inline void |
51 | reservation_object_init(struct reservation_object *obj) | 57 | reservation_object_init(struct reservation_object *obj) |
52 | { | 58 | { |
53 | ww_mutex_init(&obj->lock, &reservation_ww_class); | 59 | ww_mutex_init(&obj->lock, &reservation_ww_class); |
60 | |||
61 | obj->fence_shared_count = obj->fence_shared_max = 0; | ||
62 | obj->fence_shared = NULL; | ||
63 | obj->fence_excl = NULL; | ||
54 | } | 64 | } |
55 | 65 | ||
56 | static inline void | 66 | static inline void |
57 | reservation_object_fini(struct reservation_object *obj) | 67 | reservation_object_fini(struct reservation_object *obj) |
58 | { | 68 | { |
69 | int i; | ||
70 | |||
71 | if (obj->fence_excl) | ||
72 | fence_put(obj->fence_excl); | ||
73 | for (i = 0; i < obj->fence_shared_count; ++i) | ||
74 | fence_put(obj->fence_shared[i]); | ||
75 | kfree(obj->fence_shared); | ||
76 | |||
59 | ww_mutex_destroy(&obj->lock); | 77 | ww_mutex_destroy(&obj->lock); |
60 | } | 78 | } |
61 | 79 | ||