diff options
author | Deepak Nibade <dnibade@nvidia.com> | 2016-04-06 06:33:44 -0400 |
---|---|---|
committer | Terje Bergstrom <tbergstrom@nvidia.com> | 2016-04-15 11:11:14 -0400 |
commit | b6dc4315a4c7fa817334797cc2a4b9fb3fbfd55f (patch) | |
tree | 661626690667ed1d2bb9ef72ec7062added33235 /drivers/gpu/nvgpu/gk20a/sync_gk20a.c | |
parent | d369dca4ac742fed024b54d766bb1723916b7d87 (diff) |
gpu: nvgpu: support kernel-3.10 version
Make necessary changes to support nvgpu on kernel-3.10
This includes below changes
- PROBE_PREFER_ASYNCHRONOUS is defined only for K3.10
- Fence handling and struct sync_fence is different between
K3.10 and K3.18
- variable status in struct sync_fence is atomic on K3.18
whereas it is int on K3.10
- if SOC == T132, set soc_name = "tegra13x"
- ioremap_cache() is not defined on K3.10 ARM versions,
hence use ioremap_cached()
Bug 200188753
Change-Id: I18d77eb1404e15054e8510d67c9a61c0f1883e2b
Signed-off-by: Deepak Nibade <dnibade@nvidia.com>
Reviewed-on: http://git-master/r/1121092
Reviewed-by: Terje Bergstrom <tbergstrom@nvidia.com>
Tested-by: Terje Bergstrom <tbergstrom@nvidia.com>
Diffstat (limited to 'drivers/gpu/nvgpu/gk20a/sync_gk20a.c')
-rw-r--r-- | drivers/gpu/nvgpu/gk20a/sync_gk20a.c | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/drivers/gpu/nvgpu/gk20a/sync_gk20a.c b/drivers/gpu/nvgpu/gk20a/sync_gk20a.c index 87d905dd..21622d3d 100644 --- a/drivers/gpu/nvgpu/gk20a/sync_gk20a.c +++ b/drivers/gpu/nvgpu/gk20a/sync_gk20a.c | |||
@@ -15,6 +15,7 @@ | |||
15 | 15 | ||
16 | #include "sync_gk20a.h" | 16 | #include "sync_gk20a.h" |
17 | 17 | ||
18 | #include <linux/version.h> | ||
18 | #include <linux/kernel.h> | 19 | #include <linux/kernel.h> |
19 | #include <linux/file.h> | 20 | #include <linux/file.h> |
20 | #include <linux/fs.h> | 21 | #include <linux/fs.h> |
@@ -149,7 +150,11 @@ static struct gk20a_sync_pt *gk20a_sync_pt_create_shared( | |||
149 | 150 | ||
150 | /* Store the dependency fence for this pt. */ | 151 | /* Store the dependency fence for this pt. */ |
151 | if (dependency) { | 152 | if (dependency) { |
153 | #if LINUX_VERSION_CODE < KERNEL_VERSION(3,18,0) | ||
154 | if (dependency->status == 0) { | ||
155 | #else | ||
152 | if (!atomic_read(&dependency->status)) { | 156 | if (!atomic_read(&dependency->status)) { |
157 | #endif | ||
153 | shared->dep = dependency; | 158 | shared->dep = dependency; |
154 | } else { | 159 | } else { |
155 | shared->dep_timestamp = ktime_get(); | 160 | shared->dep_timestamp = ktime_get(); |
@@ -214,6 +219,9 @@ static int gk20a_sync_pt_has_signaled(struct sync_pt *sync_pt) | |||
214 | { | 219 | { |
215 | struct gk20a_sync_pt *pt = to_gk20a_sync_pt(sync_pt); | 220 | struct gk20a_sync_pt *pt = to_gk20a_sync_pt(sync_pt); |
216 | struct gk20a_sync_timeline *obj = pt->obj; | 221 | struct gk20a_sync_timeline *obj = pt->obj; |
222 | #if LINUX_VERSION_CODE < KERNEL_VERSION(3,18,0) | ||
223 | struct sync_pt *pos; | ||
224 | #endif | ||
217 | bool signaled = true; | 225 | bool signaled = true; |
218 | 226 | ||
219 | spin_lock(&pt->lock); | 227 | spin_lock(&pt->lock); |
@@ -233,6 +241,12 @@ static int gk20a_sync_pt_has_signaled(struct sync_pt *sync_pt) | |||
233 | * first.*/ | 241 | * first.*/ |
234 | if (pt->dep) { | 242 | if (pt->dep) { |
235 | s64 ns = 0; | 243 | s64 ns = 0; |
244 | #if LINUX_VERSION_CODE < KERNEL_VERSION(3,18,0) | ||
245 | struct list_head *dep_pts = &pt->dep->pt_list_head; | ||
246 | list_for_each_entry(pos, dep_pts, pt_list) { | ||
247 | ns = max(ns, ktime_to_ns(pos->timestamp)); | ||
248 | } | ||
249 | #else | ||
236 | struct fence *fence; | 250 | struct fence *fence; |
237 | int i; | 251 | int i; |
238 | 252 | ||
@@ -240,6 +254,7 @@ static int gk20a_sync_pt_has_signaled(struct sync_pt *sync_pt) | |||
240 | fence = pt->dep->cbs[i].sync_pt; | 254 | fence = pt->dep->cbs[i].sync_pt; |
241 | ns = max(ns, ktime_to_ns(fence->timestamp)); | 255 | ns = max(ns, ktime_to_ns(fence->timestamp)); |
242 | } | 256 | } |
257 | #endif | ||
243 | pt->dep_timestamp = ns_to_ktime(ns); | 258 | pt->dep_timestamp = ns_to_ktime(ns); |
244 | sync_fence_put(pt->dep); | 259 | sync_fence_put(pt->dep); |
245 | pt->dep = NULL; | 260 | pt->dep = NULL; |
@@ -260,7 +275,11 @@ static inline ktime_t gk20a_sync_pt_duration(struct sync_pt *sync_pt) | |||
260 | struct gk20a_sync_pt *pt = to_gk20a_sync_pt(sync_pt); | 275 | struct gk20a_sync_pt *pt = to_gk20a_sync_pt(sync_pt); |
261 | if (!gk20a_sync_pt_has_signaled(sync_pt) || !pt->dep_timestamp.tv64) | 276 | if (!gk20a_sync_pt_has_signaled(sync_pt) || !pt->dep_timestamp.tv64) |
262 | return ns_to_ktime(0); | 277 | return ns_to_ktime(0); |
278 | #if LINUX_VERSION_CODE < KERNEL_VERSION(3,18,0) | ||
279 | return ktime_sub(sync_pt->timestamp, pt->dep_timestamp); | ||
280 | #else | ||
263 | return ktime_sub(sync_pt->base.timestamp, pt->dep_timestamp); | 281 | return ktime_sub(sync_pt->base.timestamp, pt->dep_timestamp); |
282 | #endif | ||
264 | } | 283 | } |
265 | 284 | ||
266 | static int gk20a_sync_pt_compare(struct sync_pt *a, struct sync_pt *b) | 285 | static int gk20a_sync_pt_compare(struct sync_pt *a, struct sync_pt *b) |