drm/amd/powerplay: added vega20 overdrive support
Subsystems (2)
PATCH 1/1 drm/amd/powerplay: added vega20 overdrive support
Vega20 supports only sclk voltage overdrive. And user can only tell three groups of <frequency, voltage_offset>. SMU firmware will recalculate the frequency/voltage curve. Other intermediate levles will be stretched/shrunk accordingly.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c | 26 +++ .../drm/amd/powerplay/hwmgr/vega20_hwmgr.c | 165 +++++++++++++++++- .../drm/amd/powerplay/hwmgr/vega20_hwmgr.h | 2 + 3 files changed, 192 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c +26 -0
@@ -474,6 +474,8 @@ static ssize_t amdgpu_set_pp_table(struct device *dev,* in each power level within a power state. The pp_od_clk_voltage is used for * this. * +* < For Vega10 and previous ASICs > +* * Reading the file will display: * * - a list of engine clock levels and voltages labeled OD_SCLK
@@ -491,6 +493,30 @@ static ssize_t amdgpu_set_pp_table(struct device *dev,* "c" (commit) to the file to commit your changes. If you want to reset to the * default power levels, write "r" (reset) to the file to reset them. * +* +* < For Vega20 > +* +* Reading the file will display: +* +* - three groups of engine clock and voltage offset labeled OD_SCLK +* +* - a list of valid ranges for above three groups of sclk and voltage offset +* labeled OD_RANGE +* +* To manually adjust these settings: +* +* - First select manual using power_dpm_force_performance_level +* +* - Enter a new value for each group by writing a string that contains +* "s group_index clock voltage_offset" to the file. E.g., "s 0 500 20" +* will update group1 sclk to be 500 MHz with voltage increased 20mV +* +* - When you have edited all of the states as needed, write "c" (commit) +* to the file to commit your changes +* +* - If you want to reset to the default power levels, write "r" (reset) +* to the file to reset them +* */ static ssize_t amdgpu_set_pp_od_clk_voltage(struct device *dev,
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c +164 -1
193 lines not on this page · raw message
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.h +2 -0
@@ -513,6 +513,8 @@ struct vega20_hwmgr {/* ---- Gfxoff ---- */ bool gfxoff_allowed;uint32_t counter_gfxoff; + +OverDriveTable_t od_table; };#define VEGA20_DPM2_NEAR_TDP_DEC 10
Signature · 6 lines
2.18.0 _______________________________________________ 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]
Dear Evan,
Quoted 2 lines · Evan Quan
Vega20 supports only sclk voltage overdrive. And user can only tell three groups of <frequency,
voltage_offset>. SMU
Do you mean: The user can only configure three groups of …?
Quoted 2 lines
firmware will recalculate the frequency/voltage curve. Other intermediate levles will be stretched/shrunk accordingly.
levels
(A spell checker should detect simple typos.)
Quoted 32 lines
Change-Id I403cb38a95863db664cf06d030ac42a19bff6b33Signed-off-by Evan Quan <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c | 26 +++ .../drm/amd/powerplay/hwmgr/vega20_hwmgr.c | 165 +++++++++++++++++- .../drm/amd/powerplay/hwmgr/vega20_hwmgr.h | 2 + 3 files changed, 192 insertions(+), 1 deletion(-)drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c +9
-0@@ -474,6 +474,8 @@ static ssize_t amdgpu_set_pp_table(struct device *dev,* in each power level within a power state. The pp_od_clk_voltage is used for * this. * +* < For Vega10 and previous ASICs > +* * Reading the file will display: * * - a list of engine clock levels and voltages labeled OD_SCLK @@ -491,6 +493,30 @@ static ssize_t amdgpu_set_pp_table(struct device *dev,* "c" (commit) to the file to commit your changes. If you want to reset to the * default power levels, write "r" (reset) to the file to reset them. * +* +* < For Vega20 > +* +* Reading the file will display: +* +* - three groups of engine clock and voltage offset labeled OD_SCLK +*
drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c static ssize_t amdgpu_set_pp_table(struct device *dev, · line 512
Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c +10
-0+* - a list of valid ranges for above three groups of sclk and voltage offset +* labeled OD_RANGE +* +* To manually adjust these settings: +* +* - First select manual using power_dpm_force_performance_level +* +* - Enter a new value for each group by writing a string that contains +* "s group_index clock voltage_offset" to the file. E.g., "s 0 500 20" +* will update group1 sclk to be 500 MHz with voltage increased 20mV
increased *by* 20mV? by or to?
Quoted 15 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c +7
-0+* +* - When you have edited all of the states as needed, write "c" (commit) +* to the file to commit your changes +* +* - If you want to reset to the default power levels, write "r" (reset) +* to the file to reset them +* */ static ssize_t amdgpu_set_pp_od_clk_voltage(struct device *dev,drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c +0
-0
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c static int vega20_od8_initialize_default_settings( · line 1103
Quoted 8 lines
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c +5
-0@@ -1096,6 +1096,13 @@ static int vega20_od8_initialize_default_settings( } } + ret =vega20_copy_table_from_smc (hwmgr, + (uint8_t *)(&data->od_table), +TABLE_OVERDRIVE ); + PP_ASSERT_WITH_CODE(!ret, + "Failed to export over drive table!",
*over drive* or *overdrive*
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c static int vega20_set_watermarks_for_clocks_ranges(struct pp_hwmgr *hwmgr, · line 2518
Quoted 12 lines
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c +5
-0+ return ret); +return 0 ; }@@ -2506,11 +2513,112 @@ static int vega20_set_watermarks_for_clocks_ranges(struct pp_hwmgr *hwmgr,return 0 ; } +static int vega20_odn_edit_dpm_table (struct pp_hwmgr *hwmgr, +enum PP_OD_DPM_TABLE_COMMAND type, +long *input,uint32_t size)
What is size? Could it be size_t or just int?
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c static int vega20_set_watermarks_for_clocks_ranges(struct pp_hwmgr *hwmgr, · line 2524
Quoted 6 lines
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c +6
-0+{ +struct vega20_hwmgr *data = + (struct vega20_hwmgr *)(hwmgr->backend); +struct vega20_od8_single_setting *od8_settings = + data->od8_settings.od8_settings_array; +OverDriveTable_t od_table;
Is CamelCase wanted?
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c static int vega20_set_watermarks_for_clocks_ranges(struct pp_hwmgr *hwmgr, · line 2526
Quoted 2 lines
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c +2
-0+int32_t input_index, input_clk, input_vol, i; +int ret =0 ;
Is the initialization needed?
Quoted 9 lines
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c +9
-0+ +PP_ASSERT_WITH_CODE (input,"NULL user input for clock and voltage" , + return -EINVAL ); + +switch (type) { +case PP_OD_EDIT_SCLK_VDDC_TABLE : + if (!(od8_settings[OD8_SETTING_GFXCLK_FREQ1].feature_id && + od8_settings[OD8_SETTING_GFXCLK_FREQ2].feature_id && + od8_settings[OD8_SETTING_GFXCLK_FREQ3].feature_id &&
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c static int vega20_set_watermarks_for_clocks_ranges(struct pp_hwmgr *hwmgr, · line 2545
Quoted 10 lines
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c +10
-0+ od8_settings[OD8_SETTING_GFXCLK_VOLTAGE1].feature_id && + od8_settings[OD8_SETTING_GFXCLK_VOLTAGE2].feature_id && + od8_settings[OD8_SETTING_GFXCLK_VOLTAGE3].feature_id)) { +pr_info ("Sclk voltage overdrive not supported\n" ); +return 0 ; + } + +for (i =0 ; i < size; i +=3 ) { +if (i +3 > size) { +pr_info ("invalid clock voltage input\n" );
As this is log level *Info* I’d say it should be better understandable for the user. Also, why not print the values?
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c static int vega20_set_watermarks_for_clocks_ranges(struct pp_hwmgr *hwmgr, · line 2558
Quoted 13 lines
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c +13
-0+return 0 ; + } + + input_index = input[i]; + input_clk = input[i +1 ]; + input_vol = input[i +2 ]; +if (input_index >2 || + input_clk < od8_settings[OD8_SETTING_GFXCLK_FREQ1 + input_index *2 ].min_value || + input_clk > od8_settings[OD8_SETTING_GFXCLK_FREQ1 + input_index *2 ].max_value || + input_vol < od8_settings[OD8_SETTING_GFXCLK_VOLTAGE1 + input_index *2 ].min_value || + input_vol > od8_settings[OD8_SETTING_GFXCLK_VOLTAGE1 + input_index *2 ].max_value) { +pr_info ("input argument is not within allowed range\n" ); +return -EINVAL ;
Ditto. Maybe even print the values?
Quoted 11 lines
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c +11
-0+ } + +switch (input_index) { +case 0 : + data->od_table.GfxclkFreq1 = input_clk; + data->od_table.GfxclkOffsetVolt1 = input_vol; +break ; +case 1 : + data->od_table.GfxclkFreq2 = input_clk; + data->od_table.GfxclkOffsetVolt2 = input_vol; +break ;
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c static int vega20_set_watermarks_for_clocks_ranges(struct pp_hwmgr *hwmgr, · line 2579
Quoted 10 lines
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c +10
-0+case 2 : + data->od_table.GfxclkFreq3 = input_clk; + data->od_table.GfxclkOffsetVolt3 = input_vol; +break ; + } + } +break ; + +case PP_OD_EDIT_MCLK_VDDC_TABLE : +pr_info ("Mclk voltage overdrive not supported!\n" );
Ditto.
Quoted 120 lines
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c +93
-1+break ; + +case PP_OD_RESTORE_DEFAULT_TABLE : + ret =vega20_copy_table_from_smc (hwmgr, + (uint8_t *)(&od_table), +TABLE_OVERDRIVE ); +PP_ASSERT_WITH_CODE (!ret, +"Failed to export over drive table!" , + return ret); + +memcpy (&data->od_table, &od_table,sizeof (od_table)); +break ; + +case PP_OD_COMMIT_DPM_TABLE : +memcpy (&od_table, &data->od_table,sizeof (od_table)); + + ret =vega20_copy_table_to_smc (hwmgr, + (uint8_t *)(&od_table), +TABLE_OVERDRIVE ); +PP_ASSERT_WITH_CODE (!ret, +"Failed to import over drive table!" , + return ret); + +break ; + +default : +return -EINVAL ; + } + +return 0 ; +} +static int vega20_print_clock_levels (struct pp_hwmgr *hwmgr,enum pp_clock_type type,char *buf) { -int i, now, size =0 ; +struct vega20_hwmgr *data = + (struct vega20_hwmgr *)(hwmgr->backend); +struct vega20_od8_single_setting *od8_settings = + data->od8_settings.od8_settings_array; +OverDriveTable_t *od_table = &data->od_table;struct pp_clock_levels_with_latency clocks; +int i, now, size =0 ;int ret =0 ;switch (type) {@@ -2551,6 +2659,59 @@ static int vega20_print_clock_levels(struct pp_hwmgr *hwmgr,case PP_PCIE :break ; +case OD_SCLK : +if (od8_settings[OD8_SETTING_GFXCLK_FREQ1 ].feature_id && + od8_settings[OD8_SETTING_GFXCLK_FREQ2 ].feature_id && + od8_settings[OD8_SETTING_GFXCLK_FREQ3 ].feature_id && + od8_settings[OD8_SETTING_GFXCLK_VOLTAGE1 ].feature_id && + od8_settings[OD8_SETTING_GFXCLK_VOLTAGE2 ].feature_id && + od8_settings[OD8_SETTING_GFXCLK_VOLTAGE3 ].feature_id) { + + size =sprintf (buf,"%s:\n" ,"OD_SCLK" ); + size +=sprintf (buf + size,"0: %10uMhz %10dmV\n" , + od_table->GfxclkFreq1, + od_table->GfxclkOffsetVolt1); + size +=sprintf (buf + size,"1: %10uMhz %10dmV\n" , + od_table->GfxclkFreq2, + od_table->GfxclkOffsetVolt2); + size +=sprintf (buf + size,"2: %10uMhz %10dmV\n" , + od_table->GfxclkFreq3, + od_table->GfxclkOffsetVolt3); + } +break ; + +case OD_MCLK : +break ; + +case OD_RANGE : +if (od8_settings[OD8_SETTING_GFXCLK_FREQ1 ].feature_id && + od8_settings[OD8_SETTING_GFXCLK_FREQ2 ].feature_id && + od8_settings[OD8_SETTING_GFXCLK_FREQ3 ].feature_id && + od8_settings[OD8_SETTING_GFXCLK_VOLTAGE1 ].feature_id && + od8_settings[OD8_SETTING_GFXCLK_VOLTAGE2 ].feature_id && + od8_settings[OD8_SETTING_GFXCLK_VOLTAGE3 ].feature_id) { + + size =sprintf (buf,"%s:\n" ,"OD_RANGE" ); + size +=sprintf (buf + size,"SCLK[0]: %7uMhz %10uMhz\n" , + od8_settings[OD8_SETTING_GFXCLK_FREQ1 ].min_value, + od8_settings[OD8_SETTING_GFXCLK_FREQ1 ].max_value); + size +=sprintf (buf + size,"VDDC[0]: %7dmV %11dmV\n" , + od8_settings[OD8_SETTING_GFXCLK_VOLTAGE1 ].min_value, + od8_settings[OD8_SETTING_GFXCLK_VOLTAGE1 ].max_value); + size +=sprintf (buf + size,"SCLK[1]: %7uMhz %10uMhz\n" , + od8_settings[OD8_SETTING_GFXCLK_FREQ2 ].min_value, + od8_settings[OD8_SETTING_GFXCLK_FREQ2 ].max_value); + size +=sprintf (buf + size,"VDDC[1]: %7dmV %11dmV\n" , + od8_settings[OD8_SETTING_GFXCLK_VOLTAGE2 ].min_value, + od8_settings[OD8_SETTING_GFXCLK_VOLTAGE2 ].max_value); + size +=sprintf (buf + size,"SCLK[2]: %7uMhz %10uMhz\n" , + od8_settings[OD8_SETTING_GFXCLK_FREQ3 ].min_value, + od8_settings[OD8_SETTING_GFXCLK_FREQ3 ].max_value); + size +=sprintf (buf + size,"VDDC[2]: %7dmV %11dmV\n" , + od8_settings[OD8_SETTING_GFXCLK_VOLTAGE3 ].min_value, + od8_settings[OD8_SETTING_GFXCLK_VOLTAGE3 ].max_value); + } +break ;default :break ; }@@ -3162,6 +3323,8 @@ static const struct pp_hwmgr_func vega20_hwmgr_funcs = { vega20_get_mclk_od, .set_mclk_od = vega20_set_mclk_od, + .odn_edit_dpm_table = + vega20_odn_edit_dpm_table,/* for sysfs to retrive/set gfxclk/memclk */ .force_clock_level = vega20_force_clock_level,drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.h +0
-0
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.h struct vega20_hwmgr { · line 520
Quoted 8 lines
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.h +2
-0@@ -513,6 +513,8 @@ struct vega20_hwmgr {/* ---- Gfxoff ---- */ bool gfxoff_allowed;uint32_t counter_gfxoff; + +OverDriveTable_t od_table; };#define VEGA20_DPM2_NEAR_TDP_DEC 10
Kind regards,
Paul
_______________________________________________
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): 563a3d9d-07d2-4d69-cf54-49b0a5989fde-KUpvgZVWgV9o1qOY/[email protected]
Dear Evan,
I forgot, that in the commit message summary, the imperative mood should be used.
Quoted 1 line
Add vega20 overdrive support
Quoted 303 lines · Paul Menzel
Quoted 2 lines · Evan Quan
Vega20 supports only sclk voltage overdrive. And user can only tell three groups of <frequency,
voltage_offset>. SMUDo you mean: The user can only configure three groups of …?
Quoted 2 lines
firmware will recalculate the frequency/voltage curve. Other intermediate levles will be stretched/shrunk accordingly.
levels
(A spell checker should detect simple typos.)
Quoted 32 lines
Change-Id I403cb38a95863db664cf06d030ac42a19bff6b33Signed-off-by Evan Quan <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c | 26 +++ .../drm/amd/powerplay/hwmgr/vega20_hwmgr.c | 165 +++++++++++++++++- .../drm/amd/powerplay/hwmgr/vega20_hwmgr.h | 2 + 3 files changed, 192 insertions(+), 1 deletion(-)drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c +9
-0@@ -474,6 +474,8 @@ static ssize_t amdgpu_set_pp_table(struct device *dev,* in each power level within a power state. The pp_od_clk_voltage is used for * this. * +* < For Vega10 and previous ASICs > +* * Reading the file will display: * * - a list of engine clock levels and voltages labeled OD_SCLK @@ -491,6 +493,30 @@ static ssize_t amdgpu_set_pp_table(struct device *dev,* "c" (commit) to the file to commit your changes. If you want to reset to the * default power levels, write "r" (reset) to the file to reset them. * +* +* < For Vega20 > +* +* Reading the file will display: +* +* - three groups of engine clock and voltage offset labeled OD_SCLK +* drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c static ssize_t amdgpu_set_pp_table(struct device *dev, · line 512
Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c +10
-0+* - a list of valid ranges for above three groups of sclk and voltage offset +* labeled OD_RANGE +* +* To manually adjust these settings: +* +* - First select manual using power_dpm_force_performance_level +* +* - Enter a new value for each group by writing a string that contains +* "s group_index clock voltage_offset" to the file. E.g., "s 0 500 20" +* will update group1 sclk to be 500 MHz with voltage increased 20mV increased *by* 20mV? by or to?
Quoted 15 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c +7
-0+* +* - When you have edited all of the states as needed, write "c" (commit) +* to the file to commit your changes +* +* - If you want to reset to the default power levels, write "r" (reset) +* to the file to reset them +* */ static ssize_t amdgpu_set_pp_od_clk_voltage(struct device *dev,drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c +0
-0drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c static int vega20_od8_initialize_default_settings( · line 1103
Quoted 8 lines
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c +5
-0@@ -1096,6 +1096,13 @@ static int vega20_od8_initialize_default_settings( } } + ret =vega20_copy_table_from_smc (hwmgr, + (uint8_t *)(&data->od_table), +TABLE_OVERDRIVE ); + PP_ASSERT_WITH_CODE(!ret, + "Failed to export over drive table!",*over drive* or *overdrive*
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c static int vega20_set_watermarks_for_clocks_ranges(struct pp_hwmgr *hwmgr, · line 2518
Quoted 12 lines
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c +5
-0+ return ret); +return 0 ; }@@ -2506,11 +2513,112 @@ static int vega20_set_watermarks_for_clocks_ranges(struct pp_hwmgr *hwmgr,return 0 ; } +static int vega20_odn_edit_dpm_table (struct pp_hwmgr *hwmgr, +enum PP_OD_DPM_TABLE_COMMAND type, +long *input,uint32_t size)What is size? Could it be
size_tor just int?drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c static int vega20_set_watermarks_for_clocks_ranges(struct pp_hwmgr *hwmgr, · line 2524
Quoted 6 lines
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c +6
-0+{ +struct vega20_hwmgr *data = + (struct vega20_hwmgr *)(hwmgr->backend); +struct vega20_od8_single_setting *od8_settings = + data->od8_settings.od8_settings_array; +OverDriveTable_t od_table;Is CamelCase wanted?
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c static int vega20_set_watermarks_for_clocks_ranges(struct pp_hwmgr *hwmgr, · line 2526
Quoted 2 lines
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c +2
-0+int32_t input_index, input_clk, input_vol, i; +int ret =0 ;Is the initialization needed?
Quoted 9 lines
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c +9
-0+ +PP_ASSERT_WITH_CODE (input,"NULL user input for clock and voltage" , + return -EINVAL ); + +switch (type) { +case PP_OD_EDIT_SCLK_VDDC_TABLE : + if (!(od8_settings[OD8_SETTING_GFXCLK_FREQ1].feature_id && + od8_settings[OD8_SETTING_GFXCLK_FREQ2].feature_id && + od8_settings[OD8_SETTING_GFXCLK_FREQ3].feature_id &&drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c static int vega20_set_watermarks_for_clocks_ranges(struct pp_hwmgr *hwmgr, · line 2545
Quoted 10 lines
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c +10
-0+ od8_settings[OD8_SETTING_GFXCLK_VOLTAGE1].feature_id && + od8_settings[OD8_SETTING_GFXCLK_VOLTAGE2].feature_id && + od8_settings[OD8_SETTING_GFXCLK_VOLTAGE3].feature_id)) { +pr_info ("Sclk voltage overdrive not supported\n" ); +return 0 ; + } + +for (i =0 ; i < size; i +=3 ) { +if (i +3 > size) { +pr_info ("invalid clock voltage input\n" );As this is log level *Info* I’d say it should be better understandable for the user. Also, why not print the values?
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c static int vega20_set_watermarks_for_clocks_ranges(struct pp_hwmgr *hwmgr, · line 2558
Quoted 13 lines
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c +13
-0+return 0 ; + } + + input_index = input[i]; + input_clk = input[i +1 ]; + input_vol = input[i +2 ]; +if (input_index >2 || + input_clk < od8_settings[OD8_SETTING_GFXCLK_FREQ1 + input_index *2 ].min_value || + input_clk > od8_settings[OD8_SETTING_GFXCLK_FREQ1 + input_index *2 ].max_value || + input_vol < od8_settings[OD8_SETTING_GFXCLK_VOLTAGE1 + input_index *2 ].min_value || + input_vol > od8_settings[OD8_SETTING_GFXCLK_VOLTAGE1 + input_index *2 ].max_value) { +pr_info ("input argument is not within allowed range\n" ); +return -EINVAL ;Ditto. Maybe even print the values?
Quoted 11 lines
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c +11
-0+ } + +switch (input_index) { +case 0 : + data->od_table.GfxclkFreq1 = input_clk; + data->od_table.GfxclkOffsetVolt1 = input_vol; +break ; +case 1 : + data->od_table.GfxclkFreq2 = input_clk; + data->od_table.GfxclkOffsetVolt2 = input_vol; +break ;drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c static int vega20_set_watermarks_for_clocks_ranges(struct pp_hwmgr *hwmgr, · line 2579
Quoted 10 lines
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c +10
-0+case 2 : + data->od_table.GfxclkFreq3 = input_clk; + data->od_table.GfxclkOffsetVolt3 = input_vol; +break ; + } + } +break ; + +case PP_OD_EDIT_MCLK_VDDC_TABLE : +pr_info ("Mclk voltage overdrive not supported!\n" );Ditto.
Quoted 127 lines
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c +93
-1+break ; + +case PP_OD_RESTORE_DEFAULT_TABLE : + ret =vega20_copy_table_from_smc (hwmgr, + (uint8_t *)(&od_table), +TABLE_OVERDRIVE ); +PP_ASSERT_WITH_CODE (!ret, +"Failed to export over drive table!" , + return ret); + +memcpy (&data->od_table, &od_table,sizeof (od_table)); +break ; + +case PP_OD_COMMIT_DPM_TABLE : +memcpy (&od_table, &data->od_table,sizeof (od_table)); + + ret =vega20_copy_table_to_smc (hwmgr, + (uint8_t *)(&od_table), +TABLE_OVERDRIVE ); +PP_ASSERT_WITH_CODE (!ret, +"Failed to import over drive table!" , + return ret); + +break ; + +default : +return -EINVAL ; + } + +return 0 ; +} +static int vega20_print_clock_levels (struct pp_hwmgr *hwmgr,enum pp_clock_type type,char *buf) { -int i, now, size =0 ; +struct vega20_hwmgr *data = + (struct vega20_hwmgr *)(hwmgr->backend); +struct vega20_od8_single_setting *od8_settings = + data->od8_settings.od8_settings_array; +OverDriveTable_t *od_table = &data->od_table;struct pp_clock_levels_with_latency clocks; +int i, now, size =0 ;int ret =0 ;switch (type) {@@ -2551,6 +2659,59 @@ static int vega20_print_clock_levels(struct pp_hwmgr *hwmgr,case PP_PCIE :break ; +case OD_SCLK : +if (od8_settings[OD8_SETTING_GFXCLK_FREQ1 ].feature_id && + od8_settings[OD8_SETTING_GFXCLK_FREQ2 ].feature_id && + od8_settings[OD8_SETTING_GFXCLK_FREQ3 ].feature_id && + od8_settings[OD8_SETTING_GFXCLK_VOLTAGE1 ].feature_id && + od8_settings[OD8_SETTING_GFXCLK_VOLTAGE2 ].feature_id && + od8_settings[OD8_SETTING_GFXCLK_VOLTAGE3 ].feature_id) { + + size =sprintf (buf,"%s:\n" ,"OD_SCLK" ); + size +=sprintf (buf + size,"0: %10uMhz %10dmV\n" , + od_table->GfxclkFreq1, + od_table->GfxclkOffsetVolt1); + size +=sprintf (buf + size,"1: %10uMhz %10dmV\n" , + od_table->GfxclkFreq2, + od_table->GfxclkOffsetVolt2); + size +=sprintf (buf + size,"2: %10uMhz %10dmV\n" , + od_table->GfxclkFreq3, + od_table->GfxclkOffsetVolt3); + } +break ; + +case OD_MCLK : +break ; + +case OD_RANGE : +if (od8_settings[OD8_SETTING_GFXCLK_FREQ1 ].feature_id && + od8_settings[OD8_SETTING_GFXCLK_FREQ2 ].feature_id && + od8_settings[OD8_SETTING_GFXCLK_FREQ3 ].feature_id && + od8_settings[OD8_SETTING_GFXCLK_VOLTAGE1 ].feature_id && + od8_settings[OD8_SETTING_GFXCLK_VOLTAGE2 ].feature_id && + od8_settings[OD8_SETTING_GFXCLK_VOLTAGE3 ].feature_id) { + + size =sprintf (buf,"%s:\n" ,"OD_RANGE" ); + size +=sprintf (buf + size,"SCLK[0]: %7uMhz %10uMhz\n" , + od8_settings[OD8_SETTING_GFXCLK_FREQ1 ].min_value, + od8_settings[OD8_SETTING_GFXCLK_FREQ1 ].max_value); + size +=sprintf (buf + size,"VDDC[0]: %7dmV %11dmV\n" , + od8_settings[OD8_SETTING_GFXCLK_VOLTAGE1 ].min_value, + od8_settings[OD8_SETTING_GFXCLK_VOLTAGE1 ].max_value); + size +=sprintf (buf + size,"SCLK[1]: %7uMhz %10uMhz\n" , + od8_settings[OD8_SETTING_GFXCLK_FREQ2 ].min_value, + od8_settings[OD8_SETTING_GFXCLK_FREQ2 ].max_value); + size +=sprintf (buf + size,"VDDC[1]: %7dmV %11dmV\n" , + od8_settings[OD8_SETTING_GFXCLK_VOLTAGE2 ].min_value, + od8_settings[OD8_SETTING_GFXCLK_VOLTAGE2 ].max_value); + size +=sprintf (buf + size,"SCLK[2]: %7uMhz %10uMhz\n" , + od8_settings[OD8_SETTING_GFXCLK_FREQ3 ].min_value, + od8_settings[OD8_SETTING_GFXCLK_FREQ3 ].max_value); + size +=sprintf (buf + size,"VDDC[2]: %7dmV %11dmV\n" , + od8_settings[OD8_SETTING_GFXCLK_VOLTAGE3 ].min_value, + od8_settings[OD8_SETTING_GFXCLK_VOLTAGE3 ].max_value); + } +break ;default :break ; }@@ -3162,6 +3323,8 @@ static const struct pp_hwmgr_func vega20_hwmgr_funcs = { vega20_get_mclk_od, .set_mclk_od = vega20_set_mclk_od, + .odn_edit_dpm_table = + vega20_odn_edit_dpm_table,/* for sysfs to retrive/set gfxclk/memclk */ .force_clock_level = vega20_force_clock_level,drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.h +2
-0@@ -513,6 +513,8 @@ struct vega20_hwmgr {/* ---- Gfxoff ---- */ bool gfxoff_allowed;uint32_t counter_gfxoff; + +OverDriveTable_t od_table; };
Quoted 1 line
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.h struct vega20_hwmgr { · line 520
Quoted 1 line
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.h +0
-0#define VEGA20_DPM2_NEAR_TDP_DEC 10
Kind regards,
Paul
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Thanks Paul,
Comment inline
Quoted 8 lines
-----Original Message-----
From: Paul Menzel <[email protected]>
Sent: 2018年8月29日 20:23
To: Quan, Evan <[email protected]>
Cc: [email protected]; Alex Deucher <[email protected]>; Zhu, Rex <[email protected]>
Subject: Re: [PATCH] drm/amd/powerplay: added vega20 overdrive support
Quoted 9 lines
Dear Evan,
Quoted 2 lines · Evan Quan
Vega20 supports only sclk voltage overdrive. And user can only tell three groups of <frequency,
voltage_offset>. SMUDo you mean: The user can only configure three groups of …?
[Quan, Evan] Yes.
Quoted 7 lines
Quoted 2 lines
firmware will recalculate the frequency/voltage curve. Other intermediate levles will be stretched/shrunk accordingly.
levels
(A spell checker should detect simple typos.)
[Quan, Evan] Thanks.
Quoted 49 lines
Quoted 5 lines
Change-Id I403cb38a95863db664cf06d030ac42a19bff6b33Signed-off-by Evan Quan <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c | 26 +++ .../drm/amd/powerplay/hwmgr/vega20_hwmgr.c | 165+++++++++++++++++-
Review
Quoted 4 lines
.../drm/amd/powerplay/hwmgr/vega20_hwmgr.h | 2 + 3 files changed, 192 insertions(+), 1 deletion(-)(quoted diff) +0
-0
b/drivers/gpu/drm/amd/amdgpu/amdgpu_pm.cdrivers/gpu/drm/amd/amdgpu/amdgpu_pm.c static ssize_t amdgpu_set_pp_table(struct device
Quoted 4 lines
index
e2577518b9c6..6e0c8f583521100644drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c +0
-0@@ -474,6 +474,8 @@ static ssize_t amdgpu_set_pp_table(struct device*dev,
drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c static ssize_t amdgpu_set_pp_table(struct device · line 474
Quoted 1 line
drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c +0
-0* in each power level within a power state. The pp_od_clk_voltage is used for
drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c static ssize_t amdgpu_set_pp_table(struct device
Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c +2
-0* this. * +* < For Vega10 and previous ASICs > +* * Reading the file will display: * * - a list of engine clock levels and voltages labeled OD_SCLK @@ -491,6 +493,30 @@ static ssize_t amdgpu_set_pp_table(struct device*dev,
drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c static ssize_t amdgpu_set_pp_table(struct device · line 493
Quoted 1 line
drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c +0
-0* "c" (commit) to the file to commit your changes. If you want to reset to the
Quoted 9 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c +7
-0* default power levels, write "r" (reset) to the file to reset them. * +* +* < For Vega20 > +* +* Reading the file will display: +* +* - three groups of engine clock and voltage offset labeled OD_SCLK +* drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c static ssize_t amdgpu_set_pp_table(struct device *dev, · line 512
Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c +10
-0+* - a list of valid ranges for above three groups of sclk and voltage offset +* labeled OD_RANGE +* +* To manually adjust these settings: +* +* - First select manual using power_dpm_force_performance_level +* +* - Enter a new value for each group by writing a string that contains +* "s group_index clock voltage_offset" to the file. E.g., "s 0 500 20" +* will update group1 sclk to be 500 MHz with voltage increased 20mV
Quoted 2 lines
increased *by* 20mV? by or to?
[Quan, Evan] It should be 'by' since here is an offset.
Quoted 20 lines
Review
Quoted 11 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c +7
-0+* +* - When you have edited all of the states as needed, write "c" (commit) +* to the file to commit your changes +* +* - If you want to reset to the default power levels, write "r" (reset) +* to the file to reset them +* */ static ssize_t amdgpu_set_pp_od_clk_voltage(struct device *dev,(quoted diff) +0
-0
b/drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.cdrivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c static int
Quoted 4 lines
index
ececa2f7fe5f..9f6e070a76e0100644drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c +0
-0@@ -1096,6 +1096,13 @@ static intvega20_od8_initialize_default_settings(
Quoted 3 lines
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c +0
-0} }
Quoted 7 lines
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c static int vega20_od8_initialize_default_settings( · line 1103
Quoted 5 lines
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c +5
-0+ ret =vega20_copy_table_from_smc (hwmgr, + (uint8_t *)(&data->od_table), +TABLE_OVERDRIVE ); + PP_ASSERT_WITH_CODE(!ret, + "Failed to export over drive table!",*over drive* or *overdrive*
[Quan, Evan] Should be 'overdrive'. Will fix it.
Quoted 11 lines
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c static int
Quoted 7 lines
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c +2
-0+ return ret); +return 0 ; }@@ -2506,11 +2513,112 @@ static intvega20_set_watermarks_for_clocks_ranges(struct
pp_hwmgr*hwmgr,Quoted 3 lines
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c +0
-0return 0 ; }
Quoted 6 lines
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c static int · line 2517
Quoted 2 lines
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c +2
-0+static int vega20_odn_edit_dpm_table(struct pp_hwmgr *hwmgr, + enum
PP_OD_DPM_TABLE_COMMANDtype,drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c static int vega20_set_watermarks_for_clocks_ranges(struct pp_hwmgr *hwmgr, · line 2518
Quoted 1 line
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c +1
-0+ long *input, uint32_t size)What is size? Could it be
size_tor just int?
[Quan, Evan] Number of elements in the input array.
Quoted 10 lines
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c static int vega20_set_watermarks_for_clocks_ranges(struct pp_hwmgr *hwmgr, · line 2524
Quoted 7 lines
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c +6
-0+{ +struct vega20_hwmgr *data = + (struct vega20_hwmgr *)(hwmgr->backend); +struct vega20_od8_single_setting *od8_settings = + data->od8_settings.od8_settings_array; +OverDriveTable_t od_table;Is CamelCase wanted?
Quoted 5 lines
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c static int vega20_set_watermarks_for_clocks_ranges(struct pp_hwmgr *hwmgr, · line 2526
Quoted 2 lines
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c +2
-0+int32_t input_index, input_clk, input_vol, i; +int ret =0 ;Is the initialization needed?
[Quan, Evan] Fine to have it uninitialized here since it will be initialized before use.
Quoted 19 lines
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c static int · line 2528
Quoted 2 lines
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c +2
-0+ + PP_ASSERT_WITH_CODE(input, "NULL user input for clock andvoltage",
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c static int vega20_set_watermarks_for_clocks_ranges(struct pp_hwmgr *hwmgr,
Quoted 5 lines
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c +5
-0+ return -EINVAL); + +switch (type) { +case PP_OD_EDIT_SCLK_VDDC_TABLE : + if (!(od8_settings[OD8_SETTING_GFXCLK_FREQ1].feature_id&&
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c static int · line 2534
Quoted 1 line
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c +1
-0+ od8_settings[OD8_SETTING_GFXCLK_FREQ2 ].feature_id&&
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c static int · line 2535
Quoted 1 line
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c +1
-0+ od8_settings[OD8_SETTING_GFXCLK_FREQ3 ].feature_id&&
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c static int · line 2536
Quoted 1 line
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c +1
-0+od8_settings[OD8_SETTING_GFXCLK_VOLTAGE1].feature_id &&
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c static int · line 2537
Quoted 1 line
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c +1
-0+od8_settings[OD8_SETTING_GFXCLK_VOLTAGE2].feature_id &&
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c static int · line 2538
Quoted 1 line
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c +1
-0+od8_settings[OD8_SETTING_GFXCLK_VOLTAGE3].feature_id)) {
Quoted 11 lines
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c static int vega20_set_watermarks_for_clocks_ranges(struct pp_hwmgr *hwmgr, · line 2545
Quoted 7 lines
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c +7
-0+pr_info ("Sclk voltage overdrive not supported\n" ); +return 0 ; + } + +for (i =0 ; i < size; i +=3 ) { +if (i +3 > size) { +pr_info ("invalid clock voltage input\n" );As this is log level *Info* I’d say it should be better understandable for the user. Also, why not print the values?
[Quan, Evan] Thanks. Let me refine the error output to be more friendly.
Quoted 212 lines
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c static int vega20_set_watermarks_for_clocks_ranges(struct pp_hwmgr *hwmgr,
Quoted 8 lines
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c +8
-0+return 0 ; + } + + input_index = input[i]; + input_clk = input[i +1 ]; + input_vol = input[i +2 ]; +if (input_index >2 || + input_clk <od8_settings[OD8_SETTING_GFXCLK_FREQ1 +
input_index* 2].min_value|| > + input_clk > od8_settings[OD8_SETTING_GFXCLK_FREQ1 + input_index * 2].max_value || > + input_vol <od8_settings[OD8_SETTING_GFXCLK_VOLTAGE1 +
input_index* 2].min_value ||drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c static int · line 2554
Quoted 1 line
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c +1
-0+ input_vol >od8_settings[OD8_SETTING_GFXCLK_VOLTAGE1 +
input_index* 2].max_value) {drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c static int · line 2555
Quoted 1 line
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c +1
-0+ pr_info("input argument is not withinallowed range\n");
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c static int · line 2556
Quoted 1 line
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c +1
-0+return -EINVAL ;Ditto. Maybe even print the values?
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c static int vega20_set_watermarks_for_clocks_ranges(struct pp_hwmgr *hwmgr,
Quoted 6 lines
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c +6
-0+ } + +switch (input_index) { +case 0 : + data->od_table.GfxclkFreq1 = input_clk; + data->od_table.GfxclkOffsetVolt1 =
input_vol;drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c static int vega20_set_watermarks_for_clocks_ranges(struct pp_hwmgr *hwmgr,
Quoted 4 lines
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c +4
-0+break ; +case 1 : + data->od_table.GfxclkFreq2 = input_clk; + data->od_table.GfxclkOffsetVolt2 =
input_vol;drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c static int vega20_set_watermarks_for_clocks_ranges(struct pp_hwmgr *hwmgr,
Quoted 4 lines
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c +4
-0+break ; +case 2 : + data->od_table.GfxclkFreq3 = input_clk; + data->od_table.GfxclkOffsetVolt3 =
input_vol;drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c static int vega20_set_watermarks_for_clocks_ranges(struct pp_hwmgr *hwmgr, · line 2579
Quoted 7 lines
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c +7
-0+break ; + } + } +break ; + +case PP_OD_EDIT_MCLK_VDDC_TABLE : +pr_info ("Mclk voltage overdrive not supported!\n" );Ditto.
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c static int vega20_print_clock_levels(struct
Quoted 47 lines
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c +38
-1+break ; + +case PP_OD_RESTORE_DEFAULT_TABLE : + ret =vega20_copy_table_from_smc (hwmgr, + (uint8_t *)(&od_table), +TABLE_OVERDRIVE ); +PP_ASSERT_WITH_CODE (!ret, +"Failed to export over drive table!" , + return ret); + +memcpy (&data->od_table, &od_table,sizeof (od_table)); +break ; + +case PP_OD_COMMIT_DPM_TABLE : +memcpy (&od_table, &data->od_table,sizeof (od_table)); + + ret =vega20_copy_table_to_smc (hwmgr, + (uint8_t *)(&od_table), +TABLE_OVERDRIVE ); +PP_ASSERT_WITH_CODE (!ret, +"Failed to import over drive table!" , + return ret); + +break ; + +default : +return -EINVAL ; + } + +return 0 ; +} +static int vega20_print_clock_levels (struct pp_hwmgr *hwmgr,enum pp_clock_type type,char *buf) { -int i, now, size =0 ; +struct vega20_hwmgr *data = + (struct vega20_hwmgr *)(hwmgr->backend); +struct vega20_od8_single_setting *od8_settings = + data->od8_settings.od8_settings_array; +OverDriveTable_t *od_table = &data->od_table;struct pp_clock_levels_with_latency clocks; +int i, now, size =0 ;int ret =0 ;switch (type) {@@ -2551,6 +2659,59 @@ static int vega20_print_clock_levels(struct
pp_hwmgr*hwmgr,drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c static int vega20_print_clock_levels(struct pp_hwmgr *hwmgr,
Quoted 5 lines
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c +2
-0case PP_PCIE :break ; +case OD_SCLK : + if (od8_settings[OD8_SETTING_GFXCLK_FREQ1].feature_id&&
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c static int vega20_print_clock_levels(struct · line 2664
Quoted 1 line
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c +1
-0+ od8_settings[OD8_SETTING_GFXCLK_FREQ2 ].feature_id&&
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c static int vega20_print_clock_levels(struct · line 2665
Quoted 1 line
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c +1
-0+ od8_settings[OD8_SETTING_GFXCLK_FREQ3 ].feature_id&&
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c static int vega20_print_clock_levels(struct · line 2666
Quoted 1 line
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c +1
-0+od8_settings[OD8_SETTING_GFXCLK_VOLTAGE1].feature_id &&
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c static int vega20_print_clock_levels(struct · line 2667
Quoted 1 line
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c +1
-0+od8_settings[OD8_SETTING_GFXCLK_VOLTAGE2].feature_id &&
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c static int vega20_print_clock_levels(struct · line 2668
Quoted 1 line
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c +1
-0+od8_settings[OD8_SETTING_GFXCLK_VOLTAGE3].feature_id) {
Quoted 9 lines
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c +9
-0+ + size =sprintf (buf,"%s:\n" ,"OD_SCLK" ); + size +=sprintf (buf + size,"0: %10uMhz %10dmV\n" , + od_table->GfxclkFreq1, + od_table->GfxclkOffsetVolt1); + size +=sprintf (buf + size,"1: %10uMhz %10dmV\n" , + od_table->GfxclkFreq2, + od_table->GfxclkOffsetVolt2); + size += sprintf(buf + size, "2: %10uMhz %10dmV\n",drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c static int vega20_print_clock_levels(struct pp_hwmgr *hwmgr,
Quoted 10 lines
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c +10
-0+ od_table->GfxclkFreq3, + od_table->GfxclkOffsetVolt3); + } +break ; + +case OD_MCLK : +break ; + +case OD_RANGE : + if (od8_settings[OD8_SETTING_GFXCLK_FREQ1].feature_id&&
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c static int vega20_print_clock_levels(struct · line 2688
Quoted 1 line
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c +1
-0+ od8_settings[OD8_SETTING_GFXCLK_FREQ2 ].feature_id&&
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c static int vega20_print_clock_levels(struct · line 2689
Quoted 1 line
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c +1
-0+ od8_settings[OD8_SETTING_GFXCLK_FREQ3 ].feature_id&&
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c static int vega20_print_clock_levels(struct · line 2690
Quoted 1 line
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c +1
-0+od8_settings[OD8_SETTING_GFXCLK_VOLTAGE1].feature_id &&
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c static int vega20_print_clock_levels(struct · line 2691
Quoted 1 line
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c +1
-0+od8_settings[OD8_SETTING_GFXCLK_VOLTAGE2].feature_id &&
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c static int vega20_print_clock_levels(struct · line 2692
Quoted 1 line
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c +1
-0+od8_settings[OD8_SETTING_GFXCLK_VOLTAGE3].feature_id) {
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c static int vega20_print_clock_levels(struct pp_hwmgr *hwmgr,
Quoted 3 lines
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c +3
-0+ + size =sprintf (buf,"%s:\n" ,"OD_RANGE" ); + size += sprintf(buf + size,"SCLK[0]: %7uMhz %10uMhz\n",
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c static int vega20_print_clock_levels(struct · line 2696
Quoted 1 line
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c +1
-0+od8_settings[OD8_SETTING_GFXCLK_FREQ1].min_value,
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c static int vega20_print_clock_levels(struct · line 2697
Quoted 1 line
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c +1
-0+od8_settings[OD8_SETTING_GFXCLK_FREQ1].max_value);drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c static int vega20_print_clock_levels(struct · line 2698
Quoted 1 line
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c +1
-0+ size += sprintf(buf + size,"VDDC[0]: %7dmV %11dmV\n",
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c static int vega20_print_clock_levels(struct · line 2699
Quoted 1 line
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c +1
-0+od8_settings[OD8_SETTING_GFXCLK_VOLTAGE1].min_value,
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c static int vega20_print_clock_levels(struct · line 2700
Quoted 1 line
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c +1
-0+od8_settings[OD8_SETTING_GFXCLK_VOLTAGE1].max_value);drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c static int vega20_print_clock_levels(struct · line 2701
Quoted 1 line
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c +1
-0+ size += sprintf(buf + size,"SCLK[1]: %7uMhz %10uMhz\n",
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c static int vega20_print_clock_levels(struct · line 2702
Quoted 1 line
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c +1
-0+od8_settings[OD8_SETTING_GFXCLK_FREQ2].min_value,
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c static int vega20_print_clock_levels(struct · line 2703
Quoted 1 line
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c +1
-0+od8_settings[OD8_SETTING_GFXCLK_FREQ2].max_value);drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c static int vega20_print_clock_levels(struct · line 2704
Quoted 1 line
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c +1
-0+ size += sprintf(buf + size,"VDDC[1]: %7dmV %11dmV\n",
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c static int vega20_print_clock_levels(struct · line 2705
Quoted 1 line
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c +1
-0+od8_settings[OD8_SETTING_GFXCLK_VOLTAGE2].min_value,
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c static int vega20_print_clock_levels(struct · line 2706
Quoted 1 line
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c +1
-0+od8_settings[OD8_SETTING_GFXCLK_VOLTAGE2].max_value);drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c static int vega20_print_clock_levels(struct · line 2707
Quoted 1 line
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c +1
-0+ size += sprintf(buf + size,"SCLK[2]: %7uMhz %10uMhz\n",
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c static int vega20_print_clock_levels(struct · line 2708
Quoted 1 line
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c +1
-0+od8_settings[OD8_SETTING_GFXCLK_FREQ3].min_value,
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c static int vega20_print_clock_levels(struct · line 2709
Quoted 1 line
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c +1
-0+od8_settings[OD8_SETTING_GFXCLK_FREQ3].max_value);drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c static int vega20_print_clock_levels(struct · line 2710
Quoted 1 line
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c +1
-0+ size += sprintf(buf + size,"VDDC[2]: %7dmV %11dmV\n",
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c static int vega20_print_clock_levels(struct · line 2711
Quoted 1 line
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c +1
-0+od8_settings[OD8_SETTING_GFXCLK_VOLTAGE3].min_value,
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c static int vega20_print_clock_levels(struct · line 2712
Quoted 1 line
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c +1
-0+od8_settings[OD8_SETTING_GFXCLK_VOLTAGE3].max_value);drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c static const struct pp_hwmgr_func
Quoted 6 lines
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c +2
-0+ } +break ;default :break ; }@@ -3162,6 +3323,8 @@ static const struct pp_hwmgr_func
vega20_hwmgr_funcs= {Review
Quoted 9 lines
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c +2
-0vega20_get_mclk_od, .set_mclk_od = vega20_set_mclk_od, + .odn_edit_dpm_table = + vega20_odn_edit_dpm_table,/* for sysfs to retrive/set gfxclk/memclk */ .force_clock_level = vega20_force_clock_level,(quoted diff) +0
-0
b/drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.hQuoted 11 lines
index
72e4f2a55641..8bb90e22efb6100644drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.h +2
-0@@ -513,6 +513,8 @@ struct vega20_hwmgr {/* ---- Gfxoff ---- */ bool gfxoff_allowed;uint32_t counter_gfxoff; + +OverDriveTable_t od_table; };
Quoted 6 lines
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.h struct vega20_hwmgr { · line 520
Quoted 1 line
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.h +0
-0#define VEGA20_DPM2_NEAR_TDP_DEC 10Kind regards,
Paul
Regards,
Evan
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Quoted 6 lines · Evan Quan
Vega20 supports only sclk voltage overdrive. And user can only tell three groups of <frequency,
voltage_offset>. SMU firmware will recalculate the frequency/voltage curve. Other intermediate levles will be stretched/shrunk accordingly.
What about the min/max sclk? Do the curve values take that into account? What about max mclk?
Quoted 33 lines
Change-Id I403cb38a95863db664cf06d030ac42a19bff6b33Signed-off-by Evan Quan <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c | 26 +++ .../drm/amd/powerplay/hwmgr/vega20_hwmgr.c | 165 +++++++++++++++++- .../drm/amd/powerplay/hwmgr/vega20_hwmgr.h | 2 + 3 files changed, 192 insertions(+), 1 deletion(-)drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c +10
-0@@ -474,6 +474,8 @@ static ssize_t amdgpu_set_pp_table(struct device *dev,* in each power level within a power state. The pp_od_clk_voltage is used for * this. * +* < For Vega10 and previous ASICs > +* * Reading the file will display: * * - a list of engine clock levels and voltages labeled OD_SCLK @@ -491,6 +493,30 @@ static ssize_t amdgpu_set_pp_table(struct device *dev,* "c" (commit) to the file to commit your changes. If you want to reset to the * default power levels, write "r" (reset) to the file to reset them. * +* +* < For Vega20 > +* +* Reading the file will display: +* +* - three groups of engine clock and voltage offset labeled OD_SCLK +* +* - a list of valid ranges for above three groups of sclk and voltage offset
drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c static ssize_t amdgpu_set_pp_table(struct device *dev, · line 513
Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c +10
-0+* labeled OD_RANGE +* +* To manually adjust these settings: +* +* - First select manual using power_dpm_force_performance_level +* +* - Enter a new value for each group by writing a string that contains +* "s group_index clock voltage_offset" to the file. E.g., "s 0 500 20" +* will update group1 sclk to be 500 MHz with voltage increased 20mV +*
Are negative offsets supported?
Alex
Quoted 226 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c +6
-0+* - When you have edited all of the states as needed, write "c" (commit) +* to the file to commit your changes +* +* - If you want to reset to the default power levels, write "r" (reset) +* to the file to reset them +* */ static ssize_t amdgpu_set_pp_od_clk_voltage(struct device *dev,drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c +164
-1@@ -1096,6 +1096,13 @@ static int vega20_od8_initialize_default_settings( } } + ret =vega20_copy_table_from_smc (hwmgr, + (uint8_t *)(&data->od_table), +TABLE_OVERDRIVE ); +PP_ASSERT_WITH_CODE (!ret, +"Failed to export over drive table!" , + return ret); +return 0 ; }@@ -2506,11 +2513,112 @@ static int vega20_set_watermarks_for_clocks_ranges(struct pp_hwmgr *hwmgr,return 0 ; } +static int vega20_odn_edit_dpm_table (struct pp_hwmgr *hwmgr, +enum PP_OD_DPM_TABLE_COMMAND type, +long *input,uint32_t size) +{ +struct vega20_hwmgr *data = + (struct vega20_hwmgr *)(hwmgr->backend); +struct vega20_od8_single_setting *od8_settings = + data->od8_settings.od8_settings_array; +OverDriveTable_t od_table; +int32_t input_index, input_clk, input_vol, i; +int ret =0 ; + +PP_ASSERT_WITH_CODE (input,"NULL user input for clock and voltage" , + return -EINVAL ); + +switch (type) { +case PP_OD_EDIT_SCLK_VDDC_TABLE : +if (!(od8_settings[OD8_SETTING_GFXCLK_FREQ1 ].feature_id && + od8_settings[OD8_SETTING_GFXCLK_FREQ2 ].feature_id && + od8_settings[OD8_SETTING_GFXCLK_FREQ3 ].feature_id && + od8_settings[OD8_SETTING_GFXCLK_VOLTAGE1 ].feature_id && + od8_settings[OD8_SETTING_GFXCLK_VOLTAGE2 ].feature_id && + od8_settings[OD8_SETTING_GFXCLK_VOLTAGE3 ].feature_id)) { +pr_info ("Sclk voltage overdrive not supported\n" ); +return 0 ; + } + +for (i =0 ; i < size; i +=3 ) { +if (i +3 > size) { +pr_info ("invalid clock voltage input\n" ); +return 0 ; + } + + input_index = input[i]; + input_clk = input[i +1 ]; + input_vol = input[i +2 ]; +if (input_index >2 || + input_clk < od8_settings[OD8_SETTING_GFXCLK_FREQ1 + input_index *2 ].min_value || + input_clk > od8_settings[OD8_SETTING_GFXCLK_FREQ1 + input_index *2 ].max_value || + input_vol < od8_settings[OD8_SETTING_GFXCLK_VOLTAGE1 + input_index *2 ].min_value || + input_vol > od8_settings[OD8_SETTING_GFXCLK_VOLTAGE1 + input_index *2 ].max_value) { +pr_info ("input argument is not within allowed range\n" ); +return -EINVAL ; + } + +switch (input_index) { +case 0 : + data->od_table.GfxclkFreq1 = input_clk; + data->od_table.GfxclkOffsetVolt1 = input_vol; +break ; +case 1 : + data->od_table.GfxclkFreq2 = input_clk; + data->od_table.GfxclkOffsetVolt2 = input_vol; +break ; +case 2 : + data->od_table.GfxclkFreq3 = input_clk; + data->od_table.GfxclkOffsetVolt3 = input_vol; +break ; + } + } +break ; + +case PP_OD_EDIT_MCLK_VDDC_TABLE : +pr_info ("Mclk voltage overdrive not supported!\n" ); +break ; + +case PP_OD_RESTORE_DEFAULT_TABLE : + ret =vega20_copy_table_from_smc (hwmgr, + (uint8_t *)(&od_table), +TABLE_OVERDRIVE ); +PP_ASSERT_WITH_CODE (!ret, +"Failed to export over drive table!" , + return ret); + +memcpy (&data->od_table, &od_table,sizeof (od_table)); +break ; + +case PP_OD_COMMIT_DPM_TABLE : +memcpy (&od_table, &data->od_table,sizeof (od_table)); + + ret =vega20_copy_table_to_smc (hwmgr, + (uint8_t *)(&od_table), +TABLE_OVERDRIVE ); +PP_ASSERT_WITH_CODE (!ret, +"Failed to import over drive table!" , + return ret); + +break ; + +default : +return -EINVAL ; + } + +return 0 ; +} +static int vega20_print_clock_levels (struct pp_hwmgr *hwmgr,enum pp_clock_type type,char *buf) { -int i, now, size =0 ; +struct vega20_hwmgr *data = + (struct vega20_hwmgr *)(hwmgr->backend); +struct vega20_od8_single_setting *od8_settings = + data->od8_settings.od8_settings_array; +OverDriveTable_t *od_table = &data->od_table;struct pp_clock_levels_with_latency clocks; +int i, now, size =0 ;int ret =0 ;switch (type) {@@ -2551,6 +2659,59 @@ static int vega20_print_clock_levels(struct pp_hwmgr *hwmgr,case PP_PCIE :break ; +case OD_SCLK : +if (od8_settings[OD8_SETTING_GFXCLK_FREQ1 ].feature_id && + od8_settings[OD8_SETTING_GFXCLK_FREQ2 ].feature_id && + od8_settings[OD8_SETTING_GFXCLK_FREQ3 ].feature_id && + od8_settings[OD8_SETTING_GFXCLK_VOLTAGE1 ].feature_id && + od8_settings[OD8_SETTING_GFXCLK_VOLTAGE2 ].feature_id && + od8_settings[OD8_SETTING_GFXCLK_VOLTAGE3 ].feature_id) { + + size =sprintf (buf,"%s:\n" ,"OD_SCLK" ); + size +=sprintf (buf + size,"0: %10uMhz %10dmV\n" , + od_table->GfxclkFreq1, + od_table->GfxclkOffsetVolt1); + size +=sprintf (buf + size,"1: %10uMhz %10dmV\n" , + od_table->GfxclkFreq2, + od_table->GfxclkOffsetVolt2); + size +=sprintf (buf + size,"2: %10uMhz %10dmV\n" , + od_table->GfxclkFreq3, + od_table->GfxclkOffsetVolt3); + } +break ; + +case OD_MCLK : +break ; + +case OD_RANGE : +if (od8_settings[OD8_SETTING_GFXCLK_FREQ1 ].feature_id && + od8_settings[OD8_SETTING_GFXCLK_FREQ2 ].feature_id && + od8_settings[OD8_SETTING_GFXCLK_FREQ3 ].feature_id && + od8_settings[OD8_SETTING_GFXCLK_VOLTAGE1 ].feature_id && + od8_settings[OD8_SETTING_GFXCLK_VOLTAGE2 ].feature_id && + od8_settings[OD8_SETTING_GFXCLK_VOLTAGE3 ].feature_id) { + + size =sprintf (buf,"%s:\n" ,"OD_RANGE" ); + size +=sprintf (buf + size,"SCLK[0]: %7uMhz %10uMhz\n" , + od8_settings[OD8_SETTING_GFXCLK_FREQ1 ].min_value, + od8_settings[OD8_SETTING_GFXCLK_FREQ1 ].max_value); + size +=sprintf (buf + size,"VDDC[0]: %7dmV %11dmV\n" , + od8_settings[OD8_SETTING_GFXCLK_VOLTAGE1 ].min_value, + od8_settings[OD8_SETTING_GFXCLK_VOLTAGE1 ].max_value); + size +=sprintf (buf + size,"SCLK[1]: %7uMhz %10uMhz\n" , + od8_settings[OD8_SETTING_GFXCLK_FREQ2 ].min_value, + od8_settings[OD8_SETTING_GFXCLK_FREQ2 ].max_value); + size +=sprintf (buf + size,"VDDC[1]: %7dmV %11dmV\n" , + od8_settings[OD8_SETTING_GFXCLK_VOLTAGE2 ].min_value, + od8_settings[OD8_SETTING_GFXCLK_VOLTAGE2 ].max_value); + size +=sprintf (buf + size,"SCLK[2]: %7uMhz %10uMhz\n" , + od8_settings[OD8_SETTING_GFXCLK_FREQ3 ].min_value, + od8_settings[OD8_SETTING_GFXCLK_FREQ3 ].max_value); + size +=sprintf (buf + size,"VDDC[2]: %7dmV %11dmV\n" , + od8_settings[OD8_SETTING_GFXCLK_VOLTAGE3 ].min_value, + od8_settings[OD8_SETTING_GFXCLK_VOLTAGE3 ].max_value); + } +break ;default :break ; }@@ -3162,6 +3323,8 @@ static const struct pp_hwmgr_func vega20_hwmgr_funcs = { vega20_get_mclk_od, .set_mclk_od = vega20_set_mclk_od, + .odn_edit_dpm_table = + vega20_odn_edit_dpm_table,/* for sysfs to retrive/set gfxclk/memclk */ .force_clock_level = vega20_force_clock_level,drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.h +2
-1@@ -513,6 +513,8 @@ struct vega20_hwmgr {/* ---- Gfxoff ---- */ bool gfxoff_allowed;uint32_t counter_gfxoff; + +OverDriveTable_t od_table; };#define VEGA20_DPM2_NEAR_TDP_DEC 10 --2.18.0
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_M_KoHywdBzPPx6S1JWBXod0gCaST9A4tdmvdhzq15wuQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org
Hi Alex,
Quoted 2 lines
What about the min/max sclk? Do the curve values take that into account? What about max mclk?
Voltage curve does not take these into consideration. And the max sclk and mclk can be set through existing sysfs interface pp_sclk_od and pp_mclk_od. For min sclk, as i know there is no interface to get it set.
Quoted 1 line
Are negative offsets supported?
Sure.
Regards,
Evan
________________________________
From: Alex Deucher <[email protected]>
Sent: Thursday, August 30, 2018 12:25:35 AM
To: Quan, Evan
Cc: amd-gfx list; Deucher, Alexander; Zhu, Rex
Subject: Re: [PATCH] drm/amd/powerplay: added vega20 overdrive support
Quoted 6 lines · Evan Quan
Vega20 supports only sclk voltage overdrive. And user can only tell three groups of <frequency,
voltage_offset>. SMU firmware will recalculate the frequency/voltage curve. Other intermediate levles will be stretched/shrunk accordingly.
What about the min/max sclk? Do the curve values take that into account? What about max mclk?
Quoted 33 lines
Change-Id I403cb38a95863db664cf06d030ac42a19bff6b33Signed-off-by Evan Quan <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c | 26 +++ .../drm/amd/powerplay/hwmgr/vega20_hwmgr.c | 165 +++++++++++++++++- .../drm/amd/powerplay/hwmgr/vega20_hwmgr.h | 2 + 3 files changed, 192 insertions(+), 1 deletion(-)drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c +10
-0@@ -474,6 +474,8 @@ static ssize_t amdgpu_set_pp_table(struct device *dev,* in each power level within a power state. The pp_od_clk_voltage is used for * this. * +* < For Vega10 and previous ASICs > +* * Reading the file will display: * * - a list of engine clock levels and voltages labeled OD_SCLK @@ -491,6 +493,30 @@ static ssize_t amdgpu_set_pp_table(struct device *dev,* "c" (commit) to the file to commit your changes. If you want to reset to the * default power levels, write "r" (reset) to the file to reset them. * +* +* < For Vega20 > +* +* Reading the file will display: +* +* - three groups of engine clock and voltage offset labeled OD_SCLK +* +* - a list of valid ranges for above three groups of sclk and voltage offset
drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c static ssize_t amdgpu_set_pp_table(struct device *dev, · line 513
Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c +10
-0+* labeled OD_RANGE +* +* To manually adjust these settings: +* +* - First select manual using power_dpm_force_performance_level +* +* - Enter a new value for each group by writing a string that contains +* "s group_index clock voltage_offset" to the file. E.g., "s 0 500 20" +* will update group1 sclk to be 500 MHz with voltage increased 20mV +*
Are negative offsets supported?
Alex
Quoted 226 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c +6
-0+* - When you have edited all of the states as needed, write "c" (commit) +* to the file to commit your changes +* +* - If you want to reset to the default power levels, write "r" (reset) +* to the file to reset them +* */ static ssize_t amdgpu_set_pp_od_clk_voltage(struct device *dev,drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c +164
-1@@ -1096,6 +1096,13 @@ static int vega20_od8_initialize_default_settings( } } + ret =vega20_copy_table_from_smc (hwmgr, + (uint8_t *)(&data->od_table), +TABLE_OVERDRIVE ); +PP_ASSERT_WITH_CODE (!ret, +"Failed to export over drive table!" , + return ret); +return 0 ; }@@ -2506,11 +2513,112 @@ static int vega20_set_watermarks_for_clocks_ranges(struct pp_hwmgr *hwmgr,return 0 ; } +static int vega20_odn_edit_dpm_table (struct pp_hwmgr *hwmgr, +enum PP_OD_DPM_TABLE_COMMAND type, +long *input,uint32_t size) +{ +struct vega20_hwmgr *data = + (struct vega20_hwmgr *)(hwmgr->backend); +struct vega20_od8_single_setting *od8_settings = + data->od8_settings.od8_settings_array; +OverDriveTable_t od_table; +int32_t input_index, input_clk, input_vol, i; +int ret =0 ; + +PP_ASSERT_WITH_CODE (input,"NULL user input for clock and voltage" , + return -EINVAL ); + +switch (type) { +case PP_OD_EDIT_SCLK_VDDC_TABLE : +if (!(od8_settings[OD8_SETTING_GFXCLK_FREQ1 ].feature_id && + od8_settings[OD8_SETTING_GFXCLK_FREQ2 ].feature_id && + od8_settings[OD8_SETTING_GFXCLK_FREQ3 ].feature_id && + od8_settings[OD8_SETTING_GFXCLK_VOLTAGE1 ].feature_id && + od8_settings[OD8_SETTING_GFXCLK_VOLTAGE2 ].feature_id && + od8_settings[OD8_SETTING_GFXCLK_VOLTAGE3 ].feature_id)) { +pr_info ("Sclk voltage overdrive not supported\n" ); +return 0 ; + } + +for (i =0 ; i < size; i +=3 ) { +if (i +3 > size) { +pr_info ("invalid clock voltage input\n" ); +return 0 ; + } + + input_index = input[i]; + input_clk = input[i +1 ]; + input_vol = input[i +2 ]; +if (input_index >2 || + input_clk < od8_settings[OD8_SETTING_GFXCLK_FREQ1 + input_index *2 ].min_value || + input_clk > od8_settings[OD8_SETTING_GFXCLK_FREQ1 + input_index *2 ].max_value || + input_vol < od8_settings[OD8_SETTING_GFXCLK_VOLTAGE1 + input_index *2 ].min_value || + input_vol > od8_settings[OD8_SETTING_GFXCLK_VOLTAGE1 + input_index *2 ].max_value) { +pr_info ("input argument is not within allowed range\n" ); +return -EINVAL ; + } + +switch (input_index) { +case 0 : + data->od_table.GfxclkFreq1 = input_clk; + data->od_table.GfxclkOffsetVolt1 = input_vol; +break ; +case 1 : + data->od_table.GfxclkFreq2 = input_clk; + data->od_table.GfxclkOffsetVolt2 = input_vol; +break ; +case 2 : + data->od_table.GfxclkFreq3 = input_clk; + data->od_table.GfxclkOffsetVolt3 = input_vol; +break ; + } + } +break ; + +case PP_OD_EDIT_MCLK_VDDC_TABLE : +pr_info ("Mclk voltage overdrive not supported!\n" ); +break ; + +case PP_OD_RESTORE_DEFAULT_TABLE : + ret =vega20_copy_table_from_smc (hwmgr, + (uint8_t *)(&od_table), +TABLE_OVERDRIVE ); +PP_ASSERT_WITH_CODE (!ret, +"Failed to export over drive table!" , + return ret); + +memcpy (&data->od_table, &od_table,sizeof (od_table)); +break ; + +case PP_OD_COMMIT_DPM_TABLE : +memcpy (&od_table, &data->od_table,sizeof (od_table)); + + ret =vega20_copy_table_to_smc (hwmgr, + (uint8_t *)(&od_table), +TABLE_OVERDRIVE ); +PP_ASSERT_WITH_CODE (!ret, +"Failed to import over drive table!" , + return ret); + +break ; + +default : +return -EINVAL ; + } + +return 0 ; +} +static int vega20_print_clock_levels (struct pp_hwmgr *hwmgr,enum pp_clock_type type,char *buf) { -int i, now, size =0 ; +struct vega20_hwmgr *data = + (struct vega20_hwmgr *)(hwmgr->backend); +struct vega20_od8_single_setting *od8_settings = + data->od8_settings.od8_settings_array; +OverDriveTable_t *od_table = &data->od_table;struct pp_clock_levels_with_latency clocks; +int i, now, size =0 ;int ret =0 ;switch (type) {@@ -2551,6 +2659,59 @@ static int vega20_print_clock_levels(struct pp_hwmgr *hwmgr,case PP_PCIE :break ; +case OD_SCLK : +if (od8_settings[OD8_SETTING_GFXCLK_FREQ1 ].feature_id && + od8_settings[OD8_SETTING_GFXCLK_FREQ2 ].feature_id && + od8_settings[OD8_SETTING_GFXCLK_FREQ3 ].feature_id && + od8_settings[OD8_SETTING_GFXCLK_VOLTAGE1 ].feature_id && + od8_settings[OD8_SETTING_GFXCLK_VOLTAGE2 ].feature_id && + od8_settings[OD8_SETTING_GFXCLK_VOLTAGE3 ].feature_id) { + + size =sprintf (buf,"%s:\n" ,"OD_SCLK" ); + size +=sprintf (buf + size,"0: %10uMhz %10dmV\n" , + od_table->GfxclkFreq1, + od_table->GfxclkOffsetVolt1); + size +=sprintf (buf + size,"1: %10uMhz %10dmV\n" , + od_table->GfxclkFreq2, + od_table->GfxclkOffsetVolt2); + size +=sprintf (buf + size,"2: %10uMhz %10dmV\n" , + od_table->GfxclkFreq3, + od_table->GfxclkOffsetVolt3); + } +break ; + +case OD_MCLK : +break ; + +case OD_RANGE : +if (od8_settings[OD8_SETTING_GFXCLK_FREQ1 ].feature_id && + od8_settings[OD8_SETTING_GFXCLK_FREQ2 ].feature_id && + od8_settings[OD8_SETTING_GFXCLK_FREQ3 ].feature_id && + od8_settings[OD8_SETTING_GFXCLK_VOLTAGE1 ].feature_id && + od8_settings[OD8_SETTING_GFXCLK_VOLTAGE2 ].feature_id && + od8_settings[OD8_SETTING_GFXCLK_VOLTAGE3 ].feature_id) { + + size =sprintf (buf,"%s:\n" ,"OD_RANGE" ); + size +=sprintf (buf + size,"SCLK[0]: %7uMhz %10uMhz\n" , + od8_settings[OD8_SETTING_GFXCLK_FREQ1 ].min_value, + od8_settings[OD8_SETTING_GFXCLK_FREQ1 ].max_value); + size +=sprintf (buf + size,"VDDC[0]: %7dmV %11dmV\n" , + od8_settings[OD8_SETTING_GFXCLK_VOLTAGE1 ].min_value, + od8_settings[OD8_SETTING_GFXCLK_VOLTAGE1 ].max_value); + size +=sprintf (buf + size,"SCLK[1]: %7uMhz %10uMhz\n" , + od8_settings[OD8_SETTING_GFXCLK_FREQ2 ].min_value, + od8_settings[OD8_SETTING_GFXCLK_FREQ2 ].max_value); + size +=sprintf (buf + size,"VDDC[1]: %7dmV %11dmV\n" , + od8_settings[OD8_SETTING_GFXCLK_VOLTAGE2 ].min_value, + od8_settings[OD8_SETTING_GFXCLK_VOLTAGE2 ].max_value); + size +=sprintf (buf + size,"SCLK[2]: %7uMhz %10uMhz\n" , + od8_settings[OD8_SETTING_GFXCLK_FREQ3 ].min_value, + od8_settings[OD8_SETTING_GFXCLK_FREQ3 ].max_value); + size +=sprintf (buf + size,"VDDC[2]: %7dmV %11dmV\n" , + od8_settings[OD8_SETTING_GFXCLK_VOLTAGE3 ].min_value, + od8_settings[OD8_SETTING_GFXCLK_VOLTAGE3 ].max_value); + } +break ;default :break ; }@@ -3162,6 +3323,8 @@ static const struct pp_hwmgr_func vega20_hwmgr_funcs = { vega20_get_mclk_od, .set_mclk_od = vega20_set_mclk_od, + .odn_edit_dpm_table = + vega20_odn_edit_dpm_table,/* for sysfs to retrive/set gfxclk/memclk */ .force_clock_level = vega20_force_clock_level,drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.h +2
-1@@ -513,6 +513,8 @@ struct vega20_hwmgr {/* ---- Gfxoff ---- */ bool gfxoff_allowed;uint32_t counter_gfxoff; + +OverDriveTable_t od_table; };#define VEGA20_DPM2_NEAR_TDP_DEC 10 --2.18.0
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): SN6PR12MB265640239F8818353345E431E4080-kxOKjb6HO/FeL/[email protected]
Quoted 9 lines · Evan
Hi Alex,
Quoted 2 lines
What about the min/max sclk? Do the curve values take that into account? What about max mclk?
Voltage curve does not take these into consideration. And the max sclk and mclk can be set through existing sysfs interface
pp_sclk_odandpp_mclk_od. For min sclk, as i know there is no interface to get it set.
I'd prefer to allow adjusting min and max clocks via this interface for consistency with vega10 and smu7. I'd like to deprecate the pp_sclk_od and pp_mclk_od interfaces because the are percentage based and don't support underclocking.
Alex
Quoted 298 lines
Quoted 2 lines
Are negative offsets supported?
Sure.
Regards,
Evan
________________________________
From: Alex Deucher <[email protected]>
Sent: Thursday, August 30, 2018 12:25:35 AM
To: Quan, Evan
Cc: amd-gfx list; Deucher, Alexander; Zhu, Rex
Subject: Re: [PATCH] drm/amd/powerplay: added vega20 overdrive supportQuoted 6 lines · Evan Quan
Vega20 supports only sclk voltage overdrive. And user can only tell three groups of <frequency,
voltage_offset>. SMU firmware will recalculate the frequency/voltage curve. Other intermediate levles will be stretched/shrunk accordingly.What about the min/max sclk? Do the curve values take that into account? What about max mclk?
Quoted 33 lines
Change-Id I403cb38a95863db664cf06d030ac42a19bff6b33Signed-off-by Evan Quan <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c | 26 +++ .../drm/amd/powerplay/hwmgr/vega20_hwmgr.c | 165 +++++++++++++++++- .../drm/amd/powerplay/hwmgr/vega20_hwmgr.h | 2 + 3 files changed, 192 insertions(+), 1 deletion(-)drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c +10
-0@@ -474,6 +474,8 @@ static ssize_t amdgpu_set_pp_table(struct device *dev,* in each power level within a power state. The pp_od_clk_voltage is used for * this. * +* < For Vega10 and previous ASICs > +* * Reading the file will display: * * - a list of engine clock levels and voltages labeled OD_SCLK @@ -491,6 +493,30 @@ static ssize_t amdgpu_set_pp_table(struct device *dev,* "c" (commit) to the file to commit your changes. If you want to reset to the * default power levels, write "r" (reset) to the file to reset them. * +* +* < For Vega20 > +* +* Reading the file will display: +* +* - three groups of engine clock and voltage offset labeled OD_SCLK +* +* - a list of valid ranges for above three groups of sclk and voltage offset drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c static ssize_t amdgpu_set_pp_table(struct device *dev, · line 513
Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c +10
-0+* labeled OD_RANGE +* +* To manually adjust these settings: +* +* - First select manual using power_dpm_force_performance_level +* +* - Enter a new value for each group by writing a string that contains +* "s group_index clock voltage_offset" to the file. E.g., "s 0 500 20" +* will update group1 sclk to be 500 MHz with voltage increased 20mV +* Are negative offsets supported?
Alex
Quoted 222 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c +6
-0+* - When you have edited all of the states as needed, write "c" (commit) +* to the file to commit your changes +* +* - If you want to reset to the default power levels, write "r" (reset) +* to the file to reset them +* */ static ssize_t amdgpu_set_pp_od_clk_voltage(struct device *dev,drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c +164
-1@@ -1096,6 +1096,13 @@ static int vega20_od8_initialize_default_settings( } } + ret =vega20_copy_table_from_smc (hwmgr, + (uint8_t *)(&data->od_table), +TABLE_OVERDRIVE ); +PP_ASSERT_WITH_CODE (!ret, +"Failed to export over drive table!" , + return ret); +return 0 ; }@@ -2506,11 +2513,112 @@ static int vega20_set_watermarks_for_clocks_ranges(struct pp_hwmgr *hwmgr,return 0 ; } +static int vega20_odn_edit_dpm_table (struct pp_hwmgr *hwmgr, +enum PP_OD_DPM_TABLE_COMMAND type, +long *input,uint32_t size) +{ +struct vega20_hwmgr *data = + (struct vega20_hwmgr *)(hwmgr->backend); +struct vega20_od8_single_setting *od8_settings = + data->od8_settings.od8_settings_array; +OverDriveTable_t od_table; +int32_t input_index, input_clk, input_vol, i; +int ret =0 ; + +PP_ASSERT_WITH_CODE (input,"NULL user input for clock and voltage" , + return -EINVAL ); + +switch (type) { +case PP_OD_EDIT_SCLK_VDDC_TABLE : +if (!(od8_settings[OD8_SETTING_GFXCLK_FREQ1 ].feature_id && + od8_settings[OD8_SETTING_GFXCLK_FREQ2 ].feature_id && + od8_settings[OD8_SETTING_GFXCLK_FREQ3 ].feature_id && + od8_settings[OD8_SETTING_GFXCLK_VOLTAGE1 ].feature_id && + od8_settings[OD8_SETTING_GFXCLK_VOLTAGE2 ].feature_id && + od8_settings[OD8_SETTING_GFXCLK_VOLTAGE3 ].feature_id)) { +pr_info ("Sclk voltage overdrive not supported\n" ); +return 0 ; + } + +for (i =0 ; i < size; i +=3 ) { +if (i +3 > size) { +pr_info ("invalid clock voltage input\n" ); +return 0 ; + } + + input_index = input[i]; + input_clk = input[i +1 ]; + input_vol = input[i +2 ]; +if (input_index >2 || + input_clk < od8_settings[OD8_SETTING_GFXCLK_FREQ1 + input_index *2 ].min_value || + input_clk > od8_settings[OD8_SETTING_GFXCLK_FREQ1 + input_index *2 ].max_value || + input_vol < od8_settings[OD8_SETTING_GFXCLK_VOLTAGE1 + input_index *2 ].min_value || + input_vol > od8_settings[OD8_SETTING_GFXCLK_VOLTAGE1 + input_index *2 ].max_value) { +pr_info ("input argument is not within allowed range\n" ); +return -EINVAL ; + } + +switch (input_index) { +case 0 : + data->od_table.GfxclkFreq1 = input_clk; + data->od_table.GfxclkOffsetVolt1 = input_vol; +break ; +case 1 : + data->od_table.GfxclkFreq2 = input_clk; + data->od_table.GfxclkOffsetVolt2 = input_vol; +break ; +case 2 : + data->od_table.GfxclkFreq3 = input_clk; + data->od_table.GfxclkOffsetVolt3 = input_vol; +break ; + } + } +break ; + +case PP_OD_EDIT_MCLK_VDDC_TABLE : +pr_info ("Mclk voltage overdrive not supported!\n" ); +break ; + +case PP_OD_RESTORE_DEFAULT_TABLE : + ret =vega20_copy_table_from_smc (hwmgr, + (uint8_t *)(&od_table), +TABLE_OVERDRIVE ); +PP_ASSERT_WITH_CODE (!ret, +"Failed to export over drive table!" , + return ret); + +memcpy (&data->od_table, &od_table,sizeof (od_table)); +break ; + +case PP_OD_COMMIT_DPM_TABLE : +memcpy (&od_table, &data->od_table,sizeof (od_table)); + + ret =vega20_copy_table_to_smc (hwmgr, + (uint8_t *)(&od_table), +TABLE_OVERDRIVE ); +PP_ASSERT_WITH_CODE (!ret, +"Failed to import over drive table!" , + return ret); + +break ; + +default : +return -EINVAL ; + } + +return 0 ; +} +static int vega20_print_clock_levels (struct pp_hwmgr *hwmgr,enum pp_clock_type type,char *buf) { -int i, now, size =0 ; +struct vega20_hwmgr *data = + (struct vega20_hwmgr *)(hwmgr->backend); +struct vega20_od8_single_setting *od8_settings = + data->od8_settings.od8_settings_array; +OverDriveTable_t *od_table = &data->od_table;struct pp_clock_levels_with_latency clocks; +int i, now, size =0 ;int ret =0 ;switch (type) {@@ -2551,6 +2659,59 @@ static int vega20_print_clock_levels(struct pp_hwmgr *hwmgr,case PP_PCIE :break ; +case OD_SCLK : +if (od8_settings[OD8_SETTING_GFXCLK_FREQ1 ].feature_id && + od8_settings[OD8_SETTING_GFXCLK_FREQ2 ].feature_id && + od8_settings[OD8_SETTING_GFXCLK_FREQ3 ].feature_id && + od8_settings[OD8_SETTING_GFXCLK_VOLTAGE1 ].feature_id && + od8_settings[OD8_SETTING_GFXCLK_VOLTAGE2 ].feature_id && + od8_settings[OD8_SETTING_GFXCLK_VOLTAGE3 ].feature_id) { + + size =sprintf (buf,"%s:\n" ,"OD_SCLK" ); + size +=sprintf (buf + size,"0: %10uMhz %10dmV\n" , + od_table->GfxclkFreq1, + od_table->GfxclkOffsetVolt1); + size +=sprintf (buf + size,"1: %10uMhz %10dmV\n" , + od_table->GfxclkFreq2, + od_table->GfxclkOffsetVolt2); + size +=sprintf (buf + size,"2: %10uMhz %10dmV\n" , + od_table->GfxclkFreq3, + od_table->GfxclkOffsetVolt3); + } +break ; + +case OD_MCLK : +break ; + +case OD_RANGE : +if (od8_settings[OD8_SETTING_GFXCLK_FREQ1 ].feature_id && + od8_settings[OD8_SETTING_GFXCLK_FREQ2 ].feature_id && + od8_settings[OD8_SETTING_GFXCLK_FREQ3 ].feature_id && + od8_settings[OD8_SETTING_GFXCLK_VOLTAGE1 ].feature_id && + od8_settings[OD8_SETTING_GFXCLK_VOLTAGE2 ].feature_id && + od8_settings[OD8_SETTING_GFXCLK_VOLTAGE3 ].feature_id) { + + size =sprintf (buf,"%s:\n" ,"OD_RANGE" ); + size +=sprintf (buf + size,"SCLK[0]: %7uMhz %10uMhz\n" , + od8_settings[OD8_SETTING_GFXCLK_FREQ1 ].min_value, + od8_settings[OD8_SETTING_GFXCLK_FREQ1 ].max_value); + size +=sprintf (buf + size,"VDDC[0]: %7dmV %11dmV\n" , + od8_settings[OD8_SETTING_GFXCLK_VOLTAGE1 ].min_value, + od8_settings[OD8_SETTING_GFXCLK_VOLTAGE1 ].max_value); + size +=sprintf (buf + size,"SCLK[1]: %7uMhz %10uMhz\n" , + od8_settings[OD8_SETTING_GFXCLK_FREQ2 ].min_value, + od8_settings[OD8_SETTING_GFXCLK_FREQ2 ].max_value); + size +=sprintf (buf + size,"VDDC[1]: %7dmV %11dmV\n" , + od8_settings[OD8_SETTING_GFXCLK_VOLTAGE2 ].min_value, + od8_settings[OD8_SETTING_GFXCLK_VOLTAGE2 ].max_value); + size +=sprintf (buf + size,"SCLK[2]: %7uMhz %10uMhz\n" , + od8_settings[OD8_SETTING_GFXCLK_FREQ3 ].min_value, + od8_settings[OD8_SETTING_GFXCLK_FREQ3 ].max_value); + size +=sprintf (buf + size,"VDDC[2]: %7dmV %11dmV\n" , + od8_settings[OD8_SETTING_GFXCLK_VOLTAGE3 ].min_value, + od8_settings[OD8_SETTING_GFXCLK_VOLTAGE3 ].max_value); + } +break ;default :break ; }@@ -3162,6 +3323,8 @@ static const struct pp_hwmgr_func vega20_hwmgr_funcs = { vega20_get_mclk_od, .set_mclk_od = vega20_set_mclk_od, + .odn_edit_dpm_table = + vega20_odn_edit_dpm_table,/* for sysfs to retrive/set gfxclk/memclk */ .force_clock_level = vega20_force_clock_level,drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.h +2
-0@@ -513,6 +513,8 @@ struct vega20_hwmgr {/* ---- Gfxoff ---- */ bool gfxoff_allowed;uint32_t counter_gfxoff; + +OverDriveTable_t od_table; };
Quoted 8 lines
Quoted 8 lines
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.h +0
-1#define VEGA20_DPM2_NEAR_TDP_DEC 10 --2.18.0
_______________________________________________
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_NOoEXYTV0LpSnd6wcaDZ7dnDNzcjNJ_6tETjW+dw50YA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org
Hi Alex,
OK, I got your concern. Then how about the followings?
If user want to change the FMin and FMax, they just need to pass in the new clock values. E.g, "s 0 350 10" will update the Fmin to 350Mhz and increase its voltage by 10mV. "s 7 1000 -10" will update the Fmax to 1000Mhz and decrease voltage by 10mV.
Same for MCLK except the voltage offset passed in takes no effect.
OD_SCLK:
0: 0Mhz 0mV
4: 0Mhz 0mV 7: 0Mhz 0mV
OD_MCLK:
3: 0Mhz 0mV
OD_RANGE:
SCLK[0]: 0Mhz 0Mhz
VDDGFX[0]: 0mV 0mV
SCLK[4]: 0Mhz 0Mhz
VDDGFX[4]: 0mV 0mV
SCLK[7]: 0Mhz 0Mhz
VDDGFX[7]: 0mV 0mV
MCLK[3]: 0Mhz 0Mhz
VDDMEM[3]: 0mV 0mV
Regard,
Evan
Quoted 367 lines
-----Original Message-----
From: Alex Deucher <[email protected]>
Sent: 2018年8月30日 13:06
To: Quan, Evan <[email protected]>
Cc: amd-gfx list <[email protected]>; Deucher, Alexander <[email protected]>; Zhu, Rex <[email protected]>
Subject: Re: [PATCH] drm/amd/powerplay: added vega20 overdrive supportQuoted 8 lines · Evan
Hi Alex,
Quoted 2 lines
What about the min/max sclk? Do the curve values take that into account? What about max mclk?
Voltage curve does not take these into consideration. And the max sclk and
mclk can be set through existing sysfs interface
pp_sclk_odandpp_mclk_od. For min sclk, as i know there is no interface to get it set.Quoted 1 line
I'd prefer to allow adjusting min and max clocks via this interface for consistency with vega10 and smu7. I'd like to deprecate the
pp_sclk_odandpp_mclk_odinterfaces because the are percentage based and don't support underclocking.Alex
Quoted 10 lines
Quoted 2 lines
Are negative offsets supported?
Sure.
Regards,
Evan
Quoted 6 lines
________________________________
From: Alex Deucher <[email protected]>
Sent: Thursday, August 30, 2018 12:25:35 AM
To: Quan, Evan
Cc: amd-gfx list; Deucher, Alexander; Zhu, Rex
Subject: Re: [PATCH] drm/amd/powerplay: added vega20 overdrivesupport
Quoted 2 lines
On Wed, Aug 29, 2018 at 5:13 AM Evan Quan <[email protected]>
Quoted 15 lines · wrote:
Quoted 6 lines
Vega20 supports only sclk voltage overdrive. And user can only tell three groups of <frequency,
voltage_offset>. SMU firmware will recalculate the frequency/voltage curve. Other intermediate levles will be stretched/shrunk accordingly.What about the min/max sclk? Do the curve values take that into account? What about max mclk?
Quoted 5 lines
Change-Id I403cb38a95863db664cf06d030ac42a19bff6b33Signed-off-by Evan Quan <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c | 26 +++ .../drm/amd/powerplay/hwmgr/vega20_hwmgr.c | 165+++++++++++++++++-
Quoted 9 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c static ssize_t amdgpu_set_pp_table(struct device
Quoted 9 lines
.../drm/amd/powerplay/hwmgr/vega20_hwmgr.h | 2 + 3 files changed, 192 insertions(+), 1 deletion(-)drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c +0
-0@@ -474,6 +474,8 @@ static ssize_t amdgpu_set_pp_table(struct device*dev,
Quoted 1 line
drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c static ssize_t amdgpu_set_pp_table(struct device · line 474
Quoted 1 line
drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c +0
-0* in each power level within a power state. The pp_od_clk_voltage is used for
Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c static ssize_t amdgpu_set_pp_table(struct device
Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c +2
-1* this. * +* < For Vega10 and previous ASICs > +* * Reading the file will display: * * - a list of engine clock levels and voltages labeled OD_SCLK @@ -491,6 +493,30 @@ static ssize_t amdgpu_set_pp_table(struct device *dev,
Quoted 1 line
Quoted 1 line
* "c" (commit) to the file to commit your changes. If you want to reset
to the
Quoted 34 lines
Quoted 13 lines
* default power levels, write "r" (reset) to the file to reset them. *
+ *
+ * < For Vega20 >
+ *
+ * Reading the file will display:
+ *
+ * - three groups of engine clock and voltage offset labeled
+OD_SCLK
+ *
+ * - a list of valid ranges for above three groups of sclk and voltage offset
+ * labeledOD_RANGE
+ *Quoted 8 lines
+ * To manually adjust these settings:
+ *
+ * - First select manual usingpower_dpm_force_performance_level
+ *
+ * - Enter a new value for each group by writing a string that contains
+ * "sgroup_indexclockvoltage_offset" to the file. E.g., "s 0 500 20"
+ * will update group1 sclk to be 500 MHz with voltage increased 20mV
+ *Are negative offsets supported?
Alex
Quoted 8 lines
+ * - When you have edited all of the states as needed, write "c" (commit)
+ * to the file to commit your changes
+ *
+ * - If you want to reset to the default power levels, write "r" (reset)
+ * to the file to reset them
+ *
*/Quoted 7 lines
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c static int
Quoted 7 lines
static
ssize_tamdgpu_set_pp_od_clk_voltage(struct device *dev,drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c +0
-0@@ -1096,6 +1096,13 @@ static intvega20_od8_initialize_default_settings(
Quoted 13 lines
Quoted 13 lines
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c +7
-0} } + ret =vega20_copy_table_from_smc (hwmgr, + (uint8_t *)(&data->od_table), +TABLE_OVERDRIVE ); +PP_ASSERT_WITH_CODE (!ret, +"Failed to export over drive table!" , + return ret); +return 0 ; }Quoted 1 line
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c static int
Quoted 1 line
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c +0
-0@@ -2506,11 +2513,112 @@ static intvega20_set_watermarks_for_clocks_ranges(struct
pp_hwmgr*hwmgr,Quoted 16 lines
Quoted 6 lines
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c +3
-0return 0 ; } +static int vega20_odn_edit_dpm_table (struct pp_hwmgr *hwmgr, +enum PP_OD_DPM_TABLE_COMMAND type, +long *input,uint32_t size)drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c static int · line 2528
Quoted 10 lines
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c +10
-0+{ +struct vega20_hwmgr *data = + (struct vega20_hwmgr *)(hwmgr->backend); +struct vega20_od8_single_setting *od8_settings = + data->od8_settings.od8_settings_array; +OverDriveTable_t od_table; +int32_t input_index, input_clk, input_vol, i; +int ret =0 ; + + PP_ASSERT_WITH_CODE(input, "NULL user input for clock andvoltage",
Quoted 8 lines
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c static int · line 2536
Quoted 8 lines
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c +8
-0+ return -EINVAL); + +switch (type) { +case PP_OD_EDIT_SCLK_VDDC_TABLE : + if (!(od8_settings[OD8_SETTING_GFXCLK_FREQ1].feature_id && + od8_settings[OD8_SETTING_GFXCLK_FREQ2].feature_id && + od8_settings[OD8_SETTING_GFXCLK_FREQ3].feature_id && + od8_settings[OD8_SETTING_GFXCLK_VOLTAGE1].feature_id&&
Quoted 1 line
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c static int · line 2537
Quoted 1 line
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c +1
-0+ od8_settings[OD8_SETTING_GFXCLK_VOLTAGE2 ].feature_id&&
Quoted 1 line
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c static int · line 2538
Quoted 1 line
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c +1
-0+ od8_settings[OD8_SETTING_GFXCLK_VOLTAGE3].feature_id)){
Quoted 7 lines
Quoted 7 lines
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c +7
-0+pr_info ("Sclk voltage overdrive not supported\n" ); +return 0 ; + } + +for (i =0 ; i < size; i +=3 ) { +if (i +3 > size) { +pr_info ("invalid clock voltage input\n" );Quoted 8 lines
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c static int · line 2553
Quoted 8 lines
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c +8
-0+return 0 ; + } + + input_index = input[i]; + input_clk = input[i +1 ]; + input_vol = input[i +2 ]; +if (input_index >2 || + input_clk < od8_settings[OD8_SETTING_GFXCLK_FREQ1 +
input_index* 2].min_value ||Quoted 1 line
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c static int · line 2554
Quoted 1 line
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c +1
-0+ input_clk > od8_settings[OD8_SETTING_GFXCLK_FREQ1 +
input_index* 2].max_value ||Quoted 1 line
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c static int · line 2555
Quoted 1 line
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c +1
-0+ input_vol <od8_settings[OD8_SETTING_GFXCLK_VOLTAGE1 +
input_index* 2].min_value ||Quoted 1 line
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c static int · line 2556
Quoted 1 line
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c +1
-0+ input_vol >od8_settings[OD8_SETTING_GFXCLK_VOLTAGE1 +
input_index* 2].max_value) {Quoted 68 lines
Quoted 68 lines
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c +62
-1+pr_info ("input argument is not within allowed range\n" ); +return -EINVAL ; + } + +switch (input_index) { +case 0 : + data->od_table.GfxclkFreq1 = input_clk; + data->od_table.GfxclkOffsetVolt1 = input_vol; +break ; +case 1 : + data->od_table.GfxclkFreq2 = input_clk; + data->od_table.GfxclkOffsetVolt2 = input_vol; +break ; +case 2 : + data->od_table.GfxclkFreq3 = input_clk; + data->od_table.GfxclkOffsetVolt3 = input_vol; +break ; + } + } +break ; + +case PP_OD_EDIT_MCLK_VDDC_TABLE : +pr_info ("Mclk voltage overdrive not supported!\n" ); +break ; + +case PP_OD_RESTORE_DEFAULT_TABLE : + ret =vega20_copy_table_from_smc (hwmgr, + (uint8_t *)(&od_table), +TABLE_OVERDRIVE ); +PP_ASSERT_WITH_CODE (!ret, +"Failed to export over drive table!" , + return ret); + +memcpy (&data->od_table, &od_table,sizeof (od_table)); +break ; + +case PP_OD_COMMIT_DPM_TABLE : +memcpy (&od_table, &data->od_table, +sizeof (od_table)); + + ret =vega20_copy_table_to_smc (hwmgr, + (uint8_t *)(&od_table), +TABLE_OVERDRIVE ); +PP_ASSERT_WITH_CODE (!ret, +"Failed to import over drive table!" , + return ret); + +break ; + +default : +return -EINVAL ; + } + +return 0 ; +} +static int vega20_print_clock_levels (struct pp_hwmgr *hwmgr,enum pp_clock_type type,char *buf) { -int i, now, size =0 ; +struct vega20_hwmgr *data = + (struct vega20_hwmgr *)(hwmgr->backend); +struct vega20_od8_single_setting *od8_settings = + data->od8_settings.od8_settings_array; +OverDriveTable_t *od_table = &data->od_table;struct pp_clock_levels_with_latency clocks; +int i, now, size =0 ;int ret =0 ;Quoted 2 lines
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c static int vega20_print_clock_levels(struct
Quoted 2 lines
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c +0
-0switch (type) {@@ -2551,6 +2659,59 @@ static int vega20_print_clock_levels(struct
pp_hwmgr*hwmgr,Quoted 8 lines
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c static int vega20_print_clock_levels(struct · line 2666
Quoted 8 lines
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c +5
-0case PP_PCIE :break ; +case OD_SCLK : +if (od8_settings[OD8_SETTING_GFXCLK_FREQ1 ].feature_id && + od8_settings[OD8_SETTING_GFXCLK_FREQ2 ].feature_id && + od8_settings[OD8_SETTING_GFXCLK_FREQ3 ].feature_id && + od8_settings[OD8_SETTING_GFXCLK_VOLTAGE1].feature_id&&
Quoted 1 line
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c static int vega20_print_clock_levels(struct · line 2667
Quoted 1 line
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c +1
-0+ od8_settings[OD8_SETTING_GFXCLK_VOLTAGE2 ].feature_id&&
Quoted 16 lines
Quoted 16 lines
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c +16
-0+ + od8_settings[OD8_SETTING_GFXCLK_VOLTAGE3].feature_id) { + + size =sprintf (buf,"%s:\n" ,"OD_SCLK" ); + size +=sprintf (buf + size,"0: %10uMhz %10dmV\n" , + od_table->GfxclkFreq1, + od_table->GfxclkOffsetVolt1); + size +=sprintf (buf + size,"1: %10uMhz %10dmV\n" , + od_table->GfxclkFreq2, + od_table->GfxclkOffsetVolt2); + size +=sprintf (buf + size,"2: %10uMhz %10dmV\n" , + od_table->GfxclkFreq3, + od_table->GfxclkOffsetVolt3); + } +break ; +Quoted 8 lines
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c static int vega20_print_clock_levels(struct · line 2691
Quoted 8 lines
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c +8
-0+case OD_MCLK : +break ; + +case OD_RANGE : +if (od8_settings[OD8_SETTING_GFXCLK_FREQ1 ].feature_id && + od8_settings[OD8_SETTING_GFXCLK_FREQ2 ].feature_id && + od8_settings[OD8_SETTING_GFXCLK_FREQ3 ].feature_id && + od8_settings[OD8_SETTING_GFXCLK_VOLTAGE1].feature_id&&
Quoted 1 line
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c static int vega20_print_clock_levels(struct · line 2692
Quoted 1 line
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c +1
-0+ od8_settings[OD8_SETTING_GFXCLK_VOLTAGE2 ].feature_id&&
Quoted 7 lines
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c static int vega20_print_clock_levels(struct · line 2699
Quoted 7 lines
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c +7
-0+ + od8_settings[OD8_SETTING_GFXCLK_VOLTAGE3].feature_id) { + + size =sprintf (buf,"%s:\n" ,"OD_RANGE" ); + size += sprintf(buf + size, "SCLK[0]: %7uMhz %10uMhz\n", + od8_settings[OD8_SETTING_GFXCLK_FREQ1].min_value, +od8_settings[OD8_SETTING_GFXCLK_FREQ1].max_value);
Quoted 2 lines
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c static int vega20_print_clock_levels(struct · line 2701
Quoted 2 lines
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c +2
-0+ size += sprintf(buf + size, "VDDC[0]: %7dmV %11dmV\n", +od8_settings[OD8_SETTING_GFXCLK_VOLTAGE1].min_value,
Quoted 1 line
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c static int vega20_print_clock_levels(struct · line 2702
Quoted 1 line
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c +1
-0+od8_settings[OD8_SETTING_GFXCLK_VOLTAGE1].max_value);
Quoted 3 lines
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c static int vega20_print_clock_levels(struct · line 2705
Quoted 3 lines
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c +3
-0+ size += sprintf(buf + size, "SCLK[1]: %7uMhz %10uMhz\n", + od8_settings[OD8_SETTING_GFXCLK_FREQ2].min_value, +od8_settings[OD8_SETTING_GFXCLK_FREQ2].max_value);
Quoted 2 lines
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c static int vega20_print_clock_levels(struct · line 2707
Quoted 2 lines
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c +2
-0+ size += sprintf(buf + size, "VDDC[1]: %7dmV %11dmV\n", +od8_settings[OD8_SETTING_GFXCLK_VOLTAGE2].min_value,
Quoted 1 line
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c static int vega20_print_clock_levels(struct · line 2708
Quoted 1 line
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c +1
-0+od8_settings[OD8_SETTING_GFXCLK_VOLTAGE2].max_value);
Quoted 3 lines
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c static int vega20_print_clock_levels(struct · line 2711
Quoted 3 lines
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c +3
-0+ size += sprintf(buf + size, "SCLK[2]: %7uMhz %10uMhz\n", + od8_settings[OD8_SETTING_GFXCLK_FREQ3].min_value, +od8_settings[OD8_SETTING_GFXCLK_FREQ3].max_value);
Quoted 2 lines
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c static int vega20_print_clock_levels(struct · line 2713
Quoted 2 lines
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c +2
-0+ size += sprintf(buf + size, "VDDC[2]: %7dmV %11dmV\n", +od8_settings[OD8_SETTING_GFXCLK_VOLTAGE3].min_value,
Quoted 1 line
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c static int vega20_print_clock_levels(struct · line 2714
Quoted 1 line
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c +1
-0+od8_settings[OD8_SETTING_GFXCLK_VOLTAGE3].max_value);
Quoted 6 lines
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c static const struct pp_hwmgr_func
Quoted 6 lines
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c +2
-0+ } +break ;default :break ; }@@ -3162,6 +3323,8 @@ static const struct pp_hwmgr_func
vega20_hwmgr_funcs= {Quoted 21 lines
Quoted 21 lines
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c +2
-0vega20_get_mclk_od, .set_mclk_od = vega20_set_mclk_od, + .odn_edit_dpm_table = + vega20_odn_edit_dpm_table,/* for sysfs to retrive/set gfxclk/memclk */ .force_clock_level = vega20_force_clock_level, diff --git
a/drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.hb/drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.hindex72e4f2a55641..8bb90e22efb6100644drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.h +2
-0@@ -513,6 +513,8 @@ struct vega20_hwmgr {/* ---- Gfxoff ---- */ bool gfxoff_allowed;uint32_t counter_gfxoff; + +OverDriveTable_t od_table; };
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.h +0
-1#define VEGA20_DPM2_NEAR_TDP_DEC 10 --2.18.0
_______________________________________________
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): SN6PR12MB2656F3CF10A87E4E4EA6C6FFE4080-kxOKjb6HO/FeL/[email protected]
I just sent out a V2 patch which adds the clock overdrive and fixes some minor issues pointed out by Paul.
Regards,
Evan
Quoted 440 lines
-----Original Message-----
From: Quan, Evan
Sent: 2018年8月30日 13:56
To: 'Alex Deucher' <[email protected]>
Cc: amd-gfx list <[email protected]>; Deucher, Alexander <[email protected]>; Zhu, Rex <[email protected]>
Subject: RE: [PATCH] drm/amd/powerplay: added vega20 overdrive supportHi Alex,
OK, I got your concern. Then how about the followings?
If user want to change the FMin and FMax, they just need to pass in the new clock values.
E.g, "s 0 350 10" will update the Fmin to 350Mhz and increase its voltage by 10mV.
"s 7 1000 -10" will update the Fmax to 1000Mhz and decrease voltage by 10mV.Same for MCLK except the voltage offset passed in takes no effect.
OD_SCLK:
0: 0Mhz 0mV4: 0Mhz 0mV 7: 0Mhz 0mV
OD_MCLK:
3: 0Mhz 0mV
OD_RANGE:
SCLK[0]: 0Mhz 0Mhz
VDDGFX[0]: 0mV 0mV
SCLK[4]: 0Mhz 0Mhz
VDDGFX[4]: 0mV 0mV
SCLK[7]: 0Mhz 0Mhz
VDDGFX[7]: 0mV 0mVMCLK[3]: 0Mhz 0Mhz
VDDMEM[3]: 0mV 0mVRegard,
EvanQuoted 7 lines
-----Original Message-----
From: Alex Deucher <[email protected]>
Sent: 2018年8月30日 13:06
To: Quan, Evan <[email protected]>
Cc: amd-gfx list <[email protected]>; Deucher, Alexander <[email protected]>; Zhu, Rex <[email protected]>
Subject: Re: [PATCH] drm/amd/powerplay: added vega20 overdrivesupport
Quoted 7 lines
Quoted 4 lines · Evan
Hi Alex,
Quoted 6 lines
Quoted 5 lines
Quoted 2 lines
What about the min/max sclk? Do the curve values take that into account? What about max mclk?
Voltage curve does not take these into consideration. And the max sclk and
mclk can be set through existing sysfs interface
pp_sclk_odand
pp_mclk_od.Quoted 69 lines
For min sclk, as i know there is no interface to get it set.
Quoted 1 line
I'd prefer to allow adjusting min and max clocks via this interface for consistency with vega10 and smu7. I'd like to deprecate the
pp_sclk_odandpp_mclk_odinterfaces because the are percentage based and don't support underclocking.Alex
Quoted 10 lines
Quoted 2 lines
Are negative offsets supported?
Sure.
Regards,
Evan
Quoted 6 lines
________________________________
From: Alex Deucher <[email protected]>
Sent: Thursday, August 30, 2018 12:25:35 AM
To: Quan, Evan
Cc: amd-gfx list; Deucher, Alexander; Zhu, Rex
Subject: Re: [PATCH] drm/amd/powerplay: added vega20 overdrivesupport
Quoted 2 lines
On Wed, Aug 29, 2018 at 5:13 AM Evan Quan <[email protected]>
Quoted 15 lines · wrote:
Quoted 6 lines
Vega20 supports only sclk voltage overdrive. And user can only tell three groups of <frequency,
voltage_offset>. SMU firmware will recalculate the frequency/voltage curve. Other intermediate levles will be stretched/shrunk accordingly.What about the min/max sclk? Do the curve values take that into account? What about max mclk?
Quoted 5 lines
Change-Id I403cb38a95863db664cf06d030ac42a19bff6b33Signed-off-by Evan Quan <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c | 26 +++ .../drm/amd/powerplay/hwmgr/vega20_hwmgr.c | 165+++++++++++++++++-
Quoted 10 lines
Quoted 10 lines
.../drm/amd/powerplay/hwmgr/vega20_hwmgr.h | 2 + 3 files changed, 192 insertions(+), 1 deletion(-)drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c +0
-0@@ -474,6 +474,8 @@ static ssize_t amdgpu_set_pp_table(structdevice
*dev,
Quoted 2 lines
Quoted 2 lines
* in each power level within a power state. The
pp_od_clk_voltageisused for
Quoted 9 lines
Quoted 9 lines
* this.
*
+ * < For Vega10 and previous ASICs >
+ *
* Reading the file will display:
*
* - a list of engine clock levels and voltages labeledOD_SCLK
@@
-491,6 +493,30 @@ staticssize_tamdgpu_set_pp_table(struct deviceQuoted 15 lines
*dev,
Quoted 2 lines
Quoted 2 lines
* "c" (commit) to the file to commit your changes. If you want
to resetto the
Quoted 11 lines
Quoted 11 lines
* default power levels, write "r" (reset) to the file to reset them. *
+ *
+ * < For Vega20 >
+ *
+ * Reading the file will display:
+ *
+ * - three groups of engine clock and voltage offset labeled
+OD_SCLK
+ *
+ * - a list of valid ranges for above three groups of sclk and voltageoffset
Quoted 11 lines
Quoted 11 lines
Quoted 10 lines
+ * labeled
OD_RANGE
+ *
+ * To manually adjust these settings:
+ *
+ * - First select manual usingpower_dpm_force_performance_level
+ *
+ * - Enter a new value for each group by writing a string that contains
+ * "sgroup_indexclockvoltage_offset" to the file. E.g., "s 0 500 20"
+ * will update group1 sclk to be 500 MHz with voltage increased 20mV
+ *Quoted 5 lines
Quoted 5 lines
Are negative offsets supported?
Alex
Quoted 1 line
+ * - When you have edited all of the states as needed, write "c"
(commit)
Quoted 33 lines
Quoted 7 lines
Quoted 7 lines
+ * to the file to commit your changes
+ *
+ * - If you want to reset to the default power levels, write "r" (reset)
+ * to the file to reset them
+ *
*/Quoted 7 lines
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c static int
Quoted 7 lines
static
ssize_tamdgpu_set_pp_od_clk_voltage(struct device *dev,drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c +0
-0@@ -1096,6 +1096,13 @@ static intvega20_od8_initialize_default_settings(
Quoted 13 lines
Quoted 13 lines
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c +7
-0} } + ret =vega20_copy_table_from_smc (hwmgr, + (uint8_t *)(&data->od_table), +TABLE_OVERDRIVE ); +PP_ASSERT_WITH_CODE (!ret, +"Failed to export over drive table!" , + return ret); +return 0 ; }Quoted 1 line
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c static int
Quoted 1 line
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c +0
-0@@ -2506,11 +2513,112 @@ static intvega20_set_watermarks_for_clocks_ranges(struct
pp_hwmgr*hwmgr,Quoted 3 lines
Quoted 3 lines
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c +0
-0return 0 ; }Quoted 19 lines
Quoted 5 lines
Quoted 5 lines
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c +5
-0+static int vega20_odn_edit_dpm_table (struct pp_hwmgr *hwmgr, +enum PP_OD_DPM_TABLE_COMMAND type, +long *input,uint32_t +size) { + struct vega20_hwmgr *data =Quoted 8 lines
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c static int · line 2528
Quoted 8 lines
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c +8
-0+ (struct vega20_hwmgr *)(hwmgr->backend); +struct vega20_od8_single_setting *od8_settings = + data->od8_settings.od8_settings_array; +OverDriveTable_t od_table; +int32_t input_index, input_clk, input_vol, i; +int ret =0 ; + + PP_ASSERT_WITH_CODE(input, "NULL user input for clock andvoltage",
Quoted 5 lines
Quoted 5 lines
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c +5
-0+ return -EINVAL); + +switch (type) { +case PP_OD_EDIT_SCLK_VDDC_TABLE : + if (!(od8_settings[OD8_SETTING_GFXCLK_FREQ1].feature_id&&
Quoted 28 lines
Quoted 4 lines
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c static int · line 2537
Quoted 4 lines
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c +4
-0+ od8_settings[OD8_SETTING_GFXCLK_FREQ2 ].feature_id && + od8_settings[OD8_SETTING_GFXCLK_FREQ3 ].feature_id && + + od8_settings[OD8_SETTING_GFXCLK_VOLTAGE1 ].feature_id&&
Quoted 2 lines
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c static int · line 2539
Quoted 2 lines
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c +2
-0+ + od8_settings[OD8_SETTING_GFXCLK_VOLTAGE2 ].feature_id&&
Quoted 2 lines
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c static int · line 2541
Quoted 2 lines
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c +2
-0+ + od8_settings[OD8_SETTING_GFXCLK_VOLTAGE3].feature_id)){
Quoted 8 lines
Quoted 8 lines
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c +8
-0+pr_info ("Sclk voltage overdrive not supported\n" ); +return 0 ; + } + +for (i =0 ; i < size; i +=3 ) { +if (i +3 > size) { +pr_info ("invalid clock voltage input\n" ); +return 0 ;Quoted 8 lines
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c static int · line 2557
Quoted 8 lines
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c +8
-0+ } + + input_index = input[i]; + input_clk = input[i +1 ]; + input_vol = input[i +2 ]; +if (input_index >2 || + input_clk < + od8_settings[OD8_SETTING_GFXCLK_FREQ1 +
input_index* 2].min_value ||Quoted 5 lines
Quoted 2 lines
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c static int · line 2559
Quoted 2 lines
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c +2
-0+ input_clk > + od8_settings[OD8_SETTING_GFXCLK_FREQ1 +
input_index* 2].max_value ||Quoted 1 line
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c static int · line 2560
Quoted 1 line
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c +1
-0+ input_vol <od8_settings[OD8_SETTING_GFXCLK_VOLTAGE1 +
input_index*2].min_value
Quoted 5 lines
|| > > + input_vol >od8_settings[OD8_SETTING_GFXCLK_VOLTAGE1 +
input_index* 2].max_value) {Quoted 1 line
Quoted 1 line
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c +1
-0+ pr_info("input argument is not within allowedrange\n");
Quoted 67 lines
Quoted 67 lines
Quoted 67 lines
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c +61
-1+return -EINVAL ; + } + +switch (input_index) { +case 0 : + data->od_table.GfxclkFreq1 = input_clk; + data->od_table.GfxclkOffsetVolt1 = input_vol; +break ; +case 1 : + data->od_table.GfxclkFreq2 = input_clk; + data->od_table.GfxclkOffsetVolt2 = input_vol; +break ; +case 2 : + data->od_table.GfxclkFreq3 = input_clk; + data->od_table.GfxclkOffsetVolt3 = input_vol; +break ; + } + } +break ; + +case PP_OD_EDIT_MCLK_VDDC_TABLE : +pr_info ("Mclk voltage overdrive not supported!\n" ); +break ; + +case PP_OD_RESTORE_DEFAULT_TABLE : + ret =vega20_copy_table_from_smc (hwmgr, + (uint8_t *)(&od_table), +TABLE_OVERDRIVE ); +PP_ASSERT_WITH_CODE (!ret, +"Failed to export over drive table!" , + return ret); + +memcpy (&data->od_table, &od_table,sizeof (od_table)); +break ; + +case PP_OD_COMMIT_DPM_TABLE : +memcpy (&od_table, &data->od_table, +sizeof (od_table)); + + ret =vega20_copy_table_to_smc (hwmgr, + (uint8_t *)(&od_table), +TABLE_OVERDRIVE ); +PP_ASSERT_WITH_CODE (!ret, +"Failed to import over drive table!" , + return ret); + +break ; + +default : +return -EINVAL ; + } + +return 0 ; +} +static int vega20_print_clock_levels (struct pp_hwmgr *hwmgr,enum pp_clock_type type,char *buf) { -int i, now, size =0 ; +struct vega20_hwmgr *data = + (struct vega20_hwmgr *)(hwmgr->backend); +struct vega20_od8_single_setting *od8_settings = + data->od8_settings.od8_settings_array; +OverDriveTable_t *od_table = &data->od_table;struct pp_clock_levels_with_latency clocks; +int i, now, size =0 ;int ret =0 ;Quoted 8 lines
Quoted 2 lines
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c static int vega20_print_clock_levels(struct
Quoted 2 lines
switch (type) {drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c +0
-0@@ -2551,6 +2659,59 @@ static int vega20_print_clock_levels(struct
pp_hwmgr*hwmgr,Quoted 5 lines
Quoted 5 lines
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c +2
-0case PP_PCIE :break ; +case OD_SCLK : + if (od8_settings[OD8_SETTING_GFXCLK_FREQ1].feature_id&&
Quoted 21 lines
Quoted 4 lines
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c static int vega20_print_clock_levels(struct · line 2667
Quoted 4 lines
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c +4
-0+ od8_settings[OD8_SETTING_GFXCLK_FREQ2 ].feature_id && + od8_settings[OD8_SETTING_GFXCLK_FREQ3 ].feature_id && + + od8_settings[OD8_SETTING_GFXCLK_VOLTAGE1 ].feature_id&&
Quoted 2 lines
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c static int vega20_print_clock_levels(struct · line 2669
Quoted 2 lines
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c +2
-0+ + od8_settings[OD8_SETTING_GFXCLK_VOLTAGE2 ].feature_id&&
Quoted 13 lines
Quoted 13 lines
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c +13
-0+ + od8_settings[OD8_SETTING_GFXCLK_VOLTAGE3].feature_id) { + + size =sprintf (buf,"%s:\n" ,"OD_SCLK" ); + size +=sprintf (buf + size,"0: %10uMhz %10dmV\n" , + od_table->GfxclkFreq1, + od_table->GfxclkOffsetVolt1); + size +=sprintf (buf + size,"1: %10uMhz %10dmV\n" , + od_table->GfxclkFreq2, + od_table->GfxclkOffsetVolt2); + size +=sprintf (buf + size,"2: %10uMhz %10dmV\n" , + od_table->GfxclkFreq3, + od_table->GfxclkOffsetVolt3);Quoted 8 lines
Quoted 8 lines
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c static int vega20_print_clock_levels(struct · line 2690
Quoted 8 lines
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c +8
-0+ } +break ; + +case OD_MCLK : +break ; + +case OD_RANGE : + if (od8_settings[OD8_SETTING_GFXCLK_FREQ1].feature_id&&
Quoted 73 lines
Quoted 4 lines
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c static int vega20_print_clock_levels(struct · line 2694
Quoted 4 lines
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c +4
-0+ od8_settings[OD8_SETTING_GFXCLK_FREQ2 ].feature_id && + od8_settings[OD8_SETTING_GFXCLK_FREQ3 ].feature_id && + + od8_settings[OD8_SETTING_GFXCLK_VOLTAGE1 ].feature_id&&
Quoted 2 lines
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c static int vega20_print_clock_levels(struct · line 2696
Quoted 2 lines
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c +2
-0+ + od8_settings[OD8_SETTING_GFXCLK_VOLTAGE2 ].feature_id&&
Quoted 8 lines
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c static int vega20_print_clock_levels(struct · line 2704
Quoted 8 lines
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c +8
-0+ + od8_settings[OD8_SETTING_GFXCLK_VOLTAGE3].feature_id) { + + size =sprintf (buf,"%s:\n" ,"OD_RANGE" ); + size += sprintf(buf + size, "SCLK[0]: %7uMhz %10uMhz\n", + + od8_settings[OD8_SETTING_GFXCLK_FREQ1].min_value, +od8_settings[OD8_SETTING_GFXCLK_FREQ1].max_value);
Quoted 3 lines
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c static int vega20_print_clock_levels(struct · line 2707
Quoted 3 lines
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c +3
-0+ size += sprintf(buf + size, "VDDC[0]: + %7dmV %11dmV\n", +od8_settings[OD8_SETTING_GFXCLK_VOLTAGE1].min_value,
Quoted 1 line
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c static int vega20_print_clock_levels(struct · line 2708
Quoted 1 line
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c +1
-0+od8_settings[OD8_SETTING_GFXCLK_VOLTAGE1].max_value);
Quoted 4 lines
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c static int vega20_print_clock_levels(struct · line 2712
Quoted 4 lines
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c +4
-0+ size += sprintf(buf + size, "SCLK[1]: %7uMhz %10uMhz\n", + + od8_settings[OD8_SETTING_GFXCLK_FREQ2].min_value, +od8_settings[OD8_SETTING_GFXCLK_FREQ2].max_value);
Quoted 3 lines
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c static int vega20_print_clock_levels(struct · line 2715
Quoted 3 lines
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c +3
-0+ size += sprintf(buf + size, "VDDC[1]: + %7dmV %11dmV\n", +od8_settings[OD8_SETTING_GFXCLK_VOLTAGE2].min_value,
Quoted 1 line
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c static int vega20_print_clock_levels(struct · line 2716
Quoted 1 line
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c +1
-0+od8_settings[OD8_SETTING_GFXCLK_VOLTAGE2].max_value);
Quoted 4 lines
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c static int vega20_print_clock_levels(struct
Quoted 4 lines
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c +4
-0+ size += sprintf(buf + size, "SCLK[2]: %7uMhz %10uMhz\n", + + od8_settings[OD8_SETTING_GFXCLK_FREQ3].min_value, +od8_settings[OD8_SETTING_GFXCLK_FREQ3].max_value);
Quoted 3 lines
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c
Quoted 3 lines
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c +3
-0+ size += sprintf(buf + size, "VDDC[2]: + %7dmV %11dmV\n", +od8_settings[OD8_SETTING_GFXCLK_VOLTAGE3].min_value,
Quoted 1 line
Quoted 1 line
+
od8_settings[OD8_SETTING_GFXCLK_VOLTAGE3].max_value);
Quoted 6 lines
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c static const struct pp_hwmgr_func
Quoted 6 lines
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c +2
-0+ } +break ;default :break ; }@@ -3162,6 +3323,8 @@ static const struct pp_hwmgr_func
vega20_hwmgr_funcs= {Quoted 21 lines
Quoted 21 lines
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c +2
-0vega20_get_mclk_od, .set_mclk_od = vega20_set_mclk_od, + .odn_edit_dpm_table = + vega20_odn_edit_dpm_table,/* for sysfs to retrive/set gfxclk/memclk */ .force_clock_level = vega20_force_clock_level, diff --git
a/drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.hb/drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.hindex72e4f2a55641..8bb90e22efb6100644drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.h +2
-0@@ -513,6 +513,8 @@ struct vega20_hwmgr {/* ---- Gfxoff ---- */ bool gfxoff_allowed;uint32_t counter_gfxoff; + +OverDriveTable_t od_table; };
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.h +0
-1#define VEGA20_DPM2_NEAR_TDP_DEC 10 --2.18.0
_______________________________________________
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
Quoted 8 lines · Evan
Hi Alex,
OK, I got your concern. Then how about the followings?
If user want to change the FMin and FMax, they just need to pass in the new clock values. E.g, "s 0 350 10" will update the Fmin to 350Mhz and increase its voltage by 10mV. "s 7 1000 -10" will update the Fmax to 1000Mhz and decrease voltage by 10mV.
Is there ever a case where you would want different values for Fmin/Fmax and Freq1/Freq3? I'm not entirely sure how the voltage curve and the min/max are related. If so, we should separate them and use something like my earlier proposal where we separate the voltage curve from the clk settings. Also it might be more consistent to make the whole thing offset based rather than a mix of absolute values and offsets. E.g., "s 0 50 10" would increase the fmin by 50 Mhz and increase its voltage by 10 mV. "s 7 100 -10" would increase fmax by 100 Mhz and decrease voltage by 10mV. OD_RANGE would give the the absolute clk and voltage ranges for each setting. If we went this way, we'd need to also print the default settings as well, otherwise you don't have a reference point. Maybe something like:OD_SCLK:
0: 0Mhz 0mV (100Mhz 900mV) 4: 0Mhz 0mV (200Mhz 1000mV) 7: 0Mhz 0mV (300Mhz 1100mV)
OD_MCLK:
3: 0Mhz 0mV (500Mhz 1100mV)
...
So in this case, the first two items would be the offset you want to apply and the last two items are the current absolute settings. Alternatively would could use absolute values for everything and convert to offsets for voltage in the driver. E.g., OD_SCLK:
0: 100Mhz 900mV 4: 200Mhz 1000mV 7: 300Mhz 1100mV
OD_MCLK:
3: 500Mhz 1100mV
...
Then it would work pretty much the same as the previous interface.
Alex
Quoted 393 lines
Same for MCLK except the voltage offset passed in takes no effect.
OD_SCLK:
0: 0Mhz 0mV4: 0Mhz 0mV 7: 0Mhz 0mV
OD_MCLK:
3: 0Mhz 0mV
OD_RANGE:
SCLK[0]: 0Mhz 0Mhz
VDDGFX[0]: 0mV 0mV
SCLK[4]: 0Mhz 0Mhz
VDDGFX[4]: 0mV 0mV
SCLK[7]: 0Mhz 0Mhz
VDDGFX[7]: 0mV 0mVMCLK[3]: 0Mhz 0Mhz
VDDMEM[3]: 0mV 0mVRegard,
EvanQuoted 367 lines
-----Original Message-----
From: Alex Deucher <[email protected]>
Sent: 2018年8月30日 13:06
To: Quan, Evan <[email protected]>
Cc: amd-gfx list <[email protected]>; Deucher, Alexander <[email protected]>; Zhu, Rex <[email protected]>
Subject: Re: [PATCH] drm/amd/powerplay: added vega20 overdrive supportQuoted 8 lines · Evan
Hi Alex,
Quoted 2 lines
What about the min/max sclk? Do the curve values take that into account? What about max mclk?
Voltage curve does not take these into consideration. And the max sclk and
mclk can be set through existing sysfs interface
pp_sclk_odandpp_mclk_od. For min sclk, as i know there is no interface to get it set.Quoted 1 line
I'd prefer to allow adjusting min and max clocks via this interface for consistency with vega10 and smu7. I'd like to deprecate the
pp_sclk_odandpp_mclk_odinterfaces because the are percentage based and don't support underclocking.Alex
Quoted 10 lines
Quoted 2 lines
Are negative offsets supported?
Sure.
Regards,
Evan
Quoted 6 lines
________________________________
From: Alex Deucher <[email protected]>
Sent: Thursday, August 30, 2018 12:25:35 AM
To: Quan, Evan
Cc: amd-gfx list; Deucher, Alexander; Zhu, Rex
Subject: Re: [PATCH] drm/amd/powerplay: added vega20 overdrivesupport
Quoted 2 lines
On Wed, Aug 29, 2018 at 5:13 AM Evan Quan <[email protected]>
Quoted 15 lines · wrote:
Quoted 6 lines
Vega20 supports only sclk voltage overdrive. And user can only tell three groups of <frequency,
voltage_offset>. SMU firmware will recalculate the frequency/voltage curve. Other intermediate levles will be stretched/shrunk accordingly.What about the min/max sclk? Do the curve values take that into account? What about max mclk?
Quoted 5 lines
Change-Id I403cb38a95863db664cf06d030ac42a19bff6b33Signed-off-by Evan Quan <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c | 26 +++ .../drm/amd/powerplay/hwmgr/vega20_hwmgr.c | 165+++++++++++++++++-
Quoted 9 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c static ssize_t amdgpu_set_pp_table(struct device
Quoted 9 lines
.../drm/amd/powerplay/hwmgr/vega20_hwmgr.h | 2 + 3 files changed, 192 insertions(+), 1 deletion(-)drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c +0
-0@@ -474,6 +474,8 @@ static ssize_t amdgpu_set_pp_table(struct device*dev,
Quoted 1 line
drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c static ssize_t amdgpu_set_pp_table(struct device · line 474
Quoted 1 line
drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c +0
-0* in each power level within a power state. The pp_od_clk_voltage is used for
Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c static ssize_t amdgpu_set_pp_table(struct device
Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c +2
-1* this. * +* < For Vega10 and previous ASICs > +* * Reading the file will display: * * - a list of engine clock levels and voltages labeled OD_SCLK @@ -491,6 +493,30 @@ static ssize_t amdgpu_set_pp_table(struct device *dev,
Quoted 1 line
Quoted 1 line
* "c" (commit) to the file to commit your changes. If you want to reset
to the
Quoted 34 lines
Quoted 13 lines
* default power levels, write "r" (reset) to the file to reset them. *
+ *
+ * < For Vega20 >
+ *
+ * Reading the file will display:
+ *
+ * - three groups of engine clock and voltage offset labeled
+OD_SCLK
+ *
+ * - a list of valid ranges for above three groups of sclk and voltage offset
+ * labeledOD_RANGE
+ *Quoted 8 lines
+ * To manually adjust these settings:
+ *
+ * - First select manual usingpower_dpm_force_performance_level
+ *
+ * - Enter a new value for each group by writing a string that contains
+ * "sgroup_indexclockvoltage_offset" to the file. E.g., "s 0 500 20"
+ * will update group1 sclk to be 500 MHz with voltage increased 20mV
+ *Are negative offsets supported?
Alex
Quoted 8 lines
+ * - When you have edited all of the states as needed, write "c" (commit)
+ * to the file to commit your changes
+ *
+ * - If you want to reset to the default power levels, write "r" (reset)
+ * to the file to reset them
+ *
*/Quoted 7 lines
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c static int
Quoted 7 lines
static
ssize_tamdgpu_set_pp_od_clk_voltage(struct device *dev,drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c +0
-0@@ -1096,6 +1096,13 @@ static intvega20_od8_initialize_default_settings(
Quoted 13 lines
Quoted 13 lines
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c +7
-0} } + ret =vega20_copy_table_from_smc (hwmgr, + (uint8_t *)(&data->od_table), +TABLE_OVERDRIVE ); +PP_ASSERT_WITH_CODE (!ret, +"Failed to export over drive table!" , + return ret); +return 0 ; }Quoted 1 line
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c static int
Quoted 1 line
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c +0
-0@@ -2506,11 +2513,112 @@ static intvega20_set_watermarks_for_clocks_ranges(struct
pp_hwmgr*hwmgr,Quoted 16 lines
Quoted 6 lines
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c +3
-0return 0 ; } +static int vega20_odn_edit_dpm_table (struct pp_hwmgr *hwmgr, +enum PP_OD_DPM_TABLE_COMMAND type, +long *input,uint32_t size)drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c static int · line 2528
Quoted 10 lines
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c +10
-0+{ +struct vega20_hwmgr *data = + (struct vega20_hwmgr *)(hwmgr->backend); +struct vega20_od8_single_setting *od8_settings = + data->od8_settings.od8_settings_array; +OverDriveTable_t od_table; +int32_t input_index, input_clk, input_vol, i; +int ret =0 ; + + PP_ASSERT_WITH_CODE(input, "NULL user input for clock andvoltage",
Quoted 8 lines
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c static int · line 2536
Quoted 8 lines
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c +8
-0+ return -EINVAL); + +switch (type) { +case PP_OD_EDIT_SCLK_VDDC_TABLE : + if (!(od8_settings[OD8_SETTING_GFXCLK_FREQ1].feature_id && + od8_settings[OD8_SETTING_GFXCLK_FREQ2].feature_id && + od8_settings[OD8_SETTING_GFXCLK_FREQ3].feature_id && + od8_settings[OD8_SETTING_GFXCLK_VOLTAGE1].feature_id&&
Quoted 1 line
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c static int · line 2537
Quoted 1 line
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c +1
-0+ od8_settings[OD8_SETTING_GFXCLK_VOLTAGE2 ].feature_id&&
Quoted 1 line
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c static int · line 2538
Quoted 1 line
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c +1
-0+ od8_settings[OD8_SETTING_GFXCLK_VOLTAGE3].feature_id)){
Quoted 7 lines
Quoted 7 lines
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c +7
-0+pr_info ("Sclk voltage overdrive not supported\n" ); +return 0 ; + } + +for (i =0 ; i < size; i +=3 ) { +if (i +3 > size) { +pr_info ("invalid clock voltage input\n" );Quoted 8 lines
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c static int · line 2553
Quoted 8 lines
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c +8
-0+return 0 ; + } + + input_index = input[i]; + input_clk = input[i +1 ]; + input_vol = input[i +2 ]; +if (input_index >2 || + input_clk < od8_settings[OD8_SETTING_GFXCLK_FREQ1 +
input_index* 2].min_value ||Quoted 1 line
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c static int · line 2554
Quoted 1 line
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c +1
-0+ input_clk > od8_settings[OD8_SETTING_GFXCLK_FREQ1 +
input_index* 2].max_value ||Quoted 1 line
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c static int · line 2555
Quoted 1 line
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c +1
-0+ input_vol <od8_settings[OD8_SETTING_GFXCLK_VOLTAGE1 +
input_index* 2].min_value ||Quoted 1 line
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c static int · line 2556
Quoted 1 line
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c +1
-0+ input_vol >od8_settings[OD8_SETTING_GFXCLK_VOLTAGE1 +
input_index* 2].max_value) {Quoted 68 lines
Quoted 68 lines
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c +62
-1+pr_info ("input argument is not within allowed range\n" ); +return -EINVAL ; + } + +switch (input_index) { +case 0 : + data->od_table.GfxclkFreq1 = input_clk; + data->od_table.GfxclkOffsetVolt1 = input_vol; +break ; +case 1 : + data->od_table.GfxclkFreq2 = input_clk; + data->od_table.GfxclkOffsetVolt2 = input_vol; +break ; +case 2 : + data->od_table.GfxclkFreq3 = input_clk; + data->od_table.GfxclkOffsetVolt3 = input_vol; +break ; + } + } +break ; + +case PP_OD_EDIT_MCLK_VDDC_TABLE : +pr_info ("Mclk voltage overdrive not supported!\n" ); +break ; + +case PP_OD_RESTORE_DEFAULT_TABLE : + ret =vega20_copy_table_from_smc (hwmgr, + (uint8_t *)(&od_table), +TABLE_OVERDRIVE ); +PP_ASSERT_WITH_CODE (!ret, +"Failed to export over drive table!" , + return ret); + +memcpy (&data->od_table, &od_table,sizeof (od_table)); +break ; + +case PP_OD_COMMIT_DPM_TABLE : +memcpy (&od_table, &data->od_table, +sizeof (od_table)); + + ret =vega20_copy_table_to_smc (hwmgr, + (uint8_t *)(&od_table), +TABLE_OVERDRIVE ); +PP_ASSERT_WITH_CODE (!ret, +"Failed to import over drive table!" , + return ret); + +break ; + +default : +return -EINVAL ; + } + +return 0 ; +} +static int vega20_print_clock_levels (struct pp_hwmgr *hwmgr,enum pp_clock_type type,char *buf) { -int i, now, size =0 ; +struct vega20_hwmgr *data = + (struct vega20_hwmgr *)(hwmgr->backend); +struct vega20_od8_single_setting *od8_settings = + data->od8_settings.od8_settings_array; +OverDriveTable_t *od_table = &data->od_table;struct pp_clock_levels_with_latency clocks; +int i, now, size =0 ;int ret =0 ;Quoted 2 lines
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c static int vega20_print_clock_levels(struct
Quoted 2 lines
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c +0
-0switch (type) {@@ -2551,6 +2659,59 @@ static int vega20_print_clock_levels(struct
pp_hwmgr*hwmgr,Quoted 8 lines
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c static int vega20_print_clock_levels(struct · line 2666
Quoted 8 lines
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c +5
-0case PP_PCIE :break ; +case OD_SCLK : +if (od8_settings[OD8_SETTING_GFXCLK_FREQ1 ].feature_id && + od8_settings[OD8_SETTING_GFXCLK_FREQ2 ].feature_id && + od8_settings[OD8_SETTING_GFXCLK_FREQ3 ].feature_id && + od8_settings[OD8_SETTING_GFXCLK_VOLTAGE1].feature_id&&
Quoted 1 line
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c static int vega20_print_clock_levels(struct · line 2667
Quoted 1 line
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c +1
-0+ od8_settings[OD8_SETTING_GFXCLK_VOLTAGE2 ].feature_id&&
Quoted 16 lines
Quoted 16 lines
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c +16
-0+ + od8_settings[OD8_SETTING_GFXCLK_VOLTAGE3].feature_id) { + + size =sprintf (buf,"%s:\n" ,"OD_SCLK" ); + size +=sprintf (buf + size,"0: %10uMhz %10dmV\n" , + od_table->GfxclkFreq1, + od_table->GfxclkOffsetVolt1); + size +=sprintf (buf + size,"1: %10uMhz %10dmV\n" , + od_table->GfxclkFreq2, + od_table->GfxclkOffsetVolt2); + size +=sprintf (buf + size,"2: %10uMhz %10dmV\n" , + od_table->GfxclkFreq3, + od_table->GfxclkOffsetVolt3); + } +break ; +Quoted 8 lines
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c static int vega20_print_clock_levels(struct · line 2691
Quoted 8 lines
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c +8
-0+case OD_MCLK : +break ; + +case OD_RANGE : +if (od8_settings[OD8_SETTING_GFXCLK_FREQ1 ].feature_id && + od8_settings[OD8_SETTING_GFXCLK_FREQ2 ].feature_id && + od8_settings[OD8_SETTING_GFXCLK_FREQ3 ].feature_id && + od8_settings[OD8_SETTING_GFXCLK_VOLTAGE1].feature_id&&
Quoted 1 line
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c static int vega20_print_clock_levels(struct · line 2692
Quoted 1 line
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c +1
-0+ od8_settings[OD8_SETTING_GFXCLK_VOLTAGE2 ].feature_id&&
Quoted 7 lines
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c static int vega20_print_clock_levels(struct · line 2699
Quoted 7 lines
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c +7
-0+ + od8_settings[OD8_SETTING_GFXCLK_VOLTAGE3].feature_id) { + + size =sprintf (buf,"%s:\n" ,"OD_RANGE" ); + size += sprintf(buf + size, "SCLK[0]: %7uMhz %10uMhz\n", + od8_settings[OD8_SETTING_GFXCLK_FREQ1].min_value, +od8_settings[OD8_SETTING_GFXCLK_FREQ1].max_value);
Quoted 2 lines
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c static int vega20_print_clock_levels(struct · line 2701
Quoted 2 lines
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c +2
-0+ size += sprintf(buf + size, "VDDC[0]: %7dmV %11dmV\n", +od8_settings[OD8_SETTING_GFXCLK_VOLTAGE1].min_value,
Quoted 1 line
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c static int vega20_print_clock_levels(struct · line 2702
Quoted 1 line
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c +1
-0+od8_settings[OD8_SETTING_GFXCLK_VOLTAGE1].max_value);
Quoted 3 lines
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c static int vega20_print_clock_levels(struct · line 2705
Quoted 3 lines
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c +3
-0+ size += sprintf(buf + size, "SCLK[1]: %7uMhz %10uMhz\n", + od8_settings[OD8_SETTING_GFXCLK_FREQ2].min_value, +od8_settings[OD8_SETTING_GFXCLK_FREQ2].max_value);
Quoted 2 lines
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c static int vega20_print_clock_levels(struct · line 2707
Quoted 2 lines
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c +2
-0+ size += sprintf(buf + size, "VDDC[1]: %7dmV %11dmV\n", +od8_settings[OD8_SETTING_GFXCLK_VOLTAGE2].min_value,
Quoted 1 line
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c static int vega20_print_clock_levels(struct · line 2708
Quoted 1 line
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c +1
-0+od8_settings[OD8_SETTING_GFXCLK_VOLTAGE2].max_value);
Quoted 3 lines
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c static int vega20_print_clock_levels(struct · line 2711
Quoted 3 lines
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c +3
-0+ size += sprintf(buf + size, "SCLK[2]: %7uMhz %10uMhz\n", + od8_settings[OD8_SETTING_GFXCLK_FREQ3].min_value, +od8_settings[OD8_SETTING_GFXCLK_FREQ3].max_value);
Quoted 2 lines
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c static int vega20_print_clock_levels(struct · line 2713
Quoted 2 lines
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c +2
-0+ size += sprintf(buf + size, "VDDC[2]: %7dmV %11dmV\n", +od8_settings[OD8_SETTING_GFXCLK_VOLTAGE3].min_value,
Quoted 1 line
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c static int vega20_print_clock_levels(struct · line 2714
Quoted 1 line
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c +1
-0+od8_settings[OD8_SETTING_GFXCLK_VOLTAGE3].max_value);
Quoted 6 lines
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c static const struct pp_hwmgr_func
Quoted 6 lines
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c +2
-0+ } +break ;default :break ; }@@ -3162,6 +3323,8 @@ static const struct pp_hwmgr_func
vega20_hwmgr_funcs= {Quoted 21 lines
Quoted 21 lines
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c +2
-0vega20_get_mclk_od, .set_mclk_od = vega20_set_mclk_od, + .odn_edit_dpm_table = + vega20_odn_edit_dpm_table,/* for sysfs to retrive/set gfxclk/memclk */ .force_clock_level = vega20_force_clock_level, diff --git
a/drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.hb/drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.hindex72e4f2a55641..8bb90e22efb6100644drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.h +2
-0@@ -513,6 +513,8 @@ struct vega20_hwmgr {/* ---- Gfxoff ---- */ bool gfxoff_allowed;uint32_t counter_gfxoff; + +OverDriveTable_t od_table; };
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.h +0
-1#define VEGA20_DPM2_NEAR_TDP_DEC 10 --2.18.0
_______________________________________________
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_P+DUOt0PS5o-NVuqqLJOh=6nP9Gdk1+UAynBRWq922pg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org
Hi Alex,
comment inline
Quoted 18 lines
-----Original Message-----
From: Alex Deucher <[email protected]>
Sent: 2018年8月30日 23:25
To: Quan, Evan <[email protected]>
Cc: amd-gfx list <[email protected]>; Deucher, Alexander <[email protected]>; Zhu, Rex <[email protected]>
Subject: Re: [PATCH] drm/amd/powerplay: added vega20 overdrive supportQuoted 6 lines · Evan
Hi Alex,
OK, I got your concern. Then how about the followings?
If user want to change the FMin and FMax, they just need to pass in the
new clock values.
Quoted 1 line
E.g, "s 0 350 10" will update the Fmin to 350Mhz and increase its voltage by
10mV.
Quoted 8 lines
Quoted 1 line
"s 7 1000 -10" will update the Fmax to 1000Mhz and decrease voltage by
10mV.
Is there ever a case where you would want different values for Fmin/Fmax and Freq1/Freq3? I'm not entirely sure how the voltage curve and the min/max are related. If so, we should separate them and use something like my earlier proposal where we separate the voltage curve from the clk settings.
[Quan, Evan] Yes, it's OK to have different values for Freq1/Freq3 from Fmin/Fmax.
Quoted 5 lines
Also it might be more consistent to make the whole thing offset based rather than a mix of absolute values and offsets. E.g., "s 0 50 10" would increase the fmin by 50 Mhz and increase its voltage by 10 mV. "s 7 100 -10" would increase fmax by
100 Mhz and decrease voltage by 10mV.
[Quan, Evan] Make sense to me.
Quoted 16 lines
OD_RANGEwould give the the
absolute clk and voltage ranges for each setting. If we went this way, we'd need to also print the default settings as well, otherwise you don't have a reference point. Maybe something like:OD_SCLK:0: 0Mhz 0mV (100Mhz 900mV) 4: 0Mhz 0mV (200Mhz 1000mV) 7: 0Mhz 0mV (300Mhz 1100mV)
OD_MCLK:
3: 0Mhz 0mV (500Mhz 1100mV)
...
So in this case, the first two items would be the offset you want to apply and the last two items are the current absolute settings. Alternatively would could use absolute values for everything and convert to offsets for voltage in the driver. E.g.,OD_SCLK:
Quoted 8 lines
0: 100Mhz 900mV 4: 200Mhz 1000mV 7: 300Mhz 1100mV
OD_MCLK:
3: 500Mhz 1100mV
...
Then it would work pretty much the same as the previous interface.
[Quan, Evan] No, we cannot know the absolute voltage for each level. There is no such information(interface) provided by SMC fw.
Quoted 3 lines
Alex
Regards,
Evan
Quoted 436 lines
Quoted 19 lines
Same for MCLK except the voltage offset passed in takes no effect.
OD_SCLK:
0: 0Mhz 0mV4: 0Mhz 0mV 7: 0Mhz 0mV
OD_MCLK:
3: 0Mhz 0mV
OD_RANGE:
SCLK[0]: 0Mhz 0Mhz
VDDGFX[0]: 0mV 0mV
SCLK[4]: 0Mhz 0Mhz
VDDGFX[4]: 0mV 0mV
SCLK[7]: 0Mhz 0Mhz
VDDGFX[7]: 0mV 0mVQuoted 28 lines
MCLK[3]: 0Mhz 0Mhz
VDDMEM[3]: 0mV 0mVRegard,
EvanQuoted 21 lines
-----Original Message-----
From: Alex Deucher <[email protected]>
Sent: 2018年8月30日 13:06
To: Quan, Evan <[email protected]>
Cc: amd-gfx list <[email protected]>; Deucher, Alexander <[email protected]>; Zhu, Rex <[email protected]>
Subject: Re: [PATCH] drm/amd/powerplay: added vega20 overdrive supportQuoted 9 lines · Evan
Hi Alex,
Quoted 2 lines
What about the min/max sclk? Do the curve values take that into account? What about max mclk?
Voltage curve does not take these into consideration. And the max sclk and
mclk can be set through existing sysfs interface
pp_sclk_odand
pp_mclk_od.Quoted 74 lines
Quoted 74 lines
For min sclk, as i know there is no interface to get it set.
Quoted 1 line
I'd prefer to allow adjusting min and max clocks via this interface for consistency with vega10 and smu7. I'd like to deprecate the
pp_sclk_odandpp_mclk_odinterfaces because the are percentage based and don't support underclocking.Alex
Quoted 10 lines
Quoted 2 lines
Are negative offsets supported?
Sure.
Regards,
Evan
Quoted 6 lines
________________________________
From: Alex Deucher <[email protected]>
Sent: Thursday, August 30, 2018 12:25:35 AM
To: Quan, Evan
Cc: amd-gfx list; Deucher, Alexander; Zhu, Rex
Subject: Re: [PATCH] drm/amd/powerplay: added vega20 overdrivesupport
Quoted 2 lines
On Wed, Aug 29, 2018 at 5:13 AM Evan Quan <[email protected]>
Quoted 15 lines · wrote:
Quoted 6 lines
Vega20 supports only sclk voltage overdrive. And user can only tell three groups of <frequency,
voltage_offset>. SMU firmware will recalculate the frequency/voltage curve. Other intermediate levles will be stretched/shrunk accordingly.What about the min/max sclk? Do the curve values take that into account? What about max mclk?
Quoted 5 lines
Change-Id I403cb38a95863db664cf06d030ac42a19bff6b33Signed-off-by Evan Quan <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c | 26 +++ .../drm/amd/powerplay/hwmgr/vega20_hwmgr.c | 165+++++++++++++++++-
Quoted 10 lines
Quoted 10 lines
.../drm/amd/powerplay/hwmgr/vega20_hwmgr.h | 2 + 3 files changed, 192 insertions(+), 1 deletion(-)drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c +0
-0@@ -474,6 +474,8 @@ static ssize_t amdgpu_set_pp_table(structdevice
*dev,
Quoted 2 lines
Quoted 2 lines
* in each power level within a power state. The
pp_od_clk_voltageisused for
Quoted 10 lines
Quoted 10 lines
* this.
*
+ * < For Vega10 and previous ASICs >
+ *
* Reading the file will display:
*
* - a list of engine clock levels and voltages labeledOD_SCLK
@@
-491,6 +493,30 @@ staticssize_tamdgpu_set_pp_table(struct device*dev,
Quoted 2 lines
Quoted 2 lines
* "c" (commit) to the file to commit your changes. If you
want to resetto the
Quoted 11 lines
Quoted 11 lines
Quoted 11 lines
Quoted 11 lines
* default power levels, write "r" (reset) to the file to reset them. *
+ *
+ * < For Vega20 >
+ *
+ * Reading the file will display:
+ *
+ * - three groups of engine clock and voltage offset labeled
+OD_SCLK
+ *
+ * - a list of valid ranges for above three groups of sclk and voltageoffset
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
+ * labeled
OD_RANGE
+ *
+ * To manually adjust these settings:
+ *
+ * - First select manual using
+power_dpm_force_performance_level
+ *
+ * - Enter a new value for each group by writing a string that contains
+ * "sgroup_indexclockvoltage_offset" to the file. E.g., "s 0 500 20"
+ * will update group1 sclk to be 500 MHz with voltage increased20mV
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 1 line
+ *
Are negative offsets supported?
Alex
Quoted 1 line
+ * - When you have edited all of the states as needed, write "c"
(commit)
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
+ * to the file to commit your changes
+ *
+ * - If you want to reset to the default power levels, write "r" (reset)
+ * to the file to reset them
+ *
*/static
ssize_tamdgpu_set_pp_od_clk_voltage(struct device *dev,
diff --git
a/drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.cQuoted 39 lines
Quoted 39 lines
Quoted 5 lines
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c static int
Quoted 5 lines
b/drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.cindexececa2f7fe5f..9f6e070a76e0100644drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c +0
-0@@ -1096,6 +1096,13 @@ static intvega20_od8_initialize_default_settings(
Quoted 13 lines
Quoted 13 lines
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c +7
-0} } + ret =vega20_copy_table_from_smc (hwmgr, + (uint8_t *)(&data->od_table), +TABLE_OVERDRIVE ); +PP_ASSERT_WITH_CODE (!ret, +"Failed to export over drive table!" , + return ret); +return 0 ; }Quoted 1 line
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c static int
Quoted 1 line
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c +0
-0@@ -2506,11 +2513,112 @@ static intvega20_set_watermarks_for_clocks_ranges(struct
pp_hwmgr*hwmgr,Quoted 17 lines
Quoted 7 lines
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c +4
-0return 0 ; } +static int vega20_odn_edit_dpm_table (struct pp_hwmgr *hwmgr, +enum PP_OD_DPM_TABLE_COMMAND type, +long *input,uint32_t +size) {drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c static int · line 2529
Quoted 10 lines
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c +10
-0+struct vega20_hwmgr *data = + (struct vega20_hwmgr *)(hwmgr->backend); +struct vega20_od8_single_setting *od8_settings = + data->od8_settings.od8_settings_array; +OverDriveTable_t od_table; +int32_t input_index, input_clk, input_vol, i; +int ret =0 ; + + PP_ASSERT_WITH_CODE(input, "NULL user input for clock + andvoltage",
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c static int · line 2534
Quoted 5 lines
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c +5
-0+ return -EINVAL); + +switch (type) { +case PP_OD_EDIT_SCLK_VDDC_TABLE : + if (!(od8_settings[OD8_SETTING_GFXCLK_FREQ1].feature_id&&
Quoted 1 line
Quoted 1 line
Quoted 1 line
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c static int · line 2535
Quoted 1 line
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c +1
-0+ od8_settings[OD8_SETTING_GFXCLK_FREQ2 ].feature_id&&
Quoted 1 line
Quoted 1 line
Quoted 1 line
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c static int · line 2536
Quoted 1 line
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c +1
-0+ od8_settings[OD8_SETTING_GFXCLK_FREQ3 ].feature_id&&
Quoted 28 lines
Quoted 28 lines
Quoted 2 lines
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c static int · line 2538
Quoted 2 lines
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c +2
-0+ + od8_settings[OD8_SETTING_GFXCLK_VOLTAGE1 ].feature_id&&
Quoted 2 lines
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c static int · line 2540
Quoted 2 lines
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c +2
-0+ + od8_settings[OD8_SETTING_GFXCLK_VOLTAGE2 ].feature_id&&
Quoted 2 lines
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c static int · line 2542
Quoted 2 lines
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c +2
-0+ + od8_settings[OD8_SETTING_GFXCLK_VOLTAGE3].feature_id)){
Quoted 8 lines
Quoted 8 lines
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c +8
-0+pr_info ("Sclk voltage overdrive not supported\n" ); +return 0 ; + } + +for (i =0 ; i < size; i +=3 ) { +if (i +3 > size) { +pr_info ("invalid clock voltage input\n" ); +return 0 ;Quoted 8 lines
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c static int · line 2558
Quoted 8 lines
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c +8
-0+ } + + input_index = input[i]; + input_clk = input[i +1 ]; + input_vol = input[i +2 ]; +if (input_index >2 || + input_clk < + od8_settings[OD8_SETTING_GFXCLK_FREQ1 +
input_index* 2].min_value ||Quoted 2 lines
Quoted 2 lines
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c +2
-0+ input_clk > + od8_settings[OD8_SETTING_GFXCLK_FREQ1 +Quoted 8 lines
Quoted 8 lines
input_index* 2].max_value ||Quoted 1 line
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c static int · line 2561
Quoted 1 line
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c +1
-0+ input_vol <od8_settings[OD8_SETTING_GFXCLK_VOLTAGE1 +
input_index* 2].min_value ||Quoted 1 line
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c static int · line 2562
Quoted 1 line
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c +1
-0+ input_vol >od8_settings[OD8_SETTING_GFXCLK_VOLTAGE1 +
input_index* 2].max_value) {Quoted 1 line
Quoted 1 line
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c +1
-0+ pr_info("input argument is not within allowedrange\n");
Quoted 71 lines
Quoted 71 lines
Quoted 67 lines
Quoted 67 lines
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c +61
-1+return -EINVAL ; + } + +switch (input_index) { +case 0 : + data->od_table.GfxclkFreq1 = input_clk; + data->od_table.GfxclkOffsetVolt1 = input_vol; +break ; +case 1 : + data->od_table.GfxclkFreq2 = input_clk; + data->od_table.GfxclkOffsetVolt2 = input_vol; +break ; +case 2 : + data->od_table.GfxclkFreq3 = input_clk; + data->od_table.GfxclkOffsetVolt3 = input_vol; +break ; + } + } +break ; + +case PP_OD_EDIT_MCLK_VDDC_TABLE : +pr_info ("Mclk voltage overdrive not supported!\n" ); +break ; + +case PP_OD_RESTORE_DEFAULT_TABLE : + ret =vega20_copy_table_from_smc (hwmgr, + (uint8_t *)(&od_table), +TABLE_OVERDRIVE ); +PP_ASSERT_WITH_CODE (!ret, +"Failed to export over drive table!" , + return ret); + +memcpy (&data->od_table, &od_table,sizeof (od_table)); +break ; + +case PP_OD_COMMIT_DPM_TABLE : +memcpy (&od_table, &data->od_table, +sizeof (od_table)); + + ret =vega20_copy_table_to_smc (hwmgr, + (uint8_t *)(&od_table), +TABLE_OVERDRIVE ); +PP_ASSERT_WITH_CODE (!ret, +"Failed to import over drive table!" , + return ret); + +break ; + +default : +return -EINVAL ; + } + +return 0 ; +} +static int vega20_print_clock_levels (struct pp_hwmgr *hwmgr,enum pp_clock_type type,char *buf) { -int i, now, size =0 ; +struct vega20_hwmgr *data = + (struct vega20_hwmgr *)(hwmgr->backend); +struct vega20_od8_single_setting *od8_settings = + data->od8_settings.od8_settings_array; +OverDriveTable_t *od_table = &data->od_table;struct pp_clock_levels_with_latency clocks; +int i, now, size =0 ;int ret =0 ;Quoted 3 lines
Quoted 3 lines
switch (type) {drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c +0
-0@@ -2551,6 +2659,59 @@ static intvega20_print_clock_levels(struct
pp_hwmgr*hwmgr,Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c
Quoted 5 lines
case PP_PCIE: break;drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c +2
-0+case OD_SCLK : + if (od8_settings[OD8_SETTING_GFXCLK_FREQ1].feature_id&&
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
+ od8_settings[OD8_SETTING_GFXCLK_FREQ2].feature_id
&&
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
+ od8_settings[OD8_SETTING_GFXCLK_FREQ3].feature_id
&&
Quoted 19 lines
Quoted 19 lines
Quoted 2 lines
Quoted 2 lines
+
+ od8_settings[OD8_SETTING_GFXCLK_VOLTAGE1].feature_id&&
Quoted 2 lines
Quoted 2 lines
+
+ od8_settings[OD8_SETTING_GFXCLK_VOLTAGE2].feature_id&&
Quoted 13 lines
Quoted 13 lines
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c +13
-0+ + od8_settings[OD8_SETTING_GFXCLK_VOLTAGE3].feature_id) { + + size =sprintf (buf,"%s:\n" ,"OD_SCLK" ); + size +=sprintf (buf + size,"0: %10uMhz %10dmV\n" , + od_table->GfxclkFreq1, + od_table->GfxclkOffsetVolt1); + size +=sprintf (buf + size,"1: %10uMhz %10dmV\n" , + od_table->GfxclkFreq2, + od_table->GfxclkOffsetVolt2); + size +=sprintf (buf + size,"2: %10uMhz %10dmV\n" , + od_table->GfxclkFreq3, + od_table->GfxclkOffsetVolt3);Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c
Quoted 8 lines
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c +8
-0+ } +break ; + +case OD_MCLK : +break ; + +case OD_RANGE : + if (od8_settings[OD8_SETTING_GFXCLK_FREQ1].feature_id&&
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
+ od8_settings[OD8_SETTING_GFXCLK_FREQ2].feature_id
&&
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
+ od8_settings[OD8_SETTING_GFXCLK_FREQ3].feature_id
&&
Quoted 11 lines
Quoted 11 lines
Quoted 2 lines
Quoted 2 lines
+
+ od8_settings[OD8_SETTING_GFXCLK_VOLTAGE1].feature_id&&
Quoted 2 lines
Quoted 2 lines
+
+ od8_settings[OD8_SETTING_GFXCLK_VOLTAGE2].feature_id&&
Quoted 5 lines
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c
Quoted 5 lines
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c +5
-0+ + od8_settings[OD8_SETTING_GFXCLK_VOLTAGE3].feature_id) { + + size =sprintf (buf,"%s:\n" ,"OD_RANGE" ); + size += sprintf(buf + size,"SCLK[0]: %7uMhz %10uMhz\n",
Quoted 11 lines
Quoted 11 lines
Quoted 3 lines
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c
Quoted 3 lines
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c +3
-0+ + od8_settings[OD8_SETTING_GFXCLK_FREQ1].min_value, +od8_settings[OD8_SETTING_GFXCLK_FREQ1].max_value);
Quoted 3 lines
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c
Quoted 3 lines
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c +3
-0+ size += sprintf(buf + size, "VDDC[0]: + %7dmV %11dmV\n", +od8_settings[OD8_SETTING_GFXCLK_VOLTAGE1].min_value,
Quoted 1 line
Quoted 1 line
+
od8_settings[OD8_SETTING_GFXCLK_VOLTAGE1].max_value);
Quoted 1 line
Quoted 1 line
+ size += sprintf(buf + size,
"SCLK[1]: %7uMhz %10uMhz\n",
Quoted 11 lines
Quoted 11 lines
Quoted 3 lines
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c
Quoted 3 lines
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c +3
-0+ + od8_settings[OD8_SETTING_GFXCLK_FREQ2].min_value, +od8_settings[OD8_SETTING_GFXCLK_FREQ2].max_value);
Quoted 3 lines
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c
Quoted 3 lines
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c +3
-0+ size += sprintf(buf + size, "VDDC[1]: + %7dmV %11dmV\n", +od8_settings[OD8_SETTING_GFXCLK_VOLTAGE2].min_value,
Quoted 1 line
Quoted 1 line
+
od8_settings[OD8_SETTING_GFXCLK_VOLTAGE2].max_value);
Quoted 1 line
Quoted 1 line
+ size += sprintf(buf + size,
"SCLK[2]: %7uMhz %10uMhz\n",
Quoted 38 lines
Quoted 38 lines
Quoted 3 lines
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c
Quoted 3 lines
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c +3
-0+ + od8_settings[OD8_SETTING_GFXCLK_FREQ3].min_value, +od8_settings[OD8_SETTING_GFXCLK_FREQ3].max_value);
Quoted 3 lines
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c
Quoted 3 lines
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c +3
-0+ size += sprintf(buf + size, "VDDC[2]: + %7dmV %11dmV\n", +od8_settings[OD8_SETTING_GFXCLK_VOLTAGE3].min_value,
Quoted 1 line
Quoted 1 line
+
od8_settings[OD8_SETTING_GFXCLK_VOLTAGE3].max_value);
Quoted 6 lines
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c static const struct pp_hwmgr_func
Quoted 6 lines
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c +2
-0+ } +break ;default :break ; }@@ -3162,6 +3323,8 @@ static const struct pp_hwmgr_func
vega20_hwmgr_funcs= {Quoted 21 lines
Quoted 21 lines
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c +2
-0vega20_get_mclk_od, .set_mclk_od = vega20_set_mclk_od, + .odn_edit_dpm_table = + vega20_odn_edit_dpm_table,/* for sysfs to retrive/set gfxclk/memclk */ .force_clock_level = vega20_force_clock_level, diff --git
a/drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.hb/drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.hindex72e4f2a55641..8bb90e22efb6100644drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.h +2
-0@@ -513,6 +513,8 @@ struct vega20_hwmgr {/* ---- Gfxoff ---- */ bool gfxoff_allowed;uint32_t counter_gfxoff; + +OverDriveTable_t od_table; };
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.h +0
-1#define VEGA20_DPM2_NEAR_TDP_DEC 10 --2.18.0
_______________________________________________
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): SN6PR12MB2656E6EACB712F457315A5E0E40F0-kxOKjb6HO/FeL/[email protected]
Quoted 3 lines
If so, we should separate them and
use something like my earlier proposal where we separate the voltage curve from the clk settings.
There is one more thing. Previously these OD APIs mix clock and voltage settings together. That is "s/m level clock voltage". Do you think whether we should update the usage on vega20 as:
"s level clock" --> set fmin/fmax
"m level clock" --> set Umax
"vc level clock voltage" --> Newly added, set freq/voltage curve?
Regards,
Evan
Quoted 534 lines
-----Original Message-----
From: Quan, Evan
Sent: 2018年8月31日 10:40
To: 'Alex Deucher' <[email protected]>
Cc: amd-gfx list <[email protected]>; Deucher, Alexander <[email protected]>; Zhu, Rex <[email protected]>
Subject: RE: [PATCH] drm/amd/powerplay: added vega20 overdrive supportHi Alex,
comment inline
Quoted 7 lines
-----Original Message-----
From: Alex Deucher <[email protected]>
Sent: 2018年8月30日 23:25
To: Quan, Evan <[email protected]>
Cc: amd-gfx list <[email protected]>; Deucher, Alexander <[email protected]>; Zhu, Rex <[email protected]>
Subject: Re: [PATCH] drm/amd/powerplay: added vega20 overdrivesupport
Quoted 2 lines
On Thu, Aug 30, 2018 at 1:56 AM Quan, Evan <[email protected]>
Quoted 13 lines · wrote:
Quoted 7 lines
Hi Alex,
OK, I got your concern. Then how about the followings?
If user want to change the FMin and FMax, they just need to pass in the
new clock values.
Quoted 2 lines
E.g, "s 0 350 10" will update the Fmin to 350Mhz and increase its voltage by
10mV.
Quoted 2 lines
"s 7 1000 -10" will update the Fmax to 1000Mhz and decrease voltage by
Quoted 7 lines
10mV.
Is there ever a case where you would want different values for Fmin/Fmax and Freq1/Freq3? I'm not entirely sure how the voltage curve and the min/max are related. If so, we should separate them and use something like my earlier proposal where we separate the voltage curve from the clk settings.
[Quan, Evan] Yes, it's OK to have different values for Freq1/Freq3 from Fmin/Fmax.
Quoted 6 lines
Also it might be more consistent to make the whole thing offset based rather than a mix of absolute values and offsets. E.g., "s 0 50 10" would increase the fmin by 50 Mhz and increase its voltage by 10 mV. "s 7
100 -10" would increase fmax by
100 Mhz and decrease voltage by 10mV.[Quan, Evan] Make sense to me.
Quoted 16 lines
OD_RANGEwould give the the
absolute clk and voltage ranges for each setting. If we went this way, we'd need to also print the default settings as well, otherwise you don't have a reference point. Maybe something like:OD_SCLK:0: 0Mhz 0mV (100Mhz 900mV) 4: 0Mhz 0mV (200Mhz 1000mV) 7: 0Mhz 0mV (300Mhz 1100mV)
OD_MCLK:
3: 0Mhz 0mV (500Mhz 1100mV)
...
So in this case, the first two items would be the offset you want to apply and the last two items are the current absolute settings. Alternatively would could use absolute values for everything and convert to offsets for voltage in the driver. E.g.,OD_SCLK:Quoted 8 lines
0: 100Mhz 900mV 4: 200Mhz 1000mV 7: 300Mhz 1100mV
OD_MCLK:
3: 500Mhz 1100mV
...
Then it would work pretty much the same as the previous interface.[Quan, Evan] No, we cannot know the absolute voltage for each level. There is no such information(interface) provided by SMC fw.
Quoted 3 lines
Alex
Regards,
EvanQuoted 26 lines
Quoted 26 lines
Same for MCLK except the voltage offset passed in takes no effect.
OD_SCLK:
0: 0Mhz 0mV4: 0Mhz 0mV 7: 0Mhz 0mV
OD_MCLK:
3: 0Mhz 0mV
OD_RANGE:
SCLK[0]: 0Mhz 0Mhz
VDDGFX[0]: 0mV 0mV
SCLK[4]: 0Mhz 0Mhz
VDDGFX[4]: 0mV 0mV
SCLK[7]: 0Mhz 0Mhz
VDDGFX[7]: 0mV 0mVMCLK[3]: 0Mhz 0Mhz
VDDMEM[3]: 0mV 0mVRegard,
EvanQuoted 6 lines
Quoted 6 lines
Quoted 6 lines
-----Original Message-----
From: Alex Deucher <[email protected]>
Sent: 2018年8月30日 13:06
To: Quan, Evan <[email protected]>
Cc: amd-gfx list <[email protected]>; Deucher, Alexander <[email protected]>; Zhu, RexQuoted 102 lines
Quoted 9 lines
Quoted 9 lines
Subject: Re: [PATCH] drm/amd/powerplay: added vega20 overdrive support
Quoted 4 lines · Evan
Hi Alex,
Quoted 6 lines
Quoted 6 lines
Quoted 5 lines
Quoted 2 lines
What about the min/max sclk? Do the curve values take that into account? What about max mclk?
Voltage curve does not take these into consideration. And the max sclk and
mclk can be set through existing sysfs interface
pp_sclk_odand
pp_mclk_od.Quoted 74 lines
Quoted 74 lines
For min sclk, as i know there is no interface to get it set.
Quoted 1 line
I'd prefer to allow adjusting min and max clocks via this interface for consistency with vega10 and smu7. I'd like to deprecate the
pp_sclk_odandpp_mclk_odinterfaces because the are percentage based and don't support underclocking.Alex
Quoted 10 lines
Quoted 2 lines
Are negative offsets supported?
Sure.
Regards,
Evan
Quoted 6 lines
________________________________
From: Alex Deucher <[email protected]>
Sent: Thursday, August 30, 2018 12:25:35 AM
To: Quan, Evan
Cc: amd-gfx list; Deucher, Alexander; Zhu, Rex
Subject: Re: [PATCH] drm/amd/powerplay: added vega20 overdrivesupport
Quoted 2 lines
On Wed, Aug 29, 2018 at 5:13 AM Evan Quan <[email protected]>
Quoted 15 lines · wrote:
Quoted 6 lines
Vega20 supports only sclk voltage overdrive. And user can only tell three groups of <frequency,
voltage_offset>. SMU firmware will recalculate the frequency/voltage curve. Other intermediate levles will be stretched/shrunk accordingly.What about the min/max sclk? Do the curve values take that into account? What about max mclk?
Quoted 5 lines
Change-Id I403cb38a95863db664cf06d030ac42a19bff6b33Signed-off-by Evan Quan <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c | 26 +++ .../drm/amd/powerplay/hwmgr/vega20_hwmgr.c | 165+++++++++++++++++-
Quoted 10 lines
Quoted 10 lines
.../drm/amd/powerplay/hwmgr/vega20_hwmgr.h | 2 + 3 files changed, 192 insertions(+), 1 deletion(-)drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c +0
-0@@ -474,6 +474,8 @@ static ssize_t amdgpu_set_pp_table(structdevice
*dev,
Quoted 2 lines
Quoted 2 lines
* in each power level within a power state. The
pp_od_clk_voltageisused for
Quoted 10 lines
Quoted 10 lines
* this.
*
+ * < For Vega10 and previous ASICs >
+ *
* Reading the file will display:
*
* - a list of engine clock levels and voltages labeledOD_SCLK@@
-491,6 +493,30 @@ staticssize_tamdgpu_set_pp_table(struct device*dev,
Quoted 2 lines
Quoted 2 lines
* "c" (commit) to the file to commit your changes. If you
want to resetto the
Quoted 12 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
* default power levels, write "r" (reset) to the file to reset them. *
+ *
+ * < For Vega20 >Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
+ *
+ * Reading the file will display:
+ *
+ * - three groups of engine clock and voltage offset labeled
+OD_SCLK
+ *
+ * - a list of valid ranges for above three groups of sclk
+ and voltageQuoted 9 lines
offset
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
+ * labeled
OD_RANGE
+ *
+ * To manually adjust these settings:
+ *
+ * - First select manual using
+power_dpm_force_performance_level
+ *
+ * - Enter a new value for each group by writing a string thatcontains
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
+ * "s
group_indexclockvoltage_offset" to the file. E.g., "s 0 50020"
Quoted 13 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
+ * will update group1 sclk to be 500 MHz with voltage increased
20mV
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 1 line
+ *
Are negative offsets supported?
Alex
Quoted 1 line
+ * - When you have edited all of the states as needed, write "c"
(commit)
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
+ * to the file to commit your changes
+ *
+ * - If you want to reset to the default power levels, write "r"(reset)
Quoted 290 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
+ * to the file to reset them
+ *
*/static
ssize_tamdgpu_set_pp_od_clk_voltage(struct device
*dev, diff --git
a/drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.cQuoted 39 lines
Quoted 39 lines
Quoted 5 lines
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c static int
Quoted 5 lines
b/drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.cindexececa2f7fe5f..9f6e070a76e0100644drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c +0
-0@@ -1096,6 +1096,13 @@ static intvega20_od8_initialize_default_settings(
Quoted 13 lines
Quoted 13 lines
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c +7
-0} } + ret =vega20_copy_table_from_smc (hwmgr, + (uint8_t *)(&data->od_table), +TABLE_OVERDRIVE ); +PP_ASSERT_WITH_CODE (!ret, +"Failed to export over drive table!" , + return ret); +return 0 ; }Quoted 1 line
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c static int
Quoted 1 line
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c +0
-0@@ -2506,11 +2513,112 @@ static intvega20_set_watermarks_for_clocks_ranges(struct
pp_hwmgr*hwmgr,Quoted 17 lines
Quoted 7 lines
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c +4
-0return 0 ; } +static int vega20_odn_edit_dpm_table (struct pp_hwmgr *hwmgr, +enum PP_OD_DPM_TABLE_COMMAND type, +long *input,uint32_t +size) {drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c static int · line 2529
Quoted 10 lines
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c +10
-0+struct vega20_hwmgr *data = + (struct vega20_hwmgr *)(hwmgr->backend); +struct vega20_od8_single_setting *od8_settings = + data->od8_settings.od8_settings_array; +OverDriveTable_t od_table; +int32_t input_index, input_clk, input_vol, i; +int ret =0 ; + + PP_ASSERT_WITH_CODE(input, "NULL user input for clock + andvoltage",
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c static int · line 2535
Quoted 6 lines
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c +6
-0+ return -EINVAL); + +switch (type) { +case PP_OD_EDIT_SCLK_VDDC_TABLE : + if + (!(od8_settings[OD8_SETTING_GFXCLK_FREQ1].feature_id&&
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c static int · line 2537
Quoted 2 lines
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c +2
-0+ + od8_settings[OD8_SETTING_GFXCLK_FREQ2 ].feature_id&&
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c static int · line 2539
Quoted 2 lines
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c +2
-0+ + od8_settings[OD8_SETTING_GFXCLK_FREQ3 ].feature_id&&
Quoted 29 lines
Quoted 29 lines
Quoted 2 lines
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c static int · line 2541
Quoted 2 lines
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c +2
-0+ + od8_settings[OD8_SETTING_GFXCLK_VOLTAGE1 ].feature_id&&
Quoted 2 lines
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c static int · line 2543
Quoted 2 lines
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c +2
-0+ + od8_settings[OD8_SETTING_GFXCLK_VOLTAGE2 ].feature_id&&
Quoted 2 lines
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c static int · line 2545
Quoted 2 lines
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c +2
-0+ + od8_settings[OD8_SETTING_GFXCLK_VOLTAGE3].feature_id)){
Quoted 8 lines
Quoted 8 lines
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c +8
-0+pr_info ("Sclk voltage overdrive not supported\n" ); +return 0 ; + } + +for (i =0 ; i < size; i +=3 ) { +if (i +3 > size) { +pr_info ("invalid clock voltage input\n" ); +return 0 ;Quoted 8 lines
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c static int · line 2561
Quoted 8 lines
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c +8
-0+ } + + input_index = input[i]; + input_clk = input[i +1 ]; + input_vol = input[i +2 ]; +if (input_index >2 || + input_clk < + od8_settings[OD8_SETTING_GFXCLK_FREQ1 +
input_index* 2].min_value ||Quoted 2 lines
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c static int · line 2563
Quoted 2 lines
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c +2
-0+ input_clk > + od8_settings[OD8_SETTING_GFXCLK_FREQ1 +
input_index* 2].max_value ||Quoted 8 lines
Quoted 8 lines
Quoted 1 line
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c static int · line 2564
Quoted 1 line
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c +1
-0+ input_vol <od8_settings[OD8_SETTING_GFXCLK_VOLTAGE1 +
input_index* 2].min_value ||Quoted 1 line
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c static int · line 2565
Quoted 1 line
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c +1
-0+ input_vol >od8_settings[OD8_SETTING_GFXCLK_VOLTAGE1 +
input_index* 2].max_value) {Quoted 2 lines
Quoted 2 lines
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c +2
-0+ pr_info("input argument is not + within allowedrange\n");
Quoted 71 lines
Quoted 71 lines
Quoted 67 lines
Quoted 67 lines
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c +61
-1+return -EINVAL ; + } + +switch (input_index) { +case 0 : + data->od_table.GfxclkFreq1 = input_clk; + data->od_table.GfxclkOffsetVolt1 = input_vol; +break ; +case 1 : + data->od_table.GfxclkFreq2 = input_clk; + data->od_table.GfxclkOffsetVolt2 = input_vol; +break ; +case 2 : + data->od_table.GfxclkFreq3 = input_clk; + data->od_table.GfxclkOffsetVolt3 = input_vol; +break ; + } + } +break ; + +case PP_OD_EDIT_MCLK_VDDC_TABLE : +pr_info ("Mclk voltage overdrive not supported!\n" ); +break ; + +case PP_OD_RESTORE_DEFAULT_TABLE : + ret =vega20_copy_table_from_smc (hwmgr, + (uint8_t *)(&od_table), +TABLE_OVERDRIVE ); +PP_ASSERT_WITH_CODE (!ret, +"Failed to export over drive table!" , + return ret); + +memcpy (&data->od_table, &od_table,sizeof (od_table)); +break ; + +case PP_OD_COMMIT_DPM_TABLE : +memcpy (&od_table, &data->od_table, +sizeof (od_table)); + + ret =vega20_copy_table_to_smc (hwmgr, + (uint8_t *)(&od_table), +TABLE_OVERDRIVE ); +PP_ASSERT_WITH_CODE (!ret, +"Failed to import over drive table!" , + return ret); + +break ; + +default : +return -EINVAL ; + } + +return 0 ; +} +static int vega20_print_clock_levels (struct pp_hwmgr *hwmgr,enum pp_clock_type type,char *buf) { -int i, now, size =0 ; +struct vega20_hwmgr *data = + (struct vega20_hwmgr *)(hwmgr->backend); +struct vega20_od8_single_setting *od8_settings = + data->od8_settings.od8_settings_array; +OverDriveTable_t *od_table = &data->od_table;struct pp_clock_levels_with_latency clocks; +int i, now, size =0 ;int ret =0 ;Quoted 3 lines
Quoted 3 lines
switch (type) {drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c +0
-0@@ -2551,6 +2659,59 @@ static intvega20_print_clock_levels(struct
pp_hwmgr*hwmgr,Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c
Quoted 6 lines
case PP_PCIE: break;drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c +3
-0+case OD_SCLK : +if + (od8_settings[OD8_SETTING_GFXCLK_FREQ1].feature_id&&
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
+
+ od8_settings[OD8_SETTING_GFXCLK_FREQ2].feature_id&&
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
+
+ od8_settings[OD8_SETTING_GFXCLK_FREQ3].feature_id&&
Quoted 20 lines
Quoted 20 lines
Quoted 2 lines
Quoted 2 lines
+
+ od8_settings[OD8_SETTING_GFXCLK_VOLTAGE1].feature_id&&
Quoted 2 lines
Quoted 2 lines
+
+ od8_settings[OD8_SETTING_GFXCLK_VOLTAGE2].feature_id&&
Quoted 14 lines
Quoted 14 lines
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c +14
-0+ + od8_settings[OD8_SETTING_GFXCLK_VOLTAGE3].feature_id) { + + size =sprintf (buf,"%s:\n" ,"OD_SCLK" ); + size +=sprintf (buf + size,"0: %10uMhz %10dmV\n" , + od_table->GfxclkFreq1, + od_table->GfxclkOffsetVolt1); + size +=sprintf (buf + size,"1: %10uMhz %10dmV\n" , + od_table->GfxclkFreq2, + od_table->GfxclkOffsetVolt2); + size +=sprintf (buf + size,"2: %10uMhz %10dmV\n" , + od_table->GfxclkFreq3, + od_table->GfxclkOffsetVolt3); + }Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c
Quoted 8 lines
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c +8
-0+break ; + +case OD_MCLK : +break ; + +case OD_RANGE : +if + (od8_settings[OD8_SETTING_GFXCLK_FREQ1].feature_id&&
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
+
+ od8_settings[OD8_SETTING_GFXCLK_FREQ2].feature_id&&
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
+
+ od8_settings[OD8_SETTING_GFXCLK_FREQ3].feature_id&&
Quoted 11 lines
Quoted 11 lines
Quoted 2 lines
Quoted 2 lines
+
+ od8_settings[OD8_SETTING_GFXCLK_VOLTAGE1].feature_id&&
Quoted 2 lines
Quoted 2 lines
+
+ od8_settings[OD8_SETTING_GFXCLK_VOLTAGE2].feature_id&&
Quoted 5 lines
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c
Quoted 5 lines
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c +5
-0+ + od8_settings[OD8_SETTING_GFXCLK_VOLTAGE3].feature_id) { + + size =sprintf (buf,"%s:\n" ,"OD_RANGE" ); + size += sprintf(buf + size,"SCLK[0]: %7uMhz %10uMhz\n",
Quoted 11 lines
Quoted 11 lines
Quoted 3 lines
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c
Quoted 3 lines
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c +3
-0+ + od8_settings[OD8_SETTING_GFXCLK_FREQ1].min_value, +od8_settings[OD8_SETTING_GFXCLK_FREQ1].max_value);
Quoted 3 lines
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c
Quoted 3 lines
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c +3
-0+ size += sprintf(buf + size, "VDDC[0]: + %7dmV %11dmV\n", +od8_settings[OD8_SETTING_GFXCLK_VOLTAGE1].min_value,
Quoted 1 line
Quoted 1 line
+
od8_settings[OD8_SETTING_GFXCLK_VOLTAGE1].max_value);
Quoted 1 line
Quoted 1 line
+ size += sprintf(buf + size,
"SCLK[1]: %7uMhz %10uMhz\n",
Quoted 11 lines
Quoted 11 lines
Quoted 3 lines
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c
Quoted 3 lines
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c +3
-0+ + od8_settings[OD8_SETTING_GFXCLK_FREQ2].min_value, +od8_settings[OD8_SETTING_GFXCLK_FREQ2].max_value);
Quoted 3 lines
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c
Quoted 3 lines
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c +3
-0+ size += sprintf(buf + size, "VDDC[1]: + %7dmV %11dmV\n", +od8_settings[OD8_SETTING_GFXCLK_VOLTAGE2].min_value,
Quoted 1 line
Quoted 1 line
+
od8_settings[OD8_SETTING_GFXCLK_VOLTAGE2].max_value);
Quoted 1 line
Quoted 1 line
+ size += sprintf(buf + size,
"SCLK[2]: %7uMhz %10uMhz\n",
Quoted 38 lines
Quoted 38 lines
Quoted 3 lines
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c
Quoted 3 lines
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c +3
-0+ + od8_settings[OD8_SETTING_GFXCLK_FREQ3].min_value, +od8_settings[OD8_SETTING_GFXCLK_FREQ3].max_value);
Quoted 3 lines
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c
Quoted 3 lines
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c +3
-0+ size += sprintf(buf + size, "VDDC[2]: + %7dmV %11dmV\n", +od8_settings[OD8_SETTING_GFXCLK_VOLTAGE3].min_value,
Quoted 1 line
Quoted 1 line
+
od8_settings[OD8_SETTING_GFXCLK_VOLTAGE3].max_value);
Quoted 6 lines
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c static const struct pp_hwmgr_func
Quoted 6 lines
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c +2
-0+ } +break ;default :break ; }@@ -3162,6 +3323,8 @@ static const struct pp_hwmgr_func
vega20_hwmgr_funcs= {Quoted 21 lines
Quoted 21 lines
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c +2
-0vega20_get_mclk_od, .set_mclk_od = vega20_set_mclk_od, + .odn_edit_dpm_table = + vega20_odn_edit_dpm_table,/* for sysfs to retrive/set gfxclk/memclk */ .force_clock_level = vega20_force_clock_level, diff --git
a/drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.hb/drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.hindex72e4f2a55641..8bb90e22efb6100644drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.h +2
-0@@ -513,6 +513,8 @@ struct vega20_hwmgr {/* ---- Gfxoff ---- */ bool gfxoff_allowed;uint32_t counter_gfxoff; + +OverDriveTable_t od_table; };
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.h +0
-1#define VEGA20_DPM2_NEAR_TDP_DEC 10 --2.18.0
_______________________________________________
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): SN6PR12MB2656A875CF4D297A87DBBE2DE40F0-kxOKjb6HO/FeL/[email protected]
Quoted 9 lines · Evan
Quoted 4 lines
If so, we should separate them and
use something like my earlier proposal where we separate the voltage curve from the clk settings.There is one more thing. Previously these OD APIs mix clock and voltage settings together. That is "s/m level clock voltage". Do you think whether we should update the usage on vega20 as:
"s level clock" --> set fmin/fmax
"m level clock" --> set Umax
"vc level clock voltage" --> Newly added, set freq/voltage curve?
Yes. how about this?
OD_SCLK:
0: clock_value
1: clock_valueOD_MCLK:
1: clock_valueOD_VDDC_CURVE:
0: clock_value voltage_offset
1: clock_value voltage_offset
2: clock_value voltage_offsetOD_RANGE:
SCLK: clock_value clock_value MCLK: clock_value clock_value VDDC_CURVE_SCLK[0]: clock_value clock_value VDDC_CURVE_VOFF[0]: voltage_offset voltage_offset VDDC_CURVE_SCLK[1]: clock_value clock_value VDDC_CURVE_VOFF[1]: voltage_offset voltage_offset VDDC_CURVE_SCLK[2]: clock_value clock_value VDDC_CURVE_VOFF[2]: voltage_offset voltage_offset
OD_SCLK:
0: 150Mhz
1: 1000MhzOD_MCLK:
1: 800MhzOD_VDDC_CURVE:
0: 200Mhz 0mV
1: 500Mhz 0mV
2: 1000Mhz 0mVOD_RANGE:
SCLK: 100Mhz 1100Mhz MCLK: 200Mhz 900Mhz VDDC_CURVE_SCLK[0]: 100Mhz 300Mhz VDDC_CURVE_VOFF[0]: -10mV +10mV VDDC_CURVE_SCLK[1]: 400Mhz 700Mhz VDDC_CURVE_VOFF[1]: -10mV +10mV VDDC_CURVE_SCLK[2]: 800Mhz 1000Mhz VDDC_CURVE_VOFF[2]: -10mV +10mV
Alex
Quoted 537 lines
Regards,
EvanQuoted 534 lines
-----Original Message-----
From: Quan, Evan
Sent: 2018年8月31日 10:40
To: 'Alex Deucher' <[email protected]>
Cc: amd-gfx list <[email protected]>; Deucher, Alexander <[email protected]>; Zhu, Rex <[email protected]>
Subject: RE: [PATCH] drm/amd/powerplay: added vega20 overdrive supportHi Alex,
comment inline
Quoted 7 lines
-----Original Message-----
From: Alex Deucher <[email protected]>
Sent: 2018年8月30日 23:25
To: Quan, Evan <[email protected]>
Cc: amd-gfx list <[email protected]>; Deucher, Alexander <[email protected]>; Zhu, Rex <[email protected]>
Subject: Re: [PATCH] drm/amd/powerplay: added vega20 overdrivesupport
Quoted 2 lines
On Thu, Aug 30, 2018 at 1:56 AM Quan, Evan <[email protected]>
Quoted 13 lines · wrote:
Quoted 7 lines
Hi Alex,
OK, I got your concern. Then how about the followings?
If user want to change the FMin and FMax, they just need to pass in the
new clock values.
Quoted 2 lines
E.g, "s 0 350 10" will update the Fmin to 350Mhz and increase its voltage by
10mV.
Quoted 2 lines
"s 7 1000 -10" will update the Fmax to 1000Mhz and decrease voltage by
Quoted 7 lines
10mV.
Is there ever a case where you would want different values for Fmin/Fmax and Freq1/Freq3? I'm not entirely sure how the voltage curve and the min/max are related. If so, we should separate them and use something like my earlier proposal where we separate the voltage curve from the clk settings.
[Quan, Evan] Yes, it's OK to have different values for Freq1/Freq3 from Fmin/Fmax.
Quoted 6 lines
Also it might be more consistent to make the whole thing offset based rather than a mix of absolute values and offsets. E.g., "s 0 50 10" would increase the fmin by 50 Mhz and increase its voltage by 10 mV. "s 7
100 -10" would increase fmax by
100 Mhz and decrease voltage by 10mV.[Quan, Evan] Make sense to me.
Quoted 16 lines
OD_RANGEwould give the the
absolute clk and voltage ranges for each setting. If we went this way, we'd need to also print the default settings as well, otherwise you don't have a reference point. Maybe something like:OD_SCLK:0: 0Mhz 0mV (100Mhz 900mV) 4: 0Mhz 0mV (200Mhz 1000mV) 7: 0Mhz 0mV (300Mhz 1100mV)
OD_MCLK:
3: 0Mhz 0mV (500Mhz 1100mV)
...
So in this case, the first two items would be the offset you want to apply and the last two items are the current absolute settings. Alternatively would could use absolute values for everything and convert to offsets for voltage in the driver. E.g.,OD_SCLK:Quoted 8 lines
0: 100Mhz 900mV 4: 200Mhz 1000mV 7: 300Mhz 1100mV
OD_MCLK:
3: 500Mhz 1100mV
...
Then it would work pretty much the same as the previous interface.[Quan, Evan] No, we cannot know the absolute voltage for each level. There is no such information(interface) provided by SMC fw.
Quoted 3 lines
Alex
Regards,
EvanQuoted 26 lines
Quoted 26 lines
Same for MCLK except the voltage offset passed in takes no effect.
OD_SCLK:
0: 0Mhz 0mV4: 0Mhz 0mV 7: 0Mhz 0mV
OD_MCLK:
3: 0Mhz 0mV
OD_RANGE:
SCLK[0]: 0Mhz 0Mhz
VDDGFX[0]: 0mV 0mV
SCLK[4]: 0Mhz 0Mhz
VDDGFX[4]: 0mV 0mV
SCLK[7]: 0Mhz 0Mhz
VDDGFX[7]: 0mV 0mVMCLK[3]: 0Mhz 0Mhz
VDDMEM[3]: 0mV 0mVRegard,
EvanQuoted 6 lines
Quoted 6 lines
Quoted 6 lines
-----Original Message-----
From: Alex Deucher <[email protected]>
Sent: 2018年8月30日 13:06
To: Quan, Evan <[email protected]>
Cc: amd-gfx list <[email protected]>; Deucher, Alexander <[email protected]>; Zhu, RexQuoted 102 lines
Quoted 9 lines
Quoted 9 lines
Subject: Re: [PATCH] drm/amd/powerplay: added vega20 overdrive support
Quoted 4 lines · Evan
Hi Alex,
Quoted 6 lines
Quoted 6 lines
Quoted 5 lines
Quoted 2 lines
What about the min/max sclk? Do the curve values take that into account? What about max mclk?
Voltage curve does not take these into consideration. And the max sclk and
mclk can be set through existing sysfs interface
pp_sclk_odand
pp_mclk_od.Quoted 74 lines
Quoted 74 lines
For min sclk, as i know there is no interface to get it set.
Quoted 1 line
I'd prefer to allow adjusting min and max clocks via this interface for consistency with vega10 and smu7. I'd like to deprecate the
pp_sclk_odandpp_mclk_odinterfaces because the are percentage based and don't support underclocking.Alex
Quoted 10 lines
Quoted 2 lines
Are negative offsets supported?
Sure.
Regards,
Evan
Quoted 6 lines
________________________________
From: Alex Deucher <[email protected]>
Sent: Thursday, August 30, 2018 12:25:35 AM
To: Quan, Evan
Cc: amd-gfx list; Deucher, Alexander; Zhu, Rex
Subject: Re: [PATCH] drm/amd/powerplay: added vega20 overdrivesupport
Quoted 2 lines
On Wed, Aug 29, 2018 at 5:13 AM Evan Quan <[email protected]>
Quoted 15 lines · wrote:
Quoted 6 lines
Vega20 supports only sclk voltage overdrive. And user can only tell three groups of <frequency,
voltage_offset>. SMU firmware will recalculate the frequency/voltage curve. Other intermediate levles will be stretched/shrunk accordingly.What about the min/max sclk? Do the curve values take that into account? What about max mclk?
Quoted 5 lines
Change-Id I403cb38a95863db664cf06d030ac42a19bff6b33Signed-off-by Evan Quan <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c | 26 +++ .../drm/amd/powerplay/hwmgr/vega20_hwmgr.c | 165+++++++++++++++++-
Quoted 10 lines
Quoted 10 lines
.../drm/amd/powerplay/hwmgr/vega20_hwmgr.h | 2 + 3 files changed, 192 insertions(+), 1 deletion(-)drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c +0
-0@@ -474,6 +474,8 @@ static ssize_t amdgpu_set_pp_table(structdevice
*dev,
Quoted 2 lines
Quoted 2 lines
* in each power level within a power state. The
pp_od_clk_voltageisused for
Quoted 10 lines
Quoted 10 lines
* this.
*
+ * < For Vega10 and previous ASICs >
+ *
* Reading the file will display:
*
* - a list of engine clock levels and voltages labeledOD_SCLK@@
-491,6 +493,30 @@ staticssize_tamdgpu_set_pp_table(struct device*dev,
Quoted 2 lines
Quoted 2 lines
* "c" (commit) to the file to commit your changes. If you
want to resetto the
Quoted 12 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
* default power levels, write "r" (reset) to the file to reset them. *
+ *
+ * < For Vega20 >Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
+ *
+ * Reading the file will display:
+ *
+ * - three groups of engine clock and voltage offset labeled
+OD_SCLK
+ *
+ * - a list of valid ranges for above three groups of sclk
+ and voltageQuoted 9 lines
offset
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
+ * labeled
OD_RANGE
+ *
+ * To manually adjust these settings:
+ *
+ * - First select manual using
+power_dpm_force_performance_level
+ *
+ * - Enter a new value for each group by writing a string thatcontains
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
+ * "s
group_indexclockvoltage_offset" to the file. E.g., "s 0 50020"
Quoted 13 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
+ * will update group1 sclk to be 500 MHz with voltage increased
20mV
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 1 line
+ *
Are negative offsets supported?
Alex
Quoted 1 line
+ * - When you have edited all of the states as needed, write "c"
(commit)
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
+ * to the file to commit your changes
+ *
+ * - If you want to reset to the default power levels, write "r"(reset)
Quoted 290 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
+ * to the file to reset them
+ *
*/static
ssize_tamdgpu_set_pp_od_clk_voltage(struct device
*dev, diff --git
a/drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.cQuoted 39 lines
Quoted 39 lines
Quoted 5 lines
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c static int
Quoted 5 lines
b/drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.cindexececa2f7fe5f..9f6e070a76e0100644drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c +0
-0@@ -1096,6 +1096,13 @@ static intvega20_od8_initialize_default_settings(
Quoted 13 lines
Quoted 13 lines
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c +7
-0} } + ret =vega20_copy_table_from_smc (hwmgr, + (uint8_t *)(&data->od_table), +TABLE_OVERDRIVE ); +PP_ASSERT_WITH_CODE (!ret, +"Failed to export over drive table!" , + return ret); +return 0 ; }Quoted 1 line
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c static int
Quoted 1 line
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c +0
-0@@ -2506,11 +2513,112 @@ static intvega20_set_watermarks_for_clocks_ranges(struct
pp_hwmgr*hwmgr,Quoted 17 lines
Quoted 7 lines
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c +4
-0return 0 ; } +static int vega20_odn_edit_dpm_table (struct pp_hwmgr *hwmgr, +enum PP_OD_DPM_TABLE_COMMAND type, +long *input,uint32_t +size) {drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c static int · line 2529
Quoted 10 lines
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c +10
-0+struct vega20_hwmgr *data = + (struct vega20_hwmgr *)(hwmgr->backend); +struct vega20_od8_single_setting *od8_settings = + data->od8_settings.od8_settings_array; +OverDriveTable_t od_table; +int32_t input_index, input_clk, input_vol, i; +int ret =0 ; + + PP_ASSERT_WITH_CODE(input, "NULL user input for clock + andvoltage",
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c static int · line 2535
Quoted 6 lines
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c +6
-0+ return -EINVAL); + +switch (type) { +case PP_OD_EDIT_SCLK_VDDC_TABLE : + if + (!(od8_settings[OD8_SETTING_GFXCLK_FREQ1].feature_id&&
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c static int · line 2537
Quoted 2 lines
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c +2
-0+ + od8_settings[OD8_SETTING_GFXCLK_FREQ2 ].feature_id&&
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c static int · line 2539
Quoted 2 lines
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c +2
-0+ + od8_settings[OD8_SETTING_GFXCLK_FREQ3 ].feature_id&&
Quoted 29 lines
Quoted 29 lines
Quoted 2 lines
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c static int · line 2541
Quoted 2 lines
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c +2
-0+ + od8_settings[OD8_SETTING_GFXCLK_VOLTAGE1 ].feature_id&&
Quoted 2 lines
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c static int · line 2543
Quoted 2 lines
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c +2
-0+ + od8_settings[OD8_SETTING_GFXCLK_VOLTAGE2 ].feature_id&&
Quoted 2 lines
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c static int · line 2545
Quoted 2 lines
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c +2
-0+ + od8_settings[OD8_SETTING_GFXCLK_VOLTAGE3].feature_id)){
Quoted 8 lines
Quoted 8 lines
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c +8
-0+pr_info ("Sclk voltage overdrive not supported\n" ); +return 0 ; + } + +for (i =0 ; i < size; i +=3 ) { +if (i +3 > size) { +pr_info ("invalid clock voltage input\n" ); +return 0 ;Quoted 8 lines
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c static int · line 2561
Quoted 8 lines
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c +8
-0+ } + + input_index = input[i]; + input_clk = input[i +1 ]; + input_vol = input[i +2 ]; +if (input_index >2 || + input_clk < + od8_settings[OD8_SETTING_GFXCLK_FREQ1 +
input_index* 2].min_value ||Quoted 2 lines
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c static int · line 2563
Quoted 2 lines
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c +2
-0+ input_clk > + od8_settings[OD8_SETTING_GFXCLK_FREQ1 +
input_index* 2].max_value ||Quoted 8 lines
Quoted 8 lines
Quoted 1 line
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c static int · line 2564
Quoted 1 line
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c +1
-0+ input_vol <od8_settings[OD8_SETTING_GFXCLK_VOLTAGE1 +
input_index* 2].min_value ||Quoted 1 line
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c static int · line 2565
Quoted 1 line
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c +1
-0+ input_vol >od8_settings[OD8_SETTING_GFXCLK_VOLTAGE1 +
input_index* 2].max_value) {Quoted 2 lines
Quoted 2 lines
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c +2
-0+ pr_info("input argument is not + within allowedrange\n");
Quoted 71 lines
Quoted 71 lines
Quoted 67 lines
Quoted 67 lines
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c +61
-1+return -EINVAL ; + } + +switch (input_index) { +case 0 : + data->od_table.GfxclkFreq1 = input_clk; + data->od_table.GfxclkOffsetVolt1 = input_vol; +break ; +case 1 : + data->od_table.GfxclkFreq2 = input_clk; + data->od_table.GfxclkOffsetVolt2 = input_vol; +break ; +case 2 : + data->od_table.GfxclkFreq3 = input_clk; + data->od_table.GfxclkOffsetVolt3 = input_vol; +break ; + } + } +break ; + +case PP_OD_EDIT_MCLK_VDDC_TABLE : +pr_info ("Mclk voltage overdrive not supported!\n" ); +break ; + +case PP_OD_RESTORE_DEFAULT_TABLE : + ret =vega20_copy_table_from_smc (hwmgr, + (uint8_t *)(&od_table), +TABLE_OVERDRIVE ); +PP_ASSERT_WITH_CODE (!ret, +"Failed to export over drive table!" , + return ret); + +memcpy (&data->od_table, &od_table,sizeof (od_table)); +break ; + +case PP_OD_COMMIT_DPM_TABLE : +memcpy (&od_table, &data->od_table, +sizeof (od_table)); + + ret =vega20_copy_table_to_smc (hwmgr, + (uint8_t *)(&od_table), +TABLE_OVERDRIVE ); +PP_ASSERT_WITH_CODE (!ret, +"Failed to import over drive table!" , + return ret); + +break ; + +default : +return -EINVAL ; + } + +return 0 ; +} +static int vega20_print_clock_levels (struct pp_hwmgr *hwmgr,enum pp_clock_type type,char *buf) { -int i, now, size =0 ; +struct vega20_hwmgr *data = + (struct vega20_hwmgr *)(hwmgr->backend); +struct vega20_od8_single_setting *od8_settings = + data->od8_settings.od8_settings_array; +OverDriveTable_t *od_table = &data->od_table;struct pp_clock_levels_with_latency clocks; +int i, now, size =0 ;int ret =0 ;Quoted 3 lines
Quoted 3 lines
switch (type) {drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c +0
-0@@ -2551,6 +2659,59 @@ static intvega20_print_clock_levels(struct
pp_hwmgr*hwmgr,Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c
Quoted 6 lines
case PP_PCIE: break;drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c +3
-0+case OD_SCLK : +if + (od8_settings[OD8_SETTING_GFXCLK_FREQ1].feature_id&&
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
+
+ od8_settings[OD8_SETTING_GFXCLK_FREQ2].feature_id&&
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
+
+ od8_settings[OD8_SETTING_GFXCLK_FREQ3].feature_id&&
Quoted 20 lines
Quoted 20 lines
Quoted 2 lines
Quoted 2 lines
+
+ od8_settings[OD8_SETTING_GFXCLK_VOLTAGE1].feature_id&&
Quoted 2 lines
Quoted 2 lines
+
+ od8_settings[OD8_SETTING_GFXCLK_VOLTAGE2].feature_id&&
Quoted 14 lines
Quoted 14 lines
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c +14
-0+ + od8_settings[OD8_SETTING_GFXCLK_VOLTAGE3].feature_id) { + + size =sprintf (buf,"%s:\n" ,"OD_SCLK" ); + size +=sprintf (buf + size,"0: %10uMhz %10dmV\n" , + od_table->GfxclkFreq1, + od_table->GfxclkOffsetVolt1); + size +=sprintf (buf + size,"1: %10uMhz %10dmV\n" , + od_table->GfxclkFreq2, + od_table->GfxclkOffsetVolt2); + size +=sprintf (buf + size,"2: %10uMhz %10dmV\n" , + od_table->GfxclkFreq3, + od_table->GfxclkOffsetVolt3); + }Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c
Quoted 8 lines
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c +8
-0+break ; + +case OD_MCLK : +break ; + +case OD_RANGE : +if + (od8_settings[OD8_SETTING_GFXCLK_FREQ1].feature_id&&
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
+
+ od8_settings[OD8_SETTING_GFXCLK_FREQ2].feature_id&&
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
+
+ od8_settings[OD8_SETTING_GFXCLK_FREQ3].feature_id&&
Quoted 11 lines
Quoted 11 lines
Quoted 2 lines
Quoted 2 lines
+
+ od8_settings[OD8_SETTING_GFXCLK_VOLTAGE1].feature_id&&
Quoted 2 lines
Quoted 2 lines
+
+ od8_settings[OD8_SETTING_GFXCLK_VOLTAGE2].feature_id&&
Quoted 5 lines
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c
Quoted 5 lines
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c +5
-0+ + od8_settings[OD8_SETTING_GFXCLK_VOLTAGE3].feature_id) { + + size =sprintf (buf,"%s:\n" ,"OD_RANGE" ); + size += sprintf(buf + size,"SCLK[0]: %7uMhz %10uMhz\n",
Quoted 11 lines
Quoted 11 lines
Quoted 3 lines
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c
Quoted 3 lines
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c +3
-0+ + od8_settings[OD8_SETTING_GFXCLK_FREQ1].min_value, +od8_settings[OD8_SETTING_GFXCLK_FREQ1].max_value);
Quoted 3 lines
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c
Quoted 3 lines
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c +3
-0+ size += sprintf(buf + size, "VDDC[0]: + %7dmV %11dmV\n", +od8_settings[OD8_SETTING_GFXCLK_VOLTAGE1].min_value,
Quoted 1 line
Quoted 1 line
+
od8_settings[OD8_SETTING_GFXCLK_VOLTAGE1].max_value);
Quoted 1 line
Quoted 1 line
+ size += sprintf(buf + size,
"SCLK[1]: %7uMhz %10uMhz\n",
Quoted 11 lines
Quoted 11 lines
Quoted 3 lines
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c
Quoted 3 lines
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c +3
-0+ + od8_settings[OD8_SETTING_GFXCLK_FREQ2].min_value, +od8_settings[OD8_SETTING_GFXCLK_FREQ2].max_value);
Quoted 3 lines
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c
Quoted 3 lines
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c +3
-0+ size += sprintf(buf + size, "VDDC[1]: + %7dmV %11dmV\n", +od8_settings[OD8_SETTING_GFXCLK_VOLTAGE2].min_value,
Quoted 1 line
Quoted 1 line
+
od8_settings[OD8_SETTING_GFXCLK_VOLTAGE2].max_value);
Quoted 1 line
Quoted 1 line
+ size += sprintf(buf + size,
"SCLK[2]: %7uMhz %10uMhz\n",
Quoted 38 lines
Quoted 38 lines
Quoted 3 lines
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c
Quoted 3 lines
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c +3
-0+ + od8_settings[OD8_SETTING_GFXCLK_FREQ3].min_value, +od8_settings[OD8_SETTING_GFXCLK_FREQ3].max_value);
Quoted 3 lines
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c
Quoted 3 lines
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c +3
-0+ size += sprintf(buf + size, "VDDC[2]: + %7dmV %11dmV\n", +od8_settings[OD8_SETTING_GFXCLK_VOLTAGE3].min_value,
Quoted 1 line
Quoted 1 line
+
od8_settings[OD8_SETTING_GFXCLK_VOLTAGE3].max_value);
Quoted 6 lines
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c static const struct pp_hwmgr_func
Quoted 6 lines
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c +2
-0+ } +break ;default :break ; }@@ -3162,6 +3323,8 @@ static const struct pp_hwmgr_func
vega20_hwmgr_funcs= {Quoted 21 lines
Quoted 21 lines
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c +2
-0vega20_get_mclk_od, .set_mclk_od = vega20_set_mclk_od, + .odn_edit_dpm_table = + vega20_odn_edit_dpm_table,/* for sysfs to retrive/set gfxclk/memclk */ .force_clock_level = vega20_force_clock_level, diff --git
a/drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.hb/drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.hindex72e4f2a55641..8bb90e22efb6100644drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.h +2
-0@@ -513,6 +513,8 @@ struct vega20_hwmgr {/* ---- Gfxoff ---- */ bool gfxoff_allowed;uint32_t counter_gfxoff; + +OverDriveTable_t od_table; };
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.h +0
-1#define VEGA20_DPM2_NEAR_TDP_DEC 10 --2.18.0
_______________________________________________
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_Pea199QuFQmDZGE747NDtg=tyb58S003TyWMV7ZMDJ1A-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org
Make sense to me.
I will update the patch accordingly.
Regards,
Evan
Quoted 622 lines
-----Original Message-----
From: Alex Deucher <[email protected]>
Sent: 2018年8月31日 12:19
To: Quan, Evan <[email protected]>
Cc: amd-gfx list <[email protected]>; Deucher, Alexander <[email protected]>; Zhu, Rex <[email protected]>
Subject: Re: [PATCH] drm/amd/powerplay: added vega20 overdrive supportQuoted 5 lines · Evan
Quoted 4 lines
If so, we should separate them and
use something like my earlier proposal where we separate the voltage curve from the clk settings.There is one more thing. Previously these OD APIs mix clock and voltage
settings together.
Quoted 1 line
That is "s/m level clock voltage". Do you think whether we should update
the usage on vega20 as:
Quoted 3 lines
"s level clock" --> set fmin/fmax
"m level clock" --> set Umax
"vc level clock voltage" --> Newly added, set freq/voltage curve?Yes. how about this?
OD_SCLK:
0:clock_value
1:clock_valueOD_MCLK:
1:clock_valueOD_VDDC_CURVE:
0:clock_valuevoltage_offset
1:clock_valuevoltage_offset
2:clock_valuevoltage_offsetOD_RANGE:SCLK: clock_value clock_value MCLK: clock_value clock_value VDDC_CURVE_SCLK[0]: clock_value clock_value VDDC_CURVE_VOFF[0]: voltage_offset voltage_offset VDDC_CURVE_SCLK[1]: clock_value clock_value VDDC_CURVE_VOFF[1]: voltage_offset voltage_offset VDDC_CURVE_SCLK[2]: clock_value clock_value VDDC_CURVE_VOFF[2]: voltage_offset voltage_offset
OD_SCLK:
0: 150Mhz
1: 1000MhzOD_MCLK:
1: 800MhzOD_VDDC_CURVE:
0: 200Mhz 0mV
1: 500Mhz 0mV
2: 1000Mhz 0mVOD_RANGE:SCLK: 100Mhz 1100Mhz MCLK: 200Mhz 900Mhz VDDC_CURVE_SCLK[0]: 100Mhz 300Mhz VDDC_CURVE_VOFF[0]: -10mV +10mV VDDC_CURVE_SCLK[1]: 400Mhz 700Mhz VDDC_CURVE_VOFF[1]: -10mV +10mV VDDC_CURVE_SCLK[2]: 800Mhz 1000Mhz VDDC_CURVE_VOFF[2]: -10mV +10mVAlex
Quoted 22 lines
Regards,
EvanQuoted 19 lines
-----Original Message-----
From: Quan, Evan
Sent: 2018年8月31日 10:40
To: 'Alex Deucher' <[email protected]>
Cc: amd-gfx list <[email protected]>; Deucher, Alexander <[email protected]>; Zhu, Rex <[email protected]>
Subject: RE: [PATCH] drm/amd/powerplay: added vega20 overdrive supportHi Alex,
comment inline
Quoted 6 lines
-----Original Message-----
From: Alex Deucher <[email protected]>
Sent: 2018年8月30日 23:25
To: Quan, Evan <[email protected]>
Cc: amd-gfx list <[email protected]>; Deucher, Alexander <[email protected]>; Zhu, RexQuoted 188 lines
Quoted 188 lines
Quoted 1 line
Subject: Re: [PATCH] drm/amd/powerplay: added vega20 overdrive
support
Quoted 2 lines
On Thu, Aug 30, 2018 at 1:56 AM Quan, Evan <[email protected]>
Quoted 13 lines · wrote:
Quoted 7 lines
Hi Alex,
OK, I got your concern. Then how about the followings?
If user want to change the FMin and FMax, they just need to pass in the
new clock values.
Quoted 2 lines
E.g, "s 0 350 10" will update the Fmin to 350Mhz and increase its voltage by
10mV.
Quoted 2 lines
"s 7 1000 -10" will update the Fmax to 1000Mhz and decrease voltage by
Quoted 7 lines
10mV.
Is there ever a case where you would want different values for Fmin/Fmax and Freq1/Freq3? I'm not entirely sure how the voltage curve and the min/max are related. If so, we should separate them and use something like my earlier proposal where we separate the voltage curve from the clk settings.
[Quan, Evan] Yes, it's OK to have different values for Freq1/Freq3 from Fmin/Fmax.
Quoted 6 lines
Also it might be more consistent to make the whole thing offset based rather than a mix of absolute values and offsets. E.g., "s 0 50 10" would increase the fmin by 50 Mhz and increase its voltage by 10 mV. "s 7
100 -10" would increase fmax by
100 Mhz and decrease voltage by 10mV.[Quan, Evan] Make sense to me.
Quoted 16 lines
OD_RANGEwould give the the
absolute clk and voltage ranges for each setting. If we went this way, we'd need to also print the default settings as well, otherwise you don't have a reference point. Maybe something like:OD_SCLK:0: 0Mhz 0mV (100Mhz 900mV) 4: 0Mhz 0mV (200Mhz 1000mV) 7: 0Mhz 0mV (300Mhz 1100mV)
OD_MCLK:
3: 0Mhz 0mV (500Mhz 1100mV)
...
So in this case, the first two items would be the offset you want to apply and the last two items are the current absolute settings. Alternatively would could use absolute values for everything and convert to offsets for voltage in the driver. E.g.,OD_SCLK:Quoted 8 lines
0: 100Mhz 900mV 4: 200Mhz 1000mV 7: 300Mhz 1100mV
OD_MCLK:
3: 500Mhz 1100mV
...
Then it would work pretty much the same as the previous interface.[Quan, Evan] No, we cannot know the absolute voltage for each level. There is no such information(interface) provided by SMC fw.
Quoted 3 lines
Alex
Regards,
EvanQuoted 26 lines
Quoted 26 lines
Same for MCLK except the voltage offset passed in takes no effect.
OD_SCLK:
0: 0Mhz 0mV4: 0Mhz 0mV 7: 0Mhz 0mV
OD_MCLK:
3: 0Mhz 0mV
OD_RANGE:
SCLK[0]: 0Mhz 0Mhz
VDDGFX[0]: 0mV 0mV
SCLK[4]: 0Mhz 0Mhz
VDDGFX[4]: 0mV 0mV
SCLK[7]: 0Mhz 0Mhz
VDDGFX[7]: 0mV 0mVMCLK[3]: 0Mhz 0Mhz
VDDMEM[3]: 0mV 0mVRegard,
EvanQuoted 6 lines
Quoted 6 lines
Quoted 6 lines
-----Original Message-----
From: Alex Deucher <[email protected]>
Sent: 2018年8月30日 13:06
To: Quan, Evan <[email protected]>
Cc: amd-gfx list <[email protected]>; Deucher, Alexander <[email protected]>; Zhu, RexQuoted 90 lines
Quoted 10 lines
Quoted 10 lines
Subject: Re: [PATCH] drm/amd/powerplay: added vega20 overdrive support
Quoted 4 lines · Evan
Hi Alex,
Quoted 7 lines
Quoted 7 lines
Quoted 5 lines
Quoted 2 lines
What about the min/max sclk? Do the curve values take that into account? What about max mclk?
Voltage curve does not take these into consideration. And the max sclk and
mclk can be set through existing sysfs interface
pp_sclk_odand
pp_mclk_od.Quoted 72 lines
Quoted 72 lines
For min sclk, as i know there is no interface to get it set.
Quoted 1 line
I'd prefer to allow adjusting min and max clocks via this interface for consistency with vega10 and smu7. I'd like to deprecate the
pp_sclk_odandpp_mclk_odinterfaces because the are percentage based and don't support underclocking.Alex
Quoted 10 lines
Quoted 2 lines
Are negative offsets supported?
Sure.
Regards,
Evan
Quoted 7 lines
________________________________
From: Alex Deucher <[email protected]>
Sent: Thursday, August 30, 2018 12:25:35 AM
To: Quan, Evan
Cc: amd-gfx list; Deucher, Alexander; Zhu, Rex
Subject: Re: [PATCH] drm/amd/powerplay: added vega20 overdrivesupport
Quoted 3 lines
On Wed, Aug 29, 2018 at 5:13 AM Evan Quan
<[email protected]>Quoted 15 lines · wrote:
Quoted 6 lines
Vega20 supports only sclk voltage overdrive. And user can only tell three groups of <frequency,
voltage_offset>. SMU firmware will recalculate the frequency/voltage curve. Other intermediate levles will be stretched/shrunk accordingly.What about the min/max sclk? Do the curve values take that into account? What about max mclk?
Quoted 5 lines
Change-Id I403cb38a95863db664cf06d030ac42a19bff6b33Signed-off-by Evan Quan <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c | 26 +++ .../drm/amd/powerplay/hwmgr/vega20_hwmgr.c | 165+++++++++++++++++-
Quoted 10 lines
Quoted 10 lines
.../drm/amd/powerplay/hwmgr/vega20_hwmgr.h | 2 + 3 files changed, 192 insertions(+), 1 deletion(-)drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c +0
-0@@ -474,6 +474,8 @@ static ssize_tamdgpu_set_pp_table(struct device
*dev,
Quoted 2 lines
Quoted 2 lines
* in each power level within a power state. The
pp_od_clk_voltageisused for
Quoted 10 lines
Quoted 10 lines
* this.
*
+ * < For Vega10 and previous ASICs >
+ *
* Reading the file will display:
*
* - a list of engine clock levels and voltages labeledOD_SCLK@@
-491,6 +493,30 @@ staticssize_tamdgpu_set_pp_table(struct deviceQuoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
*dev,
Quoted 2 lines
Quoted 2 lines
* "c" (commit) to the file to commit your changes. If
you want to resetto the
Quoted 1 line
Quoted 1 line
* default power levels, write "r" (reset) to the file to reset
them.
Quoted 21 lines
Quoted 21 lines
Quoted 21 lines
Quoted 11 lines
Quoted 11 lines
Quoted 11 lines
Quoted 11 lines
*
+ *
+ * < For Vega20 >
+ *
+ * Reading the file will display:
+ *
+ * - three groups of engine clock and voltage offset
+ labeledOD_SCLK
+ *
+ * - a list of valid ranges for above three groups of
+ sclk and voltageoffset
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
+ * labeled
OD_RANGE
+ *
+ * To manually adjust these settings:
+ *
+ * - First select manual using
+power_dpm_force_performance_level
+ *
+ * - Enter a new value for each group by writing a string
+ thatQuoted 2 lines
Quoted 2 lines
contains
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
+ * "s
group_indexclockvoltage_offset" to the file. E.g., "s 0500
Quoted 2 lines
Quoted 2 lines
20"
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
+ * will update group1 sclk to be 500 MHz with voltage
increased
Quoted 17 lines
Quoted 17 lines
Quoted 12 lines
20mV
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 1 line
+ *
Are negative offsets supported?
Alex
Quoted 1 line
+ * - When you have edited all of the states as needed, write "c"
(commit)
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
+ * to the file to commit your changes
+ *
+ * - If you want to reset to the default power levels, write "r"(reset)
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
+ * to the file to reset them
+ *
*/Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
static
ssize_tamdgpu_set_pp_od_clk_voltage(struct device
*dev, diff --git
a/drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.cQuoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
b/drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.cindexececa2f7fe5f..9f6e070a76e0100644
---
a/drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.cQuoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
+++
b/drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.cQuoted 15 lines
Quoted 15 lines
Quoted 15 lines
Quoted 15 lines
Quoted 15 lines
Quoted 1 line
drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c static int
Quoted 1 line
drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c +0
-0@@ -1096,6 +1096,13 @@ static intvega20_od8_initialize_default_settings(
Quoted 13 lines
Quoted 13 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c +7
-0} } + ret =vega20_copy_table_from_smc (hwmgr, + (uint8_t *)(&data->od_table), +TABLE_OVERDRIVE ); +PP_ASSERT_WITH_CODE (!ret, +"Failed to export over drive table!" , + return ret); +return 0 ; }Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 1 line
drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c static int
Quoted 1 line
drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c +0
-0@@ -2506,11 +2513,112 @@ static intvega20_set_watermarks_for_clocks_ranges(struct
pp_hwmgr*hwmgr,Quoted 4 lines
Quoted 4 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c +1
-0return 0 ; } +static int vega20_odn_edit_dpm_table(struct pp_hwmgr*hwmgr,
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c static int · line 2517
Quoted 1 line
drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c +1
-0+enum PP_OD_DPM_TABLE_COMMAND type,
Quoted 90 lines
Quoted 90 lines
Quoted 90 lines
Quoted 14 lines
Quoted 14 lines
Quoted 5 lines
Quoted 5 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c +5
-0+ long *input, +uint32_t +size) { +struct vega20_hwmgr *data = + (struct vega20_hwmgr *)(hwmgr->backend);Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c static int · line 2530
Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c +8
-0+struct vega20_od8_single_setting *od8_settings = + data->od8_settings.od8_settings_array; +OverDriveTable_t od_table; +int32_t input_index, input_clk, input_vol, i; +int ret =0 ; + + PP_ASSERT_WITH_CODE(input, "NULL user input for + clock andvoltage",
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c static int · line 2536
Quoted 6 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c +6
-0+ return -EINVAL); + +switch (type) { +case PP_OD_EDIT_SCLK_VDDC_TABLE : + if + (!(od8_settings[OD8_SETTING_GFXCLK_FREQ1].feature_id&&
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c static int · line 2538
Quoted 2 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c +2
-0+ + od8_settings[OD8_SETTING_GFXCLK_FREQ2 ].feature_id&&
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c static int · line 2540
Quoted 2 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c +2
-0+ + od8_settings[OD8_SETTING_GFXCLK_FREQ3 ].feature_id&&
Quoted 29 lines
Quoted 29 lines
Quoted 2 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c static int · line 2542
Quoted 2 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c +2
-0+ + od8_settings[OD8_SETTING_GFXCLK_VOLTAGE1 ].feature_id&&
Quoted 2 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c static int · line 2544
Quoted 2 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c +2
-0+ + od8_settings[OD8_SETTING_GFXCLK_VOLTAGE2 ].feature_id&&
Quoted 2 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c static int · line 2546
Quoted 2 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c +2
-0+ + od8_settings[OD8_SETTING_GFXCLK_VOLTAGE3].feature_id)){
Quoted 8 lines
Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c +8
-0+pr_info ("Sclk voltage overdrive not supported\n" ); +return 0 ; + } + +for (i =0 ; i < size; i +=3 ) { +if (i +3 > size) { +pr_info ("invalid clock voltage input\n" ); +return 0 ;Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c static int · line 2562
Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c +8
-0+ } + + input_index = input[i]; + input_clk = input[i +1 ]; + input_vol = input[i +2 ]; +if (input_index >2 || + input_clk < + od8_settings[OD8_SETTING_GFXCLK_FREQ1 +
input_index* 2].min_value ||Quoted 2 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c static int · line 2564
Quoted 2 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c +2
-0+ input_clk > + od8_settings[OD8_SETTING_GFXCLK_FREQ1 +
input_index* 2].max_value ||Quoted 8 lines
Quoted 8 lines
Quoted 1 line
drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c static int · line 2565
Quoted 1 line
drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c +1
-0+ input_vol <od8_settings[OD8_SETTING_GFXCLK_VOLTAGE1 +
input_index* 2].min_value ||Quoted 1 line
drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c static int · line 2566
Quoted 1 line
drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c +1
-0+ input_vol >od8_settings[OD8_SETTING_GFXCLK_VOLTAGE1 +
input_index* 2].max_value) {Quoted 2 lines
Quoted 2 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c +2
-0+ pr_info("input argument is + not within allowedrange\n");
Quoted 25 lines
Quoted 25 lines
Quoted 25 lines
Quoted 25 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c +25
-0+return -EINVAL ; + } + +switch (input_index) { +case 0 : + data->od_table.GfxclkFreq1 = input_clk; + data->od_table.GfxclkOffsetVolt1 = input_vol; +break ; +case 1 : + data->od_table.GfxclkFreq2 = input_clk; + data->od_table.GfxclkOffsetVolt2 = input_vol; +break ; +case 2 : + data->od_table.GfxclkFreq3 = input_clk; + data->od_table.GfxclkOffsetVolt3 = input_vol; +break ; + } + } +break ; + +case PP_OD_EDIT_MCLK_VDDC_TABLE : +pr_info ("Mclk voltage overdrive not supported!\n" ); +break ; + +case PP_OD_RESTORE_DEFAULT_TABLE :Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c static int · line 2601
Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c +8
-0+ ret =vega20_copy_table_from_smc (hwmgr, + (uint8_t *)(&od_table), +TABLE_OVERDRIVE ); +PP_ASSERT_WITH_CODE (!ret, +"Failed to export over drive table!" , + return ret); + + memcpy(&data->od_table, &od_table,
sizeof(od_table));Quoted 51 lines
Quoted 51 lines
Quoted 51 lines
Quoted 38 lines
Quoted 38 lines
Quoted 34 lines
Quoted 34 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c +28
-1+break ; + +case PP_OD_COMMIT_DPM_TABLE : +memcpy (&od_table, &data->od_table, +sizeof (od_table)); + + ret =vega20_copy_table_to_smc (hwmgr, + (uint8_t *)(&od_table), +TABLE_OVERDRIVE ); +PP_ASSERT_WITH_CODE (!ret, +"Failed to import over drive table!" , + return ret); + +break ; + +default : +return -EINVAL ; + } + +return 0 ; +} +static int vega20_print_clock_levels (struct pp_hwmgr *hwmgr,enum pp_clock_type type,char *buf) { -int i, now, size =0 ; +struct vega20_hwmgr *data = + (struct vega20_hwmgr *)(hwmgr->backend); +struct vega20_od8_single_setting *od8_settings = + data->od8_settings.od8_settings_array; +OverDriveTable_t *od_table = &data->od_table;struct pp_clock_levels_with_latency clocks; +int i, now, size =0 ;int ret =0 ;Quoted 3 lines
Quoted 3 lines
switch (type) {drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c +0
-0@@ -2551,6 +2659,59 @@ static intvega20_print_clock_levels(struct
pp_hwmgr*hwmgr,Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c
Quoted 6 lines
case PP_PCIE: break;drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c +3
-0+case OD_SCLK : +if + (od8_settings[OD8_SETTING_GFXCLK_FREQ1].feature_id&&
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
+
+ od8_settings[OD8_SETTING_GFXCLK_FREQ2].feature_id&&
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
+
+ od8_settings[OD8_SETTING_GFXCLK_FREQ3].feature_id&&
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 2 lines
Quoted 2 lines
+
+ od8_settings[OD8_SETTING_GFXCLK_VOLTAGE1].feature_id&&
Quoted 2 lines
Quoted 2 lines
+
+ od8_settings[OD8_SETTING_GFXCLK_VOLTAGE2].feature_id&&
Quoted 2 lines
Quoted 2 lines
+
+ od8_settings[OD8_SETTING_GFXCLK_VOLTAGE3].feature_id){
Quoted 27 lines
Quoted 27 lines
Quoted 27 lines
Quoted 12 lines
Quoted 12 lines
Quoted 12 lines
Quoted 12 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c +12
-0+ + size =sprintf (buf,"%s:\n" ,"OD_SCLK" ); + size +=sprintf (buf + size,"0: %10uMhz %10dmV\n" , + od_table->GfxclkFreq1, + od_table->GfxclkOffsetVolt1); + size +=sprintf (buf + size,"1: %10uMhz %10dmV\n" , + od_table->GfxclkFreq2, + od_table->GfxclkOffsetVolt2); + size +=sprintf (buf + size,"2: %10uMhz %10dmV\n" , + od_table->GfxclkFreq3, + od_table->GfxclkOffsetVolt3); + }Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c
Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c +8
-0+break ; + +case OD_MCLK : +break ; + +case OD_RANGE : +if + (od8_settings[OD8_SETTING_GFXCLK_FREQ1].feature_id&&
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
+
+ od8_settings[OD8_SETTING_GFXCLK_FREQ2].feature_id&&
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
+
+ od8_settings[OD8_SETTING_GFXCLK_FREQ3].feature_id&&
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 2 lines
Quoted 2 lines
+
+ od8_settings[OD8_SETTING_GFXCLK_VOLTAGE1].feature_id&&
Quoted 2 lines
Quoted 2 lines
+
+ od8_settings[OD8_SETTING_GFXCLK_VOLTAGE2].feature_id&&
Quoted 2 lines
Quoted 2 lines
+
+ od8_settings[OD8_SETTING_GFXCLK_VOLTAGE3].feature_id){
Quoted 45 lines
Quoted 45 lines
Quoted 45 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c
Quoted 3 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c +3
-0+ + size =sprintf (buf,"%s:\n" ,"OD_RANGE" ); + size += sprintf(buf + size,"SCLK[0]: %7uMhz %10uMhz\n",
Quoted 11 lines
Quoted 11 lines
Quoted 3 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c
Quoted 3 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c +3
-0+ + od8_settings[OD8_SETTING_GFXCLK_FREQ1].min_value, +od8_settings[OD8_SETTING_GFXCLK_FREQ1].max_value);
Quoted 3 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c
Quoted 3 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c +3
-0+ size += sprintf(buf + size, "VDDC[0]: + %7dmV %11dmV\n", +od8_settings[OD8_SETTING_GFXCLK_VOLTAGE1].min_value,
Quoted 1 line
Quoted 1 line
+
od8_settings[OD8_SETTING_GFXCLK_VOLTAGE1].max_value);
Quoted 1 line
Quoted 1 line
+ size += sprintf(buf + size,
"SCLK[1]: %7uMhz %10uMhz\n",
Quoted 11 lines
Quoted 11 lines
Quoted 3 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c
Quoted 3 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c +3
-0+ + od8_settings[OD8_SETTING_GFXCLK_FREQ2].min_value, +od8_settings[OD8_SETTING_GFXCLK_FREQ2].max_value);
Quoted 3 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c
Quoted 3 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c +3
-0+ size += sprintf(buf + size, "VDDC[1]: + %7dmV %11dmV\n", +od8_settings[OD8_SETTING_GFXCLK_VOLTAGE2].min_value,
Quoted 1 line
Quoted 1 line
+
od8_settings[OD8_SETTING_GFXCLK_VOLTAGE2].max_value);
Quoted 1 line
Quoted 1 line
+ size += sprintf(buf + size,
"SCLK[2]: %7uMhz %10uMhz\n",
Quoted 17 lines
Quoted 17 lines
Quoted 3 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c
Quoted 3 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c +3
-0+ + od8_settings[OD8_SETTING_GFXCLK_FREQ3].min_value, +od8_settings[OD8_SETTING_GFXCLK_FREQ3].max_value);
Quoted 3 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c
Quoted 3 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c +3
-0+ size += sprintf(buf + size, "VDDC[2]: + %7dmV %11dmV\n", +od8_settings[OD8_SETTING_GFXCLK_VOLTAGE3].min_value,
Quoted 1 line
Quoted 1 line
+
od8_settings[OD8_SETTING_GFXCLK_VOLTAGE3].max_value);
Quoted 6 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c static const struct pp_hwmgr_func
Quoted 6 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c +2
-0+ } +break ;default :break ; }@@ -3162,6 +3323,8 @@ static const struct pp_hwmgr_func
vega20_hwmgr_funcs= {Quoted 12 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c +1
-0vega20_get_mclk_od, .set_mclk_od = vega20_set_mclk_od, + .odn_edit_dpm_table =Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c +1
-0+ vega20_odn_edit_dpm_table,/* for sysfs to retrive/set gfxclk/memclk */ .force_clock_level = vega20_force_clock_level, diff --git
a/drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.hb/drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.hindex72e4f2a55641..8bb90e22efb6100644
---
a/drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.hQuoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
+++
b/drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.hQuoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c +2
-0@@ -513,6 +513,8 @@ struct vega20_hwmgr {/* ---- Gfxoff ---- */ bool gfxoff_allowed;uint32_t counter_gfxoff; + +OverDriveTable_t od_table; };
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c +0
-1#define VEGA20_DPM2_NEAR_TDP_DEC 10 --2.18.0
_______________________________________________
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