summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/nvgpu/gk20a/dbg_gpu_gk20a.c
diff options
context:
space:
mode:
authorAlex Waterman <alexw@nvidia.com>2017-03-30 16:16:51 -0400
committermobile promotions <svcmobile_promotions@nvidia.com>2017-04-04 19:57:03 -0400
commitc86e940e1169be32e92297f6dfb07d0c2cade135 (patch)
tree86fc119bc20f6db09eda52ace9a2d76c6bf9ef53 /drivers/gpu/nvgpu/gk20a/dbg_gpu_gk20a.c
parente3bd4ae2a59fef37a85fbca168fc479dd5514023 (diff)
gpu: nvgpu: Remove last Linux kmem usage
Replace the last of the Linux kmem API usage with nvgpu kmem calls instead. Several places are left alone - allocating the struct gk20a in particular. Also one function was updated in the clk code to take a struct gk20a as an argument so that it could use nvgpu_kmalloc(). Bug 1799159 Bug 1823380 Change-Id: I84fc3f8e19c63d6265bac6098dc727d93e3ff613 Signed-off-by: Alex Waterman <alexw@nvidia.com> Reviewed-on: http://git-master/r/1331702 Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com> Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Diffstat (limited to 'drivers/gpu/nvgpu/gk20a/dbg_gpu_gk20a.c')
-rw-r--r--drivers/gpu/nvgpu/gk20a/dbg_gpu_gk20a.c17
1 files changed, 9 insertions, 8 deletions
diff --git a/drivers/gpu/nvgpu/gk20a/dbg_gpu_gk20a.c b/drivers/gpu/nvgpu/gk20a/dbg_gpu_gk20a.c
index 7054e2a2..1ebb1900 100644
--- a/drivers/gpu/nvgpu/gk20a/dbg_gpu_gk20a.c
+++ b/drivers/gpu/nvgpu/gk20a/dbg_gpu_gk20a.c
@@ -85,14 +85,15 @@ static int alloc_session(struct gk20a *g, struct dbg_session_gk20a **_dbg_s)
85 return 0; 85 return 0;
86} 86}
87 87
88static int alloc_profiler(struct dbg_profiler_object_data **_prof) 88static int alloc_profiler(struct gk20a *g,
89 struct dbg_profiler_object_data **_prof)
89{ 90{
90 struct dbg_profiler_object_data *prof; 91 struct dbg_profiler_object_data *prof;
91 *_prof = NULL; 92 *_prof = NULL;
92 93
93 gk20a_dbg(gpu_dbg_fn | gpu_dbg_gpu_dbg, ""); 94 gk20a_dbg(gpu_dbg_fn | gpu_dbg_gpu_dbg, "");
94 95
95 prof = kzalloc(sizeof(*prof), GFP_KERNEL); 96 prof = nvgpu_kzalloc(g, sizeof(*prof));
96 if (!prof) 97 if (!prof)
97 return -ENOMEM; 98 return -ENOMEM;
98 99
@@ -152,7 +153,7 @@ static int gk20a_dbg_gpu_do_dev_open(struct inode *inode,
152err_destroy_lock: 153err_destroy_lock:
153 nvgpu_mutex_destroy(&dbg_session->ch_list_lock); 154 nvgpu_mutex_destroy(&dbg_session->ch_list_lock);
154err_free_session: 155err_free_session:
155 kfree(dbg_session); 156 nvgpu_kfree(g, dbg_session);
156free_ref: 157free_ref:
157 gk20a_put(g); 158 gk20a_put(g);
158 return err; 159 return err;
@@ -435,7 +436,7 @@ int dbg_unbind_single_channel_gk20a(struct dbg_session_gk20a *dbg_s,
435 release_profiler_reservation(dbg_s, prof_obj); 436 release_profiler_reservation(dbg_s, prof_obj);
436 } 437 }
437 list_del(&prof_obj->prof_obj_entry); 438 list_del(&prof_obj->prof_obj_entry);
438 kfree(prof_obj); 439 nvgpu_kfree(g, prof_obj);
439 } 440 }
440 } 441 }
441 442
@@ -537,7 +538,7 @@ int gk20a_dbg_gpu_dev_release(struct inode *inode, struct file *filp)
537 g->ops.dbg_session_ops. 538 g->ops.dbg_session_ops.
538 release_profiler_reservation(dbg_s, prof_obj); 539 release_profiler_reservation(dbg_s, prof_obj);
539 list_del(&prof_obj->prof_obj_entry); 540 list_del(&prof_obj->prof_obj_entry);
540 kfree(prof_obj); 541 nvgpu_kfree(g, prof_obj);
541 } 542 }
542 } 543 }
543 nvgpu_mutex_release(&g->dbg_sessions_lock); 544 nvgpu_mutex_release(&g->dbg_sessions_lock);
@@ -1527,7 +1528,7 @@ static int nvgpu_ioctl_allocate_profiler_object(
1527 1528
1528 nvgpu_mutex_acquire(&g->dbg_sessions_lock); 1529 nvgpu_mutex_acquire(&g->dbg_sessions_lock);
1529 1530
1530 err = alloc_profiler(&prof_obj); 1531 err = alloc_profiler(g, &prof_obj);
1531 if (err) 1532 if (err)
1532 goto clean_up; 1533 goto clean_up;
1533 1534
@@ -1540,7 +1541,7 @@ static int nvgpu_ioctl_allocate_profiler_object(
1540 if (prof_obj->ch == NULL) { 1541 if (prof_obj->ch == NULL) {
1541 gk20a_err(dev_from_gk20a(g), 1542 gk20a_err(dev_from_gk20a(g),
1542 "bind a channel for dbg session"); 1543 "bind a channel for dbg session");
1543 kfree(prof_obj); 1544 nvgpu_kfree(g, prof_obj);
1544 err = -EINVAL; 1545 err = -EINVAL;
1545 goto clean_up; 1546 goto clean_up;
1546 } 1547 }
@@ -1586,7 +1587,7 @@ static int nvgpu_ioctl_free_profiler_object(
1586 g->ops.dbg_session_ops. 1587 g->ops.dbg_session_ops.
1587 release_profiler_reservation(dbg_s, prof_obj); 1588 release_profiler_reservation(dbg_s, prof_obj);
1588 list_del(&prof_obj->prof_obj_entry); 1589 list_del(&prof_obj->prof_obj_entry);
1589 kfree(prof_obj); 1590 nvgpu_kfree(g, prof_obj);
1590 obj_found = true; 1591 obj_found = true;
1591 break; 1592 break;
1592 } 1593 }