Skip to contentSkip to conversation

drm/amdgpu: Add ras module ip block to amdgpu discovery

PATCH In review YiPeng Chai 2 participants 3 messages Oct 14, 2025 – Oct 15, 2025

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

PATCH 1/2 drm/amdgpu: Add ras module ip block to amdgpu discovery

Add ras module ip block to amdgpu discovery.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu.h           |  2 +-
 drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c | 20 +++++++++++++++++++
 drivers/gpu/drm/amd/include/amd_shared.h      |  1 +
 .../gpu/drm/amd/ras/ras_mgr/amdgpu_ras_mgr.c  |  8 ++++++++
 .../gpu/drm/amd/ras/ras_mgr/amdgpu_ras_mgr.h  |  2 ++
 5 files changed, 32 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu.h +1 -1
index d9bd1d71552e..04c1f004931b 100644
@@ -378,7 +378,7 @@ int amdgpu_ip_block_suspend(struct amdgpu_ip_block *ip_block);
 
 int amdgpu_ip_block_resume(struct amdgpu_ip_block *ip_block);
 
-#define AMDGPU_MAX_IP_NUM 16
+#define AMDGPU_MAX_IP_NUM AMD_IP_BLOCK_TYPE_NUM
 
 struct amdgpu_ip_block_status {
 	bool valid;
drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c +20 -0
index 4e75334f3b3a..b4d52da687a3 100644
@@ -112,6 +112,7 @@
 #if defined(CONFIG_DRM_AMD_ISP)
 #include "amdgpu_isp.h"
 #endif
+#include "amdgpu_ras_mgr.h"
 
 MODULE_FIRMWARE("amdgpu/ip_discovery.bin");
 MODULE_FIRMWARE("amdgpu/vega10_ip_discovery.bin");
@@ -2393,6 +2394,21 @@ static int amdgpu_discovery_set_sdma_ip_blocks(struct amdgpu_device *adev)
 			amdgpu_ip_version(adev, SDMA0_HWIP, 0));
 		return -EINVAL;
 	}
+
+	return 0;
+}
+
+static int amdgpu_discovery_set_ras_ip_blocks(struct amdgpu_device *adev)
+{
+	switch (amdgpu_ip_version(adev, MP0_HWIP, 0)) {
+	case IP_VERSION(13, 0, 6):
+	case IP_VERSION(13, 0, 12):
+	case IP_VERSION(13, 0, 14):
+		amdgpu_device_ip_block_add(adev, &ras_v1_0_ip_block);
+		break;
+	default:
+		break;
+	}
 	return 0;
 }
 
@@ -3173,6 +3189,10 @@ int amdgpu_discovery_set_ip_blocks(struct amdgpu_device *adev)
 	if (r)
 		return r;
 
+	r = amdgpu_discovery_set_ras_ip_blocks(adev);
+	if (r)
+		return r;
+
 	if ((adev->firmware.load_type == AMDGPU_FW_LOAD_DIRECT &&
 	     !amdgpu_sriov_vf(adev)) ||
 	    (adev->firmware.load_type == AMDGPU_FW_LOAD_RLC_BACKDOOR_AUTO && amdgpu_dpm == 1)) {
drivers/gpu/drm/amd/include/amd_shared.h +1 -0
index 75efda2969cf..17945094a138 100644
@@ -109,6 +109,7 @@ enum amd_ip_block_type {
 	AMD_IP_BLOCK_TYPE_VPE,
 	AMD_IP_BLOCK_TYPE_UMSCH_MM,
 	AMD_IP_BLOCK_TYPE_ISP,
+	AMD_IP_BLOCK_TYPE_RAS,
 	AMD_IP_BLOCK_TYPE_NUM,
 };
 
drivers/gpu/drm/amd/ras/ras_mgr/amdgpu_ras_mgr.c +8 -0
index a8d02bd42f90..3ae843d078d8 100644
@@ -381,6 +381,14 @@ static const struct amd_ip_funcs __maybe_unused ras_v1_0_ip_funcs = {
 	.hw_fini = amdgpu_ras_mgr_hw_fini,
 };
 
+const struct amdgpu_ip_block_version ras_v1_0_ip_block = {
+	.type = AMD_IP_BLOCK_TYPE_RAS,
+	.major = 1,
+	.minor = 0,
+	.rev = 0,
+	.funcs = &ras_v1_0_ip_funcs,
+};
+
 int amdgpu_enable_uniras(struct amdgpu_device *adev, bool enable)
 {
 	struct amdgpu_ras_mgr *ras_mgr = amdgpu_ras_mgr_get_context(adev);
drivers/gpu/drm/amd/ras/ras_mgr/amdgpu_ras_mgr.h +2 -0
index 8d6a1873b666..814b65ef1c62 100644
@@ -54,6 +54,8 @@ struct amdgpu_ras_mgr {
 	bool ras_is_ready;
 };
 
+extern const struct amdgpu_ip_block_version ras_v1_0_ip_block;
+
 struct amdgpu_ras_mgr *amdgpu_ras_mgr_get_context(
 			struct amdgpu_device *adev);
 int amdgpu_enable_uniras(struct amdgpu_device *adev, bool enable);
Signature · 1 line
2.34.1
#1 lore raw

PATCH 2/2 drm/amdgpu: Enable ras module

Enable ras module, disabled by default.

---
 drivers/gpu/drm/amd/ras/ras_mgr/amdgpu_ras_mgr.c | 5 +++++
 1 file changed, 5 insertions(+)
drivers/gpu/drm/amd/ras/ras_mgr/amdgpu_ras_mgr.c +5 -0
index 3ae843d078d8..a59617126ac7 100644
@@ -346,6 +346,11 @@ static int amdgpu_ras_mgr_hw_init(struct amdgpu_ip_block *ip_block)
 
 	ras_mgr->ras_is_ready = true;
 
+	/* Currently only debug mode can enable the ras module
+	 */
+	if (adev->debug_enable_ras_aca)
+		amdgpu_enable_uniras(adev, true);
+
 	RAS_DEV_INFO(adev, "AMDGPU RAS Is Ready.\n");
 	return 0;
 }
Signature · 1 line
2.34.1
Reviewed-by Reviewed-by Tao Zhou on v1 1/2
#2 lore raw
In reply to YiPeng Chai

[AMD Official Use Only - AMD Internal Distribution Only]

Series is

Regards,
Hawking
-----Original Message-----
From: Chai, Thomas <[email protected]>
Sent: Tuesday, October 14, 2025 15:06
To: [email protected]
Cc: Zhang, Hawking <[email protected]>; Zhou1, Tao <[email protected]>; Li, Candice <[email protected]>; Wang, Yang(Kevin) <[email protected]>; Yang, Stanley <[email protected]>; Su, Joe <[email protected]>; Chai, Thomas <[email protected]>; Zhou1, Tao <[email protected]>
Subject: [PATCH 1/2] drm/amdgpu: Add ras module ip block to amdgpu discovery

Add ras module ip block to amdgpu discovery.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu.h           |  2 +-
 drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c | 20 +++++++++++++++++++
 drivers/gpu/drm/amd/include/amd_shared.h      |  1 +
 .../gpu/drm/amd/ras/ras_mgr/amdgpu_ras_mgr.c  |  8 ++++++++  .../gpu/drm/amd/ras/ras_mgr/amdgpu_ras_mgr.h  |  2 ++
 5 files changed, 32 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu.h +1 -1
index d9bd1d71552e..04c1f004931b 100644
@@ -378,7 +378,7 @@ int amdgpu_ip_block_suspend(struct amdgpu_ip_block *ip_block);
 
 int amdgpu_ip_block_resume(struct amdgpu_ip_block *ip_block);
 
-#define AMDGPU_MAX_IP_NUM 16
+#define AMDGPU_MAX_IP_NUM AMD_IP_BLOCK_TYPE_NUM
 
 struct amdgpu_ip_block_status {
        bool valid;
drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c +20 -0
index 4e75334f3b3a..b4d52da687a3 100644
@@ -112,6 +112,7 @@
 #if defined(CONFIG_DRM_AMD_ISP)
 #include "amdgpu_isp.h"
 #endif
+#include "amdgpu_ras_mgr.h"
 
 MODULE_FIRMWARE("amdgpu/ip_discovery.bin");
 MODULE_FIRMWARE("amdgpu/vega10_ip_discovery.bin");
@@ -2393,6 +2394,21 @@ static int amdgpu_discovery_set_sdma_ip_blocks(struct amdgpu_device *adev)
                        amdgpu_ip_version(adev, SDMA0_HWIP, 0));
                return -EINVAL;
        }
+
+       return 0;
+}
+
+static int amdgpu_discovery_set_ras_ip_blocks(struct amdgpu_device
+*adev) {
+       switch (amdgpu_ip_version(adev, MP0_HWIP, 0)) {
+       case IP_VERSION(13, 0, 6):
+       case IP_VERSION(13, 0, 12):
+       case IP_VERSION(13, 0, 14):
+               amdgpu_device_ip_block_add(adev, &ras_v1_0_ip_block);
+               break;
+       default:
+               break;
+       }
        return 0;
 }
 
@@ -3173,6 +3189,10 @@ int amdgpu_discovery_set_ip_blocks(struct amdgpu_device *adev)
        if (r)
                return r;
 
+       r = amdgpu_discovery_set_ras_ip_blocks(adev);
+       if (r)
+               return r;
+
        if ((adev->firmware.load_type == AMDGPU_FW_LOAD_DIRECT &&
             !amdgpu_sriov_vf(adev)) ||
            (adev->firmware.load_type == AMDGPU_FW_LOAD_RLC_BACKDOOR_AUTO && amdgpu_dpm == 1)) { diff --git a/drivers/gpu/drm/amd/include/amd_shared.h b/drivers/gpu/drm/amd/include/amd_shared.h

index 75efda2969cf..17945094a138 100644

drivers/gpu/drm/amd/include/amd_shared.h +1 -0
@@ -109,6 +109,7 @@ enum amd_ip_block_type {
        AMD_IP_BLOCK_TYPE_VPE,
        AMD_IP_BLOCK_TYPE_UMSCH_MM,
        AMD_IP_BLOCK_TYPE_ISP,
+       AMD_IP_BLOCK_TYPE_RAS,
        AMD_IP_BLOCK_TYPE_NUM,
 };
 
drivers/gpu/drm/amd/ras/ras_mgr/amdgpu_ras_mgr.c +8 -0
index a8d02bd42f90..3ae843d078d8 100644
@@ -381,6 +381,14 @@ static const struct amd_ip_funcs __maybe_unused ras_v1_0_ip_funcs = {
        .hw_fini = amdgpu_ras_mgr_hw_fini,
 };
 
+const struct amdgpu_ip_block_version ras_v1_0_ip_block = {
+       .type = AMD_IP_BLOCK_TYPE_RAS,
+       .major = 1,
+       .minor = 0,
+       .rev = 0,
+       .funcs = &ras_v1_0_ip_funcs,
+};
+
 int amdgpu_enable_uniras(struct amdgpu_device *adev, bool enable)  {
        struct amdgpu_ras_mgr *ras_mgr = amdgpu_ras_mgr_get_context(adev); diff --git a/drivers/gpu/drm/amd/ras/ras_mgr/amdgpu_ras_mgr.h b/drivers/gpu/drm/amd/ras/ras_mgr/amdgpu_ras_mgr.h

index 8d6a1873b666..814b65ef1c62 100644

drivers/gpu/drm/amd/ras/ras_mgr/amdgpu_ras_mgr.h +2 -0
@@ -54,6 +54,8 @@ struct amdgpu_ras_mgr {
        bool ras_is_ready;
 };
 
+extern const struct amdgpu_ip_block_version ras_v1_0_ip_block;
+
 struct amdgpu_ras_mgr *amdgpu_ras_mgr_get_context(
                        struct amdgpu_device *adev);
 int amdgpu_enable_uniras(struct amdgpu_device *adev, bool enable);

--
2.34.1