From: Boris Brezillon <boris.brezillon@collabora.com>
To: Deborah Brouwer <deborah.brouwer@collabora.com>
Cc: dri-devel@lists.freedesktop.org, rust-for-linux@vger.kernel.org,
"Danilo Krummrich" <dakr@kernel.org>,
"Alice Ryhl" <aliceryhl@google.com>,
"Daniel Almeida" <daniel.almeida@collabora.com>,
"Maarten Lankhorst" <maarten.lankhorst@linux.intel.com>,
"Maxime Ripard" <mripard@kernel.org>,
"Thomas Zimmermann" <tzimmermann@suse.de>,
"David Airlie" <airlied@gmail.com>,
"Simona Vetter" <simona@ffwll.ch>,
"Miguel Ojeda" <ojeda@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>,
"Trevor Gross" <tmgross@umich.edu>,
"Steven Price" <steven.price@arm.com>,
"Dirk Behme" <dirk.behme@gmail.com>,
"Alexandre Courbot" <acourbot@nvidia.com>,
"Boqun Feng" <boqun@kernel.org>
Subject: Re: [PATCH v2 4/5] drm/tyr: Use register! macro for MMU_CONTROL
Date: Thu, 12 Mar 2026 09:59:24 +0100 [thread overview]
Message-ID: <20260312095924.09fa443f@fedora> (raw)
In-Reply-To: <20260311-b4-tyr-use-register-macro-v2-v2-4-b936d9eb8f51@collabora.com>
On Wed, 11 Mar 2026 16:04:01 -0700
Deborah Brouwer <deborah.brouwer@collabora.com> wrote:
> Convert the MMU_CONTROL register definitions to use the `register!` macro.
>
> Using the `register!` macro allows us to replace manual bit masks and
> shifts with typed register and field accessors, which makes the code
> easier to read and avoids errors from bit manipulation.
>
> Co-developed-by: Daniel Almeida <daniel.almeida@collabora.com>
> Signed-off-by: Daniel Almeida <daniel.almeida@collabora.com>
> Signed-off-by: Deborah Brouwer <deborah.brouwer@collabora.com>
> ---
> drivers/gpu/drm/tyr/regs.rs | 56 +++++++++++++++++++++++++++++++++++++++++----
> 1 file changed, 51 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/gpu/drm/tyr/regs.rs b/drivers/gpu/drm/tyr/regs.rs
> index 686986536297ac2cc53ff14b162b19eaa759c192..6c16a041ab3c36f8aaf785487ad61925be65a026 100644
> --- a/drivers/gpu/drm/tyr/regs.rs
> +++ b/drivers/gpu/drm/tyr/regs.rs
> @@ -627,11 +627,6 @@ impl MCU_STATUS {
>
> pub(super) use gpu_control::*;
>
> -pub(crate) const MMU_IRQ_RAWSTAT: Register<0x2000> = Register;
> -pub(crate) const MMU_IRQ_CLEAR: Register<0x2004> = Register;
> -pub(crate) const MMU_IRQ_MASK: Register<0x2008> = Register;
> -pub(crate) const MMU_IRQ_STAT: Register<0x200c> = Register;
> -
> /// These registers correspond to the JOB_CONTROL register page.
> /// They are involved in communication between the firmware running on the MCU and the host.
> pub(super) mod job_control {
> @@ -681,3 +676,54 @@ pub(super) mod job_control {
> }
> }
> }
> +
> +/// These registers correspond to the MMU_CONTROL register page.
> +/// They are involved in MMU configuration and control.
> +pub(super) mod mmu_control {
Feels weird to have pub(super) here, and pub(crate) on the reg
definitions. I know it's the same thing in practice because super is
the root of the crate, but I was wondering if there was another reason
for this distinction.
> + use kernel::register;
> +
> + register! {
> + /// IRQ sources raw status.
> + ///
> + /// This register contains the raw unmasked interrupt sources for MMU status and exception
> + /// handling.
> + ///
> + /// Writing to this register forces bits on.
> + /// Use [`IRQ_CLEAR`] to clear interrupts.
> + pub(crate) IRQ_RAWSTAT(u32) @ 0x2000 {
> + /// Page fault for address spaces.
> + 15:0 page_fault;
> + /// Command completed in address spaces.
> + 31:16 command_completed;
> + }
> +
> + /// IRQ sources to clear.
> + /// Write a 1 to a bit to clear the corresponding bit in [`IRQ_RAWSTAT`].
> + pub(crate) IRQ_CLEAR(u32) @ 0x2004 {
> + /// Clear the PAGE_FAULT interrupt.
> + 15:0 page_fault;
> + /// Clear the COMMAND_COMPLETED interrupt.
> + 31:16 command_completed;
> + }
> +
> + /// IRQ sources enabled.
> + ///
> + /// Set each bit to 1 to enable the corresponding interrupt source, and to 0 to disable it.
> + pub(crate) IRQ_MASK(u32) @ 0x2008 {
> + /// Enable the PAGE_FAULT interrupt.
> + 15:0 page_fault;
> + /// Enable the COMMAND_COMPLETED interrupt.
> + 31:16 command_completed;
> + }
> +
> + /// IRQ status for enabled sources. Read only.
> + ///
> + /// This register contains the result of ANDing together [`IRQ_RAWSTAT`] and [`IRQ_MASK`].
> + pub(crate) IRQ_STATUS(u32) @ 0x200c {
> + /// PAGE_FAULT interrupt status.
> + 15:0 page_fault;
> + /// COMMAND_COMPLETED interrupt status.
> + 31:16 command_completed;
> + }
> + }
> +}
>
next prev parent reply other threads:[~2026-03-12 8:59 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-11 23:03 [PATCH v2 0/5] drm/tyr: Use register! macro Deborah Brouwer
2026-03-11 23:03 ` [PATCH v2 1/5] drm/tyr: Use register! macro for GPU_CONTROL Deborah Brouwer
2026-03-12 8:39 ` Boris Brezillon
2026-03-12 13:25 ` Alexandre Courbot
2026-03-13 18:29 ` Daniel Almeida
2026-03-13 19:13 ` Deborah Brouwer
2026-03-12 9:14 ` Boris Brezillon
2026-03-13 18:26 ` Daniel Almeida
2026-03-18 3:14 ` Alexandre Courbot
2026-03-20 0:15 ` Deborah Brouwer
2026-03-11 23:03 ` [PATCH v2 2/5] drm/tyr: Set interconnect coherency during probe Deborah Brouwer
2026-03-12 9:07 ` Boris Brezillon
2026-03-11 23:04 ` [PATCH v2 3/5] drm/tyr: Use register! macro for JOB_CONTROL Deborah Brouwer
2026-03-13 19:12 ` Daniel Almeida
2026-03-11 23:04 ` [PATCH v2 4/5] drm/tyr: Use register! macro for MMU_CONTROL Deborah Brouwer
2026-03-12 8:59 ` Boris Brezillon [this message]
2026-03-13 19:17 ` Daniel Almeida
2026-03-11 23:04 ` [PATCH v2 5/5] drm/tyr: Remove custom register struct Deborah Brouwer
2026-03-13 19:18 ` Daniel Almeida
2026-03-11 23:09 ` [PATCH v2 0/5] drm/tyr: Use register! macro Deborah Brouwer
2026-03-12 8:43 ` Boris Brezillon
2026-03-12 8:50 ` Boris Brezillon
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=20260312095924.09fa443f@fedora \
--to=boris.brezillon@collabora.com \
--cc=a.hindborg@kernel.org \
--cc=acourbot@nvidia.com \
--cc=airlied@gmail.com \
--cc=aliceryhl@google.com \
--cc=bjorn3_gh@protonmail.com \
--cc=boqun@kernel.org \
--cc=dakr@kernel.org \
--cc=daniel.almeida@collabora.com \
--cc=deborah.brouwer@collabora.com \
--cc=dirk.behme@gmail.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=gary@garyguo.net \
--cc=lossin@kernel.org \
--cc=maarten.lankhorst@linux.intel.com \
--cc=mripard@kernel.org \
--cc=ojeda@kernel.org \
--cc=rust-for-linux@vger.kernel.org \
--cc=simona@ffwll.ch \
--cc=steven.price@arm.com \
--cc=tmgross@umich.edu \
--cc=tzimmermann@suse.de \
/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