From: Perry Yuan Date: Tue, 10 Mar 2026 02:39:08 +0000 (+0800) Subject: drm/amdgpu: fix ptl state isssue after GPU reset or suspend X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=682142124e3848ec03904bf6bf7063e1cac197c4;p=thirdparty%2Fkernel%2Flinux.git drm/amdgpu: fix ptl state isssue after GPU reset or suspend 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 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 aec284c6b6d7d..d525443e31f63 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c @@ -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; } diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v9_4_3.c b/drivers/gpu/drm/amd/amdgpu/gfx_v9_4_3.c index f895c3ef56bc0..9f76e1af8a553 100644 --- a/drivers/gpu/drm/amd/amdgpu/gfx_v9_4_3.c +++ b/drivers/gpu/drm/amd/amdgpu/gfx_v9_4_3.c @@ -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",