]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
drm/amdgpu: amdgpu_vram_mgr_new(): Clamp lpfn to total vram
authorJohn Olender <john.olender@gmail.com>
Tue, 29 Apr 2025 11:24:28 +0000 (07:24 -0400)
committerAlex Deucher <alexander.deucher@amd.com>
Thu, 29 May 2025 14:56:23 +0000 (10:56 -0400)
The drm_mm allocator tolerated being passed end > mm->size, but the
drm_buddy allocator does not.

Restore the pre-buddy-allocator behavior of allowing such placements.

Closes: https://gitlab.freedesktop.org/drm/amd/-/issues/3448
Signed-off-by: John Olender <john.olender@gmail.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Arunpravin Paneer Selvam <Arunpravin.PaneerSelvam@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Cc: stable@vger.kernel.org
drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c

index 2d7f82e98df92c95b5cb3fb78486c19314163aa8..abdc52b0895a60136cf6beb567bc9d20f8ca114b 100644 (file)
@@ -463,7 +463,7 @@ static int amdgpu_vram_mgr_new(struct ttm_resource_manager *man,
        int r;
 
        lpfn = (u64)place->lpfn << PAGE_SHIFT;
-       if (!lpfn)
+       if (!lpfn || lpfn > man->size)
                lpfn = man->size;
 
        fpfn = (u64)place->fpfn << PAGE_SHIFT;