Skip to content

Commit 2ca0f11

Browse files
Timur Kristófgregkh
authored andcommitted
drm/amdgpu/gmc: Fix AMDGPU_GART_PLACEMENT_LOW to not overlap with VRAM
[ Upstream commit 36d65da ] When the GART placement is set to AMDGPU_GART_PLACEMENT_LOW: Make sure that GART does not overlap with VRAM when VRAM is configured to be in the low address space. Solve this according to the following logic: - When GART fits before VRAM, use zero address for GART - Otherwise, put GART after the end of VRAM, aligned to 4 GiB Previously, I had assumed this was not possible so it was OK to not handle it, but now we got a report from a user who has a board that is configured this way. Fixes: 917f91d ("drm/amdgpu/gmc: add a way to force a particular placement for GART") Signed-off-by: Timur Kristóf <timur.kristof@gmail.com> Reviewed-by: Christian König <christian.koenig@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com> (cherry picked from commit 3d9de5d) Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent 3de6266 commit 2ca0f11

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

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

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -297,7 +297,10 @@ void amdgpu_gmc_gart_location(struct amdgpu_device *adev, struct amdgpu_gmc *mc,
297297
mc->gart_start = max_mc_address - mc->gart_size + 1;
298298
break;
299299
case AMDGPU_GART_PLACEMENT_LOW:
300-
mc->gart_start = 0;
300+
if (size_bf >= mc->gart_size)
301+
mc->gart_start = 0;
302+
else
303+
mc->gart_start = ALIGN(mc->fb_end, four_gb);
301304
break;
302305
case AMDGPU_GART_PLACEMENT_BEST_FIT:
303306
default:

0 commit comments

Comments
 (0)