rust-for-linux.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Danilo Krummrich" <dakr@kernel.org>
To: "FUJITA Tomonori" <fujita.tomonori@gmail.com>
Cc: <ojeda@kernel.org>, <a.hindborg@kernel.org>,
	<abdiel.janulgue@gmail.com>, <aliceryhl@google.com>,
	<bjorn3_gh@protonmail.com>, <boqun.feng@gmail.com>,
	<daniel.almeida@collabora.com>, <gary@garyguo.net>,
	<lossin@kernel.org>, <robin.murphy@arm.com>,
	<rust-for-linux@vger.kernel.org>, <tmgross@umich.edu>,
	<stable@vger.kernel.org>
Subject: Re: [PATCH v1] rust: Add some DMA helpers for architectures without CONFIG_HAS_DMA
Date: Tue, 16 Dec 2025 13:29:14 +0100	[thread overview]
Message-ID: <DEZN3V4LT8XM.VQRQ1IXP4DDU@kernel.org> (raw)
In-Reply-To: <20251204160639.364936-1-fujita.tomonori@gmail.com>

(Cc: stable@vger.kernel.org)

On Thu Dec 4, 2025 at 5:06 PM CET, FUJITA Tomonori wrote:
> Add dma_set_mask(), dma_set_coherent_mask(), dma_map_sgtable(), and
> dma_max_mapping_size() helpers to fix a build error when
> CONFIG_HAS_DMA is not enabled.
>
> Note that when CONFIG_HAS_DMA is enabled, they are included in both
> bindings_generated.rs and bindings_helpers_generated.rs. The former
> takes precedence so behavior remains unchanged in that case.
>
> This fixes the following build error on UML:
>
> error[E0425]: cannot find function `dma_set_mask` in crate `bindings`
>      --> /linux/rust/kernel/dma.rs:46:38
>       |
>    46 |         to_result(unsafe { bindings::dma_set_mask(self.as_ref().as_raw(), mask.value()) })
>       |                                      ^^^^^^^^^^^^ help: a function with a similar name exists: `xa_set_mark`
>       |
>      ::: /build/um/rust/bindings/bindings_generated.rs:24690:5
>       |
> 24690 |     pub fn xa_set_mark(arg1: *mut xarray, index: ffi::c_ulong, arg2: xa_mark_t);
>       |     ---------------------------------------------------------------------------- similarly named function `xa_set_mark` defined here
>
> error[E0425]: cannot find function `dma_set_coherent_mask` in crate `bindings`
>      --> /linux/rust/kernel/dma.rs:63:38
>       |
>    63 |         to_result(unsafe { bindings::dma_set_coherent_mask(self.as_ref().as_raw(), mask.value()) })
>       |                                      ^^^^^^^^^^^^^^^^^^^^^ help: a function with a similar name exists: `dma_coherent_ok`
>       |
>      ::: /build/um/rust/bindings/bindings_generated.rs:52745:5
>       |
> 52745 |     pub fn dma_coherent_ok(dev: *mut device, phys: phys_addr_t, size: usize) -> bool_;
>       |     ---------------------------------------------------------------------------------- similarly named function `dma_coherent_ok` defined here
>
> error[E0425]: cannot find function `dma_map_sgtable` in crate `bindings`
>     --> /linux/rust/kernel/scatterlist.rs:212:23
>      |
>  212 |               bindings::dma_map_sgtable(dev.as_raw(), sgt.as_ptr(), dir.into(), 0)
>      |                         ^^^^^^^^^^^^^^^ help: a function with a similar name exists: `dma_unmap_sgtable`
>      |
>     ::: /build/um/rust/bindings/bindings_helpers_generated.rs:1351:5
>      |
> 1351 | /     pub fn dma_unmap_sgtable(
> 1352 | |         dev: *mut device,
> 1353 | |         sgt: *mut sg_table,
> 1354 | |         dir: dma_data_direction,
> 1355 | |         attrs: ffi::c_ulong,
> 1356 | |     );
>      | |______- similarly named function `dma_unmap_sgtable` defined here
>
> error[E0425]: cannot find function `dma_max_mapping_size` in crate `bindings`
>    --> /linux/rust/kernel/scatterlist.rs:356:52
>     |
> 356 |         let max_segment = match unsafe { bindings::dma_max_mapping_size(dev.as_raw()) } {
>     |                                                    ^^^^^^^^^^^^^^^^^^^^ not found in `bindings`
>
> error: aborting due to 4 previous errors
>
> Fixes: 101d66828a4ee ("rust: dma: add DMA addressing capabilities")
> Signed-off-by: FUJITA Tomonori <fujita.tomonori@gmail.com>

Applied to driver-core-linus, thanks!

    [ Use relative paths in the error splat; add 'dma' prefix. - Danilo ]

      parent reply	other threads:[~2025-12-16 12:29 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-12-04 16:06 [PATCH v1] rust: Add some DMA helpers for architectures without CONFIG_HAS_DMA FUJITA Tomonori
2025-12-05  9:21 ` Alice Ryhl
2025-12-05  9:33   ` Miguel Ojeda
2025-12-10  1:46 ` David Gow
2025-12-16 12:29 ` Danilo Krummrich [this message]

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=DEZN3V4LT8XM.VQRQ1IXP4DDU@kernel.org \
    --to=dakr@kernel.org \
    --cc=a.hindborg@kernel.org \
    --cc=abdiel.janulgue@gmail.com \
    --cc=aliceryhl@google.com \
    --cc=bjorn3_gh@protonmail.com \
    --cc=boqun.feng@gmail.com \
    --cc=daniel.almeida@collabora.com \
    --cc=fujita.tomonori@gmail.com \
    --cc=gary@garyguo.net \
    --cc=lossin@kernel.org \
    --cc=ojeda@kernel.org \
    --cc=robin.murphy@arm.com \
    --cc=rust-for-linux@vger.kernel.org \
    --cc=stable@vger.kernel.org \
    --cc=tmgross@umich.edu \
    /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;
as well as URLs for NNTP newsgroup(s).