Skip to contentSkip to conversation

platform/x86: amd: pmf: Fix STT limits

PATCH Superseded Mario Limonciello 3 participants 3 messages Apr 3, 2025 – Apr 7, 2025

Subsystems (3)

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 platform/x86: amd: pmf: Fix STT limits

From: Mario Limonciello <[email protected]>

On some platforms it has been observed that STT limits are not being applied properly causing poor performance as power limits are set too low.

STT limits that are sent to the platform are supposed to be in Q8.8 format. Convert them before sending.

Fixes 7c45534afa443 ("platform/x86/amd/pmf: Add support for PMF Policy Binary")
---
 drivers/platform/x86/amd/pmf/tee-if.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/platform/x86/amd/pmf/tee-if.c +2 -2
index 5d513161d7302..9a51258df0564 100644
@@ -123,7 +123,7 @@ static void amd_pmf_apply_policies(struct amd_pmf_dev *dev, struct ta_pmf_enact_
 
 		case PMF_POLICY_STT_SKINTEMP_APU:
 			if (dev->prev_data->stt_skintemp_apu != val) {
-				amd_pmf_send_cmd(dev, SET_STT_LIMIT_APU, false, val, NULL);
+				amd_pmf_send_cmd(dev, SET_STT_LIMIT_APU, false, val << 8, NULL);
 				dev_dbg(dev->dev, "update STT_SKINTEMP_APU: %u\n", val);
 				dev->prev_data->stt_skintemp_apu = val;
 			}
@@ -131,7 +131,7 @@ static void amd_pmf_apply_policies(struct amd_pmf_dev *dev, struct ta_pmf_enact_
 
 		case PMF_POLICY_STT_SKINTEMP_HS2:
 			if (dev->prev_data->stt_skintemp_hs2 != val) {
-				amd_pmf_send_cmd(dev, SET_STT_LIMIT_HS2, false, val, NULL);
+				amd_pmf_send_cmd(dev, SET_STT_LIMIT_HS2, false, val << 8, NULL);
 				dev_dbg(dev->dev, "update STT_SKINTEMP_HS2: %u\n", val);
 				dev->prev_data->stt_skintemp_hs2 = val;
 			}
Signature · 1 line
2.43.0
Tested-by Yijun Shen on v1 1/1
#1 lore raw

Internal Use - Confidential

Quoted 17 lines

-----Original Message-----
From: Mario Limonciello <[email protected]>
Sent: Thursday, April 3, 2025 11:11 AM
To: [email protected]; [email protected]; [email protected]; [email protected]
Cc: Shen, Yijun <[email protected]>; [email protected]; platform- [email protected]
Subject: [PATCH] platform/x86: amd: pmf: Fix STT limits

[EXTERNAL EMAIL]

From: Mario Limonciello <[email protected]>

On some platforms it has been observed that STT limits are not being applied properly causing poor performance as power limits are set too low.

Quoted 8 lines

STT limits that are sent to the platform are supposed to be in Q8.8 format. Convert them before sending.

Fixes 7c45534afa443 ("platform/x86/amd/pmf: Add support for PMF Policy

Binary")

Verified the patch on the issued system, the issue is gone.

Quoted 37 lines
---
 drivers/platform/x86/amd/pmf/tee-if.c | 4 +-+---
 1 file changed, 2 insertions(+-), 2 deletions(-)
drivers/platform/x86/amd/pmf/tee-if.c +1 -1
index 5d513161d7302..9a51258df0564 100644
--- a/drivers/platform/x86/amd/pmf/tee-if.c
+-+-+- b/drivers/platform/x86/amd/pmf/tee-if.c

@@ -123,7 +-123,7 @@ static void amd_pmf_apply_policies(struct amd_pmf_dev *dev, struct ta_pmf_enact_

              case PMF_POLICY_STT_SKINTEMP_APU:
                      if (dev->prev_data->stt_skintemp_apu != val) {
-                             amd_pmf_send_cmd(dev,
SET_STT_LIMIT_APU, false, val, NULL);
+-                             amd_pmf_send_cmd(dev,
SET_STT_LIMIT_APU, false, val << 8, NULL);
                              dev_dbg(dev->dev, "update
STT_SKINTEMP_APU: %u\n", val);
                              dev->prev_data->stt_skintemp_apu = val;
                      }

@@ -131,7 +-131,7 @@ static void amd_pmf_apply_policies(struct amd_pmf_dev *dev, struct ta_pmf_enact_

              case PMF_POLICY_STT_SKINTEMP_HS2:
                      if (dev->prev_data->stt_skintemp_hs2 != val) {
-                             amd_pmf_send_cmd(dev,
SET_STT_LIMIT_HS2, false, val, NULL);
+-                             amd_pmf_send_cmd(dev,
SET_STT_LIMIT_HS2, false, val << 8, NULL);
                              dev_dbg(dev->dev, "update
STT_SKINTEMP_HS2: %u\n", val);
                              dev->prev_data->stt_skintemp_hs2 = val;
                      }

--
2.43.0

maintainer
#2 lore raw
In reply to Mario Limonciello
Quoted 30 lines · Mario Limonciello

From: Mario Limonciello <[email protected]>

On some platforms it has been observed that STT limits are not being applied properly causing poor performance as power limits are set too low.

STT limits that are sent to the platform are supposed to be in Q8.8 format. Convert them before sending.

Fixes 7c45534afa443 ("platform/x86/amd/pmf: Add support for PMF Policy Binary")
---
 drivers/platform/x86/amd/pmf/tee-if.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/platform/x86/amd/pmf/tee-if.c +1 -1
index 5d513161d7302..9a51258df0564 100644
@@ -123,7 +123,7 @@ static void amd_pmf_apply_policies(struct amd_pmf_dev *dev, struct ta_pmf_enact_
 
 		case PMF_POLICY_STT_SKINTEMP_APU:
 			if (dev->prev_data->stt_skintemp_apu != val) {
-				amd_pmf_send_cmd(dev, SET_STT_LIMIT_APU, false, val, NULL);
+				amd_pmf_send_cmd(dev, SET_STT_LIMIT_APU, false, val << 8, NULL);
 				dev_dbg(dev->dev, "update STT_SKINTEMP_APU: %u\n", val);
 				dev->prev_data->stt_skintemp_apu = val;
 			}

drivers/platform/x86/amd/pmf/tee-if.c static void amd_pmf_apply_policies(struct amd_pmf_dev *dev, struct ta_pmf_enact_ · line 137

Quoted 8 lines
drivers/platform/x86/amd/pmf/tee-if.c +1 -1
@@ -131,7 +131,7 @@ static void amd_pmf_apply_policies(struct amd_pmf_dev *dev, struct ta_pmf_enact_
 
 		case PMF_POLICY_STT_SKINTEMP_HS2:
 			if (dev->prev_data->stt_skintemp_hs2 != val) {
-				amd_pmf_send_cmd(dev, SET_STT_LIMIT_HS2, false, val, NULL);
+				amd_pmf_send_cmd(dev, SET_STT_LIMIT_HS2, false, val << 8, NULL);
 				dev_dbg(dev->dev, "update STT_SKINTEMP_HS2: %u\n", val);
 				dev->prev_data->stt_skintemp_hs2 = val;
 			}

Thanks! can you please amend this across all other places like:
amd_pmf_set_automode(), amd_pmf_set_cnqf(), amd_pmf_update_slider_v2(), amd_pmf_update_slider()

Thanks,
Shyam