summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTao Zhou <tao.zhou1@amd.com>2022-10-17 18:26:17 +0800
committerAlex Deucher <alexander.deucher@amd.com>2022-10-27 15:12:08 -0400
commit24b822928b5139b85ee9a818a65e343b7e3bb4fe (patch)
tree3cb4f4924fc3f891c9f3bd562d98e6e7e3a7eda7
parentcbe4d43ea5e903ae3e8555cc39047b0ed027738a (diff)
downloadlinux-24b822928b5139b85ee9a818a65e343b7e3bb4fe.tar.bz2
drm/amdgpu: use page retirement API in MCA notifier
Make the code more readable. 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>
-rw-r--r--drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c36
1 files changed, 3 insertions, 33 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c
index 21a47f2bb87b..28463b47ce33 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c
@@ -36,7 +36,6 @@
#include "ivsrcid/nbio/irqsrcs_nbif_7_4.h"
#include "atom.h"
#include "amdgpu_reset.h"
-#include "umc_v6_7.h"
#ifdef CONFIG_X86_MCE_AMD
#include <asm/mce.h>
@@ -2849,7 +2848,6 @@ static int amdgpu_bad_page_notifier(struct notifier_block *nb,
struct amdgpu_device *adev = NULL;
uint32_t gpu_id = 0;
uint32_t umc_inst = 0, ch_inst = 0;
- struct ras_err_data err_data = {0, 0, 0, NULL};
/*
* If the error was generated in UMC_V2, which belongs to GPU UMCs,
@@ -2888,38 +2886,10 @@ 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 record in mca notifier!\n");
- return NOTIFY_DONE;
- }
-
- /*
- * Translate UMC channel address to Physical address
- */
- switch (adev->ip_versions[UMC_HWIP][0]) {
- case IP_VERSION(6, 7, 0):
- umc_v6_7_convert_error_address(adev,
- &err_data, m->addr, ch_inst, umc_inst);
- break;
- default:
- dev_warn(adev->dev,
- "UMC address to Physical address translation is not supported\n");
- kfree(err_data.err_addr);
+ if (!amdgpu_umc_page_retirement_mca(adev, m->addr, ch_inst, umc_inst))
+ return NOTIFY_OK;
+ else
return NOTIFY_DONE;
- }
-
- if (amdgpu_bad_page_threshold != 0) {
- amdgpu_ras_add_bad_pages(adev, err_data.err_addr,
- err_data.err_addr_cnt);
- amdgpu_ras_save_bad_pages(adev);
- }
-
- kfree(err_data.err_addr);
- return NOTIFY_OK;
}
static struct notifier_block amdgpu_bad_page_nb = {