gpu: nvgpu: gv11b: Reorg gr_ctx HAL initialization

Reorganize HAL initialization to remove inheritance and construct
the gpu_ops struct at compile time. This patch only covers the
gr_ctx sub-module of the gpu_ops struct.

Perform HAL function assignments in hal_gxxxx.c through the
population of a chip-specific copy of gpu_ops.

Jira NVGPU-74

Change-Id: Icc6b0f968f2e3209de190d445c878a4b20bfcf4a
Signed-off-by: Sunny He <suhe@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1527418
Reviewed-by: Automatic_Commit_Validation_User
GVS: Gerrit_Virtual_Submit
Reviewed-by: Terje Bergstrom <tbergstrom@nvidia.com>
This commit is contained in:
Sunny He
2017-07-26 10:45:38 -07:00
committed by mobile promotions
parent 3c556c5e95
commit afa29933e4
3 changed files with 11 additions and 11 deletions

View File

@@ -2,7 +2,7 @@
*
* GV11B Graphics Context
*
* Copyright (c) 2016, NVIDIA CORPORATION. All rights reserved.
* Copyright (c) 2016-2017, NVIDIA CORPORATION. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify it
* under the terms and conditions of the GNU General Public License,
@@ -22,7 +22,7 @@
#include "gr_ctx_gv11b.h"
static int gr_gv11b_get_netlist_name(struct gk20a *g, int index, char *name)
int gr_gv11b_get_netlist_name(struct gk20a *g, int index, char *name)
{
switch (index) {
#ifdef GV11B_NETLIST_IMAGE_FW_NAME
@@ -57,7 +57,7 @@ static int gr_gv11b_get_netlist_name(struct gk20a *g, int index, char *name)
return -1;
}
static bool gr_gv11b_is_firmware_defined(void)
bool gr_gv11b_is_firmware_defined(void)
{
#ifdef GV11B_NETLIST_IMAGE_FW_NAME
return true;
@@ -65,9 +65,3 @@ static bool gr_gv11b_is_firmware_defined(void)
return false;
#endif
}
void gv11b_init_gr_ctx(struct gpu_ops *gops) {
gops->gr_ctx.get_netlist_name = gr_gv11b_get_netlist_name;
gops->gr_ctx.is_fw_defined = gr_gv11b_is_firmware_defined;
gops->gr_ctx.use_dma_for_fw_bootstrap = false;
}

View File

@@ -25,6 +25,7 @@
* Define netlist for silicon only
* #define GV11B_NETLIST_IMAGE_FW_NAME GK20A_NETLIST_IMAGE_A
*/
void gv11b_init_gr_ctx(struct gpu_ops *gops);
int gr_gv11b_get_netlist_name(struct gk20a *g, int index, char *name);
bool gr_gv11b_is_firmware_defined(void);
#endif /*__GR_CTX_GV11B_H__*/

View File

@@ -282,6 +282,10 @@ static const struct gpu_ops gv11b_ops = {
.preempt_ch_tsg = gv11b_fifo_preempt_ch_tsg,
.handle_ctxsw_timeout = gv11b_fifo_handle_ctxsw_timeout,
},
.gr_ctx = {
.get_netlist_name = gr_gv11b_get_netlist_name,
.is_fw_defined = gr_gv11b_is_firmware_defined,
},
.mc = {
.intr_enable = mc_gv11b_intr_enable,
.intr_unit_config = mc_gp10b_intr_unit_config,
@@ -349,6 +353,7 @@ int gv11b_init_hal(struct gk20a *g)
gops->ce2 = gv11b_ops.ce2;
gops->clock_gating = gv11b_ops.clock_gating;
gops->fifo = gv11b_ops.fifo;
gops->gr_ctx = gv11b_ops.gr_ctx;
gops->mc = gv11b_ops.mc;
gops->debug = gv11b_ops.debug;
gops->dbg_session_ops = gv11b_ops.dbg_session_ops;
@@ -365,13 +370,13 @@ int gv11b_init_hal(struct gk20a *g)
gops->get_litter_value = gv11b_ops.get_litter_value;
/* boot in non-secure modes for time beeing */
__nvgpu_set_enabled(g, NVGPU_GR_USE_DMA_FOR_FW_BOOTSTRAP, false);
__nvgpu_set_enabled(g, NVGPU_SEC_PRIVSECURITY, false);
__nvgpu_set_enabled(g, NVGPU_SEC_SECUREGPCCS, false);
gv11b_init_gr(g);
gv11b_init_fecs_trace_ops(gops);
gv11b_init_fb(gops);
gv11b_init_gr_ctx(gops);
gv11b_init_mm(gops);
gv11b_init_pmu_ops(g);
gv11b_init_regops(gops);