drm/amd/powerplay: add limit of pp_feature for smu (v2)
Subsystems (2)
PATCH v2 1/1 drm/amd/powerplay: add limit of pp_feature for smu (v2)
From: Likun Gao <[email protected]>
Move pp_feature from the struct of amd_powerplay to amdgpu_device. Add pp_feature limit for overdrive interface.
v2: put pp_feature into struct amdgpu_pm.
--- drivers/gpu/drm/amd/amdgpu/amdgpu.h | 1 - drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 2 +- drivers/gpu/drm/amd/amdgpu/amdgpu_dpm.h | 3 +++ drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c | 2 +- drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c | 6 ++++-- drivers/gpu/drm/amd/amdgpu/ci_dpm.c | 2 +- drivers/gpu/drm/amd/amdgpu/kv_dpm.c | 2 +- drivers/gpu/drm/amd/amdgpu/soc15.c | 2 +- drivers/gpu/drm/amd/powerplay/amd_powerplay.c | 2 +- drivers/gpu/drm/amd/powerplay/amdgpu_smu.c | 4 ++++ drivers/gpu/drm/amd/powerplay/inc/amdgpu_smu.h | 3 +++ 11 files changed, 20 insertions(+), 9 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu.h +0 -1
@@ -704,7 +704,6 @@ enum amd_hw_ip_block_type {struct amd_powerplay {void *pp_handle;const struct amd_pm_funcs *pp_funcs; -uint32_t pp_feature; };#define AMDGPU_RESET_MAGIC_NUM 64
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +1 -1
@@ -1506,7 +1506,7 @@ static int amdgpu_device_ip_early_init(struct amdgpu_device *adev)return -EAGAIN ; } - adev->powerplay.pp_feature = amdgpu_pp_feature_mask; + adev->pm.pp_feature = amdgpu_pp_feature_mask;for (i =0 ; i < adev->num_ip_blocks; i++) {if ((amdgpu_ip_block_mask & (1 << i)) ==0 ) {
drivers/gpu/drm/amd/amdgpu/amdgpu_dpm.h +3 -0
@@ -445,6 +445,9 @@ struct amdgpu_pm {uint32_t smu_prv_buffer_size;struct amdgpu_bo *smu_prv_buffer;bool ac_power; +/* powerplay feature */ +uint32_t pp_feature; + };#define R600_SSTU_DFLT 0
drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c +1 -1
@@ -390,7 +390,7 @@ void amdgpu_gfx_compute_mqd_sw_fini(struct amdgpu_device *adev)void amdgpu_gfx_off_ctrl (struct amdgpu_device *adev,bool enable) { -if (!(adev->powerplay.pp_feature &PP_GFXOFF_MASK )) +if (!(adev->pm.pp_feature &PP_GFXOFF_MASK ))return ;if (!adev->powerplay.pp_funcs || !adev->powerplay.pp_funcs->set_powergating_by_smu)
drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c +4 -2
@@ -2557,7 +2557,8 @@ int amdgpu_pm_sysfs_init(struct amdgpu_device *adev) "pp_power_profile_mode\n");return ret; } -if (is_support_sw_smu (adev) || hwmgr->od_enabled) { +if ((is_support_sw_smu (adev) && adev->smu.od_enabled) || + (!is_support_sw_smu (adev) && hwmgr->od_enabled)) { ret =device_create_file (adev->dev, &dev_attr_pp_od_clk_voltage);if (ret) {
@@ -2633,7 +2634,8 @@ void amdgpu_pm_sysfs_fini(struct amdgpu_device *adev)device_remove_file (adev->dev, &dev_attr_pp_mclk_od);device_remove_file (adev->dev, &dev_attr_pp_power_profile_mode); -if (hwmgr->od_enabled) +if ((is_support_sw_smu (adev) && adev->smu.od_enabled) || + (!is_support_sw_smu (adev) && hwmgr->od_enabled))device_remove_file (adev->dev, &dev_attr_pp_od_clk_voltage);device_remove_file (adev->dev, &dev_attr_gpu_busy_percent);
drivers/gpu/drm/amd/amdgpu/ci_dpm.c +1 -1
@@ -5903,7 +5903,7 @@ static int ci_dpm_init(struct amdgpu_device *adev) pi->pcie_dpm_key_disabled =0 ; pi->thermal_sclk_dpm_enabled =0 ; -if (adev->powerplay.pp_feature &PP_SCLK_DEEP_SLEEP_MASK ) +if (adev->pm.pp_feature &PP_SCLK_DEEP_SLEEP_MASK ) pi->caps_sclk_ds = true;else pi->caps_sclk_ds = false;
drivers/gpu/drm/amd/amdgpu/kv_dpm.c +1 -1
@@ -2824,7 +2824,7 @@ static int kv_dpm_init(struct amdgpu_device *adev) pi->caps_tcp_ramping = true; } -if (adev->powerplay.pp_feature &PP_SCLK_DEEP_SLEEP_MASK ) +if (adev->pm.pp_feature &PP_SCLK_DEEP_SLEEP_MASK ) pi->caps_sclk_ds = true;else pi->caps_sclk_ds = false;
drivers/gpu/drm/amd/amdgpu/soc15.c +1 -1
@@ -931,7 +931,7 @@ static int soc15_common_early_init(void *handle) adev->pg_flags =AMD_PG_SUPPORT_SDMA |AMD_PG_SUPPORT_VCN ; } -if (adev->powerplay.pp_feature &PP_GFXOFF_MASK ) +if (adev->pm.pp_feature &PP_GFXOFF_MASK ) adev->pg_flags |=AMD_PG_SUPPORT_GFX_PG |AMD_PG_SUPPORT_CP |AMD_PG_SUPPORT_RLC_SMU_HS ;
drivers/gpu/drm/amd/powerplay/amd_powerplay.c +1 -1
@@ -53,7 +53,7 @@ static int amd_powerplay_create(struct amdgpu_device *adev)mutex_init (&hwmgr->smu_lock); hwmgr->chip_family = adev->family; hwmgr->chip_id = adev->asic_type; - hwmgr->feature_mask = adev->powerplay.pp_feature; + hwmgr->feature_mask = adev->pm.pp_feature; hwmgr->display_config = &adev->pm.pm_display_cfg; adev->powerplay.pp_handle = hwmgr; adev->powerplay.pp_funcs = &pp_dpm_funcs;
drivers/gpu/drm/amd/powerplay/amdgpu_smu.c +4 -0
@@ -282,6 +282,9 @@ static int smu_set_funcs(struct amdgpu_device *adev)switch (adev->asic_type) {case CHIP_VEGA20 : + smu->feature_mask &= ~PP_GFXOFF_MASK ; +if (smu->feature_mask &PP_OVERDRIVE_MASK ) + smu->od_enabled = true;smu_v11_0_set_smu_funcs (smu);break ;default :
@@ -298,6 +301,7 @@ static int smu_early_init(void *handle) smu->adev = adev;mutex_init (&smu->mutex); + smu->feature_mask = adev->pm.pp_feature;return smu_set_funcs (adev); }
drivers/gpu/drm/amd/powerplay/inc/amdgpu_smu.h +3 -0
@@ -384,6 +384,7 @@ struct smu_contextuint32_t pstate_sclk;uint32_t pstate_mclk; +bool od_enabled;uint32_t power_limit;uint32_t default_power_limit;
@@ -399,6 +400,8 @@ struct smu_contextuint32_t workload_setting[WORKLOAD_POLICY_MAX ];uint32_t power_profile_mode;uint32_t default_power_profile_mode; + +uint32_t feature_mask; };struct pptable_funcs {
Signature · 6 lines
2.7.4 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
A message that is not in the archive (sent off-list or not yet received): 1551168913-17088-1-git-send-email-likun.gao-5C7GfCeVMHo@public.gmane.org
Quoted 183 lines
-----Original Message-----
From: amd-gfx [mailto:[email protected]] On Behalf Of likun Gao
Sent: Tuesday, February 26, 2019 4:15 PM
To: [email protected]
Cc: Deucher, Alexander <[email protected]>; Gao, Likun <[email protected]>; Huang, Ray <[email protected]>
Subject: [PATCH v2] drm/amd/powerplay: add limit ofpp_featurefor smu (v2)From: Likun Gao <[email protected]>
Move
pp_featurefrom the struct ofamd_powerplaytoamdgpu_device. Addpp_featurelimit for overdrive interface.v2: put
pp_featureinto structamdgpu_pm.Signed-off-by Likun Gao <[email protected]>Reviewed-by Kevin Wang <[email protected]>Suggested-by Alex Deucher <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu.h | 1 - drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 2 +- drivers/gpu/drm/amd/amdgpu/amdgpu_dpm.h | 3 +++ drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c | 2 +- drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c | 6 ++++-- drivers/gpu/drm/amd/amdgpu/ci_dpm.c | 2 +- drivers/gpu/drm/amd/amdgpu/kv_dpm.c | 2 +- drivers/gpu/drm/amd/amdgpu/soc15.c | 2 +- drivers/gpu/drm/amd/powerplay/amd_powerplay.c | 2 +- drivers/gpu/drm/amd/powerplay/amdgpu_smu.c | 4 ++++ drivers/gpu/drm/amd/powerplay/inc/amdgpu_smu.h | 3 +++ 11 files changed, 20 insertions(+), 9 deletions(-)drivers/gpu/drm/amd/amdgpu/amdgpu.h +0
-1@@ -704,7 +704,6 @@ enum amd_hw_ip_block_type { struct amd_powerplay {void *pp_handle;const struct amd_pm_funcs *pp_funcs; -uint32_t pp_feature; };#define AMDGPU_RESET_MAGIC_NUM 64drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +1
-1@@ -1506,7 +1506,7 @@ static int amdgpu_device_ip_early_init(struct amdgpu_device *adev)return -EAGAIN ; } - adev->powerplay.pp_feature = amdgpu_pp_feature_mask; + adev->pm.pp_feature = amdgpu_pp_feature_mask;for (i =0 ; i < adev->num_ip_blocks; i++) {if ((
amdgpu_ip_block_mask& (1 << i)) == 0) { diff --gita/drivers/gpu/drm/amd/amdgpu/amdgpu_dpm.hb/drivers/gpu/drm/amd/amdgpu/amdgpu_dpm.h
index 2278489..077d710 100644drivers/gpu/drm/amd/amdgpu/amdgpu_dpm.h +3
-0@@ -445,6 +445,9 @@ struct amdgpu_pm {uint32_t smu_prv_buffer_size;struct amdgpu_bo *smu_prv_buffer;bool ac_power; +/* powerplay feature */ +uint32_t pp_feature; + };#define R600_SSTU_DFLT 0drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c +1
-1@@ -390,7 +390,7 @@ void amdgpu_gfx_compute_mqd_sw_fini(struct amdgpu_device *adev) void amdgpu_gfx_off_ctrl(struct amdgpu_device *adev, bool enable) { - if (!(adev->powerplay.pp_feature & PP_GFXOFF_MASK)) + if (!(adev->pm.pp_feature & PP_GFXOFF_MASK)) return; if (!adev->powerplay.pp_funcs || !adev->powerplay.pp_funcs-Quoted 1 line
set_powergating_by_smu)drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c +2
-1@@ -2557,7 +2557,8 @@ int amdgpu_pm_sysfs_init(struct amdgpu_device *adev) "pp_power_profile_mode\n");return ret; } -if (is_support_sw_smu (adev) || hwmgr->od_enabled) { +if ((is_support_sw_smu (adev) && adev->smu.od_enabled) || + (!is_support_sw_smu (adev) && hwmgr->od_enabled)) { ret =device_create_file (adev->dev, &dev_attr_pp_od_clk_voltage);drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c +2
-1if (ret) {@@ -2633,7 +2634,8 @@ void amdgpu_pm_sysfs_fini(struct amdgpu_device *adev)device_remove_file (adev->dev, &dev_attr_pp_mclk_od);device_remove_file (adev->dev, &dev_attr_pp_power_profile_mode); -if (hwmgr->od_enabled) +if ((is_support_sw_smu (adev) && adev->smu.od_enabled) || + (!is_support_sw_smu (adev) && hwmgr->od_enabled))device_remove_file (adev->dev, &dev_attr_pp_od_clk_voltage);
device_remove_file(adev->dev, &dev_attr_gpu_busy_percent); diff
--gita/drivers/gpu/drm/amd/amdgpu/ci_dpm.cb/drivers/gpu/drm/amd/amdgpu/ci_dpm.c
index 86e14c7..9ae65bf 100644drivers/gpu/drm/amd/amdgpu/ci_dpm.c +1
-1@@ -5903,7 +5903,7 @@ static int ci_dpm_init(struct amdgpu_device *adev) pi->pcie_dpm_key_disabled =0 ; pi->thermal_sclk_dpm_enabled =0 ; -if (adev->powerplay.pp_feature &PP_SCLK_DEEP_SLEEP_MASK ) +if (adev->pm.pp_feature &PP_SCLK_DEEP_SLEEP_MASK ) pi->caps_sclk_ds = true;else pi->caps_sclk_ds = false;drivers/gpu/drm/amd/amdgpu/kv_dpm.c +1
-1@@ -2824,7 +2824,7 @@ static int kv_dpm_init(struct amdgpu_device *adev) pi->caps_tcp_ramping = true; } -if (adev->powerplay.pp_feature &PP_SCLK_DEEP_SLEEP_MASK ) +if (adev->pm.pp_feature &PP_SCLK_DEEP_SLEEP_MASK ) pi->caps_sclk_ds = true;else pi->caps_sclk_ds = false;drivers/gpu/drm/amd/amdgpu/soc15.c +1
-1@@ -931,7 +931,7 @@ static int soc15_common_early_init(void *handle) adev->pg_flags =AMD_PG_SUPPORT_SDMA |AMD_PG_SUPPORT_VCN ; } -if (adev->powerplay.pp_feature &PP_GFXOFF_MASK ) +if (adev->pm.pp_feature &PP_GFXOFF_MASK ) adev->pg_flags |=AMD_PG_SUPPORT_GFX_PG | AMD_PG_SUPPORT_CP |drivers/gpu/drm/amd/amdgpu/soc15.c +0
-0AMD_PG_SUPPORT_RLC_SMU_HS ;drivers/gpu/drm/amd/powerplay/amd_powerplay.c +1
-1@@ -53,7 +53,7 @@ static int amd_powerplay_create(struct amdgpu_device *adev)mutex_init (&hwmgr->smu_lock); hwmgr->chip_family = adev->family; hwmgr->chip_id = adev->asic_type; - hwmgr->feature_mask = adev->powerplay.pp_feature; + hwmgr->feature_mask = adev->pm.pp_feature; hwmgr->display_config = &adev->pm.pm_display_cfg; adev->powerplay.pp_handle = hwmgr;
adev->powerplay.pp_funcs=&pp_dpm_funcs; diff --gita/drivers/gpu/drm/amd/powerplay/amdgpu_smu.cb/drivers/gpu/drm/amd/powerplay/amdgpu_smu.c
index 792c3e1..a6bbac9 100644
drivers/gpu/drm/amd/powerplay/amdgpu_smu.c static int smu_set_funcs(struct amdgpu_device · line 288
Quoted 7 lines
drivers/gpu/drm/amd/powerplay/amdgpu_smu.c +3
-0@@ -282,6 +282,9 @@ static int smu_set_funcs(struct amdgpu_device *adev)switch (adev->asic_type) {case CHIP_VEGA20 : + smu->feature_mask &= ~PP_GFXOFF_MASK ; +if (smu->feature_mask &PP_OVERDRIVE_MASK ) + smu->od_enabled = true;
Do we still add feature_mask in smu_context structure? How about using adev->pm.pp_feature directly here?
Thanks,
Ray
Quoted 36 lines
drivers/gpu/drm/amd/powerplay/amdgpu_smu.c +0
-0smu_v11_0_set_smu_funcs (smu);break ;drivers/gpu/drm/amd/powerplay/amdgpu_smu.c +1
-0default :@@ -298,6 +301,7 @@ static int smu_early_init(void *handle) smu->adev = adev;mutex_init (&smu->mutex); + smu->feature_mask = adev->pm.pp_feature;return smu_set_funcs (adev); }drivers/gpu/drm/amd/powerplay/inc/amdgpu_smu.h +3
-1@@ -384,6 +384,7 @@ struct smu_contextuint32_t pstate_sclk;uint32_t pstate_mclk; +bool od_enabled;uint32_t power_limit;uint32_t default_power_limit;@@ -399,6 +400,8 @@ struct smu_contextuint32_t workload_setting[WORKLOAD_POLICY_MAX ];uint32_t power_profile_mode;uint32_t default_power_profile_mode; + +uint32_t feature_mask; };struct pptable_funcs { --2.7.4
Quoted 4 lines
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx