drm/amd/powerplay: support enabled ppfeatures retrieving and setting
Subsystems (2)
PATCH 1/4 drm/amd/powerplay: support enabled ppfeatures retrieving and setting
User can use "ppfeatures" sysfs interface to retrieve and set enabled powerplay features.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_dpm.h | 8 ++ drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c | 66 +++++++++++ .../gpu/drm/amd/include/kgd_pp_interface.h | 2 + drivers/gpu/drm/amd/powerplay/amd_powerplay.c | 42 +++++++ .../drm/amd/powerplay/hwmgr/vega20_hwmgr.c | 104 ++++++++++++++++++ drivers/gpu/drm/amd/powerplay/inc/hwmgr.h | 2 + 6 files changed, 224 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_dpm.h +8 -0
@@ -364,6 +364,14 @@ enum amdgpu_pcie_gen { ((adev)->powerplay.pp_funcs->enable_mgpu_fan_boost (\ (adev)->powerplay.pp_handle)) +#define amdgpu_dpm_get_ppfeature_status (adev, buf) \ + ((adev)->powerplay.pp_funcs->get_ppfeature_status(\ + (adev)->powerplay.pp_handle, (buf))) + +#define amdgpu_dpm_set_ppfeature_status (adev, ppfeatures) \ + ((adev)->powerplay.pp_funcs->set_ppfeature_status(\ + (adev)->powerplay.pp_handle, (ppfeatures))) +struct amdgpu_dpm {struct amdgpu_ps *ps;/* number of valid power states */
drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c +66 -0
90 lines not on this page · raw message
drivers/gpu/drm/amd/include/kgd_pp_interface.h +2 -0
@@ -284,6 +284,8 @@ struct amd_pm_funcs {int (*get_asic_baco_capability)(void *handle,bool *cap);int (*get_asic_baco_state)(void *handle,int *state);int (*set_asic_baco_state)(void *handle,int state); +int (*get_ppfeature_status)(void *handle,char *buf); + int (*set_ppfeature_status)(void *handle, uint64_t ppfeature_masks); };#endif
drivers/gpu/drm/amd/powerplay/amd_powerplay.c +42 -0
52 lines not on this page · raw message
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c +104 -0
116 lines not on this page · raw message
drivers/gpu/drm/amd/powerplay/inc/hwmgr.h +2 -0
@@ -341,6 +341,8 @@ struct pp_hwmgr_func {int (*get_asic_baco_capability)(struct pp_hwmgr *hwmgr,bool *cap);int (*get_asic_baco_state)(struct pp_hwmgr *hwmgr,enum BACO_STATE *state);int (*set_asic_baco_state)(struct pp_hwmgr *hwmgr,enum BACO_STATE state); +int (*get_ppfeature_status)(struct pp_hwmgr *hwmgr,char *buf); +int (*set_ppfeature_status)(struct pp_hwmgr *hwmgr,uint64_t ppfeature_masks); };struct pp_table_func {
Signature · 6 lines
2.20.1 _______________________________________________ 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): [email protected]
PATCH 2/4 drm/amd/powerplay: support retrieving and adjusting SOC clock power levels
User can use "pp_dpm_socclk" to retrieve and adjust SOC clock power levels.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c | 49 ++++++++++++++++++- .../gpu/drm/amd/include/kgd_pp_interface.h | 1 + .../drm/amd/powerplay/hwmgr/vega20_hwmgr.c | 45 +++++++++++++++++ 3 files changed, 93 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c +47 -2
@@ -731,11 +731,11 @@ static ssize_t amdgpu_get_ppfeature_status(struct device *dev, }/** -* DOC: pp_dpm_sclk pp_dpm_mclk pp_dpm_pcie +* DOC: pp_dpm_sclk pp_dpm_mclk pp_dpm_socclk pp_dpm_pcie * * The amdgpu driver provides a sysfs API for adjusting what power levels * are enabled for a given power state. The files pp_dpm_sclk, pp_dpm_mclk, -* and pp_dpm_pcie are used for this. +* pp_dpm_socclk and pp_dpm_pcie are used for this. * * Reading back the files will show you the available power levels within * the power state and the clock information for those levels.
@@ -855,6 +855,42 @@ static ssize_t amdgpu_set_pp_dpm_mclk(struct device *dev,return count; } +static ssize_t amdgpu_get_pp_dpm_socclk (struct device *dev, +struct device_attribute *attr, +char *buf) +{ +struct drm_device *ddev =dev_get_drvdata (dev); +struct amdgpu_device *adev = ddev->dev_private; + +if (adev->powerplay.pp_funcs->print_clock_levels) +return amdgpu_dpm_print_clock_levels (adev,PP_SOCCLK , buf); +else +return snprintf (buf,PAGE_SIZE ,"\n" ); +} + +static ssize_t amdgpu_set_pp_dpm_socclk (struct device *dev, +struct device_attribute *attr, +const char *buf, +size_t count) +{ +struct drm_device *ddev =dev_get_drvdata (dev); +struct amdgpu_device *adev = ddev->dev_private; +int ret; +uint32_t mask =0 ; + + ret =amdgpu_read_mask (buf, count, &mask); +if (ret) +return ret; + +if (adev->powerplay.pp_funcs->force_clock_level) + ret =amdgpu_dpm_force_clock_level (adev,PP_SOCCLK , mask); + +if (ret) +return -EINVAL ; + +return count; +} +static ssize_t amdgpu_get_pp_dpm_pcie (struct device *dev,struct device_attribute *attr,char *buf)
@@ -1138,6 +1174,9 @@ static DEVICE_ATTR(pp_dpm_sclk, S_IRUGO | S_IWUSR, static DEVICE_ATTR(pp_dpm_mclk, S_IRUGO | S_IWUSR, amdgpu_get_pp_dpm_mclk, amdgpu_set_pp_dpm_mclk); +static DEVICE_ATTR(pp_dpm_socclk, S_IRUGO | S_IWUSR, + amdgpu_get_pp_dpm_socclk, + amdgpu_set_pp_dpm_socclk); static DEVICE_ATTR(pp_dpm_pcie, S_IRUGO | S_IWUSR, amdgpu_get_pp_dpm_pcie, amdgpu_set_pp_dpm_pcie);
@@ -2299,6 +2338,11 @@ int amdgpu_pm_sysfs_init(struct amdgpu_device *adev)DRM_ERROR ("failed to create device file pp_dpm_mclk\n" );return ret; } + ret =device_create_file (adev->dev, &dev_attr_pp_dpm_socclk); +if (ret) { +DRM_ERROR ("failed to create device file pp_dpm_socclk\n" ); +return ret; + } ret =device_create_file (adev->dev, &dev_attr_pp_dpm_pcie);if (ret) {DRM_ERROR ("failed to create device file pp_dpm_pcie\n" );
@@ -2383,6 +2427,7 @@ void amdgpu_pm_sysfs_fini(struct amdgpu_device *adev)device_remove_file (adev->dev, &dev_attr_pp_dpm_sclk);device_remove_file (adev->dev, &dev_attr_pp_dpm_mclk); +device_remove_file (adev->dev, &dev_attr_pp_dpm_socclk);device_remove_file (adev->dev, &dev_attr_pp_dpm_pcie);device_remove_file (adev->dev, &dev_attr_pp_sclk_od);device_remove_file (adev->dev, &dev_attr_pp_mclk_od);
drivers/gpu/drm/amd/include/kgd_pp_interface.h +1 -0
@@ -92,6 +92,7 @@ enum pp_clock_type {PP_SCLK ,PP_MCLK ,PP_PCIE , +PP_SOCCLK ,OD_SCLK ,OD_MCLK , OD_VDDC_CURVE,
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c +45 -0
57 lines not on this page · raw message
Signature · 6 lines
2.20.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 3/4 drm/amd/powerplay: support retrieving and adjusting fclock power levels
In reply to a message not in the archiveUser can use "pp_dpm_fclk" to retrieve and adjust fclock power levels.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c | 49 +++++++++++++- .../gpu/drm/amd/include/kgd_pp_interface.h | 1 + .../drm/amd/powerplay/hwmgr/vega20_hwmgr.c | 64 +++++++++++++++++++ 3 files changed, 112 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c +47 -2
@@ -731,11 +731,11 @@ static ssize_t amdgpu_get_ppfeature_status(struct device *dev, }/** -* DOC: pp_dpm_sclk pp_dpm_mclk pp_dpm_socclk pp_dpm_pcie +* DOC: pp_dpm_sclk pp_dpm_mclk pp_dpm_socclk pp_dpm_fclk pp_dpm_pcie * * The amdgpu driver provides a sysfs API for adjusting what power levels * are enabled for a given power state. The files pp_dpm_sclk, pp_dpm_mclk, -* pp_dpm_socclk and pp_dpm_pcie are used for this. +* pp_dpm_socclk, pp_dpm_fclk and pp_dpm_pcie are used for this. * * Reading back the files will show you the available power levels within * the power state and the clock information for those levels.
@@ -891,6 +891,42 @@ static ssize_t amdgpu_set_pp_dpm_socclk(struct device *dev,return count; } +static ssize_t amdgpu_get_pp_dpm_fclk (struct device *dev, +struct device_attribute *attr, +char *buf) +{ +struct drm_device *ddev =dev_get_drvdata (dev); +struct amdgpu_device *adev = ddev->dev_private; + +if (adev->powerplay.pp_funcs->print_clock_levels) +return amdgpu_dpm_print_clock_levels (adev,PP_FCLK , buf); +else +return snprintf (buf,PAGE_SIZE ,"\n" ); +} + +static ssize_t amdgpu_set_pp_dpm_fclk (struct device *dev, +struct device_attribute *attr, +const char *buf, +size_t count) +{ +struct drm_device *ddev =dev_get_drvdata (dev); +struct amdgpu_device *adev = ddev->dev_private; +int ret; +uint32_t mask =0 ; + + ret =amdgpu_read_mask (buf, count, &mask); +if (ret) +return ret; + +if (adev->powerplay.pp_funcs->force_clock_level) + ret =amdgpu_dpm_force_clock_level (adev,PP_FCLK , mask); + +if (ret) +return -EINVAL ; + +return count; +} +static ssize_t amdgpu_get_pp_dpm_pcie (struct device *dev,struct device_attribute *attr,char *buf)
@@ -1177,6 +1213,9 @@ static DEVICE_ATTR(pp_dpm_mclk, S_IRUGO | S_IWUSR, static DEVICE_ATTR(pp_dpm_socclk, S_IRUGO | S_IWUSR, amdgpu_get_pp_dpm_socclk, amdgpu_set_pp_dpm_socclk); +static DEVICE_ATTR(pp_dpm_fclk, S_IRUGO | S_IWUSR, + amdgpu_get_pp_dpm_fclk, + amdgpu_set_pp_dpm_fclk); static DEVICE_ATTR(pp_dpm_pcie, S_IRUGO | S_IWUSR, amdgpu_get_pp_dpm_pcie, amdgpu_set_pp_dpm_pcie);
@@ -2343,6 +2382,11 @@ int amdgpu_pm_sysfs_init(struct amdgpu_device *adev)DRM_ERROR ("failed to create device file pp_dpm_socclk\n" );return ret; } + ret =device_create_file (adev->dev, &dev_attr_pp_dpm_fclk); +if (ret) { +DRM_ERROR ("failed to create device file pp_dpm_fclk\n" ); +return ret; + } ret =device_create_file (adev->dev, &dev_attr_pp_dpm_pcie);if (ret) {DRM_ERROR ("failed to create device file pp_dpm_pcie\n" );
@@ -2429,6 +2473,7 @@ void amdgpu_pm_sysfs_fini(struct amdgpu_device *adev)device_remove_file (adev->dev, &dev_attr_pp_dpm_mclk);device_remove_file (adev->dev, &dev_attr_pp_dpm_socclk);device_remove_file (adev->dev, &dev_attr_pp_dpm_pcie); +device_remove_file (adev->dev, &dev_attr_pp_dpm_fclk);device_remove_file (adev->dev, &dev_attr_pp_sclk_od);device_remove_file (adev->dev, &dev_attr_pp_mclk_od); device_remove_file(adev->dev,
drivers/gpu/drm/amd/include/kgd_pp_interface.h +1 -0
@@ -93,6 +93,7 @@ enum pp_clock_type {PP_MCLK ,PP_PCIE ,PP_SOCCLK , +PP_FCLK ,OD_SCLK ,OD_MCLK , OD_VDDC_CURVE,
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c +64 -0
94 lines not on this page · raw message
Signature · 6 lines
2.20.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 4/4 drm/amd/powerplay: support retrieving and adjusting dcefclock power levels
In reply to a message not in the archiveUser can use "pp_dpm_dcefclk" to retrieve and adjust dcefclock power levels.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c | 53 ++++++++++++++++++- .../gpu/drm/amd/include/kgd_pp_interface.h | 1 + .../drm/amd/powerplay/hwmgr/vega20_hwmgr.c | 52 +++++++++++++++++- 3 files changed, 103 insertions(+), 3 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c +51 -2
@@ -731,11 +731,13 @@ static ssize_t amdgpu_get_ppfeature_status(struct device *dev, }/** -* DOC: pp_dpm_sclk pp_dpm_mclk pp_dpm_socclk pp_dpm_fclk pp_dpm_pcie +* DOC: pp_dpm_sclk pp_dpm_mclk pp_dpm_socclk pp_dpm_fclk pp_dpm_dcefclk +* pp_dpm_pcie * * The amdgpu driver provides a sysfs API for adjusting what power levels * are enabled for a given power state. The files pp_dpm_sclk, pp_dpm_mclk, -* pp_dpm_socclk, pp_dpm_fclk and pp_dpm_pcie are used for this. +* pp_dpm_socclk, pp_dpm_fclk, pp_dpm_dcefclk and pp_dpm_pcie are used for +* this. * * Reading back the files will show you the available power levels within * the power state and the clock information for those levels.
@@ -745,6 +747,8 @@ static ssize_t amdgpu_get_ppfeature_status(struct device *dev,* Secondly,Enter a new value for each level by inputing a string that * contains " echo xx xx xx > pp_dpm_sclk/mclk/pcie" * E.g., echo 4 5 6 to > pp_dpm_sclk will enable sclk levels 4, 5, and 6. +* +* NOTE: change to the dcefclk max dpm level is not supported now */ static ssize_t amdgpu_get_pp_dpm_sclk(struct device *dev,
@@ -927,6 +931,42 @@ static ssize_t amdgpu_set_pp_dpm_fclk(struct device *dev,return count; } +static ssize_t amdgpu_get_pp_dpm_dcefclk (struct device *dev, +struct device_attribute *attr, +char *buf) +{ +struct drm_device *ddev =dev_get_drvdata (dev); +struct amdgpu_device *adev = ddev->dev_private; + +if (adev->powerplay.pp_funcs->print_clock_levels) +return amdgpu_dpm_print_clock_levels (adev,PP_DCEFCLK , buf); +else +return snprintf (buf,PAGE_SIZE ,"\n" ); +} + +static ssize_t amdgpu_set_pp_dpm_dcefclk (struct device *dev, +struct device_attribute *attr, +const char *buf, +size_t count) +{ +struct drm_device *ddev =dev_get_drvdata (dev); +struct amdgpu_device *adev = ddev->dev_private; +int ret; +uint32_t mask =0 ; + + ret =amdgpu_read_mask (buf, count, &mask); +if (ret) +return ret; + +if (adev->powerplay.pp_funcs->force_clock_level) + ret =amdgpu_dpm_force_clock_level (adev,PP_DCEFCLK , mask); + +if (ret) +return -EINVAL ; + +return count; +} +static ssize_t amdgpu_get_pp_dpm_pcie (struct device *dev,struct device_attribute *attr,char *buf)
@@ -1216,6 +1256,9 @@ static DEVICE_ATTR(pp_dpm_socclk, S_IRUGO | S_IWUSR, static DEVICE_ATTR(pp_dpm_fclk, S_IRUGO | S_IWUSR, amdgpu_get_pp_dpm_fclk, amdgpu_set_pp_dpm_fclk); +static DEVICE_ATTR(pp_dpm_dcefclk, S_IRUGO | S_IWUSR, + amdgpu_get_pp_dpm_dcefclk, + amdgpu_set_pp_dpm_dcefclk); static DEVICE_ATTR(pp_dpm_pcie, S_IRUGO | S_IWUSR, amdgpu_get_pp_dpm_pcie, amdgpu_set_pp_dpm_pcie);
@@ -2387,6 +2430,11 @@ int amdgpu_pm_sysfs_init(struct amdgpu_device *adev)DRM_ERROR ("failed to create device file pp_dpm_fclk\n" );return ret; } + ret =device_create_file (adev->dev, &dev_attr_pp_dpm_dcefclk); +if (ret) { +DRM_ERROR ("failed to create device file pp_dpm_dcefclk\n" ); +return ret; + } ret =device_create_file (adev->dev, &dev_attr_pp_dpm_pcie);if (ret) {DRM_ERROR ("failed to create device file pp_dpm_pcie\n" );
@@ -2474,6 +2522,7 @@ void amdgpu_pm_sysfs_fini(struct amdgpu_device *adev)device_remove_file (adev->dev, &dev_attr_pp_dpm_socclk);device_remove_file (adev->dev, &dev_attr_pp_dpm_pcie);device_remove_file (adev->dev, &dev_attr_pp_dpm_fclk); +device_remove_file (adev->dev, &dev_attr_pp_dpm_dcefclk);device_remove_file (adev->dev, &dev_attr_pp_sclk_od);device_remove_file (adev->dev, &dev_attr_pp_mclk_od); device_remove_file(adev->dev,
drivers/gpu/drm/amd/include/kgd_pp_interface.h +1 -0
@@ -94,6 +94,7 @@ enum pp_clock_type {PP_PCIE ,PP_SOCCLK ,PP_FCLK , +PP_DCEFCLK ,OD_SCLK ,OD_MCLK , OD_VDDC_CURVE,
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c +51 -1
76 lines not on this page · raw message
Signature · 6 lines
2.20.1 _______________________________________________ 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): [email protected]
Re: [PATCH 4/4] drm/amd/powerplay: support retrieving and adjusting dcefclock power levels
Quoted 6 lines · Evan Quan
User can use "
pp_dpm_dcefclk" to retrieve and adjust dcefclock power levels.Change-Id Ia3f61558ca96104c88d129ba5194103b2fe702ecSigned-off-by Evan Quan <[email protected]>
We should probably find a way to hide these new files on asics which don't support them. Other than that, the series looks good to me.
Alex
Quoted 207 lines
--- drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c | 53 ++++++++++++++++++- .../gpu/drm/amd/include/kgd_pp_interface.h | 1 + .../drm/amd/powerplay/hwmgr/vega20_hwmgr.c | 52 +++++++++++++++++- 3 files changed, 103 insertions(+), 3 deletions(-)drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c +51
-2@@ -731,11 +731,13 @@ static ssize_t amdgpu_get_ppfeature_status(struct device *dev, }/** -* DOC: pp_dpm_sclk pp_dpm_mclk pp_dpm_socclk pp_dpm_fclk pp_dpm_pcie +* DOC: pp_dpm_sclk pp_dpm_mclk pp_dpm_socclk pp_dpm_fclk pp_dpm_dcefclk +* pp_dpm_pcie * * The amdgpu driver provides a sysfs API for adjusting what power levels * are enabled for a given power state. The files pp_dpm_sclk, pp_dpm_mclk, -* pp_dpm_socclk, pp_dpm_fclk and pp_dpm_pcie are used for this. +* pp_dpm_socclk, pp_dpm_fclk, pp_dpm_dcefclk and pp_dpm_pcie are used for +* this. * * Reading back the files will show you the available power levels within * the power state and the clock information for those levels. @@ -745,6 +747,8 @@ static ssize_t amdgpu_get_ppfeature_status(struct device *dev,* Secondly,Enter a new value for each level by inputing a string that * contains " echo xx xx xx > pp_dpm_sclk/mclk/pcie" * E.g., echo 4 5 6 to > pp_dpm_sclk will enable sclk levels 4, 5, and 6. +* +* NOTE: change to the dcefclk max dpm level is not supported now */ static ssize_t amdgpu_get_pp_dpm_sclk(struct device *dev,@@ -927,6 +931,42 @@ static ssize_t amdgpu_set_pp_dpm_fclk(struct device *dev,return count; } +static ssize_t amdgpu_get_pp_dpm_dcefclk (struct device *dev, +struct device_attribute *attr, +char *buf) +{ +struct drm_device *ddev =dev_get_drvdata (dev); +struct amdgpu_device *adev = ddev->dev_private; + +if (adev->powerplay.pp_funcs->print_clock_levels) +return amdgpu_dpm_print_clock_levels (adev,PP_DCEFCLK , buf); +else +return snprintf (buf,PAGE_SIZE ,"\n" ); +} + +static ssize_t amdgpu_set_pp_dpm_dcefclk (struct device *dev, +struct device_attribute *attr, +const char *buf, +size_t count) +{ +struct drm_device *ddev =dev_get_drvdata (dev); +struct amdgpu_device *adev = ddev->dev_private; +int ret; +uint32_t mask =0 ; + + ret =amdgpu_read_mask (buf, count, &mask); +if (ret) +return ret; + +if (adev->powerplay.pp_funcs->force_clock_level) + ret =amdgpu_dpm_force_clock_level (adev,PP_DCEFCLK , mask); + +if (ret) +return -EINVAL ; + +return count; +} +static ssize_t amdgpu_get_pp_dpm_pcie (struct device *dev,struct device_attribute *attr,char *buf)@@ -1216,6 +1256,9 @@ static DEVICE_ATTR(pp_dpm_socclk, S_IRUGO | S_IWUSR, static DEVICE_ATTR(pp_dpm_fclk, S_IRUGO | S_IWUSR, amdgpu_get_pp_dpm_fclk, amdgpu_set_pp_dpm_fclk); +static DEVICE_ATTR(pp_dpm_dcefclk, S_IRUGO | S_IWUSR, + amdgpu_get_pp_dpm_dcefclk, + amdgpu_set_pp_dpm_dcefclk); static DEVICE_ATTR(pp_dpm_pcie, S_IRUGO | S_IWUSR, amdgpu_get_pp_dpm_pcie, amdgpu_set_pp_dpm_pcie);@@ -2387,6 +2430,11 @@ int amdgpu_pm_sysfs_init(struct amdgpu_device *adev)DRM_ERROR ("failed to create device file pp_dpm_fclk\n" );return ret; } + ret =device_create_file (adev->dev, &dev_attr_pp_dpm_dcefclk); +if (ret) { +DRM_ERROR ("failed to create device file pp_dpm_dcefclk\n" ); +return ret; + } ret =device_create_file (adev->dev, &dev_attr_pp_dpm_pcie);if (ret) {DRM_ERROR ("failed to create device file pp_dpm_pcie\n" );@@ -2474,6 +2522,7 @@ void amdgpu_pm_sysfs_fini(struct amdgpu_device *adev)device_remove_file (adev->dev, &dev_attr_pp_dpm_socclk);device_remove_file (adev->dev, &dev_attr_pp_dpm_pcie);device_remove_file (adev->dev, &dev_attr_pp_dpm_fclk); +device_remove_file (adev->dev, &dev_attr_pp_dpm_dcefclk);device_remove_file (adev->dev, &dev_attr_pp_sclk_od);device_remove_file (adev->dev, &dev_attr_pp_mclk_od); device_remove_file(adev->dev,drivers/gpu/drm/amd/include/kgd_pp_interface.h +1
-0@@ -94,6 +94,7 @@ enum pp_clock_type {PP_PCIE ,PP_SOCCLK ,PP_FCLK , +PP_DCEFCLK ,OD_SCLK ,OD_MCLK , OD_VDDC_CURVE,drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c +51
-2@@ -1746,6 +1746,17 @@ static int vega20_upload_dpm_min_level(struct pp_hwmgr *hwmgr, uint32_t feature_ return ret); } +if (data->smu_features[GNLD_DPM_DCEFCLK ].enabled && + (feature_mask &FEATURE_DPM_DCEFCLK_MASK )) { + min_freq = data->dpm_table.dcef_table.dpm_state.hard_min_level; + +PP_ASSERT_WITH_CODE (!(ret =smum_send_msg_to_smc_with_parameter ( + hwmgr, PPSMC_MSG_SetHardMinByFreq, + (PPCLK_DCEFCLK <<16 ) | (min_freq &0xffff ))), +"Failed to set hard min dcefclk!" , + return ret); + } +return ret; }@@ -2258,7 +2269,7 @@ static int vega20_force_clock_level(struct pp_hwmgr *hwmgr, enum pp_clock_type type, uint32_t mask) {struct vega20_hwmgr *data = (struct vega20_hwmgr *)(hwmgr->backend); -uint32_t soft_min_level, soft_max_level; +uint32_t soft_min_level, soft_max_level, hard_min_level;int ret =0 ;switch (type) {@@ -2373,6 +2384,28 @@ static int vega20_force_clock_level(struct pp_hwmgr *hwmgr,break ; +case PP_DCEFCLK : + hard_min_level = mask ? (ffs (mask) -1 ) :0 ; + +if (hard_min_level >= data->dpm_table.dcef_table.count) { +pr_err ("Clock level specified %d is over max allowed %d\n" , + hard_min_level, + data->dpm_table.dcef_table.count -1 ); +return -EINVAL ; + } + + data->dpm_table.dcef_table.dpm_state.hard_min_level = + data->dpm_table.dcef_table.dpm_levels[hard_min_level].value; + + ret =vega20_upload_dpm_min_level (hwmgr,FEATURE_DPM_DCEFCLK_MASK ); +PP_ASSERT_WITH_CODE (!ret, +"Failed to upload boot level to lowest!" , + return ret); + +//TODO: Setting DCEFCLK max dpm level is not supported + +break ; +case PP_PCIE : soft_min_level = mask ? (ffs (mask) -1 ) :0 ; soft_max_level = mask ? (fls (mask) -1 ) :0 ;@@ -3039,6 +3072,23 @@ static int vega20_print_clock_levels(struct pp_hwmgr *hwmgr, fclk_dpm_table->dpm_levels[i].value == (now / 100) ? "*" : "");break ; +case PP_DCEFCLK : + ret =vega20_get_current_clk_freq (hwmgr,PPCLK_DCEFCLK , &now); +PP_ASSERT_WITH_CODE (!ret, +"Attempt to get current dcefclk freq Failed!" , + return ret); + + ret =vega20_get_dcefclocks (hwmgr, &clocks); +PP_ASSERT_WITH_CODE (!ret, +"Attempt to get dcefclk levels Failed!" , + return ret); + +for (i =0 ; i < clocks.num_levels; i++) + size +=sprintf (buf + size,"%d: %uMhz %s\n" , + i, clocks.data[i].clocks_in_khz /1000 , + (clocks.data[i].clocks_in_khz == now *10 ) ?"*" :"" ); +break ; +case PP_PCIE : gen_speed = (RREG32_PCIE (smnPCIE_LC_SPEED_CNTL) &PSWUSP0_PCIE_LC_SPEED_CNTL__LC_CURRENT_DATA_RATE_MASK ) --2.20.1
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
A message that is not in the archive (sent off-list or not yet received): CADnq5_MQg0z6FCH-3UQCXtLEOdtsS2vQ-YXvgWDNBGoyOSaFbw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org
RE: [PATCH 4/4] drm/amd/powerplay: support retrieving and adjusting dcefclock power levels
I think we can use asic_type to determine whether to expose these new interfaces. If (adev->asic_type >= CHIP_VEGA10), socclk and dcefclk are OK to expose If (adev->asic_type >= CHIP_VEGA20), fclk is OK to expose
Regards,
Evan
Quoted 247 lines
-----Original Message-----
From: Alex Deucher <[email protected]>
Sent: Tuesday, January 15, 2019 1:00 AM
To: Quan, Evan <[email protected]>
Cc: amd-gfx list <[email protected]>; Deucher, Alexander <[email protected]>
Subject: Re: [PATCH 4/4] drm/amd/powerplay: support retrieving and adjusting dcefclock power levelsQuoted 6 lines · Evan Quan
User can use "
pp_dpm_dcefclk" to retrieve and adjust dcefclock power levels.Change-Id Ia3f61558ca96104c88d129ba5194103b2fe702ecSigned-off-by Evan Quan <[email protected]>We should probably find a way to hide these new files on asics which don't support them. Other than that, the series looks good to me.
Alex
Quoted 2 lines
--- drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c | 53++++++++++++++++++-
Quoted 2 lines
.../gpu/drm/amd/include/kgd_pp_interface.h | 1 + .../drm/amd/powerplay/hwmgr/vega20_hwmgr.c | 52+++++++++++++++++-
drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c static ssize_t · line 734
Quoted 12 lines
3 files changed, 103 insertions(+), 3 deletions(-)drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c +0
-1@@ -731,11 +731,13 @@ static ssize_t amdgpu_get_ppfeature_status(struct device *dev, }/** -* DOC: pp_dpm_sclk pp_dpm_mclk pp_dpm_socclk pp_dpm_fclk
pp_dpm_pciedrivers/gpu/drm/amd/amdgpu/amdgpu_pm.c static ssize_t amdgpu_get_ppfeature_status(struct
Quoted 15 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c +6
-1+ * DOC: pp_dpm_sclk pp_dpm_mclk pp_dpm_socclk pp_dpm_fclk + pp_dpm_dcefclk + * pp_dpm_pcie * * The amdgpu driver provides a sysfs API for adjusting what power levels * are enabled for a given power state. The files pp_dpm_sclk, pp_dpm_mclk, -* pp_dpm_socclk, pp_dpm_fclk and pp_dpm_pcie are used for this. + * pp_dpm_socclk, pp_dpm_fclk, pp_dpm_dcefclk and pp_dpm_pcie are + used for + * this. * * Reading back the files will show you the available power levels within * the power state and the clock information for those levels.@@ -745,6 +747,8 @@ static ssize_t amdgpu_get_ppfeature_status(structdevice *dev,
Quoted 73 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c +42
-0* Secondly,Enter a new value for each level by inputing a string that * contains " echo xx xx xx > pp_dpm_sclk/mclk/pcie" * E.g., echo 4 5 6 to > pp_dpm_sclk will enable sclk levels 4, 5, and 6. +* +* NOTE: change to the dcefclk max dpm level is not supported now */ static ssize_t amdgpu_get_pp_dpm_sclk(struct device *dev, @@ -927,6 +931,42 @@ static ssize_t amdgpu_set_pp_dpm_fclk(struct device *dev, return count; } +static ssize_t amdgpu_get_pp_dpm_dcefclk(struct device *dev, + struct device_attribute *attr, + char *buf) +{ + struct drm_device *ddev = dev_get_drvdata(dev); + struct amdgpu_device *adev = ddev->dev_private; + + if (adev->powerplay.pp_funcs->print_clock_levels) + return amdgpu_dpm_print_clock_levels(adev, PP_DCEFCLK, buf); + else + return snprintf(buf, PAGE_SIZE, "\n"); } + +static ssize_t amdgpu_set_pp_dpm_dcefclk(struct device *dev, + struct device_attribute *attr, + const char *buf, + size_t count) +{ + struct drm_device *ddev = dev_get_drvdata(dev); + struct amdgpu_device *adev = ddev->dev_private; + int ret; + uint32_t mask = 0; + + ret = amdgpu_read_mask(buf, count, &mask); + if (ret) + return ret; + + if (adev->powerplay.pp_funcs->force_clock_level) + ret = amdgpu_dpm_force_clock_level(adev, PP_DCEFCLK, + mask); + + if (ret) + return -EINVAL; + + return count; +} + static ssize_t amdgpu_get_pp_dpm_pcie(struct device *dev, struct device_attribute *attr, char *buf)@@ -1216,6 +1256,9 @@ static DEVICE_ATTR(pp_dpm_socclk, S_IRUGO | S_IWUSR, static DEVICE_ATTR(pp_dpm_fclk, S_IRUGO | S_IWUSR, amdgpu_get_pp_dpm_fclk, amdgpu_set_pp_dpm_fclk); +static DEVICE_ATTR(pp_dpm_dcefclk, S_IRUGO | S_IWUSR, + amdgpu_get_pp_dpm_dcefclk, + amdgpu_set_pp_dpm_dcefclk); static DEVICE_ATTR(pp_dpm_pcie, S_IRUGO | S_IWUSR, amdgpu_get_pp_dpm_pcie, amdgpu_set_pp_dpm_pcie); @@ -2387,6 +2430,11 @@ int
amdgpu_pm_sysfs_init(struct amdgpu_device *adev)DRM_ERROR("failed to create device file pp_dpm_fclk\n"); return ret; }drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c +5
-0+ ret =device_create_file (adev->dev, &dev_attr_pp_dpm_dcefclk); +if (ret) { +DRM_ERROR ("failed to create device file pp_dpm_dcefclk\n" ); +return ret; + } ret =device_create_file (adev->dev, &dev_attr_pp_dpm_pcie);if (ret) { DRM_ERROR("failed to create device fileQuoted 1 line
pp_dpm_pcie\n"); @@ -2474,6 +2522,7 @@ void
amdgpu_pm_sysfs_fini(struct amdgpu_device *adev)drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c static int vega20_upload_dpm_min_level(struct
Quoted 26 lines
device_remove_file(adev->dev, &dev_attr_pp_dpm_socclk); device_remove_file(adev->dev, &dev_attr_pp_dpm_pcie); device_remove_file(adev->dev, &dev_attr_pp_dpm_fclk);drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c +1
-0+device_remove_file (adev->dev, &dev_attr_pp_dpm_dcefclk);device_remove_file (adev->dev, &dev_attr_pp_sclk_od);device_remove_file (adev->dev, &dev_attr_pp_mclk_od); device_remove_file(adev->dev,drivers/gpu/drm/amd/include/kgd_pp_interface.h +1
-0@@ -94,6 +94,7 @@ enum pp_clock_type {PP_PCIE ,PP_SOCCLK ,PP_FCLK , +PP_DCEFCLK ,OD_SCLK ,OD_MCLK , OD_VDDC_CURVE,drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c +0
-0@@ -1746,6 +1746,17 @@ static int vega20_upload_dpm_min_level(struct
pp_hwmgr*hwmgr,uint32_tfeature_drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c static int vega20_upload_dpm_min_level(struct pp_hwmgr *hwmgr, uint32_t feature_
Quoted 9 lines
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c +6
-0return ret); } +if (data->smu_features[GNLD_DPM_DCEFCLK ].enabled && + (feature_mask &FEATURE_DPM_DCEFCLK_MASK )) { + min_freq = + data->dpm_table.dcef_table.dpm_state.hard_min_level; + + PP_ASSERT_WITH_CODE(!(ret =smum_send_msg_to_smc_with_parameter(
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c static int vega20_force_clock_level(struct
Quoted 10 lines
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c +6
-0+ hwmgr, PPSMC_MSG_SetHardMinByFreq, + (PPCLK_DCEFCLK << 16) | (min_freq & 0xffff))), +"Failed to set hard min dcefclk!" , + return ret); + } +return ret; }@@ -2258,7 +2269,7 @@ static int vega20_force_clock_level(struct
pp_hwmgr*hwmgr,Quoted 18 lines
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c +6
-1enum pp_clock_type type, uint32_t mask) {struct vega20_hwmgr *data = (struct vega20_hwmgr *)(hwmgr- backend); -uint32_t soft_min_level, soft_max_level; +uint32_t soft_min_level, soft_max_level, hard_min_level;int ret =0 ;switch (type) {@@ -2373,6 +2384,28 @@ static int vega20_force_clock_level(structpp_hwmgr *hwmgr, break; +case PP_DCEFCLK : + hard_min_level = mask ? (ffs (mask) -1 ) :0 ; + +if (hard_min_level >= data->dpm_table.dcef_table.count) { + pr_err("Clock level specified %d is over max allowed %d\n",drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c static int vega20_force_clock_level(struct · line 2402
Quoted 10 lines
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c +10
-0+ hard_min_level, + data->dpm_table.dcef_table.count - 1); +return -EINVAL ; + } + + data->dpm_table.dcef_table.dpm_state.hard_min_level = + + data->dpm_table.dcef_table.dpm_levels[hard_min_level].value; + + ret = vega20_upload_dpm_min_level(hwmgr,
FEATURE_DPM_DCEFCLK_MASK);drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c static int vega20_force_clock_level(struct pp_hwmgr *hwmgr,
Quoted 12 lines
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c +8
-1+PP_ASSERT_WITH_CODE (!ret, +"Failed to upload boot level to lowest!" , + return ret); + +//TODO: Setting DCEFCLK max dpm level is not supported + +break ; +case PP_PCIE : soft_min_level = mask ? (ffs (mask) -1 ) :0 ; soft_max_level = mask ? (fls(mask) - 1) : 0; @@ -3039,6 +3072,23 @@ static int vega20_print_clock_levels(struct pp_hwmgr*hwmgr,
Quoted 1 line
fclk_dpm_table->dpm_levels[i].value == (now / 100) ? "*" :"");
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c
Quoted 4 lines
break;drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c +2
-0+case PP_DCEFCLK : + ret = vega20_get_current_clk_freq(hwmgr, PPCLK_DCEFCLK,&now);
Quoted 18 lines
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c +15
-0+PP_ASSERT_WITH_CODE (!ret, +"Attempt to get current dcefclk freq Failed!" , + return ret); + + ret =vega20_get_dcefclocks (hwmgr, &clocks); +PP_ASSERT_WITH_CODE (!ret, +"Attempt to get dcefclk levels Failed!" , + return ret); + +for (i =0 ; i < clocks.num_levels; i++) + size +=sprintf (buf + size,"%d: %uMhz %s\n" , + i, clocks.data[i].clocks_in_khz /1000 , + (clocks.data[i].clocks_in_khz == now *10 ) ?"*" :"" ); +break ; +case PP_PCIE : gen_speed = (RREG32_PCIE(smnPCIE_LC_SPEED_CNTL) &
Quoted 8 lines
Quoted 8 lines
PSWUSP0_PCIE_LC_SPEED_CNTL__LC_CURRENT_DATA_RATE_MASK) --
2.20.1_______________________________________________
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
A message that is not in the archive (sent off-list or not yet received): SN6PR12MB265648F3ACAE6F52278858D3E4810-kxOKjb6HO/FeL/[email protected]
RE: [PATCH 4/4] drm/amd/powerplay: support retrieving and adjusting dcefclock power levels
For ppfeatures, it will be seen only if (adev->asic_type >= CHIP_VEGA10 && !APU).
Regards,
Evan
Quoted 273 lines
-----Original Message-----
From: Quan, Evan
Sent: Tuesday, January 15, 2019 2:44 PM
To: Alex Deucher <[email protected]>
Cc: amd-gfx list <[email protected]>; Deucher, Alexander <[email protected]>
Subject: RE: [PATCH 4/4] drm/amd/powerplay: support retrieving and adjusting dcefclock power levelsI think we can use
asic_typeto determine whether to expose these new interfaces.
If (adev->asic_type>=CHIP_VEGA10), socclk and dcefclk are OK to expose If (adev->asic_type>=CHIP_VEGA20), fclk is OK to exposeRegards,
EvanQuoted 38 lines
-----Original Message-----
From: Alex Deucher <[email protected]>
Sent: Tuesday, January 15, 2019 1:00 AM
To: Quan, Evan <[email protected]>
Cc: amd-gfx list <[email protected]>; Deucher, Alexander <[email protected]>
Subject: Re: [PATCH 4/4] drm/amd/powerplay: support retrieving and adjusting dcefclock power levelsQuoted 6 lines · Evan Quan
User can use "
pp_dpm_dcefclk" to retrieve and adjust dcefclock power levels.Change-Id Ia3f61558ca96104c88d129ba5194103b2fe702ecSigned-off-by Evan Quan <[email protected]>We should probably find a way to hide these new files on asics which don't support them. Other than that, the series looks good to me.
Alex
Quoted 2 lines
--- drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c | 53++++++++++++++++++-
Quoted 2 lines
.../gpu/drm/amd/include/kgd_pp_interface.h | 1 + .../drm/amd/powerplay/hwmgr/vega20_hwmgr.c | 52+++++++++++++++++-
Quoted 10 lines
3 files changed, 103 insertions(+), 3 deletions(-)drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c +0
-0@@ -731,11 +731,13 @@ static ssize_t amdgpu_get_ppfeature_status(struct device *dev, }Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c static ssize_t · line 734
Quoted 2 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c +0
-1/** -* DOC: pp_dpm_sclk pp_dpm_mclk pp_dpm_socclk pp_dpm_fclk
pp_dpm_pcieQuoted 5 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c +3
-0+ * DOC: pp_dpm_sclk pp_dpm_mclk pp_dpm_socclk pp_dpm_fclk + pp_dpm_dcefclk + * pp_dpm_pcie * * The amdgpu driver provides a sysfs API for adjusting what powerlevels
Quoted 4 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c static ssize_t · line 741
Quoted 4 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c +1
-1* are enabled for a given power state. The files pp_dpm_sclk, pp_dpm_mclk, - * pp_dpm_socclk, pp_dpm_fclk and pp_dpm_pcie are used for this. + * pp_dpm_socclk, pp_dpm_fclk, pp_dpm_dcefclk and pp_dpm_pcieare
Quoted 20 lines
Quoted 7 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c +2
-0+ used for + * this. * * Reading back the files will show you the available power levels within * the power state and the clock information for those levels.@@ -745,6 +747,8 @@ static ssize_tamdgpu_get_ppfeature_status(struct
device *dev,
Quoted 12 lines
* Secondly,Enter a new value for each level by inputing a string that
* contains " echo xx xx xx > pp_dpm_sclk/mclk/pcie"
* E.g., echo 4 5 6 to >pp_dpm_sclkwill enable sclk levels 4, 5, and 6.
+ *
+ * NOTE: change to the dcefclk max dpm level is not supported now */static
ssize_tamdgpu_get_pp_dpm_sclk(struct device *dev, @@ -927,6
+931,42 @@ staticssize_tamdgpu_set_pp_dpm_fclk(struct device *dev,return count;}
Quoted 9 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c static ssize_t amdgpu_set_pp_dpm_fclk(struct device *dev,
Quoted 9 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c +9
-0+static ssize_t amdgpu_get_pp_dpm_dcefclk (struct device *dev, +struct device_attribute *attr, +char *buf) +{ +struct drm_device *ddev =dev_get_drvdata (dev); +struct amdgpu_device *adev = ddev->dev_private; + +if (adev->powerplay.pp_funcs->print_clock_levels) + return amdgpu_dpm_print_clock_levels(adev, PP_DCEFCLK,buf);
Quoted 72 lines
Quoted 52 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c +30
-0+else +return snprintf (buf,PAGE_SIZE ,"\n" ); } + +static ssize_t amdgpu_set_pp_dpm_dcefclk (struct device *dev, +struct device_attribute *attr, +const char *buf, +size_t count) +{ +struct drm_device *ddev =dev_get_drvdata (dev); +struct amdgpu_device *adev = ddev->dev_private; +int ret; +uint32_t mask =0 ; + + ret =amdgpu_read_mask (buf, count, &mask); +if (ret) +return ret; + +if (adev->powerplay.pp_funcs->force_clock_level) + ret =amdgpu_dpm_force_clock_level (adev,PP_DCEFCLK , + mask); + +if (ret) +return -EINVAL ; + +return count; +} +static ssize_t amdgpu_get_pp_dpm_pcie (struct device *dev,struct device_attribute *attr,char *buf)@@ -1216,6 +1256,9 @@ static DEVICE_ATTR(pp_dpm_socclk, S_IRUGO | S_IWUSR, static DEVICE_ATTR(pp_dpm_fclk, S_IRUGO | S_IWUSR, amdgpu_get_pp_dpm_fclk, amdgpu_set_pp_dpm_fclk); +static DEVICE_ATTR(pp_dpm_dcefclk, S_IRUGO | S_IWUSR, + amdgpu_get_pp_dpm_dcefclk, + amdgpu_set_pp_dpm_dcefclk); static DEVICE_ATTR(pp_dpm_pcie, S_IRUGO | S_IWUSR, amdgpu_get_pp_dpm_pcie, amdgpu_set_pp_dpm_pcie); @@ -2387,6 +2430,11 @@ int
amdgpu_pm_sysfs_init(struct amdgpu_device *adev)DRM_ERROR("failed to create device file pp_dpm_fclk\n"); return ret; }drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c +5
-0+ ret =device_create_file (adev->dev, &dev_attr_pp_dpm_dcefclk); +if (ret) { +DRM_ERROR ("failed to create device file pp_dpm_dcefclk\n" ); +return ret; + } ret =device_create_file (adev->dev, &dev_attr_pp_dpm_pcie);if (ret) { DRM_ERROR("failed to create device fileQuoted 1 line
pp_dpm_pcie\n"); @@ -2474,6 +2522,7 @@ void
amdgpu_pm_sysfs_fini(struct amdgpu_device *adev)Quoted 18 lines
device_remove_file(adev->dev, &dev_attr_pp_dpm_socclk); device_remove_file(adev->dev, &dev_attr_pp_dpm_pcie); device_remove_file(adev->dev, &dev_attr_pp_dpm_fclk); + device_remove_file(adev->dev, &dev_attr_pp_dpm_dcefclk); device_remove_file(adev->dev, &dev_attr_pp_sclk_od); device_remove_file(adev->dev, &dev_attr_pp_mclk_od); device_remove_file(adev->dev, diff --git
a/drivers/gpu/drm/amd/include/kgd_pp_interface.hb/drivers/gpu/drm/amd/include/kgd_pp_interface.h
indexf82de14f6560..2b579ba9b685100644drivers/gpu/drm/amd/include/kgd_pp_interface.h +1
-0@@ -94,6 +94,7 @@ enum pp_clock_type {PP_PCIE ,PP_SOCCLK ,PP_FCLK , +PP_DCEFCLK , OD_SCLK,Quoted 8 lines
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c static int
Quoted 8 lines
drivers/gpu/drm/amd/include/kgd_pp_interface.h +0
-0OD_MCLK , OD_VDDC_CURVE,drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c +0
-0@@ -1746,6 +1746,17 @@ static intvega20_upload_dpm_min_level(struct
Quoted 52 lines
pp_hwmgr*hwmgr,uint32_tfeature_drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c static int vega20_upload_dpm_min_level(struct pp_hwmgr *hwmgr, uint32_t feature_
Quoted 9 lines
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c +6
-0return ret); } +if (data->smu_features[GNLD_DPM_DCEFCLK ].enabled && + (feature_mask &FEATURE_DPM_DCEFCLK_MASK )) { + min_freq = + data->dpm_table.dcef_table.dpm_state.hard_min_level; + + PP_ASSERT_WITH_CODE(!(ret =smum_send_msg_to_smc_with_parameter(
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c static int vega20_force_clock_level(struct
Quoted 10 lines
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c +6
-0+ hwmgr, PPSMC_MSG_SetHardMinByFreq, + (PPCLK_DCEFCLK << 16) | (min_freq & 0xffff))), +"Failed to set hard min dcefclk!" , + return ret); + } +return ret; }@@ -2258,7 +2269,7 @@ static int vega20_force_clock_level(struct
pp_hwmgr*hwmgr,Quoted 19 lines
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c +7
-1enum pp_clock_type type, uint32_t mask) {struct vega20_hwmgr *data = (struct vega20_hwmgr *)(hwmgr- backend); -uint32_t soft_min_level, soft_max_level; +uint32_t soft_min_level, soft_max_level, hard_min_level;int ret =0 ;switch (type) {@@ -2373,6 +2384,28 @@ static int vega20_force_clock_level(structpp_hwmgr *hwmgr, break; +case PP_DCEFCLK : + hard_min_level = mask ? (ffs (mask) -1 ) :0 ; + +if (hard_min_level >= data->dpm_table.dcef_table.count) { + pr_err("Clock level specified %d is over max allowed %d\n", + hard_min_level,drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c static int vega20_force_clock_level(struct · line 2403
Quoted 10 lines
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c +10
-0+ data->dpm_table.dcef_table.count - 1); +return -EINVAL ; + } + + data->dpm_table.dcef_table.dpm_state.hard_min_level + = + + data->dpm_table.dcef_table.dpm_levels[hard_min_level].value; + + ret = vega20_upload_dpm_min_level(hwmgr,
FEATURE_DPM_DCEFCLK_MASK);Quoted 16 lines
Quoted 13 lines
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c +9
-1+PP_ASSERT_WITH_CODE (!ret, +"Failed to upload boot level to lowest!" , + return ret); + +//TODO: Setting DCEFCLK max dpm level is not +supported + + break; +case PP_PCIE : soft_min_level = mask ? (ffs (mask) -1 ) :0 ; soft_max_level = mask ? (fls(mask) - 1) : 0; @@ -3039,6 +3072,23 @@ static int vega20_print_clock_levels(structQuoted 1 line
pp_hwmgr*hwmgr,
Quoted 1 line
fclk_dpm_table->dpm_levels[i].value == (now / 100) ?"*" :
Quoted 25 lines
"");
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c
Quoted 5 lines
break;drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c +3
-0+case PP_DCEFCLK : + ret = vega20_get_current_clk_freq(hwmgr, + PPCLK_DCEFCLK,&now);
Quoted 18 lines
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c +15
-0+PP_ASSERT_WITH_CODE (!ret, +"Attempt to get current dcefclk freq Failed!" , + return ret); + + ret =vega20_get_dcefclocks (hwmgr, &clocks); +PP_ASSERT_WITH_CODE (!ret, +"Attempt to get dcefclk levels Failed!" , + return ret); + +for (i =0 ; i < clocks.num_levels; i++) + size +=sprintf (buf + size,"%d: %uMhz %s\n" , + i, clocks.data[i].clocks_in_khz /1000 , + (clocks.data[i].clocks_in_khz == now *10 ) ?"*" :"" ); +break ; +case PP_PCIE : gen_speed = (RREG32_PCIE(smnPCIE_LC_SPEED_CNTL) &
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
PSWUSP0_PCIE_LC_SPEED_CNTL__LC_CURRENT_DATA_RATE_MASK) --
2.20.1_______________________________________________
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
A message that is not in the archive (sent off-list or not yet received): SN6PR12MB26560F7F273E30EBFECE50EFE4810-kxOKjb6HO/FeL/[email protected]
Deucher, Alexander
Reviewed-byRe: [PATCH 4/4] drm/amd/powerplay: support retrieving and adjusting dcefclock power levels
Seems reasonable to me. With those changes,
________________________________
From: Quan, Evan
Sent: Tuesday, January 15, 2019 1:59:42 AM
To: Alex Deucher
Cc: amd-gfx list; Deucher, Alexander
Subject: RE: [PATCH 4/4] drm/amd/powerplay: support retrieving and adjusting dcefclock power levels
For ppfeatures, it will be seen only if (adev->asic_type >= CHIP_VEGA10 && !APU).
Regards,
Evan
Quoted 273 lines
-----Original Message-----
From: Quan, Evan
Sent: Tuesday, January 15, 2019 2:44 PM
To: Alex Deucher <[email protected]>
Cc: amd-gfx list <[email protected]>; Deucher, Alexander <[email protected]>
Subject: RE: [PATCH 4/4] drm/amd/powerplay: support retrieving and
adjusting dcefclock power levelsI think we can use
asic_typeto determine whether to expose these new interfaces.
If (adev->asic_type>=CHIP_VEGA10), socclk and dcefclk are OK to expose If (adev->asic_type>=CHIP_VEGA20), fclk is OK to exposeRegards,
EvanQuoted 38 lines
-----Original Message-----
From: Alex Deucher <[email protected]>
Sent: Tuesday, January 15, 2019 1:00 AM
To: Quan, Evan <[email protected]>
Cc: amd-gfx list <[email protected]>; Deucher, Alexander <[email protected]>
Subject: Re: [PATCH 4/4] drm/amd/powerplay: support retrieving and
adjusting dcefclock power levelsQuoted 6 lines · Evan Quan
User can use "
pp_dpm_dcefclk" to retrieve and adjust dcefclock power levels.Change-Id Ia3f61558ca96104c88d129ba5194103b2fe702ecSigned-off-by Evan Quan <[email protected]>We should probably find a way to hide these new files on asics which don't support them. Other than that, the series looks good to me.
Alex
Quoted 2 lines
--- drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c | 53++++++++++++++++++-
Quoted 2 lines
.../gpu/drm/amd/include/kgd_pp_interface.h | 1 + .../drm/amd/powerplay/hwmgr/vega20_hwmgr.c | 52+++++++++++++++++-
Quoted 10 lines
3 files changed, 103 insertions(+), 3 deletions(-)drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c +0
-0@@ -731,11 +731,13 @@ static ssize_t amdgpu_get_ppfeature_status(struct device *dev, }Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c static ssize_t · line 734
Quoted 2 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c +0
-1/** -* DOC: pp_dpm_sclk pp_dpm_mclk pp_dpm_socclk pp_dpm_fclk
pp_dpm_pcieQuoted 5 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c +3
-0+ * DOC: pp_dpm_sclk pp_dpm_mclk pp_dpm_socclk pp_dpm_fclk + pp_dpm_dcefclk + * pp_dpm_pcie * * The amdgpu driver provides a sysfs API for adjusting what powerlevels
Quoted 4 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c static ssize_t · line 741
Quoted 4 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c +1
-1* are enabled for a given power state. The files pp_dpm_sclk, pp_dpm_mclk, - * pp_dpm_socclk, pp_dpm_fclk and pp_dpm_pcie are used for this. + * pp_dpm_socclk, pp_dpm_fclk, pp_dpm_dcefclk and pp_dpm_pcieare
Quoted 20 lines
Quoted 7 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c +2
-0+ used for + * this. * * Reading back the files will show you the available power levels within * the power state and the clock information for those levels.@@ -745,6 +747,8 @@ static ssize_tamdgpu_get_ppfeature_status(struct
device *dev,
Quoted 12 lines
* Secondly,Enter a new value for each level by inputing a string that
* contains " echo xx xx xx > pp_dpm_sclk/mclk/pcie"
* E.g., echo 4 5 6 to >pp_dpm_sclkwill enable sclk levels 4, 5, and 6.
+ *
+ * NOTE: change to the dcefclk max dpm level is not supported now */static
ssize_tamdgpu_get_pp_dpm_sclk(struct device *dev, @@ -927,6
+931,42 @@ staticssize_tamdgpu_set_pp_dpm_fclk(struct device *dev,return count;}
Quoted 9 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c
Quoted 9 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c +9
-0+static ssize_t amdgpu_get_pp_dpm_dcefclk (struct device *dev, +struct device_attribute *attr, +char *buf) +{ +struct drm_device *ddev =dev_get_drvdata (dev); +struct amdgpu_device *adev = ddev->dev_private; + +if (adev->powerplay.pp_funcs->print_clock_levels) + return amdgpu_dpm_print_clock_levels(adev, PP_DCEFCLK,buf);
Quoted 72 lines
Quoted 52 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c +30
-0+else +return snprintf (buf,PAGE_SIZE ,"\n" ); } + +static ssize_t amdgpu_set_pp_dpm_dcefclk (struct device *dev, +struct device_attribute *attr, +const char *buf, +size_t count) +{ +struct drm_device *ddev =dev_get_drvdata (dev); +struct amdgpu_device *adev = ddev->dev_private; +int ret; +uint32_t mask =0 ; + + ret =amdgpu_read_mask (buf, count, &mask); +if (ret) +return ret; + +if (adev->powerplay.pp_funcs->force_clock_level) + ret =amdgpu_dpm_force_clock_level (adev,PP_DCEFCLK , + mask); + +if (ret) +return -EINVAL ; + +return count; +} +static ssize_t amdgpu_get_pp_dpm_pcie (struct device *dev,struct device_attribute *attr,char *buf)@@ -1216,6 +1256,9 @@ static DEVICE_ATTR(pp_dpm_socclk, S_IRUGO | S_IWUSR, static DEVICE_ATTR(pp_dpm_fclk, S_IRUGO | S_IWUSR, amdgpu_get_pp_dpm_fclk, amdgpu_set_pp_dpm_fclk); +static DEVICE_ATTR(pp_dpm_dcefclk, S_IRUGO | S_IWUSR, + amdgpu_get_pp_dpm_dcefclk, + amdgpu_set_pp_dpm_dcefclk); static DEVICE_ATTR(pp_dpm_pcie, S_IRUGO | S_IWUSR, amdgpu_get_pp_dpm_pcie, amdgpu_set_pp_dpm_pcie); @@ -2387,6 +2430,11 @@ int
amdgpu_pm_sysfs_init(struct amdgpu_device *adev)DRM_ERROR("failed to create device file pp_dpm_fclk\n"); return ret; }drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c +5
-0+ ret =device_create_file (adev->dev, &dev_attr_pp_dpm_dcefclk); +if (ret) { +DRM_ERROR ("failed to create device file pp_dpm_dcefclk\n" ); +return ret; + } ret =device_create_file (adev->dev, &dev_attr_pp_dpm_pcie);if (ret) { DRM_ERROR("failed to create device fileQuoted 1 line
pp_dpm_pcie\n"); @@ -2474,6 +2522,7 @@ void
amdgpu_pm_sysfs_fini(struct amdgpu_device *adev)Quoted 18 lines
device_remove_file(adev->dev, &dev_attr_pp_dpm_socclk); device_remove_file(adev->dev, &dev_attr_pp_dpm_pcie); device_remove_file(adev->dev, &dev_attr_pp_dpm_fclk); + device_remove_file(adev->dev, &dev_attr_pp_dpm_dcefclk); device_remove_file(adev->dev, &dev_attr_pp_sclk_od); device_remove_file(adev->dev, &dev_attr_pp_mclk_od); device_remove_file(adev->dev, diff --git
a/drivers/gpu/drm/amd/include/kgd_pp_interface.hb/drivers/gpu/drm/amd/include/kgd_pp_interface.h
indexf82de14f6560..2b579ba9b685100644drivers/gpu/drm/amd/include/kgd_pp_interface.h +1
-0@@ -94,6 +94,7 @@ enum pp_clock_type {PP_PCIE ,PP_SOCCLK ,PP_FCLK , +PP_DCEFCLK , OD_SCLK,Quoted 8 lines
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c static int
Quoted 8 lines
drivers/gpu/drm/amd/include/kgd_pp_interface.h +0
-0OD_MCLK , OD_VDDC_CURVE,drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c +0
-0@@ -1746,6 +1746,17 @@ static intvega20_upload_dpm_min_level(struct
Quoted 52 lines
pp_hwmgr*hwmgr,uint32_tfeature_drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c static int · line 1754
Quoted 9 lines
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c +6
-0return ret); } +if (data->smu_features[GNLD_DPM_DCEFCLK ].enabled && + (feature_mask &FEATURE_DPM_DCEFCLK_MASK )) { + min_freq = + data->dpm_table.dcef_table.dpm_state.hard_min_level; + + PP_ASSERT_WITH_CODE(!(ret =smum_send_msg_to_smc_with_parameter(
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c static int vega20_force_clock_level(struct
Quoted 10 lines
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c +6
-0+ hwmgr, PPSMC_MSG_SetHardMinByFreq, + (PPCLK_DCEFCLK << 16) | (min_freq & 0xffff))), +"Failed to set hard min dcefclk!" , + return ret); + } +return ret; }@@ -2258,7 +2269,7 @@ static int vega20_force_clock_level(struct
pp_hwmgr*hwmgr,Quoted 19 lines
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c +7
-1enum pp_clock_type type, uint32_t mask) {struct vega20_hwmgr *data = (struct vega20_hwmgr *)(hwmgr- backend); -uint32_t soft_min_level, soft_max_level; +uint32_t soft_min_level, soft_max_level, hard_min_level;int ret =0 ;switch (type) {@@ -2373,6 +2384,28 @@ static int vega20_force_clock_level(structpp_hwmgr *hwmgr, break; +case PP_DCEFCLK : + hard_min_level = mask ? (ffs (mask) -1 ) :0 ; + +if (hard_min_level >= data->dpm_table.dcef_table.count) { + pr_err("Clock level specified %d is over max allowed %d\n", + hard_min_level,drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c static int vega20_force_clock_level(struct · line 2403
Quoted 10 lines
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c +10
-0+ data->dpm_table.dcef_table.count - 1); +return -EINVAL ; + } + + data->dpm_table.dcef_table.dpm_state.hard_min_level + = + + data->dpm_table.dcef_table.dpm_levels[hard_min_level].value; + + ret = vega20_upload_dpm_min_level(hwmgr,
FEATURE_DPM_DCEFCLK_MASK);Quoted 16 lines
Quoted 13 lines
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c +9
-1+PP_ASSERT_WITH_CODE (!ret, +"Failed to upload boot level to lowest!" , + return ret); + +//TODO: Setting DCEFCLK max dpm level is not +supported + + break; +case PP_PCIE : soft_min_level = mask ? (ffs (mask) -1 ) :0 ; soft_max_level = mask ? (fls(mask) - 1) : 0; @@ -3039,6 +3072,23 @@ static int vega20_print_clock_levels(structQuoted 1 line
pp_hwmgr*hwmgr,
Quoted 1 line
fclk_dpm_table->dpm_levels[i].value == (now / 100) ?"*" :
Quoted 25 lines
"");
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c
Quoted 5 lines
break;drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c +3
-0+case PP_DCEFCLK : + ret = vega20_get_current_clk_freq(hwmgr, + PPCLK_DCEFCLK,&now);
Quoted 18 lines
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c +15
-0+PP_ASSERT_WITH_CODE (!ret, +"Attempt to get current dcefclk freq Failed!" , + return ret); + + ret =vega20_get_dcefclocks (hwmgr, &clocks); +PP_ASSERT_WITH_CODE (!ret, +"Attempt to get dcefclk levels Failed!" , + return ret); + +for (i =0 ; i < clocks.num_levels; i++) + size +=sprintf (buf + size,"%d: %uMhz %s\n" , + i, clocks.data[i].clocks_in_khz /1000 , + (clocks.data[i].clocks_in_khz == now *10 ) ?"*" :"" ); +break ; +case PP_PCIE : gen_speed = (RREG32_PCIE(smnPCIE_LC_SPEED_CNTL) &
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
PSWUSP0_PCIE_LC_SPEED_CNTL__LC_CURRENT_DATA_RATE_MASK) --
2.20.1_______________________________________________
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
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c static int vega20_odn_edit_dpm_table(struct pp_hwmgr *hwmgr, · line 2860
Quoted 4 lines · Evan Quan
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c +4
-0+ features_to_disable = + (features_enabled ^ new_ppfeature_masks) & features_enabled; + features_to_enable = + (features_enabled ^ new_ppfeature_masks) ^ features_to_disable;
This is confusing and unnecessarily complicated. I think you can achieve the same thing in a more obvious way like this:
features_to_disable = features_enabled & ~new_pp_feature_masks;
features_to_enable = ~features_enabled & new_pp_feature_masks;Regards,
Felix
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx