Commit 1a653b87 authored by Matthew Auld's avatar Matthew Auld Committed by Rodrigo Vivi

drm/xe/buddy: remove the virtualized start

Hopefully not needed anymore. We can add a .compatible() hook once we
need to differentiate between mappable and non-mappable vram. If the
allocation is not contiguous then the start value is kind of
meaningless, so rather just mark as invalid.

In upstream, TTM wants to eventually remove the ttm_resource.start
usage.

References: 54443270 ("drm/ttm: Add new callbacks to ttm res mgr")
Signed-off-by: default avatarMatthew Auld <matthew.auld@intel.com>
Cc: Lucas De Marchi <lucas.demarchi@intel.com>
Reviewed-by: default avatarMaarten Lankhorst <maarten.lankhorst@linux.intel.com>
Reviewed-by: default avatarGwan-gyeong Mun <gwan-gyeong.mun@intel.com>
Signed-off-by: default avatarRodrigo Vivi <rodrigo.vivi@intel.com>
parent 436dbd6b
...@@ -672,6 +672,12 @@ static int xe_bo_move(struct ttm_buffer_object *ttm_bo, bool evict, ...@@ -672,6 +672,12 @@ static int xe_bo_move(struct ttm_buffer_object *ttm_bo, bool evict,
void *new_addr = gt->mem.vram.mapping + void *new_addr = gt->mem.vram.mapping +
(new_mem->start << PAGE_SHIFT); (new_mem->start << PAGE_SHIFT);
if (XE_WARN_ON(new_mem->start == XE_BO_INVALID_OFFSET)) {
ret = -EINVAL;
xe_device_mem_access_put(xe);
goto out;
}
XE_BUG_ON(new_mem->start != XE_BUG_ON(new_mem->start !=
bo->placements->fpfn); bo->placements->fpfn);
......
...@@ -54,7 +54,6 @@ static int xe_ttm_vram_mgr_new(struct ttm_resource_manager *man, ...@@ -54,7 +54,6 @@ static int xe_ttm_vram_mgr_new(struct ttm_resource_manager *man,
struct xe_ttm_vram_mgr_resource *vres; struct xe_ttm_vram_mgr_resource *vres;
u64 size, remaining_size, lpfn, fpfn; u64 size, remaining_size, lpfn, fpfn;
struct drm_buddy *mm = &mgr->mm; struct drm_buddy *mm = &mgr->mm;
struct drm_buddy_block *block;
unsigned long pages_per_block; unsigned long pages_per_block;
int r; int r;
...@@ -186,24 +185,24 @@ static int xe_ttm_vram_mgr_new(struct ttm_resource_manager *man, ...@@ -186,24 +185,24 @@ static int xe_ttm_vram_mgr_new(struct ttm_resource_manager *man,
list_splice_tail(trim_list, &vres->blocks); list_splice_tail(trim_list, &vres->blocks);
} }
vres->base.start = 0; if (!(vres->base.placement & TTM_PL_FLAG_CONTIGUOUS) &&
list_for_each_entry(block, &vres->blocks, link) { xe_is_vram_mgr_blocks_contiguous(mm, &vres->blocks))
unsigned long start; vres->base.placement |= TTM_PL_FLAG_CONTIGUOUS;
start = drm_buddy_block_offset(block) + /*
drm_buddy_block_size(mm, block); * For some kernel objects we still rely on the start when io mapping
start >>= PAGE_SHIFT; * the object.
*/
if (vres->base.placement & TTM_PL_FLAG_CONTIGUOUS) {
struct drm_buddy_block *block = list_first_entry(&vres->blocks,
typeof(*block),
link);
if (start > PFN_UP(vres->base.size)) vres->base.start = drm_buddy_block_offset(block) >> PAGE_SHIFT;
start -= PFN_UP(vres->base.size); } else {
else vres->base.start = XE_BO_INVALID_OFFSET;
start = 0;
vres->base.start = max(vres->base.start, start);
} }
if (xe_is_vram_mgr_blocks_contiguous(mm, &vres->blocks))
vres->base.placement |= TTM_PL_FLAG_CONTIGUOUS;
*res = &vres->base; *res = &vres->base;
return 0; return 0;
......
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