drm/amdgpu: fix size calculation with stolen vga memory
authorAlex Deucher <alexander.deucher@amd.com>
Mon, 7 Dec 2020 18:12:29 +0000 (13:12 -0500)
committerAlex Deucher <alexander.deucher@amd.com>
Wed, 9 Dec 2020 04:06:37 +0000 (23:06 -0500)
If we need to keep the stolen vga memory, make sure it is
at least as big as the legacy vga size.

Acked-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.c

index ff3afc8..02af47d 100644 (file)
@@ -501,6 +501,9 @@ void amdgpu_gmc_get_vbios_allocations(struct amdgpu_device *adev)
        else
                size = amdgpu_gmc_get_vbios_fb_size(adev);
 
+       if (adev->mman.keep_stolen_vga_memory)
+               size = max(size, (unsigned)AMDGPU_VBIOS_VGA_ALLOCATION);
+
        /* set to 0 if the pre-OS buffer uses up most of vram */
        if ((adev->gmc.real_vram_size - size) < (8 * 1024 * 1024))
                size = 0;