summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/nvgpu/gk20a/gr_gk20a.c
diff options
context:
space:
mode:
authorDeepak Nibade <dnibade@nvidia.com>2018-06-07 15:05:43 -0400
committerTejal Kudav <tkudav@nvidia.com>2018-06-14 09:44:08 -0400
commit43c340de5429c7e50db20dfd46344bfe3c4119ac (patch)
treefd5d345acc0cf44bf5ccc831453a1b4d7bfa430a /drivers/gpu/nvgpu/gk20a/gr_gk20a.c
parent37160e6a77c8bdb76bf5a5021b01ffa7829f755a (diff)
gpu: nvgpu: add HALs to allocate/map/commit global context buffers
Add below new HALs to allocate/map/commit global context buffers gops.gr.alloc_global_ctx_buffers() gops.gr.map_global_ctx_buffers() gops.gr.commit_global_ctx_buffers() Set these HALs for all the supported GPUs We right now re-use below APIs to set these HALs gr_gk20a_alloc_global_ctx_buffers() gr_gk20a_map_global_ctx_buffers() gr_gk20a_commit_global_ctx_buffers() Jira NVGPUT-27 Change-Id: I975a54e8d1716af057f982d543787748d35a256e Signed-off-by: Deepak Nibade <dnibade@nvidia.com> Reviewed-on: https://git-master.nvidia.com/r/1743362 Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com> Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Diffstat (limited to 'drivers/gpu/nvgpu/gk20a/gr_gk20a.c')
-rw-r--r--drivers/gpu/nvgpu/gk20a/gr_gk20a.c23
1 files changed, 8 insertions, 15 deletions
diff --git a/drivers/gpu/nvgpu/gk20a/gr_gk20a.c b/drivers/gpu/nvgpu/gk20a/gr_gk20a.c
index 42e96715..5d9e3218 100644
--- a/drivers/gpu/nvgpu/gk20a/gr_gk20a.c
+++ b/drivers/gpu/nvgpu/gk20a/gr_gk20a.c
@@ -40,6 +40,7 @@
40#include <nvgpu/error_notifier.h> 40#include <nvgpu/error_notifier.h>
41 41
42#include "gk20a.h" 42#include "gk20a.h"
43#include "gr_gk20a.h"
43#include "gr_ctx_gk20a.h" 44#include "gr_ctx_gk20a.h"
44#include "gr_pri_gk20a.h" 45#include "gr_pri_gk20a.h"
45#include "regops_gk20a.h" 46#include "regops_gk20a.h"
@@ -73,14 +74,6 @@
73 74
74static int gk20a_init_gr_bind_fecs_elpg(struct gk20a *g); 75static int gk20a_init_gr_bind_fecs_elpg(struct gk20a *g);
75 76
76/* global ctx buffer */
77static int gr_gk20a_alloc_global_ctx_buffers(struct gk20a *g);
78static void gr_gk20a_free_global_ctx_buffers(struct gk20a *g);
79static int gr_gk20a_map_global_ctx_buffers(struct gk20a *g,
80 struct channel_gk20a *c);
81static void gr_gk20a_unmap_global_ctx_buffers(struct gk20a *g,
82 struct vm_gk20a *vm,
83 struct nvgpu_gr_ctx *gr_ctx);
84static void gr_gk20a_free_channel_pm_ctx(struct gk20a *g, 77static void gr_gk20a_free_channel_pm_ctx(struct gk20a *g,
85 struct vm_gk20a *vm, 78 struct vm_gk20a *vm,
86 struct nvgpu_gr_ctx *gr_ctx); 79 struct nvgpu_gr_ctx *gr_ctx);
@@ -1535,7 +1528,7 @@ static int gr_gk20a_init_golden_ctx_image(struct gk20a *g,
1535 gk20a_writel(g, gr_fe_go_idle_timeout_r(), 1528 gk20a_writel(g, gr_fe_go_idle_timeout_r(),
1536 gr_fe_go_idle_timeout_count_disabled_f()); 1529 gr_fe_go_idle_timeout_count_disabled_f());
1537 1530
1538 err = gr_gk20a_commit_global_ctx_buffers(g, c, false); 1531 err = g->ops.gr.commit_global_ctx_buffers(g, c, false);
1539 if (err) 1532 if (err)
1540 goto clean_up; 1533 goto clean_up;
1541 1534
@@ -2558,7 +2551,7 @@ static void gr_gk20a_free_global_ctx_buffers(struct gk20a *g)
2558 nvgpu_log_fn(g, "done"); 2551 nvgpu_log_fn(g, "done");
2559} 2552}
2560 2553
2561static int gr_gk20a_alloc_global_ctx_buffers(struct gk20a *g) 2554int gr_gk20a_alloc_global_ctx_buffers(struct gk20a *g)
2562{ 2555{
2563 struct gr_gk20a *gr = &g->gr; 2556 struct gr_gk20a *gr = &g->gr;
2564 int attr_buffer_size, err; 2557 int attr_buffer_size, err;
@@ -2679,8 +2672,8 @@ static void gr_gk20a_unmap_global_ctx_buffers(struct gk20a *g,
2679 gr_ctx->global_ctx_buffer_mapped = false; 2672 gr_ctx->global_ctx_buffer_mapped = false;
2680} 2673}
2681 2674
2682static int gr_gk20a_map_global_ctx_buffers(struct gk20a *g, 2675int gr_gk20a_map_global_ctx_buffers(struct gk20a *g,
2683 struct channel_gk20a *c) 2676 struct channel_gk20a *c)
2684{ 2677{
2685 struct tsg_gk20a *tsg; 2678 struct tsg_gk20a *tsg;
2686 struct vm_gk20a *ch_vm = c->vm; 2679 struct vm_gk20a *ch_vm = c->vm;
@@ -3004,13 +2997,13 @@ int gk20a_alloc_obj_ctx(struct channel_gk20a *c, u32 class_num, u32 flags)
3004 } 2997 }
3005 2998
3006 /* map global buffer to channel gpu_va and commit */ 2999 /* map global buffer to channel gpu_va and commit */
3007 err = gr_gk20a_map_global_ctx_buffers(g, c); 3000 err = g->ops.gr.map_global_ctx_buffers(g, c);
3008 if (err) { 3001 if (err) {
3009 nvgpu_err(g, 3002 nvgpu_err(g,
3010 "fail to map global ctx buffer"); 3003 "fail to map global ctx buffer");
3011 goto out; 3004 goto out;
3012 } 3005 }
3013 gr_gk20a_commit_global_ctx_buffers(g, c, true); 3006 g->ops.gr.commit_global_ctx_buffers(g, c, true);
3014 3007
3015 /* commit gr ctx buffer */ 3008 /* commit gr ctx buffer */
3016 err = g->ops.gr.commit_inst(c, gr_ctx->mem.gpu_va); 3009 err = g->ops.gr.commit_inst(c, gr_ctx->mem.gpu_va);
@@ -4877,7 +4870,7 @@ static int gk20a_init_gr_setup_sw(struct gk20a *g)
4877 if (err) 4870 if (err)
4878 goto clean_up; 4871 goto clean_up;
4879 4872
4880 err = gr_gk20a_alloc_global_ctx_buffers(g); 4873 err = g->ops.gr.alloc_global_ctx_buffers(g);
4881 if (err) 4874 if (err)
4882 goto clean_up; 4875 goto clean_up;
4883 4876