ttm: Expand (*populate) to support an array of DMA addresses.
authorKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Thu, 2 Dec 2010 15:24:13 +0000 (10:24 -0500)
committerKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Thu, 27 Jan 2011 21:07:58 +0000 (16:07 -0500)
We pass in the array of ttm pages to be populated in the GART/MM
of the card (or AGP). Patch titled: "ttm: Utilize the DMA API for
pages that have TTM_PAGE_FLAG_DMA32 set." uses the DMA API to make
those pages have a proper DMA addresses (in the situation where
page_to_phys or virt_to_phys do not give use the DMA (bus) address).

Since we are using the DMA API on those pages, we should pass in the
DMA address to this function so it can save it in its proper fields
(later patches use it).

[v2: Added reviewed-by tag]

Reviewed-by: Thomas Hellstrom <thellstrom@shipmail.org>
Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Tested-by: Ian Campbell <ian.campbell@citrix.com>
drivers/gpu/drm/nouveau/nouveau_sgdma.c
drivers/gpu/drm/radeon/radeon_ttm.c
drivers/gpu/drm/ttm/ttm_agp_backend.c
drivers/gpu/drm/ttm/ttm_tt.c
drivers/gpu/drm/vmwgfx/vmwgfx_buffer.c
include/drm/ttm/ttm_bo_driver.h

index 288bacac7e5aefc2f3c6c9b4f461a7e48d6e9ce7..edc140ab4df1ee6db8c22daafe25b8fca1dd064d 100644 (file)
@@ -20,7 +20,8 @@ struct nouveau_sgdma_be {
 
 static int
 nouveau_sgdma_populate(struct ttm_backend *be, unsigned long num_pages,
-                      struct page **pages, struct page *dummy_read_page)
+                      struct page **pages, struct page *dummy_read_page,
+                      dma_addr_t *dma_addrs)
 {
        struct nouveau_sgdma_be *nvbe = (struct nouveau_sgdma_be *)be;
        struct drm_device *dev = nvbe->dev;
index 01c2c736a1daff116284db0f84f3896977e6eecb..6f156e9d3f31fb0359cf505157fb6213e97a25cd 100644 (file)
@@ -655,7 +655,8 @@ struct radeon_ttm_backend {
 static int radeon_ttm_backend_populate(struct ttm_backend *backend,
                                       unsigned long num_pages,
                                       struct page **pages,
-                                      struct page *dummy_read_page)
+                                      struct page *dummy_read_page,
+                                      dma_addr_t *dma_addrs)
 {
        struct radeon_ttm_backend *gtt;
 
index f999e36f30b4c184fd5d04aa2f34bf085eba89ab..1c4a72f681c16c89c9ebf0378330910654fa713d 100644 (file)
@@ -47,7 +47,8 @@ struct ttm_agp_backend {
 
 static int ttm_agp_populate(struct ttm_backend *backend,
                            unsigned long num_pages, struct page **pages,
-                           struct page *dummy_read_page)
+                           struct page *dummy_read_page,
+                           dma_addr_t *dma_addrs)
 {
        struct ttm_agp_backend *agp_be =
            container_of(backend, struct ttm_agp_backend, backend);
index 0d39001259fbb80eea8b4e3eef3246b7fe54946a..86d5b1745a45a09cc0dd977a0cf6b1b655bc99cd 100644 (file)
@@ -169,7 +169,7 @@ int ttm_tt_populate(struct ttm_tt *ttm)
        }
 
        be->func->populate(be, ttm->num_pages, ttm->pages,
-                          ttm->dummy_read_page);
+                          ttm->dummy_read_page, ttm->dma_address);
        ttm->state = tt_unbound;
        return 0;
 }
index 80bc37b274e71b29c6b8c5622a020b945c915410..87e43e0733bfcaa14d5bf42c6ac25b580dbb7e86 100644 (file)
@@ -102,7 +102,8 @@ struct vmw_ttm_backend {
 
 static int vmw_ttm_populate(struct ttm_backend *backend,
                            unsigned long num_pages, struct page **pages,
-                           struct page *dummy_read_page)
+                           struct page *dummy_read_page,
+                           dma_addr_t *dma_addrs)
 {
        struct vmw_ttm_backend *vmw_be =
            container_of(backend, struct vmw_ttm_backend, backend);
index 6dc4fccda73cbc5a149b6f4f509e563a195b5a64..ebcd3dd7203bf56a9f174194df6bad896bbdff38 100644 (file)
@@ -50,13 +50,15 @@ struct ttm_backend_func {
         * @pages: Array of pointers to ttm pages.
         * @dummy_read_page: Page to be used instead of NULL pages in the
         * array @pages.
+        * @dma_addrs: Array of DMA (bus) address of the ttm pages.
         *
         * Populate the backend with ttm pages. Depending on the backend,
         * it may or may not copy the @pages array.
         */
        int (*populate) (struct ttm_backend *backend,
                         unsigned long num_pages, struct page **pages,
-                        struct page *dummy_read_page);
+                        struct page *dummy_read_page,
+                        dma_addr_t *dma_addrs);
        /**
         * struct ttm_backend_func member clear
         *