Skip to contentSkip to conversation

drm/amd/ras: tolerate an unsupported MCA debug mode control

PATCH In review Xiang Liu 2 participants 4 messages Aug 22 – Aug 24

Subsystems (2)
lore
Share & tools
lore

Xiang Liu

author
#0 lore raw

PATCH 1/2 drm/amd/ras: tolerate an unsupported MCA debug mode control

ras_mp1_set_debug_mode() reports -EOPNOTSUPP where the control does not exist, an SR-IOV guest among them. Treating that as fatal fails ras_core_sw_init() and takes RAS down on every VF.

Nothing else in the MP1 block depends on it, so carry on.

---
 drivers/gpu/drm/amd/ras/core/ras_mp1.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/ras/core/ras_mp1.c +2 -2
index 2452448806f6..781faf6a7529 100644
@@ -203,12 +203,12 @@ int ras_mp1_sw_init(struct ras_core_context *ras_core)
 	mutex_init(&mp1->op_mutex);
 
 	ret = ras_mp1_set_debug_mode(ras_core, false);
-	if (ret) {
+	if (ret && ret != -EOPNOTSUPP) {
 		mutex_destroy(&mp1->op_mutex);
 		return ret;
 	}
 
-	return ret;
+	return 0;
 }
 
 int ras_mp1_sw_fini(struct ras_core_context *ras_core)
Signature · 1 line
2.34.1
author
#1 lore raw

PATCH 2/2 drm/amd/ras: drop the RAS module state when its sw init fails

The failure paths free the RAS manager but keep the flags that advertise it as the owner of RAS and of the RAS firmware load. Every entry point gated on those hits the NULL manager, hw_init turns that into -EINVAL and the whole probe fails.

Clear both once the manager is gone, and route the allocation failure through the same place.

---
 drivers/gpu/drm/amd/ras/ras_mgr/amdgpu_ras_mgr.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/ras/ras_mgr/amdgpu_ras_mgr.c +6 -2
index b41117deb5f3..a02167397ce2 100644
@@ -337,8 +337,10 @@ int amdgpu_ras_mgr_sw_init(struct amdgpu_device *adev, struct ras_module_param *
 	con->uniras_load_ras_fw = true;
 
 	ras_mgr = kzalloc_obj(*ras_mgr);
-	if (!ras_mgr)
-		return -EINVAL;
+	if (!ras_mgr) {
+		ret = -EINVAL;
+		goto err1;
+	}
 
 	con->ras_mgr = ras_mgr;
 	ras_mgr->adev = adev;
@@ -385,6 +387,8 @@ int amdgpu_ras_mgr_sw_init(struct amdgpu_device *adev, struct ras_module_param *
 err1:
 	kfree(ras_mgr);
 	con->ras_mgr = NULL;
+	con->uniras_enabled = false;
+	con->uniras_load_ras_fw = false;
 	return ret;
 }
 
Signature · 1 line
2.34.1
Reviewed-by on v1 1/2
#2 lore raw
In reply to Xiang Liu

AMD General

Quoted 10 lines

-----Original Message-----
From: Liu, Xiang(Dean) <[email protected]>
Sent: Saturday, August 22, 2026 6:26 PM
To: [email protected]
Cc: Zhang, Hawking <[email protected]>; Zhou1, Tao <[email protected]>; Yang, Stanley <[email protected]>; Chai, Thomas <[email protected]>; Liu, Xiang(Dean) <[email protected]>
Subject: [PATCH 1/2] drm/amd/ras: tolerate an unsupported MCA debug mode control

Quoted 5 lines

ras_mp1_set_debug_mode() reports -EOPNOTSUPP where the control does not exist, an SR-IOV guest among them. Treating that as fatal fails ras_core_sw_init() and takes RAS down on every VF.

Nothing else in the MP1 block depends on it, so carry on.

[Tao] you can also add this explanation as code comment, anyway, the series is:

Quoted 28 lines
---
 drivers/gpu/drm/amd/ras/core/ras_mp1.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/ras/core/ras_mp1.c +2 -3
index 2452448806f6..781faf6a7529 100644
@@ -203,12 +203,12 @@ int ras_mp1_sw_init(struct ras_core_context *ras_core)
      mutex_init(&mp1->op_mutex);
 
      ret = ras_mp1_set_debug_mode(ras_core, false);
-     if (ret) {
+     if (ret && ret != -EOPNOTSUPP) {
              mutex_destroy(&mp1->op_mutex);
              return ret;
      }
 
-     return ret;
+     return 0;
 }
 
 int ras_mp1_sw_fini(struct ras_core_context *ras_core)
--

2.34.1

author Reviewed-by Tao Zhou
#3 lore raw

AMD General

Sure, will improve it.

Best Regards,

Liu, Xiang

________________________________
From: Zhou1, Tao <[email protected]>
Sent: Monday, August 24, 2026 10:41 AM
To: Liu, Xiang(Dean) <[email protected]>; [email protected] <[email protected]>
Cc: Zhang, Hawking <[email protected]>; Yang, Stanley <[email protected]>; Chai, Thomas <[email protected]>
Subject: RE: [PATCH 1/2] drm/amd/ras: tolerate an unsupported MCA debug mode control

AMD General

Quoted 10 lines

-----Original Message-----
From: Liu, Xiang(Dean) <[email protected]>
Sent: Saturday, August 22, 2026 6:26 PM
To: [email protected]
Cc: Zhang, Hawking <[email protected]>; Zhou1, Tao <[email protected]>; Yang, Stanley <[email protected]>; Chai, Thomas <[email protected]>; Liu, Xiang(Dean) <[email protected]>
Subject: [PATCH 1/2] drm/amd/ras: tolerate an unsupported MCA debug mode control

Quoted 5 lines

ras_mp1_set_debug_mode() reports -EOPNOTSUPP where the control does not exist, an SR-IOV guest among them. Treating that as fatal fails ras_core_sw_init() and takes RAS down on every VF.

Nothing else in the MP1 block depends on it, so carry on.

[Tao] you can also add this explanation as code comment, anyway, the series is:

Quoted 28 lines
---
 drivers/gpu/drm/amd/ras/core/ras_mp1.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/ras/core/ras_mp1.c +2 -3
index 2452448806f6..781faf6a7529 100644
@@ -203,12 +203,12 @@ int ras_mp1_sw_init(struct ras_core_context *ras_core)
      mutex_init(&mp1->op_mutex);
 
      ret = ras_mp1_set_debug_mode(ras_core, false);
-     if (ret) {
+     if (ret && ret != -EOPNOTSUPP) {
              mutex_destroy(&mp1->op_mutex);
              return ret;
      }
 
-     return ret;
+     return 0;
 }
 
 int ras_mp1_sw_fini(struct ras_core_context *ras_core)
--

2.34.1