Commit 2b77ade8 authored by Christian König's avatar Christian König Committed by Alex Deucher

drm/amdgpu: use cursor functions in amdgpu_bo_in_cpu_visible_vram

One of the last remaining uses of drm_mm_node.
Signed-off-by: default avatarChristian König <christian.koenig@amd.com>
Acked-by: default avatarFelix Kuehling <Felix.Kuehling@amd.com>
Tested-by: default avatarNirmoy Das <nirmoy.das@amd.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent 0ccc3ccf
...@@ -30,6 +30,8 @@ ...@@ -30,6 +30,8 @@
#include <drm/amdgpu_drm.h> #include <drm/amdgpu_drm.h>
#include "amdgpu.h" #include "amdgpu.h"
#include "amdgpu_res_cursor.h"
#ifdef CONFIG_MMU_NOTIFIER #ifdef CONFIG_MMU_NOTIFIER
#include <linux/mmu_notifier.h> #include <linux/mmu_notifier.h>
#endif #endif
...@@ -215,18 +217,19 @@ static inline u64 amdgpu_bo_mmap_offset(struct amdgpu_bo *bo) ...@@ -215,18 +217,19 @@ static inline u64 amdgpu_bo_mmap_offset(struct amdgpu_bo *bo)
static inline bool amdgpu_bo_in_cpu_visible_vram(struct amdgpu_bo *bo) static inline bool amdgpu_bo_in_cpu_visible_vram(struct amdgpu_bo *bo)
{ {
struct amdgpu_device *adev = amdgpu_ttm_adev(bo->tbo.bdev); struct amdgpu_device *adev = amdgpu_ttm_adev(bo->tbo.bdev);
unsigned fpfn = adev->gmc.visible_vram_size >> PAGE_SHIFT; struct amdgpu_res_cursor cursor;
struct drm_mm_node *node = bo->tbo.mem.mm_node;
unsigned long pages_left;
if (bo->tbo.mem.mem_type != TTM_PL_VRAM) if (bo->tbo.mem.mem_type != TTM_PL_VRAM)
return false; return false;
for (pages_left = bo->tbo.mem.num_pages; pages_left; amdgpu_res_first(&bo->tbo.mem, 0, amdgpu_bo_size(bo), &cursor);
pages_left -= node->size, node++) while (cursor.remaining) {
if (node->start < fpfn) if (cursor.start < adev->gmc.visible_vram_size)
return true; return true;
amdgpu_res_next(&cursor, cursor.size);
}
return false; return false;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment