From: Claude Code Review Bot <claude-review@example.com>
To: dri-devel-reviews@example.com
Subject: Claude review: drm/tyr: add firmware loading and MCU boot support
Date: Tue, 03 Mar 2026 12:48:20 +1000 [thread overview]
Message-ID: <review-patch12-20260302232500.244489-13-deborah.brouwer@collabora.com> (raw)
In-Reply-To: <20260302232500.244489-13-deborah.brouwer@collabora.com>
Patch Review
**Author:** Deborah Brouwer / Boris Brezillon
This ties everything together: loads firmware, creates MCU VM, maps firmware sections, boots the MCU.
1. The `Firmware::Drop` breaks a circular reference:
```rust
+impl Drop for Firmware {
+ fn drop(&mut self) {
+ self.vm.kill();
+ }
+}
```
This is because the VM -> VmAsData -> Seat -> SlotManager -> SlotData (Arc<VmAsData>) creates a cycle. The `kill()` method deactivates the VM (evicting from slot manager, dropping the Arc<VmAsData>) and then unmaps all regions. This is a necessary but somewhat fragile pattern — if `kill()` fails, the Arc cycle leaks. The error logging in `kill()` mitigates debuggability.
2. `init_section_mem()` writes firmware data byte-by-byte:
```rust
+ for (i, &byte) in data.iter().enumerate() {
+ vmap.try_write8(byte, i)?;
+ }
```
This is functional but slow for large firmware sections. A `memcpy_to_vmap()` or similar bulk operation would be more efficient, but this is a correctness-first approach that can be optimized later.
3. The MCU boot polling has reasonable timeouts:
```rust
+ if let Err(e) = poll::read_poll_timeout(
+ || regs::MCU_STATUS.read(dev, &self.iomem),
+ |status| *status == regs::MCU_STATUS_ENABLED,
+ time::Delta::from_millis(1),
+ time::Delta::from_millis(100),
+ ) {
```
1ms polling interval, 100ms total timeout. This matches the C panthor driver's `panthor_fw_start()` timeouts.
4. The `SectionFlag::CacheModeNone = 0 << 3` is zero, which means `SectionFlags::empty()` and `SectionFlag::CacheModeNone` are indistinguishable. This is by design (the zero cache mode is "none"), but the `impl_flags!` macro may not handle zero-valued flags correctly in `contains()` checks. However, the actual usage only checks `cache_mode != SectionFlag::CacheModeCached.into()`, which works correctly since cached mode is non-zero.
5. The firmware path construction looks correct:
```rust
+ let path = CString::try_from_fmt(fmt!(
+ "arm/mali/arch{}.{}/mali_csffw.bin",
+ gpu_id.arch_major,
+ gpu_id.arch_minor
+ ))?;
```
This matches the C panthor driver's firmware path format.
6. In the probe path, `firmware.boot()` is called before the DRM device is registered (before `try_pin_init!(TyrDrmDeviceData {...})`). This means if boot fails, cleanup is straightforward (no registered device to unregister). Good ordering.
Overall, this is a solid v2 series. The most actionable items are the `AsRegister::new()` validation gap and the slightly convoluted error handling in the firmware parser's `parse_entry()`.
---
Generated by Claude Code Patch Reviewer
next prev parent reply other threads:[~2026-03-03 2:48 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-02 23:24 [PATCH v2 0/12] drm/tyr: firmware loading and MCU boot support Deborah Brouwer
2026-03-02 23:24 ` [PATCH v2 01/12] drm/tyr: select DRM abstractions in Kconfig Deborah Brouwer
2026-03-03 2:48 ` Claude review: " Claude Code Review Bot
2026-03-02 23:24 ` [PATCH v2 02/12] drm/tyr: move clock cleanup into Clocks Drop impl Deborah Brouwer
2026-03-03 2:48 ` Claude review: " Claude Code Review Bot
2026-03-02 23:24 ` [PATCH v2 03/12] drm/tyr: rename TyrObject to BoData Deborah Brouwer
2026-03-03 2:48 ` Claude review: " Claude Code Review Bot
2026-03-02 23:24 ` [PATCH v2 04/12] drm/tyr: set DMA mask using GPU physical address Deborah Brouwer
2026-03-03 2:48 ` Claude review: " Claude Code Review Bot
2026-03-02 23:24 ` [PATCH v2 05/12] drm/tyr: add MMU address space registers Deborah Brouwer
2026-03-03 2:48 ` Claude review: " Claude Code Review Bot
2026-03-02 23:24 ` [PATCH v2 06/12] drm/tyr: add shmem backing for GEM objects Deborah Brouwer
2026-03-03 2:48 ` Claude review: " Claude Code Review Bot
2026-03-02 23:24 ` [PATCH v2 07/12] drm/tyr: Add generic slot manager Deborah Brouwer
2026-03-03 2:48 ` Claude review: " Claude Code Review Bot
2026-03-02 23:24 ` [PATCH v2 08/12] drm/tyr: add MMU module Deborah Brouwer
2026-03-03 2:48 ` Claude review: " Claude Code Review Bot
2026-03-02 23:24 ` [PATCH v2 09/12] drm/tyr: add GPU virtual memory module Deborah Brouwer
2026-03-03 2:48 ` Claude review: " Claude Code Review Bot
2026-03-02 23:24 ` [PATCH v2 10/12] drm/tyr: add a kernel buffer object Deborah Brouwer
2026-03-03 2:48 ` Claude review: " Claude Code Review Bot
2026-03-02 23:24 ` [PATCH v2 11/12] drm/tyr: add parser for firmware binary Deborah Brouwer
2026-03-03 2:48 ` Claude review: " Claude Code Review Bot
2026-03-02 23:25 ` [PATCH v2 12/12] drm/tyr: add firmware loading and MCU boot support Deborah Brouwer
2026-03-03 2:48 ` Claude Code Review Bot [this message]
2026-03-03 2:48 ` Claude review: drm/tyr: " 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-patch12-20260302232500.244489-13-deborah.brouwer@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