aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/ttm
diff options
context:
space:
mode:
authorKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>2010-11-29 13:52:18 -0500
committerKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>2011-01-27 16:02:31 -0500
commitf9820a46dd7888b05a36e81166fb1abcc47dcc3f (patch)
treec29e32a8fe8b08bc42120ce66c6536afd5c102df /drivers/gpu/drm/ttm
parente53beacd23d9cb47590da6a7a7f6d417b941a994 (diff)
ttm: Introduce a placeholder for DMA (bus) addresses.
This is right now limited to only non-pool constructs. [v2: Fixed indentation issues, add review-by tag] Reviewed-by: Thomas Hellstrom <thomas@shipmail.org> Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com> Tested-by: Ian Campbell <ian.campbell@citrix.com>
Diffstat (limited to 'drivers/gpu/drm/ttm')
-rw-r--r--drivers/gpu/drm/ttm/ttm_page_alloc.c8
-rw-r--r--drivers/gpu/drm/ttm/ttm_tt.c10
2 files changed, 13 insertions, 5 deletions
diff --git a/drivers/gpu/drm/ttm/ttm_page_alloc.c b/drivers/gpu/drm/ttm/ttm_page_alloc.c
index b1e02fffd3cc..9d9d92945f8c 100644
--- a/drivers/gpu/drm/ttm/ttm_page_alloc.c
+++ b/drivers/gpu/drm/ttm/ttm_page_alloc.c
@@ -38,6 +38,7 @@
38#include <linux/mm.h> 38#include <linux/mm.h>
39#include <linux/seq_file.h> /* for seq_printf */ 39#include <linux/seq_file.h> /* for seq_printf */
40#include <linux/slab.h> 40#include <linux/slab.h>
41#include <linux/dma-mapping.h>
41 42
42#include <asm/atomic.h> 43#include <asm/atomic.h>
43 44
@@ -662,7 +663,8 @@ out:
662 * cached pages. 663 * cached pages.
663 */ 664 */
664int ttm_get_pages(struct list_head *pages, int flags, 665int ttm_get_pages(struct list_head *pages, int flags,
665 enum ttm_caching_state cstate, unsigned count) 666 enum ttm_caching_state cstate, unsigned count,
667 dma_addr_t *dma_address)
666{ 668{
667 struct ttm_page_pool *pool = ttm_get_pool(flags, cstate); 669 struct ttm_page_pool *pool = ttm_get_pool(flags, cstate);
668 struct page *p = NULL; 670 struct page *p = NULL;
@@ -720,7 +722,7 @@ int ttm_get_pages(struct list_head *pages, int flags,
720 printk(KERN_ERR TTM_PFX 722 printk(KERN_ERR TTM_PFX
721 "Failed to allocate extra pages " 723 "Failed to allocate extra pages "
722 "for large request."); 724 "for large request.");
723 ttm_put_pages(pages, 0, flags, cstate); 725 ttm_put_pages(pages, 0, flags, cstate, NULL);
724 return r; 726 return r;
725 } 727 }
726 } 728 }
@@ -731,7 +733,7 @@ int ttm_get_pages(struct list_head *pages, int flags,
731 733
732/* Put all pages in pages list to correct pool to wait for reuse */ 734/* Put all pages in pages list to correct pool to wait for reuse */
733void ttm_put_pages(struct list_head *pages, unsigned page_count, int flags, 735void ttm_put_pages(struct list_head *pages, unsigned page_count, int flags,
734 enum ttm_caching_state cstate) 736 enum ttm_caching_state cstate, dma_addr_t *dma_address)
735{ 737{
736 unsigned long irq_flags; 738 unsigned long irq_flags;
737 struct ttm_page_pool *pool = ttm_get_pool(flags, cstate); 739 struct ttm_page_pool *pool = ttm_get_pool(flags, cstate);
diff --git a/drivers/gpu/drm/ttm/ttm_tt.c b/drivers/gpu/drm/ttm/ttm_tt.c
index af789dc869b9..0d39001259fb 100644
--- a/drivers/gpu/drm/ttm/ttm_tt.c
+++ b/drivers/gpu/drm/ttm/ttm_tt.c
@@ -49,12 +49,16 @@ static int ttm_tt_swapin(struct ttm_tt *ttm);
49static void ttm_tt_alloc_page_directory(struct ttm_tt *ttm) 49static void ttm_tt_alloc_page_directory(struct ttm_tt *ttm)
50{ 50{
51 ttm->pages = drm_calloc_large(ttm->num_pages, sizeof(*ttm->pages)); 51 ttm->pages = drm_calloc_large(ttm->num_pages, sizeof(*ttm->pages));
52 ttm->dma_address = drm_calloc_large(ttm->num_pages,
53 sizeof(*ttm->dma_address));
52} 54}
53 55
54static void ttm_tt_free_page_directory(struct ttm_tt *ttm) 56static void ttm_tt_free_page_directory(struct ttm_tt *ttm)
55{ 57{
56 drm_free_large(ttm->pages); 58 drm_free_large(ttm->pages);
57 ttm->pages = NULL; 59 ttm->pages = NULL;
60 drm_free_large(ttm->dma_address);
61 ttm->dma_address = NULL;
58} 62}
59 63
60static void ttm_tt_free_user_pages(struct ttm_tt *ttm) 64static void ttm_tt_free_user_pages(struct ttm_tt *ttm)
@@ -105,7 +109,8 @@ static struct page *__ttm_tt_get_page(struct ttm_tt *ttm, int index)
105 109
106 INIT_LIST_HEAD(&h); 110 INIT_LIST_HEAD(&h);
107 111
108 ret = ttm_get_pages(&h, ttm->page_flags, ttm->caching_state, 1); 112 ret = ttm_get_pages(&h, ttm->page_flags, ttm->caching_state, 1,
113 &ttm->dma_address[index]);
109 114
110 if (ret != 0) 115 if (ret != 0)
111 return NULL; 116 return NULL;
@@ -298,7 +303,8 @@ static void ttm_tt_free_alloced_pages(struct ttm_tt *ttm)
298 count++; 303 count++;
299 } 304 }
300 } 305 }
301 ttm_put_pages(&h, count, ttm->page_flags, ttm->caching_state); 306 ttm_put_pages(&h, count, ttm->page_flags, ttm->caching_state,
307 ttm->dma_address);
302 ttm->state = tt_unpopulated; 308 ttm->state = tt_unpopulated;
303 ttm->first_himem_page = ttm->num_pages; 309 ttm->first_himem_page = ttm->num_pages;
304 ttm->last_lomem_page = -1; 310 ttm->last_lomem_page = -1;