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 <perry.yuan@amd.com>
Reviewed-by: Yifan Zhang <yifan1.zhang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
This commit is contained in:
Perry Yuan 2026-03-10 10:39:08 +08:00 committed by Alex Deucher
parent 599c994c28
commit 682142124e
2 changed files with 5 additions and 1 deletions

View 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;
}

View 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",