[PATCH] drm/amd/pm: keep smu8 sclk level lookups within the table

From: Joshua Horne via B4 Relay

Date: Sat Dec 05 2026 - 23:43:41 EST


From: Joshua Horne <hornejd@xxxxxxxx>

smu8_get_sclk_level() returns the table size for a minimum clock above
the highest level and -1 for a maximum clock below the lowest level,
and the callers send that to the SMU as the level index.

This happens each time DPM is started, so at every driver load:
smu8_program_bootup_state() looks up the boot engine clock from the
IntegratedSystemInfo table, which is below the lowest graphics level on
at least some Carrizo VBIOS images (200 MHz vs. 300 MHz on an
A10-8700P), so PPSMC_MSG_SetSclkSoftMax is sent with 0xffffffff. A valid
limit is sent shortly after when the performance level is applied, so it
went unnoticed. The display's minimum engine clock is not taken from the
table either.

Select the nearest level instead.

Fixes: bdecc20a986b ("drm/amd/powerplay: add Carrizo dpm support")
Signed-off-by: Joshua Horne <hornejd@xxxxxxxx>
---
This was patch 1/5 of the smu8 overdrive series [1]. It fixes existing
code and does not depend on the rest, so I am sending it on its own,
unchanged.

It was tested as part of that series on an A10-8700P (ASUS X555DA),
not on its own.

I used an AI coding assistant (Claude Code) while working on this. It
found the bug, wrote the change and a draft of the changelog, and wrote
and ran the build checks and test scripts. I reviewed the change and the
changelog, ran the tests on my hardware, and I am responsible for the
patch.

[1] https://lore.kernel.org/amd-gfx/20261113-smu8-overdrive-v1-0-763f07bdfca9@xxxxxxxx/
---
drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu8_hwmgr.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu8_hwmgr.c b/drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu8_hwmgr.c
index 5a3f697a37a2..8e64f2af019e 100644
--- a/drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu8_hwmgr.c
+++ b/drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu8_hwmgr.c
@@ -123,7 +123,9 @@ static uint32_t smu8_get_sclk_level(struct pp_hwmgr *hwmgr,
default:
break;
}
- return i;
+
+ /* a clock outside of the table selects the nearest level */
+ return clamp(i, 0, (int)table->count - 1);
}

static uint32_t smu8_get_uvd_level(struct pp_hwmgr *hwmgr,

---
base-commit: 910fd45c4364d29810d0d10e848f8f7ef4e7b3ef
change-id: 20261205-smu8-sclk-lookup-fix-f35f0294987e