aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/ttm/ttm_tt.c
diff options
context:
space:
mode:
authorThomas Hellstrom <thellstrom@vmware.com>2014-01-03 05:47:23 -0500
committerThomas Hellstrom <thellstrom@vmware.com>2014-01-08 04:08:28 -0500
commit58aa6622d32af7d2c08d45085f44c54554a16ed7 (patch)
treeb24e02d873a323a79cc86b27a9c21fe80f2cc54f /drivers/gpu/drm/ttm/ttm_tt.c
parent667a50db0477d47fdff01c666f5ee1ce26b5264c (diff)
drm/ttm: Correctly set page mapping and -index members
Needed for some vm operations; most notably unmap_mapping_range() with even_cows = 0. Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com> Reviewed-by: Brian Paul <brianp@vmware.com>
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}