aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/gpu/drm/ttm/ttm_tt.c11
-rw-r--r--include/drm/ttm/ttm_bo_driver.h7
2 files changed, 2 insertions, 16 deletions
diff --git a/drivers/gpu/drm/ttm/ttm_tt.c b/drivers/gpu/drm/ttm/ttm_tt.c
index c68b0e770d16..f0c5ffd446d9 100644
--- a/drivers/gpu/drm/ttm/ttm_tt.c
+++ b/drivers/gpu/drm/ttm/ttm_tt.c
@@ -70,7 +70,7 @@ static struct page *__ttm_tt_get_page(struct ttm_tt *ttm, int index)
70 struct ttm_mem_global *mem_glob = ttm->glob->mem_glob; 70 struct ttm_mem_global *mem_glob = ttm->glob->mem_glob;
71 int ret; 71 int ret;
72 72
73 while (NULL == (p = ttm->pages[index])) { 73 if (NULL == (p = ttm->pages[index])) {
74 74
75 INIT_LIST_HEAD(&h); 75 INIT_LIST_HEAD(&h);
76 76
@@ -86,10 +86,7 @@ static struct page *__ttm_tt_get_page(struct ttm_tt *ttm, int index)
86 if (unlikely(ret != 0)) 86 if (unlikely(ret != 0))
87 goto out_err; 87 goto out_err;
88 88
89 if (PageHighMem(p)) 89 ttm->pages[index] = p;
90 ttm->pages[--ttm->first_himem_page] = p;
91 else
92 ttm->pages[++ttm->last_lomem_page] = p;
93 } 90 }
94 return p; 91 return p;
95out_err: 92out_err:
@@ -271,8 +268,6 @@ static void ttm_tt_free_alloced_pages(struct ttm_tt *ttm)
271 ttm_put_pages(&h, count, ttm->page_flags, ttm->caching_state, 268 ttm_put_pages(&h, count, ttm->page_flags, ttm->caching_state,
272 ttm->dma_address); 269 ttm->dma_address);
273 ttm->state = tt_unpopulated; 270 ttm->state = tt_unpopulated;
274 ttm->first_himem_page = ttm->num_pages;
275 ttm->last_lomem_page = -1;
276} 271}
277 272
278void ttm_tt_destroy(struct ttm_tt *ttm) 273void ttm_tt_destroy(struct ttm_tt *ttm)
@@ -316,8 +311,6 @@ struct ttm_tt *ttm_tt_create(struct ttm_bo_device *bdev, unsigned long size,
316 311
317 ttm->glob = bdev->glob; 312 ttm->glob = bdev->glob;
318 ttm->num_pages = (size + PAGE_SIZE - 1) >> PAGE_SHIFT; 313 ttm->num_pages = (size + PAGE_SIZE - 1) >> PAGE_SHIFT;
319 ttm->first_himem_page = ttm->num_pages;
320 ttm->last_lomem_page = -1;
321 ttm->caching_state = tt_cached; 314 ttm->caching_state = tt_cached;
322 ttm->page_flags = page_flags; 315 ttm->page_flags = page_flags;
323 316
diff --git a/include/drm/ttm/ttm_bo_driver.h b/include/drm/ttm/ttm_bo_driver.h
index 37527d671f80..9da182b400ec 100644
--- a/include/drm/ttm/ttm_bo_driver.h
+++ b/include/drm/ttm/ttm_bo_driver.h
@@ -136,11 +136,6 @@ enum ttm_caching_state {
136 * @dummy_read_page: Page to map where the ttm_tt page array contains a NULL 136 * @dummy_read_page: Page to map where the ttm_tt page array contains a NULL
137 * pointer. 137 * pointer.
138 * @pages: Array of pages backing the data. 138 * @pages: Array of pages backing the data.
139 * @first_himem_page: Himem pages are put last in the page array, which
140 * enables us to run caching attribute changes on only the first part
141 * of the page array containing lomem pages. This is the index of the
142 * first himem page.
143 * @last_lomem_page: Index of the last lomem page in the page array.
144 * @num_pages: Number of pages in the page array. 139 * @num_pages: Number of pages in the page array.
145 * @bdev: Pointer to the current struct ttm_bo_device. 140 * @bdev: Pointer to the current struct ttm_bo_device.
146 * @be: Pointer to the ttm backend. 141 * @be: Pointer to the ttm backend.
@@ -157,8 +152,6 @@ enum ttm_caching_state {
157struct ttm_tt { 152struct ttm_tt {
158 struct page *dummy_read_page; 153 struct page *dummy_read_page;
159 struct page **pages; 154 struct page **pages;
160 long first_himem_page;
161 long last_lomem_page;
162 uint32_t page_flags; 155 uint32_t page_flags;
163 unsigned long num_pages; 156 unsigned long num_pages;
164 struct ttm_bo_global *glob; 157 struct ttm_bo_global *glob;