AMD General

Reviewed-by: Yongqiang Sun <[email protected]>

________________________________
From: Jesse Zhang <[email protected]>
Sent: Thursday, October 08, 2026 2:51 AM
To: [email protected] <[email protected]>
Cc: Deucher, Alexander <[email protected]>; Koenig, Christian 
<[email protected]>; Sun, Yongqiang <[email protected]>; Zhang, 
Jesse(Jie) <[email protected]>
Subject: [PATCH] drm/amdgpu/mes: wake the GPU before toggling mes_dbgext from 
debugfs

The amdgpu_mes_dbgext debugfs write handler programs CPC_INT_CNTL and
sends MISC packets to the MES without holding a runtime PM reference.
If the GPU is runtime suspended the MES never answers, so enabling the
log fails:

  amdgpu 0000:03:00.0: MES failed to respond to msg=MISC fence_wait_ret=0 
status=0x0
  amdgpu 0000:03:00.0: failed to setup mes_dbgext in FW on xcc0 (-110)

and the write returns -ETIMEDOUT.

Resume the GPU before starting or stopping the log.

Fixes: 21593a22a09a ("drm/amdgpu: add mes_dbgext core support")
Signed-off-by: Jesse Zhang <[email protected]>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_mes.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_mes.c 
b/drivers/gpu/drm/amd/amdgpu/amdgpu_mes.c
index 8d813c68450b..b93b4be05178 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_mes.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_mes.c
@@ -23,6 +23,7 @@

 #include <linux/firmware.h>
 #include <linux/kthread.h>
+#include <linux/pm_runtime.h>
 #include <linux/delay.h>
 #include <linux/sizes.h>
 #include <linux/slab.h>
@@ -1955,6 +1956,13 @@ static ssize_t amdgpu_debugfs_mes_dbgext_write(struct 
file *file,
         if (!mes->funcs || !mes->funcs->misc_op)
                 return -EOPNOTSUPP;

+       /* Arming and detaching the firmware talks to the MES. */
+       PM_RUNTIME_ACQUIRE_IF_ENABLED_AUTOSUSPEND(adev->dev, pm);
+
+       r = PM_RUNTIME_ACQUIRE_ERR(&pm);
+       if (r)
+               return r;
+
         mutex_lock(&mes->dbgext_lock);
         if (enable) {
                 mes->dbgext_runtime_kb = amdgpu_mes_dbgext_buffer_size ?
--
2.50.1

Reply via email to