gpu: nvgpu: Remove thrm.h dependency from gk20a.h

gk20a.h depends on definition of struct therm_pmupstate. Change that
to a pointer and use forward declaration, and allocation and
free functions.

Fix a few build breaks by adding explicit includes where previously
a header file had gotten included implicitly.

JIRA NVGPU-596

Change-Id: I67010a979ed7f874070796dd834b9b3d1d9dad4c
Signed-off-by: Terje Bergstrom <tbergstrom@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1946661
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
This commit is contained in:
Terje Bergstrom
2018-11-09 08:36:57 -08:00
committed by mobile promotions
parent 154ef32dc3
commit 10d3259cdb
10 changed files with 70 additions and 27 deletions

View File

@@ -80,7 +80,6 @@ struct set_fll_clk;
#include "gk20a/fifo_gk20a.h"
#include "gk20a/gr_gk20a.h"
#include "pmgr/pmgr.h"
#include "therm/thrm.h"
#ifdef CONFIG_DEBUG_FS
struct railgate_stats {
@@ -1496,7 +1495,7 @@ struct gk20a {
struct clk_pmupstate *clk_pmu;
struct perf_pmupstate *perf_pmu;
struct pmgr_pmupstate pmgr_pmu;
struct therm_pmupstate therm_pmu;
struct therm_pmupstate *therm_pmu;
struct nvgpu_sec2 sec2;
#ifdef CONFIG_DEBUG_FS

View File

@@ -36,6 +36,7 @@ static int pstate_sw_setup(struct gk20a *g);
void gk20a_deinit_pstate_support(struct gk20a *g)
{
therm_pmu_free_pmupstate(g);
perf_pmu_free_pmupstate(g);
clk_free_pmupstate(g);
@@ -63,89 +64,96 @@ int gk20a_init_pstate_support(struct gk20a *g)
goto err_clk_init_pmupstate;
}
err = volt_rail_sw_setup(g);
err = therm_pmu_init_pmupstate(g);
if (err != 0) {
goto err_perf_pmu_init_pmupstate;
}
err = volt_rail_sw_setup(g);
if (err != 0) {
goto err_therm_pmu_init_pmupstate;
}
err = volt_dev_sw_setup(g);
if (err != 0) {
goto err_perf_pmu_init_pmupstate;
goto err_therm_pmu_init_pmupstate;
}
err = volt_policy_sw_setup(g);
if (err != 0) {
goto err_perf_pmu_init_pmupstate;
goto err_therm_pmu_init_pmupstate;
}
err = clk_vin_sw_setup(g);
if (err != 0) {
goto err_perf_pmu_init_pmupstate;
goto err_therm_pmu_init_pmupstate;
}
err = clk_fll_sw_setup(g);
if (err != 0) {
goto err_perf_pmu_init_pmupstate;
goto err_therm_pmu_init_pmupstate;
}
err = therm_domain_sw_setup(g);
if (err != 0) {
goto err_perf_pmu_init_pmupstate;
goto err_therm_pmu_init_pmupstate;
}
err = vfe_var_sw_setup(g);
if (err != 0) {
goto err_perf_pmu_init_pmupstate;
goto err_therm_pmu_init_pmupstate;
}
err = vfe_equ_sw_setup(g);
if (err != 0) {
goto err_perf_pmu_init_pmupstate;
goto err_therm_pmu_init_pmupstate;
}
err = clk_domain_sw_setup(g);
if (err != 0) {
goto err_perf_pmu_init_pmupstate;
goto err_therm_pmu_init_pmupstate;
}
err = clk_vf_point_sw_setup(g);
if (err != 0) {
goto err_perf_pmu_init_pmupstate;
goto err_therm_pmu_init_pmupstate;
}
err = clk_prog_sw_setup(g);
if (err != 0) {
goto err_perf_pmu_init_pmupstate;
goto err_therm_pmu_init_pmupstate;
}
err = pstate_sw_setup(g);
if (err != 0) {
goto err_perf_pmu_init_pmupstate;
goto err_therm_pmu_init_pmupstate;
}
if(g->ops.clk.support_pmgr_domain) {
err = pmgr_domain_sw_setup(g);
if (err != 0) {
goto err_perf_pmu_init_pmupstate;
goto err_therm_pmu_init_pmupstate;
}
}
if (g->ops.clk.support_clk_freq_controller) {
err = clk_freq_controller_sw_setup(g);
if (err != 0) {
goto err_perf_pmu_init_pmupstate;
goto err_therm_pmu_init_pmupstate;
}
}
if(g->ops.clk.support_lpwr_pg) {
err = nvgpu_lpwr_pg_setup(g);
if (err != 0) {
goto err_perf_pmu_init_pmupstate;
goto err_therm_pmu_init_pmupstate;
}
}
return 0;
err_therm_pmu_init_pmupstate:
therm_pmu_free_pmupstate(g);
err_perf_pmu_init_pmupstate:
perf_pmu_free_pmupstate(g);
err_clk_init_pmupstate:

View File

@@ -53,3 +53,23 @@ u32 therm_domain_pmu_setup(struct gk20a *g)
{
return therm_send_pmgr_tables_to_pmu(g);
}
int therm_pmu_init_pmupstate(struct gk20a *g)
{
/* If already allocated, do not re-allocate */
if (g->therm_pmu != NULL) {
return 0;
}
g->therm_pmu = nvgpu_kzalloc(g, sizeof(*g->therm_pmu));
if (g->therm_pmu == NULL) {
return -ENOMEM;
}
return 0;
}
void therm_pmu_free_pmupstate(struct gk20a *g)
{
nvgpu_kfree(g, g->therm_pmu);
}

View File

@@ -27,6 +27,8 @@
#include "thrmdev.h"
#include "thrmchannel.h"
struct gk20a;
struct therm_pmupstate {
struct therm_devices therm_deviceobjs;
struct therm_channels therm_channelobjs;
@@ -34,5 +36,7 @@ struct therm_pmupstate {
int therm_domain_sw_setup(struct gk20a *g);
u32 therm_domain_pmu_setup(struct gk20a *g);
int therm_pmu_init_pmupstate(struct gk20a *g);
void therm_pmu_free_pmupstate(struct gk20a *g);
#endif /* NVGPU_THERM_THRM_H */

View File

@@ -28,6 +28,7 @@
#include <nvgpu/string.h>
#include "thrmchannel.h"
#include "thrm.h"
#include "gp106/bios_gp106.h"
static int _therm_channel_pmudatainit_device(struct gk20a *g,
@@ -222,7 +223,7 @@ int therm_channel_sw_setup(struct gk20a *g)
/* Construct the Super Class and override the Interfaces */
status = boardobjgrpconstruct_e32(g,
&g->therm_pmu.therm_channelobjs.super);
&g->therm_pmu->therm_channelobjs.super);
if (status != 0) {
nvgpu_err(g,
"error creating boardobjgrp for therm devices, status - 0x%x",
@@ -230,8 +231,8 @@ int therm_channel_sw_setup(struct gk20a *g)
goto done;
}
pboardobjgrp = &g->therm_pmu.therm_channelobjs.super.super;
pthermchannelobjs = &(g->therm_pmu.therm_channelobjs);
pboardobjgrp = &g->therm_pmu->therm_channelobjs.super.super;
pthermchannelobjs = &(g->therm_pmu->therm_channelobjs);
/* Override the Interfaces */
pboardobjgrp->pmudatainstget = _therm_channel_pmudata_instget;

View File

@@ -24,9 +24,12 @@
#ifndef NVGPU_THERM_THRMCHANNEL_H
#define NVGPU_THERM_THRMCHANNEL_H
#include <nvgpu/types.h>
#include <nvgpu/boardobj.h>
#include <nvgpu/boardobjgrp.h>
struct gk20a;
struct therm_channel {
struct boardobj super;
s16 scaling;

View File

@@ -29,6 +29,7 @@
#include <nvgpu/pmuif/ctrltherm.h>
#include "thrmdev.h"
#include "thrm.h"
#include "gp106/bios_gp106.h"
static int _therm_device_pmudata_instget(struct gk20a *g,
@@ -335,7 +336,7 @@ int therm_device_sw_setup(struct gk20a *g)
/* Construct the Super Class and override the Interfaces */
status = boardobjgrpconstruct_e32(g,
&g->therm_pmu.therm_deviceobjs.super);
&g->therm_pmu->therm_deviceobjs.super);
if (status != 0) {
nvgpu_err(g,
"error creating boardobjgrp for therm devices, status - 0x%x",
@@ -343,8 +344,8 @@ int therm_device_sw_setup(struct gk20a *g)
goto done;
}
pboardobjgrp = &g->therm_pmu.therm_deviceobjs.super.super;
pthermdeviceobjs = &(g->therm_pmu.therm_deviceobjs);
pboardobjgrp = &g->therm_pmu->therm_deviceobjs.super.super;
pthermdeviceobjs = &(g->therm_pmu->therm_deviceobjs);
/* Override the Interfaces */
pboardobjgrp->pmudatainstget = _therm_device_pmudata_instget;

View File

@@ -24,8 +24,12 @@
#ifndef NVGPU_THERM_THRMDEV_H
#define NVGPU_THERM_THRMDEV_H
#include <nvgpu/types.h>
#include <nvgpu/boardobj.h>
#include <nvgpu/boardobjgrp.h>
#include <nvgpu/boardobjgrp_e32.h>
struct gk20a;
struct therm_devices {
struct boardobjgrp_e32 super;

View File

@@ -24,6 +24,7 @@
#include <nvgpu/boardobjgrp_e32.h>
#include "thrmpmu.h"
#include "thrm.h"
#include <nvgpu/pmuif/nvgpu_gpmu_cmdif.h>
struct therm_pmucmdhandler_params {
@@ -56,8 +57,8 @@ int therm_send_pmgr_tables_to_pmu(struct gk20a *g)
int status = 0;
struct boardobjgrp *pboardobjgrp = NULL;
if (!BOARDOBJGRP_IS_EMPTY(&g->therm_pmu.therm_deviceobjs.super.super)) {
pboardobjgrp = &g->therm_pmu.therm_deviceobjs.super.super;
if (!BOARDOBJGRP_IS_EMPTY(&g->therm_pmu->therm_deviceobjs.super.super)) {
pboardobjgrp = &g->therm_pmu->therm_deviceobjs.super.super;
status = pboardobjgrp->pmuinithandle(g, pboardobjgrp);
if (status != 0) {
nvgpu_err(g,
@@ -68,8 +69,8 @@ int therm_send_pmgr_tables_to_pmu(struct gk20a *g)
}
if (!BOARDOBJGRP_IS_EMPTY(
&g->therm_pmu.therm_channelobjs.super.super)) {
pboardobjgrp = &g->therm_pmu.therm_channelobjs.super.super;
&g->therm_pmu->therm_channelobjs.super.super)) {
pboardobjgrp = &g->therm_pmu->therm_channelobjs.super.super;
status = pboardobjgrp->pmuinithandle(g, pboardobjgrp);
if (status != 0) {
nvgpu_err(g,

View File

@@ -24,6 +24,8 @@
#ifndef NVGPU_THERM_THRMPMU_H
#define NVGPU_THERM_THRMPMU_H
struct gk20a;
int therm_send_pmgr_tables_to_pmu(struct gk20a *g);
int therm_configure_therm_alert(struct gk20a *g);