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

drm/ttm: set page mapping during allocation

To aid debugging set the page mapping during allocation instead of
during VM faults.
Signed-off-by: default avatarChristian König <christian.koenig@amd.com>
Reviewed-by: default avatarRoger He <Hongbo.He@amd.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent 9aff8b2a
......@@ -257,7 +257,6 @@ static int ttm_bo_vm_fault(struct vm_fault *vmf)
} else if (unlikely(!page)) {
break;
}
page->mapping = vma->vm_file->f_mapping;
page->index = drm_vma_node_start(&bo->vma_node) +
page_offset;
pfn = page_to_pfn(page);
......
......@@ -392,12 +392,28 @@ int ttm_tt_swapout(struct ttm_tt *ttm, struct file *persistent_swap_storage)
return ret;
}
static void ttm_tt_add_mapping(struct ttm_tt *ttm)
{
pgoff_t i;
if (ttm->page_flags & TTM_PAGE_FLAG_SG)
return;
for (i = 0; i < ttm->num_pages; ++i)
ttm->pages[i]->mapping = ttm->bdev->dev_mapping;
}
int ttm_tt_populate(struct ttm_tt *ttm, struct ttm_operation_ctx *ctx)
{
int ret;
if (ttm->state != tt_unpopulated)
return 0;
return ttm->bdev->driver->ttm_tt_populate(ttm, ctx);
ret = ttm->bdev->driver->ttm_tt_populate(ttm, ctx);
if (!ret)
ttm_tt_add_mapping(ttm);
return ret;
}
static void ttm_tt_clear_mapping(struct ttm_tt *ttm)
......
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