Skip to content

Commit e20ff05

Browse files
Lijo Lazaralexdeucher
authored andcommitted
drm/amdgpu: Add memory vendor information
For ASICs with GC v9.4.3, determine the vendor information from scratch register. Signed-off-by: Lijo Lazar <lijo.lazar@amd.com> Reviewed-by: Hawking Zhang <Hawking.Zhang@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
1 parent 0dee726 commit e20ff05

File tree

1 file changed

+18
-8
lines changed

1 file changed

+18
-8
lines changed

drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1998,6 +1998,19 @@ static int gmc_v9_0_init_mem_ranges(struct amdgpu_device *adev)
19981998
return 0;
19991999
}
20002000

2001+
static void gmc_v9_4_3_init_vram_info(struct amdgpu_device *adev)
2002+
{
2003+
static const u32 regBIF_BIOS_SCRATCH_4 = 0x50;
2004+
u32 vram_info;
2005+
2006+
if (!amdgpu_sriov_vf(adev)) {
2007+
vram_info = RREG32(regBIF_BIOS_SCRATCH_4);
2008+
adev->gmc.vram_vendor = vram_info & 0xF;
2009+
}
2010+
adev->gmc.vram_type = AMDGPU_VRAM_TYPE_HBM;
2011+
adev->gmc.vram_width = 128 * 64;
2012+
}
2013+
20012014
static int gmc_v9_0_sw_init(void *handle)
20022015
{
20032016
int r, vram_width = 0, vram_type = 0, vram_vendor = 0, dma_addr_bits;
@@ -2010,15 +2023,12 @@ static int gmc_v9_0_sw_init(void *handle)
20102023

20112024
spin_lock_init(&adev->gmc.invalidate_lock);
20122025

2013-
if (!(adev->bios) || adev->gmc.is_app_apu) {
2026+
if (adev->ip_versions[GC_HWIP][0] == IP_VERSION(9, 4, 3)) {
2027+
gmc_v9_4_3_init_vram_info(adev);
2028+
} else if (!adev->bios) {
20142029
if (adev->flags & AMD_IS_APU) {
2015-
if (adev->gmc.is_app_apu) {
2016-
adev->gmc.vram_type = AMDGPU_VRAM_TYPE_HBM;
2017-
adev->gmc.vram_width = 128 * 64;
2018-
} else {
2019-
adev->gmc.vram_type = AMDGPU_VRAM_TYPE_DDR4;
2020-
adev->gmc.vram_width = 64 * 64;
2021-
}
2030+
adev->gmc.vram_type = AMDGPU_VRAM_TYPE_DDR4;
2031+
adev->gmc.vram_width = 64 * 64;
20222032
} else {
20232033
adev->gmc.vram_type = AMDGPU_VRAM_TYPE_HBM;
20242034
adev->gmc.vram_width = 128 * 64;

0 commit comments

Comments
 (0)