diff options
author | Christian König <christian.koenig@amd.com> | 2018-02-01 08:52:50 -0500 |
---|---|---|
committer | Alex Deucher <alexander.deucher@amd.com> | 2018-02-26 23:09:33 -0500 |
commit | ec92937056db2ca3acb11929d68b95b6ab421653 (patch) | |
tree | 558dd63ed3e5d84f11d3db95856525ae30586b78 /drivers/gpu | |
parent | 9aff8b2ae71dcf7f02443821a894a736f40e4919 (diff) |
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 <christian.koenig@amd.com>
Reviewed-by: Roger He <Hongbo.He@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Diffstat (limited to 'drivers/gpu')
-rw-r--r-- | drivers/gpu/drm/ttm/ttm_bo_vm.c | 1 | ||||
-rw-r--r-- | drivers/gpu/drm/ttm/ttm_tt.c | 18 |
2 files changed, 17 insertions, 2 deletions
diff --git a/drivers/gpu/drm/ttm/ttm_bo_vm.c b/drivers/gpu/drm/ttm/ttm_bo_vm.c index 610d6714042a..121f017ac7ca 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) | |||
257 | } else if (unlikely(!page)) { | 257 | } else if (unlikely(!page)) { |
258 | break; | 258 | break; |
259 | } | 259 | } |
260 | page->mapping = vma->vm_file->f_mapping; | ||
261 | page->index = drm_vma_node_start(&bo->vma_node) + | 260 | page->index = drm_vma_node_start(&bo->vma_node) + |
262 | page_offset; | 261 | page_offset; |
263 | pfn = page_to_pfn(page); | 262 | pfn = page_to_pfn(page); |
diff --git a/drivers/gpu/drm/ttm/ttm_tt.c b/drivers/gpu/drm/ttm/ttm_tt.c index 39c44e301c72..9fd7115a013a 100644 --- a/drivers/gpu/drm/ttm/ttm_tt.c +++ b/drivers/gpu/drm/ttm/ttm_tt.c | |||
@@ -392,12 +392,28 @@ out_err: | |||
392 | return ret; | 392 | return ret; |
393 | } | 393 | } |
394 | 394 | ||
395 | static void ttm_tt_add_mapping(struct ttm_tt *ttm) | ||
396 | { | ||
397 | pgoff_t i; | ||
398 | |||
399 | if (ttm->page_flags & TTM_PAGE_FLAG_SG) | ||
400 | return; | ||
401 | |||
402 | for (i = 0; i < ttm->num_pages; ++i) | ||
403 | ttm->pages[i]->mapping = ttm->bdev->dev_mapping; | ||
404 | } | ||
405 | |||
395 | int ttm_tt_populate(struct ttm_tt *ttm, struct ttm_operation_ctx *ctx) | 406 | int ttm_tt_populate(struct ttm_tt *ttm, struct ttm_operation_ctx *ctx) |
396 | { | 407 | { |
408 | int ret; | ||
409 | |||
397 | if (ttm->state != tt_unpopulated) | 410 | if (ttm->state != tt_unpopulated) |
398 | return 0; | 411 | return 0; |
399 | 412 | ||
400 | return ttm->bdev->driver->ttm_tt_populate(ttm, ctx); | 413 | ret = ttm->bdev->driver->ttm_tt_populate(ttm, ctx); |
414 | if (!ret) | ||
415 | ttm_tt_add_mapping(ttm); | ||
416 | return ret; | ||
401 | } | 417 | } |
402 | 418 | ||
403 | static void ttm_tt_clear_mapping(struct ttm_tt *ttm) | 419 | static void ttm_tt_clear_mapping(struct ttm_tt *ttm) |