[PATCH] drm/amdgpu: move some aca/mca init functions into ras_init() stage

Yang Wang kevinyang.wang at amd.com
Wed Jun 5 09:31:30 UTC 2024


adjust the function position to better match aca/mca fini code in ras_fini().

Signed-off-by: Yang Wang <kevinyang.wang at amd.com>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c | 28 ++++++++++++++-----------
 1 file changed, 16 insertions(+), 12 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c
index 8dbfdb767f94..3258feb753ca 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c
@@ -3428,6 +3428,13 @@ int amdgpu_ras_init(struct amdgpu_device *adev)
 		goto release_con;
 	}
 
+	if (amdgpu_aca_is_enabled(adev))
+		r = amdgpu_aca_init(adev);
+	else
+		r = amdgpu_mca_init(adev);
+	if (r)
+		goto release_con;
+
 	dev_info(adev->dev, "RAS INFO: ras initialized successfully, "
 		 "hardware ability[%x] ras_mask[%x]\n",
 		 adev->ras_hw_enabled, adev->ras_enabled);
@@ -3636,25 +3643,22 @@ int amdgpu_ras_late_init(struct amdgpu_device *adev)
 
 	amdgpu_ras_event_mgr_init(adev);
 
-	if (amdgpu_aca_is_enabled(adev)) {
-		if (!amdgpu_in_reset(adev)) {
-			r = amdgpu_aca_init(adev);
+	if (amdgpu_in_reset(adev)) {
+		if (!amdgpu_aca_is_enabled(adev)) {
+			r = amdgpu_mca_reset(adev);
 			if (r)
 				return r;
 		}
+	}
 
-		if (!amdgpu_sriov_vf(adev))
-			amdgpu_ras_set_aca_debug_mode(adev, false);
-	} else {
-		if (amdgpu_in_reset(adev))
-			r = amdgpu_mca_reset(adev);
+	if (!amdgpu_sriov_vf(adev)) {
+		if (amdgpu_aca_is_enabled(adev))
+			r = amdgpu_ras_set_aca_debug_mode(adev, false);
 		else
-			r = amdgpu_mca_init(adev);
+			r = amdgpu_ras_set_mca_debug_mode(adev, false);
+
 		if (r)
 			return r;
-
-		if (!amdgpu_sriov_vf(adev))
-			amdgpu_ras_set_mca_debug_mode(adev, false);
 	}
 
 	/* Guest side doesn't need init ras feature */
-- 
2.34.1



More information about the amd-gfx mailing list