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: save UMC global channel index to eeprom

Save the global channel index returned by RAS TA to eeprom.
We can get memory physical address by MCA address and channel index.

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
71a0e963 07dd49e1

+13 -11
+2
drivers/gpu/drm/amd/amdgpu/amdgpu_ras.h
··· 483 483 uint64_t ipid; 484 484 uint64_t addr; 485 485 uint64_t pa_pfn; 486 + /* save global channel index across all UMC instances */ 487 + uint32_t channel_idx; 486 488 struct ras_err_pages err_pages; 487 489 }; 488 490
+2 -5
drivers/gpu/drm/amd/amdgpu/amdgpu_umc.c
··· 495 495 int amdgpu_umc_mca_to_addr(struct amdgpu_device *adev, 496 496 uint64_t err_addr, uint32_t ch, uint32_t umc, 497 497 uint32_t node, uint32_t socket, 498 - uint64_t *addr, bool dump_addr) 498 + struct ta_ras_query_address_output *addr_out, bool dump_addr) 499 499 { 500 500 struct ta_ras_query_address_input addr_in; 501 - struct ta_ras_query_address_output addr_out; 502 501 int ret; 503 502 504 503 memset(&addr_in, 0, sizeof(addr_in)); ··· 509 510 510 511 if (adev->umc.ras && adev->umc.ras->convert_ras_err_addr) { 511 512 ret = adev->umc.ras->convert_ras_err_addr(adev, NULL, &addr_in, 512 - &addr_out, dump_addr); 513 + addr_out, dump_addr); 513 514 if (ret) 514 515 return ret; 515 516 } else { 516 517 return 0; 517 518 } 518 - 519 - *addr = addr_out.pa.pa; 520 519 521 520 return 0; 522 521 }
+1 -1
drivers/gpu/drm/amd/amdgpu/amdgpu_umc.h
··· 146 146 int amdgpu_umc_mca_to_addr(struct amdgpu_device *adev, 147 147 uint64_t err_addr, uint32_t ch, uint32_t umc, 148 148 uint32_t node, uint32_t socket, 149 - uint64_t *addr, bool dump_addr); 149 + struct ta_ras_query_address_output *addr_out, bool dump_addr); 150 150 #endif
+8 -5
drivers/gpu/drm/amd/amdgpu/umc_v12_0.c
··· 180 180 bool dump_addr) 181 181 { 182 182 uint32_t col, col_lower, row, row_lower, bank; 183 - uint32_t channel_index, umc_inst = 0; 183 + uint32_t channel_index = 0, umc_inst = 0; 184 184 uint32_t i, loop_bits[UMC_V12_0_RETIRE_LOOP_BITS]; 185 185 uint64_t soc_pa, column, err_addr; 186 186 struct ta_ras_query_address_output addr_out_tmp; ··· 193 193 else 194 194 paddr_out = addr_out; 195 195 196 - err_addr = bank = channel_index = 0; 196 + err_addr = bank = 0; 197 197 if (addr_in) { 198 198 err_addr = addr_in->ma.err_addr; 199 199 addr_in->addr_type = TA_RAS_MCA_TO_PA; ··· 206 206 } 207 207 208 208 bank = paddr_out->pa.bank; 209 - channel_index = paddr_out->pa.channel_idx; 210 209 /* no need to care about umc inst if addr_in is NULL */ 211 210 umc_inst = addr_in->ma.umc_inst; 212 211 } ··· 227 228 } 228 229 229 230 soc_pa = paddr_out->pa.pa; 231 + channel_index = paddr_out->pa.channel_idx; 230 232 /* clear loop bits in soc physical address */ 231 233 for (i = 0; i < UMC_V12_0_RETIRE_LOOP_BITS; i++) 232 234 soc_pa &= ~BIT_ULL(loop_bits[i]); ··· 466 466 uint64_t page_pfn[UMC_V12_0_BAD_PAGE_NUM_PER_CHANNEL]; 467 467 uint64_t err_addr, pa_addr = 0; 468 468 struct ras_ecc_err *ecc_err; 469 + struct ta_ras_query_address_output addr_out; 469 470 int count, ret, i; 470 471 471 472 hwid = REG_GET_FIELD(ipid, MCMP1_IPIDT0, HardwareID); ··· 496 495 ret = amdgpu_umc_mca_to_addr(adev, 497 496 err_addr, MCA_IPID_2_UMC_CH(ipid), 498 497 MCA_IPID_2_UMC_INST(ipid), MCA_IPID_2_DIE_ID(ipid), 499 - MCA_IPID_2_SOCKET_ID(ipid), &pa_addr, true); 498 + MCA_IPID_2_SOCKET_ID(ipid), &addr_out, true); 500 499 if (ret) 501 500 return ret; 502 501 ··· 504 503 if (!ecc_err) 505 504 return -ENOMEM; 506 505 506 + pa_addr = addr_out.pa.pa; 507 507 ecc_err->status = status; 508 508 ecc_err->ipid = ipid; 509 509 ecc_err->addr = addr; 510 510 ecc_err->pa_pfn = pa_addr >> AMDGPU_GPU_PAGE_SHIFT; 511 + ecc_err->channel_idx = addr_out.pa.channel_idx; 511 512 512 513 /* If converted pa_pfn is 0, use pa C4 pfn. */ 513 514 if (!ecc_err->pa_pfn) ··· 580 577 ret = amdgpu_umc_fill_error_record(err_data, 581 578 ecc_err->addr, 582 579 page_pfn[i] << AMDGPU_GPU_PAGE_SHIFT, 583 - MCA_IPID_2_UMC_CH(ecc_err->ipid), 580 + ecc_err->channel_idx, 584 581 MCA_IPID_2_UMC_INST(ecc_err->ipid)); 585 582 if (ret) 586 583 break;