From: Abdiel Janulgue <abdiel.janulgue@gmail.com>
To: Robin Murphy <robin.murphy@arm.com>, daniel.almeida@collabora.com
Cc: "Miguel Ojeda" <ojeda@kernel.org>,
"Alex Gaynor" <alex.gaynor@gmail.com>,
"Boqun Feng" <boqun.feng@gmail.com>,
"Gary Guo" <gary@garyguo.net>,
"Björn Roy Baron" <bjorn3_gh@protonmail.com>,
"Benno Lossin" <benno.lossin@proton.me>,
"Andreas Hindborg" <a.hindborg@kernel.org>,
"Alice Ryhl" <aliceryhl@google.com>,
"Trevor Gross" <tmgross@umich.edu>,
"Danilo Krummrich" <dakr@kernel.org>,
"Valentin Obst" <kernel@valentinobst.de>,
"open list:RUST" <rust-for-linux@vger.kernel.org>,
"open list" <linux-kernel@vger.kernel.org>,
"Christoph Hellwig" <hch@lst.de>,
"Marek Szyprowski" <m.szyprowski@samsung.com>,
airlied@redhat.com,
"open list:DMA MAPPING HELPERS" <iommu@lists.linux.dev>
Subject: Re: [PATCH v6 2/2] rust: add dma coherent allocator abstraction.
Date: Thu, 5 Dec 2024 16:25:53 +0200 [thread overview]
Message-ID: <c9baa4bb-81db-42ae-98be-d8cb7d57f237@gmail.com> (raw)
In-Reply-To: <1c13843f-6929-4bc6-8564-0ec2d964c41d@arm.com>
On 05/12/2024 15:07, Robin Murphy wrote:
>> + pub fn alloc_coherent(
>> + dev: &Device,
>> + count: usize,
>> + flags: kernel::alloc::Flags,
>
> Might it be worth adding at least a placeholder type and argument for
> "attrs" as well, so there's less churn involved in coming back and
> adding it later? Or is the intention to have a separate
> dma_alloc_attrs() constructor for such users?
>
It certainly is possible to include attrs in the constructor using Option:
```
pub fn alloc_coherent(
dev: &Device,
count: usize,
flags: kernel::alloc::Flags,
attrs: Option<u64>,
) -> Result<CoherentAllocation<T>> {
<cut>
let ret = unsafe {
bindings::dma_alloc_attrs(
dev.as_raw(),
size,
&mut dma_handle, flags.as_raw(),
attrs.unwrap_or(0),
)
};
<cut>
}
```
So the signature of the constructor could be:
let c = CoherentAllocation::alloc_coherent(dev, 4, GFP_KERNEL, None)?;
Andreas, Miguel, Daniel, any thoughts?
Regards,
Abdiel
next prev parent reply other threads:[~2024-12-05 14:25 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-12-05 11:32 [PATCH v6 1/2] rust: error: Add EOVERFLOW Abdiel Janulgue
2024-12-05 11:32 ` [PATCH v6 2/2] rust: add dma coherent allocator abstraction Abdiel Janulgue
2024-12-05 13:07 ` Robin Murphy
2024-12-05 14:25 ` Abdiel Janulgue [this message]
2024-12-05 16:41 ` Daniel Almeida
2024-12-05 16:47 ` Robin Murphy
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=c9baa4bb-81db-42ae-98be-d8cb7d57f237@gmail.com \
--to=abdiel.janulgue@gmail.com \
--cc=a.hindborg@kernel.org \
--cc=airlied@redhat.com \
--cc=alex.gaynor@gmail.com \
--cc=aliceryhl@google.com \
--cc=benno.lossin@proton.me \
--cc=bjorn3_gh@protonmail.com \
--cc=boqun.feng@gmail.com \
--cc=dakr@kernel.org \
--cc=daniel.almeida@collabora.com \
--cc=gary@garyguo.net \
--cc=hch@lst.de \
--cc=iommu@lists.linux.dev \
--cc=kernel@valentinobst.de \
--cc=linux-kernel@vger.kernel.org \
--cc=m.szyprowski@samsung.com \
--cc=ojeda@kernel.org \
--cc=robin.murphy@arm.com \
--cc=rust-for-linux@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