drm/amdgpu: make MCA IPID parse global
Subsystems (2)
PATCH 1/8 drm/amdgpu: make MCA IPID parse global
So we can call it in other blocks.
v2: add a new IPID parse interface for umc and we can
implement it for each ASIC.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_umc.h | 2 ++ drivers/gpu/drm/amd/amdgpu/umc_v12_0.c | 14 ++++++++++++++ 2 files changed, 16 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_umc.h +2 -0
@@ -113,6 +113,8 @@ struct amdgpu_umc_ras {uint32_t (*get_die_id_from_pa)(struct amdgpu_device *adev,uint64_t mca_addr,uint64_t retired_page);void (*get_retire_flip_bits)(struct amdgpu_device *adev); +void (*mca_ipid_parse)(struct amdgpu_device *adev,uint64_t ipid, +uint32_t *did,uint32_t *ch,uint32_t *umc_inst,uint32_t *sid); };struct amdgpu_umc_funcs {
drivers/gpu/drm/amd/amdgpu/umc_v12_0.c +14 -0
@@ -711,6 +711,19 @@ static uint32_t umc_v12_0_get_die_id(struct amdgpu_device *adev,return die; } +static void umc_v12_0_mca_ipid_parse (struct amdgpu_device *adev,uint64_t ipid, +uint32_t *did,uint32_t *ch,uint32_t *umc_inst,uint32_t *sid) +{ +if (did) + *did =MCA_IPID_2_DIE_ID (ipid); +if (ch) + *ch =MCA_IPID_2_UMC_CH (ipid); +if (umc_inst) + *umc_inst =MCA_IPID_2_UMC_INST (ipid); +if (sid) + *sid =MCA_IPID_2_SOCKET_ID (ipid); +} +struct amdgpu_umc_ras umc_v12_0_ras = { .ras_block = { .hw_ops = &umc_v12_0_ras_hw_ops,
@@ -724,5 +737,6 @@ struct amdgpu_umc_ras umc_v12_0_ras = { .convert_ras_err_addr = umc_v12_0_convert_error_address, .get_die_id_from_pa = umc_v12_0_get_die_id, .get_retire_flip_bits = umc_v12_0_get_retire_flip_bits, + .mca_ipid_parse = umc_v12_0_mca_ipid_parse, };
Signature · 1 line
2.34.1
PATCH 2/8 drm/amdgpu: add ras_eeprom_read_idx interface
PMFW will manage RAS eeprom data by itself, add new interface to read eeprom data via PMFW, we can read part of records by setting index.
v2: use IPID parse interface.
pa is not used and set it to a fixed value.
--- .../gpu/drm/amd/amdgpu/amdgpu_ras_eeprom.c | 51 +++++++++++++++++++ .../gpu/drm/amd/amdgpu/amdgpu_ras_eeprom.h | 4 ++ 2 files changed, 55 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_ras_eeprom.c +51 -0
@@ -970,6 +970,50 @@ static int __amdgpu_ras_eeprom_read(struct amdgpu_ras_eeprom_control *control,return res; } +int amdgpu_ras_eeprom_read_idx (struct amdgpu_ras_eeprom_control *control, +struct eeprom_table_record *record,u32 rec_idx, +const u32 num) +{ +struct amdgpu_device *adev =to_amdgpu_device (control); +uint64_t ts, end_idx; +int i, ret; +u64 mca, ipid; + +if (!amdgpu_ras_smu_eeprom_supported (adev)) +return 0 ; + + end_idx = rec_idx + num; +for (i = rec_idx; i < end_idx; i++) { + ret =amdgpu_ras_smu_get_badpage_mca_addr (adev, i, &mca); +if (ret) +return ret; + + ret =amdgpu_ras_smu_get_badpage_ipid (adev, i, &ipid); +if (ret) +return ret; + + ret =amdgpu_ras_smu_get_timestamp (adev, i, &ts); +if (ret) +return ret; + + record[i - rec_idx].address = mca; +/* retired_page (pa) is unused now */ + record[i - rec_idx].retired_page =0x1ULL ; + record[i - rec_idx].ts = ts; + record[i - rec_idx].err_type =AMDGPU_RAS_EEPROM_ERR_NON_RECOVERABLE ; + record[i - rec_idx].cu =0 ; + +if (adev->umc.ras->mca_ipid_parse) + adev->umc.ras->mca_ipid_parse (adev, ipid,NULL , + (uint32_t *)&(record[i - rec_idx].mem_channel), + (uint32_t *)&(record[i - rec_idx].mcumc_id),NULL ); +else +return -EOPNOTSUPP ; + } + +return 0 ; +} +/** * amdgpu_ras_eeprom_read -- read EEPROM * @control: pointer to control structure
@@ -991,6 +1035,9 @@ int amdgpu_ras_eeprom_read(struct amdgpu_ras_eeprom_control *control,u8 *buf, *pp;u32 g0, g1; +if (amdgpu_ras_smu_eeprom_supported (adev)) +return amdgpu_ras_eeprom_read_idx (control, record,0 , num); +if (!__is_ras_eeprom_supported (adev))return 0 ;
@@ -1162,6 +1209,10 @@ static ssize_t amdgpu_ras_debugfs_table_read(struct file *f, char __user *buf,int res = -EFAULT ;size_t data_len; +/* pmfw manages eeprom data by itself */ +if (amdgpu_ras_smu_eeprom_supported (adev)) +return 0 ; +mutex_lock (&control->ras_tbl_mutex);/* We want *pos - data_len > 0, which means there's
drivers/gpu/drm/amd/amdgpu/amdgpu_ras_eeprom.h +4 -0
@@ -186,6 +186,10 @@ int amdgpu_ras_smu_get_badpage_ipid(struct amdgpu_device *adev,int amdgpu_ras_smu_erase_ras_table (struct amdgpu_device *adev,uint32_t *result); +int amdgpu_ras_eeprom_read_idx (struct amdgpu_ras_eeprom_control *control, +struct eeprom_table_record *record,u32 rec_idx, +const u32 num); +extern const struct file_operations amdgpu_ras_debugfs_eeprom_size_ops;extern const struct file_operations amdgpu_ras_debugfs_eeprom_table_ops;
Signature · 1 line
2.34.1
RE: [PATCH 2/8] drm/amdgpu: add ras_eeprom_read_idx interface
[AMD Official Use Only - AMD Internal Distribution Only]
+ if (adev->umc.ras->mca_ipid_parse)
+ adev->umc.ras->mca_ipid_parse(adev, ipid, NULL,
+ (uint32_t *)&(record[i - rec_idx].mem_channel),
+ (uint32_t *)&(record[i - rec_idx].mcumc_id), NULL);
+ else
+ return -EOPNOTSUPP;
It is better to remove the null pointer check from the loop and perform this check in the early stages to avoid unnecessary operations With that fixed, the patch is
Best Regards,
Kevin
-----Original Message-----
From: amd-gfx <[email protected]> On Behalf Of Tao Zhou
Sent: Wednesday, November 5, 2025 10:05
To: [email protected]
Cc: Zhou1, Tao <[email protected]>
Subject: [PATCH 2/8] drm/amdgpu: add ras_eeprom_read_idx interface
PMFW will manage RAS eeprom data by itself, add new interface to read eeprom data via PMFW, we can read part of records by setting index.
v2: use IPID parse interface.
pa is not used and set it to a fixed value.
--- .../gpu/drm/amd/amdgpu/amdgpu_ras_eeprom.c | 51 +++++++++++++++++++ .../gpu/drm/amd/amdgpu/amdgpu_ras_eeprom.h | 4 ++ 2 files changed, 55 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_ras_eeprom.c +44 -0
@@ -970,6 +970,50 @@ static int __amdgpu_ras_eeprom_read(struct amdgpu_ras_eeprom_control *control,return res; } +int amdgpu_ras_eeprom_read_idx (struct amdgpu_ras_eeprom_control *control, +struct eeprom_table_record *record,u32 rec_idx, +const u32 num) +{ +struct amdgpu_device *adev =to_amdgpu_device (control); +uint64_t ts, end_idx; +int i, ret; +u64 mca, ipid; + +if (!amdgpu_ras_smu_eeprom_supported (adev)) +return 0 ; + + end_idx = rec_idx + num; +for (i = rec_idx; i < end_idx; i++) { + ret =amdgpu_ras_smu_get_badpage_mca_addr (adev, i, &mca); +if (ret) +return ret; + + ret =amdgpu_ras_smu_get_badpage_ipid (adev, i, &ipid); +if (ret) +return ret; + + ret =amdgpu_ras_smu_get_timestamp (adev, i, &ts); +if (ret) +return ret; + + record[i - rec_idx].address = mca; +/* retired_page (pa) is unused now */ + record[i - rec_idx].retired_page =0x1ULL ; + record[i - rec_idx].ts = ts; + record[i - rec_idx].err_type =AMDGPU_RAS_EEPROM_ERR_NON_RECOVERABLE ; + record[i - rec_idx].cu =0 ; + +if (adev->umc.ras->mca_ipid_parse) + adev->umc.ras->mca_ipid_parse (adev, ipid,NULL , + (uint32_t *)&(record[i - rec_idx].mem_channel), + (uint32_t *)&(record[i - rec_idx].mcumc_id),NULL ); +else +return -EOPNOTSUPP ; + } + +return 0 ; +} +/** * amdgpu_ras_eeprom_read -- read EEPROM * @control: pointer to control structure @@ -991,6 +1035,9 @@ int amdgpu_ras_eeprom_read(struct amdgpu_ras_eeprom_control *control,
u8 *buf, *pp;
u32 g0, g1;+ if (amdgpu_ras_smu_eeprom_supported(adev))
+ return amdgpu_ras_eeprom_read_idx(control, record, 0, num);
+
if (!__is_ras_eeprom_supported(adev))
return 0;@@ -1162,6 +1209,10 @@ static ssize_t amdgpu_ras_debugfs_table_read(struct file *f, char __user *buf,
int res = -EFAULT;
size_t data_len;+ /* pmfw manages eeprom data by itself */
+ if (amdgpu_ras_smu_eeprom_supported(adev))
+ return 0;
+
mutex_lock(&control->ras_tbl_mutex);
/* We want *pos - data_len > 0, which means there's diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ras_eeprom.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_ras_eeprom.hindex cfbd402ddea2..e881007f715b 100644
drivers/gpu/drm/amd/amdgpu/amdgpu_ras_eeprom.h +4 -1
@@ -186,6 +186,10 @@ int amdgpu_ras_smu_get_badpage_ipid(struct amdgpu_device *adev, int amdgpu_ras_smu_erase_ras_table(struct amdgpu_device *adev, uint32_t *result); +int amdgpu_ras_eeprom_read_idx (struct amdgpu_ras_eeprom_control *control, +struct eeprom_table_record *record,u32 rec_idx, +const u32 num); +extern const struct file_operations amdgpu_ras_debugfs_eeprom_size_ops;extern const struct file_operations amdgpu_ras_debugfs_eeprom_table_ops; --
2.34.1
RE: [PATCH 2/8] drm/amdgpu: add ras_eeprom_read_idx interface
[AMD Official Use Only - AMD Internal Distribution Only]
Quoted 17 lines
-----Original Message-----
From: Wang, Yang(Kevin) <[email protected]>
Sent: Wednesday, November 5, 2025 11:18 AM
To: Zhou1, Tao <[email protected]>; [email protected]
Cc: Zhou1, Tao <[email protected]>
Subject: RE: [PATCH 2/8] drm/amdgpu: addras_eeprom_read_idxinterface[AMD Official Use Only - AMD Internal Distribution Only]
drivers/gpu/drm/amd/amdgpu/amdgpu_ras_eeprom.c +6
-0+if (adev->umc.ras->mca_ipid_parse) + adev->umc.ras->mca_ipid_parse (adev, ipid,NULL , + (uint32_t *)&(record[i - rec_idx].mem_channel), + (uint32_t *)&(record[i - rec_idx].mcumc_id),NULL ); +else +return -EOPNOTSUPP ;
Quoted 7 lines
It is better to remove the null pointer check from the loop and perform this check in the early stages to avoid unnecessary operations With that fixed, the patch is
Reviewed-by Yang Wang <[email protected]>Best Regards,
Kevin
[Tao] thanks for the suggestion, will update it.
Quoted 121 lines
-----Original Message-----
From: amd-gfx <[email protected]> On Behalf Of Tao Zhou
Sent: Wednesday, November 5, 2025 10:05
To: [email protected]
Cc: Zhou1, Tao <[email protected]>
Subject: [PATCH 2/8] drm/amdgpu: addras_eeprom_read_idxinterfacePMFW will manage RAS eeprom data by itself, add new interface to read eeprom data via PMFW, we can read part of records by setting index.
v2: use IPID parse interface.
pa is not used and set it to a fixed value.Signed-off-by Tao Zhou <[email protected]>--- .../gpu/drm/amd/amdgpu/amdgpu_ras_eeprom.c | 51 +++++++++++++++++++ .../gpu/drm/amd/amdgpu/amdgpu_ras_eeprom.h | 4 ++ 2 files changed, 55 insertions(+)drivers/gpu/drm/amd/amdgpu/amdgpu_ras_eeprom.c +44
-0@@ -970,6 +970,50 @@ static int __amdgpu_ras_eeprom_read(structamdgpu_ras_eeprom_control *control, return res; } +int amdgpu_ras_eeprom_read_idx (struct amdgpu_ras_eeprom_control *control, +struct eeprom_table_record *record,u32 rec_idx, +const u32 num) +{ +struct amdgpu_device *adev =to_amdgpu_device (control); +uint64_t ts, end_idx; +int i, ret; +u64 mca, ipid; + +if (!amdgpu_ras_smu_eeprom_supported (adev)) +return 0 ; + + end_idx = rec_idx + num; +for (i = rec_idx; i < end_idx; i++) { + ret =amdgpu_ras_smu_get_badpage_mca_addr (adev, i, &mca); +if (ret) +return ret; + + ret =amdgpu_ras_smu_get_badpage_ipid (adev, i, &ipid); +if (ret) +return ret; + + ret =amdgpu_ras_smu_get_timestamp (adev, i, &ts); +if (ret) +return ret; + + record[i - rec_idx].address = mca; +/* retired_page (pa) is unused now */ + record[i - rec_idx].retired_page =0x1ULL ; + record[i - rec_idx].ts = ts; + record[i - rec_idx].err_type =AMDGPU_RAS_EEPROM_ERR_NON_RECOVERABLE ; + record[i - rec_idx].cu =0 ; + +if (adev->umc.ras->mca_ipid_parse) + adev->umc.ras->mca_ipid_parse (adev, ipid,NULL , + (uint32_t *)&(record[i - rec_idx].mem_channel), + (uint32_t *)&(record[i - rec_idx].mcumc_id),NULL ); +else +return -EOPNOTSUPP ; + } + +return 0 ; +} +/** *
amdgpu_ras_eeprom_read-- read EEPROM
* @control: pointer to control structure @@ -991,6 +1035,9 @@ int
amdgpu_ras_eeprom_read(structamdgpu_ras_eeprom_control*control,u8 *buf, *pp; u32 g0, g1;drivers/gpu/drm/amd/amdgpu/amdgpu_ras_eeprom.c +8
-0+if (amdgpu_ras_smu_eeprom_supported (adev)) +return amdgpu_ras_eeprom_read_idx (control, record,0 , + num); +if (!__is_ras_eeprom_supported (adev))return 0 ;@@ -1162,6 +1209,10 @@ static ssize_t amdgpu_ras_debugfs_table_read(struct file *f, char__user *buf, int res = -EFAULT;size_t data_len; +/* pmfw manages eeprom data by itself */ +if (amdgpu_ras_smu_eeprom_supported (adev)) +return 0 ; +mutex_lock (&control->ras_tbl_mutex);/* We want *pos - data_len > 0, which means there's diff --git
a/drivers/gpu/drm/amd/amdgpu/amdgpu_ras_eeprom.hb/drivers/gpu/drm/amd/amdgpu/amdgpu_ras_eeprom.h
indexcfbd402ddea2..e881007f715b100644drivers/gpu/drm/amd/amdgpu/amdgpu_ras_eeprom.h +0
-0@@ -186,6 +186,10 @@ int amdgpu_ras_smu_get_badpage_ipid(struct
amdgpu_device*adev, int amdgpu_ras_smu_erase_ras_table(structamdgpu_device*adev,uint32_t *result);drivers/gpu/drm/amd/amdgpu/amdgpu_ras_eeprom.h +4
-1+int amdgpu_ras_eeprom_read_idx (struct amdgpu_ras_eeprom_control *control, +struct eeprom_table_record *record,u32 rec_idx, +const u32 num); +extern const struct file_operations amdgpu_ras_debugfs_eeprom_size_ops;extern const struct file_operations amdgpu_ras_debugfs_eeprom_table_ops; --2.34.1
PATCH 3/8 drm/amdgpu: support to load RAS bad pages from PMFW
In reply to Tao ZhouPMFW manages eeprom bad page records, update bad page loading accrodingly.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c +10 -4
@@ -3154,8 +3154,12 @@ static int __amdgpu_ras_convert_rec_from_rom(struct amdgpu_device *adev,int i =0 ;enum amdgpu_memory_partition save_nps; - save_nps = (bps->retired_page >>UMC_NPS_SHIFT ) &UMC_NPS_MASK ; - bps->retired_page &= ~(UMC_NPS_MASK <<UMC_NPS_SHIFT ); +if (!amdgpu_ras_smu_eeprom_supported (adev)) { + save_nps = (bps->retired_page >>UMC_NPS_SHIFT ) &UMC_NPS_MASK ; + bps->retired_page &= ~(UMC_NPS_MASK <<UMC_NPS_SHIFT ); + }else { + save_nps = nps; + }if (save_nps == nps) { if (amdgpu_umc_pages_in_a_row(adev, err_data,
@@ -3221,7 +3225,8 @@ int amdgpu_ras_add_bad_pages(struct amdgpu_device *adev,if (from_rom) {/* there is no pa recs in V3, so skip pa recs processing */ -if (control->tbl_hdr.version <RAS_TABLE_VER_V3 ) { +if ((control->tbl_hdr.version <RAS_TABLE_VER_V3 ) && + !amdgpu_ras_smu_eeprom_supported (adev)) {for (i =0 ; i < pages; i++) {if (control->ras_num_recs - i >= adev->umc.retire_unit) { if ((bps[i].address == bps[i + 1].address) &&
@@ -3352,7 +3357,8 @@ static int amdgpu_ras_load_bad_pages(struct amdgpu_device *adev)/*In V3, there is no pa recs, and some cases(when address==0) may be parsed as pa recs, so add verion check to avoid it. */ -if (control->tbl_hdr.version <RAS_TABLE_VER_V3 ) { +if ((control->tbl_hdr.version <RAS_TABLE_VER_V3 ) && + !amdgpu_ras_smu_eeprom_supported (adev)) {for (i =0 ; i < control->ras_num_recs; i++) {if ((control->ras_num_recs - i) >= adev->umc.retire_unit) { if ((bps[i].address == bps[i + 1].address) &&
Signature · 1 line
2.34.1
PATCH 4/8 drm/amdgpu: skip writing eeprom when PMFW manages RAS data
In reply to Tao ZhouOnly update bad page number in legacy eeprom write path.
v2: add null pointer check for con.
--- .../gpu/drm/amd/amdgpu/amdgpu_ras_eeprom.c | 20 ++++++++++++++++++- .../gpu/drm/amd/amdgpu/amdgpu_ras_eeprom.h | 3 +++ 2 files changed, 22 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_ras_eeprom.c +19 -1
@@ -871,6 +871,18 @@ amdgpu_ras_eeprom_update_header(struct amdgpu_ras_eeprom_control *control)return res; } +int amdgpu_ras_eeprom_update_record_num (struct amdgpu_ras_eeprom_control *control) +{ +struct amdgpu_device *adev =to_amdgpu_device (control); + +if (!amdgpu_ras_smu_eeprom_supported (adev)) +return 0 ; + + control->ras_num_recs_old = control->ras_num_recs; +return amdgpu_ras_smu_get_badpage_count (adev, + &(control->ras_num_recs),12 ); +} +/** * amdgpu_ras_eeprom_append -- append records to the EEPROM RAS table * @control: pointer to control structure
@@ -889,12 +901,18 @@ int amdgpu_ras_eeprom_append(struct amdgpu_ras_eeprom_control *control, const u32 num) {struct amdgpu_device *adev =to_amdgpu_device (control); +struct amdgpu_ras *con =amdgpu_ras_get_context (adev);int res, i;uint64_t nps =AMDGPU_NPS1_PARTITION_MODE ; -if (!__is_ras_eeprom_supported (adev)) +if (!__is_ras_eeprom_supported (adev) || !con)return 0 ; +if (amdgpu_ras_smu_eeprom_supported (adev)) { + control->ras_num_bad_pages = con->bad_page_num; +return 0 ; + } +if (num ==0 ) {dev_err (adev->dev,"will not append 0 records\n" );return -EINVAL ;
drivers/gpu/drm/amd/amdgpu/amdgpu_ras_eeprom.h +3 -0
@@ -82,6 +82,7 @@ struct amdgpu_ras_eeprom_control {/* Number of records in the table. */ u32 ras_num_recs; +u32 ras_num_recs_old;/* the bad page number is ras_num_recs or * ras_num_recs * umc.retire_unit
@@ -190,6 +191,8 @@ int amdgpu_ras_eeprom_read_idx(struct amdgpu_ras_eeprom_control *control, struct eeprom_table_record *record, u32 rec_idx, const u32 num); +int amdgpu_ras_eeprom_update_record_num (struct amdgpu_ras_eeprom_control *control); +extern const struct file_operations amdgpu_ras_debugfs_eeprom_size_ops;extern const struct file_operations amdgpu_ras_debugfs_eeprom_table_ops;
Signature · 1 line
2.34.1
PATCH 5/8 drm/amdgpu: load RAS bad page from PMFW in page retirement
In reply to Tao ZhouIn legacy way, bad page is queried from MCA registers, switch to getting it from PMFW when PMFW manages eeprom data.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c | 8 +- drivers/gpu/drm/amd/amdgpu/amdgpu_umc.c | 137 ++++++++++++++---------- 2 files changed, 90 insertions(+), 55 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c +7 -1
@@ -3296,7 +3296,13 @@ int amdgpu_ras_save_bad_pages(struct amdgpu_device *adev,mutex_lock (&con->recovery_lock); control = &con->eeprom_control; data = con->eh_data; - unit_num = data->count / adev->umc.retire_unit - control->ras_num_recs; +if (amdgpu_ras_smu_eeprom_supported (adev)) + unit_num = control->ras_num_recs - + control->ras_num_recs_old; +else + unit_num = data->count / adev->umc.retire_unit - + control->ras_num_recs; + save_count = con->bad_page_num - control->ras_num_bad_pages;mutex_unlock (&con->recovery_lock);
drivers/gpu/drm/amd/amdgpu/amdgpu_umc.c +83 -54
157 lines not on this page · raw message
Signature · 1 line
2.34.1
PATCH 6/8 drm/amdgpu: get RAS bad page address from MCA address
In reply to Tao ZhouInstead of from physical address.
v2: add comment to make the code more readable
--- drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c | 15 ++++++++++++--- drivers/gpu/drm/amd/amdgpu/amdgpu_ras_eeprom.c | 4 ++-- 2 files changed, 14 insertions(+), 5 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c +12 -3
@@ -3010,8 +3010,13 @@ static int amdgpu_ras_mca2pa_by_idx(struct amdgpu_device *adev, addr_in.ma.err_addr = bps->address; addr_in.ma.socket_id = socket; addr_in.ma.ch_inst = bps->mem_channel; -/* tell RAS TA the node instance is not used */ - addr_in.ma.node_inst =TA_RAS_INV_NODE ; +if (!amdgpu_ras_smu_eeprom_supported (adev)) { +/* tell RAS TA the node instance is not used */ + addr_in.ma.node_inst =TA_RAS_INV_NODE ; + }else { + addr_in.ma.umc_inst = bps->mcumc_id; + addr_in.ma.node_inst = bps->cu; + }if (adev->umc.ras && adev->umc.ras->convert_ras_err_addr) ret = adev->umc.ras->convert_ras_err_addr(adev, err_data,
@@ -3158,7 +3163,11 @@ static int __amdgpu_ras_convert_rec_from_rom(struct amdgpu_device *adev, save_nps = (bps->retired_page >>UMC_NPS_SHIFT ) &UMC_NPS_MASK ; bps->retired_page &= ~(UMC_NPS_MASK <<UMC_NPS_SHIFT ); }else { - save_nps = nps; +/* if pmfw manages eeprom, save_nps is not stored on eeprom, +* we should always convert mca address into physical address, +* make save_nps different from nps +*/ + save_nps = nps +1 ; }if (save_nps == nps) {
drivers/gpu/drm/amd/amdgpu/amdgpu_ras_eeprom.c +2 -2
@@ -1019,10 +1019,10 @@ int amdgpu_ras_eeprom_read_idx(struct amdgpu_ras_eeprom_control *control, record[i - rec_idx].retired_page =0x1ULL ; record[i - rec_idx].ts = ts; record[i - rec_idx].err_type =AMDGPU_RAS_EEPROM_ERR_NON_RECOVERABLE ; - record[i - rec_idx].cu =0 ;if (adev->umc.ras->mca_ipid_parse) - adev->umc.ras->mca_ipid_parse (adev, ipid,NULL , + adev->umc.ras->mca_ipid_parse (adev, ipid, + (uint32_t *)&(record[i - rec_idx].cu), (uint32_t *)&(record[i - rec_idx].mem_channel), (uint32_t *)&(record[i - rec_idx].mcumc_id),NULL );else
Signature · 1 line
2.34.1
PATCH 7/8 drm/amdgpu: try for more times if RAS bad page number is not updated
In reply to Tao ZhouRAS info update in PMFW is time cost, wait for it.
--- .../gpu/drm/amd/amdgpu/amdgpu_ras_eeprom.c | 22 ++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_ras_eeprom.c +21 -1
@@ -874,13 +874,33 @@ amdgpu_ras_eeprom_update_header(struct amdgpu_ras_eeprom_control *control)int amdgpu_ras_eeprom_update_record_num (struct amdgpu_ras_eeprom_control *control) {struct amdgpu_device *adev =to_amdgpu_device (control); +int ret, timeout =1000 ;if (!amdgpu_ras_smu_eeprom_supported (adev))return 0 ; control->ras_num_recs_old = control->ras_num_recs; -return amdgpu_ras_smu_get_badpage_count (adev, + +do { + ret =amdgpu_ras_smu_get_badpage_count (adev, &(control->ras_num_recs),12 ); +if (!ret && + (control->ras_num_recs_old == control->ras_num_recs)) { +/* record number update in PMFW needs some time */ +msleep (50 ); + timeout -=50 ; + }else { +break ; + } + }while (timeout); + +/* no update of record number is not a real failure, +* don't print warning here +*/ +if (!ret && (control->ras_num_recs_old == control->ras_num_recs)) + ret = -EINVAL ; + +return ret; }/**
Signature · 1 line
2.34.1
PATCH 8/8 drm/amdgpu: add RAS bad page threshold handling for PMFW manages eeprom
In reply to Tao ZhouCheck if bad page threshold is reached and take actions accordingly.
v2: remove rma message sent to smu when pmfw manages eeprom.
v3: add null pointer check for con.
--- .../gpu/drm/amd/amdgpu/amdgpu_ras_eeprom.c | 36 +++++++++++++++---- 1 file changed, 30 insertions(+), 6 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_ras_eeprom.c +30 -6
@@ -903,6 +903,33 @@ int amdgpu_ras_eeprom_update_record_num(struct amdgpu_ras_eeprom_control *controreturn ret; } +static int amdgpu_ras_smu_eeprom_append (struct amdgpu_ras_eeprom_control *control) +{ +struct amdgpu_device *adev =to_amdgpu_device (control); +struct amdgpu_ras *con =amdgpu_ras_get_context (adev); + +if (!amdgpu_ras_smu_eeprom_supported (adev) || !con) +return 0 ; + + control->ras_num_bad_pages = con->bad_page_num; + +if (amdgpu_bad_page_threshold !=0 && + control->ras_num_bad_pages > con->bad_page_cnt_threshold) { +dev_warn (adev->dev, +"Saved bad pages %d reaches threshold value %d\n" , + control->ras_num_bad_pages, con->bad_page_cnt_threshold); + +if (adev->cper.enabled &&amdgpu_cper_generate_bp_threshold_record (adev)) +dev_warn (adev->dev,"fail to generate bad page threshold cper records\n" ); + +if ((amdgpu_bad_page_threshold !=-1 ) && + (amdgpu_bad_page_threshold !=-2 )) + con->is_rma = true; + } + +return 0 ; +} +/** * amdgpu_ras_eeprom_append -- append records to the EEPROM RAS table * @control: pointer to control structure
@@ -921,17 +948,14 @@ int amdgpu_ras_eeprom_append(struct amdgpu_ras_eeprom_control *control, const u32 num) {struct amdgpu_device *adev =to_amdgpu_device (control); -struct amdgpu_ras *con =amdgpu_ras_get_context (adev);int res, i;uint64_t nps =AMDGPU_NPS1_PARTITION_MODE ; -if (!__is_ras_eeprom_supported (adev) || !con) +if (!__is_ras_eeprom_supported (adev))return 0 ; -if (amdgpu_ras_smu_eeprom_supported (adev)) { - control->ras_num_bad_pages = con->bad_page_num; -return 0 ; - } +if (amdgpu_ras_smu_eeprom_supported (adev)) +return amdgpu_ras_smu_eeprom_append (control);if (num ==0 ) {dev_err (adev->dev,"will not append 0 records\n" );
Signature · 1 line
2.34.1
RE: [PATCH 8/8] drm/amdgpu: add RAS bad page threshold handling for PMFW manages eeprom
[AMD Official Use Only - AMD Internal Distribution Only]
Series is
Regards,
Hawking
-----Original Message-----
From: amd-gfx <[email protected]> On Behalf Of Tao Zhou
Sent: Wednesday, November 5, 2025 10:05
To: [email protected]
Cc: Zhou1, Tao <[email protected]>
Subject: [PATCH 8/8] drm/amdgpu: add RAS bad page threshold handling for PMFW manages eeprom
Check if bad page threshold is reached and take actions accordingly.
v2: remove rma message sent to smu when pmfw manages eeprom.
v3: add null pointer check for con.
--- .../gpu/drm/amd/amdgpu/amdgpu_ras_eeprom.c | 36 +++++++++++++++---- 1 file changed, 30 insertions(+), 6 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_ras_eeprom.c +28 -0
@@ -903,6 +903,33 @@ int amdgpu_ras_eeprom_update_record_num(struct amdgpu_ras_eeprom_control *controreturn ret; } +static int amdgpu_ras_smu_eeprom_append (struct +amdgpu_ras_eeprom_control *control) { +struct amdgpu_device *adev =to_amdgpu_device (control); +struct amdgpu_ras *con =amdgpu_ras_get_context (adev); + +if (!amdgpu_ras_smu_eeprom_supported (adev) || !con) +return 0 ; + + control->ras_num_bad_pages = con->bad_page_num; + +if (amdgpu_bad_page_threshold !=0 && + control->ras_num_bad_pages > con->bad_page_cnt_threshold) { +dev_warn (adev->dev, +"Saved bad pages %d reaches threshold value %d\n" , + control->ras_num_bad_pages, con->bad_page_cnt_threshold); + +if (adev->cper.enabled &&amdgpu_cper_generate_bp_threshold_record (adev)) +dev_warn (adev->dev,"fail to generate bad page threshold cper +records\n"); + +if ((amdgpu_bad_page_threshold !=-1 ) && + (amdgpu_bad_page_threshold !=-2 )) + con->is_rma = true; + } + +return 0 ; +} +/** * amdgpu_ras_eeprom_append -- append records to the EEPROM RAS table
* @control: pointer to control structure @@ -921,17 +948,14 @@ int amdgpu_ras_eeprom_append(struct amdgpu_ras_eeprom_control *control, const u32 num)
{
struct amdgpu_device *adev = to_amdgpu_device(control);
- struct amdgpu_ras *con = amdgpu_ras_get_context(adev);
int res, i;
uint64_t nps = AMDGPU_NPS1_PARTITION_MODE;- if (!__is_ras_eeprom_supported(adev) || !con)
+ if (!__is_ras_eeprom_supported(adev))
return 0;
- if (amdgpu_ras_smu_eeprom_supported(adev)) {
- control->ras_num_bad_pages = con->bad_page_num;
- return 0;
- }
+ if (amdgpu_ras_smu_eeprom_supported(adev))
+ return amdgpu_ras_smu_eeprom_append(control);
if (num == 0) {
dev_err(adev->dev, "will not append 0 records\n");--
2.34.1