]> git.ipfire.org Git - thirdparty/openwrt.git/commitdiff
generic: 6.18: hack: io_uring: zcrx: Use IS_REACHABLE() instead of IS_ENABLED()
authorRobert Marko <robert.marko@sartura.hr>
Tue, 31 Mar 2026 16:54:47 +0000 (18:54 +0200)
committerRobert Marko <robimarko@gmail.com>
Tue, 31 Mar 2026 16:55:50 +0000 (18:55 +0200)
We patch DMA_BUF to make it tristate, so once ALL_KMODS is selected it will
be built as a module even if previously disabled in the config.

So, since IO_URING_ZCRX does not depend on DMA_BUF linking will fail with:
aarch64-openwrt-linux-musl-ld: Unexpected GOT/PLT entries detected!
aarch64-openwrt-linux-musl-ld: Unexpected run-time procedure linkages detected!
aarch64-openwrt-linux-musl-ld: io_uring/zcrx.o: in function `io_release_dmabuf':
io_uring/zcrx.c:94:(.text+0x20): undefined reference to `dma_buf_unmap_attachment_unlocked'
aarch64-openwrt-linux-musl-ld: io_uring/zcrx.c:97:(.text+0x30): undefined reference to `dma_buf_detach'
aarch64-openwrt-linux-musl-ld: io_uring/zcrx.c:99:(.text+0x3c): undefined reference to `dma_buf_put'
aarch64-openwrt-linux-musl-ld: io_uring/zcrx.o: in function `io_import_dmabuf':
io_uring/zcrx.c:125:(.text+0x1b20): undefined reference to `dma_buf_get'
aarch64-openwrt-linux-musl-ld: io_uring/zcrx.c:132:(.text+0x1b34): undefined reference to `dma_buf_attach'
aarch64-openwrt-linux-musl-ld: io_uring/zcrx.c:139:(.text+0x1b48): undefined reference to `dma_buf_map_attachment_unlocked'
make[6]: *** [scripts/Makefile.vmlinux:72: vmlinux.unstripped] Error 1

So, lets use IS_REACHABLE() to check for CONFIG_DMA_SHARED_BUFFER instead
to avoid adding a dependency to CONFIG_DMA_SHARED_BUFFER.

Signed-off-by: Robert Marko <robert.marko@sartura.hr>
target/linux/generic/hack-6.18/905-io_uring-zcrx-Use-IS_REACHABLE-instead-of-IS_ENABLED.patch [new file with mode: 0644]

diff --git a/target/linux/generic/hack-6.18/905-io_uring-zcrx-Use-IS_REACHABLE-instead-of-IS_ENABLED.patch b/target/linux/generic/hack-6.18/905-io_uring-zcrx-Use-IS_REACHABLE-instead-of-IS_ENABLED.patch
new file mode 100644 (file)
index 0000000..b54a0af
--- /dev/null
@@ -0,0 +1,49 @@
+From 6f6357583c491b451fb510071e39b6c56a521f95 Mon Sep 17 00:00:00 2001
+From: Robert Marko <robert.marko@sartura.hr>
+Date: Tue, 31 Mar 2026 18:37:02 +0200
+Subject: [PATCH] io_uring: zcrx: Use IS_REACHABLE() instead of IS_ENABLED()
+
+We patch DMA_BUF to make it tristate, so once ALL_KMODS is selected it will
+be built as a module even if previously disabled in the config.
+
+So, since IO_URING_ZCRX does not depend on DMA_BUF linking will fail with:
+aarch64-openwrt-linux-musl-ld: Unexpected GOT/PLT entries detected!
+aarch64-openwrt-linux-musl-ld: Unexpected run-time procedure linkages detected!
+aarch64-openwrt-linux-musl-ld: io_uring/zcrx.o: in function `io_release_dmabuf':
+io_uring/zcrx.c:94:(.text+0x20): undefined reference to `dma_buf_unmap_attachment_unlocked'
+aarch64-openwrt-linux-musl-ld: io_uring/zcrx.c:97:(.text+0x30): undefined reference to `dma_buf_detach'
+aarch64-openwrt-linux-musl-ld: io_uring/zcrx.c:99:(.text+0x3c): undefined reference to `dma_buf_put'
+aarch64-openwrt-linux-musl-ld: io_uring/zcrx.o: in function `io_import_dmabuf':
+io_uring/zcrx.c:125:(.text+0x1b20): undefined reference to `dma_buf_get'
+aarch64-openwrt-linux-musl-ld: io_uring/zcrx.c:132:(.text+0x1b34): undefined reference to `dma_buf_attach'
+aarch64-openwrt-linux-musl-ld: io_uring/zcrx.c:139:(.text+0x1b48): undefined reference to `dma_buf_map_attachment_unlocked'
+make[6]: *** [scripts/Makefile.vmlinux:72: vmlinux.unstripped] Error 1
+
+So, lets use IS_REACHABLE() to check for CONFIG_DMA_SHARED_BUFFER instead
+to avoid adding a dependency to CONFIG_DMA_SHARED_BUFFER.
+
+Signed-off-by: Robert Marko <robert.marko@sartura.hr>
+---
+ io_uring/zcrx.c | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+--- a/io_uring/zcrx.c
++++ b/io_uring/zcrx.c
+@@ -87,7 +87,7 @@ static int io_populate_area_dma(struct i
+ static void io_release_dmabuf(struct io_zcrx_mem *mem)
+ {
+-      if (!IS_ENABLED(CONFIG_DMA_SHARED_BUFFER))
++      if (!IS_REACHABLE(CONFIG_DMA_SHARED_BUFFER))
+               return;
+       if (mem->sgt)
+@@ -118,7 +118,7 @@ static int io_import_dmabuf(struct io_zc
+               return -EINVAL;
+       if (WARN_ON_ONCE(!ifq->dev))
+               return -EFAULT;
+-      if (!IS_ENABLED(CONFIG_DMA_SHARED_BUFFER))
++      if (!IS_REACHABLE(CONFIG_DMA_SHARED_BUFFER))
+               return -EINVAL;
+       mem->is_dmabuf = true;