[PATCH 8/9] drm/amdgpu: Modify umc block to fit for the unified ras function pointers.

yipechai YiPeng.Chai at amd.com
Thu Nov 25 10:57:00 UTC 2021


Modify umc block ras functions to fit for the unified ras function pointers.

Signed-off-by: yipechai <YiPeng.Chai at amd.com>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.c |  8 ++++----
 drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c | 12 ++++++------
 drivers/gpu/drm/amd/amdgpu/amdgpu_umc.c |  8 ++++----
 drivers/gpu/drm/amd/amdgpu/amdgpu_umc.h |  9 ++-------
 drivers/gpu/drm/amd/amdgpu/umc_v6_1.c   | 10 ++++++----
 drivers/gpu/drm/amd/amdgpu/umc_v6_7.c   | 12 +++++++-----
 drivers/gpu/drm/amd/amdgpu/umc_v8_7.c   | 11 ++++++-----
 7 files changed, 35 insertions(+), 35 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.c
index 7780effdf3ac..4499cc5186cc 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.c
@@ -435,8 +435,8 @@ int amdgpu_gmc_ras_late_init(struct amdgpu_device *adev)
 	int r;
 
 	if (adev->umc.ras_funcs &&
-	    adev->umc.ras_funcs->ras_late_init) {
-		r = adev->umc.ras_funcs->ras_late_init(adev);
+	    adev->umc.ras_funcs->ops.ras_late_init) {
+		r = adev->umc.ras_funcs->ops.ras_late_init(adev);
 		if (r)
 			return r;
 	}
@@ -492,8 +492,8 @@ int amdgpu_gmc_ras_late_init(struct amdgpu_device *adev)
 void amdgpu_gmc_ras_fini(struct amdgpu_device *adev)
 {
 	if (adev->umc.ras_funcs &&
-	    adev->umc.ras_funcs->ras_fini)
-		adev->umc.ras_funcs->ras_fini(adev);
+	    adev->umc.ras_funcs->ops.ras_fini)
+		adev->umc.ras_funcs->ops.ras_fini(adev);
 
 	if (adev->mmhub.ras_funcs &&
 	    adev->mmhub.ras_funcs->ops.ras_fini)
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c
index 2c79172f6031..65306e0079af 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c
@@ -902,14 +902,14 @@ int amdgpu_ras_query_error_status(struct amdgpu_device *adev,
 	switch (info->head.block) {
 	case AMDGPU_RAS_BLOCK__UMC:
 		if (adev->umc.ras_funcs &&
-		    adev->umc.ras_funcs->query_ras_error_count)
-			adev->umc.ras_funcs->query_ras_error_count(adev, &err_data);
+		    adev->umc.ras_funcs->ops.query_ras_error_count)
+			adev->umc.ras_funcs->ops.query_ras_error_count(adev, &err_data);
 		/* umc query_ras_error_address is also responsible for clearing
 		 * error status
 		 */
 		if (adev->umc.ras_funcs &&
-		    adev->umc.ras_funcs->query_ras_error_address)
-			adev->umc.ras_funcs->query_ras_error_address(adev, &err_data);
+		    adev->umc.ras_funcs->ops.query_ras_error_address)
+			adev->umc.ras_funcs->ops.query_ras_error_address(adev, &err_data);
 		break;
 	case AMDGPU_RAS_BLOCK__SDMA:
 		if (adev->sdma.funcs->query_ras_error_count) {
@@ -2341,11 +2341,11 @@ int amdgpu_ras_init(struct amdgpu_device *adev)
 	if (adev->df.funcs &&
 	    adev->df.funcs->query_ras_poison_mode &&
 	    adev->umc.ras_funcs &&
-	    adev->umc.ras_funcs->query_ras_poison_mode) {
+	    adev->umc.ras_funcs->ops.query_ras_poison_mode) {
 		df_poison =
 			adev->df.funcs->query_ras_poison_mode(adev);
 		umc_poison =
-			adev->umc.ras_funcs->query_ras_poison_mode(adev);
+			adev->umc.ras_funcs->ops.query_ras_poison_mode(adev);
 		/* Only poison is set in both DF and UMC, we can support it */
 		if (df_poison && umc_poison)
 			con->poison_supported = true;
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_umc.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_umc.c
index 0c7c56a91b25..9a44c410be06 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_umc.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_umc.c
@@ -98,11 +98,11 @@ int amdgpu_umc_process_ras_data_cb(struct amdgpu_device *adev,
 
 	kgd2kfd_set_sram_ecc_flag(adev->kfd.dev);
 	if (adev->umc.ras_funcs &&
-	    adev->umc.ras_funcs->query_ras_error_count)
-	    adev->umc.ras_funcs->query_ras_error_count(adev, ras_error_status);
+	    adev->umc.ras_funcs->ops.query_ras_error_count)
+	    adev->umc.ras_funcs->ops.query_ras_error_count(adev, ras_error_status);
 
 	if (adev->umc.ras_funcs &&
-	    adev->umc.ras_funcs->query_ras_error_address &&
+	    adev->umc.ras_funcs->ops.query_ras_error_address &&
 	    adev->umc.max_ras_err_cnt_per_query) {
 		err_data->err_addr =
 			kcalloc(adev->umc.max_ras_err_cnt_per_query,
@@ -118,7 +118,7 @@ int amdgpu_umc_process_ras_data_cb(struct amdgpu_device *adev,
 		/* umc query_ras_error_address is also responsible for clearing
 		 * error status
 		 */
-		adev->umc.ras_funcs->query_ras_error_address(adev, ras_error_status);
+		adev->umc.ras_funcs->ops.query_ras_error_address(adev, ras_error_status);
 	}
 
 	/* only uncorrectable error needs gpu reset */
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_umc.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_umc.h
index 1f5fe2315236..d6d0d92f8fc1 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_umc.h
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_umc.h
@@ -20,6 +20,7 @@
  */
 #ifndef __AMDGPU_UMC_H__
 #define __AMDGPU_UMC_H__
+#include "amdgpu_ras.h"
 
 /*
  * (addr / 256) * 4096, the higher 26 bits in ErrorAddr
@@ -41,14 +42,8 @@
 #define LOOP_UMC_INST_AND_CH(umc_inst, ch_inst) LOOP_UMC_INST((umc_inst)) LOOP_UMC_CH_INST((ch_inst))
 
 struct amdgpu_umc_ras_funcs {
+	struct amdgpu_ras_block_ops ops;
 	void (*err_cnt_init)(struct amdgpu_device *adev);
-	int (*ras_late_init)(struct amdgpu_device *adev);
-	void (*ras_fini)(struct amdgpu_device *adev);
-	void (*query_ras_error_count)(struct amdgpu_device *adev,
-				      void *ras_error_status);
-	void (*query_ras_error_address)(struct amdgpu_device *adev,
-					void *ras_error_status);
-	bool (*query_ras_poison_mode)(struct amdgpu_device *adev);
 };
 
 struct amdgpu_umc_funcs {
diff --git a/drivers/gpu/drm/amd/amdgpu/umc_v6_1.c b/drivers/gpu/drm/amd/amdgpu/umc_v6_1.c
index 921da7dffb1c..2451b6d025e0 100644
--- a/drivers/gpu/drm/amd/amdgpu/umc_v6_1.c
+++ b/drivers/gpu/drm/amd/amdgpu/umc_v6_1.c
@@ -467,8 +467,10 @@ static void umc_v6_1_err_cnt_init(struct amdgpu_device *adev)
 
 const struct amdgpu_umc_ras_funcs umc_v6_1_ras_funcs = {
 	.err_cnt_init = umc_v6_1_err_cnt_init,
-	.ras_late_init = amdgpu_umc_ras_late_init,
-	.ras_fini = amdgpu_umc_ras_fini,
-	.query_ras_error_count = umc_v6_1_query_ras_error_count,
-	.query_ras_error_address = umc_v6_1_query_ras_error_address,
+	.ops = {
+		.ras_late_init = amdgpu_umc_ras_late_init,
+		.ras_fini = amdgpu_umc_ras_fini,
+		.query_ras_error_count = umc_v6_1_query_ras_error_count,
+		.query_ras_error_address = umc_v6_1_query_ras_error_address,
+	},
 };
diff --git a/drivers/gpu/drm/amd/amdgpu/umc_v6_7.c b/drivers/gpu/drm/amd/amdgpu/umc_v6_7.c
index f7ec3fe134e5..a4786de6186f 100644
--- a/drivers/gpu/drm/amd/amdgpu/umc_v6_7.c
+++ b/drivers/gpu/drm/amd/amdgpu/umc_v6_7.c
@@ -322,9 +322,11 @@ static bool umc_v6_7_query_ras_poison_mode(struct amdgpu_device *adev)
 }
 
 const struct amdgpu_umc_ras_funcs umc_v6_7_ras_funcs = {
-	.ras_late_init = amdgpu_umc_ras_late_init,
-	.ras_fini = amdgpu_umc_ras_fini,
-	.query_ras_error_count = umc_v6_7_query_ras_error_count,
-	.query_ras_error_address = umc_v6_7_query_ras_error_address,
-	.query_ras_poison_mode = umc_v6_7_query_ras_poison_mode,
+	.ops = {
+		.ras_late_init = amdgpu_umc_ras_late_init,
+		.ras_fini = amdgpu_umc_ras_fini,
+		.query_ras_error_count = umc_v6_7_query_ras_error_count,
+		.query_ras_error_address = umc_v6_7_query_ras_error_address,
+		.query_ras_poison_mode = umc_v6_7_query_ras_poison_mode,
+	},
 };
diff --git a/drivers/gpu/drm/amd/amdgpu/umc_v8_7.c b/drivers/gpu/drm/amd/amdgpu/umc_v8_7.c
index af59a35788e3..2ae97edf9a47 100644
--- a/drivers/gpu/drm/amd/amdgpu/umc_v8_7.c
+++ b/drivers/gpu/drm/amd/amdgpu/umc_v8_7.c
@@ -325,9 +325,10 @@ static void umc_v8_7_err_cnt_init(struct amdgpu_device *adev)
 }
 
 const struct amdgpu_umc_ras_funcs umc_v8_7_ras_funcs = {
-	.err_cnt_init = umc_v8_7_err_cnt_init,
-	.ras_late_init = amdgpu_umc_ras_late_init,
-	.ras_fini = amdgpu_umc_ras_fini,
-	.query_ras_error_count = umc_v8_7_query_ras_error_count,
-	.query_ras_error_address = umc_v8_7_query_ras_error_address,
+	.ops = {
+		.ras_late_init = amdgpu_umc_ras_late_init,
+		.ras_fini = amdgpu_umc_ras_fini,
+		.query_ras_error_count = umc_v8_7_query_ras_error_count,
+		.query_ras_error_address = umc_v8_7_query_ras_error_address,
+	},
 };
-- 
2.25.1



More information about the amd-gfx mailing list