diff options
author | Alex Waterman <alexw@nvidia.com> | 2017-03-08 20:08:50 -0500 |
---|---|---|
committer | mobile promotions <svcmobile_promotions@nvidia.com> | 2017-03-30 15:36:09 -0400 |
commit | 24e1c7e0a729158be36d63b821550d206a8a0436 (patch) | |
tree | cf26c850cc63957f63f3e8f97914268839d8e0de /drivers/gpu/nvgpu/gk20a/dbg_gpu_gk20a.c | |
parent | 7010bf88399ea81b2b35844f738baac19dc5a441 (diff) |
gpu: nvgpu: Use new kmem API functions (misc)
Use the new kmem API functions in misc gk20a code. Some additional
modifications were also made:
o Add a struct gk20a pointer to gk20a_fence to enable proper
kmem free usage.
o Add gk20a pointer to alloc_session() in dbg_gpu_gk20a.c to
use kmem API for allocating a session.
o Plumb a gk20a pointer through the fence creation and deletion.
o Use statically allocated buffers for names in file creation.
Bug 1799159
Bug 1823380
Change-Id: I3678080e3ffa1f9bcf6934e3f4819a1bc531689b
Signed-off-by: Alex Waterman <alexw@nvidia.com>
Reviewed-on: http://git-master/r/1318323
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.c | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/drivers/gpu/nvgpu/gk20a/dbg_gpu_gk20a.c b/drivers/gpu/nvgpu/gk20a/dbg_gpu_gk20a.c index b5098849..7054e2a2 100644 --- a/drivers/gpu/nvgpu/gk20a/dbg_gpu_gk20a.c +++ b/drivers/gpu/nvgpu/gk20a/dbg_gpu_gk20a.c | |||
@@ -69,14 +69,14 @@ static int generate_unique_id(void) | |||
69 | return atomic_add_return(1, &unique_id); | 69 | return atomic_add_return(1, &unique_id); |
70 | } | 70 | } |
71 | 71 | ||
72 | static int alloc_session(struct dbg_session_gk20a **_dbg_s) | 72 | static int alloc_session(struct gk20a *g, struct dbg_session_gk20a **_dbg_s) |
73 | { | 73 | { |
74 | struct dbg_session_gk20a *dbg_s; | 74 | struct dbg_session_gk20a *dbg_s; |
75 | *_dbg_s = NULL; | 75 | *_dbg_s = NULL; |
76 | 76 | ||
77 | gk20a_dbg(gpu_dbg_fn | gpu_dbg_gpu_dbg, ""); | 77 | gk20a_dbg(gpu_dbg_fn | gpu_dbg_gpu_dbg, ""); |
78 | 78 | ||
79 | dbg_s = kzalloc(sizeof(*dbg_s), GFP_KERNEL); | 79 | dbg_s = nvgpu_kzalloc(g, sizeof(*dbg_s)); |
80 | if (!dbg_s) | 80 | if (!dbg_s) |
81 | return -ENOMEM; | 81 | return -ENOMEM; |
82 | 82 | ||
@@ -125,7 +125,7 @@ static int gk20a_dbg_gpu_do_dev_open(struct inode *inode, | |||
125 | 125 | ||
126 | gk20a_dbg(gpu_dbg_fn | gpu_dbg_gpu_dbg, "dbg session: %s", g->name); | 126 | gk20a_dbg(gpu_dbg_fn | gpu_dbg_gpu_dbg, "dbg session: %s", g->name); |
127 | 127 | ||
128 | err = alloc_session(&dbg_session); | 128 | err = alloc_session(g, &dbg_session); |
129 | if (err) | 129 | if (err) |
130 | goto free_ref; | 130 | goto free_ref; |
131 | 131 | ||
@@ -443,10 +443,10 @@ int dbg_unbind_single_channel_gk20a(struct dbg_session_gk20a *dbg_s, | |||
443 | 443 | ||
444 | session_data = ch_data->session_data; | 444 | session_data = ch_data->session_data; |
445 | list_del_init(&session_data->dbg_s_entry); | 445 | list_del_init(&session_data->dbg_s_entry); |
446 | kfree(session_data); | 446 | nvgpu_kfree(dbg_s->g, session_data); |
447 | 447 | ||
448 | fput(ch_data->ch_f); | 448 | fput(ch_data->ch_f); |
449 | kfree(ch_data); | 449 | nvgpu_kfree(dbg_s->g, ch_data); |
450 | 450 | ||
451 | return 0; | 451 | return 0; |
452 | } | 452 | } |
@@ -545,7 +545,7 @@ int gk20a_dbg_gpu_dev_release(struct inode *inode, struct file *filp) | |||
545 | nvgpu_mutex_destroy(&dbg_s->ch_list_lock); | 545 | nvgpu_mutex_destroy(&dbg_s->ch_list_lock); |
546 | nvgpu_mutex_destroy(&dbg_s->ioctl_lock); | 546 | nvgpu_mutex_destroy(&dbg_s->ioctl_lock); |
547 | 547 | ||
548 | kfree(dbg_s); | 548 | nvgpu_kfree(g, dbg_s); |
549 | gk20a_put(g); | 549 | gk20a_put(g); |
550 | 550 | ||
551 | return 0; | 551 | return 0; |
@@ -582,7 +582,7 @@ static int dbg_bind_channel_gk20a(struct dbg_session_gk20a *dbg_s, | |||
582 | nvgpu_mutex_acquire(&g->dbg_sessions_lock); | 582 | nvgpu_mutex_acquire(&g->dbg_sessions_lock); |
583 | nvgpu_mutex_acquire(&ch->dbg_s_lock); | 583 | nvgpu_mutex_acquire(&ch->dbg_s_lock); |
584 | 584 | ||
585 | ch_data = kzalloc(sizeof(*ch_data), GFP_KERNEL); | 585 | ch_data = nvgpu_kzalloc(g, sizeof(*ch_data)); |
586 | if (!ch_data) { | 586 | if (!ch_data) { |
587 | fput(f); | 587 | fput(f); |
588 | return -ENOMEM; | 588 | return -ENOMEM; |
@@ -592,9 +592,9 @@ static int dbg_bind_channel_gk20a(struct dbg_session_gk20a *dbg_s, | |||
592 | ch_data->chid = ch->hw_chid; | 592 | ch_data->chid = ch->hw_chid; |
593 | INIT_LIST_HEAD(&ch_data->ch_entry); | 593 | INIT_LIST_HEAD(&ch_data->ch_entry); |
594 | 594 | ||
595 | session_data = kzalloc(sizeof(*session_data), GFP_KERNEL); | 595 | session_data = nvgpu_kzalloc(g, sizeof(*session_data)); |
596 | if (!session_data) { | 596 | if (!session_data) { |
597 | kfree(ch_data); | 597 | nvgpu_kfree(g, ch_data); |
598 | fput(f); | 598 | fput(f); |
599 | return -ENOMEM; | 599 | return -ENOMEM; |
600 | } | 600 | } |
@@ -796,7 +796,7 @@ static int nvgpu_dbg_gpu_ioctl_write_single_sm_error_state( | |||
796 | if (sm_id >= gr->no_of_sm) | 796 | if (sm_id >= gr->no_of_sm) |
797 | return -EINVAL; | 797 | return -EINVAL; |
798 | 798 | ||
799 | sm_error_state = kzalloc(sizeof(*sm_error_state), GFP_KERNEL); | 799 | sm_error_state = nvgpu_kzalloc(g, sizeof(*sm_error_state)); |
800 | if (!sm_error_state) | 800 | if (!sm_error_state) |
801 | return -ENOMEM; | 801 | return -ENOMEM; |
802 | 802 | ||
@@ -829,7 +829,7 @@ static int nvgpu_dbg_gpu_ioctl_write_single_sm_error_state( | |||
829 | gk20a_idle(g); | 829 | gk20a_idle(g); |
830 | 830 | ||
831 | err_free: | 831 | err_free: |
832 | kfree(sm_error_state); | 832 | nvgpu_kfree(g, sm_error_state); |
833 | 833 | ||
834 | return err; | 834 | return err; |
835 | } | 835 | } |