drm/amdgpu: store PA with column bits cleared for RAS bad page
authorTao Zhou <tao.zhou1@amd.com>
Thu, 17 Oct 2024 03:56:12 +0000 (11:56 +0800)
committerAlex Deucher <alexander.deucher@amd.com>
Tue, 10 Dec 2024 15:26:45 +0000 (10:26 -0500)
So the code can be simplified, and no need to expose the detail of PA
format outside address conversion.

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>
drivers/gpu/drm/amd/amdgpu/umc_v12_0.c
drivers/gpu/drm/amd/amdgpu/umc_v12_0.h

index 523ca830e9ac39202dafb8107f5a49bf5d511ceb..ffc0b7d93d6fc7c55c2727ef527773ca683e4bba 100644 (file)
@@ -219,6 +219,8 @@ static void umc_v12_0_convert_error_address(struct amdgpu_device *adev,
        /* clear [R13] in soc physical address */
        soc_pa &= ~(0x1ULL << UMC_V12_0_PA_R13_BIT);
 
+       paddr_out->pa.pa = soc_pa;
+
        /* loop for all possibilities of [R13 C4 C3 C2] */
        for (column = 0; column < UMC_V12_0_BAD_PAGE_NUM_PER_CHANNEL; column++) {
                retired_page = soc_pa | ((column & 0x3) << UMC_V12_0_PA_C2_BIT);
@@ -537,7 +539,7 @@ static int umc_v12_0_update_ecc_status(struct amdgpu_device *adev,
        ecc_err->status = status;
        ecc_err->ipid = ipid;
        ecc_err->addr = addr;
-       ecc_err->pa_pfn = UMC_V12_ADDR_MASK_BAD_COLS(pa_addr) >> AMDGPU_GPU_PAGE_SHIFT;
+       ecc_err->pa_pfn = pa_addr >> AMDGPU_GPU_PAGE_SHIFT;
 
        /* If converted pa_pfn is 0, use pa C4 pfn. */
        if (!ecc_err->pa_pfn)
index dea42810fc53c73ce07a43952e57327f7de7dfae..f0074abb5381a0c8bc4988f7611849bcab7a0a1e 100644 (file)
        (((REG_GET_FIELD(ipid, MCMP1_IPIDT0, InstanceIdLo) & 0x1) << 2) | \
         (REG_GET_FIELD(ipid, MCMP1_IPIDT0, InstanceIdHi) & 0x03))
 
-#define UMC_V12_ADDR_MASK_BAD_COLS(addr) \
-       ((addr) & ~((0x3ULL << UMC_V12_0_PA_C2_BIT) | \
-                       (0x1ULL << UMC_V12_0_PA_C4_BIT) | \
-                       (0x1ULL << UMC_V12_0_PA_R13_BIT)))
-
 bool umc_v12_0_is_deferred_error(struct amdgpu_device *adev, uint64_t mc_umc_status);
 bool umc_v12_0_is_uncorrectable_error(struct amdgpu_device *adev, uint64_t mc_umc_status);
 bool umc_v12_0_is_correctable_error(struct amdgpu_device *adev, uint64_t mc_umc_status);