From: Edwin Peer <epeer@nvidia.com>
To: dakr@kernel.org, aliceryhl@google.com, phasta@kernel.org,
sumit.semwal@linaro.org, christian.koenig@amd.com
Cc: jhubbard@nvidia.com, rust-for-linux@vger.kernel.org,
dri-devel@lists.freedesktop.org, linux-media@vger.kernel.org,
linaro-mm-sig@lists.linaro.org, linux-kernel@vger.kernel.org,
Edwin Peer <epeer@nvidia.com>
Subject: [PATCH drm-rust-next] rust: dma_fence: gate abstractions on CONFIG_DMA_SHARED_BUFFER
Date: Wed, 9 Sep 2026 13:23:27 -0700 [thread overview]
Message-ID: <20260909202327.33285-1-epeer@nvidia.com> (raw)
The dma_fence abstractions added by commit 3282d5916019 ("rust: Add
dma_fence abstractions") are compiled unconditionally, but the C
`dma_fence_*` symbols they reference live in
drivers/dma-buf/dma-fence.c, which is only built when
CONFIG_DMA_SHARED_BUFFER=y. Kernels with CONFIG_RUST=y and
CONFIG_RUST_KERNEL_DOCTESTS=y but CONFIG_DMA_SHARED_BUFFER=n fail
to link:
ld.lld: error: undefined symbol: dma_fence_release
>>> referenced by usercopy_64.c
>>> vmlinux.o:(rust_helper_dma_fence_put)
... dma_fence_signal{,_locked}, dma_fence_context_alloc,
dma_fence_init, dma_fence_{add,remove}_callback ...
Wrap the dma_fence.c helper include in the same
`pub mod dma_buf;` in rust/kernel/lib.rs with a matching #[cfg].
Fixes: 3282d5916019 ("rust: Add dma_fence abstractions")
Signed-off-by: Edwin Peer <epeer@nvidia.com>
Reviewed-by: John Hubbard <jhubbard@nvidia.com>
---
rust/helpers/helpers.c | 2 +-
rust/kernel/lib.rs | 1 +
2 files changed, 2 insertions(+), 1 deletion(-)
diff --git a/rust/helpers/helpers.c b/rust/helpers/helpers.c
index 609689fba3dd..2c5eecc091c4 100644
--- a/rust/helpers/helpers.c
+++ b/rust/helpers/helpers.c
@@ -57,8 +57,8 @@
#include "cred.c"
#include "device.c"
#include "dma.c"
-#include "dma_fence.c"
#ifdef CONFIG_DMA_SHARED_BUFFER
+#include "dma_fence.c"
#include "dma-resv.c"
#endif
#include "drm.c"
diff --git a/rust/kernel/lib.rs b/rust/kernel/lib.rs
index 72f5527ba66c..f9ef36217bb5 100644
--- a/rust/kernel/lib.rs
+++ b/rust/kernel/lib.rs
@@ -67,6 +67,7 @@
pub mod device_id;
pub mod devres;
pub mod dma;
+#[cfg(CONFIG_DMA_SHARED_BUFFER)]
pub mod dma_buf;
pub mod driver;
#[cfg(CONFIG_DRM = "y")]
--
2.50.1 (Apple Git-155)
next reply other threads:[~2026-09-09 20:23 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-09 20:23 Edwin Peer [this message]
2026-09-10 7:17 ` Philipp Stanner
2026-09-10 13:36 ` Danilo Krummrich
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=20260909202327.33285-1-epeer@nvidia.com \
--to=epeer@nvidia.com \
--cc=aliceryhl@google.com \
--cc=christian.koenig@amd.com \
--cc=dakr@kernel.org \
--cc=dri-devel@lists.freedesktop.org \
--cc=jhubbard@nvidia.com \
--cc=linaro-mm-sig@lists.linaro.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=phasta@kernel.org \
--cc=rust-for-linux@vger.kernel.org \
--cc=sumit.semwal@linaro.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
all inboxes | Powered by JetHome®