summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/nvgpu/vgpu
diff options
context:
space:
mode:
authorDeepak Nibade <dnibade@nvidia.com>2017-01-24 08:30:42 -0500
committermobile promotions <svcmobile_promotions@nvidia.com>2017-02-22 07:15:02 -0500
commit8ee3aa4b3175d8d27e57a0f5d5e2cdf3d78a4a58 (patch)
tree505dfd2ea2aca2f1cbdb254baee980862d21e04d /drivers/gpu/nvgpu/vgpu
parent1f855af63fdd31fe3dcfee75f4f5f9b62f30d87e (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/vgpu')
-rw-r--r--drivers/gpu/nvgpu/vgpu/fifo_vgpu.c18
-rw-r--r--drivers/gpu/nvgpu/vgpu/gr_vgpu.c12
-rw-r--r--drivers/gpu/nvgpu/vgpu/mm_vgpu.c6
-rw-r--r--drivers/gpu/nvgpu/vgpu/vgpu.c8
4 files changed, 22 insertions, 22 deletions
diff --git a/drivers/gpu/nvgpu/vgpu/fifo_vgpu.c b/drivers/gpu/nvgpu/vgpu/fifo_vgpu.c
index 339f2237..7b6ed322 100644
--- a/drivers/gpu/nvgpu/vgpu/fifo_vgpu.c
+++ b/drivers/gpu/nvgpu/vgpu/fifo_vgpu.c
@@ -1,7 +1,7 @@
1/* 1/*
2 * Virtualized GPU Fifo 2 * Virtualized GPU Fifo
3 * 3 *
4 * Copyright (c) 2014-2016, NVIDIA CORPORATION. All rights reserved. 4 * Copyright (c) 2014-2017, NVIDIA CORPORATION. All rights reserved.
5 * 5 *
6 * This program is free software; you can redistribute it and/or modify it 6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms and conditions of the GNU General Public License, 7 * under the terms and conditions of the GNU General Public License,
@@ -218,7 +218,7 @@ static int init_runlist(struct gk20a *g, struct fifo_gk20a *f)
218 goto clean_up_runlist; 218 goto clean_up_runlist;
219 } 219 }
220 } 220 }
221 mutex_init(&runlist->mutex); 221 nvgpu_mutex_init(&runlist->mutex);
222 222
223 /* None of buffers is pinned if this value doesn't change. 223 /* None of buffers is pinned if this value doesn't change.
224 Otherwise, one of them (cur_buffer) must have been pinned. */ 224 Otherwise, one of them (cur_buffer) must have been pinned. */
@@ -294,7 +294,7 @@ static int vgpu_init_fifo_setup_sw(struct gk20a *g)
294 init_runlist(g, f); 294 init_runlist(g, f);
295 295
296 INIT_LIST_HEAD(&f->free_chs); 296 INIT_LIST_HEAD(&f->free_chs);
297 mutex_init(&f->free_chs_mutex); 297 nvgpu_mutex_init(&f->free_chs_mutex);
298 298
299 for (chid = 0; chid < f->num_channels; chid++) { 299 for (chid = 0; chid < f->num_channels; chid++) {
300 f->channel[chid].userd_iova = 300 f->channel[chid].userd_iova =
@@ -306,10 +306,10 @@ static int vgpu_init_fifo_setup_sw(struct gk20a *g)
306 gk20a_init_channel_support(g, chid); 306 gk20a_init_channel_support(g, chid);
307 gk20a_init_tsg_support(g, chid); 307 gk20a_init_tsg_support(g, chid);
308 } 308 }
309 mutex_init(&f->tsg_inuse_mutex); 309 nvgpu_mutex_init(&f->tsg_inuse_mutex);
310 310
311 f->deferred_reset_pending = false; 311 f->deferred_reset_pending = false;
312 mutex_init(&f->deferred_reset_mutex); 312 nvgpu_mutex_init(&f->deferred_reset_mutex);
313 313
314 f->sw_ready = true; 314 f->sw_ready = true;
315 315
@@ -534,12 +534,12 @@ static int vgpu_fifo_update_runlist(struct gk20a *g, u32 runlist_id,
534 534
535 runlist = &f->runlist_info[runlist_id]; 535 runlist = &f->runlist_info[runlist_id];
536 536
537 mutex_lock(&runlist->mutex); 537 nvgpu_mutex_acquire(&runlist->mutex);
538 538
539 ret = vgpu_fifo_update_runlist_locked(g, runlist_id, hw_chid, add, 539 ret = vgpu_fifo_update_runlist_locked(g, runlist_id, hw_chid, add,
540 wait_for_finish); 540 wait_for_finish);
541 541
542 mutex_unlock(&runlist->mutex); 542 nvgpu_mutex_release(&runlist->mutex);
543 return ret; 543 return ret;
544} 544}
545 545
@@ -679,7 +679,7 @@ static int vgpu_fifo_force_reset_ch(struct channel_gk20a *ch,
679static void vgpu_fifo_set_ctx_mmu_error(struct gk20a *g, 679static void vgpu_fifo_set_ctx_mmu_error(struct gk20a *g,
680 struct channel_gk20a *ch) 680 struct channel_gk20a *ch)
681{ 681{
682 mutex_lock(&ch->error_notifier_mutex); 682 nvgpu_mutex_acquire(&ch->error_notifier_mutex);
683 if (ch->error_notifier_ref) { 683 if (ch->error_notifier_ref) {
684 if (ch->error_notifier->status == 0xffff) { 684 if (ch->error_notifier->status == 0xffff) {
685 /* If error code is already set, this mmu fault 685 /* If error code is already set, this mmu fault
@@ -691,7 +691,7 @@ static void vgpu_fifo_set_ctx_mmu_error(struct gk20a *g,
691 NVGPU_CHANNEL_FIFO_ERROR_MMU_ERR_FLT); 691 NVGPU_CHANNEL_FIFO_ERROR_MMU_ERR_FLT);
692 } 692 }
693 } 693 }
694 mutex_unlock(&ch->error_notifier_mutex); 694 nvgpu_mutex_release(&ch->error_notifier_mutex);
695 695
696 /* mark channel as faulted */ 696 /* mark channel as faulted */
697 ch->has_timedout = true; 697 ch->has_timedout = true;
diff --git a/drivers/gpu/nvgpu/vgpu/gr_vgpu.c b/drivers/gpu/nvgpu/vgpu/gr_vgpu.c
index 36bbee00..5c637d25 100644
--- a/drivers/gpu/nvgpu/vgpu/gr_vgpu.c
+++ b/drivers/gpu/nvgpu/vgpu/gr_vgpu.c
@@ -866,7 +866,7 @@ static int vgpu_gr_init_gr_setup_sw(struct gk20a *g)
866 gr->g = g; 866 gr->g = g;
867 867
868#if defined(CONFIG_GK20A_CYCLE_STATS) 868#if defined(CONFIG_GK20A_CYCLE_STATS)
869 mutex_init(&g->gr.cs_lock); 869 nvgpu_mutex_init(&g->gr.cs_lock);
870#endif 870#endif
871 871
872 err = vgpu_gr_init_gr_config(g, gr); 872 err = vgpu_gr_init_gr_config(g, gr);
@@ -885,7 +885,7 @@ static int vgpu_gr_init_gr_setup_sw(struct gk20a *g)
885 if (err) 885 if (err)
886 goto clean_up; 886 goto clean_up;
887 887
888 mutex_init(&gr->ctx_mutex); 888 nvgpu_mutex_init(&gr->ctx_mutex);
889 889
890 gr->sm_error_states = kzalloc( 890 gr->sm_error_states = kzalloc(
891 sizeof(struct nvgpu_dbg_gpu_sm_error_state_record) * 891 sizeof(struct nvgpu_dbg_gpu_sm_error_state_record) *
@@ -1078,9 +1078,9 @@ static int vgpu_gr_clear_sm_error_state(struct gk20a *g,
1078{ 1078{
1079 struct gr_gk20a *gr = &g->gr; 1079 struct gr_gk20a *gr = &g->gr;
1080 1080
1081 mutex_lock(&g->dbg_sessions_lock); 1081 nvgpu_mutex_acquire(&g->dbg_sessions_lock);
1082 memset(&gr->sm_error_states[sm_id], 0, sizeof(*gr->sm_error_states)); 1082 memset(&gr->sm_error_states[sm_id], 0, sizeof(*gr->sm_error_states));
1083 mutex_unlock(&g->dbg_sessions_lock); 1083 nvgpu_mutex_release(&g->dbg_sessions_lock);
1084 1084
1085 return 0; 1085 return 0;
1086} 1086}
@@ -1096,7 +1096,7 @@ void vgpu_gr_handle_sm_esr_event(struct gk20a *g,
1096 return; 1096 return;
1097 } 1097 }
1098 1098
1099 mutex_lock(&g->dbg_sessions_lock); 1099 nvgpu_mutex_acquire(&g->dbg_sessions_lock);
1100 1100
1101 sm_error_states = &g->gr.sm_error_states[info->sm_id]; 1101 sm_error_states = &g->gr.sm_error_states[info->sm_id];
1102 1102
@@ -1108,7 +1108,7 @@ void vgpu_gr_handle_sm_esr_event(struct gk20a *g,
1108 sm_error_states->hww_warp_esr_report_mask = 1108 sm_error_states->hww_warp_esr_report_mask =
1109 info->hww_warp_esr_report_mask; 1109 info->hww_warp_esr_report_mask;
1110 1110
1111 mutex_unlock(&g->dbg_sessions_lock); 1111 nvgpu_mutex_release(&g->dbg_sessions_lock);
1112} 1112}
1113 1113
1114void vgpu_init_gr_ops(struct gpu_ops *gops) 1114void vgpu_init_gr_ops(struct gpu_ops *gops)
diff --git a/drivers/gpu/nvgpu/vgpu/mm_vgpu.c b/drivers/gpu/nvgpu/vgpu/mm_vgpu.c
index c6780cf7..70b50e7e 100644
--- a/drivers/gpu/nvgpu/vgpu/mm_vgpu.c
+++ b/drivers/gpu/nvgpu/vgpu/mm_vgpu.c
@@ -200,7 +200,7 @@ static void vgpu_vm_remove_support(struct vm_gk20a *vm)
200 int err; 200 int err;
201 201
202 gk20a_dbg_fn(""); 202 gk20a_dbg_fn("");
203 mutex_lock(&vm->update_gmmu_lock); 203 nvgpu_mutex_acquire(&vm->update_gmmu_lock);
204 204
205 /* TBD: add a flag here for the unmap code to recognize teardown 205 /* TBD: add a flag here for the unmap code to recognize teardown
206 * and short-circuit any otherwise expensive operations. */ 206 * and short-circuit any otherwise expensive operations. */
@@ -231,7 +231,7 @@ static void vgpu_vm_remove_support(struct vm_gk20a *vm)
231 if (nvgpu_alloc_initialized(&vm->user)) 231 if (nvgpu_alloc_initialized(&vm->user))
232 nvgpu_alloc_destroy(&vm->user); 232 nvgpu_alloc_destroy(&vm->user);
233 233
234 mutex_unlock(&vm->update_gmmu_lock); 234 nvgpu_mutex_release(&vm->update_gmmu_lock);
235 235
236 /* vm is not used anymore. release it. */ 236 /* vm is not used anymore. release it. */
237 kfree(vm); 237 kfree(vm);
@@ -401,7 +401,7 @@ static int vgpu_vm_alloc_share(struct gk20a_as_share *as_share,
401 401
402 vm->mapped_buffers = RB_ROOT; 402 vm->mapped_buffers = RB_ROOT;
403 403
404 mutex_init(&vm->update_gmmu_lock); 404 nvgpu_mutex_init(&vm->update_gmmu_lock);
405 kref_init(&vm->ref); 405 kref_init(&vm->ref);
406 INIT_LIST_HEAD(&vm->reserved_va_list); 406 INIT_LIST_HEAD(&vm->reserved_va_list);
407 407
diff --git a/drivers/gpu/nvgpu/vgpu/vgpu.c b/drivers/gpu/nvgpu/vgpu/vgpu.c
index ba387de9..4c88ab96 100644
--- a/drivers/gpu/nvgpu/vgpu/vgpu.c
+++ b/drivers/gpu/nvgpu/vgpu/vgpu.c
@@ -250,9 +250,9 @@ static int vgpu_init_support(struct platform_device *pdev)
250 } 250 }
251 g->bar1_mem = r; 251 g->bar1_mem = r;
252 252
253 mutex_init(&g->dbg_sessions_lock); 253 nvgpu_mutex_init(&g->dbg_sessions_lock);
254 mutex_init(&g->client_lock); 254 nvgpu_mutex_init(&g->client_lock);
255 mutex_init(&g->ch_wdt_lock); 255 nvgpu_mutex_init(&g->ch_wdt_lock);
256 256
257 g->dbg_regops_tmp_buf = kzalloc(SZ_4K, GFP_KERNEL); 257 g->dbg_regops_tmp_buf = kzalloc(SZ_4K, GFP_KERNEL);
258 if (!g->dbg_regops_tmp_buf) { 258 if (!g->dbg_regops_tmp_buf) {
@@ -576,7 +576,7 @@ int vgpu_probe(struct platform_device *pdev)
576 576
577 init_rwsem(&gk20a->busy_lock); 577 init_rwsem(&gk20a->busy_lock);
578 578
579 spin_lock_init(&gk20a->mc_enable_lock); 579 nvgpu_spinlock_init(&gk20a->mc_enable_lock);
580 580
581 /* Initialize the platform interface. */ 581 /* Initialize the platform interface. */
582 err = platform->probe(dev); 582 err = platform->probe(dev);