drm/amdgpu: keep the stolen memory in visible vram region
authorTianci.Yin <tianci.yin@amd.com>
Wed, 28 Aug 2019 10:51:19 +0000 (18:51 +0800)
committerAlex Deucher <alexander.deucher@amd.com>
Thu, 29 Aug 2019 20:52:32 +0000 (15:52 -0500)
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>
drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c

index bbb4c96ed5f91fd0a75c83f2353444d6cd2b8842..a29110a4e492eeac32f8bee9c9098b3cb8fa85ff 100644 (file)
@@ -1738,6 +1738,7 @@ int amdgpu_ttm_init(struct amdgpu_device *adev)
        uint64_t gtt_size;
        int r;
        u64 vis_vram_limit;
+       void *stolen_vga_buf;
 
        mutex_init(&adev->mman.gtt_window_lock);
 
@@ -1792,7 +1793,7 @@ int amdgpu_ttm_init(struct amdgpu_device *adev)
        r = amdgpu_bo_create_kernel(adev, adev->gmc.stolen_size, PAGE_SIZE,
                                    AMDGPU_GEM_DOMAIN_VRAM,
                                    &adev->stolen_vga_memory,
-                                   NULL, NULL);
+                                   NULL, &stolen_vga_buf);
        if (r)
                return r;
        DRM_INFO("amdgpu: %uM of VRAM memory ready\n",
@@ -1856,8 +1857,9 @@ 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->stolen_vga_memory, NULL, NULL);
+       amdgpu_bo_free_kernel(&adev->stolen_vga_memory, NULL, &stolen_vga_buf);
 }
 
 /**
index 8efda03920e31651fd1d7a9a583cb842b272341b..f91337030dc07857987bfc25ea6cabe8185585e3 100644 (file)
@@ -1238,6 +1238,7 @@ static int gmc_v9_0_sw_init(void *handle)
 static int gmc_v9_0_sw_fini(void *handle)
 {
        struct amdgpu_device *adev = (struct amdgpu_device *)handle;
+       void *stolen_vga_buf;
 
        if (amdgpu_ras_is_supported(adev, AMDGPU_RAS_BLOCK__UMC) &&
                        adev->gmc.umc_ras_if) {
@@ -1270,7 +1271,7 @@ static int gmc_v9_0_sw_fini(void *handle)
        amdgpu_vm_manager_fini(adev);
 
        if (gmc_v9_0_keep_stolen_memory(adev))
-               amdgpu_bo_free_kernel(&adev->stolen_vga_memory, NULL, NULL);
+               amdgpu_bo_free_kernel(&adev->stolen_vga_memory, NULL, &stolen_vga_buf);
 
        amdgpu_gart_table_vram_free(adev);
        amdgpu_bo_fini(adev);