diff options
author | Deepak Nibade <dnibade@nvidia.com> | 2017-01-24 08:30:42 -0500 |
---|---|---|
committer | mobile promotions <svcmobile_promotions@nvidia.com> | 2017-02-22 07:15:02 -0500 |
commit | 8ee3aa4b3175d8d27e57a0f5d5e2cdf3d78a4a58 (patch) | |
tree | 505dfd2ea2aca2f1cbdb254baee980862d21e04d /drivers/gpu/nvgpu/gk20a/fecs_trace_gk20a.c | |
parent | 1f855af63fdd31fe3dcfee75f4f5f9b62f30d87e (diff) |
gpu: nvgpu: use common nvgpu mutex/spinlock APIs
Instead of using Linux APIs for mutex and spinlocks
directly, use new APIs defined in <nvgpu/lock.h>
Replace Linux specific mutex/spinlock declaration,
init, lock, unlock APIs with new APIs
e.g
struct mutex is replaced by struct nvgpu_mutex and
mutex_lock() is replaced by nvgpu_mutex_acquire()
And also include <nvgpu/lock.h> instead of including
<linux/mutex.h> and <linux/spinlock.h>
Add explicit nvgpu/lock.h includes to below
files to fix complilation failures.
gk20a/platform_gk20a.h
include/nvgpu/allocator.h
Jira NVGPU-13
Change-Id: I81a05d21ecdbd90c2076a9f0aefd0e40b215bd33
Signed-off-by: Deepak Nibade <dnibade@nvidia.com>
Reviewed-on: http://git-master/r/1293187
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Diffstat (limited to 'drivers/gpu/nvgpu/gk20a/fecs_trace_gk20a.c')
-rw-r--r-- | drivers/gpu/nvgpu/gk20a/fecs_trace_gk20a.c | 32 |
1 files changed, 16 insertions, 16 deletions
diff --git a/drivers/gpu/nvgpu/gk20a/fecs_trace_gk20a.c b/drivers/gpu/nvgpu/gk20a/fecs_trace_gk20a.c index 1f86fd8f..8244403e 100644 --- a/drivers/gpu/nvgpu/gk20a/fecs_trace_gk20a.c +++ b/drivers/gpu/nvgpu/gk20a/fecs_trace_gk20a.c | |||
@@ -60,8 +60,8 @@ struct gk20a_fecs_trace { | |||
60 | 60 | ||
61 | struct mem_desc trace_buf; | 61 | struct mem_desc trace_buf; |
62 | DECLARE_HASHTABLE(pid_hash_table, GK20A_FECS_TRACE_HASH_BITS); | 62 | DECLARE_HASHTABLE(pid_hash_table, GK20A_FECS_TRACE_HASH_BITS); |
63 | struct mutex hash_lock; | 63 | struct nvgpu_mutex hash_lock; |
64 | struct mutex poll_lock; | 64 | struct nvgpu_mutex poll_lock; |
65 | struct task_struct *poll_task; | 65 | struct task_struct *poll_task; |
66 | }; | 66 | }; |
67 | 67 | ||
@@ -133,14 +133,14 @@ void gk20a_fecs_trace_hash_dump(struct gk20a *g) | |||
133 | 133 | ||
134 | gk20a_dbg(gpu_dbg_ctxsw, "dumping hash table"); | 134 | gk20a_dbg(gpu_dbg_ctxsw, "dumping hash table"); |
135 | 135 | ||
136 | mutex_lock(&trace->hash_lock); | 136 | nvgpu_mutex_acquire(&trace->hash_lock); |
137 | hash_for_each(trace->pid_hash_table, bkt, ent, node) | 137 | hash_for_each(trace->pid_hash_table, bkt, ent, node) |
138 | { | 138 | { |
139 | gk20a_dbg(gpu_dbg_ctxsw, " ent=%p bkt=%x context_ptr=%x pid=%d", | 139 | gk20a_dbg(gpu_dbg_ctxsw, " ent=%p bkt=%x context_ptr=%x pid=%d", |
140 | ent, bkt, ent->context_ptr, ent->pid); | 140 | ent, bkt, ent->context_ptr, ent->pid); |
141 | 141 | ||
142 | } | 142 | } |
143 | mutex_unlock(&trace->hash_lock); | 143 | nvgpu_mutex_release(&trace->hash_lock); |
144 | } | 144 | } |
145 | 145 | ||
146 | static int gk20a_fecs_trace_hash_add(struct gk20a *g, u32 context_ptr, pid_t pid) | 146 | static int gk20a_fecs_trace_hash_add(struct gk20a *g, u32 context_ptr, pid_t pid) |
@@ -161,9 +161,9 @@ static int gk20a_fecs_trace_hash_add(struct gk20a *g, u32 context_ptr, pid_t pid | |||
161 | 161 | ||
162 | he->context_ptr = context_ptr; | 162 | he->context_ptr = context_ptr; |
163 | he->pid = pid; | 163 | he->pid = pid; |
164 | mutex_lock(&trace->hash_lock); | 164 | nvgpu_mutex_acquire(&trace->hash_lock); |
165 | hash_add(trace->pid_hash_table, &he->node, context_ptr); | 165 | hash_add(trace->pid_hash_table, &he->node, context_ptr); |
166 | mutex_unlock(&trace->hash_lock); | 166 | nvgpu_mutex_release(&trace->hash_lock); |
167 | return 0; | 167 | return 0; |
168 | } | 168 | } |
169 | 169 | ||
@@ -176,7 +176,7 @@ static void gk20a_fecs_trace_hash_del(struct gk20a *g, u32 context_ptr) | |||
176 | gk20a_dbg(gpu_dbg_fn | gpu_dbg_ctxsw, | 176 | gk20a_dbg(gpu_dbg_fn | gpu_dbg_ctxsw, |
177 | "freeing hash entry context_ptr=%x", context_ptr); | 177 | "freeing hash entry context_ptr=%x", context_ptr); |
178 | 178 | ||
179 | mutex_lock(&trace->hash_lock); | 179 | nvgpu_mutex_acquire(&trace->hash_lock); |
180 | hash_for_each_possible_safe(trace->pid_hash_table, ent, tmp, node, | 180 | hash_for_each_possible_safe(trace->pid_hash_table, ent, tmp, node, |
181 | context_ptr) { | 181 | context_ptr) { |
182 | if (ent->context_ptr == context_ptr) { | 182 | if (ent->context_ptr == context_ptr) { |
@@ -188,7 +188,7 @@ static void gk20a_fecs_trace_hash_del(struct gk20a *g, u32 context_ptr) | |||
188 | break; | 188 | break; |
189 | } | 189 | } |
190 | } | 190 | } |
191 | mutex_unlock(&trace->hash_lock); | 191 | nvgpu_mutex_release(&trace->hash_lock); |
192 | } | 192 | } |
193 | 193 | ||
194 | static void gk20a_fecs_trace_free_hash_table(struct gk20a *g) | 194 | static void gk20a_fecs_trace_free_hash_table(struct gk20a *g) |
@@ -200,12 +200,12 @@ static void gk20a_fecs_trace_free_hash_table(struct gk20a *g) | |||
200 | 200 | ||
201 | gk20a_dbg(gpu_dbg_fn | gpu_dbg_ctxsw, "trace=%p", trace); | 201 | gk20a_dbg(gpu_dbg_fn | gpu_dbg_ctxsw, "trace=%p", trace); |
202 | 202 | ||
203 | mutex_lock(&trace->hash_lock); | 203 | nvgpu_mutex_acquire(&trace->hash_lock); |
204 | hash_for_each_safe(trace->pid_hash_table, bkt, tmp, ent, node) { | 204 | hash_for_each_safe(trace->pid_hash_table, bkt, tmp, ent, node) { |
205 | hash_del(&ent->node); | 205 | hash_del(&ent->node); |
206 | kfree(ent); | 206 | kfree(ent); |
207 | } | 207 | } |
208 | mutex_unlock(&trace->hash_lock); | 208 | nvgpu_mutex_release(&trace->hash_lock); |
209 | 209 | ||
210 | } | 210 | } |
211 | 211 | ||
@@ -215,7 +215,7 @@ static pid_t gk20a_fecs_trace_find_pid(struct gk20a *g, u32 context_ptr) | |||
215 | struct gk20a_fecs_trace *trace = g->fecs_trace; | 215 | struct gk20a_fecs_trace *trace = g->fecs_trace; |
216 | pid_t pid = 0; | 216 | pid_t pid = 0; |
217 | 217 | ||
218 | mutex_lock(&trace->hash_lock); | 218 | nvgpu_mutex_acquire(&trace->hash_lock); |
219 | hash_for_each_possible(trace->pid_hash_table, ent, node, context_ptr) { | 219 | hash_for_each_possible(trace->pid_hash_table, ent, node, context_ptr) { |
220 | if (ent->context_ptr == context_ptr) { | 220 | if (ent->context_ptr == context_ptr) { |
221 | gk20a_dbg(gpu_dbg_ctxsw, | 221 | gk20a_dbg(gpu_dbg_ctxsw, |
@@ -225,7 +225,7 @@ static pid_t gk20a_fecs_trace_find_pid(struct gk20a *g, u32 context_ptr) | |||
225 | break; | 225 | break; |
226 | } | 226 | } |
227 | } | 227 | } |
228 | mutex_unlock(&trace->hash_lock); | 228 | nvgpu_mutex_release(&trace->hash_lock); |
229 | 229 | ||
230 | return pid; | 230 | return pid; |
231 | } | 231 | } |
@@ -336,7 +336,7 @@ static int gk20a_fecs_trace_poll(struct gk20a *g) | |||
336 | if (unlikely(err)) | 336 | if (unlikely(err)) |
337 | return err; | 337 | return err; |
338 | 338 | ||
339 | mutex_lock(&trace->poll_lock); | 339 | nvgpu_mutex_acquire(&trace->poll_lock); |
340 | write = gk20a_fecs_trace_get_write_index(g); | 340 | write = gk20a_fecs_trace_get_write_index(g); |
341 | if (unlikely((write < 0) || (write >= GK20A_FECS_TRACE_NUM_RECORDS))) { | 341 | if (unlikely((write < 0) || (write >= GK20A_FECS_TRACE_NUM_RECORDS))) { |
342 | gk20a_err(dev_from_gk20a(g), | 342 | gk20a_err(dev_from_gk20a(g), |
@@ -371,7 +371,7 @@ static int gk20a_fecs_trace_poll(struct gk20a *g) | |||
371 | gk20a_fecs_trace_set_read_index(g, read); | 371 | gk20a_fecs_trace_set_read_index(g, read); |
372 | 372 | ||
373 | done: | 373 | done: |
374 | mutex_unlock(&trace->poll_lock); | 374 | nvgpu_mutex_release(&trace->poll_lock); |
375 | gk20a_idle(g->dev); | 375 | gk20a_idle(g->dev); |
376 | return err; | 376 | return err; |
377 | } | 377 | } |
@@ -580,8 +580,8 @@ static int gk20a_fecs_trace_init(struct gk20a *g) | |||
580 | goto clean; | 580 | goto clean; |
581 | } | 581 | } |
582 | 582 | ||
583 | mutex_init(&trace->poll_lock); | 583 | nvgpu_mutex_init(&trace->poll_lock); |
584 | mutex_init(&trace->hash_lock); | 584 | nvgpu_mutex_init(&trace->hash_lock); |
585 | hash_init(trace->pid_hash_table); | 585 | hash_init(trace->pid_hash_table); |
586 | 586 | ||
587 | gk20a_fecs_trace_debugfs_init(g); | 587 | gk20a_fecs_trace_debugfs_init(g); |