Skip to contentSkip to conversation

drm/amd/pm: Add debug bit for smu pool allocation

PATCH In review Lijo Lazar 3 participants 5 messages Mar 7, 2025 – Mar 19, 2025

Subsystems (3)
lore
Share & tools
lore

Lijo Lazar

author
#0 lore raw

PATCH 1/2 drm/amd/pm: Add debug bit for smu pool allocation

In certain cases, it's desirable to avoid PMFW log transactions to system memory. Add a mask bit to decide whether to allocate smu pool in device memory or system memory.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c   | 5 +++++
 drivers/gpu/drm/amd/pm/inc/amdgpu_dpm.h   | 3 ++-
 drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c | 5 ++++-
 3 files changed, 11 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +5 -0
index b161daa90019..22775c204632 100644
@@ -140,6 +140,7 @@ enum AMDGPU_DEBUG_MASK {
 	AMDGPU_DEBUG_ENABLE_RAS_ACA = BIT(4),
 	AMDGPU_DEBUG_ENABLE_EXP_RESETS = BIT(5),
 	AMDGPU_DEBUG_DISABLE_GPU_RING_RESET = BIT(6),
+	AMDGPU_DEBUG_SMU_POOL = BIT(7),
 };
 
 unsigned int amdgpu_vram_limit = UINT_MAX;
@@ -2231,6 +2232,10 @@ static void amdgpu_init_debug_options(struct amdgpu_device *adev)
 		pr_info("debug: ring reset disabled\n");
 		adev->debug_disable_gpu_ring_reset = true;
 	}
+	if (amdgpu_debug_mask & AMDGPU_DEBUG_SMU_POOL) {
+		pr_info("debug: use vram for smu pool\n");
+		adev->pm.smu_debug_mask |= SMU_DEBUG_POOL_USE_VRAM;
+	}
 }
 
 static unsigned long amdgpu_fix_asic_type(struct pci_dev *pdev, unsigned long flags)
drivers/gpu/drm/amd/pm/inc/amdgpu_dpm.h +2 -1
index 9fb26b5c8ae7..f93d287dbf13 100644
@@ -295,7 +295,8 @@ enum ip_power_state {
 };
 
 /* Used to mask smu debug modes */
-#define SMU_DEBUG_HALT_ON_ERROR		0x1
+#define SMU_DEBUG_HALT_ON_ERROR		BIT(0)
+#define SMU_DEBUG_POOL_USE_VRAM		BIT(1)
 
 #define MAX_SMU_I2C_BUSES       2
 
drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c +4 -1
index 54a31d586d55..f6def50ba22d 100644
@@ -1027,7 +1027,10 @@ static int smu_alloc_memory_pool(struct smu_context *smu)
 
 	memory_pool->size = pool_size;
 	memory_pool->align = PAGE_SIZE;
-	memory_pool->domain = AMDGPU_GEM_DOMAIN_GTT;
+	memory_pool->domain =
+		(adev->pm.smu_debug_mask & SMU_DEBUG_POOL_USE_VRAM) ?
+			AMDGPU_GEM_DOMAIN_VRAM :
+			AMDGPU_GEM_DOMAIN_GTT;
 
 	switch (pool_size) {
 	case SMU_MEMORY_POOL_SIZE_256_MB:
Signature · 1 line
2.25.1
author
#1 lore raw

PATCH 2/2 Documentation/amdgpu: Add debug_mask documentation

Add description for debug_mask bit options.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 5 +++++
 1 file changed, 5 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +5 -0
index 22775c204632..04b518417da0 100644
@@ -1055,6 +1055,11 @@ module_param_named(seamless, amdgpu_seamless, int, 0444);
  *   limits the VRAM size reported to ROCm applications to the visible
  *   size, usually 256MB.
  * - 0x4: Disable GPU soft recovery, always do a full reset
+ * - 0x8: Use VRAM for firmware loading
+ * - 0x10: Enable ACA based RAS logging
+ * - 0x20: Enable experimental resets
+ * - 0x40: Disable ring resets
+ * - 0x80: Use VRAM for SMU pool
  */
 MODULE_PARM_DESC(debug_mask, "debug options for amdgpu, disabled by default");
 module_param_named_unsafe(debug_mask, amdgpu_debug_mask, uint, 0444);
Signature · 1 line
2.25.1
Reviewed-by on v1 2/2
#2 lore raw

Re: [PATCH 2/2] Documentation/amdgpu: Add debug_mask documentation

Series is:

Quoted 27 lines · Lijo Lazar

Add description for debug_mask bit options.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 5 +++++
 1 file changed, 5 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +5 -1
index 22775c204632..04b518417da0 100644
@@ -1055,6 +1055,11 @@ module_param_named(seamless, amdgpu_seamless, int, 0444);
  *   limits the VRAM size reported to ROCm applications to the visible
  *   size, usually 256MB.
  * - 0x4: Disable GPU soft recovery, always do a full reset
+ * - 0x8: Use VRAM for firmware loading
+ * - 0x10: Enable ACA based RAS logging
+ * - 0x20: Enable experimental resets
+ * - 0x40: Disable ring resets
+ * - 0x80: Use VRAM for SMU pool
  */
 MODULE_PARM_DESC(debug_mask, "debug options for amdgpu, disabled by default");
 module_param_named_unsafe(debug_mask, amdgpu_debug_mask, uint, 0444);
--

2.25.1

#3 lore raw
In reply to Lijo Lazar

<Ping>

Quoted 64 lines · Lijo Lazar

In certain cases, it's desirable to avoid PMFW log transactions to system memory. Add a mask bit to decide whether to allocate smu pool in device memory or system memory.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c   | 5 +++++
 drivers/gpu/drm/amd/pm/inc/amdgpu_dpm.h   | 3 ++-
 drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c | 5 ++++-
 3 files changed, 11 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +5 -0
index b161daa90019..22775c204632 100644
@@ -140,6 +140,7 @@ enum AMDGPU_DEBUG_MASK {
 	AMDGPU_DEBUG_ENABLE_RAS_ACA = BIT(4),
 	AMDGPU_DEBUG_ENABLE_EXP_RESETS = BIT(5),
 	AMDGPU_DEBUG_DISABLE_GPU_RING_RESET = BIT(6),
+	AMDGPU_DEBUG_SMU_POOL = BIT(7),
 };
 
 unsigned int amdgpu_vram_limit = UINT_MAX;
@@ -2231,6 +2232,10 @@ static void amdgpu_init_debug_options(struct amdgpu_device *adev)
 		pr_info("debug: ring reset disabled\n");
 		adev->debug_disable_gpu_ring_reset = true;
 	}
+	if (amdgpu_debug_mask & AMDGPU_DEBUG_SMU_POOL) {
+		pr_info("debug: use vram for smu pool\n");
+		adev->pm.smu_debug_mask |= SMU_DEBUG_POOL_USE_VRAM;
+	}
 }
 
 static unsigned long amdgpu_fix_asic_type(struct pci_dev *pdev, unsigned long flags)
drivers/gpu/drm/amd/pm/inc/amdgpu_dpm.h +2 -1
index 9fb26b5c8ae7..f93d287dbf13 100644
@@ -295,7 +295,8 @@ enum ip_power_state {
 };
 
 /* Used to mask smu debug modes */
-#define SMU_DEBUG_HALT_ON_ERROR		0x1
+#define SMU_DEBUG_HALT_ON_ERROR		BIT(0)
+#define SMU_DEBUG_POOL_USE_VRAM		BIT(1)
 
 #define MAX_SMU_I2C_BUSES       2
 
drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c +4 -1
index 54a31d586d55..f6def50ba22d 100644
@@ -1027,7 +1027,10 @@ static int smu_alloc_memory_pool(struct smu_context *smu)
 
 	memory_pool->size = pool_size;
 	memory_pool->align = PAGE_SIZE;
-	memory_pool->domain = AMDGPU_GEM_DOMAIN_GTT;
+	memory_pool->domain =
+		(adev->pm.smu_debug_mask & SMU_DEBUG_POOL_USE_VRAM) ?
+			AMDGPU_GEM_DOMAIN_VRAM :
+			AMDGPU_GEM_DOMAIN_GTT;
 
 	switch (pool_size) {
 	case SMU_MEMORY_POOL_SIZE_256_MB:
Reviewed-by
#4 lore raw

[AMD Official Use Only - AMD Internal Distribution Only]

Thanks & Regards
Asad

-----Original Message-----
From: amd-gfx <[email protected]> On Behalf Of Lazar, Lijo
Sent: Tuesday, March 18, 2025 6:52 PM
To: [email protected]
Cc: Zhang, Hawking <[email protected]>; Deucher, Alexander <[email protected]>
Subject: Re: [PATCH 1/2] drm/amd/pm: Add debug bit for smu pool allocation

<Ping>

Quoted 68 lines · Lijo Lazar

In certain cases, it's desirable to avoid PMFW log transactions to system memory. Add a mask bit to decide whether to allocate smu pool in device memory or system memory.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c   | 5 +++++
 drivers/gpu/drm/amd/pm/inc/amdgpu_dpm.h   | 3 ++-
 drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c | 5 ++++-
 3 files changed, 11 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +1 -0
index b161daa90019..22775c204632 100644
@@ -140,6 +140,7 @@ enum AMDGPU_DEBUG_MASK {
      AMDGPU_DEBUG_ENABLE_RAS_ACA = BIT(4),
      AMDGPU_DEBUG_ENABLE_EXP_RESETS = BIT(5),
      AMDGPU_DEBUG_DISABLE_GPU_RING_RESET = BIT(6),
+     AMDGPU_DEBUG_SMU_POOL = BIT(7),
 };
 
 unsigned int amdgpu_vram_limit = UINT_MAX; @@ -2231,6 +2232,10 @@

static void amdgpu_init_debug_options(struct amdgpu_device *adev)

              pr_info("debug: ring reset disabled\n");
              adev->debug_disable_gpu_ring_reset = true;
      }
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +4 -0
+     if (amdgpu_debug_mask & AMDGPU_DEBUG_SMU_POOL) {
+             pr_info("debug: use vram for smu pool\n");
+             adev->pm.smu_debug_mask |= SMU_DEBUG_POOL_USE_VRAM;
+     }
 }
 
 static unsigned long amdgpu_fix_asic_type(struct pci_dev *pdev,

unsigned long flags) diff --git
a/drivers/gpu/drm/amd/pm/inc/amdgpu_dpm.h
b/drivers/gpu/drm/amd/pm/inc/amdgpu_dpm.h
index 9fb26b5c8ae7..f93d287dbf13 100644

drivers/gpu/drm/amd/pm/inc/amdgpu_dpm.h +2 -1
@@ -295,7 +295,8 @@ enum ip_power_state {  };
 
 /* Used to mask smu debug modes */
-#define SMU_DEBUG_HALT_ON_ERROR              0x1
+#define SMU_DEBUG_HALT_ON_ERROR              BIT(0)
+#define SMU_DEBUG_POOL_USE_VRAM              BIT(1)
 
 #define MAX_SMU_I2C_BUSES       2
 
drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c +4 -1
index 54a31d586d55..f6def50ba22d 100644
@@ -1027,7 +1027,10 @@ static int smu_alloc_memory_pool(struct
 smu_context *smu)
 
      memory_pool->size = pool_size;
      memory_pool->align = PAGE_SIZE;
-     memory_pool->domain = AMDGPU_GEM_DOMAIN_GTT;
+     memory_pool->domain =
+             (adev->pm.smu_debug_mask & SMU_DEBUG_POOL_USE_VRAM) ?
+                     AMDGPU_GEM_DOMAIN_VRAM :
+                     AMDGPU_GEM_DOMAIN_GTT;
 
      switch (pool_size) {
      case SMU_MEMORY_POOL_SIZE_256_MB: