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

drm/amdgpu: get rev_id from strap register or IP-discovery table

Query the sub-revision field in the IP Discovery table for the VFs
to obtain their revision ID.
Meanwhile, read the revision ID from the strap register for the PF.

Signed-off-by: Perry Yuan <perry.yuan@amd.com>
Reviewed-by: Hawking Zhang <Hawking.Zhang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>

authored by

Perry Yuan and committed by
Alex Deucher
28d4de7e edddaada

+17 -11
+4
drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c
··· 1843 1843 if (amdgpu_ip_version(adev, GC_HWIP, 0) == IP_VERSION(9, 5, 0)) 1844 1844 adev->gmc.vram_type = AMDGPU_VRAM_TYPE_HBM3E; 1845 1845 1846 + if (amdgpu_ip_version(adev, GC_HWIP, 0) == IP_VERSION(9, 4, 4) && 1847 + adev->rev_id == 0x3) 1848 + adev->gmc.vram_type = AMDGPU_VRAM_TYPE_HBM3E; 1849 + 1846 1850 if (!(adev->flags & AMD_IS_APU) && !amdgpu_sriov_vf(adev)) { 1847 1851 vram_info = RREG32(regBIF_BIOS_SCRATCH_4); 1848 1852 adev->gmc.vram_vendor = vram_info & 0xF;
+13 -11
drivers/gpu/drm/amd/amdgpu/nbio_v7_9.c
··· 41 41 42 42 static u32 nbio_v7_9_get_rev_id(struct amdgpu_device *adev) 43 43 { 44 - u32 tmp; 44 + u32 rev_id; 45 45 46 - tmp = IP_VERSION_SUBREV(amdgpu_ip_version_full(adev, NBIO_HWIP, 0)); 47 - /* If it is VF or subrevision holds a non-zero value, that should be used */ 48 - if (tmp || amdgpu_sriov_vf(adev)) 49 - return tmp; 46 + /* 47 + * fetch the sub-revision field from the IP-discovery table 48 + * (returns zero if the table entry is not populated). 49 + */ 50 + if (amdgpu_sriov_vf(adev)) { 51 + rev_id = IP_VERSION_SUBREV(amdgpu_ip_version_full(adev, NBIO_HWIP, 0)); 52 + } else { 53 + rev_id = RREG32_SOC15(NBIO, 0, regRCC_STRAP0_RCC_DEV0_EPF0_STRAP0); 54 + rev_id = REG_GET_FIELD(rev_id, RCC_STRAP0_RCC_DEV0_EPF0_STRAP0, 55 + STRAP_ATI_REV_ID_DEV0_F0); 56 + } 50 57 51 - /* If discovery subrev is not updated, use register version */ 52 - tmp = RREG32_SOC15(NBIO, 0, regRCC_STRAP0_RCC_DEV0_EPF0_STRAP0); 53 - tmp = REG_GET_FIELD(tmp, RCC_STRAP0_RCC_DEV0_EPF0_STRAP0, 54 - STRAP_ATI_REV_ID_DEV0_F0); 55 - 56 - return tmp; 58 + return rev_id; 57 59 } 58 60 59 61 static void nbio_v7_9_mc_access_enable(struct amdgpu_device *adev, bool enable)