From: sashiko-bot@kernel.org
To: "Simon Song" <xinmengs@nvidia.com>,
dakr@kernel.org, acourbot@nvidia.com, kvm@vger.kernel.org,
nova-gpu@lists.linux.dev, linux-pci@vger.kernel.org
Cc: alex@shazbot.org, jgg@nvidia.com, yishaih@nvidia.com,
skolothumtho@nvidia.com, kevin.tian@intel.com, airlied@gmail.com,
simona@ffwll.ch, ojeda@kernel.org, alex.gaynor@gmail.com,
boqun.feng@gmail.com, gary@garyguo.net, bjorn3_gh@protonmail.com,
lossin@kernel.org, a.hindborg@kernel.org, aliceryhl@google.com,
tmgross@umich.edu, jhubbard@nvidia.com, ecourtney@nvidia.com,
cjia@nvidia.com, smitra@nvidia.com, kjaju@nvidia.com,
alkumar@nvidia.com, ankita@nvidia.com, aniketa@nvidia.com,
kwankhede@nvidia.com, targupta@nvidia.com, zhiwang@kernel.org,
zhiw@nvidia.com, boqun@kernel.org, daniel.almeida@collabora.com,
tamird@kernel.org, work@onurozkan.dev, jgg@ziepe.ca,
bhelgaas@google.com, kwilczynski@kernel.org,
dri-devel@lists.freedesktop.org, peter@colberg.org,
"Liam R. Howlett" <liam@infradead.org>,
linux-mm@kvack.org, "Lorenzo Stoakes" <ljs@kernel.org>
Subject: Re: [PATCH v5 4/4] rust: vfio: add PCI variant driver abstractions
Date: Sat, 05 Dec 2026 04:19:07 +0000 [thread overview]
Message-ID: <sashiko-outbox-251066@kernel.org> (raw)
In-Reply-To: <20261204041727.4021092-5-xinmengs@nvidia.com>
Thank you for your contribution! Sashiko AI review found 2 potential
issues to consider:
- [Low] rust: vfio: missing #[inline] on small and forwarding methods in
vfio::pci
- [Low] rust: vfio: build_ops!() duplicates
as_char_ptr_in_const_context()
--
commit fc553fbc4c9de5d8211c3a1d37c9e87f322da8bb
Author: Danilo Krummrich <dakr@kernel.org>
rust: vfio: add PCI variant driver abstractions
This commit adds Rust abstractions for VFIO PCI variant drivers in
rust/kernel/vfio/pci.rs, along with PCI device and error-result helpers in
rust/kernel/pci.rs.
> diff --git a/rust/kernel/vfio/pci.rs b/rust/kernel/vfio/pci.rs
> new file mode 100644
> index 0000000000000..728baf0c1ce93
> --- /dev/null
> +++ b/rust/kernel/vfio/pci.rs
> @@ -0,0 +1,880 @@
[ ... ]
> + pub fn with_temporary<R>(
> + &mut self,
> + operation: impl FnOnce(&mut Position<'_>) -> Result<R>,
> + ) -> Result<R> {
> + let mut next = *self.raw;
> + let result = operation(&mut Position { raw: &mut next })?;
> + *self.raw = next;
> + Ok(result)
> + }
[Severity: Low]
Should Position::with_temporary() and the other small or forwarding
methods in vfio::pci be marked #[inline]?
In the kernel crate, small helpers and thin wrappers around C bindings
normally carry #[inline] (as Position::region_index() and
Device::core_mmap() already do) so they can be inlined across crates into
variant drivers.
This also applies to Device::set_device_id(), Device::core_ioctl(),
Device::core_read(), Device::core_write(), Device::core_get_region_info(),
Registration::reset_prepare(), Registration::reset_done(), and
Registration::error_detected().
[ ... ]
> +macro_rules! build_ops {
> + ($T:ty) => {
> + bindings::vfio_device_ops {
> + #[allow(clippy::disallowed_methods)]
> + name: <$T>::NAME.as_ptr().cast_mut().cast(),
[Severity: Low]
Can this use crate::str::as_char_ptr_in_const_context(<$T>::NAME).cast_mut()
instead of duplicating the cast with #[allow(clippy::disallowed_methods)]?
rust/kernel/str.rs already provides as_char_ptr_in_const_context() for
const-context vtable initializers, as used by other subsystems in the
kernel crate.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261204041727.4021092-1-xinmengs@nvidia.com?part=4
next prev parent reply other threads:[~2026-12-05 4:19 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-12-04 4:17 [PATCH v5 0/4] Rust VFIO PCI support Simon Song
2026-12-04 4:17 ` [PATCH v5 1/4] rust: uaccess: support bounded forward buffer traversal Simon Song
2026-12-04 4:17 ` [PATCH v5 2/4] rust: vfio: add common VFIO device handling Simon Song
2026-12-05 4:19 ` sashiko-bot
2026-12-04 4:17 ` [PATCH v5 3/4] rust: mm: add VmaRef::size() and VmaRef::pgoff() Simon Song
2026-12-04 4:17 ` [PATCH v5 4/4] rust: vfio: add PCI variant driver abstractions Simon Song
2026-12-05 4:19 ` sashiko-bot [this message]
2026-12-05 4:19 ` [PATCH v5 0/4] Rust VFIO PCI support sashiko-bot
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=sashiko-outbox-251066@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=a.hindborg@kernel.org \
--cc=acourbot@nvidia.com \
--cc=airlied@gmail.com \
--cc=alex.gaynor@gmail.com \
--cc=alex@shazbot.org \
--cc=aliceryhl@google.com \
--cc=alkumar@nvidia.com \
--cc=aniketa@nvidia.com \
--cc=ankita@nvidia.com \
--cc=bhelgaas@google.com \
--cc=bjorn3_gh@protonmail.com \
--cc=boqun.feng@gmail.com \
--cc=boqun@kernel.org \
--cc=cjia@nvidia.com \
--cc=dakr@kernel.org \
--cc=daniel.almeida@collabora.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=ecourtney@nvidia.com \
--cc=gary@garyguo.net \
--cc=jgg@nvidia.com \
--cc=jgg@ziepe.ca \
--cc=jhubbard@nvidia.com \
--cc=kevin.tian@intel.com \
--cc=kjaju@nvidia.com \
--cc=kvm@vger.kernel.org \
--cc=kwankhede@nvidia.com \
--cc=kwilczynski@kernel.org \
--cc=liam@infradead.org \
--cc=linux-mm@kvack.org \
--cc=linux-pci@vger.kernel.org \
--cc=ljs@kernel.org \
--cc=lossin@kernel.org \
--cc=nova-gpu@lists.linux.dev \
--cc=ojeda@kernel.org \
--cc=peter@colberg.org \
--cc=sashiko-reviews@lists.linux.dev \
--cc=simona@ffwll.ch \
--cc=skolothumtho@nvidia.com \
--cc=smitra@nvidia.com \
--cc=tamird@kernel.org \
--cc=targupta@nvidia.com \
--cc=tmgross@umich.edu \
--cc=work@onurozkan.dev \
--cc=xinmengs@nvidia.com \
--cc=yishaih@nvidia.com \
--cc=zhiw@nvidia.com \
--cc=zhiwang@kernel.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