drm/amdgpu: fix regression in vbios reservation handling on headless
authorAlex Deucher <alexander.deucher@amd.com>
Mon, 14 Dec 2020 16:00:47 +0000 (11:00 -0500)
committerAlex Deucher <alexander.deucher@amd.com>
Tue, 15 Dec 2020 16:35:42 +0000 (11:35 -0500)
We need to move the check under the non-headless case, otherwise
we always reserve the VGA save size.

Fixes: 157fe68d74c2ad ("drm/amdgpu: fix size calculation with stolen vga memory")
Reviewed-by: Guchun Chen <guchun.chen@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.c

index 02af47ddddbc5ee7c7ff0cdce7a8b823a74b179c..c2ced5be6d7bf87115c6628808cbe6778d2a426d 100644 (file)
@@ -496,13 +496,14 @@ void amdgpu_gmc_get_vbios_allocations(struct amdgpu_device *adev)
                break;
        }
 
-       if (!amdgpu_device_ip_get_ip_block(adev, AMD_IP_BLOCK_TYPE_DCE))
+       if (!amdgpu_device_ip_get_ip_block(adev, AMD_IP_BLOCK_TYPE_DCE)) {
                size = 0;
-       else
+       } else {
                size = amdgpu_gmc_get_vbios_fb_size(adev);
 
-       if (adev->mman.keep_stolen_vga_memory)
-               size = max(size, (unsigned)AMDGPU_VBIOS_VGA_ALLOCATION);
+               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))