From: Deborah Brouwer <deborah.brouwer@collabora.com>
To: Gary Guo <gary@garyguo.net>
Cc: Danilo Krummrich <dakr@kernel.org>,
Alice Ryhl <aliceryhl@google.com>,
Daniel Almeida <daniel.almeida@collabora.com>,
David Airlie <airlied@gmail.com>, Simona Vetter <simona@ffwll.ch>,
dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] drm/tyr: use `bitfield!` instead of `register!` for non-registers
Date: Wed, 23 Sep 2026 09:29:41 -0700 [thread overview]
Message-ID: <arP-dat7V0Rg70ok@um790> (raw)
In-Reply-To: <20260910165734.80378-1-gary@kernel.org>
On Thu, Sep 10, 2026 at 05:57:33PM +0100, Gary Guo wrote:
> From: Gary Guo <gary@garyguo.net>
>
> `SectionFlags` and `MMU_MEMATTR_STAGE1` are not registers themselves. Use
> `bitfield!` directly.
>
> Signed-off-by: Gary Guo <gary@garyguo.net>
> ---
> drivers/gpu/drm/tyr/fw.rs | 12 ++++--------
> drivers/gpu/drm/tyr/regs.rs | 11 +++++------
> 2 files changed, 9 insertions(+), 14 deletions(-)
>
> diff --git a/drivers/gpu/drm/tyr/fw.rs b/drivers/gpu/drm/tyr/fw.rs
> index 7edb5eff1707..aea151ff1f93 100644
> --- a/drivers/gpu/drm/tyr/fw.rs
> +++ b/drivers/gpu/drm/tyr/fw.rs
> @@ -14,6 +14,7 @@
> //! [`Section`]: crate::fw::Section
>
> use kernel::{
> + bitfield,
> device::{
> Bound,
> Device, //
> @@ -27,7 +28,6 @@
> },
> num::Bounded,
> prelude::*,
> - register,
> str::CString,
> sync::{
> Arc,
> @@ -39,8 +39,7 @@
> use crate::{
> driver::{
> IoMem,
> - TyrDrmDevice,
> - TyrRegisters, //
> + TyrDrmDevice, //
> },
> fw::parser::{
> FwParser,
> @@ -101,11 +100,8 @@ fn from(value: CacheMode) -> Self {
> }
> }
>
> -register! {
> - base: TyrRegisters;
> -
> - #[allow(non_upper_case_globals)]
> - pub(super) SectionFlags(u32) @ 0x0 {
> +bitfield! {
> + pub(super) struct SectionFlags(u32) {
> 0:0 read => bool;
> 1:1 write => bool;
> 2:2 exec => bool;
> diff --git a/drivers/gpu/drm/tyr/regs.rs b/drivers/gpu/drm/tyr/regs.rs
> index 0c419c4e1186..6f626957a010 100644
> --- a/drivers/gpu/drm/tyr/regs.rs
> +++ b/drivers/gpu/drm/tyr/regs.rs
> @@ -986,6 +986,7 @@ pub(crate) mod mmu_control {
> /// This array contains 16 instances of the MMU_AS_CONTROL register page.
> pub(crate) mod mmu_as_control {
> use kernel::{
> + bitfield,
> num::Bounded,
> prelude::*,
> register, //
> @@ -1130,14 +1131,12 @@ fn from(val: MemoryType) -> Self {
> }
> }
>
> - register! {
> - base: TyrRegisters;
> -
> + bitfield! {
> /// Stage 1 memory attributes (8-bit bitfield).
> ///
> - /// This is not an actual register, but a bitfield definition used by the MEMATTR
> - /// register. Each of the 8 bytes in MEMATTR follows this layout.
> - MMU_MEMATTR_STAGE1(u8) @ 0x0 {
> + /// Each of the 8 bytes in MEMATTR follows this layout.
> + #[allow(non_camel_case_types)]
> + struct MMU_MEMATTR_STAGE1(u8) {
> /// Inner cache write allocation policy.
> 0:0 alloc_w => bool;
> /// Inner cache read allocation policy.
Reviewed-by: Deborah Brouwer <deborah.brouwer@collabora.com>
>
> base-commit: 73e5616f3d197c1af5a04a481fe0f13aa3913bd1
> --
> 2.54.0
>
next prev parent reply other threads:[~2026-09-23 16:29 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-10 16:57 [PATCH] drm/tyr: use `bitfield!` instead of `register!` for non-registers Gary Guo
2026-09-23 16:29 ` Deborah Brouwer [this message]
2026-09-30 13:34 ` Alice Ryhl
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=arP-dat7V0Rg70ok@um790 \
--to=deborah.brouwer@collabora.com \
--cc=airlied@gmail.com \
--cc=aliceryhl@google.com \
--cc=dakr@kernel.org \
--cc=daniel.almeida@collabora.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=gary@garyguo.net \
--cc=linux-kernel@vger.kernel.org \
--cc=simona@ffwll.ch \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.