]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
drm/amdgpu: fix ptl state isssue after GPU reset or suspend
authorPerry Yuan <perry.yuan@amd.com>
Tue, 10 Mar 2026 02:39:08 +0000 (10:39 +0800)
committerAlex Deucher <alexander.deucher@amd.com>
Mon, 11 May 2026 19:55:57 +0000 (15:55 -0400)
Fix this by skipping the sysfs disable mapping when the GPU is
currently undergoing a reset or suspend flow.
Additionally, add debug logging in psp_ptl_invoke() to better
trace PTL state and format queries/updates cmd.

Signed-off-by: Perry Yuan <perry.yuan@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
drivers/gpu/drm/amd/amdgpu/gfx_v9_4_3.c

index aec284c6b6d7d490c801fb18637462674a4f83e7..d525443e31f632e79f54ef7f30b442c6b7bd5a6b 100644 (file)
@@ -1289,12 +1289,16 @@ static int psp_ptl_invoke(struct psp_context *psp, u32 req_code,
                *ptl_state = cmd->resp.uresp.perf_hw_info.ptl_state;
                *fmt1      = cmd->resp.uresp.perf_hw_info.pref_format1;
                *fmt2      = cmd->resp.uresp.perf_hw_info.pref_format2;
+               dev_dbg(psp->adev->dev, "PTL query: state=%d, fmt1=%d, fmt2=%d\n",
+                               *ptl_state, *fmt1, *fmt2);
                break;
        case PSP_PTL_PERF_MON_SET:
                /* Update cached state only on success */
                ptl->enabled = *ptl_state;
                ptl->fmt1    = *fmt1;
                ptl->fmt2    = *fmt2;
+               dev_dbg(psp->adev->dev, "PTL set: state=%d, fmt1=%d, fmt2=%d\n",
+                               *ptl_state, *fmt1, *fmt2);
                break;
        }
 
index f895c3ef56bc00a8b4e6c608becd1c06534bbeb8..9f76e1af8a553d4ca5d2f3fa157080b6b29d6d5e 100644 (file)
@@ -2401,7 +2401,7 @@ static int gfx_v9_4_3_perf_monitor_ptl_init(struct amdgpu_device *adev, bool ena
        ptl->hw_supported = true;
 
        atomic_set(&ptl->disable_ref, 0);
-       if (!enable) {
+       if (!enable && !amdgpu_in_reset(adev) && !adev->in_suspend) {
                dev_dbg(adev->dev,
                        "PTL disabled (amdgpu.ptl=%d)\
                        To enable, set amdgpu.ptl=1 via module param or kernel cmdline\n",