From: Alexandre Courbot <acourbot@nvidia.com>
To: "Yury Norov" <yury.norov@gmail.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>,
"Danilo Krummrich" <dakr@kernel.org>,
"Daniel Almeida" <daniel.almeida@collabora.com>,
"David Airlie" <airlied@gmail.com>,
"Simona Vetter" <simona@ffwll.ch>
Cc: John Hubbard <jhubbard@nvidia.com>,
Alistair Popple <apopple@nvidia.com>,
Timur Tabi <ttabi@nvidia.com>, Zhi Wang <zhiw@nvidia.com>,
Eliot Courtney <ecourtney@nvidia.com>,
linux-kernel@vger.kernel.org, rust-for-linux@vger.kernel.org,
nova-gpu@lists.linux.dev, driver-core@lists.linux.dev,
Alexandre Courbot <acourbot@nvidia.com>,
Yury Norov <ynorov@nvidia.com>,
Joel Fernandes <joelagnelf@nvidia.com>
Subject: [PATCH v5 0/3] rust: add `bitfield!` macro
Date: Sat, 06 Jun 2026 21:43:03 +0900 [thread overview]
Message-ID: <20260606-bitfield-v5-0-b92188820914@nvidia.com> (raw)
This is the continuation of the `bitfield!` macro which started
alongside the `register!` one before being temporarily integrated into
it [1].
This series extracts `bitfield!` from `register!`, adds unit tests for
the new macro, and replaces the `register!` macro rules with the
extracted version.
I have removed the `nova-core` patches, because the Blackwell support
that has been added this cycle (and thus not visible from `rust-next`)
introduces more uses of the Nova-local `bitfield!` macro that this
series intended to remove. If these new uses are not updated, then
`nova-core` won't build, thus to avoid conflicts and/or build breakages
I think it is preferable to merge them during the next cycle.
This version is based on `rust-next`, with [2] applied.
A tree with this branch and its dependencies is available at [3].
[1] https://lore.kernel.org/all/20260120-register-v1-0-723a1743b557@nvidia.com/
[2] https://lore.kernel.org/all/20260417031531.315281-1-ynorov@nvidia.com/
[3] https://github.com/Gnurou/linux/tree/b4/bitfield
Signed-off-by: Alexandre Courbot <acourbot@nvidia.com>
---
Changes in v5:
- Squash the fixup patches into the one extracting the `bitfield!` macro.
- Remove the `nova-core` patches to avoid a conflict/build breakage on
-rc1.
- Improve the unit tests per Yury's feedback:
- Use a consistent test axis where each test focuses on a single thing.
- Rename members to generic name including range for readability.
- Add test exercising `try_with`.
- Add test checking that unallocated bits are left untouched.
- Link to v4: https://patch.msgid.link/20260527-bitfield-v4-0-e8821d4efbde@nvidia.com
Changes in v4:
- Inline private bitfield accessor methods.
- Fully qualify types in `bitfield!` macro.
- Rename `RUST_KERNEL_BITFIELD_KUNIT_TEST` to `RUST_BITFIELD_KUNIT_TEST`.
- Link to v3: https://patch.msgid.link/20260501-bitfield-v3-0-aa1076c3337d@nvidia.com
Changes in v3:
- Split patch 1 into the addition of the `bitfield!` macro and its use
in the `io` module.
- Mention reserved field names in `bitfield!`'s doccomment.
- Properly order fields in the KUnit test.
- Add a Kconfig option for building the KUnit tests.
- Document behavior on non-covered bits.
- Document support for signed fields and storage types (TL;DR: not
supported).
- Move `nova-core`'s `bitfield` module deletion into its own patch.
- Link to v2: https://patch.msgid.link/20260409-bitfield-v2-0-23ac400071cb@nvidia.com
---
Alexandre Courbot (2):
rust: extract `bitfield!` macro from `register!`
rust: io: use the `bitfield!` macro in `register!`
Joel Fernandes (1):
rust: bitfield: Add KUnit tests for bitfield
MAINTAINERS | 7 +
rust/kernel/Kconfig.test | 10 +
rust/kernel/bitfield.rs | 862 +++++++++++++++++++++++++++++++++++++++++++++
rust/kernel/io/register.rs | 246 +------------
rust/kernel/lib.rs | 1 +
5 files changed, 882 insertions(+), 244 deletions(-)
---
base-commit: 72d33b8bfeacbfdccf2cda4650e8e002def036f8
change-id: 20260408-bitfield-6e18254f4fdc
prerequisite-message-id: 20260417031531.315281-1-ynorov@nvidia.com
prerequisite-patch-id: 403e34bb92b42d3f31ed972e11896d18902585e3
prerequisite-patch-id: 42ae775aa6762a9e28ff31c5f69a0b65a7b40dcc
prerequisite-patch-id: 19b3e535962348f7627ede57ea829b34abda08c7
Best regards,
--
Alexandre Courbot <acourbot@nvidia.com>
next reply other threads:[~2026-06-06 12:43 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-06 12:43 Alexandre Courbot [this message]
2026-06-06 12:43 ` [PATCH v5 1/3] rust: extract `bitfield!` macro from `register!` Alexandre Courbot
2026-06-06 12:43 ` [PATCH v5 2/3] rust: bitfield: Add KUnit tests for bitfield Alexandre Courbot
2026-06-07 12:32 ` Alexandre Courbot
2026-06-06 12:43 ` [PATCH v5 3/3] rust: io: use the `bitfield!` macro in `register!` Alexandre Courbot
2026-06-08 7:05 ` [PATCH v5 0/3] rust: add `bitfield!` macro Miguel Ojeda
2026-06-08 16:16 ` Yury Norov
2026-06-09 10:46 ` Miguel Ojeda
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=20260606-bitfield-v5-0-b92188820914@nvidia.com \
--to=acourbot@nvidia.com \
--cc=a.hindborg@kernel.org \
--cc=airlied@gmail.com \
--cc=aliceryhl@google.com \
--cc=apopple@nvidia.com \
--cc=bjorn3_gh@protonmail.com \
--cc=boqun@kernel.org \
--cc=dakr@kernel.org \
--cc=daniel.almeida@collabora.com \
--cc=driver-core@lists.linux.dev \
--cc=ecourtney@nvidia.com \
--cc=gary@garyguo.net \
--cc=jhubbard@nvidia.com \
--cc=joelagnelf@nvidia.com \
--cc=linux-kernel@vger.kernel.org \
--cc=lossin@kernel.org \
--cc=nova-gpu@lists.linux.dev \
--cc=ojeda@kernel.org \
--cc=rust-for-linux@vger.kernel.org \
--cc=simona@ffwll.ch \
--cc=tmgross@umich.edu \
--cc=ttabi@nvidia.com \
--cc=ynorov@nvidia.com \
--cc=yury.norov@gmail.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