RE: [PATCH v2] drm/amd/powerplay: enable power containment features for tonga.
> -Original Message- > From: amd-gfx [mailto:amd-gfx-boun...@lists.freedesktop.org] On Behalf > Of Rex Zhu > Sent: Wednesday, August 17, 2016 6:06 AM > To: amd-gfx@lists.freedesktop.org > Cc: Zhu, Rex > Subject: [PATCH v2] drm/amd/powerplay: enable power containment > features for tonga. > > v2: fix build error introduced when fix code style problems. > > Change-Id: Ifa9bdfd92fe060349cfbf7c10cd75d30d8acb95d > Signed-off-by: Rex Zhu <rex@amd.com> Reviewed-by: Alex Deucher <alexander.deuc...@amd.com> > --- > drivers/gpu/drm/amd/powerplay/hwmgr/Makefile | 2 +- > drivers/gpu/drm/amd/powerplay/hwmgr/tonga_hwmgr.c | 24 +- > drivers/gpu/drm/amd/powerplay/hwmgr/tonga_hwmgr.h | 11 +- > .../gpu/drm/amd/powerplay/hwmgr/tonga_powertune.c | 498 > + > .../gpu/drm/amd/powerplay/hwmgr/tonga_powertune.h | 22 +- > 5 files changed, 548 insertions(+), 9 deletions(-) > create mode 100644 > drivers/gpu/drm/amd/powerplay/hwmgr/tonga_powertune.c > > diff --git a/drivers/gpu/drm/amd/powerplay/hwmgr/Makefile > b/drivers/gpu/drm/amd/powerplay/hwmgr/Makefile > index f7ce4cb..80741cc 100644 > --- a/drivers/gpu/drm/amd/powerplay/hwmgr/Makefile > +++ b/drivers/gpu/drm/amd/powerplay/hwmgr/Makefile > @@ -4,7 +4,7 @@ > > HARDWARE_MGR = hwmgr.o processpptables.o functiontables.o \ > hardwaremanager.o pp_acpi.o cz_hwmgr.o \ > - cz_clockpowergating.o \ > + cz_clockpowergating.o tonga_powertune.o\ > tonga_processpptables.o ppatomctrl.o \ > tonga_hwmgr.o pppcielanes.o tonga_thermal.o\ > fiji_powertune.o fiji_hwmgr.o tonga_clockpowergating.o \ > diff --git a/drivers/gpu/drm/amd/powerplay/hwmgr/tonga_hwmgr.c > b/drivers/gpu/drm/amd/powerplay/hwmgr/tonga_hwmgr.c > index 072b3b6..f2793e8 100644 > --- a/drivers/gpu/drm/amd/powerplay/hwmgr/tonga_hwmgr.c > +++ b/drivers/gpu/drm/amd/powerplay/hwmgr/tonga_hwmgr.c > @@ -302,6 +302,8 @@ void tonga_initialize_dpm_defaults(struct pp_hwmgr > *hwmgr) > phm_cap_set(hwmgr->platform_descriptor.platformCaps, > PHM_PlatformCaps_DisableMemoryTransition); > > + tonga_initialize_power_tune_defaults(hwmgr); > + > data->mclk_strobe_mode_threshold = 4; > data->mclk_stutter_mode_threshold = 3; > data->mclk_edc_enable_threshold = 4; > @@ -2477,7 +2479,7 @@ static int > tonga_populate_single_graphic_level(struct pp_hwmgr *hwmgr, uint32_t > graphic_level->VoltageDownHyst = 0; > graphic_level->PowerThrottle = 0; > > - threshold = engine_clock * data->fast_watemark_threshold / 100; > + threshold = engine_clock * data->fast_watermark_threshold / 100; > /* > *get the DAL clock. do it in funture. > PECI_GetMinClockSettings(hwmgr->peci, ); > @@ -2980,6 +2982,10 @@ int tonga_init_smc_table(struct pp_hwmgr > *hwmgr) > PP_ASSERT_WITH_CODE(0 == result, > "Failed to initialize Boot Level!", return result;); > > + result = tonga_populate_bapm_parameters_in_dpm_table(hwmgr); > + PP_ASSERT_WITH_CODE(result == 0, > + "Failed to populate BAPM Parameters!", return > result); > + > if (phm_cap_enabled(hwmgr->platform_descriptor.platformCaps, > PHM_PlatformCaps_ClockStretcher)) { > result = > tonga_populate_clock_stretcher_data_table(hwmgr); > @@ -4368,6 +4374,10 @@ int tonga_enable_dpm_tasks(struct pp_hwmgr > *hwmgr) > PP_ASSERT_WITH_CODE((0 == tmp_result), > "Failed to initialize ARB table index!", result = tmp_result); > > + tmp_result = tonga_populate_pm_fuses(hwmgr); > + PP_ASSERT_WITH_CODE((tmp_result == 0), > + "Failed to populate PM fuses!", result = tmp_result); > + > tmp_result = tonga_populate_initial_mc_reg_table(hwmgr); > PP_ASSERT_WITH_CODE((0 == tmp_result), > "Failed to populate initialize MC Reg table!", result = > tmp_result); > @@ -4386,6 +4396,18 @@ int tonga_enable_dpm_tasks(struct pp_hwmgr > *hwmgr) > PP_ASSERT_WITH_CODE((0 == tmp_result), > "Failed to start DPM!", result = tmp_result); > > + tmp_result = tonga_enable_smc_cac(hwmgr); > + PP_ASSERT_WITH_CODE((tmp_result == 0), > + "Failed to enable SMC CAC!", result = tmp_result); > + > + tmp_result = tonga_enable_power_containment(hwmgr); > + PP_ASSERT_WITH_CODE((tmp_result == 0), > + "Failed to enable power containment!", result = > tmp_result); > + &
[PATCH v2] drm/amd/powerplay: enable power containment features for tonga.
v2: fix build error introduced when fix code style problems. Change-Id: Ifa9bdfd92fe060349cfbf7c10cd75d30d8acb95d Signed-off-by: Rex Zhu--- drivers/gpu/drm/amd/powerplay/hwmgr/Makefile | 2 +- drivers/gpu/drm/amd/powerplay/hwmgr/tonga_hwmgr.c | 24 +- drivers/gpu/drm/amd/powerplay/hwmgr/tonga_hwmgr.h | 11 +- .../gpu/drm/amd/powerplay/hwmgr/tonga_powertune.c | 498 + .../gpu/drm/amd/powerplay/hwmgr/tonga_powertune.h | 22 +- 5 files changed, 548 insertions(+), 9 deletions(-) create mode 100644 drivers/gpu/drm/amd/powerplay/hwmgr/tonga_powertune.c diff --git a/drivers/gpu/drm/amd/powerplay/hwmgr/Makefile b/drivers/gpu/drm/amd/powerplay/hwmgr/Makefile index f7ce4cb..80741cc 100644 --- a/drivers/gpu/drm/amd/powerplay/hwmgr/Makefile +++ b/drivers/gpu/drm/amd/powerplay/hwmgr/Makefile @@ -4,7 +4,7 @@ HARDWARE_MGR = hwmgr.o processpptables.o functiontables.o \ hardwaremanager.o pp_acpi.o cz_hwmgr.o \ - cz_clockpowergating.o \ + cz_clockpowergating.o tonga_powertune.o\ tonga_processpptables.o ppatomctrl.o \ tonga_hwmgr.o pppcielanes.o tonga_thermal.o\ fiji_powertune.o fiji_hwmgr.o tonga_clockpowergating.o \ diff --git a/drivers/gpu/drm/amd/powerplay/hwmgr/tonga_hwmgr.c b/drivers/gpu/drm/amd/powerplay/hwmgr/tonga_hwmgr.c index 072b3b6..f2793e8 100644 --- a/drivers/gpu/drm/amd/powerplay/hwmgr/tonga_hwmgr.c +++ b/drivers/gpu/drm/amd/powerplay/hwmgr/tonga_hwmgr.c @@ -302,6 +302,8 @@ void tonga_initialize_dpm_defaults(struct pp_hwmgr *hwmgr) phm_cap_set(hwmgr->platform_descriptor.platformCaps, PHM_PlatformCaps_DisableMemoryTransition); + tonga_initialize_power_tune_defaults(hwmgr); + data->mclk_strobe_mode_threshold = 4; data->mclk_stutter_mode_threshold = 3; data->mclk_edc_enable_threshold = 4; @@ -2477,7 +2479,7 @@ static int tonga_populate_single_graphic_level(struct pp_hwmgr *hwmgr, uint32_t graphic_level->VoltageDownHyst = 0; graphic_level->PowerThrottle = 0; - threshold = engine_clock * data->fast_watemark_threshold / 100; + threshold = engine_clock * data->fast_watermark_threshold / 100; /* *get the DAL clock. do it in funture. PECI_GetMinClockSettings(hwmgr->peci, ); @@ -2980,6 +2982,10 @@ int tonga_init_smc_table(struct pp_hwmgr *hwmgr) PP_ASSERT_WITH_CODE(0 == result, "Failed to initialize Boot Level!", return result;); + result = tonga_populate_bapm_parameters_in_dpm_table(hwmgr); + PP_ASSERT_WITH_CODE(result == 0, + "Failed to populate BAPM Parameters!", return result); + if (phm_cap_enabled(hwmgr->platform_descriptor.platformCaps, PHM_PlatformCaps_ClockStretcher)) { result = tonga_populate_clock_stretcher_data_table(hwmgr); @@ -4368,6 +4374,10 @@ int tonga_enable_dpm_tasks(struct pp_hwmgr *hwmgr) PP_ASSERT_WITH_CODE((0 == tmp_result), "Failed to initialize ARB table index!", result = tmp_result); + tmp_result = tonga_populate_pm_fuses(hwmgr); + PP_ASSERT_WITH_CODE((tmp_result == 0), + "Failed to populate PM fuses!", result = tmp_result); + tmp_result = tonga_populate_initial_mc_reg_table(hwmgr); PP_ASSERT_WITH_CODE((0 == tmp_result), "Failed to populate initialize MC Reg table!", result = tmp_result); @@ -4386,6 +4396,18 @@ int tonga_enable_dpm_tasks(struct pp_hwmgr *hwmgr) PP_ASSERT_WITH_CODE((0 == tmp_result), "Failed to start DPM!", result = tmp_result); + tmp_result = tonga_enable_smc_cac(hwmgr); + PP_ASSERT_WITH_CODE((tmp_result == 0), + "Failed to enable SMC CAC!", result = tmp_result); + + tmp_result = tonga_enable_power_containment(hwmgr); + PP_ASSERT_WITH_CODE((tmp_result == 0), + "Failed to enable power containment!", result = tmp_result); + + tmp_result = tonga_power_control_set_level(hwmgr); + PP_ASSERT_WITH_CODE((tmp_result == 0), + "Failed to power control set level!", result = tmp_result); + return result; } diff --git a/drivers/gpu/drm/amd/powerplay/hwmgr/tonga_hwmgr.h b/drivers/gpu/drm/amd/powerplay/hwmgr/tonga_hwmgr.h index 3961884..fcad942 100644 --- a/drivers/gpu/drm/amd/powerplay/hwmgr/tonga_hwmgr.h +++ b/drivers/gpu/drm/amd/powerplay/hwmgr/tonga_hwmgr.h @@ -300,6 +300,7 @@ struct tonga_hwmgr { bool dll_defaule_on; bool performance_request_registered; + /* - Low Power Features -*/ phw_tonga_bacos bacos; phw_tonga_ulv_parm ulv; @@ -314,10 +315,14 @@ struct tonga_hwmgr { bool