diff options
author | Debarshi Dutta <ddutta@nvidia.com> | 2018-04-24 01:08:30 -0400 |
---|---|---|
committer | mobile promotions <svcmobile_promotions@nvidia.com> | 2018-05-10 11:40:36 -0400 |
commit | 4f40637c580c5f25f34f45c2c16b5332104897bc (patch) | |
tree | 997eb7390801e3159611d59e0b2f149e43d14470 /drivers/gpu/nvgpu/gk20a/fence_gk20a.c | |
parent | 70e69e2686527990865b221a60e0ec1e9a53d316 (diff) |
gpu: nvgpu: remove sync_fence dependencies from fence_gk20a
Replaced all instances of sync_fence in gk20a_fence* code with
nvgpu_os_fence. Added the API install_fence for the nvgpu_os_fence
abstraction. sync_fence mechanism and its dependencies are completely
removed from the fence_gk20a methods. Due to the recent os_fence changes
and the changes to fence_gk20a, we can finally get rid of all the CONFIG_SYNCS
present in the submit path.
JIRA NVGPU-66
Change-Id: I3551dab04b93b1e94db83fc102a41872be89e9ed
Signed-off-by: Debarshi Dutta <ddutta@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1701245
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Diffstat (limited to 'drivers/gpu/nvgpu/gk20a/fence_gk20a.c')
-rw-r--r-- | drivers/gpu/nvgpu/gk20a/fence_gk20a.c | 36 |
1 files changed, 11 insertions, 25 deletions
diff --git a/drivers/gpu/nvgpu/gk20a/fence_gk20a.c b/drivers/gpu/nvgpu/gk20a/fence_gk20a.c index f0ad773f..0f7f3ea1 100644 --- a/drivers/gpu/nvgpu/gk20a/fence_gk20a.c +++ b/drivers/gpu/nvgpu/gk20a/fence_gk20a.c | |||
@@ -22,25 +22,17 @@ | |||
22 | 22 | ||
23 | #include "fence_gk20a.h" | 23 | #include "fence_gk20a.h" |
24 | 24 | ||
25 | #ifdef CONFIG_SYNC | ||
26 | #include <linux/file.h> | ||
27 | #include <linux/fs.h> | ||
28 | #endif | ||
29 | |||
30 | #include <nvgpu/semaphore.h> | 25 | #include <nvgpu/semaphore.h> |
31 | #include <nvgpu/kmem.h> | 26 | #include <nvgpu/kmem.h> |
32 | #include <nvgpu/soc.h> | 27 | #include <nvgpu/soc.h> |
33 | #include <nvgpu/nvhost.h> | 28 | #include <nvgpu/nvhost.h> |
34 | #include <nvgpu/barrier.h> | 29 | #include <nvgpu/barrier.h> |
30 | #include <nvgpu/os_fence.h> | ||
35 | 31 | ||
36 | #include "gk20a.h" | 32 | #include "gk20a.h" |
37 | #include "channel_gk20a.h" | 33 | #include "channel_gk20a.h" |
38 | #include "sync_gk20a.h" | 34 | #include "sync_gk20a.h" |
39 | 35 | ||
40 | #ifdef CONFIG_SYNC | ||
41 | #include "../drivers/staging/android/sync.h" | ||
42 | #endif | ||
43 | |||
44 | struct gk20a_fence_ops { | 36 | struct gk20a_fence_ops { |
45 | int (*wait)(struct gk20a_fence *, long timeout); | 37 | int (*wait)(struct gk20a_fence *, long timeout); |
46 | bool (*is_expired)(struct gk20a_fence *); | 38 | bool (*is_expired)(struct gk20a_fence *); |
@@ -53,10 +45,8 @@ static void gk20a_fence_free(struct nvgpu_ref *ref) | |||
53 | container_of(ref, struct gk20a_fence, ref); | 45 | container_of(ref, struct gk20a_fence, ref); |
54 | struct gk20a *g = f->g; | 46 | struct gk20a *g = f->g; |
55 | 47 | ||
56 | #ifdef CONFIG_SYNC | 48 | if (nvgpu_os_fence_is_initialized(&f->os_fence)) |
57 | if (f->os_fence) | 49 | f->os_fence.ops->drop_ref(&f->os_fence); |
58 | sync_fence_put(f->os_fence); | ||
59 | #endif | ||
60 | 50 | ||
61 | if (f->semaphore) | 51 | if (f->semaphore) |
62 | nvgpu_semaphore_put(f->semaphore); | 52 | nvgpu_semaphore_put(f->semaphore); |
@@ -91,17 +81,13 @@ inline bool gk20a_fence_is_valid(struct gk20a_fence *f) | |||
91 | 81 | ||
92 | int gk20a_fence_install_fd(struct gk20a_fence *f, int fd) | 82 | int gk20a_fence_install_fd(struct gk20a_fence *f, int fd) |
93 | { | 83 | { |
94 | #ifdef CONFIG_SYNC | 84 | if (!f || !gk20a_fence_is_valid(f) || |
95 | if (!f || !gk20a_fence_is_valid(f) || !f->os_fence) | 85 | !nvgpu_os_fence_is_initialized(&f->os_fence)) |
96 | return -EINVAL; | 86 | return -EINVAL; |
97 | 87 | ||
98 | sync_fence_get(f->os_fence); | 88 | f->os_fence.ops->install_fence(&f->os_fence, fd); |
99 | sync_fence_install(f->os_fence, fd); | ||
100 | 89 | ||
101 | return 0; | 90 | return 0; |
102 | #else | ||
103 | return -ENODEV; | ||
104 | #endif | ||
105 | } | 91 | } |
106 | 92 | ||
107 | int gk20a_fence_wait(struct gk20a *g, struct gk20a_fence *f, | 93 | int gk20a_fence_wait(struct gk20a *g, struct gk20a_fence *f, |
@@ -191,7 +177,7 @@ struct gk20a_fence *gk20a_alloc_fence(struct channel_gk20a *c) | |||
191 | 177 | ||
192 | void gk20a_init_fence(struct gk20a_fence *f, | 178 | void gk20a_init_fence(struct gk20a_fence *f, |
193 | const struct gk20a_fence_ops *ops, | 179 | const struct gk20a_fence_ops *ops, |
194 | struct sync_fence *os_fence) | 180 | struct nvgpu_os_fence os_fence) |
195 | { | 181 | { |
196 | if (!f) | 182 | if (!f) |
197 | return; | 183 | return; |
@@ -229,7 +215,7 @@ int gk20a_fence_from_semaphore( | |||
229 | struct gk20a_fence *fence_out, | 215 | struct gk20a_fence *fence_out, |
230 | struct nvgpu_semaphore *semaphore, | 216 | struct nvgpu_semaphore *semaphore, |
231 | struct nvgpu_cond *semaphore_wq, | 217 | struct nvgpu_cond *semaphore_wq, |
232 | struct sync_fence *os_fence) | 218 | struct nvgpu_os_fence os_fence) |
233 | { | 219 | { |
234 | struct gk20a_fence *f = fence_out; | 220 | struct gk20a_fence *f = fence_out; |
235 | 221 | ||
@@ -290,7 +276,7 @@ static const struct gk20a_fence_ops gk20a_syncpt_fence_ops = { | |||
290 | int gk20a_fence_from_syncpt( | 276 | int gk20a_fence_from_syncpt( |
291 | struct gk20a_fence *fence_out, | 277 | struct gk20a_fence *fence_out, |
292 | struct nvgpu_nvhost_dev *nvhost_dev, | 278 | struct nvgpu_nvhost_dev *nvhost_dev, |
293 | u32 id, u32 value, struct sync_fence *os_fence) | 279 | u32 id, u32 value, struct nvgpu_os_fence os_fence) |
294 | { | 280 | { |
295 | struct gk20a_fence *f = fence_out; | 281 | struct gk20a_fence *f = fence_out; |
296 | 282 | ||
@@ -312,7 +298,7 @@ int gk20a_fence_from_syncpt( | |||
312 | int gk20a_fence_from_syncpt( | 298 | int gk20a_fence_from_syncpt( |
313 | struct gk20a_fence *fence_out, | 299 | struct gk20a_fence *fence_out, |
314 | struct nvgpu_nvhost_dev *nvhost_dev, | 300 | struct nvgpu_nvhost_dev *nvhost_dev, |
315 | u32 id, u32 value, struct sync_fence *os_fence) | 301 | u32 id, u32 value, struct nvgpu_os_fence os_fence) |
316 | { | 302 | { |
317 | return -EINVAL; | 303 | return -EINVAL; |
318 | } | 304 | } |