summaryrefslogtreecommitdiff
path: root/drivers/gpu/drm/amd/amdgpu
diff options
context:
space:
mode:
authorPerry Yuan <perry.yuan@amd.com>2026-02-10 13:50:36 +0800
committerAlex Deucher <alexander.deucher@amd.com>2026-05-11 15:55:56 -0400
commitc13ff096437c6d470edf754c78e0cb83d24505fa (patch)
treed8688e0c0d6210c060f2d858783d51bf1d80a73d /drivers/gpu/drm/amd/amdgpu
parent82cfe59ba4679647c776367dd6914c6310c1888e (diff)
downloadlwn-c13ff096437c6d470edf754c78e0cb83d24505fa.tar.gz
lwn-c13ff096437c6d470edf754c78e0cb83d24505fa.zip
drm/amdgpu: check PSP response status in psp_ptl_invoke
Add an explicit check on cmd->resp.status after psp_cmd_submit_buf() returns to ensure PTL state is only updated on actual success. Signed-off-by: Perry Yuan <perry.yuan@amd.com> Reviewed-by: Lijo Lazar <lijo.lazar@amd.com> Reviewed-by: Yifan Zhang <yifan1.zhang@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Diffstat (limited to 'drivers/gpu/drm/amd/amdgpu')
-rw-r--r--drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c
index 580e68f02bbe..ad76074d54aa 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c
@@ -1270,6 +1270,18 @@ static int psp_ptl_invoke(struct psp_context *psp, u32 req_code,
if (ret)
goto out;
+ /*
+ * Check response status explicitly to avoid
+ * updating cached PTL state with invalid data.
+ */
+ if (cmd->resp.status) {
+ dev_err(psp->adev->dev,
+ "PTL command 0x%x failed, PSP response status: 0x%X\n",
+ req_code, cmd->resp.status);
+ ret = -EIO;
+ goto out;
+ }
+
/* Parse response */
switch (req_code) {
case PSP_PTL_PERF_MON_QUERY: