Skip to contentSkip to conversation

drm/amd: Allow printing VanGogh OD SCLK levels without setting dpm to manual

PATCH In review Mario Limonciello 2 participants 3 messages Jun 9, 2025 – Jun 11, 2025

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH v2 1/2 drm/amd: Allow printing VanGogh OD SCLK levels without setting dpm to manual

From: Mario Limonciello <[email protected]>

Several other ASICs allow printing OD SCLK levels without setting DPM control to manual. When OD is disabled it will show the range the hardware supports. When OD is enabled it will show what values have been programmed. Adjust VanGogh to work the same.

---
v1: https://lore.kernel.org/amd-gfx/[email protected]/
v1 (resend): https://lore.kernel.org/amd-gfx/[email protected]/
v2: rebase

---
 .../gpu/drm/amd/pm/swsmu/smu11/vangogh_ppt.c  | 37 ++++++++-----------
 1 file changed, 15 insertions(+), 22 deletions(-)
drivers/gpu/drm/amd/pm/swsmu/smu11/vangogh_ppt.c +15 -22
index a55ea76d73996..2c9869feba610 100644
@@ -666,7 +666,6 @@ static int vangogh_print_clk_levels(struct smu_context *smu,
 {
 	DpmClocks_t *clk_table = smu->smu_table.clocks_table;
 	SmuMetrics_t metrics;
-	struct smu_dpm_context *smu_dpm_ctx = &(smu->smu_dpm);
 	int i, idx, size = 0, ret = 0;
 	uint32_t cur_value = 0, value = 0, count = 0;
 	bool cur_value_match_level = false;
@@ -682,31 +681,25 @@ static int vangogh_print_clk_levels(struct smu_context *smu,
 
 	switch (clk_type) {
 	case SMU_OD_SCLK:
-		if (smu_dpm_ctx->dpm_level == AMD_DPM_FORCED_LEVEL_MANUAL) {
-			size += sysfs_emit_at(buf, size, "%s:\n", "OD_SCLK");
-			size += sysfs_emit_at(buf, size, "0: %10uMhz\n",
-			(smu->gfx_actual_hard_min_freq > 0) ? smu->gfx_actual_hard_min_freq : smu->gfx_default_hard_min_freq);
-			size += sysfs_emit_at(buf, size, "1: %10uMhz\n",
-			(smu->gfx_actual_soft_max_freq > 0) ? smu->gfx_actual_soft_max_freq : smu->gfx_default_soft_max_freq);
-		}
+		size += sysfs_emit_at(buf, size, "%s:\n", "OD_SCLK");
+		size += sysfs_emit_at(buf, size, "0: %10uMhz\n",
+		(smu->gfx_actual_hard_min_freq > 0) ? smu->gfx_actual_hard_min_freq : smu->gfx_default_hard_min_freq);
+		size += sysfs_emit_at(buf, size, "1: %10uMhz\n",
+		(smu->gfx_actual_soft_max_freq > 0) ? smu->gfx_actual_soft_max_freq : smu->gfx_default_soft_max_freq);
 		break;
 	case SMU_OD_CCLK:
-		if (smu_dpm_ctx->dpm_level == AMD_DPM_FORCED_LEVEL_MANUAL) {
-			size += sysfs_emit_at(buf, size, "CCLK_RANGE in Core%d:\n",  smu->cpu_core_id_select);
-			size += sysfs_emit_at(buf, size, "0: %10uMhz\n",
-			(smu->cpu_actual_soft_min_freq > 0) ? smu->cpu_actual_soft_min_freq : smu->cpu_default_soft_min_freq);
-			size += sysfs_emit_at(buf, size, "1: %10uMhz\n",
-			(smu->cpu_actual_soft_max_freq > 0) ? smu->cpu_actual_soft_max_freq : smu->cpu_default_soft_max_freq);
-		}
+		size += sysfs_emit_at(buf, size, "CCLK_RANGE in Core%d:\n",  smu->cpu_core_id_select);
+		size += sysfs_emit_at(buf, size, "0: %10uMhz\n",
+		(smu->cpu_actual_soft_min_freq > 0) ? smu->cpu_actual_soft_min_freq : smu->cpu_default_soft_min_freq);
+		size += sysfs_emit_at(buf, size, "1: %10uMhz\n",
+		(smu->cpu_actual_soft_max_freq > 0) ? smu->cpu_actual_soft_max_freq : smu->cpu_default_soft_max_freq);
 		break;
 	case SMU_OD_RANGE:
-		if (smu_dpm_ctx->dpm_level == AMD_DPM_FORCED_LEVEL_MANUAL) {
-			size += sysfs_emit_at(buf, size, "%s:\n", "OD_RANGE");
-			size += sysfs_emit_at(buf, size, "SCLK: %7uMhz %10uMhz\n",
-				smu->gfx_default_hard_min_freq, smu->gfx_default_soft_max_freq);
-			size += sysfs_emit_at(buf, size, "CCLK: %7uMhz %10uMhz\n",
-				smu->cpu_default_soft_min_freq, smu->cpu_default_soft_max_freq);
-		}
+		size += sysfs_emit_at(buf, size, "%s:\n", "OD_RANGE");
+		size += sysfs_emit_at(buf, size, "SCLK: %7uMhz %10uMhz\n",
+			smu->gfx_default_hard_min_freq, smu->gfx_default_soft_max_freq);
+		size += sysfs_emit_at(buf, size, "CCLK: %7uMhz %10uMhz\n",
+			smu->cpu_default_soft_min_freq, smu->cpu_default_soft_max_freq);
 		break;
 	case SMU_SOCCLK:
 		/* the level 3 ~ 6 of socclk use the same frequency for vangogh */
Signature · 1 line
2.43.0
#1 lore raw

PATCH v2 2/2 drm/amd: Allow printing Renoir OD SCLK levels without setting dpm to manual

From: Mario Limonciello <[email protected]>

Several other ASICs allow printing OD SCLK levels without setting DPM control to manual. When OD is disabled it will show the range the hardware supports. When OD is enabled it will show what values have been programmed. Adjust Renoir to work the same.

---
---
v1: https://lore.kernel.org/amd-gfx/[email protected]/
v1 (resend): https://lore.kernel.org/amd-gfx/[email protected]/
v2:
* rebase
* Drop extra variable

---
 .../gpu/drm/amd/pm/swsmu/smu12/renoir_ppt.c   | 37 ++++++++-----------
 1 file changed, 16 insertions(+), 21 deletions(-)
drivers/gpu/drm/amd/pm/swsmu/smu12/renoir_ppt.c +16 -21
index 9481f897432d7..e97b0cf19197e 100644
@@ -497,7 +497,6 @@ static int renoir_print_clk_levels(struct smu_context *smu,
 	int i, idx, size = 0, ret = 0;
 	uint32_t cur_value = 0, value = 0, count = 0, min = 0, max = 0;
 	SmuMetrics_t metrics;
-	struct smu_dpm_context *smu_dpm_ctx = &(smu->smu_dpm);
 	bool cur_value_match_level = false;
 
 	memset(&metrics, 0, sizeof(metrics));
@@ -510,28 +509,24 @@ static int renoir_print_clk_levels(struct smu_context *smu,
 
 	switch (clk_type) {
 	case SMU_OD_RANGE:
-		if (smu_dpm_ctx->dpm_level == AMD_DPM_FORCED_LEVEL_MANUAL) {
-			ret = smu_cmn_send_smc_msg_with_param(smu,
-						SMU_MSG_GetMinGfxclkFrequency,
-						0, &min);
-			if (ret)
-				return ret;
-			ret = smu_cmn_send_smc_msg_with_param(smu,
-						SMU_MSG_GetMaxGfxclkFrequency,
-						0, &max);
-			if (ret)
-				return ret;
-			size += sysfs_emit_at(buf, size, "OD_RANGE\nSCLK: %10uMhz %10uMhz\n", min, max);
-		}
+		ret = smu_cmn_send_smc_msg_with_param(smu,
+					SMU_MSG_GetMinGfxclkFrequency,
+					0, &min);
+		if (ret)
+			return ret;
+		ret = smu_cmn_send_smc_msg_with_param(smu,
+					SMU_MSG_GetMaxGfxclkFrequency,
+					0, &max);
+		if (ret)
+			return ret;
+		size += sysfs_emit_at(buf, size, "OD_RANGE\nSCLK: %10uMhz %10uMhz\n", min, max);
 		break;
 	case SMU_OD_SCLK:
-		if (smu_dpm_ctx->dpm_level == AMD_DPM_FORCED_LEVEL_MANUAL) {
-			min = (smu->gfx_actual_hard_min_freq > 0) ? smu->gfx_actual_hard_min_freq : smu->gfx_default_hard_min_freq;
-			max = (smu->gfx_actual_soft_max_freq > 0) ? smu->gfx_actual_soft_max_freq : smu->gfx_default_soft_max_freq;
-			size += sysfs_emit_at(buf, size, "OD_SCLK\n");
-			size += sysfs_emit_at(buf, size, "0:%10uMhz\n", min);
-			size += sysfs_emit_at(buf, size, "1:%10uMhz\n", max);
-		}
+		min = (smu->gfx_actual_hard_min_freq > 0) ? smu->gfx_actual_hard_min_freq : smu->gfx_default_hard_min_freq;
+		max = (smu->gfx_actual_soft_max_freq > 0) ? smu->gfx_actual_soft_max_freq : smu->gfx_default_soft_max_freq;
+		size += sysfs_emit_at(buf, size, "OD_SCLK\n");
+		size += sysfs_emit_at(buf, size, "0:%10uMhz\n", min);
+		size += sysfs_emit_at(buf, size, "1:%10uMhz\n", max);
 		break;
 	case SMU_GFXCLK:
 	case SMU_SCLK:
Signature · 1 line
2.43.0
maintainer Reviewed-by on v2 1/2
#2 lore raw
In reply to Mario Limonciello

[Public]

Quoted 12 lines

-----Original Message-----
From: amd-gfx <[email protected]> On Behalf Of Mario Limonciello
Sent: Sunday, June 8, 2025 11:12 PM
To: [email protected]
Cc: Limonciello, Mario <[email protected]>; Pierre-Loup A . Griffais <[email protected]>; Vicki Pfau <[email protected]>
Subject: [PATCH v2 1/2] drm/amd: Allow printing VanGogh OD SCLK levels without setting dpm to manual

From: Mario Limonciello <[email protected]>

Quoted 8 lines

Several other ASICs allow printing OD SCLK levels without setting DPM control to manual. When OD is disabled it will show the range the hardware supports. When OD is enabled it will show what values have been programmed. Adjust VanGogh to work the same.

Series is:

Quoted 94 lines

---
v1: https://lore.kernel.org/amd-gfx/20250323145316.859797-1-
[email protected]/
v1 (resend): https://lore.kernel.org/amd-gfx/20250421210639.1138228-1-
[email protected]/
v2: rebase

---
 .../gpu/drm/amd/pm/swsmu/smu11/vangogh_ppt.c  | 37 ++++++++-----------
 1 file changed, 15 insertions(+), 22 deletions(-)
drivers/gpu/drm/amd/pm/swsmu/smu11/vangogh_ppt.c +5 -8
index a55ea76d73996..2c9869feba610 100644
@@ -666,7 +666,6 @@ static int vangogh_print_clk_levels(struct smu_context
 *smu,  {
      DpmClocks_t *clk_table = smu->smu_table.clocks_table;
      SmuMetrics_t metrics;
-     struct smu_dpm_context *smu_dpm_ctx = &(smu->smu_dpm);
      int i, idx, size = 0, ret = 0;
      uint32_t cur_value = 0, value = 0, count = 0;
      bool cur_value_match_level = false;
@@ -682,31 +681,25 @@ static int vangogh_print_clk_levels(struct smu_context
 *smu,
 
      switch (clk_type) {
      case SMU_OD_SCLK:
-             if (smu_dpm_ctx->dpm_level ==
 AMD_DPM_FORCED_LEVEL_MANUAL) {
-                     size += sysfs_emit_at(buf, size, "%s:\n", "OD_SCLK");
-                     size += sysfs_emit_at(buf, size, "0: %10uMhz\n",
-                     (smu->gfx_actual_hard_min_freq > 0) ? smu-
 >gfx_actual_hard_min_freq : smu->gfx_default_hard_min_freq);
-                     size += sysfs_emit_at(buf, size, "1: %10uMhz\n",
-                     (smu->gfx_actual_soft_max_freq > 0) ? smu-
 >gfx_actual_soft_max_freq : smu->gfx_default_soft_max_freq);
-             }
+             size += sysfs_emit_at(buf, size, "%s:\n", "OD_SCLK");
+             size += sysfs_emit_at(buf, size, "0: %10uMhz\n",
+             (smu->gfx_actual_hard_min_freq > 0) ? smu-
 >gfx_actual_hard_min_freq : smu->gfx_default_hard_min_freq);
+             size += sysfs_emit_at(buf, size, "1: %10uMhz\n",
+             (smu->gfx_actual_soft_max_freq > 0) ? smu-
Quoted 1 line

gfx_actual_soft_max_freq :

drivers/gpu/drm/amd/pm/swsmu/smu11/vangogh_ppt.c +1 -1
+smu->gfx_default_soft_max_freq);
              break;
      case SMU_OD_CCLK:
-             if (smu_dpm_ctx->dpm_level ==

AMD_DPM_FORCED_LEVEL_MANUAL) {
- size += sysfs_emit_at(buf, size, "CCLK_RANGE in
Core%d:\n", smu->cpu_core_id_select);

drivers/gpu/drm/amd/pm/swsmu/smu11/vangogh_ppt.c +0 -2
-                     size += sysfs_emit_at(buf, size, "0: %10uMhz\n",
-                     (smu->cpu_actual_soft_min_freq > 0) ? smu-
Quoted 1 line

cpu_actual_soft_min_freq : smu->cpu_default_soft_min_freq);

drivers/gpu/drm/amd/pm/swsmu/smu11/vangogh_ppt.c +0 -2
-                     size += sysfs_emit_at(buf, size, "1: %10uMhz\n",
-                     (smu->cpu_actual_soft_max_freq > 0) ? smu-
Quoted 1 line

cpu_actual_soft_max_freq : smu->cpu_default_soft_max_freq);

drivers/gpu/drm/amd/pm/swsmu/smu11/vangogh_ppt.c +1 -1
-             }
+             size += sysfs_emit_at(buf, size, "CCLK_RANGE in Core%d:\n",

smu->cpu_core_id_select);

drivers/gpu/drm/amd/pm/swsmu/smu11/vangogh_ppt.c +2 -0
+             size += sysfs_emit_at(buf, size, "0: %10uMhz\n",
+             (smu->cpu_actual_soft_min_freq > 0) ? smu-
Quoted 1 line

cpu_actual_soft_min_freq : smu->cpu_default_soft_min_freq);

drivers/gpu/drm/amd/pm/swsmu/smu11/vangogh_ppt.c +2 -0
+             size += sysfs_emit_at(buf, size, "1: %10uMhz\n",
+             (smu->cpu_actual_soft_max_freq > 0) ? smu-
Quoted 1 line

cpu_actual_soft_max_freq :

drivers/gpu/drm/amd/pm/swsmu/smu11/vangogh_ppt.c +1 -1
+smu->cpu_default_soft_max_freq);
              break;
      case SMU_OD_RANGE:
-             if (smu_dpm_ctx->dpm_level ==

AMD_DPM_FORCED_LEVEL_MANUAL) {

drivers/gpu/drm/amd/pm/swsmu/smu11/vangogh_ppt.c +0 -2
-                     size += sysfs_emit_at(buf, size, "%s:\n", "OD_RANGE");
-                     size += sysfs_emit_at(buf, size, "SCLK: %7uMhz

%10uMhz\n",
- smu->gfx_default_hard_min_freq, smu-

Quoted 1 line

gfx_default_soft_max_freq);

- size += sysfs_emit_at(buf, size, "CCLK: %7uMhz
%10uMhz\n",
- smu->cpu_default_soft_min_freq, smu-

Quoted 1 line

cpu_default_soft_max_freq);

drivers/gpu/drm/amd/pm/swsmu/smu11/vangogh_ppt.c +3 -1
-             }
+             size += sysfs_emit_at(buf, size, "%s:\n", "OD_RANGE");
+             size += sysfs_emit_at(buf, size, "SCLK: %7uMhz %10uMhz\n",
+                     smu->gfx_default_hard_min_freq, smu-
Quoted 1 line

gfx_default_soft_max_freq);

drivers/gpu/drm/amd/pm/swsmu/smu11/vangogh_ppt.c +2 -0
+             size += sysfs_emit_at(buf, size, "CCLK: %7uMhz %10uMhz\n",
+                     smu->cpu_default_soft_min_freq, smu-
Quoted 1 line

cpu_default_soft_max_freq);

              break;
      case SMU_SOCCLK:
              /* the level 3 ~ 6 of socclk use the same frequency for vangogh */

--
2.43.0