drm/amdgpu/navi: fix index for OD MCLK
Subsystems (2)
PATCH 1/3 drm/amdgpu/navi: fix index for OD MCLK
You can only adjust the max mclk, not the min.
--- drivers/gpu/drm/amd/powerplay/navi10_ppt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/powerplay/navi10_ppt.c +1 -1
@@ -843,7 +843,7 @@ static int navi10_print_clk_levels(struct smu_context *smu,if (!navi10_od_feature_is_supported (od_settings,SMU_11_0_ODFEATURE_UCLK_MAX ))break ; size +=sprintf (buf + size,"OD_MCLK:\n" ); - size +=sprintf (buf + size,"0: %uMHz\n" , od_table->UclkFmax); + size +=sprintf (buf + size,"1: %uMHz\n" , od_table->UclkFmax);break ;case SMU_OD_VDDC_CURVE :if (!smu->od_enabled || !od_table || !od_settings)
Signature · 6 lines
2.24.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 2/3 drm/amdgpu/navi10: add OD_RANGE for navi overclocking
So users can see the range of valid values.
--- drivers/gpu/drm/amd/powerplay/navi10_ppt.c | 59 ++++++++++++++++++++++ 1 file changed, 59 insertions(+)
drivers/gpu/drm/amd/powerplay/navi10_ppt.c +59 -0
@@ -737,6 +737,15 @@ static inline bool navi10_od_feature_is_supported(struct smu_11_0_overdrive_tablreturn od_table->cap[feature]; } +static void navi10_od_setting_get_range (struct smu_11_0_overdrive_table *od_table, +enum SMU_11_0_ODSETTING_ID setting, +uint32_t *min,uint32_t *max) +{ +if (min) + *min = od_table->min[setting]; +if (max) + *max = od_table->max[setting]; +}static int navi10_print_clk_levels (struct smu_context *smu,enum smu_clk_type clk_type,char *buf)
@@ -755,6 +764,7 @@ static int navi10_print_clk_levels(struct smu_context *smu,OverDriveTable_t *od_table = (OverDriveTable_t *)table_context->overdrive_table;struct smu_11_0_overdrive_table *od_settings = smu->od_settings; +uint32_t min_value, max_value;switch (clk_type) {case SMU_GFXCLK :
@@ -867,6 +877,55 @@ static int navi10_print_clk_levels(struct smu_context *smu, } size +=sprintf (buf + size,"%d: %uMHz @ %umV\n" , i, curve_settings[0 ], curve_settings[1 ] /NAVI10_VOLTAGE_SCALE ); } +break ; +case SMU_OD_RANGE : +if (!smu->od_enabled || !od_table || !od_settings) +break ; + size =sprintf (buf,"%s:\n" ,"OD_RANGE" ); + +if (navi10_od_feature_is_supported (od_settings,SMU_11_0_ODFEATURE_GFXCLK_LIMITS )) { +navi10_od_setting_get_range (od_settings,SMU_11_0_ODSETTING_GFXCLKFMIN , + &min_value,NULL ); +navi10_od_setting_get_range (od_settings,SMU_11_0_ODSETTING_GFXCLKFMAX , +NULL , &max_value); + size +=sprintf (buf + size,"SCLK: %7uMhz %10uMhz\n" , + min_value, max_value); + } + +if (navi10_od_feature_is_supported (od_settings,SMU_11_0_ODFEATURE_UCLK_MAX )) { +navi10_od_setting_get_range (od_settings,SMU_11_0_ODSETTING_UCLKFMAX , + &min_value, &max_value); + size +=sprintf (buf + size,"MCLK: %7uMhz %10uMhz\n" , + min_value, max_value); + } + +if (navi10_od_feature_is_supported (od_settings,SMU_11_0_ODFEATURE_GFXCLK_CURVE )) { +navi10_od_setting_get_range (od_settings,SMU_11_0_ODSETTING_VDDGFXCURVEFREQ_P1 , + &min_value, &max_value); + size +=sprintf (buf + size,"VDDC_CURVE_SCLK[0]: %7uMhz %10uMhz\n" , + min_value, max_value); +navi10_od_setting_get_range (od_settings,SMU_11_0_ODSETTING_VDDGFXCURVEVOLTAGE_P1 , + &min_value, &max_value); + size +=sprintf (buf + size,"VDDC_CURVE_VOLT[0]: %7dmV %11dmV\n" , + min_value, max_value); +navi10_od_setting_get_range (od_settings,SMU_11_0_ODSETTING_VDDGFXCURVEFREQ_P2 , + &min_value, &max_value); + size +=sprintf (buf + size,"VDDC_CURVE_SCLK[1]: %7uMhz %10uMhz\n" , + min_value, max_value); +navi10_od_setting_get_range (od_settings,SMU_11_0_ODSETTING_VDDGFXCURVEVOLTAGE_P2 , + &min_value, &max_value); + size +=sprintf (buf + size,"VDDC_CURVE_VOLT[1]: %7dmV %11dmV\n" , + min_value, max_value); +navi10_od_setting_get_range (od_settings,SMU_11_0_ODSETTING_VDDGFXCURVEFREQ_P3 , + &min_value, &max_value); + size +=sprintf (buf + size,"VDDC_CURVE_SCLK[2]: %7uMhz %10uMhz\n" , + min_value, max_value); +navi10_od_setting_get_range (od_settings,SMU_11_0_ODSETTING_VDDGFXCURVEVOLTAGE_P3 , + &min_value, &max_value); + size +=sprintf (buf + size,"VDDC_CURVE_VOLT[2]: %7dmV %11dmV\n" , + min_value, max_value); + } +break ;default :break ;
Signature · 6 lines
2.24.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
RE: [PATCH 2/3] drm/amdgpu/navi10: add OD_RANGE for navi overclocking
-----Original Message-----
From: amd-gfx <[email protected]> On Behalf Of Alex Deucher
Sent: Thursday, January 30, 2020 2:18 AM
To: [email protected]
Cc: Deucher, Alexander <[email protected]>
Subject: [PATCH 2/3] drm/amdgpu/navi10: add OD_RANGE for navi overclocking
So users can see the range of valid values.
--- drivers/gpu/drm/amd/powerplay/navi10_ppt.c | 59 ++++++++++++++++++++++ 1 file changed, 59 insertions(+)
drivers/gpu/drm/amd/powerplay/navi10_ppt.c +9 -0
@@ -737,6 +737,15 @@ static inline bool navi10_od_feature_is_supported(struct smu_11_0_overdrive_tablreturn od_table->cap[feature]; } +static void navi10_od_setting_get_range (struct smu_11_0_overdrive_table *od_table, +enum SMU_11_0_ODSETTING_ID setting, +uint32_t *min,uint32_t *max) +{ +if (min) + *min = od_table->min[setting]; +if (max) + *max = od_table->max[setting]; +}static int navi10_print_clk_levels (struct smu_context *smu, enum smu_clk_type clk_type, char *buf) @@ -755,6 +764,7 @@ static int navi10_print_clk_levels(struct smu_context *smu,
OverDriveTable_t *od_table =
(OverDriveTable_t *)table_context->overdrive_table;
struct smu_11_0_overdrive_table *od_settings = smu->od_settings;
+ uint32_t min_value, max_value;
switch (clk_type) {
case SMU_GFXCLK:
@@ -867,6 +877,55 @@ static int navi10_print_clk_levels(struct smu_context *smu,
}
size += sprintf(buf + size, "%d: %uMHz @ %umV\n", i, curve_settings[0], curve_settings[1] / NAVI10_VOLTAGE_SCALE);
}
+ break;
+ case SMU_OD_RANGE:
+ if (!smu->od_enabled || !od_table || !od_settings)
+ break;
+ size = sprintf(buf, "%s:\n", "OD_RANGE");
+
+ if (navi10_od_feature_is_supported(od_settings, SMU_11_0_ODFEATURE_GFXCLK_LIMITS)) {
+ navi10_od_setting_get_range(od_settings, SMU_11_0_ODSETTING_GFXCLKFMIN,
+ &min_value, NULL);
+ navi10_od_setting_get_range(od_settings, SMU_11_0_ODSETTING_GFXCLKFMAX,
+ NULL, &max_value);
+ size += sprintf(buf + size, "SCLK: %7uMhz %10uMhz\n",
+ min_value, max_value);
+ }
+
+ if (navi10_od_feature_is_supported(od_settings, SMU_11_0_ODFEATURE_UCLK_MAX)) {
+ navi10_od_setting_get_range(od_settings, SMU_11_0_ODSETTING_UCLKFMAX,
+ &min_value, &max_value);
+ size += sprintf(buf + size, "MCLK: %7uMhz %10uMhz\n",
+ min_value, max_value);
+ }
+
+ if (navi10_od_feature_is_supported(od_settings, SMU_11_0_ODFEATURE_GFXCLK_CURVE)) {
+ navi10_od_setting_get_range(od_settings, SMU_11_0_ODSETTING_VDDGFXCURVEFREQ_P1,
+ &min_value, &max_value);
+ size += sprintf(buf + size, "VDDC_CURVE_SCLK[0]: %7uMhz %10uMhz\n",
+ min_value, max_value);
+ navi10_od_setting_get_range(od_settings, SMU_11_0_ODSETTING_VDDGFXCURVEVOLTAGE_P1,
+ &min_value, &max_value);
+ size += sprintf(buf + size, "VDDC_CURVE_VOLT[0]: %7dmV %11dmV\n",
+ min_value, max_value);
+ navi10_od_setting_get_range(od_settings, SMU_11_0_ODSETTING_VDDGFXCURVEFREQ_P2,
+ &min_value, &max_value);
+ size += sprintf(buf + size, "VDDC_CURVE_SCLK[1]: %7uMhz %10uMhz\n",
+ min_value, max_value);
+ navi10_od_setting_get_range(od_settings, SMU_11_0_ODSETTING_VDDGFXCURVEVOLTAGE_P2,
+ &min_value, &max_value);
+ size += sprintf(buf + size, "VDDC_CURVE_VOLT[1]: %7dmV %11dmV\n",
+ min_value, max_value);
+ navi10_od_setting_get_range(od_settings, SMU_11_0_ODSETTING_VDDGFXCURVEFREQ_P3,
+ &min_value, &max_value);
+ size += sprintf(buf + size, "VDDC_CURVE_SCLK[2]: %7uMhz %10uMhz\n",
+ min_value, max_value);
+ navi10_od_setting_get_range(od_settings, SMU_11_0_ODSETTING_VDDGFXCURVEVOLTAGE_P3,
+ &min_value, &max_value);
+ size += sprintf(buf + size, "VDDC_CURVE_VOLT[2]: %7dmV %11dmV\n",
+ min_value, max_value);
+ }
+
break;
default:
break;
--
2.24.1
_______________________________________________
amd-gfx mailing list
[email protected]
https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.freedesktop.org%2Fmailman%2Flistinfo%2Famd-gfx&data=02%7C01%7Cevan.quan%40amd.com%7C0e007c1c61d74ee6f6fb08d7a4e79680%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637159186942374776&sdata=pkI2xsrGq0EJNMaWU5r53%2Fv2CJ4p1ngxeaqHulbeoFo%3D&reserved=0
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 3/3 drm/amdgpu/smu_v11_0: Correct behavior of restoring default tables (v2)
In reply to Alex DeucherFrom: Matt Coffin <[email protected]>
Previously, the syfs functionality for restoring the default powerplay table was sourcing it's information from the currently-staged powerplay table.
This patch adds a step to cache the first overdrive table that we see on boot, so that it can be used later to "restore" the powerplay table
v2: sqaush my original with Matt's fix
--- .../gpu/drm/amd/powerplay/inc/amdgpu_smu.h | 1 + drivers/gpu/drm/amd/powerplay/navi10_ppt.c | 7 +++++ drivers/gpu/drm/amd/powerplay/smu_v11_0.c | 6 ++++ drivers/gpu/drm/amd/powerplay/vega20_ppt.c | 28 ++++++------------- 4 files changed, 22 insertions(+), 20 deletions(-)
drivers/gpu/drm/amd/powerplay/inc/amdgpu_smu.h +1 -0
@@ -273,6 +273,7 @@ struct smu_table_contextuint8_t thermal_controller_type;void *overdrive_table; +void *boot_overdrive_table; };struct smu_dpm_context {
drivers/gpu/drm/amd/powerplay/navi10_ppt.c +7 -0
@@ -2063,6 +2063,13 @@ static int navi10_od_edit_dpm_table(struct smu_context *smu, enum PP_OD_DPM_TABLreturn ret; od_table->UclkFmax = input[1 ];break ; +case PP_OD_RESTORE_DEFAULT_TABLE : +if (!(table_context->overdrive_table && table_context->boot_overdrive_table)) { +pr_err ("Overdrive table was not initialized!\n" ); +return -EINVAL ; + } +memcpy (table_context->overdrive_table, table_context->boot_overdrive_table,sizeof (OverDriveTable_t)); +break ;case PP_OD_COMMIT_DPM_TABLE :navi10_dump_od_table (od_table); ret =smu_update_table (smu,SMU_TABLE_OVERDRIVE ,0 , (void *)od_table, true);
drivers/gpu/drm/amd/powerplay/smu_v11_0.c +6 -0
@@ -1882,6 +1882,12 @@ int smu_v11_0_set_default_od_settings(struct smu_context *smu, bool initialize,pr_err ("Failed to export overdrive table!\n" );return ret; } +if (!table_context->boot_overdrive_table) { + table_context->boot_overdrive_table =kmemdup (table_context->overdrive_table, overdrive_table_size,GFP_KERNEL ); +if (!table_context->boot_overdrive_table) { +return -ENOMEM ; + } + } } ret =smu_update_table (smu,SMU_TABLE_OVERDRIVE ,0 , table_context->overdrive_table, true);if (ret) {
drivers/gpu/drm/amd/powerplay/vega20_ppt.c +8 -20
@@ -1706,22 +1706,11 @@ static int vega20_set_default_od_settings(struct smu_context *smu,struct smu_table_context *table_context = &smu->smu_table;int ret; -if (initialize) { -if (table_context->overdrive_table) -return -EINVAL ; - - table_context->overdrive_table =kzalloc (sizeof (OverDriveTable_t),GFP_KERNEL ); - -if (!table_context->overdrive_table) -return -ENOMEM ; - - ret =smu_update_table (smu,SMU_TABLE_OVERDRIVE ,0 , - table_context->overdrive_table, false); -if (ret) { -pr_err ("Failed to export over drive table!\n" ); -return ret; - } + ret =smu_v11_0_set_default_od_settings (smu, initialize,sizeof (OverDriveTable_t)); +if (ret) +return ret; +if (initialize) { ret =vega20_set_default_od8_setttings (smu);if (ret)return ret;
@@ -2778,12 +2767,11 @@ static int vega20_odn_edit_dpm_table(struct smu_context *smu,break ;case PP_OD_RESTORE_DEFAULT_TABLE : - ret =smu_update_table (smu,SMU_TABLE_OVERDRIVE ,0 , table_context->overdrive_table, false); -if (ret) { -pr_err ("Failed to export over drive table!\n" ); -return ret; +if (!(table_context->overdrive_table && table_context->boot_overdrive_table)) { +pr_err ("Overdrive table was not initialized!\n" ); +return -EINVAL ; } - +memcpy (table_context->overdrive_table, table_context->boot_overdrive_table,sizeof (OverDriveTable_t));break ;case PP_OD_COMMIT_DPM_TABLE :
Signature · 6 lines
2.24.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Re: [PATCH 3/3] drm/amdgpu/smu_v11_0: Correct behavior of restoring default tables (v2)
It's worth noting here that I don't have a vega20 card to test with, so it might be prudent to get a Tested-by from someone that has access to one.
It *should* work since it's so similar to the navi10 code, but it is moderately un-tested.
Quoted 108 lines · Alex Deucher
From: Matt Coffin <[email protected]>
Previously, the syfs functionality for restoring the default powerplay table was sourcing it's information from the currently-staged powerplay table.
This patch adds a step to cache the first overdrive table that we see on boot, so that it can be used later to "restore" the powerplay table
v2: sqaush my original with Matt's fix
Signed-off-by Matt Coffin <[email protected]>Reviewed-by Alex Deucher <[email protected]>Signed-off-by Alex Deucher <[email protected]>--- .../gpu/drm/amd/powerplay/inc/amdgpu_smu.h | 1 + drivers/gpu/drm/amd/powerplay/navi10_ppt.c | 7 +++++ drivers/gpu/drm/amd/powerplay/smu_v11_0.c | 6 ++++ drivers/gpu/drm/amd/powerplay/vega20_ppt.c | 28 ++++++------------- 4 files changed, 22 insertions(+), 20 deletions(-)drivers/gpu/drm/amd/powerplay/inc/amdgpu_smu.h +1
-0@@ -273,6 +273,7 @@ struct smu_table_contextuint8_t thermal_controller_type;void *overdrive_table; +void *boot_overdrive_table; };struct smu_dpm_context {drivers/gpu/drm/amd/powerplay/navi10_ppt.c +7
-0@@ -2063,6 +2063,13 @@ static int navi10_od_edit_dpm_table(struct smu_context *smu, enum PP_OD_DPM_TABLreturn ret; od_table->UclkFmax = input[1 ];break ; +case PP_OD_RESTORE_DEFAULT_TABLE : +if (!(table_context->overdrive_table && table_context->boot_overdrive_table)) { +pr_err ("Overdrive table was not initialized!\n" ); +return -EINVAL ; + } +memcpy (table_context->overdrive_table, table_context->boot_overdrive_table,sizeof (OverDriveTable_t)); +break ;case PP_OD_COMMIT_DPM_TABLE :navi10_dump_od_table (od_table); ret =smu_update_table (smu,SMU_TABLE_OVERDRIVE ,0 , (void *)od_table, true);drivers/gpu/drm/amd/powerplay/smu_v11_0.c +6
-0@@ -1882,6 +1882,12 @@ int smu_v11_0_set_default_od_settings(struct smu_context *smu, bool initialize,pr_err ("Failed to export overdrive table!\n" );return ret; } +if (!table_context->boot_overdrive_table) { + table_context->boot_overdrive_table =kmemdup (table_context->overdrive_table, overdrive_table_size,GFP_KERNEL ); +if (!table_context->boot_overdrive_table) { +return -ENOMEM ; + } + } } ret =smu_update_table (smu,SMU_TABLE_OVERDRIVE ,0 , table_context->overdrive_table, true);if (ret) {drivers/gpu/drm/amd/powerplay/vega20_ppt.c +4
-18@@ -1706,22 +1706,11 @@ static int vega20_set_default_od_settings(struct smu_context *smu,struct smu_table_context *table_context = &smu->smu_table;int ret; -if (initialize) { -if (table_context->overdrive_table) -return -EINVAL ; - - table_context->overdrive_table =kzalloc (sizeof (OverDriveTable_t),GFP_KERNEL ); - -if (!table_context->overdrive_table) -return -ENOMEM ; - - ret =smu_update_table (smu,SMU_TABLE_OVERDRIVE ,0 , - table_context->overdrive_table, false); -if (ret) { -pr_err ("Failed to export over drive table!\n" ); -return ret; - } + ret =smu_v11_0_set_default_od_settings (smu, initialize,sizeof (OverDriveTable_t)); +if (ret) +return ret; +if (initialize) { ret =vega20_set_default_od8_setttings (smu);if (ret)return ret;@@ -2778,12 +2767,11 @@ static int vega20_odn_edit_dpm_table(struct smu_context *smu,break ;case PP_OD_RESTORE_DEFAULT_TABLE : - ret =smu_update_table (smu,SMU_TABLE_OVERDRIVE ,0 , table_context->overdrive_table, false); -if (ret) { -pr_err ("Failed to export over drive table!\n" );
drivers/gpu/drm/amd/powerplay/vega20_ppt.c static int vega20_odn_edit_dpm_table(struct smu_context *smu, · line 2777
Quoted 10 lines
drivers/gpu/drm/amd/powerplay/vega20_ppt.c +4
-2-return ret; +if (!(table_context->overdrive_table && table_context->boot_overdrive_table)) { +pr_err ("Overdrive table was not initialized!\n" ); +return -EINVAL ; } - +memcpy (table_context->overdrive_table, table_context->boot_overdrive_table,sizeof (OverDriveTable_t));break ;case PP_OD_COMMIT_DPM_TABLE :
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
-----Original Message-----
From: amd-gfx <[email protected]> On Behalf Of Alex Deucher
Sent: Thursday, January 30, 2020 2:18 AM
To: [email protected]
Cc: Deucher, Alexander <[email protected]>
Subject: [PATCH 1/3] drm/amdgpu/navi: fix index for OD MCLK
You can only adjust the max mclk, not the min.
--- drivers/gpu/drm/amd/powerplay/navi10_ppt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/powerplay/navi10_ppt.c +1 -1
@@ -843,7 +843,7 @@ static int navi10_print_clk_levels(struct smu_context *smu,if (!navi10_od_feature_is_supported (od_settings,SMU_11_0_ODFEATURE_UCLK_MAX ))break ; size +=sprintf (buf + size,"OD_MCLK:\n" ); - size +=sprintf (buf + size,"0: %uMHz\n" , od_table->UclkFmax); + size +=sprintf (buf + size,"1: %uMHz\n" , od_table->UclkFmax);break ;case SMU_OD_VDDC_CURVE :if (!smu->od_enabled || !od_table || !od_settings)
Signature · 10 lines
2.24.1 _______________________________________________ amd-gfx mailing list [email protected] https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.freedesktop.org%2Fmailman%2Flistinfo%2Famd-gfx&data=02%7C01%7Cevan.quan%40amd.com%7C7417fff1d6244791b42408d7a4e79457%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637159186863472587&sdata=tpoWeKNdPMcF6hff7tWNxeLOJe%2Bo9KuPPoe3n8F5tXo%3D&reserved=0 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx