page_pool: use DMA_ATTR_SKIP_CPU_SYNC for DMA mappings
authorJesper Dangaard Brouer <brouer@redhat.com>
Wed, 13 Feb 2019 01:55:50 +0000 (02:55 +0100)
committerDavid S. Miller <davem@davemloft.net>
Thu, 14 Feb 2019 06:00:16 +0000 (22:00 -0800)
As pointed out by Alexander Duyck, the DMA mapping done in page_pool needs
to use the DMA attribute DMA_ATTR_SKIP_CPU_SYNC.

As the principle behind page_pool keeping the pages mapped is that the
driver takes over the DMA-sync steps.

Reported-by: Alexander Duyck <alexander.duyck@gmail.com>
Signed-off-by: Jesper Dangaard Brouer <brouer@redhat.com>
Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/core/page_pool.c

index 897a69a1477e25c49ca67fa094a51e5aa70f1047..5b2252c6d49baf58e7cc3f399adb299b5147bf60 100644 (file)
@@ -141,9 +141,9 @@ static struct page *__page_pool_alloc_pages_slow(struct page_pool *pool,
         * into page private data (i.e 32bit cpu with 64bit DMA caps)
         * This mapping is kept for lifetime of page, until leaving pool.
         */
-       dma = dma_map_page(pool->p.dev, page, 0,
-                          (PAGE_SIZE << pool->p.order),
-                          pool->p.dma_dir);
+       dma = dma_map_page_attrs(pool->p.dev, page, 0,
+                                (PAGE_SIZE << pool->p.order),
+                                pool->p.dma_dir, DMA_ATTR_SKIP_CPU_SYNC);
        if (dma_mapping_error(pool->p.dev, dma)) {
                put_page(page);
                return NULL;
@@ -184,8 +184,9 @@ static void __page_pool_clean_page(struct page_pool *pool,
 
        dma = page->dma_addr;
        /* DMA unmap */
-       dma_unmap_page(pool->p.dev, dma,
-                      PAGE_SIZE << pool->p.order, pool->p.dma_dir);
+       dma_unmap_page_attrs(pool->p.dev, dma,
+                            PAGE_SIZE << pool->p.order, pool->p.dma_dir,
+                            DMA_ATTR_SKIP_CPU_SYNC);
        page->dma_addr = 0;
 }