diff options
Diffstat (limited to 'drivers/gpu/nvgpu/gk20a/tsg_gk20a.c')
-rw-r--r-- | drivers/gpu/nvgpu/gk20a/tsg_gk20a.c | 40 |
1 files changed, 20 insertions, 20 deletions
diff --git a/drivers/gpu/nvgpu/gk20a/tsg_gk20a.c b/drivers/gpu/nvgpu/gk20a/tsg_gk20a.c index 96d6873d..aadf5463 100644 --- a/drivers/gpu/nvgpu/gk20a/tsg_gk20a.c +++ b/drivers/gpu/nvgpu/gk20a/tsg_gk20a.c | |||
@@ -169,7 +169,7 @@ int gk20a_init_tsg_support(struct gk20a *g, u32 tsgid) | |||
169 | init_rwsem(&tsg->ch_list_lock); | 169 | init_rwsem(&tsg->ch_list_lock); |
170 | 170 | ||
171 | INIT_LIST_HEAD(&tsg->event_id_list); | 171 | INIT_LIST_HEAD(&tsg->event_id_list); |
172 | mutex_init(&tsg->event_id_list_lock); | 172 | nvgpu_mutex_init(&tsg->event_id_list_lock); |
173 | 173 | ||
174 | return 0; | 174 | return 0; |
175 | } | 175 | } |
@@ -204,7 +204,7 @@ static int gk20a_tsg_get_event_data_from_id(struct tsg_gk20a *tsg, | |||
204 | struct gk20a_event_id_data *local_event_id_data; | 204 | struct gk20a_event_id_data *local_event_id_data; |
205 | bool event_found = false; | 205 | bool event_found = false; |
206 | 206 | ||
207 | mutex_lock(&tsg->event_id_list_lock); | 207 | nvgpu_mutex_acquire(&tsg->event_id_list_lock); |
208 | list_for_each_entry(local_event_id_data, &tsg->event_id_list, | 208 | list_for_each_entry(local_event_id_data, &tsg->event_id_list, |
209 | event_id_node) { | 209 | event_id_node) { |
210 | if (local_event_id_data->event_id == event_id) { | 210 | if (local_event_id_data->event_id == event_id) { |
@@ -212,7 +212,7 @@ static int gk20a_tsg_get_event_data_from_id(struct tsg_gk20a *tsg, | |||
212 | break; | 212 | break; |
213 | } | 213 | } |
214 | } | 214 | } |
215 | mutex_unlock(&tsg->event_id_list_lock); | 215 | nvgpu_mutex_release(&tsg->event_id_list_lock); |
216 | 216 | ||
217 | if (event_found) { | 217 | if (event_found) { |
218 | *event_id_data = local_event_id_data; | 218 | *event_id_data = local_event_id_data; |
@@ -233,7 +233,7 @@ void gk20a_tsg_event_id_post_event(struct tsg_gk20a *tsg, | |||
233 | if (err) | 233 | if (err) |
234 | return; | 234 | return; |
235 | 235 | ||
236 | mutex_lock(&event_id_data->lock); | 236 | nvgpu_mutex_acquire(&event_id_data->lock); |
237 | 237 | ||
238 | gk20a_dbg_info( | 238 | gk20a_dbg_info( |
239 | "posting event for event_id=%d on tsg=%d\n", | 239 | "posting event for event_id=%d on tsg=%d\n", |
@@ -242,7 +242,7 @@ void gk20a_tsg_event_id_post_event(struct tsg_gk20a *tsg, | |||
242 | 242 | ||
243 | wake_up_interruptible_all(&event_id_data->event_id_wq); | 243 | wake_up_interruptible_all(&event_id_data->event_id_wq); |
244 | 244 | ||
245 | mutex_unlock(&event_id_data->lock); | 245 | nvgpu_mutex_release(&event_id_data->lock); |
246 | } | 246 | } |
247 | 247 | ||
248 | static int gk20a_tsg_event_id_enable(struct tsg_gk20a *tsg, | 248 | static int gk20a_tsg_event_id_enable(struct tsg_gk20a *tsg, |
@@ -287,12 +287,12 @@ static int gk20a_tsg_event_id_enable(struct tsg_gk20a *tsg, | |||
287 | event_id_data->event_id = event_id; | 287 | event_id_data->event_id = event_id; |
288 | 288 | ||
289 | init_waitqueue_head(&event_id_data->event_id_wq); | 289 | init_waitqueue_head(&event_id_data->event_id_wq); |
290 | mutex_init(&event_id_data->lock); | 290 | nvgpu_mutex_init(&event_id_data->lock); |
291 | INIT_LIST_HEAD(&event_id_data->event_id_node); | 291 | INIT_LIST_HEAD(&event_id_data->event_id_node); |
292 | 292 | ||
293 | mutex_lock(&tsg->event_id_list_lock); | 293 | nvgpu_mutex_acquire(&tsg->event_id_list_lock); |
294 | list_add_tail(&event_id_data->event_id_node, &tsg->event_id_list); | 294 | list_add_tail(&event_id_data->event_id_node, &tsg->event_id_list); |
295 | mutex_unlock(&tsg->event_id_list_lock); | 295 | nvgpu_mutex_release(&tsg->event_id_list_lock); |
296 | 296 | ||
297 | fd_install(local_fd, file); | 297 | fd_install(local_fd, file); |
298 | file->private_data = event_id_data; | 298 | file->private_data = event_id_data; |
@@ -370,9 +370,9 @@ int gk20a_tsg_set_timeslice(struct tsg_gk20a *tsg, u32 timeslice) | |||
370 | 370 | ||
371 | static void release_used_tsg(struct fifo_gk20a *f, struct tsg_gk20a *tsg) | 371 | static void release_used_tsg(struct fifo_gk20a *f, struct tsg_gk20a *tsg) |
372 | { | 372 | { |
373 | mutex_lock(&f->tsg_inuse_mutex); | 373 | nvgpu_mutex_acquire(&f->tsg_inuse_mutex); |
374 | f->tsg[tsg->tsgid].in_use = false; | 374 | f->tsg[tsg->tsgid].in_use = false; |
375 | mutex_unlock(&f->tsg_inuse_mutex); | 375 | nvgpu_mutex_release(&f->tsg_inuse_mutex); |
376 | } | 376 | } |
377 | 377 | ||
378 | static struct tsg_gk20a *acquire_unused_tsg(struct fifo_gk20a *f) | 378 | static struct tsg_gk20a *acquire_unused_tsg(struct fifo_gk20a *f) |
@@ -380,7 +380,7 @@ static struct tsg_gk20a *acquire_unused_tsg(struct fifo_gk20a *f) | |||
380 | struct tsg_gk20a *tsg = NULL; | 380 | struct tsg_gk20a *tsg = NULL; |
381 | unsigned int tsgid; | 381 | unsigned int tsgid; |
382 | 382 | ||
383 | mutex_lock(&f->tsg_inuse_mutex); | 383 | nvgpu_mutex_acquire(&f->tsg_inuse_mutex); |
384 | for (tsgid = 0; tsgid < f->num_channels; tsgid++) { | 384 | for (tsgid = 0; tsgid < f->num_channels; tsgid++) { |
385 | if (!f->tsg[tsgid].in_use) { | 385 | if (!f->tsg[tsgid].in_use) { |
386 | f->tsg[tsgid].in_use = true; | 386 | f->tsg[tsgid].in_use = true; |
@@ -388,7 +388,7 @@ static struct tsg_gk20a *acquire_unused_tsg(struct fifo_gk20a *f) | |||
388 | break; | 388 | break; |
389 | } | 389 | } |
390 | } | 390 | } |
391 | mutex_unlock(&f->tsg_inuse_mutex); | 391 | nvgpu_mutex_release(&f->tsg_inuse_mutex); |
392 | 392 | ||
393 | return tsg; | 393 | return tsg; |
394 | } | 394 | } |
@@ -482,13 +482,13 @@ void gk20a_tsg_release(struct kref *ref) | |||
482 | gk20a_sched_ctrl_tsg_removed(g, tsg); | 482 | gk20a_sched_ctrl_tsg_removed(g, tsg); |
483 | 483 | ||
484 | /* unhook all events created on this TSG */ | 484 | /* unhook all events created on this TSG */ |
485 | mutex_lock(&tsg->event_id_list_lock); | 485 | nvgpu_mutex_acquire(&tsg->event_id_list_lock); |
486 | list_for_each_entry_safe(event_id_data, event_id_data_temp, | 486 | list_for_each_entry_safe(event_id_data, event_id_data_temp, |
487 | &tsg->event_id_list, | 487 | &tsg->event_id_list, |
488 | event_id_node) { | 488 | event_id_node) { |
489 | list_del_init(&event_id_data->event_id_node); | 489 | list_del_init(&event_id_data->event_id_node); |
490 | } | 490 | } |
491 | mutex_unlock(&tsg->event_id_list_lock); | 491 | nvgpu_mutex_release(&tsg->event_id_list_lock); |
492 | 492 | ||
493 | release_used_tsg(&g->fifo, tsg); | 493 | release_used_tsg(&g->fifo, tsg); |
494 | 494 | ||
@@ -517,7 +517,7 @@ static int gk20a_tsg_ioctl_set_priority(struct gk20a *g, | |||
517 | struct gk20a_sched_ctrl *sched = &g->sched_ctrl; | 517 | struct gk20a_sched_ctrl *sched = &g->sched_ctrl; |
518 | int err; | 518 | int err; |
519 | 519 | ||
520 | mutex_lock(&sched->control_lock); | 520 | nvgpu_mutex_acquire(&sched->control_lock); |
521 | if (sched->control_locked) { | 521 | if (sched->control_locked) { |
522 | err = -EPERM; | 522 | err = -EPERM; |
523 | goto done; | 523 | goto done; |
@@ -533,7 +533,7 @@ static int gk20a_tsg_ioctl_set_priority(struct gk20a *g, | |||
533 | 533 | ||
534 | gk20a_idle(g->dev); | 534 | gk20a_idle(g->dev); |
535 | done: | 535 | done: |
536 | mutex_unlock(&sched->control_lock); | 536 | nvgpu_mutex_release(&sched->control_lock); |
537 | return err; | 537 | return err; |
538 | } | 538 | } |
539 | 539 | ||
@@ -545,7 +545,7 @@ static int gk20a_tsg_ioctl_set_runlist_interleave(struct gk20a *g, | |||
545 | 545 | ||
546 | gk20a_dbg(gpu_dbg_fn | gpu_dbg_sched, "tsgid=%u", tsg->tsgid); | 546 | gk20a_dbg(gpu_dbg_fn | gpu_dbg_sched, "tsgid=%u", tsg->tsgid); |
547 | 547 | ||
548 | mutex_lock(&sched->control_lock); | 548 | nvgpu_mutex_acquire(&sched->control_lock); |
549 | if (sched->control_locked) { | 549 | if (sched->control_locked) { |
550 | err = -EPERM; | 550 | err = -EPERM; |
551 | goto done; | 551 | goto done; |
@@ -560,7 +560,7 @@ static int gk20a_tsg_ioctl_set_runlist_interleave(struct gk20a *g, | |||
560 | 560 | ||
561 | gk20a_idle(g->dev); | 561 | gk20a_idle(g->dev); |
562 | done: | 562 | done: |
563 | mutex_unlock(&sched->control_lock); | 563 | nvgpu_mutex_release(&sched->control_lock); |
564 | return err; | 564 | return err; |
565 | } | 565 | } |
566 | 566 | ||
@@ -572,7 +572,7 @@ static int gk20a_tsg_ioctl_set_timeslice(struct gk20a *g, | |||
572 | 572 | ||
573 | gk20a_dbg(gpu_dbg_fn | gpu_dbg_sched, "tsgid=%u", tsg->tsgid); | 573 | gk20a_dbg(gpu_dbg_fn | gpu_dbg_sched, "tsgid=%u", tsg->tsgid); |
574 | 574 | ||
575 | mutex_lock(&sched->control_lock); | 575 | nvgpu_mutex_acquire(&sched->control_lock); |
576 | if (sched->control_locked) { | 576 | if (sched->control_locked) { |
577 | err = -EPERM; | 577 | err = -EPERM; |
578 | goto done; | 578 | goto done; |
@@ -585,7 +585,7 @@ static int gk20a_tsg_ioctl_set_timeslice(struct gk20a *g, | |||
585 | err = gk20a_tsg_set_timeslice(tsg, arg->timeslice_us); | 585 | err = gk20a_tsg_set_timeslice(tsg, arg->timeslice_us); |
586 | gk20a_idle(g->dev); | 586 | gk20a_idle(g->dev); |
587 | done: | 587 | done: |
588 | mutex_unlock(&sched->control_lock); | 588 | nvgpu_mutex_release(&sched->control_lock); |
589 | return err; | 589 | return err; |
590 | } | 590 | } |
591 | 591 | ||