mirror of
git://nv-tegra.nvidia.com/linux-nvgpu.git
synced 2025-12-24 10:34:43 +03:00
gpu: nvgpu: Add pmu as argument for all therm functions
Add struct nvgpu_pmu as argument for all therm functions. This will help in unit testing of public functions in therm unit. Jira NVGPU-3216 Change-Id: Icf48c68bacda2f65dfaa9578f46c0a588c683ed4 Signed-off-by: Abdul Salam <absalam@nvidia.com> Reviewed-on: https://git-master.nvidia.com/r/2113641 Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com> Reviewed-by: Mahantesh Kumbar <mkumbar@nvidia.com> GVS: Gerrit_Virtual_Submit Reviewed-by: Deepak Nibade <dnibade@nvidia.com> Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com> Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
This commit is contained in:
committed by
mobile promotions
parent
8729b9a260
commit
b6b1af387d
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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:
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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 */
|
||||
|
||||
Reference in New Issue
Block a user