From: Perry Yuan Date: Tue, 10 Feb 2026 05:50:36 +0000 (+0800) Subject: drm/amdgpu: check PSP response status in psp_ptl_invoke X-Git-Url: http://git.ipfire.org/gitweb/index.cgi?a=commitdiff_plain;h=c13ff096437c6d470edf754c78e0cb83d24505fa;p=thirdparty%2Fkernel%2Flinux.git 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 Reviewed-by: Lijo Lazar Reviewed-by: Yifan Zhang Signed-off-by: Alex Deucher --- 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: