drm/amdgpu: fixup bad vram size on gmc v8
authorZongmin Zhou <zhouzongmin@kylinos.cn>
Wed, 15 Dec 2021 09:23:37 +0000 (17:23 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 27 Jan 2022 09:54:19 +0000 (10:54 +0100)
commit516e332d6fcebf7d69ba895acc974cd80e638458
treee87368cc1e781a9c41463de0765ce79a183d1ae5
parentee88ff140de2b16543547aa40db32537bd29bae9
drm/amdgpu: fixup bad vram size on gmc v8

[ Upstream commit 11544d77e3974924c5a9c8a8320b996a3e9b2f8b ]

Some boards(like RX550) seem to have garbage in the upper
16 bits of the vram size register.  Check for
this and clamp the size properly.  Fixes
boards reporting bogus amounts of vram.

after add this patch,the maximum GPU VRAM size is 64GB,
otherwise only 64GB vram size will be used.

Signed-off-by: Zongmin Zhou<zhouzongmin@kylinos.cn>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/gpu/drm/amd/amdgpu/gmc_v8_0.c