[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <aXN2LVQJqtZKGzQP@arm.com>
Date: Fri, 23 Jan 2026 14:22:53 +0100
From: Beata Michalska <beata.michalska@....com>
To: Danilo Krummrich <dakr@...nel.org>
Cc: ojeda@...nel.org, rust-for-linux@...r.kernel.org,
abdiel.janulgue@...il.com, daniel.almeida@...labora.com,
aliceryhl@...gle.com, robin.murphy@....com, a.hindborg@...nel.org,
boqun.feng@...il.com, gary@...yguo.net, bjorn3_gh@...tonmail.com,
lossin@...nel.org, tmgross@...ch.edu, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] rust: dma: allow drivers to tune max segment size
On Fri, Jan 23, 2026 at 11:40:47AM +0100, Danilo Krummrich wrote:
> On Fri Jan 23, 2026 at 11:18 AM CET, Beata Michalska wrote:
> > + /// Set the maximum size of a single DMA segment the device may request.
> > + ///
> > + /// This method is usually called once from `probe()` as soon as the device capabilities are
> > + /// known.
> > + ///
> > + /// # Safety
> > + ///
> > + /// This method must not be called if there are any in-flight DMA allocation
> > + /// or mapping operations.
>
> Yes, unfortunately it has the same requirements as the DMA mask setters.
>
> For consistency, can you please use the exact same safety requirement text as
> the other methods?
Done:
https://lore.kernel.org/rust-for-linux/20260123131308.3218421-1-beata.michalska@arm.com/T/#u
---
BR
Beata
>
> > + unsafe fn dma_set_max_seg_size(&self, size: u32) {
> > + // SAFETY:
> > + // - By the type invariant of `device::Device`, `self.as_ref().as_raw()` is valid.
> > + // - The safety requirement of this function guarantees that there are no concurrent calls
> > + // to DMA allocation and mapping operations relying on this parameter.
> > + unsafe { bindings::dma_set_max_seg_size(self.as_ref().as_raw(), size) }
> > + }
> > }
> >
> > /// A DMA mask that holds a bitmask with the lowest `n` bits set.
> > --
> > 2.25.1
>
Powered by blists - more mailing lists