From f87007829f176baa5d3e784c71f3bceb082a29eb Mon Sep 17 00:00:00 2001 From: Sunny He Date: Fri, 28 Jul 2017 18:37:49 -0700 Subject: gpu: nvgpu: gv11b: Reorg regops HAL initialization Reorganize HAL initialization to remove inheritance and construct the gpu_ops struct at compile time. This patch only covers the regops 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: Ibf9f64ca445691e252b72c2b8fc59edb84e226ce Signed-off-by: Sunny He Reviewed-on: https://git-master.nvidia.com/r/1530136 Reviewed-by: Automatic_Commit_Validation_User GVS: Gerrit_Virtual_Submit Reviewed-by: Alex Waterman Tested-by: Alex Waterman Reviewed-by: Terje Bergstrom --- drivers/gpu/nvgpu/gv11b/hal_gv11b.c | 25 +++++++++++++- drivers/gpu/nvgpu/gv11b/regops_gv11b.c | 63 +++++++--------------------------- drivers/gpu/nvgpu/gv11b/regops_gv11b.h | 14 +++++++- 3 files changed, 50 insertions(+), 52 deletions(-) diff --git a/drivers/gpu/nvgpu/gv11b/hal_gv11b.c b/drivers/gpu/nvgpu/gv11b/hal_gv11b.c index f6121f94..963f78c6 100644 --- a/drivers/gpu/nvgpu/gv11b/hal_gv11b.c +++ b/drivers/gpu/nvgpu/gv11b/hal_gv11b.c @@ -310,6 +310,29 @@ static const struct gpu_ops gv11b_ops = { .init_therm_setup_hw = gp10b_init_therm_setup_hw, .elcg_init_idle_filters = gp10b_elcg_init_idle_filters, }, + .regops = { + .get_global_whitelist_ranges = + gv11b_get_global_whitelist_ranges, + .get_global_whitelist_ranges_count = + gv11b_get_global_whitelist_ranges_count, + .get_context_whitelist_ranges = + gv11b_get_context_whitelist_ranges, + .get_context_whitelist_ranges_count = + gv11b_get_context_whitelist_ranges_count, + .get_runcontrol_whitelist = gv11b_get_runcontrol_whitelist, + .get_runcontrol_whitelist_count = + gv11b_get_runcontrol_whitelist_count, + .get_runcontrol_whitelist_ranges = + gv11b_get_runcontrol_whitelist_ranges, + .get_runcontrol_whitelist_ranges_count = + gv11b_get_runcontrol_whitelist_ranges_count, + .get_qctl_whitelist = gv11b_get_qctl_whitelist, + .get_qctl_whitelist_count = gv11b_get_qctl_whitelist_count, + .get_qctl_whitelist_ranges = gv11b_get_qctl_whitelist_ranges, + .get_qctl_whitelist_ranges_count = + gv11b_get_qctl_whitelist_ranges_count, + .apply_smpc_war = gv11b_apply_smpc_war, + }, .mc = { .intr_enable = mc_gv11b_intr_enable, .intr_unit_config = mc_gp10b_intr_unit_config, @@ -380,6 +403,7 @@ int gv11b_init_hal(struct gk20a *g) gops->gr_ctx = gv11b_ops.gr_ctx; gops->fecs_trace = gv11b_ops.fecs_trace; gops->therm = gv11b_ops.therm; + gops->regops = gv11b_ops.regops; gops->mc = gv11b_ops.mc; gops->debug = gv11b_ops.debug; gops->dbg_session_ops = gv11b_ops.dbg_session_ops; @@ -404,7 +428,6 @@ int gv11b_init_hal(struct gk20a *g) gv11b_init_fb(gops); gv11b_init_mm(gops); gv11b_init_pmu_ops(g); - gv11b_init_regops(gops); g->name = "gv11b"; diff --git a/drivers/gpu/nvgpu/gv11b/regops_gv11b.c b/drivers/gpu/nvgpu/gv11b/regops_gv11b.c index 75923b6a..5e98f9f1 100644 --- a/drivers/gpu/nvgpu/gv11b/regops_gv11b.c +++ b/drivers/gpu/nvgpu/gv11b/regops_gv11b.c @@ -1327,105 +1327,68 @@ static const struct regop_offset_range gv11b_qctl_whitelist_ranges[] = { static const u32 gv11b_qctl_whitelist_ranges_count = ARRAY_SIZE(gv11b_qctl_whitelist_ranges); -static const struct regop_offset_range *gv11b_get_global_whitelist_ranges(void) +const struct regop_offset_range *gv11b_get_global_whitelist_ranges(void) { return gv11b_global_whitelist_ranges; } -static int gv11b_get_global_whitelist_ranges_count(void) +int gv11b_get_global_whitelist_ranges_count(void) { return gv11b_global_whitelist_ranges_count; } -static const struct regop_offset_range *gv11b_get_context_whitelist_ranges(void) +const struct regop_offset_range *gv11b_get_context_whitelist_ranges(void) { return gv11b_global_whitelist_ranges; } -static int gv11b_get_context_whitelist_ranges_count(void) +int gv11b_get_context_whitelist_ranges_count(void) { return gv11b_global_whitelist_ranges_count; } -static const u32 *gv11b_get_runcontrol_whitelist(void) +const u32 *gv11b_get_runcontrol_whitelist(void) { return gv11b_runcontrol_whitelist; } -static int gv11b_get_runcontrol_whitelist_count(void) +int gv11b_get_runcontrol_whitelist_count(void) { return gv11b_runcontrol_whitelist_count; } -static const -struct regop_offset_range *gv11b_get_runcontrol_whitelist_ranges(void) +const struct regop_offset_range *gv11b_get_runcontrol_whitelist_ranges(void) { return gv11b_runcontrol_whitelist_ranges; } -static int gv11b_get_runcontrol_whitelist_ranges_count(void) +int gv11b_get_runcontrol_whitelist_ranges_count(void) { return gv11b_runcontrol_whitelist_ranges_count; } -static const u32 *gv11b_get_qctl_whitelist(void) +const u32 *gv11b_get_qctl_whitelist(void) { return gv11b_qctl_whitelist; } -static int gv11b_get_qctl_whitelist_count(void) +int gv11b_get_qctl_whitelist_count(void) { return gv11b_qctl_whitelist_count; } -static const struct regop_offset_range *gv11b_get_qctl_whitelist_ranges(void) +const struct regop_offset_range *gv11b_get_qctl_whitelist_ranges(void) { return gv11b_qctl_whitelist_ranges; } -static int gv11b_get_qctl_whitelist_ranges_count(void) +int gv11b_get_qctl_whitelist_ranges_count(void) { return gv11b_qctl_whitelist_ranges_count; } -static int gv11b_apply_smpc_war(struct dbg_session_gk20a *dbg_s) +int gv11b_apply_smpc_war(struct dbg_session_gk20a *dbg_s) { /* Not needed on gv11b */ return 0; } - -void gv11b_init_regops(struct gpu_ops *gops) -{ - gops->regops.get_global_whitelist_ranges = - gv11b_get_global_whitelist_ranges; - gops->regops.get_global_whitelist_ranges_count = - gv11b_get_global_whitelist_ranges_count; - - gops->regops.get_context_whitelist_ranges = - gv11b_get_context_whitelist_ranges; - gops->regops.get_context_whitelist_ranges_count = - gv11b_get_context_whitelist_ranges_count; - - gops->regops.get_runcontrol_whitelist = - gv11b_get_runcontrol_whitelist; - gops->regops.get_runcontrol_whitelist_count = - gv11b_get_runcontrol_whitelist_count; - - gops->regops.get_runcontrol_whitelist_ranges = - gv11b_get_runcontrol_whitelist_ranges; - gops->regops.get_runcontrol_whitelist_ranges_count = - gv11b_get_runcontrol_whitelist_ranges_count; - - gops->regops.get_qctl_whitelist = - gv11b_get_qctl_whitelist; - gops->regops.get_qctl_whitelist_count = - gv11b_get_qctl_whitelist_count; - - gops->regops.get_qctl_whitelist_ranges = - gv11b_get_qctl_whitelist_ranges; - gops->regops.get_qctl_whitelist_ranges_count = - gv11b_get_qctl_whitelist_ranges_count; - - gops->regops.apply_smpc_war = - gv11b_apply_smpc_war; -} diff --git a/drivers/gpu/nvgpu/gv11b/regops_gv11b.h b/drivers/gpu/nvgpu/gv11b/regops_gv11b.h index b7250818..dada9a7e 100644 --- a/drivers/gpu/nvgpu/gv11b/regops_gv11b.h +++ b/drivers/gpu/nvgpu/gv11b/regops_gv11b.h @@ -19,6 +19,18 @@ #ifndef __REGOPS_GV11B_H_ #define __REGOPS_GV11B_H_ -void gv11b_init_regops(struct gpu_ops *gops); +const struct regop_offset_range *gv11b_get_global_whitelist_ranges(void); +int gv11b_get_global_whitelist_ranges_count(void); +const struct regop_offset_range *gv11b_get_context_whitelist_ranges(void); +int gv11b_get_context_whitelist_ranges_count(void); +const u32 *gv11b_get_runcontrol_whitelist(void); +int gv11b_get_runcontrol_whitelist_count(void); +const struct regop_offset_range *gv11b_get_runcontrol_whitelist_ranges(void); +int gv11b_get_runcontrol_whitelist_ranges_count(void); +const u32 *gv11b_get_qctl_whitelist(void); +int gv11b_get_qctl_whitelist_count(void); +const struct regop_offset_range *gv11b_get_qctl_whitelist_ranges(void); +int gv11b_get_qctl_whitelist_ranges_count(void); +int gv11b_apply_smpc_war(struct dbg_session_gk20a *dbg_s); #endif /* __REGOPS_GV11B_H_ */ -- cgit v1.2.2