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: add interface to get die id from memory address

And implement it for UMC v12_0. The die id is calculated from IPID
register in bad page retirement flow, but we don't store it on eeprom
and it can be also gotten from physical address.

v2: get PA_C4 and PA_R13 from MCA address since they may be cleared in
retired page.

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
fcb600b0 2206daa1

+28
+2
drivers/gpu/drm/amd/amdgpu/amdgpu_umc.h
··· 91 91 struct ta_ras_query_address_input *addr_in, 92 92 struct ta_ras_query_address_output *addr_out, 93 93 bool dump_addr); 94 + uint32_t (*get_die_id_from_pa)(struct amdgpu_device *adev, 95 + uint64_t mca_addr, uint64_t retired_page); 94 96 }; 95 97 96 98 struct amdgpu_umc_funcs {
+26
drivers/gpu/drm/amd/amdgpu/umc_v12_0.c
··· 619 619 mutex_unlock(&con->umc_ecc_log.lock); 620 620 } 621 621 622 + static uint32_t umc_v12_0_get_die_id(struct amdgpu_device *adev, 623 + uint64_t mca_addr, uint64_t retired_page) 624 + { 625 + uint32_t die = 0; 626 + 627 + /* we only calculate die id for nps1 mode right now */ 628 + die += ((((retired_page >> 12) & 0x1ULL)^ 629 + ((retired_page >> 20) & 0x1ULL) ^ 630 + ((retired_page >> 27) & 0x1ULL) ^ 631 + ((retired_page >> 34) & 0x1ULL) ^ 632 + ((retired_page >> 41) & 0x1ULL)) << 0); 633 + 634 + /* the original PA_C4 and PA_R13 may be cleared in retired_page, so 635 + * get them from mca_addr. 636 + */ 637 + die += ((((retired_page >> 13) & 0x1ULL) ^ 638 + ((mca_addr >> 5) & 0x1ULL) ^ 639 + ((retired_page >> 28) & 0x1ULL) ^ 640 + ((mca_addr >> 23) & 0x1ULL) ^ 641 + ((retired_page >> 42) & 0x1ULL)) << 1); 642 + die &= 3; 643 + 644 + return die; 645 + } 646 + 622 647 struct amdgpu_umc_ras umc_v12_0_ras = { 623 648 .ras_block = { 624 649 .hw_ops = &umc_v12_0_ras_hw_ops, ··· 655 630 .check_ecc_err_status = umc_v12_0_check_ecc_err_status, 656 631 .update_ecc_status = umc_v12_0_update_ecc_status, 657 632 .convert_ras_err_addr = umc_v12_0_convert_error_address, 633 + .get_die_id_from_pa = umc_v12_0_get_die_id, 658 634 }; 659 635