summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/nvgpu/gk20a/fifo_gk20a.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/gpu/nvgpu/gk20a/fifo_gk20a.c')
-rw-r--r--drivers/gpu/nvgpu/gk20a/fifo_gk20a.c57
1 files changed, 28 insertions, 29 deletions
diff --git a/drivers/gpu/nvgpu/gk20a/fifo_gk20a.c b/drivers/gpu/nvgpu/gk20a/fifo_gk20a.c
index 2fa939b9..b390daa4 100644
--- a/drivers/gpu/nvgpu/gk20a/fifo_gk20a.c
+++ b/drivers/gpu/nvgpu/gk20a/fifo_gk20a.c
@@ -18,7 +18,6 @@
18 */ 18 */
19 19
20#include <linux/delay.h> 20#include <linux/delay.h>
21#include <linux/slab.h>
22#include <linux/scatterlist.h> 21#include <linux/scatterlist.h>
23#include <trace/events/gk20a.h> 22#include <trace/events/gk20a.h>
24#include <linux/dma-mapping.h> 23#include <linux/dma-mapping.h>
@@ -27,6 +26,7 @@
27 26
28#include <nvgpu/timers.h> 27#include <nvgpu/timers.h>
29#include <nvgpu/semaphore.h> 28#include <nvgpu/semaphore.h>
29#include <nvgpu/kmem.h>
30 30
31#include "gk20a.h" 31#include "gk20a.h"
32#include "debug_gk20a.h" 32#include "debug_gk20a.h"
@@ -483,10 +483,10 @@ void gk20a_fifo_delete_runlist(struct fifo_gk20a *f)
483 gk20a_gmmu_free(g, &runlist->mem[i]); 483 gk20a_gmmu_free(g, &runlist->mem[i]);
484 } 484 }
485 485
486 kfree(runlist->active_channels); 486 nvgpu_kfree(g, runlist->active_channels);
487 runlist->active_channels = NULL; 487 runlist->active_channels = NULL;
488 488
489 kfree(runlist->active_tsgs); 489 nvgpu_kfree(g, runlist->active_tsgs);
490 runlist->active_tsgs = NULL; 490 runlist->active_tsgs = NULL;
491 491
492 nvgpu_mutex_destroy(&runlist->mutex); 492 nvgpu_mutex_destroy(&runlist->mutex);
@@ -495,7 +495,7 @@ void gk20a_fifo_delete_runlist(struct fifo_gk20a *f)
495 memset(f->runlist_info, 0, (sizeof(struct fifo_runlist_info_gk20a) * 495 memset(f->runlist_info, 0, (sizeof(struct fifo_runlist_info_gk20a) *
496 f->max_runlists)); 496 f->max_runlists));
497 497
498 kfree(f->runlist_info); 498 nvgpu_kfree(g, f->runlist_info);
499 f->runlist_info = NULL; 499 f->runlist_info = NULL;
500 f->max_runlists = 0; 500 f->max_runlists = 0;
501} 501}
@@ -538,8 +538,8 @@ static void gk20a_remove_fifo_support(struct fifo_gk20a *f)
538 538
539 } 539 }
540 540
541 vfree(f->channel); 541 nvgpu_vfree(g, f->channel);
542 vfree(f->tsg); 542 nvgpu_vfree(g, f->tsg);
543 if (g->ops.mm.is_bar1_supported(g)) 543 if (g->ops.mm.is_bar1_supported(g))
544 gk20a_gmmu_unmap_free(&g->mm.bar1.vm, &f->userd); 544 gk20a_gmmu_unmap_free(&g->mm.bar1.vm, &f->userd);
545 else 545 else
@@ -547,11 +547,11 @@ static void gk20a_remove_fifo_support(struct fifo_gk20a *f)
547 547
548 gk20a_fifo_delete_runlist(f); 548 gk20a_fifo_delete_runlist(f);
549 549
550 kfree(f->pbdma_map); 550 nvgpu_kfree(g, f->pbdma_map);
551 f->pbdma_map = NULL; 551 f->pbdma_map = NULL;
552 kfree(f->engine_info); 552 nvgpu_kfree(g, f->engine_info);
553 f->engine_info = NULL; 553 f->engine_info = NULL;
554 kfree(f->active_engines_list); 554 nvgpu_kfree(g, f->active_engines_list);
555 f->active_engines_list = NULL; 555 f->active_engines_list = NULL;
556#ifdef CONFIG_DEBUG_FS 556#ifdef CONFIG_DEBUG_FS
557 nvgpu_mutex_acquire(&f->profile.lock); 557 nvgpu_mutex_acquire(&f->profile.lock);
@@ -654,8 +654,9 @@ static int init_runlist(struct gk20a *g, struct fifo_gk20a *f)
654 gk20a_dbg_fn(""); 654 gk20a_dbg_fn("");
655 655
656 f->max_runlists = g->ops.fifo.eng_runlist_base_size(); 656 f->max_runlists = g->ops.fifo.eng_runlist_base_size();
657 f->runlist_info = kzalloc(sizeof(struct fifo_runlist_info_gk20a) * 657 f->runlist_info = nvgpu_kzalloc(g,
658 f->max_runlists, GFP_KERNEL); 658 sizeof(struct fifo_runlist_info_gk20a) *
659 f->max_runlists);
659 if (!f->runlist_info) 660 if (!f->runlist_info)
660 goto clean_up_runlist; 661 goto clean_up_runlist;
661 662
@@ -666,14 +667,14 @@ static int init_runlist(struct gk20a *g, struct fifo_gk20a *f)
666 runlist = &f->runlist_info[runlist_id]; 667 runlist = &f->runlist_info[runlist_id];
667 668
668 runlist->active_channels = 669 runlist->active_channels =
669 kzalloc(DIV_ROUND_UP(f->num_channels, BITS_PER_BYTE), 670 nvgpu_kzalloc(g, DIV_ROUND_UP(f->num_channels,
670 GFP_KERNEL); 671 BITS_PER_BYTE));
671 if (!runlist->active_channels) 672 if (!runlist->active_channels)
672 goto clean_up_runlist; 673 goto clean_up_runlist;
673 674
674 runlist->active_tsgs = 675 runlist->active_tsgs =
675 kzalloc(DIV_ROUND_UP(f->num_channels, BITS_PER_BYTE), 676 nvgpu_kzalloc(g, DIV_ROUND_UP(f->num_channels,
676 GFP_KERNEL); 677 BITS_PER_BYTE));
677 if (!runlist->active_tsgs) 678 if (!runlist->active_tsgs)
678 goto clean_up_runlist; 679 goto clean_up_runlist;
679 680
@@ -905,16 +906,14 @@ static int gk20a_init_fifo_setup_sw(struct gk20a *g)
905 906
906 f->userd_entry_size = 1 << ram_userd_base_shift_v(); 907 f->userd_entry_size = 1 << ram_userd_base_shift_v();
907 908
908 f->channel = vzalloc(f->num_channels * sizeof(*f->channel)); 909 f->channel = nvgpu_vzalloc(g, f->num_channels * sizeof(*f->channel));
909 f->tsg = vzalloc(f->num_channels * sizeof(*f->tsg)); 910 f->tsg = nvgpu_vzalloc(g, f->num_channels * sizeof(*f->tsg));
910 f->pbdma_map = kzalloc(f->num_pbdma * sizeof(*f->pbdma_map), 911 f->pbdma_map = nvgpu_kzalloc(g, f->num_pbdma * sizeof(*f->pbdma_map));
911 GFP_KERNEL); 912 f->engine_info = nvgpu_kzalloc(g, f->max_engines *
912 f->engine_info = kzalloc(f->max_engines * sizeof(*f->engine_info), 913 sizeof(*f->engine_info));
913 GFP_KERNEL); 914 f->active_engines_list = nvgpu_kzalloc(g, f->max_engines * sizeof(u32));
914 f->active_engines_list = kzalloc(f->max_engines * sizeof(u32),
915 GFP_KERNEL);
916 915
917 if (!(f->channel && f->pbdma_map && f->engine_info && 916 if (!(f->channel && f->tsg && f->pbdma_map && f->engine_info &&
918 f->active_engines_list)) { 917 f->active_engines_list)) {
919 err = -ENOMEM; 918 err = -ENOMEM;
920 goto clean_up; 919 goto clean_up;
@@ -977,15 +976,15 @@ clean_up:
977 else 976 else
978 gk20a_gmmu_free(g, &f->userd); 977 gk20a_gmmu_free(g, &f->userd);
979 978
980 vfree(f->channel); 979 nvgpu_vfree(g, f->channel);
981 f->channel = NULL; 980 f->channel = NULL;
982 vfree(f->tsg); 981 nvgpu_vfree(g, f->tsg);
983 f->tsg = NULL; 982 f->tsg = NULL;
984 kfree(f->pbdma_map); 983 nvgpu_kfree(g, f->pbdma_map);
985 f->pbdma_map = NULL; 984 f->pbdma_map = NULL;
986 kfree(f->engine_info); 985 nvgpu_kfree(g, f->engine_info);
987 f->engine_info = NULL; 986 f->engine_info = NULL;
988 kfree(f->active_engines_list); 987 nvgpu_kfree(g, f->active_engines_list);
989 f->active_engines_list = NULL; 988 f->active_engines_list = NULL;
990 989
991 return err; 990 return err;