gpu: nvgpu: gr_priv header include cleanup

Add more apis in gr_utils for accessing variables within gr struct.
This helps to avoid including gr_priv.h outside gr files and
derefencing gr struct.

Jira NVGPU-3218

Change-Id: I6f24cc302f10aa1da14a981d80c400a027c9a115
Signed-off-by: Vinod G <vinodg@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2115930
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
This commit is contained in:
Vinod G
2019-05-09 14:32:05 -07:00
committed by mobile promotions
parent e615e8f0ff
commit 5c60645cfa
17 changed files with 155 additions and 62 deletions

View File

@@ -32,8 +32,7 @@
#include <nvgpu/gr/ctx.h>
#include <nvgpu/gr/subctx.h>
#include <nvgpu/gr/fecs_trace.h>
#include "common/gr/gr_priv.h"
#include <nvgpu/gr/gr_utils.h>
#ifdef CONFIG_GK20A_CTXSW_TRACE
@@ -215,8 +214,10 @@ int nvgpu_gr_fecs_trace_num_ts(struct gk20a *g)
struct nvgpu_fecs_trace_record *nvgpu_gr_fecs_trace_get_record(
struct gk20a *g, int idx)
{
struct nvgpu_gr_global_ctx_buffer_desc *gr_global_ctx_buffer =
nvgpu_gr_get_global_ctx_buffer_ptr(g);
struct nvgpu_mem *mem = nvgpu_gr_global_ctx_buffer_get_mem(
g->gr->global_ctx_buffer,
gr_global_ctx_buffer,
NVGPU_GR_GLOBAL_CTX_FECS_TRACE_BUFFER);
if (mem == NULL) {
return NULL;
@@ -621,6 +622,8 @@ int nvgpu_gr_fecs_trace_bind_channel(struct gk20a *g,
u64 addr = 0ULL;
struct nvgpu_gr_fecs_trace *trace = g->fecs_trace;
struct nvgpu_mem *mem;
struct nvgpu_gr_global_ctx_buffer_desc *gr_global_ctx_buffer =
nvgpu_gr_get_global_ctx_buffer_ptr(g);
u32 context_ptr;
u32 aperture_mask;
int ret;
@@ -636,7 +639,7 @@ int nvgpu_gr_fecs_trace_bind_channel(struct gk20a *g,
pid, context_ptr,
nvgpu_inst_block_addr(g, inst_block));
mem = nvgpu_gr_global_ctx_buffer_get_mem(g->gr->global_ctx_buffer,
mem = nvgpu_gr_global_ctx_buffer_get_mem(gr_global_ctx_buffer,
NVGPU_GR_GLOBAL_CTX_FECS_TRACE_BUFFER);
if (mem == NULL) {
return -EINVAL;