aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/ttm
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/gpu/drm/ttm')
-rw-r--r--drivers/gpu/drm/ttm/ttm_bo_util.c2
-rw-r--r--drivers/gpu/drm/ttm/ttm_page_alloc_dma.c5
-rw-r--r--drivers/gpu/drm/ttm/ttm_tt.c16
3 files changed, 4 insertions, 19 deletions
diff --git a/drivers/gpu/drm/ttm/ttm_bo_util.c b/drivers/gpu/drm/ttm/ttm_bo_util.c
index 2a4aa57779e7..2026060f03e0 100644
--- a/drivers/gpu/drm/ttm/ttm_bo_util.c
+++ b/drivers/gpu/drm/ttm/ttm_bo_util.c
@@ -472,7 +472,7 @@ pgprot_t ttm_io_prot(uint32_t caching_flags, pgprot_t tmp)
472 else 472 else
473 tmp = pgprot_noncached(tmp); 473 tmp = pgprot_noncached(tmp);
474#endif 474#endif
475#if defined(__sparc__) 475#if defined(__sparc__) || defined(__mips__)
476 if (!(caching_flags & TTM_PL_FLAG_CACHED)) 476 if (!(caching_flags & TTM_PL_FLAG_CACHED))
477 tmp = pgprot_noncached(tmp); 477 tmp = pgprot_noncached(tmp);
478#endif 478#endif
diff --git a/drivers/gpu/drm/ttm/ttm_page_alloc_dma.c b/drivers/gpu/drm/ttm/ttm_page_alloc_dma.c
index d4aa5a82ab1b..b8b394319b45 100644
--- a/drivers/gpu/drm/ttm/ttm_page_alloc_dma.c
+++ b/drivers/gpu/drm/ttm/ttm_page_alloc_dma.c
@@ -1060,7 +1060,7 @@ int ttm_dma_page_alloc_init(struct ttm_mem_global *glob, unsigned max_pages)
1060 1060
1061 _manager = kzalloc(sizeof(*_manager), GFP_KERNEL); 1061 _manager = kzalloc(sizeof(*_manager), GFP_KERNEL);
1062 if (!_manager) 1062 if (!_manager)
1063 goto err_manager; 1063 goto err;
1064 1064
1065 mutex_init(&_manager->lock); 1065 mutex_init(&_manager->lock);
1066 INIT_LIST_HEAD(&_manager->pools); 1066 INIT_LIST_HEAD(&_manager->pools);
@@ -1078,9 +1078,6 @@ int ttm_dma_page_alloc_init(struct ttm_mem_global *glob, unsigned max_pages)
1078 } 1078 }
1079 ttm_dma_pool_mm_shrink_init(_manager); 1079 ttm_dma_pool_mm_shrink_init(_manager);
1080 return 0; 1080 return 0;
1081err_manager:
1082 kfree(_manager);
1083 _manager = NULL;
1084err: 1081err:
1085 return ret; 1082 return ret;
1086} 1083}
diff --git a/drivers/gpu/drm/ttm/ttm_tt.c b/drivers/gpu/drm/ttm/ttm_tt.c
index 82a529e45afe..bf8260133ea9 100644
--- a/drivers/gpu/drm/ttm/ttm_tt.c
+++ b/drivers/gpu/drm/ttm/ttm_tt.c
@@ -290,8 +290,6 @@ int ttm_tt_swapin(struct ttm_tt *ttm)
290 struct file *swap_storage; 290 struct file *swap_storage;
291 struct page *from_page; 291 struct page *from_page;
292 struct page *to_page; 292 struct page *to_page;
293 void *from_virtual;
294 void *to_virtual;
295 int i; 293 int i;
296 int ret = -ENOMEM; 294 int ret = -ENOMEM;
297 295
@@ -311,11 +309,7 @@ int ttm_tt_swapin(struct ttm_tt *ttm)
311 goto out_err; 309 goto out_err;
312 310
313 preempt_disable(); 311 preempt_disable();
314 from_virtual = kmap_atomic(from_page); 312 copy_highpage(to_page, from_page);
315 to_virtual = kmap_atomic(to_page);
316 memcpy(to_virtual, from_virtual, PAGE_SIZE);
317 kunmap_atomic(to_virtual);
318 kunmap_atomic(from_virtual);
319 preempt_enable(); 313 preempt_enable();
320 page_cache_release(from_page); 314 page_cache_release(from_page);
321 } 315 }
@@ -336,8 +330,6 @@ int ttm_tt_swapout(struct ttm_tt *ttm, struct file *persistent_swap_storage)
336 struct file *swap_storage; 330 struct file *swap_storage;
337 struct page *from_page; 331 struct page *from_page;
338 struct page *to_page; 332 struct page *to_page;
339 void *from_virtual;
340 void *to_virtual;
341 int i; 333 int i;
342 int ret = -ENOMEM; 334 int ret = -ENOMEM;
343 335
@@ -367,11 +359,7 @@ int ttm_tt_swapout(struct ttm_tt *ttm, struct file *persistent_swap_storage)
367 goto out_err; 359 goto out_err;
368 } 360 }
369 preempt_disable(); 361 preempt_disable();
370 from_virtual = kmap_atomic(from_page); 362 copy_highpage(to_page, from_page);
371 to_virtual = kmap_atomic(to_page);
372 memcpy(to_virtual, from_virtual, PAGE_SIZE);
373 kunmap_atomic(to_virtual);
374 kunmap_atomic(from_virtual);
375 preempt_enable(); 363 preempt_enable();
376 set_page_dirty(to_page); 364 set_page_dirty(to_page);
377 mark_page_accessed(to_page); 365 mark_page_accessed(to_page);