From: John Hubbard <jhubbard@nvidia.com>
To: Danilo Krummrich <dakr@kernel.org>,
Alexandre Courbot <acourbot@nvidia.com>
Cc: "Joel Fernandes" <joelagnelf@nvidia.com>,
"Timur Tabi" <ttabi@nvidia.com>,
"Alistair Popple" <apopple@nvidia.com>,
"Eliot Courtney" <ecourtney@nvidia.com>,
"Shashank Sharma" <shashanks@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>,
"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" <lossin@kernel.org>,
"Andreas Hindborg" <a.hindborg@kernel.org>,
"Alice Ryhl" <aliceryhl@google.com>,
"Trevor Gross" <tmgross@umich.edu>,
rust-for-linux@vger.kernel.org,
LKML <linux-kernel@vger.kernel.org>,
"John Hubbard" <jhubbard@nvidia.com>
Subject: [PATCH v4 0/2] rust, nova-core: add DeviceSize trait for SZ_* constants
Date: Wed, 1 Apr 2026 15:27:41 -0700 [thread overview]
Message-ID: <20260401222743.148710-1-jhubbard@nvidia.com> (raw)
Changes in v4:
* Renamed the trait from DeviceSize to SizeConstants.
* Added backticks and trailing periods to all hex-value doc comments
on the SZ_* constants.
* Removed redundant type annotations from doc-test examples.
* Used a `use` import for PAGE_SIZE in the module-level doc-test
instead of a fully qualified path.
* Rewrote doc-test comments to clarify the distinction between
module-level constants (no type qualifier) and trait associated
constants (type qualifier required).
* Added Reviewed-by from Eliot Courtney.
Changes in v3:
* Dropped the Alignment::from_u64() patch.
* Reworked define_sizes! macro to accept target types as arguments
(define_sizes!(u32, u64, usize)) using recursive macro arms,
instead of hardcoding impls for u32 and u64. Overflow checking
uses u128 casts so the same assert works for any ("reasonable")
target type.
* Added usize to the DeviceSize implementations, so the trait
covers u32, u64, and usize.
* Hex values for each constant are now proper doc-comments
(forwarded via macro meta), instead of inline comments.
* Rebased onto latest drm-rust-next.
Changes in v2:
* Replaced flat SZ_*_U64 constants with a DeviceSize trait that
provides SZ_* as associated constants on u32 and u64.
* A define_sizes! macro generates everything from one list of names.
* Added Alignment::from_u64() so alignment values can be constructed
from DeviceSize constants without falling back to usize variants.
* Rebased onto drm-rust-next. No longer depends on the Blackwell
patchset.
v1 is here:
https://lore.kernel.org/20260310023145.120037-1-jhubbard@nvidia.com
John Hubbard (2):
rust: sizes: add SizeConstants trait for device address space
constants
gpu: nova-core: use SizeConstants trait for u64 size constants
drivers/gpu/nova-core/fb.rs | 21 ++--
drivers/gpu/nova-core/gsp/fw.rs | 15 ++-
drivers/gpu/nova-core/regs.rs | 7 +-
rust/kernel/sizes.rs | 167 +++++++++++++++++++++++---------
4 files changed, 142 insertions(+), 68 deletions(-)
base-commit: 7c50d748b4a635bc39802ea3f6b120e66b1b9067
--
2.53.0
next reply other threads:[~2026-04-01 22:27 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-01 22:27 John Hubbard [this message]
2026-04-01 22:27 ` [PATCH v4 1/2] rust: sizes: add SizeConstants trait for device address space constants John Hubbard
2026-04-02 14:43 ` Alexandre Courbot
2026-04-01 22:27 ` [PATCH v4 2/2] gpu: nova-core: use SizeConstants trait for u64 size constants John Hubbard
2026-04-02 14:33 ` Joel Fernandes
2026-04-02 14:55 ` Alexandre Courbot
2026-04-02 14:59 ` Joel Fernandes
2026-04-02 15:05 ` Joel Fernandes
2026-04-02 15:23 ` Alexandre Courbot
2026-04-02 14:39 ` [PATCH v4 0/2] rust, nova-core: add DeviceSize trait for SZ_* constants Gary Guo
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=20260401222743.148710-1-jhubbard@nvidia.com \
--to=jhubbard@nvidia.com \
--cc=a.hindborg@kernel.org \
--cc=acourbot@nvidia.com \
--cc=airlied@gmail.com \
--cc=alex.gaynor@gmail.com \
--cc=aliceryhl@google.com \
--cc=apopple@nvidia.com \
--cc=bhelgaas@google.com \
--cc=bjorn3_gh@protonmail.com \
--cc=boqun.feng@gmail.com \
--cc=dakr@kernel.org \
--cc=ecourtney@nvidia.com \
--cc=gary@garyguo.net \
--cc=joelagnelf@nvidia.com \
--cc=linux-kernel@vger.kernel.org \
--cc=lossin@kernel.org \
--cc=ojeda@kernel.org \
--cc=rust-for-linux@vger.kernel.org \
--cc=shashanks@nvidia.com \
--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