Skip to content

Commit 95b4063

Browse files
YiPeng Chaialexdeucher
authored andcommitted
drm/amdgpu: add interface to update umc v12_0 ecc status
Add interface to update umc v12_0 ecc status. Signed-off-by: YiPeng Chai <[email protected]> Reviewed-by: Tao Zhou <[email protected]> Signed-off-by: Alex Deucher <[email protected]>
1 parent a734adf commit 95b4063

File tree

6 files changed

+49
-0
lines changed

6 files changed

+49
-0
lines changed

drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4215,6 +4215,8 @@ void amdgpu_ras_add_mca_err_addr(struct ras_err_info *err_info, struct ras_err_a
42154215
{
42164216
struct ras_err_addr *mca_err_addr;
42174217

4218+
/* This function will be retired. */
4219+
return;
42184220
mca_err_addr = kzalloc(sizeof(*mca_err_addr), GFP_KERNEL);
42194221
if (!mca_err_addr)
42204222
return;

drivers/gpu/drm/amd/amdgpu/amdgpu_umc.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -437,3 +437,12 @@ int amdgpu_umc_loop_channels(struct amdgpu_device *adev,
437437

438438
return 0;
439439
}
440+
441+
int amdgpu_umc_update_ecc_status(struct amdgpu_device *adev,
442+
uint64_t status, uint64_t ipid, uint64_t addr)
443+
{
444+
if (adev->umc.ras->update_ecc_status)
445+
return adev->umc.ras->update_ecc_status(adev,
446+
status, ipid, addr);
447+
return 0;
448+
}

drivers/gpu/drm/amd/amdgpu/amdgpu_umc.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,8 @@ struct amdgpu_umc_ras {
6666
void *ras_error_status);
6767
bool (*check_ecc_err_status)(struct amdgpu_device *adev,
6868
enum amdgpu_mca_error_type type, void *ras_error_status);
69+
int (*update_ecc_status)(struct amdgpu_device *adev,
70+
uint64_t status, uint64_t ipid, uint64_t addr);
6971
};
7072

7173
struct amdgpu_umc_funcs {
@@ -122,4 +124,8 @@ int amdgpu_umc_loop_channels(struct amdgpu_device *adev,
122124

123125
int amdgpu_umc_bad_page_polling_timeout(struct amdgpu_device *adev,
124126
uint32_t reset, uint32_t timeout_ms);
127+
128+
int amdgpu_umc_update_ecc_status(struct amdgpu_device *adev,
129+
uint64_t status, uint64_t ipid, uint64_t addr);
130+
125131
#endif

drivers/gpu/drm/amd/amdgpu/umc_v12_0.c

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -479,6 +479,29 @@ static int umc_v12_0_ras_late_init(struct amdgpu_device *adev, struct ras_common
479479
return 0;
480480
}
481481

482+
static int umc_v12_0_update_ecc_status(struct amdgpu_device *adev,
483+
uint64_t status, uint64_t ipid, uint64_t addr)
484+
{
485+
uint16_t hwid, mcatype;
486+
struct amdgpu_ras *con = amdgpu_ras_get_context(adev);
487+
488+
hwid = REG_GET_FIELD(ipid, MCMP1_IPIDT0, HardwareID);
489+
mcatype = REG_GET_FIELD(ipid, MCMP1_IPIDT0, McaType);
490+
491+
if ((hwid != MCA_UMC_HWID_V12_0) || (mcatype != MCA_UMC_MCATYPE_V12_0))
492+
return 0;
493+
494+
if (!status)
495+
return 0;
496+
497+
if (!umc_v12_0_is_deferred_error(adev, status))
498+
return 0;
499+
500+
con->umc_ecc_log.de_updated = true;
501+
502+
return 0;
503+
}
504+
482505
struct amdgpu_umc_ras umc_v12_0_ras = {
483506
.ras_block = {
484507
.hw_ops = &umc_v12_0_ras_hw_ops,
@@ -489,5 +512,6 @@ struct amdgpu_umc_ras umc_v12_0_ras = {
489512
.ecc_info_query_ras_error_count = umc_v12_0_ecc_info_query_ras_error_count,
490513
.ecc_info_query_ras_error_address = umc_v12_0_ecc_info_query_ras_error_address,
491514
.check_ecc_err_status = umc_v12_0_check_ecc_err_status,
515+
.update_ecc_status = umc_v12_0_update_ecc_status,
492516
};
493517

drivers/gpu/drm/amd/amdgpu/umc_v12_0.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,9 @@
6262
/* row bits in SOC physical address */
6363
#define UMC_V12_0_PA_R13_BIT 35
6464

65+
#define MCA_UMC_HWID_V12_0 0x96
66+
#define MCA_UMC_MCATYPE_V12_0 0x0
67+
6568
#define MCA_IPID_LO_2_UMC_CH(_ipid_lo) (((((_ipid_lo) >> 20) & 0x1) * 4) + \
6669
(((_ipid_lo) >> 12) & 0xF))
6770
#define MCA_IPID_LO_2_UMC_INST(_ipid_lo) (((_ipid_lo) >> 21) & 0x7)

drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_6_ppt.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2716,6 +2716,11 @@ static int mca_umc_mca_get_err_count(const struct mca_ras_info *mca_ras, struct
27162716
umc_v12_0_is_correctable_error(adev, status0))
27172717
*count = (ext_error_code == 0) ? odecc_err_cnt : 1;
27182718

2719+
amdgpu_umc_update_ecc_status(adev,
2720+
entry->regs[MCA_REG_IDX_STATUS],
2721+
entry->regs[MCA_REG_IDX_IPID],
2722+
entry->regs[MCA_REG_IDX_ADDR]);
2723+
27192724
return 0;
27202725
}
27212726

0 commit comments

Comments
 (0)