Skip to contentSkip to conversation

drm/amdgpu: fix convert bad page retiremt

PATCH In review Stanley.Yang 2 participants 4 messages Jan 19, 2022 – Jan 20, 2022

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

PATCH 1/1 drm/amdgpu: fix convert bad page retiremt

Pmfw read ecc info registers and store values in
eccinfo_table in the following order

umc0 ch_inst 0, 1, 2 ... 7
umc1 ch_inst 0, 1, 2 ... 7
...
umc3 ch_inst 0, 1, 2 ... 7

Driver should convert eccinfo_table_idx into channel_index according to channel_idx_tbe.

Change-Id Icafe93e458912b729d2e30d655fd68be0e12124d
---
 drivers/gpu/drm/amd/amdgpu/umc_v6_7.c | 26 ++++++++++++++------------
 1 file changed, 14 insertions(+), 12 deletions(-)
drivers/gpu/drm/amd/amdgpu/umc_v6_7.c +14 -12
index 526de1ca9b8d..f5a1ba7db75a 100644
@@ -58,29 +58,33 @@ static inline uint32_t get_umc_v6_7_channel_index(struct amdgpu_device *adev,
 }
 
 static void umc_v6_7_ecc_info_query_correctable_error_count(struct amdgpu_device *adev,
-						   uint32_t channel_index,
+						   uint32_t umc_inst, uint32_t ch_inst,
 						   unsigned long *error_count)
 {
 	uint64_t mc_umc_status;
+	uint32_t eccinfo_table_idx;
 	struct amdgpu_ras *ras = amdgpu_ras_get_context(adev);
 
+	eccinfo_table_idx = umc_inst * adev->umc.channel_inst_num + ch_inst;
 	/* check for SRAM correctable error
 	  MCUMC_STATUS is a 64 bit register */
-	mc_umc_status = ras->umc_ecc.ecc[channel_index].mca_umc_status;
+	mc_umc_status = ras->umc_ecc.ecc[eccinfo_table_idx].mca_umc_status;
 	if (REG_GET_FIELD(mc_umc_status, MCA_UMC_UMC0_MCUMC_STATUST0, Val) == 1 &&
 	    REG_GET_FIELD(mc_umc_status, MCA_UMC_UMC0_MCUMC_STATUST0, CECC) == 1)
 		*error_count += 1;
 }
 
 static void umc_v6_7_ecc_info_querry_uncorrectable_error_count(struct amdgpu_device *adev,
-						      uint32_t channel_index,
+							  uint32_t umc_inst, uint32_t ch_inst,
 						      unsigned long *error_count)
 {
 	uint64_t mc_umc_status;
+	uint32_t eccinfo_table_idx;
 	struct amdgpu_ras *ras = amdgpu_ras_get_context(adev);
 
+	eccinfo_table_idx = umc_inst * adev->umc.channel_inst_num + ch_inst;
 	/* check the MCUMC_STATUS */
-	mc_umc_status = ras->umc_ecc.ecc[channel_index].mca_umc_status;
+	mc_umc_status = ras->umc_ecc.ecc[eccinfo_table_idx].mca_umc_status;
 	if ((REG_GET_FIELD(mc_umc_status, MCA_UMC_UMC0_MCUMC_STATUST0, Val) == 1) &&
 	    (REG_GET_FIELD(mc_umc_status, MCA_UMC_UMC0_MCUMC_STATUST0, Deferred) == 1 ||
 	    REG_GET_FIELD(mc_umc_status, MCA_UMC_UMC0_MCUMC_STATUST0, UECC) == 1 ||
@@ -97,19 +101,15 @@ static void umc_v6_7_ecc_info_query_ras_error_count(struct amdgpu_device *adev,
 
 	uint32_t umc_inst        = 0;
 	uint32_t ch_inst         = 0;
-	uint32_t channel_index	 = 0;
 
 	/*TODO: driver needs to toggle DF Cstate to ensure
 	 * safe access of UMC registers. Will add the protection */
 	LOOP_UMC_INST_AND_CH(umc_inst, ch_inst) {
-		channel_index = get_umc_v6_7_channel_index(adev,
-							 umc_inst,
-							 ch_inst);
 		umc_v6_7_ecc_info_query_correctable_error_count(adev,
-						      channel_index,
+						      umc_inst, ch_inst,
 						      &(err_data->ce_count));
 		umc_v6_7_ecc_info_querry_uncorrectable_error_count(adev,
-							  channel_index,
+						      umc_inst, ch_inst,
 							  &(err_data->ue_count));
 	}
 }
@@ -122,12 +122,14 @@ static void umc_v6_7_ecc_info_query_error_address(struct amdgpu_device *adev,
 	uint64_t mc_umc_status, err_addr, retired_page;
 	struct eeprom_table_record *err_rec;
 	uint32_t channel_index;
+	uint32_t eccinfo_table_idx;
 	struct amdgpu_ras *ras = amdgpu_ras_get_context(adev);
 
+	eccinfo_table_idx = umc_inst * adev->umc.channel_inst_num + ch_inst;
 	channel_index =
 		adev->umc.channel_idx_tbl[umc_inst * adev->umc.channel_inst_num + ch_inst];
 
-	mc_umc_status = ras->umc_ecc.ecc[channel_index].mca_umc_status;
+	mc_umc_status = ras->umc_ecc.ecc[eccinfo_table_idx].mca_umc_status;
 
 	if (mc_umc_status == 0)
 		return;
@@ -142,7 +144,7 @@ static void umc_v6_7_ecc_info_query_error_address(struct amdgpu_device *adev,
 	    (REG_GET_FIELD(mc_umc_status, MCA_UMC_UMC0_MCUMC_STATUST0, UECC) == 1 ||
 	    REG_GET_FIELD(mc_umc_status, MCA_UMC_UMC0_MCUMC_STATUST0, CECC) == 1)) {
 
-		err_addr = ras->umc_ecc.ecc[channel_index].mca_umc_addr;
+		err_addr = ras->umc_ecc.ecc[eccinfo_table_idx].mca_umc_addr;
 		err_addr = REG_GET_FIELD(err_addr, MCA_UMC_UMC0_MCUMC_ADDRT0, ErrorAddr);
 
 		/* translate umc channel address to soc pa, 3 parts are included */
Signature · 1 line
2.17.1
#1 lore raw

[AMD Official Use Only]

Quoted 13 lines

-----Original Message-----
From: Stanley.Yang <[email protected]>
Sent: Thursday, January 20, 2022 12:29 AM
To: [email protected]
Cc: Zhang, Hawking <[email protected]>; Zhou1, Tao <[email protected]>; Clements, John <[email protected]>; Ziya, Mohammad zafar <[email protected]>; Yang, Stanley <[email protected]>
Subject: [PATCH Review 1/1] drm/amdgpu: fix convert bad page retiremt

Pmfw read ecc info registers and store values in eccinfo_table in the following order

Quoted 7 lines

umc0 ch_inst 0, 1, 2 ... 7
umc1 ch_inst 0, 1, 2 ... 7
...
umc3 ch_inst 0, 1, 2 ... 7

Driver should convert eccinfo_table_idx into channel_index according to channel_idx_tbe.

[Tao]: typo, channel_idx_tbe -> channel_idx_tbl

The patch is OK for me, do we also need to apply the update to umc_v8_7.c?

Quoted 121 lines
Change-Id Icafe93e458912b729d2e30d655fd68be0e12124d
---
 drivers/gpu/drm/amd/amdgpu/umc_v6_7.c | 26 ++++++++++++++------------
 1 file changed, 14 insertions(+), 12 deletions(-)
drivers/gpu/drm/amd/amdgpu/umc_v6_7.c +4 -2
index 526de1ca9b8d..f5a1ba7db75a 100644
@@ -58,29 +58,33 @@ static inline uint32_t
 get_umc_v6_7_channel_index(struct amdgpu_device *adev,  }
 
 static void umc_v6_7_ecc_info_query_correctable_error_count(struct
 amdgpu_device *adev,
-						   uint32_t channel_index,
+						   uint32_t umc_inst, uint32_t
 ch_inst,
 						   unsigned long *error_count)
 {
 	uint64_t mc_umc_status;
+	uint32_t eccinfo_table_idx;
 	struct amdgpu_ras *ras = amdgpu_ras_get_context(adev);
 
+	eccinfo_table_idx = umc_inst * adev->umc.channel_inst_num + ch_inst;
 	/* check for SRAM correctable error
 	  MCUMC_STATUS is a 64 bit register */
-	mc_umc_status = ras->umc_ecc.ecc[channel_index].mca_umc_status;
+	mc_umc_status = ras-
 >umc_ecc.ecc[eccinfo_table_idx].mca_umc_status;
 	if (REG_GET_FIELD(mc_umc_status,

MCA_UMC_UMC0_MCUMC_STATUST0, Val) == 1 &&
REG_GET_FIELD(mc_umc_status,
MCA_UMC_UMC0_MCUMC_STATUST0, CECC) == 1)
*error_count += 1;
}

static void umc_v6_7_ecc_info_querry_uncorrectable_error_count(struct
amdgpu_device *adev,

drivers/gpu/drm/amd/amdgpu/umc_v6_7.c +1 -1
-						      uint32_t channel_index,
+							  uint32_t umc_inst,

uint32_t ch_inst,
unsigned long *error_count)
{

drivers/gpu/drm/amd/amdgpu/umc_v6_7.c +3 -1
 	uint64_t mc_umc_status;
+	uint32_t eccinfo_table_idx;
 	struct amdgpu_ras *ras = amdgpu_ras_get_context(adev);
 
+	eccinfo_table_idx = umc_inst * adev->umc.channel_inst_num + ch_inst;
 	/* check the MCUMC_STATUS */
-	mc_umc_status = ras->umc_ecc.ecc[channel_index].mca_umc_status;
+	mc_umc_status = ras-
Quoted 1 line

umc_ecc.ecc[eccinfo_table_idx].mca_umc_status;

if ((REG_GET_FIELD(mc_umc_status,
MCA_UMC_UMC0_MCUMC_STATUST0, Val) == 1) &&
(REG_GET_FIELD(mc_umc_status,
MCA_UMC_UMC0_MCUMC_STATUST0, Deferred) == 1 ||
REG_GET_FIELD(mc_umc_status,
MCA_UMC_UMC0_MCUMC_STATUST0, UECC) == 1 || @@ -97,19 +101,15 @@ static void umc_v6_7_ecc_info_query_ras_error_count(struct amdgpu_device *adev,

drivers/gpu/drm/amd/amdgpu/umc_v6_7.c +2 -6
 	uint32_t umc_inst        = 0;
 	uint32_t ch_inst         = 0;
-	uint32_t channel_index	 = 0;
 
 	/*TODO: driver needs to toggle DF Cstate to ensure
 	 * safe access of UMC registers. Will add the protection */
 	LOOP_UMC_INST_AND_CH(umc_inst, ch_inst) {
-		channel_index = get_umc_v6_7_channel_index(adev,
-							 umc_inst,
-							 ch_inst);
 		umc_v6_7_ecc_info_query_correctable_error_count(adev,
-						      channel_index,
+						      umc_inst, ch_inst,
 						      &(err_data->ce_count));
 		umc_v6_7_ecc_info_querry_uncorrectable_error_count(adev,
-							  channel_index,
+						      umc_inst, ch_inst,
 							  &(err_data-
Quoted 1 line

ue_count));

drivers/gpu/drm/amd/amdgpu/umc_v6_7.c +3 -1
 	}
 }
@@ -122,12 +122,14 @@ static void
 umc_v6_7_ecc_info_query_error_address(struct amdgpu_device *adev,
 	uint64_t mc_umc_status, err_addr, retired_page;
 	struct eeprom_table_record *err_rec;
 	uint32_t channel_index;
+	uint32_t eccinfo_table_idx;
 	struct amdgpu_ras *ras = amdgpu_ras_get_context(adev);
 
+	eccinfo_table_idx = umc_inst * adev->umc.channel_inst_num + ch_inst;
 	channel_index =
 		adev->umc.channel_idx_tbl[umc_inst * adev-
 >umc.channel_inst_num + ch_inst];
 
-	mc_umc_status = ras->umc_ecc.ecc[channel_index].mca_umc_status;
+	mc_umc_status = ras-
 >umc_ecc.ecc[eccinfo_table_idx].mca_umc_status;
drivers/gpu/drm/amd/amdgpu/umc_v6_7.c +0 -0
 	if (mc_umc_status == 0)
 		return;
@@ -142,7 +144,7 @@ static void
 umc_v6_7_ecc_info_query_error_address(struct amdgpu_device *adev,
 	    (REG_GET_FIELD(mc_umc_status,

MCA_UMC_UMC0_MCUMC_STATUST0, UECC) == 1 ||
REG_GET_FIELD(mc_umc_status,
MCA_UMC_UMC0_MCUMC_STATUST0, CECC) == 1)) {

drivers/gpu/drm/amd/amdgpu/umc_v6_7.c +1 -1
-		err_addr = ras->umc_ecc.ecc[channel_index].mca_umc_addr;
+		err_addr = ras-
Quoted 1 line

umc_ecc.ecc[eccinfo_table_idx].mca_umc_addr;

err_addr = REG_GET_FIELD(err_addr,
MCA_UMC_UMC0_MCUMC_ADDRT0, ErrorAddr);

/* translate umc channel address to soc pa, 3 parts are included
*/
--
2.17.1

#2 lore raw

[AMD Official Use Only]

Quoted 33 lines

-----邮件原件-----
发件人: Zhou1, Tao <[email protected]>
发送时间: Thursday, January 20, 2022 11:09 AM
收件人: Yang, Stanley <[email protected]>; amd- [email protected]
抄送: Zhang, Hawking <[email protected]>; Clements, John <[email protected]>; Ziya, Mohammad zafar <[email protected]>; Yang, Stanley <[email protected]> 主题: RE: [PATCH Review 1/1] drm/amdgpu: fix convert bad page retiremt

[AMD Official Use Only]

Quoted 6 lines

-----Original Message-----
From: Stanley.Yang <[email protected]>
Sent: Thursday, January 20, 2022 12:29 AM
To: [email protected]
Cc: Zhang, Hawking <[email protected]>; Zhou1, Tao <[email protected]>; Clements, John <[email protected]>;

Ziya,

Quoted 12 lines

Mohammad zafar <[email protected]>; Yang, Stanley <[email protected]>
Subject: [PATCH Review 1/1] drm/amdgpu: fix convert bad page retiremt

Pmfw read ecc info registers and store values in eccinfo_table in the following order

umc0 ch_inst 0, 1, 2 ... 7
umc1 ch_inst 0, 1, 2 ... 7
...
umc3 ch_inst 0, 1, 2 ... 7

Quoted 5 lines
Quoted 2 lines

Driver should convert eccinfo_table_idx into channel_index according to channel_idx_tbe.

[Tao]: typo, channel_idx_tbe -> channel_idx_tbl

The patch is OK for me, do we also need to apply the update to umc_v8_7.c?

[Yang, Stanley] : This need to confirm the ecc info registers address definition in pmfw, it should be updated if definition mechanism of those registers addresses are same.

Quoted 132 lines
Quoted 6 lines
Change-Id Icafe93e458912b729d2e30d655fd68be0e12124d
---
 drivers/gpu/drm/amd/amdgpu/umc_v6_7.c | 26 ++++++++++++++--------

----

Quoted 12 lines
 1 file changed, 14 insertions(+), 12 deletions(-)
drivers/gpu/drm/amd/amdgpu/umc_v6_7.c +0 -0
index 526de1ca9b8d..f5a1ba7db75a 100644
@@ -58,29 +58,33 @@ static inline uint32_t
 get_umc_v6_7_channel_index(struct amdgpu_device *adev,  }
 
 static void umc_v6_7_ecc_info_query_correctable_error_count(struct
 amdgpu_device *adev,

drivers/gpu/drm/amd/amdgpu/umc_v6_7.c static inline uint32_t · line 70

Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/umc_v6_7.c +3 -1
-						   uint32_t channel_index,
+						   uint32_t umc_inst, uint32_t
 ch_inst,
 						   unsigned long *error_count)
 {
 	uint64_t mc_umc_status;
+	uint32_t eccinfo_table_idx;
 	struct amdgpu_ras *ras = amdgpu_ras_get_context(adev);
 
+	eccinfo_table_idx = umc_inst * adev->umc.channel_inst_num +

ch_inst;

Quoted 17 lines
drivers/gpu/drm/amd/amdgpu/umc_v6_7.c +1 -1
 	/* check for SRAM correctable error
 	  MCUMC_STATUS is a 64 bit register */
-	mc_umc_status = ras-
 umc_ecc.ecc[channel_index].mca_umc_status;
+	mc_umc_status = ras-
 >umc_ecc.ecc[eccinfo_table_idx].mca_umc_status;
 	if (REG_GET_FIELD(mc_umc_status,

MCA_UMC_UMC0_MCUMC_STATUST0, Val) == 1 &&
REG_GET_FIELD(mc_umc_status,
MCA_UMC_UMC0_MCUMC_STATUST0, CECC) == 1)
*error_count += 1;
}

static void umc_v6_7_ecc_info_querry_uncorrectable_error_count(struct
amdgpu_device *adev,

drivers/gpu/drm/amd/amdgpu/umc_v6_7.c +1 -1
-						      uint32_t channel_index,
+							  uint32_t umc_inst,
Quoted 2 lines

uint32_t ch_inst,
unsigned long

*error_count) {

drivers/gpu/drm/amd/amdgpu/umc_v6_7.c static inline uint32_t get_umc_v6_7_channel_index(struct amdgpu_device *adev,

Quoted 5 lines
drivers/gpu/drm/amd/amdgpu/umc_v6_7.c +2 -0
 	uint64_t mc_umc_status;
+	uint32_t eccinfo_table_idx;
 	struct amdgpu_ras *ras = amdgpu_ras_get_context(adev);
 
+	eccinfo_table_idx = umc_inst * adev->umc.channel_inst_num +

ch_inst;

Quoted 11 lines
drivers/gpu/drm/amd/amdgpu/umc_v6_7.c +0 -1
 	/* check the MCUMC_STATUS */
-	mc_umc_status = ras-

umc_ecc.ecc[channel_index].mca_umc_status;

drivers/gpu/drm/amd/amdgpu/umc_v6_7.c +1 -0
+	mc_umc_status = ras-
Quoted 1 line

umc_ecc.ecc[eccinfo_table_idx].mca_umc_status;

if ((REG_GET_FIELD(mc_umc_status,
MCA_UMC_UMC0_MCUMC_STATUST0, Val) == 1) &&
(REG_GET_FIELD(mc_umc_status,
MCA_UMC_UMC0_MCUMC_STATUST0, Deferred) == 1 ||
REG_GET_FIELD(mc_umc_status,
MCA_UMC_UMC0_MCUMC_STATUST0, UECC) == 1 || @@ -97,19 +101,15

@@ static

Quoted 8 lines

void umc_v6_7_ecc_info_query_ras_error_count(struct amdgpu_device *adev,

drivers/gpu/drm/amd/amdgpu/umc_v6_7.c +0 -1
 	uint32_t umc_inst        = 0;
 	uint32_t ch_inst         = 0;
-	uint32_t channel_index	 = 0;
 

drivers/gpu/drm/amd/amdgpu/umc_v6_7.c static void umc_v6_7_ecc_info_query_ras_error_count(struct amdgpu_device *adev, · line 110

Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/umc_v6_7.c +1 -4
 	/*TODO: driver needs to toggle DF Cstate to ensure
 	 * safe access of UMC registers. Will add the protection */
 	LOOP_UMC_INST_AND_CH(umc_inst, ch_inst) {
-		channel_index = get_umc_v6_7_channel_index(adev,
-							 umc_inst,
-							 ch_inst);
 		umc_v6_7_ecc_info_query_correctable_error_count(adev,
-						      channel_index,
+						      umc_inst, ch_inst,
 						      &(err_data->ce_count));

umc_v6_7_ecc_info_querry_uncorrectable_error_count(adev,

Quoted 7 lines
drivers/gpu/drm/amd/amdgpu/umc_v6_7.c +1 -1
-							  channel_index,
+						      umc_inst, ch_inst,
 							  &(err_data-
Quoted 1 line

ue_count));

drivers/gpu/drm/amd/amdgpu/umc_v6_7.c +0 -0
 	}
 }

drivers/gpu/drm/amd/amdgpu/umc_v6_7.c static void · line 129

Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/umc_v6_7.c +2 -0
@@ -122,12 +122,14 @@ static void
 umc_v6_7_ecc_info_query_error_address(struct amdgpu_device *adev,
 	uint64_t mc_umc_status, err_addr, retired_page;
 	struct eeprom_table_record *err_rec;
 	uint32_t channel_index;
+	uint32_t eccinfo_table_idx;
 	struct amdgpu_ras *ras = amdgpu_ras_get_context(adev);
 
+	eccinfo_table_idx = umc_inst * adev->umc.channel_inst_num +

ch_inst;

Quoted 22 lines
drivers/gpu/drm/amd/amdgpu/umc_v6_7.c +1 -1
 	channel_index =
 		adev->umc.channel_idx_tbl[umc_inst * adev-
 >umc.channel_inst_num + ch_inst];
 
-	mc_umc_status = ras-
 umc_ecc.ecc[channel_index].mca_umc_status;
+	mc_umc_status = ras-
Quoted 1 line

umc_ecc.ecc[eccinfo_table_idx].mca_umc_status;

drivers/gpu/drm/amd/amdgpu/umc_v6_7.c +0 -0
 	if (mc_umc_status == 0)
 		return;
@@ -142,7 +144,7 @@ static void
 umc_v6_7_ecc_info_query_error_address(struct amdgpu_device *adev,
 	    (REG_GET_FIELD(mc_umc_status,

MCA_UMC_UMC0_MCUMC_STATUST0, UECC) == 1 ||
REG_GET_FIELD(mc_umc_status,
MCA_UMC_UMC0_MCUMC_STATUST0, CECC) == 1)) {

drivers/gpu/drm/amd/amdgpu/umc_v6_7.c +0 -1
-		err_addr = ras-

umc_ecc.ecc[channel_index].mca_umc_addr;

drivers/gpu/drm/amd/amdgpu/umc_v6_7.c +1 -0
+		err_addr = ras-
Quoted 1 line

umc_ecc.ecc[eccinfo_table_idx].mca_umc_addr;

Quoted 4 lines

err_addr = REG_GET_FIELD(err_addr,
MCA_UMC_UMC0_MCUMC_ADDRT0, ErrorAddr);

/* translate umc channel address to soc pa, 3 parts are

included */

Quoted 2 lines

--
2.17.1

Reviewed-by
#3 lore raw

[AMD Official Use Only]

With the typo fixed, the patch is:

Quoted 189 lines

-----Original Message-----
From: Yang, Stanley <[email protected]>
Sent: Thursday, January 20, 2022 11:25 AM
To: Zhou1, Tao <[email protected]>; [email protected]
Cc: Zhang, Hawking <[email protected]>; Clements, John <[email protected]>; Ziya, Mohammad zafar <[email protected]>
Subject: 回复: [PATCH Review 1/1] drm/amdgpu: fix convert bad page retiremt

[AMD Official Use Only]

Quoted 34 lines

-----邮件原件-----
发件人: Zhou1, Tao <[email protected]>
发送时间: Thursday, January 20, 2022 11:09 AM
收件人: Yang, Stanley <[email protected]>; amd- [email protected]
抄送: Zhang, Hawking <[email protected]>; Clements, John <[email protected]>; Ziya, Mohammad zafar <[email protected]>; Yang, Stanley <[email protected]> 主题: RE: [PATCH Review 1/1] drm/amdgpu: fix convert bad page retiremt

[AMD Official Use Only]

Quoted 6 lines

-----Original Message-----
From: Stanley.Yang <[email protected]>
Sent: Thursday, January 20, 2022 12:29 AM
To: [email protected]
Cc: Zhang, Hawking <[email protected]>; Zhou1, Tao <[email protected]>; Clements, John <[email protected]>;

Ziya,

Quoted 13 lines

Mohammad zafar <[email protected]>; Yang, Stanley <[email protected]>
Subject: [PATCH Review 1/1] drm/amdgpu: fix convert bad page retiremt

Pmfw read ecc info registers and store values in eccinfo_table in the following order

umc0 ch_inst 0, 1, 2 ... 7
umc1 ch_inst 0, 1, 2 ... 7
...
umc3 ch_inst 0, 1, 2 ... 7

Quoted 5 lines
Quoted 2 lines

Driver should convert eccinfo_table_idx into channel_index according to channel_idx_tbe.

[Tao]: typo, channel_idx_tbe -> channel_idx_tbl

The patch is OK for me, do we also need to apply the update to umc_v8_7.c?

[Yang, Stanley] : This need to confirm the ecc info registers address definition in pmfw, it should be updated if definition mechanism of those registers addresses are same.

Quoted 17 lines
Quoted 6 lines
Change-Id Icafe93e458912b729d2e30d655fd68be0e12124d
---
 drivers/gpu/drm/amd/amdgpu/umc_v6_7.c | 26 ++++++++++++++--------

----

Quoted 10 lines
 1 file changed, 14 insertions(+), 12 deletions(-)
drivers/gpu/drm/amd/amdgpu/umc_v6_7.c +0 -0
index 526de1ca9b8d..f5a1ba7db75a 100644
@@ -58,29 +58,33 @@ static inline uint32_t
 get_umc_v6_7_channel_index(struct amdgpu_device *adev,  }
 
Quoted 6 lines

drivers/gpu/drm/amd/amdgpu/umc_v6_7.c static inline uint32_t · line 64

Quoted 6 lines
drivers/gpu/drm/amd/amdgpu/umc_v6_7.c +1 -1
 static void umc_v6_7_ecc_info_query_correctable_error_count(struct
 amdgpu_device *adev,
-						   uint32_t channel_index,
+						   uint32_t umc_inst, uint32_t
 ch_inst,
 						   unsigned long *error_count)

{

Quoted 78 lines

drivers/gpu/drm/amd/amdgpu/umc_v6_7.c static inline uint32_t get_umc_v6_7_channel_index(struct amdgpu_device *adev,

Quoted 5 lines
drivers/gpu/drm/amd/amdgpu/umc_v6_7.c +2 -0
 	uint64_t mc_umc_status;
+	uint32_t eccinfo_table_idx;
 	struct amdgpu_ras *ras = amdgpu_ras_get_context(adev);
 
+	eccinfo_table_idx = umc_inst * adev->umc.channel_inst_num +

ch_inst;

Quoted 18 lines
drivers/gpu/drm/amd/amdgpu/umc_v6_7.c +1 -1
 	/* check for SRAM correctable error
 	  MCUMC_STATUS is a 64 bit register */
-	mc_umc_status = ras-
 umc_ecc.ecc[channel_index].mca_umc_status;
+	mc_umc_status = ras-
 >umc_ecc.ecc[eccinfo_table_idx].mca_umc_status;
 	if (REG_GET_FIELD(mc_umc_status,

MCA_UMC_UMC0_MCUMC_STATUST0, Val) == 1 &&
REG_GET_FIELD(mc_umc_status,
MCA_UMC_UMC0_MCUMC_STATUST0, CECC) == 1)
*error_count += 1;
}

static void
umc_v6_7_ecc_info_querry_uncorrectable_error_count(struct amdgpu_device *adev,

drivers/gpu/drm/amd/amdgpu/umc_v6_7.c +1 -1
-						      uint32_t channel_index,
+							  uint32_t umc_inst,
Quoted 2 lines

uint32_t ch_inst,
unsigned long

*error_count) {

drivers/gpu/drm/amd/amdgpu/umc_v6_7.c static inline uint32_t get_umc_v6_7_channel_index(struct amdgpu_device *adev,

Quoted 5 lines
drivers/gpu/drm/amd/amdgpu/umc_v6_7.c +2 -0
 	uint64_t mc_umc_status;
+	uint32_t eccinfo_table_idx;
 	struct amdgpu_ras *ras = amdgpu_ras_get_context(adev);
 
+	eccinfo_table_idx = umc_inst * adev->umc.channel_inst_num +

ch_inst;

Quoted 11 lines
drivers/gpu/drm/amd/amdgpu/umc_v6_7.c +0 -1
 	/* check the MCUMC_STATUS */
-	mc_umc_status = ras-

umc_ecc.ecc[channel_index].mca_umc_status;

drivers/gpu/drm/amd/amdgpu/umc_v6_7.c +1 -0
+	mc_umc_status = ras-
Quoted 1 line

umc_ecc.ecc[eccinfo_table_idx].mca_umc_status;

if ((REG_GET_FIELD(mc_umc_status,
MCA_UMC_UMC0_MCUMC_STATUST0, Val) == 1) &&
(REG_GET_FIELD(mc_umc_status,
MCA_UMC_UMC0_MCUMC_STATUST0, Deferred) == 1 ||
REG_GET_FIELD(mc_umc_status,
MCA_UMC_UMC0_MCUMC_STATUST0, UECC) == 1 || @@ -97,19 +101,15

@@ static

Quoted 8 lines

void umc_v6_7_ecc_info_query_ras_error_count(struct amdgpu_device *adev,

drivers/gpu/drm/amd/amdgpu/umc_v6_7.c +0 -1
 	uint32_t umc_inst        = 0;
 	uint32_t ch_inst         = 0;
-	uint32_t channel_index	 = 0;
 

drivers/gpu/drm/amd/amdgpu/umc_v6_7.c static void umc_v6_7_ecc_info_query_ras_error_count(struct amdgpu_device *adev, · line 110

Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/umc_v6_7.c +1 -4
 	/*TODO: driver needs to toggle DF Cstate to ensure
 	 * safe access of UMC registers. Will add the protection */
 	LOOP_UMC_INST_AND_CH(umc_inst, ch_inst) {
-		channel_index = get_umc_v6_7_channel_index(adev,
-							 umc_inst,
-							 ch_inst);
 		umc_v6_7_ecc_info_query_correctable_error_count(adev,
-						      channel_index,
+						      umc_inst, ch_inst,
 						      &(err_data->ce_count));

umc_v6_7_ecc_info_querry_uncorrectable_error_count(adev,

Quoted 14 lines
drivers/gpu/drm/amd/amdgpu/umc_v6_7.c +1 -1
-							  channel_index,
+						      umc_inst, ch_inst,
 							  &(err_data-
Quoted 1 line

ue_count));

drivers/gpu/drm/amd/amdgpu/umc_v6_7.c +1 -0
 	}
 }
@@ -122,12 +122,14 @@ static void
 umc_v6_7_ecc_info_query_error_address(struct amdgpu_device *adev,
 	uint64_t mc_umc_status, err_addr, retired_page;
 	struct eeprom_table_record *err_rec;
 	uint32_t channel_index;
+	uint32_t eccinfo_table_idx;
 	struct amdgpu_ras *ras = amdgpu_ras_get_context(adev);
 
Quoted 25 lines

drivers/gpu/drm/amd/amdgpu/umc_v6_7.c static void · line 129

Quoted 1 line
drivers/gpu/drm/amd/amdgpu/umc_v6_7.c +1 -0
+	eccinfo_table_idx = umc_inst * adev->umc.channel_inst_num +

ch_inst;

Quoted 23 lines
drivers/gpu/drm/amd/amdgpu/umc_v6_7.c +1 -1
 	channel_index =
 		adev->umc.channel_idx_tbl[umc_inst * adev-
 >umc.channel_inst_num + ch_inst];
 
-	mc_umc_status = ras-
 umc_ecc.ecc[channel_index].mca_umc_status;
+	mc_umc_status = ras-
Quoted 1 line

umc_ecc.ecc[eccinfo_table_idx].mca_umc_status;

drivers/gpu/drm/amd/amdgpu/umc_v6_7.c +0 -0
 	if (mc_umc_status == 0)
 		return;
@@ -142,7 +144,7 @@ static void
 umc_v6_7_ecc_info_query_error_address(struct amdgpu_device *adev,
 	    (REG_GET_FIELD(mc_umc_status,

MCA_UMC_UMC0_MCUMC_STATUST0, UECC) == 1 ||
REG_GET_FIELD(mc_umc_status,
MCA_UMC_UMC0_MCUMC_STATUST0, CECC) == 1)) {

drivers/gpu/drm/amd/amdgpu/umc_v6_7.c +0 -1
-		err_addr = ras-

umc_ecc.ecc[channel_index].mca_umc_addr;

drivers/gpu/drm/amd/amdgpu/umc_v6_7.c +1 -0
+		err_addr = ras-
Quoted 1 line

umc_ecc.ecc[eccinfo_table_idx].mca_umc_addr;

err_addr = REG_GET_FIELD(err_addr,

MCA_UMC_UMC0_MCUMC_ADDRT0,

Quoted 6 lines
Quoted 3 lines

ErrorAddr);

/* translate umc channel address to soc pa, 3 parts are

included */

Quoted 2 lines

--
2.17.1