public inbox for drm-ai-reviews@public-inbox.freedesktop.org
 help / color / mirror / Atom feed
From: Claude Code Review Bot <claude-review@example.com>
To: dri-devel-reviews@example.com
Subject: Claude review: drm/amd/display: Wire up dcn10_dio_construct() for all pre-DCN401 generations
Date: Wed, 25 Mar 2026 07:19:08 +1000	[thread overview]
Message-ID: <review-patch1-20260323211343.263909-1-sunlightlinux@gmail.com> (raw)
In-Reply-To: <20260323211343.263909-1-sunlightlinux@gmail.com>

Patch Review

**Bug: DCN21 shift/mask are zero-initialized**

In `dcn21_resource.c`, the patch uses:
```c
static const struct dcn_dio_shift dio_shift = { 0 };
static const struct dcn_dio_mask dio_mask = { 0 };
```

Every other generation properly defines:
```c
#define DIO_MASK_SH_LIST(mask_sh)\
		HWS_SF(, DIO_MEM_PWR_CTRL, I2C_LIGHT_SLEEP_FORCE, mask_sh)

static const struct dcn_dio_shift dio_shift = {
		DIO_MASK_SH_LIST(__SHIFT)
};
static const struct dcn_dio_mask dio_mask = {
		DIO_MASK_SH_LIST(_MASK)
};
```

With mask = 0, the `REG_UPDATE(DIO_MEM_PWR_CTRL, I2C_LIGHT_SLEEP_FORCE, 1)` call in `dcn10_dio_mem_pwr_ctrl()` (at `dcn10_dio.c:27`) becomes a no-op. The initial `REG_WRITE(DIO_MEM_PWR_CTRL, 0)` at line 24 still clears the register, but I2C light sleep force will never be re-enabled. DCN21 covers Renoir/Cezanne APUs — the hardware specifically called out in the commit message as affected — so this is particularly bad. This must be fixed before merging.

**Massive code duplication**

The exact same boilerplate (~30 lines: register struct, shift/mask definitions, `_dio_create()` function) is copy-pasted into 17 resource files. The only variation is the SR macro style (designator-init for older gens vs `REG_STRUCT` assignment for dcn32+). This could be significantly reduced:

- The `_dio_create()` function body is identical across all generations (allocate `dcn10_dio`, call `dcn10_dio_construct`). A single shared factory function could handle this.
- Similarly, the destruction code (`kfree(TO_DCN10_DIO(pool->base.dio))`) is identical everywhere. Consider adding a common `dcn10_dio_destroy()` function, or handling it in a shared resource pool teardown path.

Even for the SR macro split, only two shared helpers would be needed: one for the initializer-style generations and one for the `REG_STRUCT` assignment-style generations.

**Single patch is too large for bisection**

At 699 insertions across 17 files, this should ideally be split into at least a few patches (e.g., grouped by DCN generation family), or better yet, introduce a shared helper first and then wire it up. A single monolithic patch makes review harder and provides no bisection granularity if one generation has problems.

**Minor style inconsistency: blank line before `if (pool->base.dio)`**

In dcn31, dcn314, dcn315, dcn316, the destruction block lacks the blank line separator present in the other generations:
```c
	}
	if (pool->base.dio != NULL) {    // no blank line before this
```
vs. the other files which have:
```c
	}

	if (pool->base.dio != NULL) {    // blank line separator
```

This is cosmetic but inconsistent within the same patch.

**Summary of required changes:**
1. **Fix DCN21 shift/mask** — use the same `DIO_MASK_SH_LIST` / `HWS_SF` pattern as all other generations.
2. **Strongly consider** factoring out the common code into a shared helper to reduce the duplication.
3. **Consider splitting** into multiple patches for reviewability.

---
Generated by Claude Code Patch Reviewer

  parent reply	other threads:[~2026-03-24 21:19 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-23 21:13 [PATCH] drm/amd/display: Wire up dcn10_dio_construct() for all pre-DCN401 generations Ionut Nechita (Sunlight Linux)
2026-03-24 14:37 ` Alex Deucher
2026-03-24 16:42   ` LIPSKI, IVAN
2026-03-24 21:19 ` Claude Code Review Bot [this message]
2026-03-24 21:19 ` 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-20260323211343.263909-1-sunlightlinux@gmail.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