]> git.ipfire.org Git - thirdparty/linux.git/commit
drm/amdgpu: cap GTT size to physical RAM on APUs
authorHarkirat Gill <harkirat.gill@amd.com>
Mon, 27 Jul 2026 18:37:56 +0000 (14:37 -0400)
committerAlex Deucher <alexander.deucher@amd.com>
Wed, 29 Jul 2026 00:01:16 +0000 (20:01 -0400)
commit5e70f6804b4d6256058c360b10e044ee04ea4a4e
tree46b36c247d6ea88a9258c0ad1ff0bcac194a133d
parent1849a64165ccc23d3e5fc22b8be19227c21c1871
drm/amdgpu: cap GTT size to physical RAM on APUs

On APUs, the GTT pool is backed by system RAM, but its size is not bound
to the non-carveout memory that actually backs it. A user can end up
with GTT + VRAM exceeding total physical memory through the following
sequence:

 - Have a large non-carveout memory space (~128GB) and accordingly set a
   large GTT (~100GB) via the ttm module parameter.
 - Lower the non-carveout memory space in BIOS by increasing the UMA
   Frame Buffer Size (VRAM) to 64GB.
 - The previously set GTT value (~100GB) persists, even though the new
   non-carveout space (64GB) can no longer back it.

This leads to a case where kernel reports GTT (100GB) + VRAM (64GB)
despite the sum being greater than total physical memory (128GB).

Cap the GTT size to totalram_pages() on APUs. totalram_pages() already
excludes the VRAM carveout, so the resulting GTT can never exceed the
system RAM that actually backs it.

Signed-off-by: Harkirat Gill <harkirat.gill@amd.com>
Reviewed-by: David Francis <David.Francis@amd.com>
Assisted-by: Claude:claude-opus-4
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
(cherry picked from commit 5dafdd649280c7dc6c22c8f877da3f54fcc441e1)
Cc: stable@vger.kernel.org
drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c