aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/ttm/ttm_tt.c
diff options
context:
space:
mode:
authorDave Airlie <airlied@redhat.com>2014-01-13 19:46:19 -0500
committerDave Airlie <airlied@redhat.com>2014-01-13 19:46:19 -0500
commita095c60bd06f204c98527aafd5fda6ef42b53eb5 (patch)
tree5725ef3563751a7dab26d4b8c50694c239697911 /drivers/gpu/drm/ttm/ttm_tt.c
parent99d4a8ae93ead27b5a88cdbd09dc556fe96ac3a8 (diff)
parent52028704126b5597775cc788028385556af1f85c (diff)
Merge tag 'ttm-next-2014-01-13' of git://people.freedesktop.org/~thomash/linux into drm-next
Some code cleanup by Rashika Keria, VM stuff for ttm: -Use PFNMAP instead of MIXEDMAP where possible for performance -Refuse to fault imported pages, an initial step to support dma-bufs better from within TTM. -Correctly set page mapping and -index members. These are needed in various places in the vm subsystem that we are not using yet, but plan to use soonish: For example unmap-mapping-range keeping COW pages, and dirty tracking fbdefio style, but also for PCI memory. ttm-next 2013-01-14 pull request * tag 'ttm-next-2014-01-13' of git://people.freedesktop.org/~thomash/linux: drivers: gpu: Remove unused function in ttm_lock.c drivers: gpu: Mark function as static in ttm_bo_util.c drivers: gpu: Mark function as static in ttm_bo.c drm/ttm: Correctly set page mapping and -index members drm/ttm: Refuse to fault (prime-) imported pages drm/ttm: Use VM_PFNMAP for shared bo maps
Diffstat (limited to 'drivers/gpu/drm/ttm/ttm_tt.c')
-rw-r--r--drivers/gpu/drm/ttm/ttm_tt.c27
1 files changed, 23 insertions, 4 deletions
diff --git a/drivers/gpu/drm/ttm/ttm_tt.c b/drivers/gpu/drm/ttm/ttm_tt.c
index 210d50365162..9af99084b344 100644
--- a/drivers/gpu/drm/ttm/ttm_tt.c
+++ b/drivers/gpu/drm/ttm/ttm_tt.c
@@ -170,9 +170,8 @@ void ttm_tt_destroy(struct ttm_tt *ttm)
170 ttm_tt_unbind(ttm); 170 ttm_tt_unbind(ttm);
171 } 171 }
172 172
173 if (ttm->state == tt_unbound) { 173 if (ttm->state == tt_unbound)
174 ttm->bdev->driver->ttm_tt_unpopulate(ttm); 174 ttm_tt_unpopulate(ttm);
175 }
176 175
177 if (!(ttm->page_flags & TTM_PAGE_FLAG_PERSISTENT_SWAP) && 176 if (!(ttm->page_flags & TTM_PAGE_FLAG_PERSISTENT_SWAP) &&
178 ttm->swap_storage) 177 ttm->swap_storage)
@@ -362,7 +361,7 @@ int ttm_tt_swapout(struct ttm_tt *ttm, struct file *persistent_swap_storage)
362 page_cache_release(to_page); 361 page_cache_release(to_page);
363 } 362 }
364 363
365 ttm->bdev->driver->ttm_tt_unpopulate(ttm); 364 ttm_tt_unpopulate(ttm);
366 ttm->swap_storage = swap_storage; 365 ttm->swap_storage = swap_storage;
367 ttm->page_flags |= TTM_PAGE_FLAG_SWAPPED; 366 ttm->page_flags |= TTM_PAGE_FLAG_SWAPPED;
368 if (persistent_swap_storage) 367 if (persistent_swap_storage)
@@ -375,3 +374,23 @@ out_err:
375 374
376 return ret; 375 return ret;
377} 376}
377
378static void ttm_tt_clear_mapping(struct ttm_tt *ttm)
379{
380 pgoff_t i;
381 struct page **page = ttm->pages;
382
383 for (i = 0; i < ttm->num_pages; ++i) {
384 (*page)->mapping = NULL;
385 (*page++)->index = 0;
386 }
387}
388
389void ttm_tt_unpopulate(struct ttm_tt *ttm)
390{
391 if (ttm->state == tt_unpopulated)
392 return;
393
394 ttm_tt_clear_mapping(ttm);
395 ttm->bdev->driver->ttm_tt_unpopulate(ttm);
396}