drm/amdgpu: use TTM values instead of MC values for the info queries
authorChristian König <christian.koenig@amd.com>
Fri, 30 Jun 2017 12:37:02 +0000 (14:37 +0200)
committerAlex Deucher <alexander.deucher@amd.com>
Fri, 14 Jul 2017 15:06:23 +0000 (11:06 -0400)
Use the TTM values instead of the hardware config here.

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

index b0b23101d1c870ddeefc89b15818cd5b13ea13a7..63017de99f3652c1957e55455b0495cf8faebf3c 100644 (file)
@@ -485,7 +485,8 @@ static int amdgpu_info_ioctl(struct drm_device *dev, void *data, struct drm_file
                vram_gtt.vram_size -= adev->vram_pin_size;
                vram_gtt.vram_cpu_accessible_size = adev->mc.visible_vram_size;
                vram_gtt.vram_cpu_accessible_size -= (adev->vram_pin_size - adev->invisible_pin_size);
-               vram_gtt.gtt_size  = adev->mc.gtt_size;
+               vram_gtt.gtt_size = adev->mman.bdev.man[TTM_PL_TT].size;
+               vram_gtt.gtt_size *= PAGE_SIZE;
                vram_gtt.gtt_size -= adev->gart_pin_size;
                return copy_to_user(out, &vram_gtt,
                                    min((size_t)size, sizeof(vram_gtt))) ? -EFAULT : 0;
@@ -510,9 +511,10 @@ static int amdgpu_info_ioctl(struct drm_device *dev, void *data, struct drm_file
                mem.cpu_accessible_vram.max_allocation =
                        mem.cpu_accessible_vram.usable_heap_size * 3 / 4;
 
-               mem.gtt.total_heap_size = adev->mc.gtt_size;
-               mem.gtt.usable_heap_size =
-                       adev->mc.gtt_size - adev->gart_pin_size;
+               mem.gtt.total_heap_size = adev->mman.bdev.man[TTM_PL_TT].size;
+               mem.gtt.total_heap_size *= PAGE_SIZE;
+               mem.gtt.usable_heap_size = mem.gtt.total_heap_size
+                       - adev->gart_pin_size;
                mem.gtt.heap_usage = atomic64_read(&adev->gtt_usage);
                mem.gtt.max_allocation = mem.gtt.usable_heap_size * 3 / 4;