Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

drm/amdgpu: set flip bits for RAS bad pages

Make the code more general, user doesn't need to pay attention to the
detail of flip bits setting.

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>

authored by

Tao Zhou and committed by
Alex Deucher
dc111f8f 7e340d3c

+7 -13
+7 -13
drivers/gpu/drm/amd/amdgpu/umc_v12_0.c
··· 283 283 col_lower = (err_addr >> 1) & 0x3ULL; 284 284 /* extra row bit will be handled later */ 285 285 row_lower = (err_addr >> UMC_V12_0_MA_R0_BIT) & 0x1fffULL; 286 + row_lower &= ~BIT_ULL(adev->umc.flip_bits.flip_row_bit); 286 287 287 288 if (amdgpu_ip_version(adev, GC_HWIP, 0) >= IP_VERSION(9, 5, 0)) { 288 - row_high = (soc_pa >> UMC_V12_0_PA_R13_BIT) & 0x3ULL; 289 + row_high = (soc_pa >> adev->umc.flip_bits.r13_in_pa) & 0x3ULL; 289 290 /* it's 2.25GB in each channel, from MCA address to PA 290 291 * [R14 R13] is converted if the two bits value are 0x3, 291 292 * get them from PA instead of MCA address. ··· 304 303 soc_pa |= (((column >> i) & 0x1ULL) << flip_bits[i]); 305 304 306 305 col = ((column & 0x7) << 2) | col_lower; 307 - /* add row bit 13 */ 308 - row = ((column >> 3) << 13) | row_lower; 306 + /* handle extra row bit */ 307 + if (bit_num == RETIRE_FLIP_BITS_NUM) 308 + row = ((column >> 3) << adev->umc.flip_bits.flip_row_bit) | 309 + row_lower; 309 310 310 311 if (dump_addr) 311 312 dev_info(adev->dev, ··· 530 527 uint64_t err_addr, pa_addr = 0; 531 528 struct ras_ecc_err *ecc_err; 532 529 struct ta_ras_query_address_output addr_out; 533 - enum amdgpu_memory_partition nps = AMDGPU_NPS1_PARTITION_MODE; 534 - uint32_t shift_bit = UMC_V12_0_PA_C4_BIT; 530 + uint32_t shift_bit = adev->umc.flip_bits.flip_bits_in_pa[2]; 535 531 int count, ret, i; 536 532 537 533 hwid = REG_GET_FIELD(ipid, MCMP1_IPIDT0, HardwareID); ··· 574 572 ecc_err->addr = addr; 575 573 ecc_err->pa_pfn = pa_addr >> AMDGPU_GPU_PAGE_SHIFT; 576 574 ecc_err->channel_idx = addr_out.pa.channel_idx; 577 - 578 - if (adev->gmc.gmc_funcs->query_mem_partition_mode) 579 - nps = adev->gmc.gmc_funcs->query_mem_partition_mode(adev); 580 - 581 - if (nps == AMDGPU_NPS2_PARTITION_MODE) 582 - shift_bit = UMC_V12_0_PA_B1_BIT; 583 - if (nps == AMDGPU_NPS4_PARTITION_MODE) 584 - shift_bit = UMC_V12_0_PA_B0_BIT; 585 575 586 576 /* If converted pa_pfn is 0, use pa C4 pfn. */ 587 577 if (!ecc_err->pa_pfn)