Skip to contentSkip to conversation

drm/amd/pp: Store stable Pstate clocks

PATCH In review Rex Zhu 3 participants 8 messages Jan 16, 2018 – Jan 17, 2018 5 messages not in the archive

Subsystems (3)
lore
Share & tools
lore

Rex Zhu

author
#0 lore raw

PATCH 1/3 drm/amd/pp: Store stable Pstate clocks

User can use to calculate profiling ratios when
set UMD Pstate.

Change-Id: I3c6b82ebface57eb969d474c57149e8658ab7014

---
 drivers/gpu/drm/amd/powerplay/hwmgr/cz_hwmgr.c     |  2 ++
 drivers/gpu/drm/amd/powerplay/hwmgr/rv_hwmgr.c     |  3 +++
 drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c   | 14 ++++++++++++--
 drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c |  5 +++++
 drivers/gpu/drm/amd/powerplay/inc/hwmgr.h          |  2 ++
 5 files changed, 24 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/powerplay/hwmgr/cz_hwmgr.c +2 -0
index e574af1..f68dd08 100644
@@ -1189,6 +1189,8 @@ static int cz_phm_unforce_dpm_levels(struct pp_hwmgr *hwmgr)
 
 	cz_hwmgr->sclk_dpm.soft_min_clk = table->entries[0].clk;
 	cz_hwmgr->sclk_dpm.hard_min_clk = table->entries[0].clk;
+	hwmgr->pstate_sclk = table->entries[0].clk;
+	hwmgr->pstate_mclk = 0;
 
 	level = cz_get_max_sclk_level(hwmgr) - 1;
 
drivers/gpu/drm/amd/powerplay/hwmgr/rv_hwmgr.c +3 -0
index 569073e..409a56b 100644
@@ -451,6 +451,9 @@ static int rv_hwmgr_backend_init(struct pp_hwmgr *hwmgr)
 
 	hwmgr->platform_descriptor.minimumClocksReductionPercentage = 50;
 
+	hwmgr->pstate_sclk = RAVEN_UMD_PSTATE_GFXCLK;
+	hwmgr->pstate_mclk = RAVEN_UMD_PSTATE_FCLK;
+
 	return result;
 }
 
drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c +12 -2
index b60e50e..11a900b 100644
@@ -2579,8 +2579,10 @@ static int smu7_get_profiling_clk(struct pp_hwmgr *hwmgr, enum amd_dpm_forced_le
 				break;
 			}
 		}
-		if (count < 0 || level == AMD_DPM_FORCED_LEVEL_PROFILE_MIN_SCLK)
+		if (count < 0 || level == AMD_DPM_FORCED_LEVEL_PROFILE_MIN_SCLK) {
 			*sclk_mask = 0;
+			tmp_sclk = hwmgr->dyn_state.vddc_dependency_on_sclk->entries[0].clk;
+		}
 
 		if (level == AMD_DPM_FORCED_LEVEL_PROFILE_PEAK)
 			*sclk_mask = hwmgr->dyn_state.vddc_dependency_on_sclk->count-1;
@@ -2595,8 +2597,10 @@ static int smu7_get_profiling_clk(struct pp_hwmgr *hwmgr, enum amd_dpm_forced_le
 				break;
 			}
 		}
-		if (count < 0 || level == AMD_DPM_FORCED_LEVEL_PROFILE_MIN_SCLK)
+		if (count < 0 || level == AMD_DPM_FORCED_LEVEL_PROFILE_MIN_SCLK) {
 			*sclk_mask = 0;
+			tmp_sclk =  table_info->vdd_dep_on_sclk->entries[0].clk;
+		}
 
 		if (level == AMD_DPM_FORCED_LEVEL_PROFILE_PEAK)
 			*sclk_mask = table_info->vdd_dep_on_sclk->count - 1;
@@ -2608,6 +2612,9 @@ static int smu7_get_profiling_clk(struct pp_hwmgr *hwmgr, enum amd_dpm_forced_le
 		*mclk_mask = golden_dpm_table->mclk_table.count - 1;
 
 	*pcie_mask = data->dpm_table.pcie_speed_table.count - 1;
+	hwmgr->pstate_sclk = tmp_sclk;
+	hwmgr->pstate_mclk = tmp_mclk;
+
 	return 0;
 }
 
@@ -2619,6 +2626,9 @@ static int smu7_force_dpm_level(struct pp_hwmgr *hwmgr,
 	uint32_t mclk_mask = 0;
 	uint32_t pcie_mask = 0;
 
+	if (hwmgr->pstate_sclk == 0)
+		smu7_get_profiling_clk(hwmgr, level, &sclk_mask, &mclk_mask, &pcie_mask);
+
 	switch (level) {
 	case AMD_DPM_FORCED_LEVEL_HIGH:
 		ret = smu7_force_dpm_highest(hwmgr);
drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c +5 -0
index d5abd46..adfbbc1 100644
@@ -4178,6 +4178,8 @@ static int vega10_get_profiling_clk_mask(struct pp_hwmgr *hwmgr, enum amd_dpm_fo
 		*sclk_mask = VEGA10_UMD_PSTATE_GFXCLK_LEVEL;
 		*soc_mask = VEGA10_UMD_PSTATE_SOCCLK_LEVEL;
 		*mclk_mask = VEGA10_UMD_PSTATE_MCLK_LEVEL;
+		hwmgr->pstate_sclk = table_info->vdd_dep_on_sclk->entries[VEGA10_UMD_PSTATE_GFXCLK_LEVEL].clk;
+		hwmgr->pstate_mclk = table_info->vdd_dep_on_mclk->entries[VEGA10_UMD_PSTATE_MCLK_LEVEL].clk;
 	}
 
 	if (level == AMD_DPM_FORCED_LEVEL_PROFILE_MIN_SCLK) {
@@ -4219,6 +4221,9 @@ static int vega10_dpm_force_dpm_level(struct pp_hwmgr *hwmgr,
 	uint32_t mclk_mask = 0;
 	uint32_t soc_mask = 0;
 
+	if (hwmgr->pstate_sclk == 0)
+		vega10_get_profiling_clk_mask(hwmgr, level, &sclk_mask, &mclk_mask, &soc_mask);
+
 	switch (level) {
 	case AMD_DPM_FORCED_LEVEL_HIGH:
 		ret = vega10_force_dpm_highest(hwmgr);
drivers/gpu/drm/amd/powerplay/inc/hwmgr.h +2 -0
index 800d773..6d8183d 100644
@@ -753,6 +753,8 @@ struct pp_hwmgr {
 	enum amd_pp_profile_type current_power_profile;
 	bool en_umd_pstate;
 	uint32_t power_profile_mode;
+	uint32_t pstate_sclk;
+	uint32_t pstate_mclk;
 };
 
 struct cgs_irq_src_funcs {
Signature · 6 lines
1.9.1

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

A message that is not in the archive (sent off-list or not yet received): 1516103973-26870-1-git-send-email-Rex.Zhu-5C7GfCeVMHo@public.gmane.org

author
#2 lore raw

PATCH 2/3 drm/amd/pp: Add stable Pstate clk display when print_clock_levels

The additional output are at the end of sclk/mclk info as cat pp_dpm_mclk
0: 300Mhz *
1: 1650Mhz
P: 300Mhz

Change-Id: Idf8eeedb5d399d9ffb7de7a2fb2976c7fa7c01a8

---
 drivers/gpu/drm/amd/powerplay/hwmgr/cz_hwmgr.c     | 2 ++
 drivers/gpu/drm/amd/powerplay/hwmgr/rv_hwmgr.c     | 2 ++
 drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c   | 2 ++
 drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c | 2 ++
 4 files changed, 8 insertions(+)
drivers/gpu/drm/amd/powerplay/hwmgr/cz_hwmgr.c +2 -0
index f68dd08..03dfba0 100644
@@ -1601,6 +1601,7 @@ static int cz_print_clock_levels(struct pp_hwmgr *hwmgr,
 			size += sprintf(buf + size, "%d: %uMhz %s\n",
 					i, sclk_table->entries[i].clk / 100,
 					(i == now) ? "*" : "");
+		size += sprintf(buf + size, "P: %uMhz\n", hwmgr->pstate_sclk/100);
 		break;
 	case PP_MCLK:
 		now = PHM_GET_FIELD(cgs_read_ind_register(hwmgr->device,
@@ -1613,6 +1614,7 @@ static int cz_print_clock_levels(struct pp_hwmgr *hwmgr,
 			size += sprintf(buf + size, "%d: %uMhz %s\n",
 					CZ_NUM_NBPMEMORYCLOCK-i, data->sys_info.nbp_memory_clock[i-1] / 100,
 					(CZ_NUM_NBPMEMORYCLOCK-i == now) ? "*" : "");
+		size += sprintf(buf + size, "P: %uMhz\n", hwmgr->pstate_mclk/100);
 		break;
 	default:
 		break;
drivers/gpu/drm/amd/powerplay/hwmgr/rv_hwmgr.c +2 -0
index 409a56b..88c6ad8 100644
@@ -756,6 +756,7 @@ static int rv_print_clock_levels(struct pp_hwmgr *hwmgr,
 				data->gfx_max_freq_limit / 100,
 				((data->gfx_max_freq_limit / 100)
 				 == now) ? "*" : "");
+		size += sprintf(buf + size, "P: %uMhz\n", hwmgr->pstate_sclk/100);
 		break;
 	case PP_MCLK:
 		PP_ASSERT_WITH_CODE(!smum_send_msg_to_smc(hwmgr,
@@ -773,6 +774,7 @@ static int rv_print_clock_levels(struct pp_hwmgr *hwmgr,
 					mclk_table->entries[i].clk / 100,
 					((mclk_table->entries[i].clk / 100)
 					 == now) ? "*" : "");
+		size += sprintf(buf + size, "P: %uMhz\n", hwmgr->pstate_mclk/100);
 		break;
 	default:
 		break;
drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c +2 -0
index 11a900b..6f053fa 100644
@@ -4301,6 +4301,7 @@ static int smu7_print_clock_levels(struct pp_hwmgr *hwmgr,
 			size += sprintf(buf + size, "%d: %uMhz %s\n",
 					i, sclk_table->dpm_levels[i].value / 100,
 					(i == now) ? "*" : "");
+		size += sprintf(buf + size, "P: %uMhz\n", hwmgr->pstate_sclk/100);
 		break;
 	case PP_MCLK:
 		smum_send_msg_to_smc(hwmgr, PPSMC_MSG_API_GetMclkFrequency);
@@ -4317,6 +4318,7 @@ static int smu7_print_clock_levels(struct pp_hwmgr *hwmgr,
 			size += sprintf(buf + size, "%d: %uMhz %s\n",
 					i, mclk_table->dpm_levels[i].value / 100,
 					(i == now) ? "*" : "");
+		size += sprintf(buf + size, "P: %uMhz\n", hwmgr->pstate_mclk/100);
 		break;
 	case PP_PCIE:
 		pcie_speed = smu7_get_current_pcie_speed(hwmgr);
drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c +2 -0
index adfbbc1..d646b27b 100644
@@ -4571,6 +4571,7 @@ static int vega10_print_clock_levels(struct pp_hwmgr *hwmgr,
 			size += sprintf(buf + size, "%d: %uMhz %s\n",
 					i, sclk_table->dpm_levels[i].value / 100,
 					(i == now) ? "*" : "");
+		size += sprintf(buf + size, "P: %uMhz\n", hwmgr->pstate_sclk/100);
 		break;
 	case PP_MCLK:
 		if (data->registry_data.mclk_dpm_key_disabled)
@@ -4589,6 +4590,7 @@ static int vega10_print_clock_levels(struct pp_hwmgr *hwmgr,
 			size += sprintf(buf + size, "%d: %uMhz %s\n",
 					i, mclk_table->dpm_levels[i].value / 100,
 					(i == now) ? "*" : "");
+		size += sprintf(buf + size, "P: %uMhz\n", hwmgr->pstate_mclk/100);
 		break;
 	case PP_PCIE:
 		PP_ASSERT_WITH_CODE(!smum_send_msg_to_smc(hwmgr,
Signature · 6 lines
1.9.1

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

A message that is not in the archive (sent off-list or not yet received): 1516103973-26870-2-git-send-email-Rex.Zhu-5C7GfCeVMHo@public.gmane.org

#4 lore raw

Re: [PATCH 2/3] drm/amd/pp: Add stable Pstate clk display when print_clock_levels

Quoted 7 lines · Rex Zhu

The additional output are at the end of sclk/mclk info as cat pp_dpm_mclk
0: 300Mhz *
1: 1650Mhz
P: 300Mhz

I'm not crazy about this patch. I think it conflates things and breaks older versions of the rocm smi tool. I'd prefer to add a new file for the pstate clocks or add a query to the amdgpu INFO ioctl to fetch them.

Alex

Quoted 92 lines

Change-Id: Idf8eeedb5d399d9ffb7de7a2fb2976c7fa7c01a8

---
 drivers/gpu/drm/amd/powerplay/hwmgr/cz_hwmgr.c     | 2 ++
 drivers/gpu/drm/amd/powerplay/hwmgr/rv_hwmgr.c     | 2 ++
 drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c   | 2 ++
 drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c | 2 ++
 4 files changed, 8 insertions(+)
drivers/gpu/drm/amd/powerplay/hwmgr/cz_hwmgr.c +2 -0
index f68dd08..03dfba0 100644
@@ -1601,6 +1601,7 @@ static int cz_print_clock_levels(struct pp_hwmgr *hwmgr,
                        size += sprintf(buf + size, "%d: %uMhz %s\n",
                                        i, sclk_table->entries[i].clk / 100,
                                        (i == now) ? "*" : "");
+               size += sprintf(buf + size, "P: %uMhz\n", hwmgr->pstate_sclk/100);
                break;
        case PP_MCLK:
                now = PHM_GET_FIELD(cgs_read_ind_register(hwmgr->device,
@@ -1613,6 +1614,7 @@ static int cz_print_clock_levels(struct pp_hwmgr *hwmgr,
                        size += sprintf(buf + size, "%d: %uMhz %s\n",
                                        CZ_NUM_NBPMEMORYCLOCK-i, data->sys_info.nbp_memory_clock[i-1] / 100,
                                        (CZ_NUM_NBPMEMORYCLOCK-i == now) ? "*" : "");
+               size += sprintf(buf + size, "P: %uMhz\n", hwmgr->pstate_mclk/100);
                break;
        default:
                break;
drivers/gpu/drm/amd/powerplay/hwmgr/rv_hwmgr.c +2 -0
index 409a56b..88c6ad8 100644
@@ -756,6 +756,7 @@ static int rv_print_clock_levels(struct pp_hwmgr *hwmgr,
                                data->gfx_max_freq_limit / 100,
                                ((data->gfx_max_freq_limit / 100)
                                 == now) ? "*" : "");
+               size += sprintf(buf + size, "P: %uMhz\n", hwmgr->pstate_sclk/100);
                break;
        case PP_MCLK:
                PP_ASSERT_WITH_CODE(!smum_send_msg_to_smc(hwmgr,
@@ -773,6 +774,7 @@ static int rv_print_clock_levels(struct pp_hwmgr *hwmgr,
                                        mclk_table->entries[i].clk / 100,
                                        ((mclk_table->entries[i].clk / 100)
                                         == now) ? "*" : "");
+               size += sprintf(buf + size, "P: %uMhz\n", hwmgr->pstate_mclk/100);
                break;
        default:
                break;
drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c +2 -0
index 11a900b..6f053fa 100644
@@ -4301,6 +4301,7 @@ static int smu7_print_clock_levels(struct pp_hwmgr *hwmgr,
                        size += sprintf(buf + size, "%d: %uMhz %s\n",
                                        i, sclk_table->dpm_levels[i].value / 100,
                                        (i == now) ? "*" : "");
+               size += sprintf(buf + size, "P: %uMhz\n", hwmgr->pstate_sclk/100);
                break;
        case PP_MCLK:
                smum_send_msg_to_smc(hwmgr, PPSMC_MSG_API_GetMclkFrequency);
@@ -4317,6 +4318,7 @@ static int smu7_print_clock_levels(struct pp_hwmgr *hwmgr,
                        size += sprintf(buf + size, "%d: %uMhz %s\n",
                                        i, mclk_table->dpm_levels[i].value / 100,
                                        (i == now) ? "*" : "");
+               size += sprintf(buf + size, "P: %uMhz\n", hwmgr->pstate_mclk/100);
                break;
        case PP_PCIE:
                pcie_speed = smu7_get_current_pcie_speed(hwmgr);
drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c +2 -1
index adfbbc1..d646b27b 100644
@@ -4571,6 +4571,7 @@ static int vega10_print_clock_levels(struct pp_hwmgr *hwmgr,
                        size += sprintf(buf + size, "%d: %uMhz %s\n",
                                        i, sclk_table->dpm_levels[i].value / 100,
                                        (i == now) ? "*" : "");
+               size += sprintf(buf + size, "P: %uMhz\n", hwmgr->pstate_sclk/100);
                break;
        case PP_MCLK:
                if (data->registry_data.mclk_dpm_key_disabled)
@@ -4589,6 +4590,7 @@ static int vega10_print_clock_levels(struct pp_hwmgr *hwmgr,
                        size += sprintf(buf + size, "%d: %uMhz %s\n",
                                        i, mclk_table->dpm_levels[i].value / 100,
                                        (i == now) ? "*" : "");
+               size += sprintf(buf + size, "P: %uMhz\n", hwmgr->pstate_mclk/100);
                break;
        case PP_PCIE:
                PP_ASSERT_WITH_CODE(!smum_send_msg_to_smc(hwmgr,
--

1.9.1

Quoted 4 lines

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

A message that is not in the archive (sent off-list or not yet received): CADnq5_MxAeNVKa=O1Y705OZxiXq5qTzh8Y4fRqzm0Mxoz19Adw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org

author
#6 lore raw

RE: [PATCH 2/3] drm/amd/pp: Add stable Pstate clk display when print_clock_levels

Ok, I will drop this patch. and please review the new attached patch expose stable pstate clock by ioctl.

Best Regards
Rex

-----Original Message-----
From: Alex Deucher [mailto:[email protected]]
Sent: Wednesday, January 17, 2018 12:03 AM
To: Zhu, Rex
Cc: amd-gfx list
Subject: Re: [PATCH 2/3] drm/amd/pp: Add stable Pstate clk display when print_clock_levels

Quoted 7 lines · Rex Zhu

The additional output are at the end of sclk/mclk info as cat pp_dpm_mclk
0: 300Mhz *
1: 1650Mhz
P: 300Mhz

I'm not crazy about this patch. I think it conflates things and breaks older versions of the rocm smi tool. I'd prefer to add a new file for the pstate clocks or add a query to the amdgpu INFO ioctl to fetch them.

Alex

Quoted 106 lines

Change-Id: Idf8eeedb5d399d9ffb7de7a2fb2976c7fa7c01a8

---
 drivers/gpu/drm/amd/powerplay/hwmgr/cz_hwmgr.c     | 2 ++
 drivers/gpu/drm/amd/powerplay/hwmgr/rv_hwmgr.c     | 2 ++
 drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c   | 2 ++
 drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c | 2 ++
 4 files changed, 8 insertions(+)
drivers/gpu/drm/amd/powerplay/hwmgr/cz_hwmgr.c +2 -0
index f68dd08..03dfba0 100644
@@ -1601,6 +1601,7 @@ static int cz_print_clock_levels(struct pp_hwmgr *hwmgr,
                        size += sprintf(buf + size, "%d: %uMhz %s\n",
                                        i, sclk_table->entries[i].clk / 100,
                                        (i == now) ? "*" : "");
+               size += sprintf(buf + size, "P: %uMhz\n", 
+ hwmgr->pstate_sclk/100);
                break;
        case PP_MCLK:
                now = 

PHM_GET_FIELD(cgs_read_ind_register(hwmgr->device,

drivers/gpu/drm/amd/powerplay/hwmgr/cz_hwmgr.c +2 -0
@@ -1613,6 +1614,7 @@ static int cz_print_clock_levels(struct pp_hwmgr *hwmgr,
                        size += sprintf(buf + size, "%d: %uMhz %s\n",
                                        CZ_NUM_NBPMEMORYCLOCK-i, data->sys_info.nbp_memory_clock[i-1] / 100,
                                        (CZ_NUM_NBPMEMORYCLOCK-i == 
 now) ? "*" : "");
+               size += sprintf(buf + size, "P: %uMhz\n", 
+ hwmgr->pstate_mclk/100);
                break;
        default:
                break;
drivers/gpu/drm/amd/powerplay/hwmgr/rv_hwmgr.c +4 -0
index 409a56b..88c6ad8 100644
@@ -756,6 +756,7 @@ static int rv_print_clock_levels(struct pp_hwmgr *hwmgr,
                                data->gfx_max_freq_limit / 100,
                                ((data->gfx_max_freq_limit / 100)
                                 == now) ? "*" : "");
+               size += sprintf(buf + size, "P: %uMhz\n", 
+ hwmgr->pstate_sclk/100);
                break;
        case PP_MCLK:
                PP_ASSERT_WITH_CODE(!smum_send_msg_to_smc(hwmgr,
@@ -773,6 +774,7 @@ static int rv_print_clock_levels(struct pp_hwmgr *hwmgr,
                                        mclk_table->entries[i].clk / 100,
                                        ((mclk_table->entries[i].clk / 100)
                                         == now) ? "*" : "");
+               size += sprintf(buf + size, "P: %uMhz\n", 
+ hwmgr->pstate_mclk/100);
                break;
        default:
                break;
drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c +2 -0
index 11a900b..6f053fa 100644
@@ -4301,6 +4301,7 @@ static int smu7_print_clock_levels(struct pp_hwmgr *hwmgr,
                        size += sprintf(buf + size, "%d: %uMhz %s\n",
                                        i, sclk_table->dpm_levels[i].value / 100,
                                        (i == now) ? "*" : "");
+               size += sprintf(buf + size, "P: %uMhz\n", 
+ hwmgr->pstate_sclk/100);
                break;
        case PP_MCLK:
                smum_send_msg_to_smc(hwmgr, 

PPSMC_MSG_API_GetMclkFrequency); @@ -4317,6 +4318,7 @@ static int smu7_print_clock_levels(struct pp_hwmgr *hwmgr,

                        size += sprintf(buf + size, "%d: %uMhz %s\n",
                                        i, mclk_table->dpm_levels[i].value / 100,
                                        (i == now) ? "*" : "");
drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c +2 -0
+               size += sprintf(buf + size, "P: %uMhz\n", 
+ hwmgr->pstate_mclk/100);
                break;
        case PP_PCIE:
                pcie_speed = smu7_get_current_pcie_speed(hwmgr);
drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c +4 -1
index adfbbc1..d646b27b 100644
@@ -4571,6 +4571,7 @@ static int vega10_print_clock_levels(struct pp_hwmgr *hwmgr,
                        size += sprintf(buf + size, "%d: %uMhz %s\n",
                                        i, sclk_table->dpm_levels[i].value / 100,
                                        (i == now) ? "*" : "");
+               size += sprintf(buf + size, "P: %uMhz\n", 
+ hwmgr->pstate_sclk/100);
                break;
        case PP_MCLK:
                if (data->registry_data.mclk_dpm_key_disabled)
@@ -4589,6 +4590,7 @@ static int vega10_print_clock_levels(struct pp_hwmgr *hwmgr,
                        size += sprintf(buf + size, "%d: %uMhz %s\n",
                                        i, mclk_table->dpm_levels[i].value / 100,
                                        (i == now) ? "*" : "");
+               size += sprintf(buf + size, "P: %uMhz\n", 
+ hwmgr->pstate_mclk/100);
                break;
        case PP_PCIE:
                PP_ASSERT_WITH_CODE(!smum_send_msg_to_smc(hwmgr,
--

1.9.1

Quoted 4 lines

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

From cc49bb900566a2aaa029af680065eb31ec8dcb87 Mon Sep 17 00:00:00 2001
From: Rex Zhu <[email protected]>
Date: Wed, 17 Jan 2018 13:18:47 +0800
Subject: [PATCH] drm/amdgpu: expose more GPU sensor queries

add sub-queries for stable pstate shader/memory clock.

Change-Id I7a4224927cc2edb361662ab440708b2a853041e0
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c | 18 ++++++++++++++++++
 include/uapi/drm/amdgpu_drm.h           |  4 ++++
 2 files changed, 22 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c +18 -0
index da3d7ed..985f3ed 100644
@@ -758,6 +758,24 @@ static int amdgpu_info_ioctl(struct drm_device *dev, void *data, struct drm_file
 				return -EINVAL;
 			}
 			break;
+		case AMDGPU_INFO_SENSOR_STABLE_PSTATE_GFX_SCLK:
+			/* get sclk in Mhz */
+			if (amdgpu_dpm_read_sensor(adev,
+						   AMDGPU_PP_SENSOR_STABLE_PSTATE_SCLK,
+						   (void *)&ui32, &ui32_size)) {
+				return -EINVAL;
+			}
+			ui32 /= 100;
+			break;
+		case AMDGPU_INFO_SENSOR_STABLE_PSTATE_GFX_MCLK:
+			/* get mclk in Mhz */
+			if (amdgpu_dpm_read_sensor(adev,
+						   AMDGPU_PP_SENSOR_STABLE_PSTATE_MCLK,
+						   (void *)&ui32, &ui32_size)) {
+				return -EINVAL;
+			}
+			ui32 /= 100;
+			break;
 		default:
 			DRM_DEBUG_KMS("Invalid request %d\n",
 				      info->sensor_info.type);
include/uapi/drm/amdgpu_drm.h +4 -0
index 1dc8089b..fe17b67 100644
@@ -667,6 +667,10 @@ struct drm_amdgpu_cs_chunk_data {
 	#define AMDGPU_INFO_SENSOR_VDDNB		0x6
 	/* Subquery id: Query graphics voltage */
 	#define AMDGPU_INFO_SENSOR_VDDGFX		0x7
+	/* Subquery id: Query GPU stable pstate shader clock */
+	#define AMDGPU_INFO_SENSOR_STABLE_PSTATE_GFX_SCLK		0x8
+	/* Subquery id: Query GPU stable pstate memory clock */
+	#define AMDGPU_INFO_SENSOR_STABLE_PSTATE_GFX_MCLK		0x9
 /* Number of VRAM page faults on CPU access. */
 #define AMDGPU_INFO_NUM_VRAM_CPU_PAGE_FAULTS	0x1E
 #define AMDGPU_INFO_VRAM_LOST_COUNTER		0x1F
Signature · 1 line
1.9.1

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

A message that is not in the archive (sent off-list or not yet received): CY4PR12MB16873EFA7B7C85284AE4E302FBE90-rpdhrqHFk06Y0SjTqZDccQdYzm3356FpvxpqHgZTriW3zl9H0oFU5g@public.gmane.org

Reviewed-by
#8 lore raw

Re: [PATCH 2/3] drm/amd/pp: Add stable Pstate clk display when print_clock_levels

Looks good.

Please also send a patch to bump the kernel driver version so the UMDs know when the query is available.

Thanks!

Alex

________________________________
From: amd-gfx <amd-gfx-bounces-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org> on behalf of Zhu, Rex <[email protected]>
Sent: Wednesday, January 17, 2018 12:48:48 AM
To: 'Alex Deucher'
Cc: amd-gfx list
Subject: RE: [PATCH 2/3] drm/amd/pp: Add stable Pstate clk display when print_clock_levels

Ok, I will drop this patch. and please review the new attached patch expose stable pstate clock by ioctl.

Best Regards
Rex

-----Original Message-----
From: Alex Deucher [mailto:[email protected]]
Sent: Wednesday, January 17, 2018 12:03 AM
To: Zhu, Rex
Cc: amd-gfx list
Subject: Re: [PATCH 2/3] drm/amd/pp: Add stable Pstate clk display when print_clock_levels

Quoted 7 lines · Rex Zhu

The additional output are at the end of sclk/mclk info as cat pp_dpm_mclk
0: 300Mhz *
1: 1650Mhz
P: 300Mhz

I'm not crazy about this patch. I think it conflates things and breaks older versions of the rocm smi tool. I'd prefer to add a new file for the pstate clocks or add a query to the amdgpu INFO ioctl to fetch them.

Alex

Quoted 106 lines

Change-Id: Idf8eeedb5d399d9ffb7de7a2fb2976c7fa7c01a8

---
 drivers/gpu/drm/amd/powerplay/hwmgr/cz_hwmgr.c     | 2 ++
 drivers/gpu/drm/amd/powerplay/hwmgr/rv_hwmgr.c     | 2 ++
 drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c   | 2 ++
 drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c | 2 ++
 4 files changed, 8 insertions(+)
drivers/gpu/drm/amd/powerplay/hwmgr/cz_hwmgr.c +2 -0
index f68dd08..03dfba0 100644
@@ -1601,6 +1601,7 @@ static int cz_print_clock_levels(struct pp_hwmgr *hwmgr,
                        size += sprintf(buf + size, "%d: %uMhz %s\n",
                                        i, sclk_table->entries[i].clk / 100,
                                        (i == now) ? "*" : "");
+               size += sprintf(buf + size, "P: %uMhz\n",
+ hwmgr->pstate_sclk/100);
                break;
        case PP_MCLK:
                now =

PHM_GET_FIELD(cgs_read_ind_register(hwmgr->device,

drivers/gpu/drm/amd/powerplay/hwmgr/cz_hwmgr.c +2 -0
@@ -1613,6 +1614,7 @@ static int cz_print_clock_levels(struct pp_hwmgr *hwmgr,
                        size += sprintf(buf + size, "%d: %uMhz %s\n",
                                        CZ_NUM_NBPMEMORYCLOCK-i, data->sys_info.nbp_memory_clock[i-1] / 100,
                                        (CZ_NUM_NBPMEMORYCLOCK-i ==
 now) ? "*" : "");
+               size += sprintf(buf + size, "P: %uMhz\n",
+ hwmgr->pstate_mclk/100);
                break;
        default:
                break;
drivers/gpu/drm/amd/powerplay/hwmgr/rv_hwmgr.c +4 -0
index 409a56b..88c6ad8 100644
@@ -756,6 +756,7 @@ static int rv_print_clock_levels(struct pp_hwmgr *hwmgr,
                                data->gfx_max_freq_limit / 100,
                                ((data->gfx_max_freq_limit / 100)
                                 == now) ? "*" : "");
+               size += sprintf(buf + size, "P: %uMhz\n",
+ hwmgr->pstate_sclk/100);
                break;
        case PP_MCLK:
                PP_ASSERT_WITH_CODE(!smum_send_msg_to_smc(hwmgr,
@@ -773,6 +774,7 @@ static int rv_print_clock_levels(struct pp_hwmgr *hwmgr,
                                        mclk_table->entries[i].clk / 100,
                                        ((mclk_table->entries[i].clk / 100)
                                         == now) ? "*" : "");
+               size += sprintf(buf + size, "P: %uMhz\n",
+ hwmgr->pstate_mclk/100);
                break;
        default:
                break;
drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c +2 -0
index 11a900b..6f053fa 100644
@@ -4301,6 +4301,7 @@ static int smu7_print_clock_levels(struct pp_hwmgr *hwmgr,
                        size += sprintf(buf + size, "%d: %uMhz %s\n",
                                        i, sclk_table->dpm_levels[i].value / 100,
                                        (i == now) ? "*" : "");
+               size += sprintf(buf + size, "P: %uMhz\n",
+ hwmgr->pstate_sclk/100);
                break;
        case PP_MCLK:
                smum_send_msg_to_smc(hwmgr,

PPSMC_MSG_API_GetMclkFrequency); @@ -4317,6 +4318,7 @@ static int smu7_print_clock_levels(struct pp_hwmgr *hwmgr,

                        size += sprintf(buf + size, "%d: %uMhz %s\n",
                                        i, mclk_table->dpm_levels[i].value / 100,
                                        (i == now) ? "*" : "");
drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c +2 -0
+               size += sprintf(buf + size, "P: %uMhz\n",
+ hwmgr->pstate_mclk/100);
                break;
        case PP_PCIE:
                pcie_speed = smu7_get_current_pcie_speed(hwmgr);
drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c +4 -1
index adfbbc1..d646b27b 100644
@@ -4571,6 +4571,7 @@ static int vega10_print_clock_levels(struct pp_hwmgr *hwmgr,
                        size += sprintf(buf + size, "%d: %uMhz %s\n",
                                        i, sclk_table->dpm_levels[i].value / 100,
                                        (i == now) ? "*" : "");
+               size += sprintf(buf + size, "P: %uMhz\n",
+ hwmgr->pstate_sclk/100);
                break;
        case PP_MCLK:
                if (data->registry_data.mclk_dpm_key_disabled)
@@ -4589,6 +4590,7 @@ static int vega10_print_clock_levels(struct pp_hwmgr *hwmgr,
                        size += sprintf(buf + size, "%d: %uMhz %s\n",
                                        i, mclk_table->dpm_levels[i].value / 100,
                                        (i == now) ? "*" : "");
+               size += sprintf(buf + size, "P: %uMhz\n",
+ hwmgr->pstate_mclk/100);
                break;
        case PP_PCIE:
                PP_ASSERT_WITH_CODE(!smum_send_msg_to_smc(hwmgr,
--

1.9.1

Quoted 4 lines

_______________________________________________
amd-gfx mailing list [email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

author
#9 lore raw

PATCH 3/3 drm/amd/pp: Add stable Pstate clk display support in debugfs

In reply to a message not in the archive

The additional output are: PSTATE_SCLK and PSTATE_MCLK value in MHz as:

300 MHz (PSTATE_SCLK)
300 MHz (PSTATE_MCLK)

Change-Id I96dac70d7e7d9702a5bfc3a40bd9bb57a21abdd7
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c         |  4 ++++
 drivers/gpu/drm/amd/include/kgd_pp_interface.h |  2 ++
 drivers/gpu/drm/amd/powerplay/amd_powerplay.c  | 23 ++++++++++++++---------
 3 files changed, 20 insertions(+), 9 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c +4 -0
index 662edca..ed9012a 100644
@@ -1591,6 +1591,10 @@ static int amdgpu_debugfs_pm_info_pp(struct seq_file *m, struct amdgpu_device *a
 		seq_printf(m, "\t%u MHz (MCLK)\n", value/100);
 	if (!amdgpu_dpm_read_sensor(adev, AMDGPU_PP_SENSOR_GFX_SCLK, (void *)&value, &size))
 		seq_printf(m, "\t%u MHz (SCLK)\n", value/100);
+	if (!amdgpu_dpm_read_sensor(adev, AMDGPU_PP_SENSOR_STABLE_PSTATE_SCLK, (void *)&value, &size))
+		seq_printf(m, "\t%u MHz (PSTATE_SCLK)\n", value/100);
+	if (!amdgpu_dpm_read_sensor(adev, AMDGPU_PP_SENSOR_STABLE_PSTATE_MCLK, (void *)&value, &size))
+		seq_printf(m, "\t%u MHz (PSTATE_MCLK)\n", value/100);
 	if (!amdgpu_dpm_read_sensor(adev, AMDGPU_PP_SENSOR_VDDGFX, (void *)&value, &size))
 		seq_printf(m, "\t%u mV (VDDGFX)\n", value);
 	if (!amdgpu_dpm_read_sensor(adev, AMDGPU_PP_SENSOR_VDDNB, (void *)&value, &size))
drivers/gpu/drm/amd/include/kgd_pp_interface.h +2 -0
index a823c03..401b895 100644
@@ -122,6 +122,8 @@ enum amd_pp_sensors {
 	AMDGPU_PP_SENSOR_VCE_POWER,
 	AMDGPU_PP_SENSOR_UVD_POWER,
 	AMDGPU_PP_SENSOR_GPU_POWER,
+	AMDGPU_PP_SENSOR_STABLE_PSTATE_SCLK,
+	AMDGPU_PP_SENSOR_STABLE_PSTATE_MCLK,
 };
 
 enum amd_pp_task {
drivers/gpu/drm/amd/powerplay/amd_powerplay.c +14 -9
index 5e22521..d9cb424 100644
@@ -992,22 +992,27 @@ static int pp_dpm_read_sensor(void *handle, int idx,
 	int ret = 0;
 
 	ret = pp_check(pp_handle);
-
 	if (ret)
 		return ret;
 
+	if (value == NULL)
+		return -EINVAL;
+
 	hwmgr = pp_handle->hwmgr;
 
-	if (hwmgr->hwmgr_func->read_sensor == NULL) {
-		pr_info("%s was not implemented.\n", __func__);
+	switch (idx) {
+	case AMDGPU_PP_SENSOR_STABLE_PSTATE_SCLK:
+		*((uint32_t *)value) = hwmgr->pstate_sclk;
 		return 0;
+	case AMDGPU_PP_SENSOR_STABLE_PSTATE_MCLK:
+		*((uint32_t *)value) = hwmgr->pstate_mclk;
+		return 0;
+	default:
+		mutex_lock(&pp_handle->pp_lock);
+		ret = hwmgr->hwmgr_func->read_sensor(hwmgr, idx, value, size);
+		mutex_unlock(&pp_handle->pp_lock);
+		return ret;
 	}
-
-	mutex_lock(&pp_handle->pp_lock);
-	ret = hwmgr->hwmgr_func->read_sensor(hwmgr, idx, value, size);
-	mutex_unlock(&pp_handle->pp_lock);
-
-	return ret;
 }
 
 static struct amd_vce_state*
Signature · 6 lines
1.9.1

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

A message that is not in the archive (sent off-list or not yet received): 1516103973-26870-3-git-send-email-Rex.Zhu-5C7GfCeVMHo@public.gmane.org

Reviewed-by
#11 lore raw

Re: [PATCH 3/3] drm/amd/pp: Add stable Pstate clk display support in debugfs

Quoted 8 lines · Rex Zhu

The additional output are: PSTATE_SCLK and PSTATE_MCLK value in MHz as:

300 MHz (PSTATE_SCLK)
300 MHz (PSTATE_MCLK)

Change-Id I96dac70d7e7d9702a5bfc3a40bd9bb57a21abdd7
Quoted 78 lines
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c         |  4 ++++
 drivers/gpu/drm/amd/include/kgd_pp_interface.h |  2 ++
 drivers/gpu/drm/amd/powerplay/amd_powerplay.c  | 23 ++++++++++++++---------
 3 files changed, 20 insertions(+), 9 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c +4 -0
index 662edca..ed9012a 100644
@@ -1591,6 +1591,10 @@ static int amdgpu_debugfs_pm_info_pp(struct seq_file *m, struct amdgpu_device *a
                seq_printf(m, "\t%u MHz (MCLK)\n", value/100);
        if (!amdgpu_dpm_read_sensor(adev, AMDGPU_PP_SENSOR_GFX_SCLK, (void *)&value, &size))
                seq_printf(m, "\t%u MHz (SCLK)\n", value/100);
+       if (!amdgpu_dpm_read_sensor(adev, AMDGPU_PP_SENSOR_STABLE_PSTATE_SCLK, (void *)&value, &size))
+               seq_printf(m, "\t%u MHz (PSTATE_SCLK)\n", value/100);
+       if (!amdgpu_dpm_read_sensor(adev, AMDGPU_PP_SENSOR_STABLE_PSTATE_MCLK, (void *)&value, &size))
+               seq_printf(m, "\t%u MHz (PSTATE_MCLK)\n", value/100);
        if (!amdgpu_dpm_read_sensor(adev, AMDGPU_PP_SENSOR_VDDGFX, (void *)&value, &size))
                seq_printf(m, "\t%u mV (VDDGFX)\n", value);
        if (!amdgpu_dpm_read_sensor(adev, AMDGPU_PP_SENSOR_VDDNB, (void *)&value, &size))
drivers/gpu/drm/amd/include/kgd_pp_interface.h +2 -0
index a823c03..401b895 100644
@@ -122,6 +122,8 @@ enum amd_pp_sensors {
        AMDGPU_PP_SENSOR_VCE_POWER,
        AMDGPU_PP_SENSOR_UVD_POWER,
        AMDGPU_PP_SENSOR_GPU_POWER,
+       AMDGPU_PP_SENSOR_STABLE_PSTATE_SCLK,
+       AMDGPU_PP_SENSOR_STABLE_PSTATE_MCLK,
 };
 
 enum amd_pp_task {
drivers/gpu/drm/amd/powerplay/amd_powerplay.c +14 -10
index 5e22521..d9cb424 100644
@@ -992,22 +992,27 @@ static int pp_dpm_read_sensor(void *handle, int idx,
        int ret = 0;
 
        ret = pp_check(pp_handle);
-
        if (ret)
                return ret;
 
+       if (value == NULL)
+               return -EINVAL;
+
        hwmgr = pp_handle->hwmgr;
 
-       if (hwmgr->hwmgr_func->read_sensor == NULL) {
-               pr_info("%s was not implemented.\n", __func__);
+       switch (idx) {
+       case AMDGPU_PP_SENSOR_STABLE_PSTATE_SCLK:
+               *((uint32_t *)value) = hwmgr->pstate_sclk;
                return 0;
+       case AMDGPU_PP_SENSOR_STABLE_PSTATE_MCLK:
+               *((uint32_t *)value) = hwmgr->pstate_mclk;
+               return 0;
+       default:
+               mutex_lock(&pp_handle->pp_lock);
+               ret = hwmgr->hwmgr_func->read_sensor(hwmgr, idx, value, size);
+               mutex_unlock(&pp_handle->pp_lock);
+               return ret;
        }
-
-       mutex_lock(&pp_handle->pp_lock);
-       ret = hwmgr->hwmgr_func->read_sensor(hwmgr, idx, value, size);
-       mutex_unlock(&pp_handle->pp_lock);
-
-       return ret;
 }
 
 static struct amd_vce_state*
--

1.9.1

Quoted 4 lines

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

Reviewed-by
#12 lore raw
In reply to a message not in the archive
Quoted 4 lines · Rex Zhu

User can use to calculate profiling ratios when
set UMD Pstate.

Quoted 124 lines

Change-Id: I3c6b82ebface57eb969d474c57149e8658ab7014

---
 drivers/gpu/drm/amd/powerplay/hwmgr/cz_hwmgr.c     |  2 ++
 drivers/gpu/drm/amd/powerplay/hwmgr/rv_hwmgr.c     |  3 +++
 drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c   | 14 ++++++++++++--
 drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c |  5 +++++
 drivers/gpu/drm/amd/powerplay/inc/hwmgr.h          |  2 ++
 5 files changed, 24 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/powerplay/hwmgr/cz_hwmgr.c +2 -0
index e574af1..f68dd08 100644
@@ -1189,6 +1189,8 @@ static int cz_phm_unforce_dpm_levels(struct pp_hwmgr *hwmgr)
 
        cz_hwmgr->sclk_dpm.soft_min_clk = table->entries[0].clk;
        cz_hwmgr->sclk_dpm.hard_min_clk = table->entries[0].clk;
+       hwmgr->pstate_sclk = table->entries[0].clk;
+       hwmgr->pstate_mclk = 0;
 
        level = cz_get_max_sclk_level(hwmgr) - 1;
 
drivers/gpu/drm/amd/powerplay/hwmgr/rv_hwmgr.c +3 -0
index 569073e..409a56b 100644
@@ -451,6 +451,9 @@ static int rv_hwmgr_backend_init(struct pp_hwmgr *hwmgr)
 
        hwmgr->platform_descriptor.minimumClocksReductionPercentage = 50;
 
+       hwmgr->pstate_sclk = RAVEN_UMD_PSTATE_GFXCLK;
+       hwmgr->pstate_mclk = RAVEN_UMD_PSTATE_FCLK;
+
        return result;
 }
 
drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c +12 -2
index b60e50e..11a900b 100644
@@ -2579,8 +2579,10 @@ static int smu7_get_profiling_clk(struct pp_hwmgr *hwmgr, enum amd_dpm_forced_le
                                break;
                        }
                }
-               if (count < 0 || level == AMD_DPM_FORCED_LEVEL_PROFILE_MIN_SCLK)
+               if (count < 0 || level == AMD_DPM_FORCED_LEVEL_PROFILE_MIN_SCLK) {
                        *sclk_mask = 0;
+                       tmp_sclk = hwmgr->dyn_state.vddc_dependency_on_sclk->entries[0].clk;
+               }
 
                if (level == AMD_DPM_FORCED_LEVEL_PROFILE_PEAK)
                        *sclk_mask = hwmgr->dyn_state.vddc_dependency_on_sclk->count-1;
@@ -2595,8 +2597,10 @@ static int smu7_get_profiling_clk(struct pp_hwmgr *hwmgr, enum amd_dpm_forced_le
                                break;
                        }
                }
-               if (count < 0 || level == AMD_DPM_FORCED_LEVEL_PROFILE_MIN_SCLK)
+               if (count < 0 || level == AMD_DPM_FORCED_LEVEL_PROFILE_MIN_SCLK) {
                        *sclk_mask = 0;
+                       tmp_sclk =  table_info->vdd_dep_on_sclk->entries[0].clk;
+               }
 
                if (level == AMD_DPM_FORCED_LEVEL_PROFILE_PEAK)
                        *sclk_mask = table_info->vdd_dep_on_sclk->count - 1;
@@ -2608,6 +2612,9 @@ static int smu7_get_profiling_clk(struct pp_hwmgr *hwmgr, enum amd_dpm_forced_le
                *mclk_mask = golden_dpm_table->mclk_table.count - 1;
 
        *pcie_mask = data->dpm_table.pcie_speed_table.count - 1;
+       hwmgr->pstate_sclk = tmp_sclk;
+       hwmgr->pstate_mclk = tmp_mclk;
+
        return 0;
 }
 
@@ -2619,6 +2626,9 @@ static int smu7_force_dpm_level(struct pp_hwmgr *hwmgr,
        uint32_t mclk_mask = 0;
        uint32_t pcie_mask = 0;
 
+       if (hwmgr->pstate_sclk == 0)
+               smu7_get_profiling_clk(hwmgr, level, &sclk_mask, &mclk_mask, &pcie_mask);
+
        switch (level) {
        case AMD_DPM_FORCED_LEVEL_HIGH:
                ret = smu7_force_dpm_highest(hwmgr);
drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c +5 -0
index d5abd46..adfbbc1 100644
@@ -4178,6 +4178,8 @@ static int vega10_get_profiling_clk_mask(struct pp_hwmgr *hwmgr, enum amd_dpm_fo
                *sclk_mask = VEGA10_UMD_PSTATE_GFXCLK_LEVEL;
                *soc_mask = VEGA10_UMD_PSTATE_SOCCLK_LEVEL;
                *mclk_mask = VEGA10_UMD_PSTATE_MCLK_LEVEL;
+               hwmgr->pstate_sclk = table_info->vdd_dep_on_sclk->entries[VEGA10_UMD_PSTATE_GFXCLK_LEVEL].clk;
+               hwmgr->pstate_mclk = table_info->vdd_dep_on_mclk->entries[VEGA10_UMD_PSTATE_MCLK_LEVEL].clk;
        }
 
        if (level == AMD_DPM_FORCED_LEVEL_PROFILE_MIN_SCLK) {
@@ -4219,6 +4221,9 @@ static int vega10_dpm_force_dpm_level(struct pp_hwmgr *hwmgr,
        uint32_t mclk_mask = 0;
        uint32_t soc_mask = 0;
 
+       if (hwmgr->pstate_sclk == 0)
+               vega10_get_profiling_clk_mask(hwmgr, level, &sclk_mask, &mclk_mask, &soc_mask);
+
        switch (level) {
        case AMD_DPM_FORCED_LEVEL_HIGH:
                ret = vega10_force_dpm_highest(hwmgr);
drivers/gpu/drm/amd/powerplay/inc/hwmgr.h +2 -1
index 800d773..6d8183d 100644
@@ -753,6 +753,8 @@ struct pp_hwmgr {
        enum amd_pp_profile_type current_power_profile;
        bool en_umd_pstate;
        uint32_t power_profile_mode;
+       uint32_t pstate_sclk;
+       uint32_t pstate_mclk;
 };
 
 struct cgs_irq_src_funcs {
--

1.9.1

Quoted 4 lines

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx