diff options
Diffstat (limited to 'drivers/gpu')
-rw-r--r-- | drivers/gpu/nvgpu/gk20a/cde_gk20a.c | 19 | ||||
-rw-r--r-- | drivers/gpu/nvgpu/gk20a/ce2_gk20a.c | 6 | ||||
-rw-r--r-- | drivers/gpu/nvgpu/gk20a/channel_sync_gk20a.c | 6 | ||||
-rw-r--r-- | drivers/gpu/nvgpu/gk20a/css_gr_gk20a.c | 12 | ||||
-rw-r--r-- | drivers/gpu/nvgpu/gk20a/ctrl_gk20a.c | 44 | ||||
-rw-r--r-- | drivers/gpu/nvgpu/gk20a/ctxsw_trace_gk20a.c | 11 | ||||
-rw-r--r-- | drivers/gpu/nvgpu/gk20a/dbg_gpu_gk20a.c | 22 | ||||
-rw-r--r-- | drivers/gpu/nvgpu/gk20a/fecs_trace_gk20a.c | 15 | ||||
-rw-r--r-- | drivers/gpu/nvgpu/gk20a/fence_gk20a.c | 20 | ||||
-rw-r--r-- | drivers/gpu/nvgpu/gk20a/fence_gk20a.h | 3 | ||||
-rw-r--r-- | drivers/gpu/nvgpu/gk20a/gk20a_scale.c | 8 | ||||
-rw-r--r-- | drivers/gpu/nvgpu/gk20a/gk20a_sysfs.c | 4 | ||||
-rw-r--r-- | drivers/gpu/nvgpu/gk20a/pmu_gk20a.c | 32 | ||||
-rw-r--r-- | drivers/gpu/nvgpu/gk20a/sync_gk20a.c | 18 | ||||
-rw-r--r-- | drivers/gpu/nvgpu/gk20a/sync_gk20a.h | 4 | ||||
-rw-r--r-- | drivers/gpu/nvgpu/tegra/linux/platform_gk20a_tegra.c | 10 |
16 files changed, 134 insertions, 100 deletions
diff --git a/drivers/gpu/nvgpu/gk20a/cde_gk20a.c b/drivers/gpu/nvgpu/gk20a/cde_gk20a.c index 5b8ee642..02636206 100644 --- a/drivers/gpu/nvgpu/gk20a/cde_gk20a.c +++ b/drivers/gpu/nvgpu/gk20a/cde_gk20a.c | |||
@@ -26,6 +26,7 @@ | |||
26 | 26 | ||
27 | #include <nvgpu/timers.h> | 27 | #include <nvgpu/timers.h> |
28 | #include <nvgpu/nvgpu_common.h> | 28 | #include <nvgpu/nvgpu_common.h> |
29 | #include <nvgpu/kmem.h> | ||
29 | 30 | ||
30 | #include "gk20a.h" | 31 | #include "gk20a.h" |
31 | #include "channel_gk20a.h" | 32 | #include "channel_gk20a.h" |
@@ -55,7 +56,7 @@ static void gk20a_deinit_cde_img(struct gk20a_cde_ctx *cde_ctx) | |||
55 | gk20a_gmmu_unmap_free(cde_ctx->vm, mem); | 56 | gk20a_gmmu_unmap_free(cde_ctx->vm, mem); |
56 | } | 57 | } |
57 | 58 | ||
58 | kfree(cde_ctx->init_convert_cmd); | 59 | nvgpu_kfree(cde_ctx->g, cde_ctx->init_convert_cmd); |
59 | 60 | ||
60 | cde_ctx->convert_cmd = NULL; | 61 | cde_ctx->convert_cmd = NULL; |
61 | cde_ctx->init_convert_cmd = NULL; | 62 | cde_ctx->init_convert_cmd = NULL; |
@@ -86,7 +87,7 @@ __must_hold(&cde_app->mutex) | |||
86 | /* housekeeping on app */ | 87 | /* housekeeping on app */ |
87 | list_del(&cde_ctx->list); | 88 | list_del(&cde_ctx->list); |
88 | cde_ctx->g->cde_app.ctx_count--; | 89 | cde_ctx->g->cde_app.ctx_count--; |
89 | kfree(cde_ctx); | 90 | nvgpu_kfree(g, cde_ctx); |
90 | } | 91 | } |
91 | 92 | ||
92 | static void gk20a_cde_cancel_deleter(struct gk20a_cde_ctx *cde_ctx, | 93 | static void gk20a_cde_cancel_deleter(struct gk20a_cde_ctx *cde_ctx, |
@@ -535,8 +536,8 @@ static int gk20a_init_cde_command(struct gk20a_cde_ctx *cde_ctx, | |||
535 | } | 536 | } |
536 | 537 | ||
537 | /* allocate gpfifo entries to be pushed */ | 538 | /* allocate gpfifo entries to be pushed */ |
538 | *gpfifo = kzalloc(sizeof(struct nvgpu_gpfifo) * num_elems, | 539 | *gpfifo = nvgpu_kzalloc(cde_ctx->g, |
539 | GFP_KERNEL); | 540 | sizeof(struct nvgpu_gpfifo) * num_elems); |
540 | if (!*gpfifo) { | 541 | if (!*gpfifo) { |
541 | gk20a_warn(cde_ctx->dev, "cde: could not allocate memory for gpfifo entries"); | 542 | gk20a_warn(cde_ctx->dev, "cde: could not allocate memory for gpfifo entries"); |
542 | return -ENOMEM; | 543 | return -ENOMEM; |
@@ -588,7 +589,7 @@ static int gk20a_cde_pack_cmdbufs(struct gk20a_cde_ctx *cde_ctx) | |||
588 | struct nvgpu_gpfifo *combined_cmd; | 589 | struct nvgpu_gpfifo *combined_cmd; |
589 | 590 | ||
590 | /* allocate buffer that has space for both */ | 591 | /* allocate buffer that has space for both */ |
591 | combined_cmd = kzalloc(total_bytes, GFP_KERNEL); | 592 | combined_cmd = nvgpu_kzalloc(cde_ctx->g, total_bytes); |
592 | if (!combined_cmd) { | 593 | if (!combined_cmd) { |
593 | gk20a_warn(cde_ctx->dev, | 594 | gk20a_warn(cde_ctx->dev, |
594 | "cde: could not allocate memory for gpfifo entries"); | 595 | "cde: could not allocate memory for gpfifo entries"); |
@@ -600,8 +601,8 @@ static int gk20a_cde_pack_cmdbufs(struct gk20a_cde_ctx *cde_ctx) | |||
600 | memcpy(combined_cmd + cde_ctx->init_cmd_num_entries, | 601 | memcpy(combined_cmd + cde_ctx->init_cmd_num_entries, |
601 | cde_ctx->convert_cmd, conv_bytes); | 602 | cde_ctx->convert_cmd, conv_bytes); |
602 | 603 | ||
603 | kfree(cde_ctx->init_convert_cmd); | 604 | nvgpu_kfree(cde_ctx->g, cde_ctx->init_convert_cmd); |
604 | kfree(cde_ctx->convert_cmd); | 605 | nvgpu_kfree(cde_ctx->g, cde_ctx->convert_cmd); |
605 | 606 | ||
606 | cde_ctx->init_convert_cmd = combined_cmd; | 607 | cde_ctx->init_convert_cmd = combined_cmd; |
607 | cde_ctx->convert_cmd = combined_cmd | 608 | cde_ctx->convert_cmd = combined_cmd |
@@ -893,7 +894,7 @@ static struct gk20a_cde_ctx *gk20a_cde_allocate_context(struct gk20a *g) | |||
893 | struct gk20a_cde_ctx *cde_ctx; | 894 | struct gk20a_cde_ctx *cde_ctx; |
894 | int ret; | 895 | int ret; |
895 | 896 | ||
896 | cde_ctx = kzalloc(sizeof(*cde_ctx), GFP_KERNEL); | 897 | cde_ctx = nvgpu_kzalloc(g, sizeof(*cde_ctx)); |
897 | if (!cde_ctx) | 898 | if (!cde_ctx) |
898 | return ERR_PTR(-ENOMEM); | 899 | return ERR_PTR(-ENOMEM); |
899 | 900 | ||
@@ -902,7 +903,7 @@ static struct gk20a_cde_ctx *gk20a_cde_allocate_context(struct gk20a *g) | |||
902 | 903 | ||
903 | ret = gk20a_cde_load(cde_ctx); | 904 | ret = gk20a_cde_load(cde_ctx); |
904 | if (ret) { | 905 | if (ret) { |
905 | kfree(cde_ctx); | 906 | nvgpu_kfree(g, cde_ctx); |
906 | return ERR_PTR(ret); | 907 | return ERR_PTR(ret); |
907 | } | 908 | } |
908 | 909 | ||
diff --git a/drivers/gpu/nvgpu/gk20a/ce2_gk20a.c b/drivers/gpu/nvgpu/gk20a/ce2_gk20a.c index 418572a1..3ca38715 100644 --- a/drivers/gpu/nvgpu/gk20a/ce2_gk20a.c +++ b/drivers/gpu/nvgpu/gk20a/ce2_gk20a.c | |||
@@ -26,6 +26,8 @@ | |||
26 | #include <linux/nvhost.h> | 26 | #include <linux/nvhost.h> |
27 | #include <linux/debugfs.h> | 27 | #include <linux/debugfs.h> |
28 | 28 | ||
29 | #include <nvgpu/kmem.h> | ||
30 | |||
29 | #include "gk20a.h" | 31 | #include "gk20a.h" |
30 | #include "debug_gk20a.h" | 32 | #include "debug_gk20a.h" |
31 | 33 | ||
@@ -207,7 +209,7 @@ static void gk20a_ce_delete_gpu_context(struct gk20a_gpu_ctx *ce_ctx) | |||
207 | nvgpu_mutex_release(&ce_ctx->gpu_ctx_mutex); | 209 | nvgpu_mutex_release(&ce_ctx->gpu_ctx_mutex); |
208 | nvgpu_mutex_destroy(&ce_ctx->gpu_ctx_mutex); | 210 | nvgpu_mutex_destroy(&ce_ctx->gpu_ctx_mutex); |
209 | 211 | ||
210 | kfree(ce_ctx); | 212 | nvgpu_kfree(ce_ctx->g, ce_ctx); |
211 | } | 213 | } |
212 | 214 | ||
213 | static inline unsigned int gk20a_ce_get_method_size(int request_operation) | 215 | static inline unsigned int gk20a_ce_get_method_size(int request_operation) |
@@ -428,7 +430,7 @@ u32 gk20a_ce_create_context_with_cb(struct device *dev, | |||
428 | if (!ce_app->initialised || ce_app->app_state != NVGPU_CE_ACTIVE) | 430 | if (!ce_app->initialised || ce_app->app_state != NVGPU_CE_ACTIVE) |
429 | return ctx_id; | 431 | return ctx_id; |
430 | 432 | ||
431 | ce_ctx = kzalloc(sizeof(*ce_ctx), GFP_KERNEL); | 433 | ce_ctx = nvgpu_kzalloc(g, sizeof(*ce_ctx)); |
432 | if (!ce_ctx) | 434 | if (!ce_ctx) |
433 | return ctx_id; | 435 | return ctx_id; |
434 | 436 | ||
diff --git a/drivers/gpu/nvgpu/gk20a/channel_sync_gk20a.c b/drivers/gpu/nvgpu/gk20a/channel_sync_gk20a.c index e84f70a2..8baf60dd 100644 --- a/drivers/gpu/nvgpu/gk20a/channel_sync_gk20a.c +++ b/drivers/gpu/nvgpu/gk20a/channel_sync_gk20a.c | |||
@@ -667,7 +667,7 @@ static int gk20a_channel_semaphore_wait_fd( | |||
667 | ret = __semaphore_wait_fd_fast_path(c, sync_fence, wait_cmd, &fp_sema); | 667 | ret = __semaphore_wait_fd_fast_path(c, sync_fence, wait_cmd, &fp_sema); |
668 | if (ret == 0) { | 668 | if (ret == 0) { |
669 | if (fp_sema) { | 669 | if (fp_sema) { |
670 | err = gk20a_fence_from_semaphore(fence, | 670 | err = gk20a_fence_from_semaphore(c->g, fence, |
671 | sema->timeline, | 671 | sema->timeline, |
672 | fp_sema, | 672 | fp_sema, |
673 | &c->semaphore_wq, | 673 | &c->semaphore_wq, |
@@ -734,7 +734,7 @@ static int gk20a_channel_semaphore_wait_fd( | |||
734 | * that we properly clean up in the event the sync_fence has | 734 | * that we properly clean up in the event the sync_fence has |
735 | * already signaled | 735 | * already signaled |
736 | */ | 736 | */ |
737 | err = gk20a_fence_from_semaphore(fence, sema->timeline, w->sema, | 737 | err = gk20a_fence_from_semaphore(c->g, fence, sema->timeline, w->sema, |
738 | &c->semaphore_wq, NULL, false, false); | 738 | &c->semaphore_wq, NULL, false, false); |
739 | if (err) | 739 | if (err) |
740 | goto clean_up_sema; | 740 | goto clean_up_sema; |
@@ -810,7 +810,7 @@ static int __gk20a_channel_semaphore_incr( | |||
810 | /* Release the completion semaphore. */ | 810 | /* Release the completion semaphore. */ |
811 | add_sema_cmd(c->g, c, semaphore, incr_cmd, 14, false, wfi_cmd); | 811 | add_sema_cmd(c->g, c, semaphore, incr_cmd, 14, false, wfi_cmd); |
812 | 812 | ||
813 | err = gk20a_fence_from_semaphore(fence, | 813 | err = gk20a_fence_from_semaphore(c->g, fence, |
814 | sp->timeline, semaphore, | 814 | sp->timeline, semaphore, |
815 | &c->semaphore_wq, | 815 | &c->semaphore_wq, |
816 | dependency, wfi_cmd, | 816 | dependency, wfi_cmd, |
diff --git a/drivers/gpu/nvgpu/gk20a/css_gr_gk20a.c b/drivers/gpu/nvgpu/gk20a/css_gr_gk20a.c index 4bc7ee52..53d5f78d 100644 --- a/drivers/gpu/nvgpu/gk20a/css_gr_gk20a.c +++ b/drivers/gpu/nvgpu/gk20a/css_gr_gk20a.c | |||
@@ -19,9 +19,11 @@ | |||
19 | #include <linux/bitops.h> | 19 | #include <linux/bitops.h> |
20 | #include <linux/dma-mapping.h> | 20 | #include <linux/dma-mapping.h> |
21 | #include <linux/dma-buf.h> | 21 | #include <linux/dma-buf.h> |
22 | #include <nvgpu/lock.h> | ||
23 | #include <linux/vmalloc.h> | 22 | #include <linux/vmalloc.h> |
24 | 23 | ||
24 | #include <nvgpu/kmem.h> | ||
25 | #include <nvgpu/lock.h> | ||
26 | |||
25 | #include "gk20a.h" | 27 | #include "gk20a.h" |
26 | #include "css_gr_gk20a.h" | 28 | #include "css_gr_gk20a.h" |
27 | 29 | ||
@@ -112,7 +114,7 @@ static int css_gr_create_shared_data(struct gr_gk20a *gr) | |||
112 | if (gr->cs_data) | 114 | if (gr->cs_data) |
113 | return 0; | 115 | return 0; |
114 | 116 | ||
115 | data = kzalloc(sizeof(*data), GFP_KERNEL); | 117 | data = nvgpu_kzalloc(gr->g, sizeof(*data)); |
116 | if (!data) | 118 | if (!data) |
117 | return -ENOMEM; | 119 | return -ENOMEM; |
118 | 120 | ||
@@ -234,7 +236,7 @@ static void css_gr_free_shared_data(struct gr_gk20a *gr) | |||
234 | g->ops.css.disable_snapshot(gr); | 236 | g->ops.css.disable_snapshot(gr); |
235 | 237 | ||
236 | /* release the objects */ | 238 | /* release the objects */ |
237 | kfree(gr->cs_data); | 239 | nvgpu_kfree(gr->g, gr->cs_data); |
238 | gr->cs_data = NULL; | 240 | gr->cs_data = NULL; |
239 | } | 241 | } |
240 | } | 242 | } |
@@ -458,7 +460,7 @@ static int css_gr_free_client_data(struct gk20a *g, | |||
458 | dma_buf_put(client->dma_handler); | 460 | dma_buf_put(client->dma_handler); |
459 | } | 461 | } |
460 | 462 | ||
461 | kfree(client); | 463 | nvgpu_kfree(g, client); |
462 | 464 | ||
463 | return ret; | 465 | return ret; |
464 | } | 466 | } |
@@ -471,7 +473,7 @@ static int css_gr_create_client_data(struct gk20a *g, | |||
471 | struct gk20a_cs_snapshot_client *cur; | 473 | struct gk20a_cs_snapshot_client *cur; |
472 | int ret = 0; | 474 | int ret = 0; |
473 | 475 | ||
474 | cur = kzalloc(sizeof(*cur), GFP_KERNEL); | 476 | cur = nvgpu_kzalloc(g, sizeof(*cur)); |
475 | if (!cur) { | 477 | if (!cur) { |
476 | ret = -ENOMEM; | 478 | ret = -ENOMEM; |
477 | goto failed; | 479 | goto failed; |
diff --git a/drivers/gpu/nvgpu/gk20a/ctrl_gk20a.c b/drivers/gpu/nvgpu/gk20a/ctrl_gk20a.c index 5661b402..fba39a50 100644 --- a/drivers/gpu/nvgpu/gk20a/ctrl_gk20a.c +++ b/drivers/gpu/nvgpu/gk20a/ctrl_gk20a.c | |||
@@ -23,6 +23,8 @@ | |||
23 | #include <uapi/linux/nvgpu.h> | 23 | #include <uapi/linux/nvgpu.h> |
24 | #include <linux/delay.h> | 24 | #include <linux/delay.h> |
25 | 25 | ||
26 | #include <nvgpu/kmem.h> | ||
27 | |||
26 | #include "gk20a.h" | 28 | #include "gk20a.h" |
27 | #include "fence_gk20a.h" | 29 | #include "fence_gk20a.h" |
28 | 30 | ||
@@ -52,7 +54,7 @@ int gk20a_ctrl_dev_open(struct inode *inode, struct file *filp) | |||
52 | if (!g) | 54 | if (!g) |
53 | return -ENODEV; | 55 | return -ENODEV; |
54 | 56 | ||
55 | priv = kzalloc(sizeof(struct gk20a_ctrl_priv), GFP_KERNEL); | 57 | priv = nvgpu_kzalloc(g, sizeof(struct gk20a_ctrl_priv)); |
56 | if (!priv) { | 58 | if (!priv) { |
57 | err = -ENOMEM; | 59 | err = -ENOMEM; |
58 | goto free_ref; | 60 | goto free_ref; |
@@ -94,7 +96,7 @@ int gk20a_ctrl_dev_release(struct inode *inode, struct file *filp) | |||
94 | #endif | 96 | #endif |
95 | 97 | ||
96 | gk20a_put(g); | 98 | gk20a_put(g); |
97 | kfree(priv); | 99 | nvgpu_kfree(g, priv); |
98 | 100 | ||
99 | return 0; | 101 | return 0; |
100 | } | 102 | } |
@@ -195,18 +197,16 @@ static int gk20a_ctrl_alloc_as( | |||
195 | int err; | 197 | int err; |
196 | int fd; | 198 | int fd; |
197 | struct file *file; | 199 | struct file *file; |
198 | char *name; | 200 | char name[64]; |
199 | 201 | ||
200 | err = get_unused_fd_flags(O_RDWR); | 202 | err = get_unused_fd_flags(O_RDWR); |
201 | if (err < 0) | 203 | if (err < 0) |
202 | return err; | 204 | return err; |
203 | fd = err; | 205 | fd = err; |
204 | 206 | ||
205 | name = kasprintf(GFP_KERNEL, "nvhost-%s-fd%d", | 207 | snprintf(name, sizeof(name), "nvhost-%s-fd%d", g->name, fd); |
206 | g->name, fd); | ||
207 | 208 | ||
208 | file = anon_inode_getfile(name, g->as.cdev.ops, NULL, O_RDWR); | 209 | file = anon_inode_getfile(name, g->as.cdev.ops, NULL, O_RDWR); |
209 | kfree(name); | ||
210 | if (IS_ERR(file)) { | 210 | if (IS_ERR(file)) { |
211 | err = PTR_ERR(file); | 211 | err = PTR_ERR(file); |
212 | goto clean_up; | 212 | goto clean_up; |
@@ -236,18 +236,16 @@ static int gk20a_ctrl_open_tsg(struct gk20a *g, | |||
236 | int err; | 236 | int err; |
237 | int fd; | 237 | int fd; |
238 | struct file *file; | 238 | struct file *file; |
239 | char *name; | 239 | char name[64]; |
240 | 240 | ||
241 | err = get_unused_fd_flags(O_RDWR); | 241 | err = get_unused_fd_flags(O_RDWR); |
242 | if (err < 0) | 242 | if (err < 0) |
243 | return err; | 243 | return err; |
244 | fd = err; | 244 | fd = err; |
245 | 245 | ||
246 | name = kasprintf(GFP_KERNEL, "nvgpu-%s-tsg%d", | 246 | snprintf(name, sizeof(name), "nvgpu-%s-tsg%d", g->name, fd); |
247 | g->name, fd); | ||
248 | 247 | ||
249 | file = anon_inode_getfile(name, g->tsg.cdev.ops, NULL, O_RDWR); | 248 | file = anon_inode_getfile(name, g->tsg.cdev.ops, NULL, O_RDWR); |
250 | kfree(name); | ||
251 | if (IS_ERR(file)) { | 249 | if (IS_ERR(file)) { |
252 | err = PTR_ERR(file); | 250 | err = PTR_ERR(file); |
253 | goto clean_up; | 251 | goto clean_up; |
@@ -407,7 +405,7 @@ static int nvgpu_gpu_ioctl_wait_for_pause(struct gk20a *g, | |||
407 | 405 | ||
408 | sm_count = g->gr.gpc_count * g->gr.tpc_count; | 406 | sm_count = g->gr.gpc_count * g->gr.tpc_count; |
409 | size = sm_count * sizeof(struct warpstate); | 407 | size = sm_count * sizeof(struct warpstate); |
410 | w_state = kzalloc(size, GFP_KERNEL); | 408 | w_state = nvgpu_kzalloc(g, size); |
411 | if (!w_state) | 409 | if (!w_state) |
412 | return -ENOMEM; | 410 | return -ENOMEM; |
413 | 411 | ||
@@ -421,7 +419,7 @@ static int nvgpu_gpu_ioctl_wait_for_pause(struct gk20a *g, | |||
421 | } | 419 | } |
422 | 420 | ||
423 | nvgpu_mutex_release(&g->dbg_sessions_lock); | 421 | nvgpu_mutex_release(&g->dbg_sessions_lock); |
424 | kfree(w_state); | 422 | nvgpu_kfree(g, w_state); |
425 | return err; | 423 | return err; |
426 | } | 424 | } |
427 | 425 | ||
@@ -473,7 +471,7 @@ static int gk20a_ctrl_vsm_mapping(struct gk20a *g, | |||
473 | struct nvgpu_gpu_vsms_mapping_entry *vsms_buf; | 471 | struct nvgpu_gpu_vsms_mapping_entry *vsms_buf; |
474 | u32 i; | 472 | u32 i; |
475 | 473 | ||
476 | vsms_buf = kzalloc(write_size, GFP_KERNEL); | 474 | vsms_buf = nvgpu_kzalloc(g, write_size); |
477 | if (vsms_buf == NULL) | 475 | if (vsms_buf == NULL) |
478 | return -ENOMEM; | 476 | return -ENOMEM; |
479 | 477 | ||
@@ -485,7 +483,7 @@ static int gk20a_ctrl_vsm_mapping(struct gk20a *g, | |||
485 | err = copy_to_user((void __user *)(uintptr_t) | 483 | err = copy_to_user((void __user *)(uintptr_t) |
486 | args->vsms_map_buf_addr, | 484 | args->vsms_map_buf_addr, |
487 | vsms_buf, write_size); | 485 | vsms_buf, write_size); |
488 | kfree(vsms_buf); | 486 | nvgpu_kfree(g, vsms_buf); |
489 | 487 | ||
490 | return err; | 488 | return err; |
491 | } | 489 | } |
@@ -760,7 +758,7 @@ static int nvgpu_gpu_clk_get_vf_points(struct gk20a *g, | |||
760 | if (err) | 758 | if (err) |
761 | return err; | 759 | return err; |
762 | 760 | ||
763 | fpoints = kcalloc(max_points, sizeof(u16), GFP_KERNEL); | 761 | fpoints = nvgpu_kcalloc(g, max_points, sizeof(u16)); |
764 | if (!fpoints) | 762 | if (!fpoints) |
765 | return -ENOMEM; | 763 | return -ENOMEM; |
766 | 764 | ||
@@ -797,7 +795,7 @@ static int nvgpu_gpu_clk_get_vf_points(struct gk20a *g, | |||
797 | args->num_entries = num_points; | 795 | args->num_entries = num_points; |
798 | 796 | ||
799 | fail: | 797 | fail: |
800 | kfree(fpoints); | 798 | nvgpu_kfree(g, fpoints); |
801 | return err; | 799 | return err; |
802 | } | 800 | } |
803 | 801 | ||
@@ -1245,13 +1243,13 @@ long gk20a_ctrl_dev_ioctl(struct file *filp, unsigned int cmd, unsigned long arg | |||
1245 | 1243 | ||
1246 | memset(get_info_args, 0, sizeof(struct nvgpu_gpu_zcull_get_info_args)); | 1244 | memset(get_info_args, 0, sizeof(struct nvgpu_gpu_zcull_get_info_args)); |
1247 | 1245 | ||
1248 | zcull_info = kzalloc(sizeof(struct gr_zcull_info), GFP_KERNEL); | 1246 | zcull_info = nvgpu_kzalloc(g, sizeof(struct gr_zcull_info)); |
1249 | if (zcull_info == NULL) | 1247 | if (zcull_info == NULL) |
1250 | return -ENOMEM; | 1248 | return -ENOMEM; |
1251 | 1249 | ||
1252 | err = g->ops.gr.get_zcull_info(g, &g->gr, zcull_info); | 1250 | err = g->ops.gr.get_zcull_info(g, &g->gr, zcull_info); |
1253 | if (err) { | 1251 | if (err) { |
1254 | kfree(zcull_info); | 1252 | nvgpu_kfree(g, zcull_info); |
1255 | break; | 1253 | break; |
1256 | } | 1254 | } |
1257 | 1255 | ||
@@ -1266,12 +1264,12 @@ long gk20a_ctrl_dev_ioctl(struct file *filp, unsigned int cmd, unsigned long arg | |||
1266 | get_info_args->subregion_height_align_pixels = zcull_info->subregion_height_align_pixels; | 1264 | get_info_args->subregion_height_align_pixels = zcull_info->subregion_height_align_pixels; |
1267 | get_info_args->subregion_count = zcull_info->subregion_count; | 1265 | get_info_args->subregion_count = zcull_info->subregion_count; |
1268 | 1266 | ||
1269 | kfree(zcull_info); | 1267 | nvgpu_kfree(g, zcull_info); |
1270 | break; | 1268 | break; |
1271 | case NVGPU_GPU_IOCTL_ZBC_SET_TABLE: | 1269 | case NVGPU_GPU_IOCTL_ZBC_SET_TABLE: |
1272 | set_table_args = (struct nvgpu_gpu_zbc_set_table_args *)buf; | 1270 | set_table_args = (struct nvgpu_gpu_zbc_set_table_args *)buf; |
1273 | 1271 | ||
1274 | zbc_val = kzalloc(sizeof(struct zbc_entry), GFP_KERNEL); | 1272 | zbc_val = nvgpu_kzalloc(g, sizeof(struct zbc_entry)); |
1275 | if (zbc_val == NULL) | 1273 | if (zbc_val == NULL) |
1276 | return -ENOMEM; | 1274 | return -ENOMEM; |
1277 | 1275 | ||
@@ -1303,12 +1301,12 @@ long gk20a_ctrl_dev_ioctl(struct file *filp, unsigned int cmd, unsigned long arg | |||
1303 | } | 1301 | } |
1304 | 1302 | ||
1305 | if (zbc_val) | 1303 | if (zbc_val) |
1306 | kfree(zbc_val); | 1304 | nvgpu_kfree(g, zbc_val); |
1307 | break; | 1305 | break; |
1308 | case NVGPU_GPU_IOCTL_ZBC_QUERY_TABLE: | 1306 | case NVGPU_GPU_IOCTL_ZBC_QUERY_TABLE: |
1309 | query_table_args = (struct nvgpu_gpu_zbc_query_table_args *)buf; | 1307 | query_table_args = (struct nvgpu_gpu_zbc_query_table_args *)buf; |
1310 | 1308 | ||
1311 | zbc_tbl = kzalloc(sizeof(struct zbc_query_params), GFP_KERNEL); | 1309 | zbc_tbl = nvgpu_kzalloc(g, sizeof(struct zbc_query_params)); |
1312 | if (zbc_tbl == NULL) | 1310 | if (zbc_tbl == NULL) |
1313 | return -ENOMEM; | 1311 | return -ENOMEM; |
1314 | 1312 | ||
@@ -1342,7 +1340,7 @@ long gk20a_ctrl_dev_ioctl(struct file *filp, unsigned int cmd, unsigned long arg | |||
1342 | } | 1340 | } |
1343 | 1341 | ||
1344 | if (zbc_tbl) | 1342 | if (zbc_tbl) |
1345 | kfree(zbc_tbl); | 1343 | nvgpu_kfree(g, zbc_tbl); |
1346 | break; | 1344 | break; |
1347 | 1345 | ||
1348 | case NVGPU_GPU_IOCTL_GET_CHARACTERISTICS: | 1346 | case NVGPU_GPU_IOCTL_GET_CHARACTERISTICS: |
diff --git a/drivers/gpu/nvgpu/gk20a/ctxsw_trace_gk20a.c b/drivers/gpu/nvgpu/gk20a/ctxsw_trace_gk20a.c index c75689f2..1c3ba9c2 100644 --- a/drivers/gpu/nvgpu/gk20a/ctxsw_trace_gk20a.c +++ b/drivers/gpu/nvgpu/gk20a/ctxsw_trace_gk20a.c | |||
@@ -24,6 +24,9 @@ | |||
24 | #include <linux/log2.h> | 24 | #include <linux/log2.h> |
25 | #include <trace/events/gk20a.h> | 25 | #include <trace/events/gk20a.h> |
26 | #include <uapi/linux/nvgpu.h> | 26 | #include <uapi/linux/nvgpu.h> |
27 | |||
28 | #include <nvgpu/kmem.h> | ||
29 | |||
27 | #include "ctxsw_trace_gk20a.h" | 30 | #include "ctxsw_trace_gk20a.h" |
28 | #include "gk20a.h" | 31 | #include "gk20a.h" |
29 | #include "gr_gk20a.h" | 32 | #include "gr_gk20a.h" |
@@ -196,7 +199,7 @@ static int gk20a_ctxsw_dev_ring_free(struct gk20a *g) | |||
196 | { | 199 | { |
197 | struct gk20a_ctxsw_dev *dev = &g->ctxsw_trace->devs[0]; | 200 | struct gk20a_ctxsw_dev *dev = &g->ctxsw_trace->devs[0]; |
198 | 201 | ||
199 | vfree(dev->hdr); | 202 | nvgpu_vfree(g, dev->hdr); |
200 | return 0; | 203 | return 0; |
201 | } | 204 | } |
202 | 205 | ||
@@ -516,7 +519,7 @@ int gk20a_ctxsw_trace_init(struct gk20a *g) | |||
516 | if (likely(trace)) | 519 | if (likely(trace)) |
517 | return 0; | 520 | return 0; |
518 | 521 | ||
519 | trace = kzalloc(sizeof(*trace), GFP_KERNEL); | 522 | trace = nvgpu_kzalloc(g, sizeof(*trace)); |
520 | if (unlikely(!trace)) | 523 | if (unlikely(!trace)) |
521 | return -ENOMEM; | 524 | return -ENOMEM; |
522 | g->ctxsw_trace = trace; | 525 | g->ctxsw_trace = trace; |
@@ -533,7 +536,7 @@ int gk20a_ctxsw_trace_init(struct gk20a *g) | |||
533 | 536 | ||
534 | fail: | 537 | fail: |
535 | memset(&g->ops.fecs_trace, 0, sizeof(g->ops.fecs_trace)); | 538 | memset(&g->ops.fecs_trace, 0, sizeof(g->ops.fecs_trace)); |
536 | kfree(trace); | 539 | nvgpu_kfree(g, trace); |
537 | g->ctxsw_trace = NULL; | 540 | g->ctxsw_trace = NULL; |
538 | return err; | 541 | return err; |
539 | #else | 542 | #else |
@@ -559,7 +562,7 @@ void gk20a_ctxsw_trace_cleanup(struct gk20a *g) | |||
559 | dev++; | 562 | dev++; |
560 | } | 563 | } |
561 | 564 | ||
562 | kfree(g->ctxsw_trace); | 565 | nvgpu_kfree(g, g->ctxsw_trace); |
563 | g->ctxsw_trace = NULL; | 566 | g->ctxsw_trace = NULL; |
564 | 567 | ||
565 | g->ops.fecs_trace.deinit(g); | 568 | g->ops.fecs_trace.deinit(g); |
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 | } |
diff --git a/drivers/gpu/nvgpu/gk20a/fecs_trace_gk20a.c b/drivers/gpu/nvgpu/gk20a/fecs_trace_gk20a.c index da2421d9..dbf67c71 100644 --- a/drivers/gpu/nvgpu/gk20a/fecs_trace_gk20a.c +++ b/drivers/gpu/nvgpu/gk20a/fecs_trace_gk20a.c | |||
@@ -23,6 +23,9 @@ | |||
23 | #include <linux/debugfs.h> | 23 | #include <linux/debugfs.h> |
24 | #include <linux/log2.h> | 24 | #include <linux/log2.h> |
25 | #include <uapi/linux/nvgpu.h> | 25 | #include <uapi/linux/nvgpu.h> |
26 | |||
27 | #include <nvgpu/kmem.h> | ||
28 | |||
26 | #include "ctxsw_trace_gk20a.h" | 29 | #include "ctxsw_trace_gk20a.h" |
27 | #include "fecs_trace_gk20a.h" | 30 | #include "fecs_trace_gk20a.h" |
28 | #include "gk20a.h" | 31 | #include "gk20a.h" |
@@ -151,7 +154,7 @@ static int gk20a_fecs_trace_hash_add(struct gk20a *g, u32 context_ptr, pid_t pid | |||
151 | gk20a_dbg(gpu_dbg_fn | gpu_dbg_ctxsw, | 154 | gk20a_dbg(gpu_dbg_fn | gpu_dbg_ctxsw, |
152 | "adding hash entry context_ptr=%x -> pid=%d", context_ptr, pid); | 155 | "adding hash entry context_ptr=%x -> pid=%d", context_ptr, pid); |
153 | 156 | ||
154 | he = kzalloc(sizeof(*he), GFP_KERNEL); | 157 | he = nvgpu_kzalloc(g, sizeof(*he)); |
155 | if (unlikely(!he)) { | 158 | if (unlikely(!he)) { |
156 | gk20a_warn(dev_from_gk20a(g), | 159 | gk20a_warn(dev_from_gk20a(g), |
157 | "can't alloc new hash entry for context_ptr=%x pid=%d", | 160 | "can't alloc new hash entry for context_ptr=%x pid=%d", |
@@ -184,7 +187,7 @@ static void gk20a_fecs_trace_hash_del(struct gk20a *g, u32 context_ptr) | |||
184 | gk20a_dbg(gpu_dbg_ctxsw, | 187 | gk20a_dbg(gpu_dbg_ctxsw, |
185 | "freed hash entry=%p context_ptr=%x", ent, | 188 | "freed hash entry=%p context_ptr=%x", ent, |
186 | ent->context_ptr); | 189 | ent->context_ptr); |
187 | kfree(ent); | 190 | nvgpu_kfree(g, ent); |
188 | break; | 191 | break; |
189 | } | 192 | } |
190 | } | 193 | } |
@@ -203,7 +206,7 @@ static void gk20a_fecs_trace_free_hash_table(struct gk20a *g) | |||
203 | nvgpu_mutex_acquire(&trace->hash_lock); | 206 | nvgpu_mutex_acquire(&trace->hash_lock); |
204 | hash_for_each_safe(trace->pid_hash_table, bkt, tmp, ent, node) { | 207 | hash_for_each_safe(trace->pid_hash_table, bkt, tmp, ent, node) { |
205 | hash_del(&ent->node); | 208 | hash_del(&ent->node); |
206 | kfree(ent); | 209 | nvgpu_kfree(g, ent); |
207 | } | 210 | } |
208 | nvgpu_mutex_release(&trace->hash_lock); | 211 | nvgpu_mutex_release(&trace->hash_lock); |
209 | 212 | ||
@@ -566,7 +569,7 @@ static int gk20a_fecs_trace_init(struct gk20a *g) | |||
566 | struct gk20a_fecs_trace *trace; | 569 | struct gk20a_fecs_trace *trace; |
567 | int err; | 570 | int err; |
568 | 571 | ||
569 | trace = kzalloc(sizeof(struct gk20a_fecs_trace), GFP_KERNEL); | 572 | trace = nvgpu_kzalloc(g, sizeof(struct gk20a_fecs_trace)); |
570 | if (!trace) { | 573 | if (!trace) { |
571 | gk20a_warn(dev_from_gk20a(g), "failed to allocate fecs_trace"); | 574 | gk20a_warn(dev_from_gk20a(g), "failed to allocate fecs_trace"); |
572 | return -ENOMEM; | 575 | return -ENOMEM; |
@@ -600,7 +603,7 @@ clean_hash_lock: | |||
600 | clean_poll_lock: | 603 | clean_poll_lock: |
601 | nvgpu_mutex_destroy(&trace->poll_lock); | 604 | nvgpu_mutex_destroy(&trace->poll_lock); |
602 | clean: | 605 | clean: |
603 | kfree(trace); | 606 | nvgpu_kfree(g, trace); |
604 | g->fecs_trace = NULL; | 607 | g->fecs_trace = NULL; |
605 | return err; | 608 | return err; |
606 | } | 609 | } |
@@ -712,7 +715,7 @@ static int gk20a_fecs_trace_deinit(struct gk20a *g) | |||
712 | nvgpu_mutex_destroy(&g->fecs_trace->hash_lock); | 715 | nvgpu_mutex_destroy(&g->fecs_trace->hash_lock); |
713 | nvgpu_mutex_destroy(&g->fecs_trace->poll_lock); | 716 | nvgpu_mutex_destroy(&g->fecs_trace->poll_lock); |
714 | 717 | ||
715 | kfree(g->fecs_trace); | 718 | nvgpu_kfree(g, g->fecs_trace); |
716 | g->fecs_trace = NULL; | 719 | g->fecs_trace = NULL; |
717 | return 0; | 720 | return 0; |
718 | } | 721 | } |
diff --git a/drivers/gpu/nvgpu/gk20a/fence_gk20a.c b/drivers/gpu/nvgpu/gk20a/fence_gk20a.c index ea3cd3ff..63da0959 100644 --- a/drivers/gpu/nvgpu/gk20a/fence_gk20a.c +++ b/drivers/gpu/nvgpu/gk20a/fence_gk20a.c | |||
@@ -18,6 +18,7 @@ | |||
18 | #include <linux/version.h> | 18 | #include <linux/version.h> |
19 | 19 | ||
20 | #include <nvgpu/semaphore.h> | 20 | #include <nvgpu/semaphore.h> |
21 | #include <nvgpu/kmem.h> | ||
21 | 22 | ||
22 | #include "gk20a.h" | 23 | #include "gk20a.h" |
23 | #include "channel_gk20a.h" | 24 | #include "channel_gk20a.h" |
@@ -42,6 +43,8 @@ static void gk20a_fence_free(struct kref *ref) | |||
42 | { | 43 | { |
43 | struct gk20a_fence *f = | 44 | struct gk20a_fence *f = |
44 | container_of(ref, struct gk20a_fence, ref); | 45 | container_of(ref, struct gk20a_fence, ref); |
46 | struct gk20a *g = f->g; | ||
47 | |||
45 | #ifdef CONFIG_SYNC | 48 | #ifdef CONFIG_SYNC |
46 | if (f->sync_fence) | 49 | if (f->sync_fence) |
47 | sync_fence_put(f->sync_fence); | 50 | sync_fence_put(f->sync_fence); |
@@ -53,7 +56,7 @@ static void gk20a_fence_free(struct kref *ref) | |||
53 | if (nvgpu_alloc_initialized(f->allocator)) | 56 | if (nvgpu_alloc_initialized(f->allocator)) |
54 | nvgpu_free(f->allocator, (size_t)f); | 57 | nvgpu_free(f->allocator, (size_t)f); |
55 | } else | 58 | } else |
56 | kfree(f); | 59 | nvgpu_kfree(g, f); |
57 | } | 60 | } |
58 | 61 | ||
59 | void gk20a_fence_put(struct gk20a_fence *f) | 62 | void gk20a_fence_put(struct gk20a_fence *f) |
@@ -124,7 +127,7 @@ int gk20a_alloc_fence_pool(struct channel_gk20a *c, unsigned int count) | |||
124 | size = sizeof(struct gk20a_fence); | 127 | size = sizeof(struct gk20a_fence); |
125 | if (count <= UINT_MAX / size) { | 128 | if (count <= UINT_MAX / size) { |
126 | size = count * size; | 129 | size = count * size; |
127 | fence_pool = vzalloc(size); | 130 | fence_pool = nvgpu_vzalloc(c->g, size); |
128 | } | 131 | } |
129 | 132 | ||
130 | if (!fence_pool) | 133 | if (!fence_pool) |
@@ -139,7 +142,7 @@ int gk20a_alloc_fence_pool(struct channel_gk20a *c, unsigned int count) | |||
139 | return 0; | 142 | return 0; |
140 | 143 | ||
141 | fail: | 144 | fail: |
142 | vfree(fence_pool); | 145 | nvgpu_vfree(c->g, fence_pool); |
143 | return err; | 146 | return err; |
144 | } | 147 | } |
145 | 148 | ||
@@ -150,7 +153,7 @@ void gk20a_free_fence_pool(struct channel_gk20a *c) | |||
150 | nvgpu_alloc_base(&c->fence_allocator); | 153 | nvgpu_alloc_base(&c->fence_allocator); |
151 | 154 | ||
152 | nvgpu_alloc_destroy(&c->fence_allocator); | 155 | nvgpu_alloc_destroy(&c->fence_allocator); |
153 | vfree(base); | 156 | nvgpu_vfree(c->g, base); |
154 | } | 157 | } |
155 | } | 158 | } |
156 | 159 | ||
@@ -171,10 +174,12 @@ struct gk20a_fence *gk20a_alloc_fence(struct channel_gk20a *c) | |||
171 | } | 174 | } |
172 | } | 175 | } |
173 | } else | 176 | } else |
174 | fence = kzalloc(sizeof(struct gk20a_fence), GFP_KERNEL); | 177 | fence = nvgpu_kzalloc(c->g, sizeof(struct gk20a_fence)); |
175 | 178 | ||
176 | if (fence) | 179 | if (fence) { |
177 | kref_init(&fence->ref); | 180 | kref_init(&fence->ref); |
181 | fence->g = c->g; | ||
182 | } | ||
178 | 183 | ||
179 | return fence; | 184 | return fence; |
180 | } | 185 | } |
@@ -223,6 +228,7 @@ static const struct gk20a_fence_ops nvgpu_semaphore_fence_ops = { | |||
223 | 228 | ||
224 | /* This function takes ownership of the semaphore */ | 229 | /* This function takes ownership of the semaphore */ |
225 | int gk20a_fence_from_semaphore( | 230 | int gk20a_fence_from_semaphore( |
231 | struct gk20a *g, | ||
226 | struct gk20a_fence *fence_out, | 232 | struct gk20a_fence *fence_out, |
227 | struct sync_timeline *timeline, | 233 | struct sync_timeline *timeline, |
228 | struct nvgpu_semaphore *semaphore, | 234 | struct nvgpu_semaphore *semaphore, |
@@ -235,7 +241,7 @@ int gk20a_fence_from_semaphore( | |||
235 | 241 | ||
236 | #ifdef CONFIG_SYNC | 242 | #ifdef CONFIG_SYNC |
237 | if (need_sync_fence) { | 243 | if (need_sync_fence) { |
238 | sync_fence = gk20a_sync_fence_create(timeline, semaphore, | 244 | sync_fence = gk20a_sync_fence_create(g, timeline, semaphore, |
239 | dependency, "f-gk20a-0x%04x", | 245 | dependency, "f-gk20a-0x%04x", |
240 | nvgpu_semaphore_gpu_ro_va(semaphore)); | 246 | nvgpu_semaphore_gpu_ro_va(semaphore)); |
241 | if (!sync_fence) | 247 | if (!sync_fence) |
diff --git a/drivers/gpu/nvgpu/gk20a/fence_gk20a.h b/drivers/gpu/nvgpu/gk20a/fence_gk20a.h index b4283f58..9d9fde85 100644 --- a/drivers/gpu/nvgpu/gk20a/fence_gk20a.h +++ b/drivers/gpu/nvgpu/gk20a/fence_gk20a.h | |||
@@ -30,6 +30,8 @@ struct channel_gk20a; | |||
30 | struct gk20a_fence_ops; | 30 | struct gk20a_fence_ops; |
31 | 31 | ||
32 | struct gk20a_fence { | 32 | struct gk20a_fence { |
33 | struct gk20a *g; | ||
34 | |||
33 | /* Valid for all fence types: */ | 35 | /* Valid for all fence types: */ |
34 | bool valid; | 36 | bool valid; |
35 | struct kref ref; | 37 | struct kref ref; |
@@ -52,6 +54,7 @@ struct gk20a_fence { | |||
52 | 54 | ||
53 | /* Fences can be created from semaphores or syncpoint (id, value) pairs */ | 55 | /* Fences can be created from semaphores or syncpoint (id, value) pairs */ |
54 | int gk20a_fence_from_semaphore( | 56 | int gk20a_fence_from_semaphore( |
57 | struct gk20a *g, | ||
55 | struct gk20a_fence *fence_out, | 58 | struct gk20a_fence *fence_out, |
56 | struct sync_timeline *timeline, | 59 | struct sync_timeline *timeline, |
57 | struct nvgpu_semaphore *semaphore, | 60 | struct nvgpu_semaphore *semaphore, |
diff --git a/drivers/gpu/nvgpu/gk20a/gk20a_scale.c b/drivers/gpu/nvgpu/gk20a/gk20a_scale.c index bae5c2d8..aabe673a 100644 --- a/drivers/gpu/nvgpu/gk20a/gk20a_scale.c +++ b/drivers/gpu/nvgpu/gk20a/gk20a_scale.c | |||
@@ -26,6 +26,8 @@ | |||
26 | 26 | ||
27 | #include <governor.h> | 27 | #include <governor.h> |
28 | 28 | ||
29 | #include <nvgpu/kmem.h> | ||
30 | |||
29 | #include "gk20a.h" | 31 | #include "gk20a.h" |
30 | #include "pmu_gk20a.h" | 32 | #include "pmu_gk20a.h" |
31 | #include "clk_gk20a.h" | 33 | #include "clk_gk20a.h" |
@@ -364,7 +366,7 @@ void gk20a_scale_init(struct device *dev) | |||
364 | if (!platform->devfreq_governor && !platform->qos_notify) | 366 | if (!platform->devfreq_governor && !platform->qos_notify) |
365 | return; | 367 | return; |
366 | 368 | ||
367 | profile = kzalloc(sizeof(*profile), GFP_KERNEL); | 369 | profile = nvgpu_kzalloc(g, sizeof(*profile)); |
368 | 370 | ||
369 | profile->dev = dev; | 371 | profile->dev = dev; |
370 | profile->dev_stat.busy = false; | 372 | profile->dev_stat.busy = false; |
@@ -415,7 +417,7 @@ void gk20a_scale_init(struct device *dev) | |||
415 | return; | 417 | return; |
416 | 418 | ||
417 | err_get_freqs: | 419 | err_get_freqs: |
418 | kfree(profile); | 420 | nvgpu_kfree(g, profile); |
419 | } | 421 | } |
420 | 422 | ||
421 | void gk20a_scale_exit(struct device *dev) | 423 | void gk20a_scale_exit(struct device *dev) |
@@ -436,7 +438,7 @@ void gk20a_scale_exit(struct device *dev) | |||
436 | g->devfreq = NULL; | 438 | g->devfreq = NULL; |
437 | } | 439 | } |
438 | 440 | ||
439 | kfree(g->scale_profile); | 441 | nvgpu_kfree(g, g->scale_profile); |
440 | g->scale_profile = NULL; | 442 | g->scale_profile = NULL; |
441 | } | 443 | } |
442 | 444 | ||
diff --git a/drivers/gpu/nvgpu/gk20a/gk20a_sysfs.c b/drivers/gpu/nvgpu/gk20a/gk20a_sysfs.c index 2ab15357..4b3bb83c 100644 --- a/drivers/gpu/nvgpu/gk20a/gk20a_sysfs.c +++ b/drivers/gpu/nvgpu/gk20a/gk20a_sysfs.c | |||
@@ -29,6 +29,8 @@ | |||
29 | #include <soc/tegra/tegra-dvfs.h> | 29 | #include <soc/tegra/tegra-dvfs.h> |
30 | #endif | 30 | #endif |
31 | 31 | ||
32 | #include <nvgpu/kmem.h> | ||
33 | |||
32 | #include "gk20a.h" | 34 | #include "gk20a.h" |
33 | #include "gr_gk20a.h" | 35 | #include "gr_gk20a.h" |
34 | #include "fifo_gk20a.h" | 36 | #include "fifo_gk20a.h" |
@@ -794,7 +796,7 @@ static ssize_t tpc_fs_mask_store(struct device *dev, | |||
794 | 796 | ||
795 | g->ops.gr.set_gpc_tpc_mask(g, 0); | 797 | g->ops.gr.set_gpc_tpc_mask(g, 0); |
796 | 798 | ||
797 | vfree(g->gr.ctx_vars.local_golden_image); | 799 | nvgpu_vfree(g, g->gr.ctx_vars.local_golden_image); |
798 | g->gr.ctx_vars.local_golden_image = NULL; | 800 | g->gr.ctx_vars.local_golden_image = NULL; |
799 | g->gr.ctx_vars.golden_image_initialized = false; | 801 | g->gr.ctx_vars.golden_image_initialized = false; |
800 | g->gr.ctx_vars.golden_image_size = 0; | 802 | g->gr.ctx_vars.golden_image_size = 0; |
diff --git a/drivers/gpu/nvgpu/gk20a/pmu_gk20a.c b/drivers/gpu/nvgpu/gk20a/pmu_gk20a.c index 85fa8ea1..eda4167b 100644 --- a/drivers/gpu/nvgpu/gk20a/pmu_gk20a.c +++ b/drivers/gpu/nvgpu/gk20a/pmu_gk20a.c | |||
@@ -25,6 +25,7 @@ | |||
25 | 25 | ||
26 | #include <nvgpu/nvgpu_common.h> | 26 | #include <nvgpu/nvgpu_common.h> |
27 | #include <nvgpu/timers.h> | 27 | #include <nvgpu/timers.h> |
28 | #include <nvgpu/kmem.h> | ||
28 | 29 | ||
29 | #include "gk20a.h" | 30 | #include "gk20a.h" |
30 | #include "gr_gk20a.h" | 31 | #include "gr_gk20a.h" |
@@ -301,7 +302,7 @@ static void printtrace(struct pmu_gk20a *pmu) | |||
301 | u32 *trace1; | 302 | u32 *trace1; |
302 | 303 | ||
303 | /* allocate system memory to copy pmu trace buffer */ | 304 | /* allocate system memory to copy pmu trace buffer */ |
304 | tracebuffer = kzalloc(GK20A_PMU_TRACE_BUFSIZE, GFP_KERNEL); | 305 | tracebuffer = nvgpu_kzalloc(g, GK20A_PMU_TRACE_BUFSIZE); |
305 | if (tracebuffer == NULL) | 306 | if (tracebuffer == NULL) |
306 | return; | 307 | return; |
307 | 308 | ||
@@ -335,7 +336,7 @@ static void printtrace(struct pmu_gk20a *pmu) | |||
335 | scnprintf((buf + count), 0x40, "%s", (trace+i+20+m)); | 336 | scnprintf((buf + count), 0x40, "%s", (trace+i+20+m)); |
336 | gk20a_err(dev_from_gk20a(g), "%s", buf); | 337 | gk20a_err(dev_from_gk20a(g), "%s", buf); |
337 | } | 338 | } |
338 | kfree(tracebuffer); | 339 | nvgpu_kfree(g, tracebuffer); |
339 | } | 340 | } |
340 | 341 | ||
341 | static void set_pmu_cmdline_args_falctracedmabase_v1(struct pmu_gk20a *pmu) | 342 | static void set_pmu_cmdline_args_falctracedmabase_v1(struct pmu_gk20a *pmu) |
@@ -3163,8 +3164,8 @@ static int gk20a_init_pmu_setup_sw(struct gk20a *g) | |||
3163 | pmu->perfmon_sampling_enabled = true; | 3164 | pmu->perfmon_sampling_enabled = true; |
3164 | 3165 | ||
3165 | pmu->mutex_cnt = pwr_pmu_mutex__size_1_v(); | 3166 | pmu->mutex_cnt = pwr_pmu_mutex__size_1_v(); |
3166 | pmu->mutex = kzalloc(pmu->mutex_cnt * | 3167 | pmu->mutex = nvgpu_kzalloc(g, pmu->mutex_cnt * |
3167 | sizeof(struct pmu_mutex), GFP_KERNEL); | 3168 | sizeof(struct pmu_mutex)); |
3168 | if (!pmu->mutex) { | 3169 | if (!pmu->mutex) { |
3169 | err = -ENOMEM; | 3170 | err = -ENOMEM; |
3170 | goto err; | 3171 | goto err; |
@@ -3175,8 +3176,8 @@ static int gk20a_init_pmu_setup_sw(struct gk20a *g) | |||
3175 | pmu->mutex[i].index = i; | 3176 | pmu->mutex[i].index = i; |
3176 | } | 3177 | } |
3177 | 3178 | ||
3178 | pmu->seq = kzalloc(PMU_MAX_NUM_SEQUENCES * | 3179 | pmu->seq = nvgpu_kzalloc(g, PMU_MAX_NUM_SEQUENCES * |
3179 | sizeof(struct pmu_sequence), GFP_KERNEL); | 3180 | sizeof(struct pmu_sequence)); |
3180 | if (!pmu->seq) { | 3181 | if (!pmu->seq) { |
3181 | err = -ENOMEM; | 3182 | err = -ENOMEM; |
3182 | goto err_free_mutex; | 3183 | goto err_free_mutex; |
@@ -3218,9 +3219,9 @@ skip_init: | |||
3218 | err_free_seq_buf: | 3219 | err_free_seq_buf: |
3219 | gk20a_gmmu_unmap_free(vm, &pmu->seq_buf); | 3220 | gk20a_gmmu_unmap_free(vm, &pmu->seq_buf); |
3220 | err_free_seq: | 3221 | err_free_seq: |
3221 | kfree(pmu->seq); | 3222 | nvgpu_kfree(g, pmu->seq); |
3222 | err_free_mutex: | 3223 | err_free_mutex: |
3223 | kfree(pmu->mutex); | 3224 | nvgpu_kfree(g, pmu->mutex); |
3224 | err: | 3225 | err: |
3225 | gk20a_dbg_fn("fail"); | 3226 | gk20a_dbg_fn("fail"); |
3226 | return err; | 3227 | return err; |
@@ -4060,7 +4061,7 @@ static int pmu_response_handle(struct pmu_gk20a *pmu, | |||
4060 | 4061 | ||
4061 | gk20a_pmu_surface_free(g, seq->out_mem); | 4062 | gk20a_pmu_surface_free(g, seq->out_mem); |
4062 | if (seq->out_mem != seq->in_mem) | 4063 | if (seq->out_mem != seq->in_mem) |
4063 | kfree(seq->out_mem); | 4064 | nvgpu_kfree(g, seq->out_mem); |
4064 | else | 4065 | else |
4065 | seq->out_mem = NULL; | 4066 | seq->out_mem = NULL; |
4066 | } | 4067 | } |
@@ -4072,7 +4073,7 @@ static int pmu_response_handle(struct pmu_gk20a *pmu, | |||
4072 | pv->get_pmu_seq_in_a_ptr(seq))); | 4073 | pv->get_pmu_seq_in_a_ptr(seq))); |
4073 | 4074 | ||
4074 | gk20a_pmu_surface_free(g, seq->in_mem); | 4075 | gk20a_pmu_surface_free(g, seq->in_mem); |
4075 | kfree(seq->in_mem); | 4076 | nvgpu_kfree(g, seq->in_mem); |
4076 | seq->in_mem = NULL; | 4077 | seq->in_mem = NULL; |
4077 | } | 4078 | } |
4078 | 4079 | ||
@@ -4822,8 +4823,7 @@ int gk20a_pmu_cmd_post(struct gk20a *g, struct pmu_cmd *cmd, | |||
4822 | goto clean_up; | 4823 | goto clean_up; |
4823 | 4824 | ||
4824 | if (payload->in.fb_size != 0x0) { | 4825 | if (payload->in.fb_size != 0x0) { |
4825 | seq->in_mem = kzalloc(sizeof(struct mem_desc), | 4826 | seq->in_mem = nvgpu_kzalloc(g, sizeof(struct mem_desc)); |
4826 | GFP_KERNEL); | ||
4827 | if (!seq->in_mem) { | 4827 | if (!seq->in_mem) { |
4828 | err = -ENOMEM; | 4828 | err = -ENOMEM; |
4829 | goto clean_up; | 4829 | goto clean_up; |
@@ -4866,8 +4866,8 @@ int gk20a_pmu_cmd_post(struct gk20a *g, struct pmu_cmd *cmd, | |||
4866 | goto clean_up; | 4866 | goto clean_up; |
4867 | 4867 | ||
4868 | if (payload->out.fb_size != 0x0) { | 4868 | if (payload->out.fb_size != 0x0) { |
4869 | seq->out_mem = kzalloc(sizeof(struct mem_desc), | 4869 | seq->out_mem = nvgpu_kzalloc(g, |
4870 | GFP_KERNEL); | 4870 | sizeof(struct mem_desc)); |
4871 | if (!seq->out_mem) { | 4871 | if (!seq->out_mem) { |
4872 | err = -ENOMEM; | 4872 | err = -ENOMEM; |
4873 | goto clean_up; | 4873 | goto clean_up; |
@@ -5690,7 +5690,7 @@ static int falc_trace_show(struct seq_file *s, void *data) | |||
5690 | u32 *trace1; | 5690 | u32 *trace1; |
5691 | 5691 | ||
5692 | /* allocate system memory to copy pmu trace buffer */ | 5692 | /* allocate system memory to copy pmu trace buffer */ |
5693 | tracebuffer = kzalloc(GK20A_PMU_TRACE_BUFSIZE, GFP_KERNEL); | 5693 | tracebuffer = nvgpu_kzalloc(g, GK20A_PMU_TRACE_BUFSIZE); |
5694 | if (tracebuffer == NULL) | 5694 | if (tracebuffer == NULL) |
5695 | return -ENOMEM; | 5695 | return -ENOMEM; |
5696 | 5696 | ||
@@ -5723,7 +5723,7 @@ static int falc_trace_show(struct seq_file *s, void *data) | |||
5723 | seq_printf(s, "%s", (trace+i+20+m)); | 5723 | seq_printf(s, "%s", (trace+i+20+m)); |
5724 | } | 5724 | } |
5725 | 5725 | ||
5726 | kfree(tracebuffer); | 5726 | nvgpu_kfree(g, tracebuffer); |
5727 | return 0; | 5727 | return 0; |
5728 | } | 5728 | } |
5729 | 5729 | ||
diff --git a/drivers/gpu/nvgpu/gk20a/sync_gk20a.c b/drivers/gpu/nvgpu/gk20a/sync_gk20a.c index f57871d5..b6105a40 100644 --- a/drivers/gpu/nvgpu/gk20a/sync_gk20a.c +++ b/drivers/gpu/nvgpu/gk20a/sync_gk20a.c | |||
@@ -23,6 +23,7 @@ | |||
23 | #include <nvgpu/lock.h> | 23 | #include <nvgpu/lock.h> |
24 | #include <uapi/linux/nvgpu.h> | 24 | #include <uapi/linux/nvgpu.h> |
25 | 25 | ||
26 | #include <nvgpu/kmem.h> | ||
26 | #include <nvgpu/semaphore.h> | 27 | #include <nvgpu/semaphore.h> |
27 | 28 | ||
28 | #include "../drivers/staging/android/sync.h" | 29 | #include "../drivers/staging/android/sync.h" |
@@ -42,6 +43,7 @@ struct gk20a_sync_timeline { | |||
42 | * refcounted gk20a_sync_pt for each duped pt. | 43 | * refcounted gk20a_sync_pt for each duped pt. |
43 | */ | 44 | */ |
44 | struct gk20a_sync_pt { | 45 | struct gk20a_sync_pt { |
46 | struct gk20a *g; | ||
45 | struct kref refcount; | 47 | struct kref refcount; |
46 | u32 thresh; | 48 | u32 thresh; |
47 | struct nvgpu_semaphore *sema; | 49 | struct nvgpu_semaphore *sema; |
@@ -203,26 +205,29 @@ static void gk20a_sync_pt_free_shared(struct kref *ref) | |||
203 | { | 205 | { |
204 | struct gk20a_sync_pt *pt = | 206 | struct gk20a_sync_pt *pt = |
205 | container_of(ref, struct gk20a_sync_pt, refcount); | 207 | container_of(ref, struct gk20a_sync_pt, refcount); |
208 | struct gk20a *g = pt->g; | ||
206 | 209 | ||
207 | if (pt->dep) | 210 | if (pt->dep) |
208 | sync_fence_put(pt->dep); | 211 | sync_fence_put(pt->dep); |
209 | if (pt->sema) | 212 | if (pt->sema) |
210 | nvgpu_semaphore_put(pt->sema); | 213 | nvgpu_semaphore_put(pt->sema); |
211 | kfree(pt); | 214 | nvgpu_kfree(g, pt); |
212 | } | 215 | } |
213 | 216 | ||
214 | static struct gk20a_sync_pt *gk20a_sync_pt_create_shared( | 217 | static struct gk20a_sync_pt *gk20a_sync_pt_create_shared( |
218 | struct gk20a *g, | ||
215 | struct gk20a_sync_timeline *obj, | 219 | struct gk20a_sync_timeline *obj, |
216 | struct nvgpu_semaphore *sema, | 220 | struct nvgpu_semaphore *sema, |
217 | struct sync_fence *dependency) | 221 | struct sync_fence *dependency) |
218 | { | 222 | { |
219 | struct gk20a_sync_pt *shared; | 223 | struct gk20a_sync_pt *shared; |
220 | 224 | ||
221 | shared = kzalloc(sizeof(*shared), GFP_KERNEL); | 225 | shared = nvgpu_kzalloc(g, sizeof(*shared)); |
222 | if (!shared) | 226 | if (!shared) |
223 | return NULL; | 227 | return NULL; |
224 | 228 | ||
225 | kref_init(&shared->refcount); | 229 | kref_init(&shared->refcount); |
230 | shared->g = g; | ||
226 | shared->obj = obj; | 231 | shared->obj = obj; |
227 | shared->sema = sema; | 232 | shared->sema = sema; |
228 | shared->thresh = ++obj->max; /* sync framework has a lock */ | 233 | shared->thresh = ++obj->max; /* sync framework has a lock */ |
@@ -249,6 +254,7 @@ static struct gk20a_sync_pt *gk20a_sync_pt_create_shared( | |||
249 | } | 254 | } |
250 | 255 | ||
251 | static struct sync_pt *gk20a_sync_pt_create_inst( | 256 | static struct sync_pt *gk20a_sync_pt_create_inst( |
257 | struct gk20a *g, | ||
252 | struct gk20a_sync_timeline *obj, | 258 | struct gk20a_sync_timeline *obj, |
253 | struct nvgpu_semaphore *sema, | 259 | struct nvgpu_semaphore *sema, |
254 | struct sync_fence *dependency) | 260 | struct sync_fence *dependency) |
@@ -260,7 +266,7 @@ static struct sync_pt *gk20a_sync_pt_create_inst( | |||
260 | if (!pti) | 266 | if (!pti) |
261 | return NULL; | 267 | return NULL; |
262 | 268 | ||
263 | pti->shared = gk20a_sync_pt_create_shared(obj, sema, dependency); | 269 | pti->shared = gk20a_sync_pt_create_shared(g, obj, sema, dependency); |
264 | if (!pti->shared) { | 270 | if (!pti->shared) { |
265 | sync_pt_free(&pti->pt); | 271 | sync_pt_free(&pti->pt); |
266 | return NULL; | 272 | return NULL; |
@@ -506,7 +512,9 @@ struct sync_timeline *gk20a_sync_timeline_create( | |||
506 | return &obj->obj; | 512 | return &obj->obj; |
507 | } | 513 | } |
508 | 514 | ||
509 | struct sync_fence *gk20a_sync_fence_create(struct sync_timeline *obj, | 515 | struct sync_fence *gk20a_sync_fence_create( |
516 | struct gk20a *g, | ||
517 | struct sync_timeline *obj, | ||
510 | struct nvgpu_semaphore *sema, | 518 | struct nvgpu_semaphore *sema, |
511 | struct sync_fence *dependency, | 519 | struct sync_fence *dependency, |
512 | const char *fmt, ...) | 520 | const char *fmt, ...) |
@@ -517,7 +525,7 @@ struct sync_fence *gk20a_sync_fence_create(struct sync_timeline *obj, | |||
517 | struct sync_fence *fence; | 525 | struct sync_fence *fence; |
518 | struct gk20a_sync_timeline *timeline = to_gk20a_timeline(obj); | 526 | struct gk20a_sync_timeline *timeline = to_gk20a_timeline(obj); |
519 | 527 | ||
520 | pt = gk20a_sync_pt_create_inst(timeline, sema, dependency); | 528 | pt = gk20a_sync_pt_create_inst(g, timeline, sema, dependency); |
521 | if (pt == NULL) | 529 | if (pt == NULL) |
522 | return NULL; | 530 | return NULL; |
523 | 531 | ||
diff --git a/drivers/gpu/nvgpu/gk20a/sync_gk20a.h b/drivers/gpu/nvgpu/gk20a/sync_gk20a.h index dcced5c8..5dcdfe15 100644 --- a/drivers/gpu/nvgpu/gk20a/sync_gk20a.h +++ b/drivers/gpu/nvgpu/gk20a/sync_gk20a.h | |||
@@ -34,7 +34,9 @@ struct nvgpu_semaphore *gk20a_sync_fence_get_sema(struct sync_fence *f); | |||
34 | struct sync_timeline *gk20a_sync_timeline_create(const char *fmt, ...); | 34 | struct sync_timeline *gk20a_sync_timeline_create(const char *fmt, ...); |
35 | void gk20a_sync_timeline_destroy(struct sync_timeline *); | 35 | void gk20a_sync_timeline_destroy(struct sync_timeline *); |
36 | void gk20a_sync_timeline_signal(struct sync_timeline *); | 36 | void gk20a_sync_timeline_signal(struct sync_timeline *); |
37 | struct sync_fence *gk20a_sync_fence_create(struct sync_timeline *, | 37 | struct sync_fence *gk20a_sync_fence_create( |
38 | struct gk20a *g, | ||
39 | struct sync_timeline *, | ||
38 | struct nvgpu_semaphore *, | 40 | struct nvgpu_semaphore *, |
39 | struct sync_fence *dependency, | 41 | struct sync_fence *dependency, |
40 | const char *fmt, ...); | 42 | const char *fmt, ...); |
diff --git a/drivers/gpu/nvgpu/tegra/linux/platform_gk20a_tegra.c b/drivers/gpu/nvgpu/tegra/linux/platform_gk20a_tegra.c index d051c0e3..5b2958ec 100644 --- a/drivers/gpu/nvgpu/tegra/linux/platform_gk20a_tegra.c +++ b/drivers/gpu/nvgpu/tegra/linux/platform_gk20a_tegra.c | |||
@@ -47,6 +47,8 @@ | |||
47 | 47 | ||
48 | #include <linux/platform/tegra/tegra_emc.h> | 48 | #include <linux/platform/tegra/tegra_emc.h> |
49 | 49 | ||
50 | #include <nvgpu/kmem.h> | ||
51 | |||
50 | #include "gk20a/gk20a.h" | 52 | #include "gk20a/gk20a.h" |
51 | #include "gk20a/hal_gk20a.h" | 53 | #include "gk20a/hal_gk20a.h" |
52 | #include "gk20a/platform_gk20a.h" | 54 | #include "gk20a/platform_gk20a.h" |
@@ -162,7 +164,7 @@ int gk20a_tegra_secure_alloc(struct device *dev, | |||
162 | if (dma_mapping_error(&tegra_vpr_dev, iova)) | 164 | if (dma_mapping_error(&tegra_vpr_dev, iova)) |
163 | return -ENOMEM; | 165 | return -ENOMEM; |
164 | 166 | ||
165 | sgt = kzalloc(sizeof(*sgt), GFP_KERNEL); | 167 | sgt = nvgpu_kzalloc(platform->g, sizeof(*sgt)); |
166 | if (!sgt) { | 168 | if (!sgt) { |
167 | gk20a_err(dev, "failed to allocate memory\n"); | 169 | gk20a_err(dev, "failed to allocate memory\n"); |
168 | goto fail; | 170 | goto fail; |
@@ -186,7 +188,7 @@ int gk20a_tegra_secure_alloc(struct device *dev, | |||
186 | return err; | 188 | return err; |
187 | 189 | ||
188 | fail_sgt: | 190 | fail_sgt: |
189 | kfree(sgt); | 191 | nvgpu_kfree(platform->g, sgt); |
190 | fail: | 192 | fail: |
191 | dma_free_attrs(&tegra_vpr_dev, desc->mem.size, | 193 | dma_free_attrs(&tegra_vpr_dev, desc->mem.size, |
192 | (void *)(uintptr_t)iova, iova, __DMA_ATTR(attrs)); | 194 | (void *)(uintptr_t)iova, iova, __DMA_ATTR(attrs)); |
@@ -809,7 +811,7 @@ static void gk20a_tegra_scale_init(struct device *dev) | |||
809 | if (!profile) | 811 | if (!profile) |
810 | return; | 812 | return; |
811 | 813 | ||
812 | emc_params = kzalloc(sizeof(*emc_params), GFP_KERNEL); | 814 | emc_params = nvgpu_kzalloc(platform->g, sizeof(*emc_params)); |
813 | if (!emc_params) | 815 | if (!emc_params) |
814 | return; | 816 | return; |
815 | 817 | ||
@@ -841,7 +843,7 @@ static void gk20a_tegra_scale_exit(struct device *dev) | |||
841 | tegra_bwmgr_unregister(emc_params->bwmgr_cl); | 843 | tegra_bwmgr_unregister(emc_params->bwmgr_cl); |
842 | #endif | 844 | #endif |
843 | 845 | ||
844 | kfree(profile->private_data); | 846 | nvgpu_kfree(platform->g, profile->private_data); |
845 | } | 847 | } |
846 | 848 | ||
847 | void gk20a_tegra_debug_dump(struct device *dev) | 849 | void gk20a_tegra_debug_dump(struct device *dev) |