aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/gpu/drm/radeon/radeon.h1
-rw-r--r--drivers/gpu/drm/radeon/radeon_device.c17
-rw-r--r--drivers/gpu/drm/radeon/radeon_ttm.c3
-rw-r--r--drivers/gpu/drm/ttm/ttm_bo.c7
-rw-r--r--drivers/gpu/drm/ttm/ttm_tt.c9
-rw-r--r--include/drm/ttm/ttm_bo_driver.h5
6 files changed, 35 insertions, 7 deletions
diff --git a/drivers/gpu/drm/radeon/radeon.h b/drivers/gpu/drm/radeon/radeon.h
index e7662ba9abfb..3060ce14071e 100644
--- a/drivers/gpu/drm/radeon/radeon.h
+++ b/drivers/gpu/drm/radeon/radeon.h
@@ -624,6 +624,7 @@ struct radeon_device {
624 bool gpu_lockup; 624 bool gpu_lockup;
625 bool shutdown; 625 bool shutdown;
626 bool suspend; 626 bool suspend;
627 bool need_dma32;
627}; 628};
628 629
629int radeon_device_init(struct radeon_device *rdev, 630int radeon_device_init(struct radeon_device *rdev,
diff --git a/drivers/gpu/drm/radeon/radeon_device.c b/drivers/gpu/drm/radeon/radeon_device.c
index 332911267ebe..27a5ac969953 100644
--- a/drivers/gpu/drm/radeon/radeon_device.c
+++ b/drivers/gpu/drm/radeon/radeon_device.c
@@ -450,6 +450,7 @@ int radeon_device_init(struct radeon_device *rdev,
450 uint32_t flags) 450 uint32_t flags)
451{ 451{
452 int r, ret; 452 int r, ret;
453 int dma_bits;
453 454
454 DRM_INFO("radeon: Initializing kernel modesetting.\n"); 455 DRM_INFO("radeon: Initializing kernel modesetting.\n");
455 rdev->shutdown = false; 456 rdev->shutdown = false;
@@ -492,8 +493,20 @@ int radeon_device_init(struct radeon_device *rdev,
492 return r; 493 return r;
493 } 494 }
494 495
495 /* Report DMA addressing limitation */ 496 /* set DMA mask + need_dma32 flags.
496 r = pci_set_dma_mask(rdev->pdev, DMA_BIT_MASK(32)); 497 * PCIE - can handle 40-bits.
498 * IGP - can handle 40-bits (in theory)
499 * AGP - generally dma32 is safest
500 * PCI - only dma32
501 */
502 rdev->need_dma32 = false;
503 if (rdev->flags & RADEON_IS_AGP)
504 rdev->need_dma32 = true;
505 if (rdev->flags & RADEON_IS_PCI)
506 rdev->need_dma32 = true;
507
508 dma_bits = rdev->need_dma32 ? 32 : 40;
509 r = pci_set_dma_mask(rdev->pdev, DMA_BIT_MASK(dma_bits));
497 if (r) { 510 if (r) {
498 printk(KERN_WARNING "radeon: No suitable DMA available.\n"); 511 printk(KERN_WARNING "radeon: No suitable DMA available.\n");
499 } 512 }
diff --git a/drivers/gpu/drm/radeon/radeon_ttm.c b/drivers/gpu/drm/radeon/radeon_ttm.c
index 1227a97f5169..4ca9aa9203d0 100644
--- a/drivers/gpu/drm/radeon/radeon_ttm.c
+++ b/drivers/gpu/drm/radeon/radeon_ttm.c
@@ -442,7 +442,8 @@ int radeon_ttm_init(struct radeon_device *rdev)
442 /* No others user of address space so set it to 0 */ 442 /* No others user of address space so set it to 0 */
443 r = ttm_bo_device_init(&rdev->mman.bdev, 443 r = ttm_bo_device_init(&rdev->mman.bdev,
444 rdev->mman.mem_global_ref.object, 444 rdev->mman.mem_global_ref.object,
445 &radeon_bo_driver, DRM_FILE_PAGE_OFFSET); 445 &radeon_bo_driver, DRM_FILE_PAGE_OFFSET,
446 rdev->need_dma32);
446 if (r) { 447 if (r) {
447 DRM_ERROR("failed initializing buffer object driver(%d).\n", r); 448 DRM_ERROR("failed initializing buffer object driver(%d).\n", r);
448 return r; 449 return r;
diff --git a/drivers/gpu/drm/ttm/ttm_bo.c b/drivers/gpu/drm/ttm/ttm_bo.c
index a753598a5e35..e55e7972c897 100644
--- a/drivers/gpu/drm/ttm/ttm_bo.c
+++ b/drivers/gpu/drm/ttm/ttm_bo.c
@@ -224,6 +224,9 @@ static int ttm_bo_add_ttm(struct ttm_buffer_object *bo, bool zero_alloc)
224 TTM_ASSERT_LOCKED(&bo->mutex); 224 TTM_ASSERT_LOCKED(&bo->mutex);
225 bo->ttm = NULL; 225 bo->ttm = NULL;
226 226
227 if (bdev->need_dma32)
228 page_flags |= TTM_PAGE_FLAG_DMA32;
229
227 switch (bo->type) { 230 switch (bo->type) {
228 case ttm_bo_type_device: 231 case ttm_bo_type_device:
229 if (zero_alloc) 232 if (zero_alloc)
@@ -1332,7 +1335,8 @@ EXPORT_SYMBOL(ttm_bo_device_release);
1332 1335
1333int ttm_bo_device_init(struct ttm_bo_device *bdev, 1336int ttm_bo_device_init(struct ttm_bo_device *bdev,
1334 struct ttm_mem_global *mem_glob, 1337 struct ttm_mem_global *mem_glob,
1335 struct ttm_bo_driver *driver, uint64_t file_page_offset) 1338 struct ttm_bo_driver *driver, uint64_t file_page_offset,
1339 bool need_dma32)
1336{ 1340{
1337 int ret = -EINVAL; 1341 int ret = -EINVAL;
1338 1342
@@ -1369,6 +1373,7 @@ int ttm_bo_device_init(struct ttm_bo_device *bdev,
1369 INIT_LIST_HEAD(&bdev->ddestroy); 1373 INIT_LIST_HEAD(&bdev->ddestroy);
1370 INIT_LIST_HEAD(&bdev->swap_lru); 1374 INIT_LIST_HEAD(&bdev->swap_lru);
1371 bdev->dev_mapping = NULL; 1375 bdev->dev_mapping = NULL;
1376 bdev->need_dma32 = need_dma32;
1372 ttm_mem_init_shrink(&bdev->shrink, ttm_bo_swapout); 1377 ttm_mem_init_shrink(&bdev->shrink, ttm_bo_swapout);
1373 ret = ttm_mem_register_shrink(mem_glob, &bdev->shrink); 1378 ret = ttm_mem_register_shrink(mem_glob, &bdev->shrink);
1374 if (unlikely(ret != 0)) { 1379 if (unlikely(ret != 0)) {
diff --git a/drivers/gpu/drm/ttm/ttm_tt.c b/drivers/gpu/drm/ttm/ttm_tt.c
index 75dc8bd24592..81ab81f030a3 100644
--- a/drivers/gpu/drm/ttm/ttm_tt.c
+++ b/drivers/gpu/drm/ttm/ttm_tt.c
@@ -131,10 +131,15 @@ static void ttm_tt_free_page_directory(struct ttm_tt *ttm)
131 131
132static struct page *ttm_tt_alloc_page(unsigned page_flags) 132static struct page *ttm_tt_alloc_page(unsigned page_flags)
133{ 133{
134 gfp_t gfp_flags = GFP_HIGHUSER;
135
134 if (page_flags & TTM_PAGE_FLAG_ZERO_ALLOC) 136 if (page_flags & TTM_PAGE_FLAG_ZERO_ALLOC)
135 return alloc_page(GFP_HIGHUSER | __GFP_ZERO); 137 gfp_flags |= __GFP_ZERO;
138
139 if (page_flags & TTM_PAGE_FLAG_DMA32)
140 gfp_flags |= __GFP_DMA32;
136 141
137 return alloc_page(GFP_HIGHUSER); 142 return alloc_page(gfp_flags);
138} 143}
139 144
140static void ttm_tt_free_user_pages(struct ttm_tt *ttm) 145static void ttm_tt_free_user_pages(struct ttm_tt *ttm)
diff --git a/include/drm/ttm/ttm_bo_driver.h b/include/drm/ttm/ttm_bo_driver.h
index 62ed733c52a2..ea83dd23a4d7 100644
--- a/include/drm/ttm/ttm_bo_driver.h
+++ b/include/drm/ttm/ttm_bo_driver.h
@@ -121,6 +121,7 @@ struct ttm_backend {
121#define TTM_PAGE_FLAG_SWAPPED (1 << 4) 121#define TTM_PAGE_FLAG_SWAPPED (1 << 4)
122#define TTM_PAGE_FLAG_PERSISTANT_SWAP (1 << 5) 122#define TTM_PAGE_FLAG_PERSISTANT_SWAP (1 << 5)
123#define TTM_PAGE_FLAG_ZERO_ALLOC (1 << 6) 123#define TTM_PAGE_FLAG_ZERO_ALLOC (1 << 6)
124#define TTM_PAGE_FLAG_DMA32 (1 << 7)
124 125
125enum ttm_caching_state { 126enum ttm_caching_state {
126 tt_uncached, 127 tt_uncached,
@@ -429,6 +430,8 @@ struct ttm_bo_device {
429 */ 430 */
430 431
431 struct delayed_work wq; 432 struct delayed_work wq;
433
434 bool need_dma32;
432}; 435};
433 436
434/** 437/**
@@ -648,7 +651,7 @@ extern int ttm_bo_device_release(struct ttm_bo_device *bdev);
648extern int ttm_bo_device_init(struct ttm_bo_device *bdev, 651extern int ttm_bo_device_init(struct ttm_bo_device *bdev,
649 struct ttm_mem_global *mem_glob, 652 struct ttm_mem_global *mem_glob,
650 struct ttm_bo_driver *driver, 653 struct ttm_bo_driver *driver,
651 uint64_t file_page_offset); 654 uint64_t file_page_offset, bool need_dma32);
652 655
653/** 656/**
654 * ttm_bo_reserve: 657 * ttm_bo_reserve: