From: Claude Code Review Bot <claude-review@example.com>
To: dri-devel-reviews@example.com
Subject: Claude review: drm/tyr: Use register! macro for GPU_CONTROL
Date: Fri, 13 Mar 2026 14:38:51 +1000 [thread overview]
Message-ID: <review-patch1-20260311-b4-tyr-use-register-macro-v2-v2-1-b936d9eb8f51@collabora.com> (raw)
In-Reply-To: <20260311-b4-tyr-use-register-macro-v2-v2-1-b936d9eb8f51@collabora.com>
Patch Review
This is the largest and most important patch. It replaces all GPU_CONTROL register definitions with `register!` macro invocations, moves them into a `gpu_control` module, and updates all callers in `driver.rs` and `gpu.rs`.
**Critical: GPU_COMMAND_RESET missing command field**
The old code wrote:
```c
pub(crate) const GPU_CMD_SOFT_RESET: u32 = 1 | (1 << 8);
```
This sets both the command type (bits 7:0 = 1 = RESET) and the reset_mode (bits 11:8 = 1 = SOFT_RESET), producing value `0x101`. The C panthor driver confirms this: `GPU_CMD_DEF(type, payload) ((type) | ((payload) << 8))`.
The new code in `driver.rs`:
```rust
GPU_COMMAND_RESET::zeroed().with_const_reset_mode::<{ GPU_COMMAND_RESET::SOFT_RESET }>()
```
This only sets `reset_mode` (bits 11:8) to 1, leaving the `command` field (bits 7:0) as 0 (which is `GPU_COMMAND::NOP`). This would write `0x100` instead of `0x101`, meaning the hardware would not interpret this as a reset command. This will break GPU initialization. The fix should be:
```rust
GPU_COMMAND_RESET::zeroed()
.with_const_command::<{ GPU_COMMAND::RESET }>()
.with_const_reset_mode::<{ GPU_COMMAND_RESET::SOFT_RESET }>()
```
**Log output format change in `gpu_info_log`**
The old code printed:
```rust
self.gpu_id >> 16
```
which produces a 16-bit value like `0xb0a0` (matching the C panthor driver's `ptdev->gpu_info.gpu_id >> 16`).
The new code constructs a canonical ID and prints the full 32-bit value:
```rust
let id = GPU_ID::zeroed()
.with_arch_major(gpu_id.arch_major())
.with_arch_minor(gpu_id.arch_minor())
.with_arch_rev(gpu_id.arch_rev())
.with_prod_major(gpu_id.prod_major())
.into_raw();
```
This would print `0xb0a00000` instead of `0xb0a0`. This changes the user-visible log format compared to the C panthor driver, which could confuse developers. Consider either keeping the `>> 16` shift or noting this intentional change in the commit message.
**`gpu_info_log` now reads registers directly instead of using the already-fetched GpuInfo**
The old `log()` method used `self.gpu_id`, `self.l2_features`, etc. from the already-populated struct. The new `gpu_info_log()` function re-reads all registers from hardware via `iomem`. This is a minor inefficiency and a semantic change — the log now reflects the live register state rather than the cached `GpuInfo` values. It also means `gpu_info_log` can fail (returns `Result`), whereas the old method was infallible.
**`va_bits()` and `pa_bits()` removed**
These methods on `GpuInfo` were removed. They were marked `#[expect(dead_code)]` so this is fine, but it's a minor loss of API surface that could be useful for future MMU setup. The new `MMU_FEATURES` register definition provides `va_bits` and `pa_bits` fields, so the information is still accessible.
**Documentation additions are good.** The glossary at the top of `regs.rs` (CEU, CS, CSF, CSG, etc.) is a nice addition.
**Incomplete COHERENCY_ENABLE doc comment:**
```rust
/// Possible values are in
/// This register only selects the protocol...
```
The sentence "Possible values are in" is incomplete — it appears a reference (e.g., to the `impl` block constants) was accidentally omitted.
---
Generated by Claude Code Patch Reviewer
next prev parent reply other threads:[~2026-03-13 4:38 UTC|newest]
Thread overview: 21+ 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-12 9:14 ` Boris Brezillon
2026-03-13 4:38 ` Claude Code Review Bot [this message]
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-13 4:38 ` Claude review: " Claude Code Review Bot
2026-03-11 23:04 ` [PATCH v2 3/5] drm/tyr: Use register! macro for JOB_CONTROL Deborah Brouwer
2026-03-13 4:38 ` Claude review: " Claude Code Review Bot
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
2026-03-13 4:38 ` Claude review: " Claude Code Review Bot
2026-03-11 23:04 ` [PATCH v2 5/5] drm/tyr: Remove custom register struct Deborah Brouwer
2026-03-13 4:38 ` Claude review: " Claude Code Review Bot
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
2026-03-13 4:38 ` Claude review: " Claude Code Review Bot
-- strict thread matches above, loose matches on Subject: below --
2026-03-24 0:18 [PATCH v3 00/12] " Deborah Brouwer
2026-03-24 0:18 ` [PATCH v3 01/12] drm/tyr: Use register! macro for GPU_CONTROL Deborah Brouwer
2026-03-24 21:08 ` Claude review: " Claude Code Review Bot
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=review-patch1-20260311-b4-tyr-use-register-macro-v2-v2-1-b936d9eb8f51@collabora.com \
--to=claude-review@example.com \
--cc=dri-devel-reviews@example.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