aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMaarten Lankhorst <maarten.lankhorst@canonical.com>2014-07-01 06:57:37 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2014-07-08 16:36:14 -0400
commit0ba6b8fb91fc051535c7612f6241c8197d92323b (patch)
tree94d403c4d80ad8b1974ec075047d4838ab6c9f7c
parent0f0d8406fb9c3c5ed1b1609a0f51c504c5b37aea (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.h20
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
44extern struct ww_class reservation_ww_class; 46extern struct ww_class reservation_ww_class;
45 47
46struct reservation_object { 48struct 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
50static inline void 56static inline void
51reservation_object_init(struct reservation_object *obj) 57reservation_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
56static inline void 66static inline void
57reservation_object_fini(struct reservation_object *obj) 67reservation_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