diff --git a/drivers/gpu/nvgpu/common/pmu/pmu_pstate.c b/drivers/gpu/nvgpu/common/pmu/pmu_pstate.c index ff04913e7..c4ae496aa 100644 --- a/drivers/gpu/nvgpu/common/pmu/pmu_pstate.c +++ b/drivers/gpu/nvgpu/common/pmu/pmu_pstate.c @@ -47,7 +47,7 @@ void nvgpu_pmu_pstate_deinit(struct gk20a *g) { pmgr_pmu_free_pmupstate(g); - nvgpu_therm_pmu_free_pmupstate(g); + nvgpu_therm_pmu_free_pmupstate(g, &g->pmu); nvgpu_perf_pmu_free_pmupstate(g); nvgpu_clk_domain_free_pmupstate(g); nvgpu_clk_prog_free_pmupstate(g); @@ -124,9 +124,9 @@ static int pmu_pstate_init(struct gk20a *g) int err; nvgpu_log_fn(g, " "); - err = nvgpu_therm_pmu_init_pmupstate(g); + err = nvgpu_therm_pmu_init_pmupstate(g, &g->pmu); if (err != 0) { - nvgpu_therm_pmu_free_pmupstate(g); + nvgpu_therm_pmu_free_pmupstate(g, &g->pmu); return err; } @@ -286,7 +286,7 @@ int nvgpu_pmu_pstate_sw_setup(struct gk20a *g) return err; } - err = nvgpu_therm_domain_sw_setup(g); + err = nvgpu_therm_domain_sw_setup(g, &g->pmu); if (err != 0) { goto err_therm_pmu_init_pmupstate; } @@ -322,7 +322,7 @@ int nvgpu_pmu_pstate_sw_setup(struct gk20a *g) err_pmgr_pmu_init_pmupstate: pmgr_pmu_free_pmupstate(g); err_therm_pmu_init_pmupstate: - nvgpu_therm_pmu_free_pmupstate(g); + nvgpu_therm_pmu_free_pmupstate(g, &g->pmu); err_perf_pmu_init_pmupstate: nvgpu_perf_pmu_free_pmupstate(g); @@ -469,7 +469,7 @@ int nvgpu_pmu_pstate_pmu_setup(struct gk20a *g) return err; } - err = nvgpu_therm_domain_pmu_setup(g); + err = nvgpu_therm_domain_pmu_setup(g, &g->pmu); if (err != 0) { return err; } diff --git a/drivers/gpu/nvgpu/common/pmu/therm/thrm.c b/drivers/gpu/nvgpu/common/pmu/therm/thrm.c index 69abb6cd8..b9be572d3 100644 --- a/drivers/gpu/nvgpu/common/pmu/therm/thrm.c +++ b/drivers/gpu/nvgpu/common/pmu/therm/thrm.c @@ -35,7 +35,7 @@ void nvgpu_pmu_handle_therm_event(struct gk20a *g, struct nvgpu_pmu *pmu, nvgpu_log_fn(g, " "); if (rpc != NULL) { - nvgpu_pmu_therm_rpc_handler(g, rpc); + nvgpu_pmu_therm_rpc_handler(g, pmu, rpc); } else { switch (msg_therm->msg_type) { @@ -58,7 +58,7 @@ void nvgpu_pmu_handle_therm_event(struct gk20a *g, struct nvgpu_pmu *pmu, } } -int nvgpu_therm_domain_sw_setup(struct gk20a *g) +int nvgpu_therm_domain_sw_setup(struct gk20a *g, struct nvgpu_pmu *pmu) { int status; @@ -78,34 +78,34 @@ int nvgpu_therm_domain_sw_setup(struct gk20a *g) goto exit; } - g->pmu.therm_event_handler = nvgpu_pmu_handle_therm_event; + pmu->therm_event_handler = nvgpu_pmu_handle_therm_event; exit: return status; } -int nvgpu_therm_domain_pmu_setup(struct gk20a *g) +int nvgpu_therm_domain_pmu_setup(struct gk20a *g, struct nvgpu_pmu *pmu) { return therm_send_pmgr_tables_to_pmu(g); } -int nvgpu_therm_pmu_init_pmupstate(struct gk20a *g) +int nvgpu_therm_pmu_init_pmupstate(struct gk20a *g, struct nvgpu_pmu *pmu) { /* If already allocated, do not re-allocate */ - if (g->pmu.therm_pmu != NULL) { + if (pmu->therm_pmu != NULL) { return 0; } - g->pmu.therm_pmu = nvgpu_kzalloc(g, sizeof(*g->pmu.therm_pmu)); - if (g->pmu.therm_pmu == NULL) { + pmu->therm_pmu = nvgpu_kzalloc(g, sizeof(*(pmu->therm_pmu))); + if (pmu->therm_pmu == NULL) { return -ENOMEM; } return 0; } -void nvgpu_therm_pmu_free_pmupstate(struct gk20a *g) +void nvgpu_therm_pmu_free_pmupstate(struct gk20a *g, struct nvgpu_pmu *pmu) { - nvgpu_kfree(g, g->pmu.therm_pmu); - g->pmu.therm_pmu = NULL; + nvgpu_kfree(g, pmu->therm_pmu); + pmu->therm_pmu = NULL; } diff --git a/drivers/gpu/nvgpu/common/pmu/therm/thrmpmu.c b/drivers/gpu/nvgpu/common/pmu/therm/thrmpmu.c index e45637322..813562468 100644 --- a/drivers/gpu/nvgpu/common/pmu/therm/thrmpmu.c +++ b/drivers/gpu/nvgpu/common/pmu/therm/thrmpmu.c @@ -227,7 +227,7 @@ static int therm_send_slct_configuration_to_pmu(struct gk20a *g) (void *)&handlerparams); } -int nvgpu_therm_configure_therm_alert(struct gk20a *g) +int nvgpu_therm_configure_therm_alert(struct gk20a *g, struct nvgpu_pmu *pmu) { int status; @@ -258,7 +258,8 @@ exit: return status; } -void nvgpu_pmu_therm_rpc_handler(struct gk20a *g, struct nv_pmu_rpc_header *rpc) +void nvgpu_pmu_therm_rpc_handler(struct gk20a *g, struct nvgpu_pmu *pmu, + struct nv_pmu_rpc_header *rpc) { switch (rpc->function) { case NV_PMU_RPC_ID_THERM_BOARD_OBJ_GRP_CMD: diff --git a/drivers/gpu/nvgpu/hal/therm/therm_gp106.c b/drivers/gpu/nvgpu/hal/therm/therm_gp106.c index 1f044b902..c8e92b18e 100644 --- a/drivers/gpu/nvgpu/hal/therm/therm_gp106.c +++ b/drivers/gpu/nvgpu/hal/therm/therm_gp106.c @@ -107,7 +107,7 @@ int gp106_configure_therm_alert(struct gk20a *g, s32 curr_warn_temp) if (g->curr_warn_temp != curr_warn_temp) { g->curr_warn_temp = curr_warn_temp; - err = nvgpu_therm_configure_therm_alert(g); + err = nvgpu_therm_configure_therm_alert(g, &g->pmu); } return err; diff --git a/drivers/gpu/nvgpu/include/nvgpu/pmu/therm.h b/drivers/gpu/nvgpu/include/nvgpu/pmu/therm.h index 64b18dbd7..431abf681 100644 --- a/drivers/gpu/nvgpu/include/nvgpu/pmu/therm.h +++ b/drivers/gpu/nvgpu/include/nvgpu/pmu/therm.h @@ -30,12 +30,12 @@ struct nv_pmu_therm_msg; void nvgpu_pmu_handle_therm_event(struct gk20a *g, struct nvgpu_pmu *pmu, struct pmu_msg *msg, struct nv_pmu_rpc_header *rpc); -int nvgpu_therm_domain_sw_setup(struct gk20a *g); -int nvgpu_therm_domain_pmu_setup(struct gk20a *g); -int nvgpu_therm_pmu_init_pmupstate(struct gk20a *g); -void nvgpu_therm_pmu_free_pmupstate(struct gk20a *g); -int nvgpu_therm_configure_therm_alert(struct gk20a *g); -void nvgpu_pmu_therm_rpc_handler(struct gk20a *g, +int nvgpu_therm_domain_sw_setup(struct gk20a *g, struct nvgpu_pmu *pmu); +int nvgpu_therm_domain_pmu_setup(struct gk20a *g, struct nvgpu_pmu *pmu); +int nvgpu_therm_pmu_init_pmupstate(struct gk20a *g, struct nvgpu_pmu *pmu); +void nvgpu_therm_pmu_free_pmupstate(struct gk20a *g, struct nvgpu_pmu *pmu); +int nvgpu_therm_configure_therm_alert(struct gk20a *g, struct nvgpu_pmu *pmu); +void nvgpu_pmu_therm_rpc_handler(struct gk20a *g, struct nvgpu_pmu *pmu, struct nv_pmu_rpc_header *rpc); #endif /* NVGPU_PMU_THREM_H */