From a182be7b8ddee038a3db851166902b197b7be1ea Mon Sep 17 00:00:00 2001 From: Vedashree Vidwans Date: Mon, 9 Mar 2020 13:16:59 -0700 Subject: [PATCH] gpu: nvgpu: add ctxsw_reg bundles for nvgpu-next Add ctxsw_reg bundle programming for nvgpu-next. Jira NVGPU-5047 Change-Id: I3df9d89a6615825d224ec5d46b550cd68623e7d7 Signed-off-by: Vedashree Vidwans Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2309817 Reviewed-by: Automatic_Commit_Validation_User Reviewed-by: svc-mobile-coverity Reviewed-by: svc-mobile-misra Reviewed-by: svc-mobile-cert Reviewed-by: Seshendra Gadagottu Reviewed-by: Lakshmanan M Reviewed-by: Deepak Nibade Reviewed-by: automaticguardword Reviewed-by: mobile promotions Tested-by: mobile promotions --- drivers/gpu/nvgpu/common/netlist/netlist.c | 7 +++++++ drivers/gpu/nvgpu/common/netlist/netlist_priv.h | 3 +++ drivers/gpu/nvgpu/common/sim/sim_netlist.c | 6 ++++++ 3 files changed, 16 insertions(+) diff --git a/drivers/gpu/nvgpu/common/netlist/netlist.c b/drivers/gpu/nvgpu/common/netlist/netlist.c index b544c149b..811482d95 100644 --- a/drivers/gpu/nvgpu/common/netlist/netlist.c +++ b/drivers/gpu/nvgpu/common/netlist/netlist.c @@ -404,6 +404,10 @@ static bool nvgpu_netlist_handle_debugger_region_id(struct gk20a *g, break; default: handled = false; +#if defined(CONFIG_NVGPU_NON_FUSA) && defined(CONFIG_NVGPU_NEXT) + handled = nvgpu_next_netlist_handle_debugger_region_id(g, + region_id, src, size, netlist_vars, &err); +#endif break; } @@ -561,6 +565,9 @@ clean_up: nvgpu_kfree(g, netlist_vars->ctxsw_regs.pm_rop.l); nvgpu_kfree(g, netlist_vars->ctxsw_regs.pm_ucgpc.l); nvgpu_kfree(g, netlist_vars->ctxsw_regs.etpc.l); +#if defined(CONFIG_NVGPU_NON_FUSA) && defined(CONFIG_NVGPU_NEXT) + nvgpu_next_netlist_deinit_ctxsw_regs(g); +#endif nvgpu_kfree(g, netlist_vars->ctxsw_regs.pm_cau.l); nvgpu_kfree(g, netlist_vars->ctxsw_regs.perf_sys_control.l); nvgpu_kfree(g, netlist_vars->ctxsw_regs.perf_fbp_control.l); diff --git a/drivers/gpu/nvgpu/common/netlist/netlist_priv.h b/drivers/gpu/nvgpu/common/netlist/netlist_priv.h index 6adf1b4ca..d46c15950 100644 --- a/drivers/gpu/nvgpu/common/netlist/netlist_priv.h +++ b/drivers/gpu/nvgpu/common/netlist/netlist_priv.h @@ -154,6 +154,9 @@ struct nvgpu_netlist_vars { struct netlist_aiv_list perf_fbp_control; struct netlist_aiv_list perf_gpc_control; struct netlist_aiv_list perf_pma_control; +#if defined(CONFIG_NVGPU_HAL_NON_FUSA) && defined(CONFIG_NVGPU_NEXT) + struct nvgpu_next_ctxsw_regs nvgpu_next; +#endif } ctxsw_regs; #endif /* CONFIG_NVGPU_DEBUGGER */ }; diff --git a/drivers/gpu/nvgpu/common/sim/sim_netlist.c b/drivers/gpu/nvgpu/common/sim/sim_netlist.c index dd8f320a1..453870af9 100644 --- a/drivers/gpu/nvgpu/common/sim/sim_netlist.c +++ b/drivers/gpu/nvgpu/common/sim/sim_netlist.c @@ -204,6 +204,9 @@ int nvgpu_init_sim_netlist_ctx_vars(struct gk20a *g) if (nvgpu_netlist_alloc_aiv_list(g, etpc_ctxsw_regs) == NULL) { goto fail; } +#if defined(CONFIG_NVGPU_NON_FUSA) && defined(CONFIG_NVGPU_NEXT) + nvgpu_next_init_sim_netlist_ctxsw_regs(g); +#endif #endif /* CONFIG_NVGPU_DEBUGGER */ #if defined(CONFIG_NVGPU_NON_FUSA) && defined(CONFIG_NVGPU_NEXT) nvgpu_next_init_sim_netlist_ctx_vars(g); @@ -417,6 +420,9 @@ fail: nvgpu_kfree(g, pm_gpc_ctxsw_regs->l); nvgpu_kfree(g, pm_tpc_ctxsw_regs->l); nvgpu_kfree(g, etpc_ctxsw_regs->l); +#if defined(CONFIG_NVGPU_NON_FUSA) && defined(CONFIG_NVGPU_NEXT) + nvgpu_next_init_sim_netlist_ctxsw_regs_free(g); +#endif #endif /* CONFIG_NVGPU_DEBUGGER */ return err;