Skip to content

Commit 31e837d

Browse files
ganglxiealexdeucher
authored andcommitted
drm/amdgpu: handle old RAS eeprom data in non-nps1 mode
Get MCA address from PA in nps1, then convert MCA address to PA in specific nps mode. Signed-off-by: ganglxie <[email protected]> Reviewed-by: Tao Zhou <[email protected]> Signed-off-by: Alex Deucher <[email protected]>
1 parent 90237b1 commit 31e837d

File tree

3 files changed

+39
-2
lines changed

3 files changed

+39
-2
lines changed

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

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2886,8 +2886,20 @@ static int __amdgpu_ras_convert_rec_from_rom(struct amdgpu_device *adev,
28862886
bps->retired_page << AMDGPU_GPU_PAGE_SHIFT))
28872887
return -EINVAL;
28882888
} else {
2889-
if (amdgpu_ras_mca2pa_by_idx(adev, bps, err_data))
2890-
return -EINVAL;
2889+
if (bps->address) {
2890+
if (amdgpu_ras_mca2pa_by_idx(adev, bps, err_data))
2891+
return -EINVAL;
2892+
} else {
2893+
/* for specific old eeprom data, mca address is not stored,
2894+
* calc it from pa
2895+
*/
2896+
if (amdgpu_umc_pa2mca(adev, bps->retired_page << AMDGPU_GPU_PAGE_SHIFT,
2897+
&(bps->address), AMDGPU_NPS1_PARTITION_MODE))
2898+
return -EINVAL;
2899+
2900+
if (amdgpu_ras_mca2pa(adev, bps, err_data))
2901+
return -EOPNOTSUPP;
2902+
}
28912903
}
28922904

28932905
return __amdgpu_ras_restore_bad_pages(adev, err_data->err_addr,

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

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -562,3 +562,26 @@ int amdgpu_umc_mca_to_addr(struct amdgpu_device *adev,
562562

563563
return 0;
564564
}
565+
566+
int amdgpu_umc_pa2mca(struct amdgpu_device *adev,
567+
uint64_t pa, uint64_t *mca, enum amdgpu_memory_partition nps)
568+
{
569+
struct ta_ras_query_address_input addr_in;
570+
struct ta_ras_query_address_output addr_out;
571+
int ret;
572+
573+
/* nps: the pa belongs to */
574+
addr_in.pa.pa = pa | ((uint64_t)nps << 58);
575+
addr_in.addr_type = TA_RAS_PA_TO_MCA;
576+
ret = psp_ras_query_address(&adev->psp, &addr_in, &addr_out);
577+
if (ret) {
578+
dev_warn(adev->dev, "Failed to query RAS MCA address for 0x%llx",
579+
pa);
580+
581+
return ret;
582+
}
583+
584+
*mca = addr_out.ma.err_addr;
585+
586+
return 0;
587+
}

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -189,4 +189,6 @@ int amdgpu_umc_mca_to_addr(struct amdgpu_device *adev,
189189
uint64_t err_addr, uint32_t ch, uint32_t umc,
190190
uint32_t node, uint32_t socket,
191191
struct ta_ras_query_address_output *addr_out, bool dump_addr);
192+
int amdgpu_umc_pa2mca(struct amdgpu_device *adev,
193+
uint64_t pa, uint64_t *mca, enum amdgpu_memory_partition nps);
192194
#endif

0 commit comments

Comments
 (0)