Skip to contentSkip to conversation

drm/amdgpu: print channel index for UMC bad page

PATCH In review Tao Zhou 2 participants 4 messages Sep 20, 2023

Subsystems (2)
lore
Share & tools
lore

Tao Zhou

author
#0 lore raw

PATCH 1/3 drm/amdgpu: print channel index for UMC bad page

Print channel index for UMC v12.

---
 drivers/gpu/drm/amd/amdgpu/umc_v12_0.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)
drivers/gpu/drm/amd/amdgpu/umc_v12_0.c +6 -4
index c6742dd863d4..7714c2ef2cdc 100644
@@ -240,15 +240,17 @@ static void umc_v12_0_convert_error_address(struct amdgpu_device *adev,
 		/* include column bit 0 and 1 */
 		col &= 0x3;
 		col |= (column << 2);
-		dev_info(adev->dev, "Error Address(PA):0x%llx Row:0x%x Col:0x%x Bank:0x%x\n",
-			retired_page, row, col, bank);
+		dev_info(adev->dev,
+			"Error Address(PA):0x%-10llx Row:0x%-4x Col:0x%-2x Bank:0x%x Channel:0x%x\n",
+			retired_page, row, col, bank, channel_index);
 		amdgpu_umc_fill_error_record(err_data, err_addr,
 			retired_page, channel_index, umc_inst);
 
 		/* shift R13 bit */
 		retired_page ^= (0x1ULL << UMC_V12_0_PA_R13_BIT);
-		dev_info(adev->dev, "Error Address(PA):0x%llx Row:0x%x Col:0x%x Bank:0x%x\n",
-			retired_page, row_xor, col, bank);
+		dev_info(adev->dev,
+			"Error Address(PA):0x%-10llx Row:0x%-4x Col:0x%-2x Bank:0x%x Channel:0x%x\n",
+			retired_page, row_xor, col, bank, channel_index);
 		amdgpu_umc_fill_error_record(err_data, err_addr,
 			retired_page, channel_index, umc_inst);
 	}
Signature · 1 line
2.35.1
author
#1 lore raw

PATCH 2/3 drm/amdgpu: fix value of some UMC parameters for UMC v12

Prepare for bad page retirement.

---
 drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c  | 4 +++-
 drivers/gpu/drm/amd/amdgpu/umc_v12_0.h | 2 ++
 2 files changed, 5 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c +3 -1
index a5510412acd0..bae4a0d18190 100644
@@ -1497,12 +1497,14 @@ static void gmc_v9_0_set_umc_funcs(struct amdgpu_device *adev)
 			adev->umc.channel_idx_tbl = &umc_v6_7_channel_idx_tbl_second[0][0];
 		break;
 	case IP_VERSION(12, 0, 0):
-		adev->umc.max_ras_err_cnt_per_query = UMC_V12_0_TOTAL_CHANNEL_NUM(adev);
+		adev->umc.max_ras_err_cnt_per_query =
+			UMC_V12_0_TOTAL_CHANNEL_NUM(adev) * UMC_V12_0_BAD_PAGE_NUM_PER_CHANNEL;
 		adev->umc.channel_inst_num = UMC_V12_0_CHANNEL_INSTANCE_NUM;
 		adev->umc.umc_inst_num = UMC_V12_0_UMC_INSTANCE_NUM;
 		adev->umc.node_inst_num /= UMC_V12_0_UMC_INSTANCE_NUM;
 		adev->umc.channel_offs = UMC_V12_0_PER_CHANNEL_OFFSET;
 		adev->umc.active_mask = adev->aid_mask;
+		adev->umc.retire_unit = UMC_V12_0_BAD_PAGE_NUM_PER_CHANNEL;
 		adev->umc.channel_idx_tbl = &umc_v12_0_channel_idx_tbl[0][0][0];
 		if (!adev->gmc.xgmi.connected_to_cpu && !adev->gmc.is_app_apu)
 			adev->umc.ras = &umc_v12_0_ras;
drivers/gpu/drm/amd/amdgpu/umc_v12_0.h +2 -0
index e3619d67ae3b..4885b9fff272 100644
@@ -53,6 +53,8 @@
 
 /* one piece of normalized address is mapped to 8 pieces of physical address */
 #define UMC_V12_0_NA_MAP_PA_NUM        8
+/* R13 bit shift should be considered, double the number */
+#define UMC_V12_0_BAD_PAGE_NUM_PER_CHANNEL (UMC_V12_0_NA_MAP_PA_NUM * 2)
 /* bank bits in MCA error address */
 #define UMC_V12_0_MCA_B0_BIT 6
 #define UMC_V12_0_MCA_B1_BIT 7
Signature · 1 line
2.35.1
author
#2 lore raw

PATCH 3/3 drm/amdgpu: change if condition for bad channel bitmap update

In reply to Tao Zhou

The amdgpu_ras_eeprom_control.bad_channel_bitmap is u32 type, but the channel index could be larger than 32. For the ASICs whose channel number is more than 32, the amdgpu_dpm_send_hbm_bad_channel_flag interface is not supported, so we simply bypass channel bitmap update under this condition.

v2: replace sizeof with BITS_PER_TYPE, we should check bit number instead of byte number.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_ras_eeprom.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_ras_eeprom.c +4 -2
index 8ced4be784e0..c60d2f79eeef 100644
@@ -616,7 +616,8 @@ amdgpu_ras_eeprom_append_table(struct amdgpu_ras_eeprom_control *control,
 		__encode_table_record_to_buf(control, &record[i], pp);
 
 		/* update bad channel bitmap */
-		if (!(control->bad_channel_bitmap & (1 << record[i].mem_channel))) {
+		if ((record[i].mem_channel < BITS_PER_TYPE(control->bad_channel_bitmap)) &&
+		    !(control->bad_channel_bitmap & (1 << record[i].mem_channel))) {
 			control->bad_channel_bitmap |= 1 << record[i].mem_channel;
 			con->update_channel_flag = true;
 		}
@@ -969,7 +970,8 @@ int amdgpu_ras_eeprom_read(struct amdgpu_ras_eeprom_control *control,
 		__decode_table_record_from_buf(control, &record[i], pp);
 
 		/* update bad channel bitmap */
-		if (!(control->bad_channel_bitmap & (1 << record[i].mem_channel))) {
+		if ((record[i].mem_channel < BITS_PER_TYPE(control->bad_channel_bitmap)) &&
+		    !(control->bad_channel_bitmap & (1 << record[i].mem_channel))) {
 			control->bad_channel_bitmap |= 1 << record[i].mem_channel;
 			con->update_channel_flag = true;
 		}
Signature · 1 line
2.35.1
Reviewed-by on v1 3/3
#3 lore raw

RE: [PATCH 3/3] drm/amdgpu: change if condition for bad channel bitmap update

[AMD Official Use Only - General]

Series is

Regards,
Hawking
-----Original Message-----
From: Zhou1, Tao <[email protected]>
Sent: Wednesday, September 20, 2023 16:37
To: [email protected]; Zhang, Hawking <[email protected]>; Yang, Stanley <[email protected]>; Li, Candice <[email protected]>; Wang, Yang(Kevin) <[email protected]>; Chai, Thomas <[email protected]>
Cc: Zhou1, Tao <[email protected]>
Subject: [PATCH 3/3] drm/amdgpu: change if condition for bad channel bitmap update

The amdgpu_ras_eeprom_control.bad_channel_bitmap is u32 type, but the channel index could be larger than 32. For the ASICs whose channel number is more than 32, the amdgpu_dpm_send_hbm_bad_channel_flag interface is not supported, so we simply bypass channel bitmap update under this condition.

v2: replace sizeof with BITS_PER_TYPE, we should check bit number instead of byte number.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_ras_eeprom.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_ras_eeprom.c +4 -2
index 8ced4be784e0..c60d2f79eeef 100644
@@ -616,7 +616,8 @@ amdgpu_ras_eeprom_append_table(struct amdgpu_ras_eeprom_control *control,
                __encode_table_record_to_buf(control, &record[i], pp);
 
                /* update bad channel bitmap */
-               if (!(control->bad_channel_bitmap & (1 << record[i].mem_channel))) {
+               if ((record[i].mem_channel < BITS_PER_TYPE(control->bad_channel_bitmap)) &&
+                   !(control->bad_channel_bitmap & (1 << record[i].mem_channel))) {
                        control->bad_channel_bitmap |= 1 << record[i].mem_channel;
                        con->update_channel_flag = true;
                }
@@ -969,7 +970,8 @@ int amdgpu_ras_eeprom_read(struct amdgpu_ras_eeprom_control *control,
                __decode_table_record_from_buf(control, &record[i], pp);
 
                /* update bad channel bitmap */
-               if (!(control->bad_channel_bitmap & (1 << record[i].mem_channel))) {
+               if ((record[i].mem_channel < BITS_PER_TYPE(control->bad_channel_bitmap)) &&
+                   !(control->bad_channel_bitmap & (1 << record[i].mem_channel))) {
                        control->bad_channel_bitmap |= 1 << record[i].mem_channel;
                        con->update_channel_flag = true;
                }

--
2.35.1