]> www.infradead.org Git - users/dwmw2/linux.git/commitdiff
page_pool: Set `dma_sync` to false for devmem memory provider
authorSamiullah Khawaja <skhawaja@google.com>
Wed, 11 Dec 2024 21:20:30 +0000 (21:20 +0000)
committerJakub Kicinski <kuba@kernel.org>
Fri, 13 Dec 2024 02:49:07 +0000 (18:49 -0800)
Move the `dma_map` and `dma_sync` checks to `page_pool_init` to make
them generic. Set dma_sync to false for devmem memory provider because
the dma_sync APIs should not be used for dma_buf backed devmem memory
provider.

Cc: Jason Gunthorpe <jgg@ziepe.ca>
Signed-off-by: Samiullah Khawaja <skhawaja@google.com>
Signed-off-by: Mina Almasry <almasrymina@google.com>
Link: https://patch.msgid.link/20241211212033.1684197-4-almasrymina@google.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
net/core/devmem.c
net/core/page_pool.c

index 11b91c12ee11358de9615546cc20f35a05dcfc89..3ebdeed2bf188d7c20420efc76edad421cb7f7c0 100644 (file)
@@ -331,11 +331,10 @@ int mp_dmabuf_devmem_init(struct page_pool *pool)
        if (!binding)
                return -EINVAL;
 
-       if (!pool->dma_map)
-               return -EOPNOTSUPP;
-
-       if (pool->dma_sync)
-               return -EOPNOTSUPP;
+       /* dma-buf dma addresses do not need and should not be used with
+        * dma_sync_for_cpu/device. Force disable dma_sync.
+        */
+       pool->dma_sync = false;
 
        if (pool->p.order != 0)
                return -E2BIG;
index 7a17af286a9e1550831b4486a43b703e6e2f435d..275a7fd209d7a4e50dfec8f0494be23fc8829e74 100644 (file)
@@ -287,6 +287,9 @@ static int page_pool_init(struct page_pool *pool,
        }
 
        if (pool->mp_priv) {
+               if (!pool->dma_map || !pool->dma_sync)
+                       return -EOPNOTSUPP;
+
                err = mp_dmabuf_devmem_init(pool);
                if (err) {
                        pr_warn("%s() mem-provider init failed %d\n", __func__,