drm/amdgpu: use RAS error address convert api in mca notifier
Use the convert interface to simplify code. Signed-off-by: Tao Zhou <tao.zhou1@amd.com> Reviewed-by: Hawking Zhang <Hawking.Zhang@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
This commit is contained in:
parent
1014bd1cb3
commit
cd4c99f103
@ -2834,11 +2834,8 @@ static int amdgpu_bad_page_notifier(struct notifier_block *nb,
|
||||
struct mce *m = (struct mce *)data;
|
||||
struct amdgpu_device *adev = NULL;
|
||||
uint32_t gpu_id = 0;
|
||||
uint32_t umc_inst = 0;
|
||||
uint32_t ch_inst, channel_index = 0;
|
||||
uint32_t umc_inst = 0, ch_inst = 0;
|
||||
struct ras_err_data err_data = {0, 0, 0, NULL};
|
||||
struct eeprom_table_record err_rec;
|
||||
uint64_t retired_page;
|
||||
|
||||
/*
|
||||
* If the error was generated in UMC_V2, which belongs to GPU UMCs,
|
||||
@ -2877,21 +2874,22 @@ static int amdgpu_bad_page_notifier(struct notifier_block *nb,
|
||||
dev_info(adev->dev, "Uncorrectable error detected in UMC inst: %d, chan_idx: %d",
|
||||
umc_inst, ch_inst);
|
||||
|
||||
err_data.err_addr =
|
||||
kcalloc(adev->umc.max_ras_err_cnt_per_query,
|
||||
sizeof(struct eeprom_table_record), GFP_KERNEL);
|
||||
if(!err_data.err_addr) {
|
||||
dev_warn(adev->dev, "Failed to alloc memory for "
|
||||
"umc error address record in mca notifier!\n");
|
||||
return NOTIFY_DONE;
|
||||
}
|
||||
|
||||
/*
|
||||
* Translate UMC channel address to Physical address
|
||||
*/
|
||||
channel_index =
|
||||
adev->umc.channel_idx_tbl[umc_inst * adev->umc.channel_inst_num
|
||||
+ ch_inst];
|
||||
|
||||
retired_page = ADDR_OF_8KB_BLOCK(m->addr) |
|
||||
ADDR_OF_256B_BLOCK(channel_index) |
|
||||
OFFSET_IN_256B_BLOCK(m->addr);
|
||||
|
||||
memset(&err_rec, 0x0, sizeof(struct eeprom_table_record));
|
||||
err_data.err_addr = &err_rec;
|
||||
amdgpu_umc_fill_error_record(&err_data, m->addr,
|
||||
retired_page, channel_index, umc_inst);
|
||||
if (adev->umc.ras &&
|
||||
adev->umc.ras->convert_ras_error_address)
|
||||
adev->umc.ras->convert_ras_error_address(adev,
|
||||
&err_data, 0, ch_inst, umc_inst, m->addr);
|
||||
|
||||
if (amdgpu_bad_page_threshold != 0) {
|
||||
amdgpu_ras_add_bad_pages(adev, err_data.err_addr,
|
||||
@ -2899,6 +2897,7 @@ static int amdgpu_bad_page_notifier(struct notifier_block *nb,
|
||||
amdgpu_ras_save_bad_pages(adev);
|
||||
}
|
||||
|
||||
kfree(err_data.err_addr);
|
||||
return NOTIFY_OK;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user