From: Christian König Date: Thu, 1 Feb 2018 13:52:50 +0000 (+0100) Subject: drm/ttm: set page mapping during allocation X-Git-Tag: v4.19~1144^2~26^2~142 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=ec92937056db2ca3acb11929d68b95b6ab421653;p=platform%2Fkernel%2Flinux-rpi.git drm/ttm: set page mapping during allocation To aid debugging set the page mapping during allocation instead of during VM faults. Signed-off-by: Christian König Reviewed-by: Roger He Signed-off-by: Alex Deucher --- diff --git a/drivers/gpu/drm/ttm/ttm_bo_vm.c b/drivers/gpu/drm/ttm/ttm_bo_vm.c index 610d671..121f017 100644 --- a/drivers/gpu/drm/ttm/ttm_bo_vm.c +++ b/drivers/gpu/drm/ttm/ttm_bo_vm.c @@ -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); diff --git a/drivers/gpu/drm/ttm/ttm_tt.c b/drivers/gpu/drm/ttm/ttm_tt.c index 39c44e3..9fd7115 100644 --- a/drivers/gpu/drm/ttm/ttm_tt.c +++ b/drivers/gpu/drm/ttm/ttm_tt.c @@ -392,12 +392,28 @@ out_err: 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)