diff options
author | Dave Airlie <airlied@linux.ie> | 2009-07-10 08:36:26 -0400 |
---|---|---|
committer | Dave Airlie <airlied@redhat.com> | 2009-07-15 03:13:18 -0400 |
commit | ad49f501867cba87e1e45e5ebae0b12435d68bf1 (patch) | |
tree | 4602e5caf96451b1dcdda7a38628d494466d2e20 /drivers/gpu/drm/ttm | |
parent | 61b576dbbe6a19d102c025ebc102a0749e2d3c80 (diff) |
drm/ttm/radeon: add dma32 support.
This add support for using dma32 memory on gpus that really need it.
Currently IGPs are left without DMA32 but we might need to change
that unless we can fix rs690.
Signed-off-by: Dave Airlie <airlied@redhat.com>
Diffstat (limited to 'drivers/gpu/drm/ttm')
-rw-r--r-- | drivers/gpu/drm/ttm/ttm_bo.c | 7 | ||||
-rw-r--r-- | drivers/gpu/drm/ttm/ttm_tt.c | 9 |
2 files changed, 13 insertions, 3 deletions
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 | ||
1333 | int ttm_bo_device_init(struct ttm_bo_device *bdev, | 1336 | int 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 | ||
132 | static struct page *ttm_tt_alloc_page(unsigned page_flags) | 132 | static 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 | ||
140 | static void ttm_tt_free_user_pages(struct ttm_tt *ttm) | 145 | static void ttm_tt_free_user_pages(struct ttm_tt *ttm) |