Commit af223dfa authored by Rex Zhu's avatar Rex Zhu Committed by Alex Deucher

drm/amdgpu: add module parameters to ctrl powerplay feature

Signed-off-by: default avatarRex Zhu <Rex.Zhu@amd.com>
Reviewed-by: default avatarAlex Deucher <alexander.deucher@amd.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent a94cbfc3
...@@ -84,6 +84,7 @@ int amdgpu_sched_jobs = 32; ...@@ -84,6 +84,7 @@ int amdgpu_sched_jobs = 32;
int amdgpu_sched_hw_submission = 2; int amdgpu_sched_hw_submission = 2;
int amdgpu_powerplay = -1; int amdgpu_powerplay = -1;
int amdgpu_powercontainment = 1; int amdgpu_powercontainment = 1;
int amdgpu_sclk_deep_sleep_en = 1;
unsigned amdgpu_pcie_gen_cap = 0; unsigned amdgpu_pcie_gen_cap = 0;
unsigned amdgpu_pcie_lane_cap = 0; unsigned amdgpu_pcie_lane_cap = 0;
unsigned amdgpu_cg_mask = 0xffffffff; unsigned amdgpu_cg_mask = 0xffffffff;
...@@ -170,6 +171,9 @@ MODULE_PARM_DESC(powercontainment, "Power Containment (1 = enable (default), 0 = ...@@ -170,6 +171,9 @@ MODULE_PARM_DESC(powercontainment, "Power Containment (1 = enable (default), 0 =
module_param_named(powercontainment, amdgpu_powercontainment, int, 0444); module_param_named(powercontainment, amdgpu_powercontainment, int, 0444);
#endif #endif
MODULE_PARM_DESC(sclkdeepsleep, "SCLK Deep Sleep (1 = enable (default), 0 = disable)");
module_param_named(sclkdeepsleep, amdgpu_sclk_deep_sleep_en, int, 0444);
MODULE_PARM_DESC(pcie_gen_cap, "PCIE Gen Caps (0: autodetect (default))"); MODULE_PARM_DESC(pcie_gen_cap, "PCIE Gen Caps (0: autodetect (default))");
module_param_named(pcie_gen_cap, amdgpu_pcie_gen_cap, uint, 0444); module_param_named(pcie_gen_cap, amdgpu_pcie_gen_cap, uint, 0444);
......
...@@ -52,7 +52,6 @@ static int amdgpu_powerplay_init(struct amdgpu_device *adev) ...@@ -52,7 +52,6 @@ static int amdgpu_powerplay_init(struct amdgpu_device *adev)
pp_init->chip_family = adev->family; pp_init->chip_family = adev->family;
pp_init->chip_id = adev->asic_type; pp_init->chip_id = adev->asic_type;
pp_init->device = amdgpu_cgs_create_device(adev); pp_init->device = amdgpu_cgs_create_device(adev);
pp_init->powercontainment_enabled = amdgpu_powercontainment;
ret = amd_powerplay_init(pp_init, amd_pp); ret = amd_powerplay_init(pp_init, amd_pp);
kfree(pp_init); kfree(pp_init);
......
...@@ -31,6 +31,7 @@ ...@@ -31,6 +31,7 @@
#include "eventmanager.h" #include "eventmanager.h"
#include "pp_debug.h" #include "pp_debug.h"
#define PP_CHECK(handle) \ #define PP_CHECK(handle) \
do { \ do { \
if ((handle) == NULL || (handle)->pp_valid != PP_VALID) \ if ((handle) == NULL || (handle)->pp_valid != PP_VALID) \
......
...@@ -619,9 +619,6 @@ static int fiji_hwmgr_backend_init(struct pp_hwmgr *hwmgr) ...@@ -619,9 +619,6 @@ static int fiji_hwmgr_backend_init(struct pp_hwmgr *hwmgr)
phm_cap_set(hwmgr->platform_descriptor.platformCaps, phm_cap_set(hwmgr->platform_descriptor.platformCaps,
PHM_PlatformCaps_TablelessHardwareInterface); PHM_PlatformCaps_TablelessHardwareInterface);
phm_cap_set(hwmgr->platform_descriptor.platformCaps,
PHM_PlatformCaps_SclkDeepSleep);
data->gpio_debug = 0; data->gpio_debug = 0;
phm_cap_set(hwmgr->platform_descriptor.platformCaps, phm_cap_set(hwmgr->platform_descriptor.platformCaps,
......
...@@ -77,9 +77,8 @@ void fiji_initialize_power_tune_defaults(struct pp_hwmgr *hwmgr) ...@@ -77,9 +77,8 @@ void fiji_initialize_power_tune_defaults(struct pp_hwmgr *hwmgr)
fiji_hwmgr->fast_watermark_threshold = 100; fiji_hwmgr->fast_watermark_threshold = 100;
if (hwmgr->powercontainment_enabled) { if (phm_cap_enabled(hwmgr->platform_descriptor.platformCaps,
phm_cap_set(hwmgr->platform_descriptor.platformCaps, PHM_PlatformCaps_PowerContainment)) {
PHM_PlatformCaps_PowerContainment);
tmp = 1; tmp = 1;
fiji_hwmgr->enable_dte_feature = tmp ? false : true; fiji_hwmgr->enable_dte_feature = tmp ? false : true;
fiji_hwmgr->enable_tdc_limit_feature = tmp ? true : false; fiji_hwmgr->enable_tdc_limit_feature = tmp ? true : false;
......
...@@ -41,6 +41,25 @@ extern int fiji_hwmgr_init(struct pp_hwmgr *hwmgr); ...@@ -41,6 +41,25 @@ extern int fiji_hwmgr_init(struct pp_hwmgr *hwmgr);
extern int polaris10_hwmgr_init(struct pp_hwmgr *hwmgr); extern int polaris10_hwmgr_init(struct pp_hwmgr *hwmgr);
extern int iceland_hwmgr_init(struct pp_hwmgr *hwmgr); extern int iceland_hwmgr_init(struct pp_hwmgr *hwmgr);
static int hwmgr_set_features_platform_caps(struct pp_hwmgr *hwmgr)
{
if (amdgpu_sclk_deep_sleep_en)
phm_cap_set(hwmgr->platform_descriptor.platformCaps,
PHM_PlatformCaps_SclkDeepSleep);
else
phm_cap_unset(hwmgr->platform_descriptor.platformCaps,
PHM_PlatformCaps_SclkDeepSleep);
if (amdgpu_powercontainment)
phm_cap_set(hwmgr->platform_descriptor.platformCaps,
PHM_PlatformCaps_PowerContainment);
else
phm_cap_unset(hwmgr->platform_descriptor.platformCaps,
PHM_PlatformCaps_PowerContainment);
return 0;
}
int hwmgr_init(struct amd_pp_init *pp_init, struct pp_instance *handle) int hwmgr_init(struct amd_pp_init *pp_init, struct pp_instance *handle)
{ {
struct pp_hwmgr *hwmgr; struct pp_hwmgr *hwmgr;
...@@ -60,7 +79,8 @@ int hwmgr_init(struct amd_pp_init *pp_init, struct pp_instance *handle) ...@@ -60,7 +79,8 @@ int hwmgr_init(struct amd_pp_init *pp_init, struct pp_instance *handle)
hwmgr->hw_revision = pp_init->rev_id; hwmgr->hw_revision = pp_init->rev_id;
hwmgr->usec_timeout = AMD_MAX_USEC_TIMEOUT; hwmgr->usec_timeout = AMD_MAX_USEC_TIMEOUT;
hwmgr->power_source = PP_PowerSource_AC; hwmgr->power_source = PP_PowerSource_AC;
hwmgr->powercontainment_enabled = pp_init->powercontainment_enabled;
hwmgr_set_features_platform_caps(hwmgr);
switch (hwmgr->chip_family) { switch (hwmgr->chip_family) {
case AMDGPU_FAMILY_CZ: case AMDGPU_FAMILY_CZ:
......
...@@ -137,9 +137,8 @@ void iceland_initialize_power_tune_defaults(struct pp_hwmgr *hwmgr) ...@@ -137,9 +137,8 @@ void iceland_initialize_power_tune_defaults(struct pp_hwmgr *hwmgr)
data->fast_watermark_threshold = 100; data->fast_watermark_threshold = 100;
if (hwmgr->powercontainment_enabled) { if (phm_cap_enabled(hwmgr->platform_descriptor.platformCaps,
phm_cap_set(hwmgr->platform_descriptor.platformCaps, PHM_PlatformCaps_PowerContainment)) {
PHM_PlatformCaps_PowerContainment);
tmp = 1; tmp = 1;
data->enable_dte_feature = tmp ? false : true; data->enable_dte_feature = tmp ? false : true;
data->enable_tdc_limit_feature = tmp ? true : false; data->enable_tdc_limit_feature = tmp ? true : false;
......
...@@ -2772,9 +2772,6 @@ int polaris10_set_features_platform_caps(struct pp_hwmgr *hwmgr) ...@@ -2772,9 +2772,6 @@ int polaris10_set_features_platform_caps(struct pp_hwmgr *hwmgr)
{ {
struct polaris10_hwmgr *data = (struct polaris10_hwmgr *)(hwmgr->backend); struct polaris10_hwmgr *data = (struct polaris10_hwmgr *)(hwmgr->backend);
phm_cap_set(hwmgr->platform_descriptor.platformCaps,
PHM_PlatformCaps_SclkDeepSleep);
phm_cap_set(hwmgr->platform_descriptor.platformCaps, phm_cap_set(hwmgr->platform_descriptor.platformCaps,
PHM_PlatformCaps_DynamicPatchPowerState); PHM_PlatformCaps_DynamicPatchPowerState);
...@@ -2820,13 +2817,6 @@ int polaris10_set_features_platform_caps(struct pp_hwmgr *hwmgr) ...@@ -2820,13 +2817,6 @@ int polaris10_set_features_platform_caps(struct pp_hwmgr *hwmgr)
phm_cap_set(hwmgr->platform_descriptor.platformCaps, phm_cap_set(hwmgr->platform_descriptor.platformCaps,
PHM_PlatformCaps_TCPRamping); PHM_PlatformCaps_TCPRamping);
if (hwmgr->powercontainment_enabled)
phm_cap_set(hwmgr->platform_descriptor.platformCaps,
PHM_PlatformCaps_PowerContainment);
else
phm_cap_unset(hwmgr->platform_descriptor.platformCaps,
PHM_PlatformCaps_PowerContainment);
phm_cap_set(hwmgr->platform_descriptor.platformCaps, phm_cap_set(hwmgr->platform_descriptor.platformCaps,
PHM_PlatformCaps_CAC); PHM_PlatformCaps_CAC);
......
...@@ -132,8 +132,8 @@ struct amd_pp_init { ...@@ -132,8 +132,8 @@ struct amd_pp_init {
uint32_t chip_family; uint32_t chip_family;
uint32_t chip_id; uint32_t chip_id;
uint32_t rev_id; uint32_t rev_id;
bool powercontainment_enabled;
}; };
enum amd_pp_display_config_type{ enum amd_pp_display_config_type{
AMD_PP_DisplayConfigType_None = 0, AMD_PP_DisplayConfigType_None = 0,
AMD_PP_DisplayConfigType_DP54 , AMD_PP_DisplayConfigType_DP54 ,
......
...@@ -41,6 +41,9 @@ struct phm_fan_speed_info; ...@@ -41,6 +41,9 @@ struct phm_fan_speed_info;
struct pp_atomctrl_voltage_table; struct pp_atomctrl_voltage_table;
extern int amdgpu_powercontainment;
extern int amdgpu_sclk_deep_sleep_en;
enum DISPLAY_GAP { enum DISPLAY_GAP {
DISPLAY_GAP_VBLANK_OR_WM = 0, /* Wait for vblank or MCHG watermark. */ DISPLAY_GAP_VBLANK_OR_WM = 0, /* Wait for vblank or MCHG watermark. */
DISPLAY_GAP_VBLANK = 1, /* Wait for vblank. */ DISPLAY_GAP_VBLANK = 1, /* Wait for vblank. */
...@@ -614,7 +617,6 @@ struct pp_hwmgr { ...@@ -614,7 +617,6 @@ struct pp_hwmgr {
uint32_t num_ps; uint32_t num_ps;
struct pp_thermal_controller_info thermal_controller; struct pp_thermal_controller_info thermal_controller;
bool fan_ctrl_is_in_default_mode; bool fan_ctrl_is_in_default_mode;
bool powercontainment_enabled;
uint32_t fan_ctrl_default_mode; uint32_t fan_ctrl_default_mode;
uint32_t tmin; uint32_t tmin;
struct phm_microcode_version_info microcode_version_info; struct phm_microcode_version_info microcode_version_info;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment