Skip to contentSkip to conversation

drm/amdgpu: Update message IDs to PMFW to correctly gather GFXOFF residency logs

PATCH In review Fares Soliman 4 participants 6 messages Jul 13 – Jul 29

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 drm/amdgpu: Update message IDs to PMFW to correctly gather GFXOFF residency logs

Updates PPSMC_MSGs and set/get functions for gathering GFXOFF logs on Van Gogh. Logs are now gathered live rather than starting then stopping logging and reading an average value afterwards. This is in accordance to changes made in PMFW.

In regards to messageID 0x52, the old interface uses a start/stop parameter, and the new one doesn't. The firmware is checked to determine which method to use.

v2: added firmware guard to new interface, old interface kept as fallback

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c   |  4 +-
 drivers/gpu/drm/amd/pm/swsmu/inc/amdgpu_smu.h |  2 +-
 .../pm/swsmu/inc/pmfw_if/smu_v11_5_ppsmc.h    |  6 ++-
 drivers/gpu/drm/amd/pm/swsmu/inc/smu_types.h  |  4 +-
 .../gpu/drm/amd/pm/swsmu/smu11/vangogh_ppt.c  | 50 +++++++++++++++----
 5 files changed, 50 insertions(+), 16 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c +2 -2
index 5c4d4ff001ea..46514a1faf1f 100644
@@ -1320,8 +1320,8 @@ static ssize_t amdgpu_debugfs_gpr_read(struct file *f, char __user *buf,
  * @size: Number of bytes to read
  * @pos:  Offset to seek to
  *
- * Read the last residency value logged. It doesn't auto update, one needs to
- * stop logging before getting the current value.
+ * Read a live GFXOFF residency sample from firmware. One needs to start logging
+ * before getting the current value.
  */
 static ssize_t amdgpu_debugfs_gfxoff_residency_read(struct file *f, char __user *buf,
 						    size_t size, loff_t *pos)
drivers/gpu/drm/amd/pm/swsmu/inc/amdgpu_smu.h +1 -1
index f8fd93999617..d94e3dcf7f9a 100644
@@ -1333,7 +1333,7 @@ struct pptable_funcs {
 	u32 (*set_gfx_off_residency)(struct smu_context *smu, bool start);
 
 	/**
-	 * @get_gfx_off_residency: Average GFXOFF residency % during the logging interval
+	 * @get_gfx_off_residency: Live GFXOFF residency percentage
 	 */
 	u32 (*get_gfx_off_residency)(struct smu_context *smu, uint32_t *residency);
 
drivers/gpu/drm/amd/pm/swsmu/inc/pmfw_if/smu_v11_5_ppsmc.h +4 -2
index 7471e2df2828..4206514765cd 100644
@@ -110,8 +110,10 @@
 #define PPSMC_MSG_GetSlowPPTLimit                      0x4C
 #define PPSMC_MSG_GetGfxOffStatus		       0x50
 #define PPSMC_MSG_GetGfxOffEntryCount		       0x51
-#define PPSMC_MSG_LogGfxOffResidency		       0x52
-#define PPSMC_Message_Count                            0x53
+#define PPSMC_MSG_GfxOffResidencyLogReadSample	       0x52
+#define PPSMC_MSG_StopGfxOffResidencyLogging	         0x53
+#define PPSMC_MSG_StartGfxOffResidencyLogging	         0x56
+#define PPSMC_Message_Count                            0x57
 
 //Argument for PPSMC_MSG_GfxDeviceDriverReset
 enum {
drivers/gpu/drm/amd/pm/swsmu/inc/smu_types.h +3 -1
index 636ff90923d9..acf03838d49d 100644
@@ -252,7 +252,9 @@
 	__SMU_DUMMY_MAP(DriverMode2Reset), \
 	__SMU_DUMMY_MAP(GetGfxOffStatus),		 \
 	__SMU_DUMMY_MAP(GetGfxOffEntryCount),		 \
-	__SMU_DUMMY_MAP(LogGfxOffResidency),			\
+	__SMU_DUMMY_MAP(StartGfxOffResidencyLogging),		\
+	__SMU_DUMMY_MAP(GfxOffResidencyLogReadSample),		\
+	__SMU_DUMMY_MAP(StopGfxOffResidencyLogging),		\
 	__SMU_DUMMY_MAP(SetNumBadMemoryPagesRetired),		\
 	__SMU_DUMMY_MAP(SetBadMemoryPagesRetiredFlagsPerChannel), \
 	__SMU_DUMMY_MAP(AllowGpo),	\
drivers/gpu/drm/amd/pm/swsmu/smu11/vangogh_ppt.c +40 -10

83 lines not on this page · raw message

Signature · 1 line
2.43.0
#1 lore raw

AMD General

Hi Alex,

I've updated the patch earlier this week to gate on when the new PMFW interface was added (4.63.62.00). If you can let me know what you think, that would be excellent.

Thanks!
Fares

________________________________
From: Soliman, Fares <[email protected]>
Sent: Monday, 13 July 2026 09:26:24
To: [email protected] <[email protected]>
Cc: Liang, Richard qi <[email protected]>; Soliman, Fares <[email protected]>
Subject: [PATCH v2] drm/amdgpu: Update message IDs to PMFW to correctly gather GFXOFF residency logs

Updates PPSMC_MSGs and set/get functions for gathering GFXOFF logs on Van Gogh. Logs are now gathered live rather than starting then stopping logging and reading an average value afterwards. This is in accordance to changes made in PMFW.

In regards to messageID 0x52, the old interface uses a start/stop parameter, and the new one doesn't. The firmware is checked to determine which method to use.

v2: added firmware guard to new interface, old interface kept as fallback

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c   |  4 +-
 drivers/gpu/drm/amd/pm/swsmu/inc/amdgpu_smu.h |  2 +-
 .../pm/swsmu/inc/pmfw_if/smu_v11_5_ppsmc.h    |  6 ++-
 drivers/gpu/drm/amd/pm/swsmu/inc/smu_types.h  |  4 +-
 .../gpu/drm/amd/pm/swsmu/smu11/vangogh_ppt.c  | 50 +++++++++++++++----
 5 files changed, 50 insertions(+), 16 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c +2 -2
index 5c4d4ff001ea..46514a1faf1f 100644
@@ -1320,8 +1320,8 @@ static ssize_t amdgpu_debugfs_gpr_read(struct file *f, char __user *buf,
  * @size: Number of bytes to read
  * @pos:  Offset to seek to
  *
- * Read the last residency value logged. It doesn't auto update, one needs to
- * stop logging before getting the current value.
+ * Read a live GFXOFF residency sample from firmware. One needs to start logging
+ * before getting the current value.
  */
 static ssize_t amdgpu_debugfs_gfxoff_residency_read(struct file *f, char __user *buf,
                                                     size_t size, loff_t *pos)
drivers/gpu/drm/amd/pm/swsmu/inc/amdgpu_smu.h +1 -1
index f8fd93999617..d94e3dcf7f9a 100644
@@ -1333,7 +1333,7 @@ struct pptable_funcs {
         u32 (*set_gfx_off_residency)(struct smu_context *smu, bool start);
 
         /**
-        * @get_gfx_off_residency: Average GFXOFF residency % during the logging interval
+        * @get_gfx_off_residency: Live GFXOFF residency percentage
          */
         u32 (*get_gfx_off_residency)(struct smu_context *smu, uint32_t *residency);
 
drivers/gpu/drm/amd/pm/swsmu/inc/pmfw_if/smu_v11_5_ppsmc.h +4 -2
index 7471e2df2828..4206514765cd 100644
@@ -110,8 +110,10 @@
 #define PPSMC_MSG_GetSlowPPTLimit                      0x4C
 #define PPSMC_MSG_GetGfxOffStatus                      0x50
 #define PPSMC_MSG_GetGfxOffEntryCount                  0x51
-#define PPSMC_MSG_LogGfxOffResidency                  0x52
-#define PPSMC_Message_Count                            0x53
+#define PPSMC_MSG_GfxOffResidencyLogReadSample        0x52
+#define PPSMC_MSG_StopGfxOffResidencyLogging            0x53
+#define PPSMC_MSG_StartGfxOffResidencyLogging           0x56
+#define PPSMC_Message_Count                            0x57
 
 //Argument for PPSMC_MSG_GfxDeviceDriverReset
 enum {
drivers/gpu/drm/amd/pm/swsmu/inc/smu_types.h +3 -1
index 636ff90923d9..acf03838d49d 100644
@@ -252,7 +252,9 @@
         __SMU_DUMMY_MAP(DriverMode2Reset), \
         __SMU_DUMMY_MAP(GetGfxOffStatus),                \
         __SMU_DUMMY_MAP(GetGfxOffEntryCount),            \
-       __SMU_DUMMY_MAP(LogGfxOffResidency),                    \
+       __SMU_DUMMY_MAP(StartGfxOffResidencyLogging),           \
+       __SMU_DUMMY_MAP(GfxOffResidencyLogReadSample),          \
+       __SMU_DUMMY_MAP(StopGfxOffResidencyLogging),            \
         __SMU_DUMMY_MAP(SetNumBadMemoryPagesRetired),           \
         __SMU_DUMMY_MAP(SetBadMemoryPagesRetiredFlagsPerChannel), \
         __SMU_DUMMY_MAP(AllowGpo),      \
drivers/gpu/drm/amd/pm/swsmu/smu11/vangogh_ppt.c +40 -10

83 lines not on this page · raw message

--
2.43.0

maintainer Acked-by on v2 1/1
#2 lore raw
In reply to Fares Soliman

Public

Quoted 15 lines

-----Original Message-----
From: amd-gfx <[email protected]> On Behalf Of Fares Soliman
Sent: Monday, July 13, 2026 9:26 AM
To: [email protected]
Cc: Liang, Richard qi <[email protected]>; Soliman, Fares <[email protected]>
Subject: [PATCH v2] drm/amdgpu: Update message IDs to PMFW to correctly gather GFXOFF residency logs

Updates PPSMC_MSGs and set/get functions for gathering GFXOFF logs on Van Gogh. Logs are now gathered live rather than starting then stopping logging and reading an average value afterwards. This is in accordance to changes made in PMFW.

Quoted 7 lines

In regards to messageID 0x52, the old interface uses a start/stop parameter, and the new one doesn't. The firmware is checked to determine which method to use.

v2: added firmware guard to new interface, old interface kept as fallback

Quoted 198 lines
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c   |  4 +-
 drivers/gpu/drm/amd/pm/swsmu/inc/amdgpu_smu.h |  2 +-
 .../pm/swsmu/inc/pmfw_if/smu_v11_5_ppsmc.h    |  6 ++-
 drivers/gpu/drm/amd/pm/swsmu/inc/smu_types.h  |  4 +-
.../gpu/drm/amd/pm/swsmu/smu11/vangogh_ppt.c  | 50
+++++++++++++++----
 5 files changed, 50 insertions(+), 16 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c +3 -2
index 5c4d4ff001ea..46514a1faf1f 100644
@@ -1320,8 +1320,8 @@ static ssize_t amdgpu_debugfs_gpr_read(struct file
 *f, char __user *buf,
  * @size: Number of bytes to read
  * @pos:  Offset to seek to
  *
- * Read the last residency value logged. It doesn't auto update, one needs to
- * stop logging before getting the current value.
+ * Read a live GFXOFF residency sample from firmware. One needs to
+ start logging
+ * before getting the current value.
  */
 static ssize_t amdgpu_debugfs_gfxoff_residency_read(struct file *f, char

__user *buf,
size_t size, loff_t *pos)

drivers/gpu/drm/amd/pm/swsmu/inc/amdgpu_smu.h +0 -1
index f8fd93999617..d94e3dcf7f9a 100644
@@ -1333,7 +1333,7 @@ struct pptable_funcs {
      u32 (*set_gfx_off_residency)(struct smu_context *smu, bool start);
 
      /**
-      * @get_gfx_off_residency: Average GFXOFF residency % during the

logging interval
+ * @get_gfx_off_residency: Live GFXOFF residency percentage
*/
u32 (*get_gfx_off_residency)(struct smu_context *smu, uint32_t
*residency);

diff --git a/drivers/gpu/drm/amd/pm/swsmu/inc/pmfw_if/smu_v11_5_ppsmc.h b/drivers/gpu/drm/amd/pm/swsmu/inc/pmfw_if/smu_v11_5_ppsmc.h index 7471e2df2828..4206514765cd 100644

drivers/gpu/drm/amd/pm/swsmu/inc/pmfw_if/smu_v11_5_ppsmc.h +4 -2
@@ -110,8 +110,10 @@
 #define PPSMC_MSG_GetSlowPPTLimit                      0x4C
 #define PPSMC_MSG_GetGfxOffStatus                   0x50
 #define PPSMC_MSG_GetGfxOffEntryCount                       0x51
-#define PPSMC_MSG_LogGfxOffResidency                0x52
-#define PPSMC_Message_Count                            0x53
+#define PPSMC_MSG_GfxOffResidencyLogReadSample              0x52
+#define PPSMC_MSG_StopGfxOffResidencyLogging          0x53
+#define PPSMC_MSG_StartGfxOffResidencyLogging                 0x56
+#define PPSMC_Message_Count                            0x57
 
 //Argument for PPSMC_MSG_GfxDeviceDriverReset  enum { diff --git

a/drivers/gpu/drm/amd/pm/swsmu/inc/smu_types.h
b/drivers/gpu/drm/amd/pm/swsmu/inc/smu_types.h
index 636ff90923d9..acf03838d49d 100644

drivers/gpu/drm/amd/pm/swsmu/inc/smu_types.h +3 -1
@@ -252,7 +252,9 @@
      __SMU_DUMMY_MAP(DriverMode2Reset), \
      __SMU_DUMMY_MAP(GetGfxOffStatus),                \
      __SMU_DUMMY_MAP(GetGfxOffEntryCount),            \
-     __SMU_DUMMY_MAP(LogGfxOffResidency),                    \
+     __SMU_DUMMY_MAP(StartGfxOffResidencyLogging),           \
+     __SMU_DUMMY_MAP(GfxOffResidencyLogReadSample),
      \
+     __SMU_DUMMY_MAP(StopGfxOffResidencyLogging),            \
      __SMU_DUMMY_MAP(SetNumBadMemoryPagesRetired),
      \

__SMU_DUMMY_MAP(SetBadMemoryPagesRetiredFlagsPerChannel)

, \
      __SMU_DUMMY_MAP(AllowGpo),      \
drivers/gpu/drm/amd/pm/swsmu/smu11/vangogh_ppt.c +6 -0
index 717ba46c8933..1104f8b05b29 100644
@@ -72,6 +72,12 @@ static const struct smu_feature_bits
 vangogh_dpm_features = {
      }
 };
 
+/*
+ * SMU support new GFXOFF residency log interface since version
+4.63.62.00,
+ * use this to get live readings of GFXOFF residency  */ #define
+SUPPORT_LIVE_RESIDENCY_MSG_VERSION 0x043f3e00
+
 static struct cmn2asic_msg_mapping
 vangogh_message_map[SMU_MSG_MAX_COUNT] = {
      MSG_MAP(TestMessage,                    PPSMC_MSG_TestMessage,
              0),
      MSG_MAP(GetSmuVersion,                  PPSMC_MSG_GetSmuVersion,
              0),
drivers/gpu/drm/amd/pm/swsmu/smu11/vangogh_ppt.c +0 -0
@@ -142,7 +148,9 @@ static struct cmn2asic_msg_mapping
 vangogh_message_map[SMU_MSG_MAX_COUNT] = {
      MSG_MAP(GetSlowPPTLimit,
 PPSMC_MSG_GetSlowPPTLimit,
      0),
      MSG_MAP(GetGfxOffStatus,
 PPSMC_MSG_GetGfxOffStatus,                                            0),
      MSG_MAP(GetGfxOffEntryCount,

PPSMC_MSG_GetGfxOffEntryCount, 0),
- MSG_MAP(LogGfxOffResidency,
PPSMC_MSG_LogGfxOffResidency, 0),
+ MSG_MAP(StartGfxOffResidencyLogging,
PPSMC_MSG_StartGfxOffResidencyLogging, 0),
+ MSG_MAP(GfxOffResidencyLogReadSample,
PPSMC_MSG_GfxOffResidencyLogReadSample, 0),
+ MSG_MAP(StopGfxOffResidencyLogging,
PPSMC_MSG_StopGfxOffResidencyLogging, 0),
};

static struct cmn2asic_mapping
vangogh_feature_mask_map[SMU_FEATURE_COUNT] = { @@ -2450,19 +2458,32 @@ static int vangogh_set_power_limit(struct smu_context *smu, static u32 vangogh_set_gfxoff_residency(struct smu_context *smu, bool

start)  {
      int ret = 0;
drivers/gpu/drm/amd/pm/swsmu/smu11/vangogh_ppt.c +0 -2
-     u32 residency;
      struct amdgpu_device *adev = smu->adev;
 
      if (!(adev->pm.pp_feature & PP_GFXOFF_MASK))
              return 0;
 
-     ret = smu_cmn_send_smc_msg_with_param(smu,

SMU_MSG_LogGfxOffResidency,

drivers/gpu/drm/amd/pm/swsmu/smu11/vangogh_ppt.c +1 -3
-                                           start, &residency);
-     if (ret)
-             return ret;
+     if (smu->smc_fw_version <

SUPPORT_LIVE_RESIDENCY_MSG_VERSION) {

drivers/gpu/drm/amd/pm/swsmu/smu11/vangogh_ppt.c +3 -0
+             u32 residency;
+
+             ret = smu_cmn_send_smc_msg_with_param(smu,

SMU_MSG_GfxOffResidencyLogReadSample,

drivers/gpu/drm/amd/pm/swsmu/smu11/vangogh_ppt.c +8 -2
+                                                     start, &residency);
+             if (ret)
+                     return ret;
 
-     if (!start)
-             adev->gfx.gfx_off_residency = residency;
+             if (!start)
+                     adev->gfx.gfx_off_residency = residency;
+     } else {
+             if (start) {
+                     ret = smu_cmn_send_smc_msg(smu,

SMU_MSG_StartGfxOffResidencyLogging, NULL);

drivers/gpu/drm/amd/pm/swsmu/smu11/vangogh_ppt.c +4 -0
+                     if (ret)
+                             return ret;
+             } else {
+                     ret = smu_cmn_send_smc_msg(smu,

SMU_MSG_StopGfxOffResidencyLogging, NULL);

drivers/gpu/drm/amd/pm/swsmu/smu11/vangogh_ppt.c +15 -2
+                     if (ret)
+                             return ret;
+             }
+     }
 
      return ret;
 }
@@ -2479,11 +2500,20 @@ static u32 vangogh_set_gfxoff_residency(struct
 smu_context *smu, bool start)
  */
 static u32 vangogh_get_gfxoff_residency(struct smu_context *smu, uint32_t
 *residency)  {
+     int ret = 0;
      struct amdgpu_device *adev = smu->adev;
 
-     *residency = adev->gfx.gfx_off_residency;
+     if (!(adev->pm.pp_feature & PP_GFXOFF_MASK))
+             return 0;
+
+     if (smu->smc_fw_version <
 SUPPORT_LIVE_RESIDENCY_MSG_VERSION) {
+             *residency = adev->gfx.gfx_off_residency;
+     } else {
+             ret = smu_cmn_send_smc_msg(smu,
 SMU_MSG_GfxOffResidencyLogReadSample,
+                                                             residency);
+     }
 
-     return 0;
+     return ret;

}

/**
--
2.43.0

author Acked-by Alex Deucher
#3 lore raw

Public

Thanks Alex,

Forgive me if this is obvious, but is an Acked-by tag sufficient to have this pushed or will I have to get it reviewed by an additional developer?

Thanks,
Fares

________________________________
From: Deucher, Alexander <[email protected]>
Sent: Friday, 17 July 2026 17:20:27
To: Soliman, Fares <[email protected]>; [email protected] <[email protected]>
Cc: Liang, Richard qi <[email protected]>; Soliman, Fares <[email protected]>
Subject: RE: [PATCH v2] drm/amdgpu: Update message IDs to PMFW to correctly gather GFXOFF residency logs

Public

Quoted 15 lines

-----Original Message-----
From: amd-gfx <[email protected]> On Behalf Of Fares Soliman
Sent: Monday, July 13, 2026 9:26 AM
To: [email protected]
Cc: Liang, Richard qi <[email protected]>; Soliman, Fares <[email protected]>
Subject: [PATCH v2] drm/amdgpu: Update message IDs to PMFW to correctly gather GFXOFF residency logs

Updates PPSMC_MSGs and set/get functions for gathering GFXOFF logs on Van Gogh. Logs are now gathered live rather than starting then stopping logging and reading an average value afterwards. This is in accordance to changes made in PMFW.

Quoted 7 lines

In regards to messageID 0x52, the old interface uses a start/stop parameter, and the new one doesn't. The firmware is checked to determine which method to use.

v2: added firmware guard to new interface, old interface kept as fallback

Quoted 198 lines
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c   |  4 +-
 drivers/gpu/drm/amd/pm/swsmu/inc/amdgpu_smu.h |  2 +-
 .../pm/swsmu/inc/pmfw_if/smu_v11_5_ppsmc.h    |  6 ++-
 drivers/gpu/drm/amd/pm/swsmu/inc/smu_types.h  |  4 +-
.../gpu/drm/amd/pm/swsmu/smu11/vangogh_ppt.c  | 50
+++++++++++++++----
 5 files changed, 50 insertions(+), 16 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c +3 -2
index 5c4d4ff001ea..46514a1faf1f 100644
@@ -1320,8 +1320,8 @@ static ssize_t amdgpu_debugfs_gpr_read(struct file
 *f, char __user *buf,
  * @size: Number of bytes to read
  * @pos:  Offset to seek to
  *
- * Read the last residency value logged. It doesn't auto update, one needs to
- * stop logging before getting the current value.
+ * Read a live GFXOFF residency sample from firmware. One needs to
+ start logging
+ * before getting the current value.
  */
 static ssize_t amdgpu_debugfs_gfxoff_residency_read(struct file *f, char

__user *buf,
size_t size, loff_t *pos)

drivers/gpu/drm/amd/pm/swsmu/inc/amdgpu_smu.h +0 -1
index f8fd93999617..d94e3dcf7f9a 100644
@@ -1333,7 +1333,7 @@ struct pptable_funcs {
      u32 (*set_gfx_off_residency)(struct smu_context *smu, bool start);
 
      /**
-      * @get_gfx_off_residency: Average GFXOFF residency % during the

logging interval
+ * @get_gfx_off_residency: Live GFXOFF residency percentage
*/
u32 (*get_gfx_off_residency)(struct smu_context *smu, uint32_t
*residency);

diff --git a/drivers/gpu/drm/amd/pm/swsmu/inc/pmfw_if/smu_v11_5_ppsmc.h b/drivers/gpu/drm/amd/pm/swsmu/inc/pmfw_if/smu_v11_5_ppsmc.h index 7471e2df2828..4206514765cd 100644

drivers/gpu/drm/amd/pm/swsmu/inc/pmfw_if/smu_v11_5_ppsmc.h +4 -2
@@ -110,8 +110,10 @@
 #define PPSMC_MSG_GetSlowPPTLimit                      0x4C
 #define PPSMC_MSG_GetGfxOffStatus                   0x50
 #define PPSMC_MSG_GetGfxOffEntryCount                       0x51
-#define PPSMC_MSG_LogGfxOffResidency                0x52
-#define PPSMC_Message_Count                            0x53
+#define PPSMC_MSG_GfxOffResidencyLogReadSample              0x52
+#define PPSMC_MSG_StopGfxOffResidencyLogging          0x53
+#define PPSMC_MSG_StartGfxOffResidencyLogging                 0x56
+#define PPSMC_Message_Count                            0x57
 
 //Argument for PPSMC_MSG_GfxDeviceDriverReset  enum { diff --git

a/drivers/gpu/drm/amd/pm/swsmu/inc/smu_types.h
b/drivers/gpu/drm/amd/pm/swsmu/inc/smu_types.h
index 636ff90923d9..acf03838d49d 100644

drivers/gpu/drm/amd/pm/swsmu/inc/smu_types.h +3 -1
@@ -252,7 +252,9 @@
      __SMU_DUMMY_MAP(DriverMode2Reset), \
      __SMU_DUMMY_MAP(GetGfxOffStatus),                \
      __SMU_DUMMY_MAP(GetGfxOffEntryCount),            \
-     __SMU_DUMMY_MAP(LogGfxOffResidency),                    \
+     __SMU_DUMMY_MAP(StartGfxOffResidencyLogging),           \
+     __SMU_DUMMY_MAP(GfxOffResidencyLogReadSample),
      \
+     __SMU_DUMMY_MAP(StopGfxOffResidencyLogging),            \
      __SMU_DUMMY_MAP(SetNumBadMemoryPagesRetired),
      \

__SMU_DUMMY_MAP(SetBadMemoryPagesRetiredFlagsPerChannel)

, \
      __SMU_DUMMY_MAP(AllowGpo),      \
drivers/gpu/drm/amd/pm/swsmu/smu11/vangogh_ppt.c +6 -0
index 717ba46c8933..1104f8b05b29 100644
@@ -72,6 +72,12 @@ static const struct smu_feature_bits
 vangogh_dpm_features = {
      }
 };
 
+/*
+ * SMU support new GFXOFF residency log interface since version
+4.63.62.00,
+ * use this to get live readings of GFXOFF residency  */ #define
+SUPPORT_LIVE_RESIDENCY_MSG_VERSION 0x043f3e00
+
 static struct cmn2asic_msg_mapping
 vangogh_message_map[SMU_MSG_MAX_COUNT] = {
      MSG_MAP(TestMessage,                    PPSMC_MSG_TestMessage,
              0),
      MSG_MAP(GetSmuVersion,                  PPSMC_MSG_GetSmuVersion,
              0),
drivers/gpu/drm/amd/pm/swsmu/smu11/vangogh_ppt.c +0 -0
@@ -142,7 +148,9 @@ static struct cmn2asic_msg_mapping
 vangogh_message_map[SMU_MSG_MAX_COUNT] = {
      MSG_MAP(GetSlowPPTLimit,
 PPSMC_MSG_GetSlowPPTLimit,
      0),
      MSG_MAP(GetGfxOffStatus,
 PPSMC_MSG_GetGfxOffStatus,                                            0),
      MSG_MAP(GetGfxOffEntryCount,

PPSMC_MSG_GetGfxOffEntryCount, 0),
- MSG_MAP(LogGfxOffResidency,
PPSMC_MSG_LogGfxOffResidency, 0),
+ MSG_MAP(StartGfxOffResidencyLogging,
PPSMC_MSG_StartGfxOffResidencyLogging, 0),
+ MSG_MAP(GfxOffResidencyLogReadSample,
PPSMC_MSG_GfxOffResidencyLogReadSample, 0),
+ MSG_MAP(StopGfxOffResidencyLogging,
PPSMC_MSG_StopGfxOffResidencyLogging, 0),
};

static struct cmn2asic_mapping
vangogh_feature_mask_map[SMU_FEATURE_COUNT] = { @@ -2450,19 +2458,32 @@ static int vangogh_set_power_limit(struct smu_context *smu, static u32 vangogh_set_gfxoff_residency(struct smu_context *smu, bool

start)  {
      int ret = 0;
drivers/gpu/drm/amd/pm/swsmu/smu11/vangogh_ppt.c +0 -2
-     u32 residency;
      struct amdgpu_device *adev = smu->adev;
 
      if (!(adev->pm.pp_feature & PP_GFXOFF_MASK))
              return 0;
 
-     ret = smu_cmn_send_smc_msg_with_param(smu,

SMU_MSG_LogGfxOffResidency,

drivers/gpu/drm/amd/pm/swsmu/smu11/vangogh_ppt.c +1 -3
-                                           start, &residency);
-     if (ret)
-             return ret;
+     if (smu->smc_fw_version <

SUPPORT_LIVE_RESIDENCY_MSG_VERSION) {

drivers/gpu/drm/amd/pm/swsmu/smu11/vangogh_ppt.c +3 -0
+             u32 residency;
+
+             ret = smu_cmn_send_smc_msg_with_param(smu,

SMU_MSG_GfxOffResidencyLogReadSample,

drivers/gpu/drm/amd/pm/swsmu/smu11/vangogh_ppt.c +8 -2
+                                                     start, &residency);
+             if (ret)
+                     return ret;
 
-     if (!start)
-             adev->gfx.gfx_off_residency = residency;
+             if (!start)
+                     adev->gfx.gfx_off_residency = residency;
+     } else {
+             if (start) {
+                     ret = smu_cmn_send_smc_msg(smu,

SMU_MSG_StartGfxOffResidencyLogging, NULL);

drivers/gpu/drm/amd/pm/swsmu/smu11/vangogh_ppt.c +4 -0
+                     if (ret)
+                             return ret;
+             } else {
+                     ret = smu_cmn_send_smc_msg(smu,

SMU_MSG_StopGfxOffResidencyLogging, NULL);

drivers/gpu/drm/amd/pm/swsmu/smu11/vangogh_ppt.c +15 -2
+                     if (ret)
+                             return ret;
+             }
+     }
 
      return ret;
 }
@@ -2479,11 +2500,20 @@ static u32 vangogh_set_gfxoff_residency(struct
 smu_context *smu, bool start)
  */
 static u32 vangogh_get_gfxoff_residency(struct smu_context *smu, uint32_t
 *residency)  {
+     int ret = 0;
      struct amdgpu_device *adev = smu->adev;
 
-     *residency = adev->gfx.gfx_off_residency;
+     if (!(adev->pm.pp_feature & PP_GFXOFF_MASK))
+             return 0;
+
+     if (smu->smc_fw_version <
 SUPPORT_LIVE_RESIDENCY_MSG_VERSION) {
+             *residency = adev->gfx.gfx_off_residency;
+     } else {
+             ret = smu_cmn_send_smc_msg(smu,
 SMU_MSG_GfxOffResidencyLogReadSample,
+                                                             residency);
+     }
 
-     return 0;
+     return ret;

}

/**
--
2.43.0

Acked-by Alex Deucher
#4 lore raw

Public

Either Acked-by or Reviewed-by are sufficient for merging.

Kent

From: amd-gfx <[email protected]> On Behalf Of Soliman, Fares
Sent: July 17, 2026 7:06 PM
To: Deucher, Alexander <[email protected]>; [email protected]
Cc: Liang, Richard qi <[email protected]>
Subject: Re: [PATCH v2] drm/amdgpu: Update message IDs to PMFW to correctly gather GFXOFF residency logs

Some people who received this message don't often get email from [email protected]<mailto:[email protected]>. Learn why this is important<https://aka.ms/LearnAboutSenderIdentification>

Public

Thanks Alex,

Forgive me if this is obvious, but is an Acked-by tag sufficient to have this pushed or will I have to get it reviewed by an additional developer?

Thanks,
Fares

________________________________
From: Deucher, Alexander <[email protected]<mailto:[email protected]>>
Sent: Friday, 17 July 2026 17:20:27
To: Soliman, Fares <[email protected]<mailto:[email protected]>>; [email protected]<mailto:[email protected]> <[email protected]<mailto:[email protected]>>
Cc: Liang, Richard qi <[email protected]<mailto:[email protected]>>; Soliman, Fares <[email protected]<mailto:[email protected]>>
Subject: RE: [PATCH v2] drm/amdgpu: Update message IDs to PMFW to correctly gather GFXOFF residency logs

Public

Quoted 15 lines

-----Original Message-----
From: amd-gfx <[email protected]<mailto:[email protected]>> On Behalf Of Fares Soliman
Sent: Monday, July 13, 2026 9:26 AM
To: [email protected]<mailto:[email protected]>
Cc: Liang, Richard qi <[email protected]<mailto:[email protected]>>; Soliman, Fares <[email protected]<mailto:[email protected]>>
Subject: [PATCH v2] drm/amdgpu: Update message IDs to PMFW to correctly
gather GFXOFF residency logs

Updates PPSMC_MSGs and set/get functions for gathering GFXOFF logs on Van Gogh. Logs are now gathered live rather than starting then stopping logging and reading an average value afterwards. This is in accordance to changes made in PMFW.

Quoted 7 lines

In regards to messageID 0x52, the old interface uses a start/stop parameter, and the new one doesn't. The firmware is checked to determine which method to use.

v2: added firmware guard to new interface, old interface kept as fallback

Quoted 198 lines
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c   |  4 +-
 drivers/gpu/drm/amd/pm/swsmu/inc/amdgpu_smu.h |  2 +-
 .../pm/swsmu/inc/pmfw_if/smu_v11_5_ppsmc.h    |  6 ++-
 drivers/gpu/drm/amd/pm/swsmu/inc/smu_types.h  |  4 +-
.../gpu/drm/amd/pm/swsmu/smu11/vangogh_ppt.c  | 50
+++++++++++++++----
 5 files changed, 50 insertions(+), 16 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c +3 -2
index 5c4d4ff001ea..46514a1faf1f 100644
@@ -1320,8 +1320,8 @@ static ssize_t amdgpu_debugfs_gpr_read(struct file
 *f, char __user *buf,
  * @size: Number of bytes to read
  * @pos:  Offset to seek to
  *
- * Read the last residency value logged. It doesn't auto update, one needs to
- * stop logging before getting the current value.
+ * Read a live GFXOFF residency sample from firmware. One needs to
+ start logging
+ * before getting the current value.
  */
 static ssize_t amdgpu_debugfs_gfxoff_residency_read(struct file *f, char

__user *buf,
size_t size, loff_t *pos)

drivers/gpu/drm/amd/pm/swsmu/inc/amdgpu_smu.h +0 -1
index f8fd93999617..d94e3dcf7f9a 100644
@@ -1333,7 +1333,7 @@ struct pptable_funcs {
      u32 (*set_gfx_off_residency)(struct smu_context *smu, bool start);
 
      /**
-      * @get_gfx_off_residency: Average GFXOFF residency % during the

logging interval
+ * @get_gfx_off_residency: Live GFXOFF residency percentage
*/
u32 (*get_gfx_off_residency)(struct smu_context *smu, uint32_t
*residency);

diff --git a/drivers/gpu/drm/amd/pm/swsmu/inc/pmfw_if/smu_v11_5_ppsmc.h b/drivers/gpu/drm/amd/pm/swsmu/inc/pmfw_if/smu_v11_5_ppsmc.h index 7471e2df2828..4206514765cd 100644

drivers/gpu/drm/amd/pm/swsmu/inc/pmfw_if/smu_v11_5_ppsmc.h +4 -2
@@ -110,8 +110,10 @@
 #define PPSMC_MSG_GetSlowPPTLimit                      0x4C
 #define PPSMC_MSG_GetGfxOffStatus                   0x50
 #define PPSMC_MSG_GetGfxOffEntryCount                       0x51
-#define PPSMC_MSG_LogGfxOffResidency                0x52
-#define PPSMC_Message_Count                            0x53
+#define PPSMC_MSG_GfxOffResidencyLogReadSample              0x52
+#define PPSMC_MSG_StopGfxOffResidencyLogging          0x53
+#define PPSMC_MSG_StartGfxOffResidencyLogging                 0x56
+#define PPSMC_Message_Count                            0x57
 
 //Argument for PPSMC_MSG_GfxDeviceDriverReset  enum { diff --git

a/drivers/gpu/drm/amd/pm/swsmu/inc/smu_types.h
b/drivers/gpu/drm/amd/pm/swsmu/inc/smu_types.h
index 636ff90923d9..acf03838d49d 100644

drivers/gpu/drm/amd/pm/swsmu/inc/smu_types.h +3 -1
@@ -252,7 +252,9 @@
      __SMU_DUMMY_MAP(DriverMode2Reset), \
      __SMU_DUMMY_MAP(GetGfxOffStatus),                \
      __SMU_DUMMY_MAP(GetGfxOffEntryCount),            \
-     __SMU_DUMMY_MAP(LogGfxOffResidency),                    \
+     __SMU_DUMMY_MAP(StartGfxOffResidencyLogging),           \
+     __SMU_DUMMY_MAP(GfxOffResidencyLogReadSample),
      \
+     __SMU_DUMMY_MAP(StopGfxOffResidencyLogging),            \
      __SMU_DUMMY_MAP(SetNumBadMemoryPagesRetired),
      \

__SMU_DUMMY_MAP(SetBadMemoryPagesRetiredFlagsPerChannel)

, \
      __SMU_DUMMY_MAP(AllowGpo),      \
drivers/gpu/drm/amd/pm/swsmu/smu11/vangogh_ppt.c +6 -0
index 717ba46c8933..1104f8b05b29 100644
@@ -72,6 +72,12 @@ static const struct smu_feature_bits
 vangogh_dpm_features = {
      }
 };
 
+/*
+ * SMU support new GFXOFF residency log interface since version
+4.63.62.00,
+ * use this to get live readings of GFXOFF residency  */ #define
+SUPPORT_LIVE_RESIDENCY_MSG_VERSION 0x043f3e00
+
 static struct cmn2asic_msg_mapping
 vangogh_message_map[SMU_MSG_MAX_COUNT] = {
      MSG_MAP(TestMessage,                    PPSMC_MSG_TestMessage,
              0),
      MSG_MAP(GetSmuVersion,                  PPSMC_MSG_GetSmuVersion,
              0),
drivers/gpu/drm/amd/pm/swsmu/smu11/vangogh_ppt.c +0 -0
@@ -142,7 +148,9 @@ static struct cmn2asic_msg_mapping
 vangogh_message_map[SMU_MSG_MAX_COUNT] = {
      MSG_MAP(GetSlowPPTLimit,
 PPSMC_MSG_GetSlowPPTLimit,
      0),
      MSG_MAP(GetGfxOffStatus,
 PPSMC_MSG_GetGfxOffStatus,                                            0),
      MSG_MAP(GetGfxOffEntryCount,

PPSMC_MSG_GetGfxOffEntryCount, 0),
- MSG_MAP(LogGfxOffResidency,
PPSMC_MSG_LogGfxOffResidency, 0),
+ MSG_MAP(StartGfxOffResidencyLogging,
PPSMC_MSG_StartGfxOffResidencyLogging, 0),
+ MSG_MAP(GfxOffResidencyLogReadSample,
PPSMC_MSG_GfxOffResidencyLogReadSample, 0),
+ MSG_MAP(StopGfxOffResidencyLogging,
PPSMC_MSG_StopGfxOffResidencyLogging, 0),
};

static struct cmn2asic_mapping
vangogh_feature_mask_map[SMU_FEATURE_COUNT] = { @@ -2450,19 +2458,32 @@ static int vangogh_set_power_limit(struct smu_context *smu, static u32 vangogh_set_gfxoff_residency(struct smu_context *smu, bool

start)  {
      int ret = 0;
drivers/gpu/drm/amd/pm/swsmu/smu11/vangogh_ppt.c +0 -2
-     u32 residency;
      struct amdgpu_device *adev = smu->adev;
 
      if (!(adev->pm.pp_feature & PP_GFXOFF_MASK))
              return 0;
 
-     ret = smu_cmn_send_smc_msg_with_param(smu,

SMU_MSG_LogGfxOffResidency,

drivers/gpu/drm/amd/pm/swsmu/smu11/vangogh_ppt.c +1 -3
-                                           start, &residency);
-     if (ret)
-             return ret;
+     if (smu->smc_fw_version <

SUPPORT_LIVE_RESIDENCY_MSG_VERSION) {

drivers/gpu/drm/amd/pm/swsmu/smu11/vangogh_ppt.c +3 -0
+             u32 residency;
+
+             ret = smu_cmn_send_smc_msg_with_param(smu,

SMU_MSG_GfxOffResidencyLogReadSample,

drivers/gpu/drm/amd/pm/swsmu/smu11/vangogh_ppt.c +8 -2
+                                                     start, &residency);
+             if (ret)
+                     return ret;
 
-     if (!start)
-             adev->gfx.gfx_off_residency = residency;
+             if (!start)
+                     adev->gfx.gfx_off_residency = residency;
+     } else {
+             if (start) {
+                     ret = smu_cmn_send_smc_msg(smu,

SMU_MSG_StartGfxOffResidencyLogging, NULL);

drivers/gpu/drm/amd/pm/swsmu/smu11/vangogh_ppt.c +4 -0
+                     if (ret)
+                             return ret;
+             } else {
+                     ret = smu_cmn_send_smc_msg(smu,

SMU_MSG_StopGfxOffResidencyLogging, NULL);

drivers/gpu/drm/amd/pm/swsmu/smu11/vangogh_ppt.c +15 -2
+                     if (ret)
+                             return ret;
+             }
+     }
 
      return ret;
 }
@@ -2479,11 +2500,20 @@ static u32 vangogh_set_gfxoff_residency(struct
 smu_context *smu, bool start)
  */
 static u32 vangogh_get_gfxoff_residency(struct smu_context *smu, uint32_t
 *residency)  {
+     int ret = 0;
      struct amdgpu_device *adev = smu->adev;
 
-     *residency = adev->gfx.gfx_off_residency;
+     if (!(adev->pm.pp_feature & PP_GFXOFF_MASK))
+             return 0;
+
+     if (smu->smc_fw_version <
 SUPPORT_LIVE_RESIDENCY_MSG_VERSION) {
+             *residency = adev->gfx.gfx_off_residency;
+     } else {
+             ret = smu_cmn_send_smc_msg(smu,
 SMU_MSG_GfxOffResidencyLogReadSample,
+                                                             residency);
+     }
 
-     return 0;
+     return ret;

}

/**
--
2.43.0

Tested-by on v2 1/1
#5 lore raw
In reply to Fares Soliman

Em 13/07/2026 10:26, Fares Soliman escreveu:

Quoted 5 lines

Updates PPSMC_MSGs and set/get functions for gathering GFXOFF logs on Van Gogh. Logs are now gathered live rather than starting then stopping logging and reading an average value afterwards. This is in accordance to changes made in PMFW.

Quoted 8 lines

In regards to messageID 0x52, the old interface uses a start/stop parameter, and the new one doesn't. The firmware is checked to determine which method to use.

v2: added firmware guard to new interface, old interface kept as fallback

Thanks!
André