aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
diff options
context:
space:
mode:
authorAlex Deucher <alexander.deucher@amd.com>2020-07-28 17:55:30 -0400
committerAlex Deucher <alexander.deucher@amd.com>2020-08-04 17:29:28 -0400
commit5db62dc8d4f35dc11054f24ba2c86f6c3422918a (patch)
tree2c6bc85662f6642c87e80f9920441be2102ba1d0 /drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
parentdrm/amdgpu: move stolen vga bo from amdgpu to amdgpu.gmc (diff)
downloadwireguard-linux-5db62dc8d4f35dc11054f24ba2c86f6c3422918a.tar.xz
wireguard-linux-5db62dc8d4f35dc11054f24ba2c86f6c3422918a.zip
drm/amdgpu: move keep stolen memory check into gmc core
Rather than leaving this as a gmc v9 specific hack. Reviewed-by: Christian König <christian.koenig@amd.com> Reviewed-by: Felix Kuehling <Felix.Kuehling@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Diffstat (limited to 'drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c')
-rw-r--r--drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
index 39781127d059..fd61769202b3 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
@@ -2042,8 +2042,10 @@ int amdgpu_ttm_init(struct amdgpu_device *adev)
void amdgpu_ttm_late_init(struct amdgpu_device *adev)
{
void *stolen_vga_buf;
+
/* return the VGA stolen memory (if any) back to VRAM */
- amdgpu_bo_free_kernel(&adev->gmc.stolen_vga_memory, NULL, &stolen_vga_buf);
+ if (!adev->gmc.keep_stolen_vga_memory)
+ amdgpu_bo_free_kernel(&adev->gmc.stolen_vga_memory, NULL, &stolen_vga_buf);
}
/**
@@ -2051,10 +2053,15 @@ void amdgpu_ttm_late_init(struct amdgpu_device *adev)
*/
void amdgpu_ttm_fini(struct amdgpu_device *adev)
{
+ void *stolen_vga_buf;
+
if (!adev->mman.initialized)
return;
amdgpu_ttm_training_reserve_vram_fini(adev);
+ /* return the stolen vga memory back to VRAM */
+ if (adev->gmc.keep_stolen_vga_memory)
+ amdgpu_bo_free_kernel(&adev->gmc.stolen_vga_memory, NULL, &stolen_vga_buf);
/* return the IP Discovery TMR memory back to VRAM */
amdgpu_bo_free_kernel(&adev->discovery_memory, NULL, NULL);
amdgpu_ttm_fw_reserve_vram_fini(adev);