From: Pavel Begunkov <asml.silence@gmail.com>
To: io-uring@vger.kernel.org
Cc: asml.silence@gmail.com, Alexey Charkov <alchark@gmail.com>
Subject: [PATCH 1/1] io_uring/zcrx: fix builds without dmabuf
Date: Tue, 6 May 2025 17:08:56 +0100 [thread overview]
Message-ID: <6e37db97303212bbd8955f9501cf99b579f8aece.1746547722.git.asml.silence@gmail.com> (raw)
armv7a-unknown-linux-gnueabihf-ld: io_uring/zcrx.o: in function
`io_release_dmabuf':
zcrx.c:(.text+0x1c): undefined reference to `dma_buf_unmap_attachment_unlocked'
armv7a-unknown-linux-gnueabihf-ld: zcrx.c:(.text+0x30): undefined
reference to `dma_buf_detach'
armv7a-unknown-linux-gnueabihf-ld: zcrx.c:(.text+0x40): undefined
reference to `dma_buf_put'
armv7a-unknown-linux-gnueabihf-ld: io_uring/zcrx.o: in function
`io_register_zcrx_ifq':
zcrx.c:(.text+0x15cc): undefined reference to `dma_buf_get'
armv7a-unknown-linux-gnueabihf-ld: zcrx.c:(.text+0x15e8): undefined
reference to `dma_buf_attach'
armv7a-unknown-linux-gnueabihf-ld: zcrx.c:(.text+0x1604): undefined
reference to `dma_buf_map_attachment_unlocked'
make[2]: *** [scripts/Makefile.vmlinux:91: vmlinux] Error 1
make[1]: *** [/home/alchark/linux/Makefile:1242: vmlinux] Error 2
make: *** [Makefile:248: __sub-make] Error 2
There are no definitions for dma-buf functions without
CONFIG_DMA_SHARED_BUFFER, make sure we don't try to link to them
if dma-bufs are not enabled.
Reported-by: Alexey Charkov <alchark@gmail.com>
Signed-off-by: Pavel Begunkov <asml.silence@gmail.com>
---
io_uring/zcrx.c | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/io_uring/zcrx.c b/io_uring/zcrx.c
index fac293bcba72..9a568d049204 100644
--- a/io_uring/zcrx.c
+++ b/io_uring/zcrx.c
@@ -49,6 +49,9 @@ static inline struct page *io_zcrx_iov_page(const struct net_iov *niov)
static void io_release_dmabuf(struct io_zcrx_mem *mem)
{
+ if (!IS_ENABLED(CONFIG_DMA_SHARED_BUFFER))
+ return;
+
if (mem->sgt)
dma_buf_unmap_attachment_unlocked(mem->attach, mem->sgt,
DMA_FROM_DEVICE);
@@ -75,6 +78,8 @@ static int io_import_dmabuf(struct io_zcrx_ifq *ifq,
if (WARN_ON_ONCE(!ifq->dev))
return -EFAULT;
+ if (!IS_ENABLED(CONFIG_DMA_SHARED_BUFFER))
+ return -EINVAL;
mem->is_dmabuf = true;
mem->dmabuf = dma_buf_get(dmabuf_fd);
@@ -118,6 +123,9 @@ static int io_zcrx_map_area_dmabuf(struct io_zcrx_ifq *ifq, struct io_zcrx_area
struct scatterlist *sg;
unsigned i, niov_idx = 0;
+ if (!IS_ENABLED(CONFIG_DMA_SHARED_BUFFER))
+ return -EINVAL;
+
for_each_sgtable_dma_sg(area->mem.sgt, sg, i) {
dma_addr_t dma = sg_dma_address(sg);
unsigned long sg_len = sg_dma_len(sg);
--
2.49.0
next reply other threads:[~2025-05-06 16:07 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-05-06 16:08 Pavel Begunkov [this message]
2025-05-06 16:10 ` [PATCH 1/1] io_uring/zcrx: fix builds without dmabuf Pavel Begunkov
2025-05-06 16:11 ` Jens Axboe
2025-05-06 16:58 ` Alexey Charkov
2025-05-07 7:35 ` Pavel Begunkov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=6e37db97303212bbd8955f9501cf99b579f8aece.1746547722.git.asml.silence@gmail.com \
--to=asml.silence@gmail.com \
--cc=alchark@gmail.com \
--cc=io-uring@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox