]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
drm/amdgpu: check PSP response status in psp_ptl_invoke
authorPerry Yuan <perry.yuan@amd.com>
Tue, 10 Feb 2026 05:50:36 +0000 (13:50 +0800)
committerAlex Deucher <alexander.deucher@amd.com>
Mon, 11 May 2026 19:55:56 +0000 (15:55 -0400)
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>
drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c

index 580e68f02bbee1ef41a93742e0b488f7b8edddb5..ad76074d54aa57d3058544d453ec2cdfaab91c71 100644 (file)
@@ -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: