summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/nvgpu/gk20a/channel_sync_gk20a.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/gpu/nvgpu/gk20a/channel_sync_gk20a.c')
-rw-r--r--drivers/gpu/nvgpu/gk20a/channel_sync_gk20a.c24
1 files changed, 13 insertions, 11 deletions
diff --git a/drivers/gpu/nvgpu/gk20a/channel_sync_gk20a.c b/drivers/gpu/nvgpu/gk20a/channel_sync_gk20a.c
index b4870c33..11448094 100644
--- a/drivers/gpu/nvgpu/gk20a/channel_sync_gk20a.c
+++ b/drivers/gpu/nvgpu/gk20a/channel_sync_gk20a.c
@@ -19,6 +19,7 @@
19#include <linux/version.h> 19#include <linux/version.h>
20 20
21#include <nvgpu/semaphore.h> 21#include <nvgpu/semaphore.h>
22#include <nvgpu/kmem.h>
22 23
23#include "channel_sync_gk20a.h" 24#include "channel_sync_gk20a.h"
24#include "gk20a.h" 25#include "gk20a.h"
@@ -339,7 +340,7 @@ static void gk20a_channel_syncpt_destroy(struct gk20a_channel_sync *s)
339 container_of(s, struct gk20a_channel_syncpt, ops); 340 container_of(s, struct gk20a_channel_syncpt, ops);
340 nvhost_syncpt_set_min_eq_max_ext(sp->host1x_pdev, sp->id); 341 nvhost_syncpt_set_min_eq_max_ext(sp->host1x_pdev, sp->id);
341 nvhost_syncpt_put_ref_ext(sp->host1x_pdev, sp->id); 342 nvhost_syncpt_put_ref_ext(sp->host1x_pdev, sp->id);
342 kfree(sp); 343 nvgpu_kfree(sp->c->g, sp);
343} 344}
344 345
345static struct gk20a_channel_sync * 346static struct gk20a_channel_sync *
@@ -348,7 +349,7 @@ gk20a_channel_syncpt_create(struct channel_gk20a *c)
348 struct gk20a_channel_syncpt *sp; 349 struct gk20a_channel_syncpt *sp;
349 char syncpt_name[32]; 350 char syncpt_name[32];
350 351
351 sp = kzalloc(sizeof(*sp), GFP_KERNEL); 352 sp = nvgpu_kzalloc(c->g, sizeof(*sp));
352 if (!sp) 353 if (!sp)
353 return NULL; 354 return NULL;
354 355
@@ -361,7 +362,7 @@ gk20a_channel_syncpt_create(struct channel_gk20a *c)
361 sp->id = nvhost_get_syncpt_host_managed(sp->host1x_pdev, 362 sp->id = nvhost_get_syncpt_host_managed(sp->host1x_pdev,
362 c->hw_chid, syncpt_name); 363 c->hw_chid, syncpt_name);
363 if (!sp->id) { 364 if (!sp->id) {
364 kfree(sp); 365 nvgpu_kfree(c->g, sp);
365 gk20a_err(c->g->dev, "failed to get free syncpt"); 366 gk20a_err(c->g->dev, "failed to get free syncpt");
366 return NULL; 367 return NULL;
367 } 368 }
@@ -464,12 +465,13 @@ void gk20a_channel_cancel_pending_sema_waits(struct gk20a *g)
464 list_del_init(&work->entry); 465 list_del_init(&work->entry);
465 466
466 /* 467 /*
467 * Only kfree() work if the cancel is successful. Otherwise it's 468 * Only nvgpu_kfree() work if the cancel is successful.
468 * in use by the gk20a_channel_semaphore_launcher() code. 469 * Otherwise it's in use by the
470 * gk20a_channel_semaphore_launcher() code.
469 */ 471 */
470 ret = sync_fence_cancel_async(work->fence, &work->waiter); 472 ret = sync_fence_cancel_async(work->fence, &work->waiter);
471 if (ret == 0) 473 if (ret == 0)
472 kfree(work); 474 nvgpu_kfree(g, work);
473 } 475 }
474} 476}
475 477
@@ -503,7 +505,7 @@ static void gk20a_channel_semaphore_launcher(
503 sync_fence_put(fence); 505 sync_fence_put(fence);
504 nvgpu_semaphore_release(w->sema); 506 nvgpu_semaphore_release(w->sema);
505 nvgpu_semaphore_put(w->sema); 507 nvgpu_semaphore_put(w->sema);
506 kfree(w); 508 nvgpu_kfree(g, w);
507} 509}
508#endif 510#endif
509 511
@@ -706,7 +708,7 @@ static int gk20a_channel_semaphore_wait_fd(
706 goto clean_up_sync_fence; 708 goto clean_up_sync_fence;
707 } 709 }
708 710
709 w = kzalloc(sizeof(*w), GFP_KERNEL); 711 w = nvgpu_kzalloc(c->g, sizeof(*w));
710 if (!w) { 712 if (!w) {
711 err = -ENOMEM; 713 err = -ENOMEM;
712 goto clean_up_priv_cmd; 714 goto clean_up_priv_cmd;
@@ -766,7 +768,7 @@ clean_up_sema:
766 nvgpu_semaphore_put(w->sema); 768 nvgpu_semaphore_put(w->sema);
767 nvgpu_semaphore_put(w->sema); 769 nvgpu_semaphore_put(w->sema);
768clean_up_worker: 770clean_up_worker:
769 kfree(w); 771 nvgpu_kfree(c->g, w);
770clean_up_priv_cmd: 772clean_up_priv_cmd:
771 gk20a_free_priv_cmdbuf(c, entry); 773 gk20a_free_priv_cmdbuf(c, entry);
772clean_up_sync_fence: 774clean_up_sync_fence:
@@ -917,7 +919,7 @@ static void gk20a_channel_semaphore_destroy(struct gk20a_channel_sync *s)
917 /* The sema pool is cleaned up by the VM destroy. */ 919 /* The sema pool is cleaned up by the VM destroy. */
918 sema->pool = NULL; 920 sema->pool = NULL;
919 921
920 kfree(sema); 922 nvgpu_kfree(sema->c->g, sema);
921} 923}
922 924
923static struct gk20a_channel_sync * 925static struct gk20a_channel_sync *
@@ -930,7 +932,7 @@ gk20a_channel_semaphore_create(struct channel_gk20a *c)
930 if (WARN_ON(!c->vm)) 932 if (WARN_ON(!c->vm))
931 return NULL; 933 return NULL;
932 934
933 sema = kzalloc(sizeof(*sema), GFP_KERNEL); 935 sema = nvgpu_kzalloc(c->g, sizeof(*sema));
934 if (!sema) 936 if (!sema)
935 return NULL; 937 return NULL;
936 sema->c = c; 938 sema->c = c;