diff options
author | Tianci.Yin <tianci.yin@amd.com> | 2019-08-28 06:51:19 -0400 |
---|---|---|
committer | Alex Deucher <alexander.deucher@amd.com> | 2019-08-29 16:52:32 -0400 |
commit | 994dcfaa7ee321a23ec398f6b0e709f11ab2f577 (patch) | |
tree | 9f2090c6e6a8c9cb2465d0e57f900c328a315465 | |
parent | 92ead9fa6fc554e0ce43a4a83b26fac71f9b96ba (diff) |
drm/amdgpu: keep the stolen memory in visible vram region
stolen memory should be fixed in visible region.
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Tianci.Yin <tianci.yin@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
-rw-r--r-- | drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 6 | ||||
-rw-r--r-- | drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c | 3 |
2 files changed, 6 insertions, 3 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c index bbb4c96ed5f9..a29110a4e492 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | |||
@@ -1738,6 +1738,7 @@ int amdgpu_ttm_init(struct amdgpu_device *adev) | |||
1738 | uint64_t gtt_size; | 1738 | uint64_t gtt_size; |
1739 | int r; | 1739 | int r; |
1740 | u64 vis_vram_limit; | 1740 | u64 vis_vram_limit; |
1741 | void *stolen_vga_buf; | ||
1741 | 1742 | ||
1742 | mutex_init(&adev->mman.gtt_window_lock); | 1743 | mutex_init(&adev->mman.gtt_window_lock); |
1743 | 1744 | ||
@@ -1792,7 +1793,7 @@ int amdgpu_ttm_init(struct amdgpu_device *adev) | |||
1792 | r = amdgpu_bo_create_kernel(adev, adev->gmc.stolen_size, PAGE_SIZE, | 1793 | r = amdgpu_bo_create_kernel(adev, adev->gmc.stolen_size, PAGE_SIZE, |
1793 | AMDGPU_GEM_DOMAIN_VRAM, | 1794 | AMDGPU_GEM_DOMAIN_VRAM, |
1794 | &adev->stolen_vga_memory, | 1795 | &adev->stolen_vga_memory, |
1795 | NULL, NULL); | 1796 | NULL, &stolen_vga_buf); |
1796 | if (r) | 1797 | if (r) |
1797 | return r; | 1798 | return r; |
1798 | DRM_INFO("amdgpu: %uM of VRAM memory ready\n", | 1799 | DRM_INFO("amdgpu: %uM of VRAM memory ready\n", |
@@ -1856,8 +1857,9 @@ int amdgpu_ttm_init(struct amdgpu_device *adev) | |||
1856 | */ | 1857 | */ |
1857 | void amdgpu_ttm_late_init(struct amdgpu_device *adev) | 1858 | void amdgpu_ttm_late_init(struct amdgpu_device *adev) |
1858 | { | 1859 | { |
1860 | void *stolen_vga_buf; | ||
1859 | /* return the VGA stolen memory (if any) back to VRAM */ | 1861 | /* return the VGA stolen memory (if any) back to VRAM */ |
1860 | amdgpu_bo_free_kernel(&adev->stolen_vga_memory, NULL, NULL); | 1862 | amdgpu_bo_free_kernel(&adev->stolen_vga_memory, NULL, &stolen_vga_buf); |
1861 | } | 1863 | } |
1862 | 1864 | ||
1863 | /** | 1865 | /** |
diff --git a/drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c b/drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c index 8efda03920e3..f91337030dc0 100644 --- a/drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c +++ b/drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c | |||
@@ -1238,6 +1238,7 @@ static int gmc_v9_0_sw_init(void *handle) | |||
1238 | static int gmc_v9_0_sw_fini(void *handle) | 1238 | static int gmc_v9_0_sw_fini(void *handle) |
1239 | { | 1239 | { |
1240 | struct amdgpu_device *adev = (struct amdgpu_device *)handle; | 1240 | struct amdgpu_device *adev = (struct amdgpu_device *)handle; |
1241 | void *stolen_vga_buf; | ||
1241 | 1242 | ||
1242 | if (amdgpu_ras_is_supported(adev, AMDGPU_RAS_BLOCK__UMC) && | 1243 | if (amdgpu_ras_is_supported(adev, AMDGPU_RAS_BLOCK__UMC) && |
1243 | adev->gmc.umc_ras_if) { | 1244 | adev->gmc.umc_ras_if) { |
@@ -1270,7 +1271,7 @@ static int gmc_v9_0_sw_fini(void *handle) | |||
1270 | amdgpu_vm_manager_fini(adev); | 1271 | amdgpu_vm_manager_fini(adev); |
1271 | 1272 | ||
1272 | if (gmc_v9_0_keep_stolen_memory(adev)) | 1273 | if (gmc_v9_0_keep_stolen_memory(adev)) |
1273 | amdgpu_bo_free_kernel(&adev->stolen_vga_memory, NULL, NULL); | 1274 | amdgpu_bo_free_kernel(&adev->stolen_vga_memory, NULL, &stolen_vga_buf); |
1274 | 1275 | ||
1275 | amdgpu_gart_table_vram_free(adev); | 1276 | amdgpu_gart_table_vram_free(adev); |
1276 | amdgpu_bo_fini(adev); | 1277 | amdgpu_bo_fini(adev); |