From: sashiko-bot@kernel.org
To: "John Hubbard" <jhubbard@nvidia.com>,
"Danilo Krummrich" <dakr@kernel.org>,
"Alexandre Courbot" <acourbot@nvidia.com>
Cc: "Timur Tabi" <ttabi@nvidia.com>,
"Alistair Popple" <apopple@nvidia.com>,
"Eliot Courtney" <ecourtney@nvidia.com>,
"Zhi Wang" <zhiw@nvidia.com>, "David Airlie" <airlied@gmail.com>,
"Simona Vetter" <simona@ffwll.ch>,
"Bjorn Helgaas" <bhelgaas@google.com>,
"Miguel Ojeda" <ojeda@kernel.org>,
"Boqun Feng" <boqun@kernel.org>, "Gary Guo" <gary@garyguo.net>,
"Björn Roy Baron" <bjorn3_gh@protonmail.com>,
"Benno Lossin" <lossin@kernel.org>,
"Andreas Hindborg" <a.hindborg@kernel.org>,
"Alice Ryhl" <aliceryhl@google.com>,
"Trevor Gross" <tmgross@umich.edu>,
nova-gpu@lists.linux.dev, dri-devel@lists.freedesktop.org,
linux-pci@vger.kernel.org
Subject: Re: [PATCH 1/2] rust: pci: add domain_nr() accessor
Date: Tue, 10 Nov 2026 03:48:31 +0000 [thread overview]
Message-ID: <sashiko-outbox-206149@kernel.org> (raw)
In-Reply-To: <20261110033655.148487-2-jhubbard@nvidia.com>
Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Medium] rust: pci: signature mismatch in rust_helper_pci_domain_nr()
on ppc and s390
--
commit 40ebd2410b826b9813de5dae1bbe6075723a08bc
Author: John Hubbard <jhubbard@nvidia.com>
rust: pci: add domain_nr() accessor
This commit adds a domain_nr() accessor to pci::Device and a corresponding
rust_helper_pci_domain_nr() C helper to retrieve the PCI domain number.
> diff --git a/rust/helpers/pci.c b/rust/helpers/pci.c
> index a8540f90b13ce..49f2c089d2369 100644
> --- a/rust/helpers/pci.c
> +++ b/rust/helpers/pci.c
> @@ -7,6 +7,11 @@ __rust_helper u16 rust_helper_pci_dev_id(struct pci_dev *dev)
> return PCI_DEVID(dev->bus->number, dev->devfn);
> }
>
> +__rust_helper int rust_helper_pci_domain_nr(struct pci_dev *dev)
> +{
> + return pci_domain_nr(dev->bus);
> +}
> +
> __rust_helper resource_size_t
> rust_helper_pci_resource_start(struct pci_dev *pdev, int bar)
> {
> diff --git a/rust/kernel/pci.rs b/rust/kernel/pci.rs
> index 769d01d234296..57718e48208d5 100644
> --- a/rust/kernel/pci.rs
> +++ b/rust/kernel/pci.rs
> @@ -408,6 +408,20 @@ pub fn dev_id(&self) -> u16 {
> unsafe { bindings::pci_dev_id(self.as_raw()) }
> }
>
> + /// Returns the PCI domain number of the bus that this device is on.
> + #[inline]
> + pub fn domain_nr(&self) -> u32 {
> + // SAFETY: By its type invariant `self.as_raw` is always a valid pointer to a
> + // `struct pci_dev`.
> + let domain_nr = unsafe { bindings::pci_domain_nr(self.as_raw()) };
[Severity: Medium]
Does bindings::pci_domain_nr(self.as_raw()) fail to compile on PowerPC and
s390 due to a pointer type mismatch?
In rust/bindings/lib.rs, bindings_generated.rs is included after
pub use super::bindings_helper::*, so any non-inline C function emitted by
bindgen shadows a rust_helper_* wrapper of the same stripped name. On PowerPC
(arch/powerpc/include/asm/pci.h) and s390 (arch/s390/include/asm/pci.h),
pci_domain_nr() is declared as a non-inline extern function taking
struct pci_bus * rather than a static inline function:
arch/powerpc/include/asm/pci.h:
extern int pci_domain_nr(struct pci_bus *bus);
On those architectures, bindings::pci_domain_nr resolves to the C declaration
expecting *mut bindings::pci_bus instead of the helper's
*mut bindings::pci_dev, breaking the build when CONFIG_RUST and CONFIG_PCI are
enabled. Either rust_helper_pci_domain_nr() should take struct pci_bus *bus to
match the C signature (with domain_nr() passing (*self.as_raw()).bus), or the
helper should use a distinct name that does not collide with C pci_domain_nr().
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261110033655.148487-1-jhubbard@nvidia.com?part=1
next prev parent reply other threads:[~2026-11-10 3:48 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-10 3:36 [PATCH 0/2] gpu: nova-core: add two prerequisites for the r000 GSP firmware John Hubbard
2026-11-10 3:36 ` [PATCH 1/2] rust: pci: add domain_nr() accessor John Hubbard
2026-11-10 3:48 ` sashiko-bot [this message]
2026-11-10 12:43 ` Danilo Krummrich
2026-11-11 19:07 ` John Hubbard
2026-11-10 3:36 ` [PATCH 2/2] gpu: nova-core: factor out and expose Falcon::is_processor_suspended() John Hubbard
2026-11-10 3:40 ` sashiko-bot
2026-11-11 4:20 ` Eliot Courtney
2026-11-11 11:45 ` (subset) [PATCH 0/2] gpu: nova-core: add two prerequisites for the r000 GSP firmware 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=sashiko-outbox-206149@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=a.hindborg@kernel.org \
--cc=acourbot@nvidia.com \
--cc=airlied@gmail.com \
--cc=aliceryhl@google.com \
--cc=apopple@nvidia.com \
--cc=bhelgaas@google.com \
--cc=bjorn3_gh@protonmail.com \
--cc=boqun@kernel.org \
--cc=dakr@kernel.org \
--cc=dri-devel@lists.freedesktop.org \
--cc=ecourtney@nvidia.com \
--cc=gary@garyguo.net \
--cc=jhubbard@nvidia.com \
--cc=linux-pci@vger.kernel.org \
--cc=lossin@kernel.org \
--cc=nova-gpu@lists.linux.dev \
--cc=ojeda@kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
--cc=simona@ffwll.ch \
--cc=tmgross@umich.edu \
--cc=ttabi@nvidia.com \
--cc=zhiw@nvidia.com \
/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