Skip to contentSkip to conversation

drm/amd/ras: add error log for unhandled gpu mce data

PATCH In review YiPeng Chai 3 participants 5 messages Sep 15 – Sep 16

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

PATCH 1/3 drm/amd/ras: add error log for unhandled gpu mce data

Add error log for unhandled gpu mce data.

---
 drivers/gpu/drm/amd/ras/ras_mgr/amdgpu_ras_mce.c | 15 ++++++++++++---
 1 file changed, 12 insertions(+), 3 deletions(-)
drivers/gpu/drm/amd/ras/ras_mgr/amdgpu_ras_mce.c +12 -3
index 0edb3dc06a69..6bb8bc1b52a9 100644
@@ -163,8 +163,13 @@ static int amdgpu_ras_mce_notifier_v1(struct amdgpu_device *adev, unsigned int i
 
 	__fill_mce_to_aca_bank(adev, MCE_BANK_TYPE_GPU, m, &aca_bank);
 
-	if (ras_aca_parse_bank(ras_mgr->ras_core, &aca_bank, &err))
+	if (ras_aca_parse_bank(ras_mgr->ras_core, &aca_bank, &err)) {
+		RAS_DEV_ERR(adev,
+			"Unrecognized gpu mce: bank:%u IPID:0x%llx"
+			" STATUS:0x%llx ADDR:0x%llx SYND:0x%llx\n",
+			m->bank, m->ipid, m->status, m->addr, m->synd);
 		return -EINVAL;
+	}
 
 	/* GPU device only record bank data that matches its own socket id.*/
 	if (adev->smuio.funcs->get_socket_id(adev) != err.bank_info.socket_id)
@@ -201,9 +206,13 @@ static int amdgpu_ras_mce_notifier_v5(struct amdgpu_device *adev, unsigned int i
 	__fill_mce_to_aca_bank(adev, bank_type, m, &aca_bank);
 
 	if (bank_type == MCE_BANK_TYPE_GPU) {
-
-		if (ras_aca_parse_bank(ras_mgr->ras_core, &aca_bank, &err))
+		if (ras_aca_parse_bank(ras_mgr->ras_core, &aca_bank, &err)) {
+			RAS_DEV_ERR(adev,
+				"Unrecognized gpu mce: bank:%u IPID:0x%llx"
+				" STATUS:0x%llx ADDR:0x%llx SYND:0x%llx\n",
+				m->bank, m->ipid, m->status, m->addr, m->synd);
 			return -EINVAL;
+		}
 
 		/* GPU device only record bank data that matches its own socket id.*/
 		if (adev->smuio.funcs->get_socket_id(adev) != err.bank_info.socket_id)
Signature · 1 line
2.43.0
#1 lore raw

PATCH 2/3 drm/amd/ras: suppress warning for unsupported early init service

Suppress warning for unsupported early init service.

---
 drivers/gpu/drm/amd/ras/ras_mgr/amdgpu_ras_mgr.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/ras/ras_mgr/amdgpu_ras_mgr.c +1 -1
index 07dd62ae460b..23be4212d0a7 100644
@@ -863,7 +863,7 @@ int amdgpu_ras_mgr_early_init_service(struct amdgpu_device *adev)
 	}
 
 	ret = ras_core_eeprom_early_init_service(ras_mgr->ras_core);
-	if (ret)
+	if (ret && (ret != -EOPNOTSUPP))
 		RAS_DEV_WARN(adev, "RAS early init service failure! ret:%d\n", ret);
 
 	return ret;
Signature · 1 line
2.43.0
#2 lore raw

PATCH 3/3 drm/amd/ras: use __le32 pointer type to resolve the sparse warnings

In reply to YiPeng Chai

Use __le32 pointer type to resolve the sparse warnings.

sparse warnings:
ras/core/eeprom.c:275:15: sparse: expected unsigned int [usertype] ras/core/eeprom.c:275:15: sparse: got restricted __le32 [usertype]

ras/core/eeprom.c:277:15: sparse: expected unsigned int [usertype] ras/core/eeprom.c:277:15: sparse: got restricted __le32 [usertype]

ras/core/eeprom.c:288:33: sparse: sparse: cast to restricted __le32 ras/core/eeprom.c:289:33: sparse: sparse: cast to restricted __le32 ras/core/eeprom.c:290:33: sparse: sparse: cast to restricted __le32 ras/core/eeprom.c:291:33: sparse: sparse: cast to restricted __le32

ras/core/eeprom.c:333:15: sparse: expected unsigned int [usertype] ras/core/eeprom.c:333:15: sparse: got restricted __le32 [usertype] ras/core/eeprom.c:343:15: sparse: sparse: cast to restricted __le32

Fixes d95700604fbc ("drm/amd/ras: rename core ras_* files and update include guards")
---
 drivers/gpu/drm/amd/ras/core/eeprom.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/gpu/drm/amd/ras/core/eeprom.c +3 -3
index e7aad113b98a..efa04cd8fbe0 100644
@@ -260,7 +260,7 @@ static void
 __encode_table_header_to_buf(struct ras_eeprom_table_header *hdr,
 			     unsigned char *buf)
 {
-	u32 *pp = (uint32_t *)buf;
+	__le32 *pp = (__le32 *)buf;
 
 	pp[0] = cpu_to_le32(hdr->header);
 	pp[1] = cpu_to_le32(hdr->version);
@@ -273,7 +273,7 @@ static void
 __decode_table_header_from_buf(struct ras_eeprom_table_header *hdr,
 			       unsigned char *buf)
 {
-	u32 *pp = (uint32_t *)buf;
+	__le32 *pp = (__le32 *)buf;
 
 	hdr->header	      = le32_to_cpu(pp[0]);
 	hdr->version	      = le32_to_cpu(pp[1]);
@@ -315,7 +315,7 @@ static void
 __encode_table_ras_info_to_buf(struct ras_eeprom_table_ras_info *rai,
 			       unsigned char *buf)
 {
-	u32 *pp = (uint32_t *)buf;
+	__le32 *pp = (__le32 *)buf;
 	u32 tmp;
 
 	tmp = ((uint32_t)(rai->rma_status) & 0xFF) |
Signature · 1 line
2.43.0
Acked-by on v1 3/3
#3 lore raw

Re: [PATCH 3/3] drm/amd/ras: use __le32 pointer type to resolve the sparse warnings

Quoted 19 lines · YiPeng Chai

Use __le32 pointer type to resolve the sparse warnings.

sparse warnings:
ras/core/eeprom.c:275:15: sparse: expected unsigned int [usertype] ras/core/eeprom.c:275:15: sparse: got restricted __le32 [usertype]

ras/core/eeprom.c:277:15: sparse: expected unsigned int [usertype] ras/core/eeprom.c:277:15: sparse: got restricted __le32 [usertype]

ras/core/eeprom.c:288:33: sparse: sparse: cast to restricted __le32 ras/core/eeprom.c:289:33: sparse: sparse: cast to restricted __le32 ras/core/eeprom.c:290:33: sparse: sparse: cast to restricted __le32 ras/core/eeprom.c:291:33: sparse: sparse: cast to restricted __le32

ras/core/eeprom.c:333:15: sparse: expected unsigned int [usertype] ras/core/eeprom.c:333:15: sparse: got restricted __le32 [usertype] ras/core/eeprom.c:343:15: sparse: sparse: cast to restricted __le32

Quoted 5 lines
Fixes d95700604fbc ("drm/amd/ras: rename core ras_* files and update include guards")
Quoted 38 lines
---
 drivers/gpu/drm/amd/ras/core/eeprom.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/gpu/drm/amd/ras/core/eeprom.c +3 -4
index e7aad113b98a..efa04cd8fbe0 100644
@@ -260,7 +260,7 @@ static void
 __encode_table_header_to_buf(struct ras_eeprom_table_header *hdr,
                             unsigned char *buf)
 {
-       u32 *pp = (uint32_t *)buf;
+       __le32 *pp = (__le32 *)buf;
 
        pp[0] = cpu_to_le32(hdr->header);
        pp[1] = cpu_to_le32(hdr->version);
@@ -273,7 +273,7 @@ static void
 __decode_table_header_from_buf(struct ras_eeprom_table_header *hdr,
                               unsigned char *buf)
 {
-       u32 *pp = (uint32_t *)buf;
+       __le32 *pp = (__le32 *)buf;
 
        hdr->header           = le32_to_cpu(pp[0]);
        hdr->version          = le32_to_cpu(pp[1]);
@@ -315,7 +315,7 @@ static void
 __encode_table_ras_info_to_buf(struct ras_eeprom_table_ras_info *rai,
                               unsigned char *buf)
 {
-       u32 *pp = (uint32_t *)buf;
+       __le32 *pp = (__le32 *)buf;
        u32 tmp;
 
        tmp = ((uint32_t)(rai->rma_status) & 0xFF) |
--

2.43.0

#4 lore raw

RE: [PATCH 3/3] drm/amd/ras: use __le32 pointer type to resolve the sparse warnings

In reply to YiPeng Chai

AMD General

The series is: Reviewed-by: Tao Zhou <[email protected]>

Quoted 72 lines

-----Original Message-----
From: amd-gfx <[email protected]> On Behalf Of YiPeng Chai
Sent: Tuesday, September 15, 2026 3:25 PM
To: [email protected]
Cc: Zhang, Hawking <[email protected]>; Zhou1, Tao <[email protected]>; Yang, Stanley <[email protected]>; Chai, Thomas <[email protected]>; kernel test robot <[email protected]>
Subject: [PATCH 3/3] drm/amd/ras: use __le32 pointer type to resolve the sparse warnings

Use __le32 pointer type to resolve the sparse warnings.

sparse warnings:
ras/core/eeprom.c:275:15: sparse: expected unsigned int [usertype] ras/core/eeprom.c:275:15: sparse: got restricted __le32 [usertype]

ras/core/eeprom.c:277:15: sparse: expected unsigned int [usertype] ras/core/eeprom.c:277:15: sparse: got restricted __le32 [usertype]

ras/core/eeprom.c:288:33: sparse: sparse: cast to restricted __le32 ras/core/eeprom.c:289:33: sparse: sparse: cast to restricted __le32 ras/core/eeprom.c:290:33: sparse: sparse: cast to restricted __le32 ras/core/eeprom.c:291:33: sparse: sparse: cast to restricted __le32

ras/core/eeprom.c:333:15: sparse: expected unsigned int [usertype] ras/core/eeprom.c:333:15: sparse: got restricted __le32 [usertype] ras/core/eeprom.c:343:15: sparse: sparse: cast to restricted __le32

Fixes d95700604fbc ("drm/amd/ras: rename core ras_* files and update include

guards")

---
 drivers/gpu/drm/amd/ras/core/eeprom.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/gpu/drm/amd/ras/core/eeprom.c +3 -4
index e7aad113b98a..efa04cd8fbe0 100644
@@ -260,7 +260,7 @@ static void
 __encode_table_header_to_buf(struct ras_eeprom_table_header *hdr,
                           unsigned char *buf)
 {
-     u32 *pp = (uint32_t *)buf;
+     __le32 *pp = (__le32 *)buf;
 
      pp[0] = cpu_to_le32(hdr->header);
      pp[1] = cpu_to_le32(hdr->version);
@@ -273,7 +273,7 @@ static void
 __decode_table_header_from_buf(struct ras_eeprom_table_header *hdr,
                             unsigned char *buf)
 {
-     u32 *pp = (uint32_t *)buf;
+     __le32 *pp = (__le32 *)buf;
 
      hdr->header           = le32_to_cpu(pp[0]);
      hdr->version          = le32_to_cpu(pp[1]);
@@ -315,7 +315,7 @@ static void
 __encode_table_ras_info_to_buf(struct ras_eeprom_table_ras_info *rai,
                             unsigned char *buf)
 {
-     u32 *pp = (uint32_t *)buf;
+     __le32 *pp = (__le32 *)buf;
      u32 tmp;
 
      tmp = ((uint32_t)(rai->rma_status) & 0xFF) |
--

2.43.0