From: Claude Code Review Bot <claude-review@example.com>
To: dri-devel-reviews@example.com
Subject: Claude review: drm/amdgpu: deduplicate register access and helper routines
Date: Wed, 01 Apr 2026 08:02:08 +1000 [thread overview]
Message-ID: <review-patch1-20260330224503.548284-1-gabrielsousa230@gmail.com> (raw)
In-Reply-To: <20260330224503.548284-1-gabrielsousa230@gmail.com>
Patch Review
**`amdgpu_common.c` — `common_sw_init()`:**
```c
int common_sw_init(struct amdgpu_ip_block *ip_block)
{
struct amdgpu_device *adev = ip_block->adev;
if (amdgpu_sriov_vf(adev))
xgpu_nv_mailbox_add_irq_id(adev);
return 0;
}
```
This is **not** a universal replacement:
- `soc15_common_sw_init()` calls `xgpu_ai_mailbox_add_irq_id()` (different function) and also has `adev->df.funcs->sw_init()` logic. The patch doesn't replace `soc15_common_sw_init()` in the diff, but the function is misleadingly named as if it were universal.
- `soc_v1_0_common_sw_init()` is just `return 0;` — it should **not** gain an `xgpu_nv_mailbox_add_irq_id()` call.
**`soc_v1_0.c` change:**
```c
static int soc_v1_0_common_sw_init(struct amdgpu_ip_block *ip_block)
{
- return 0;
+ return common_sw_init(ip_block);
}
```
This introduces a **behavioral change** on soc_v1_0 hardware — the function now calls `xgpu_nv_mailbox_add_irq_id()` in SR-IOV VF mode, which it never did before.
**`read_indexed_register()` and `program_aspm()` deduplication**: These two are genuinely identical across all call sites and the mechanical replacement is correct. However, the function names need an `amdgpu_` prefix to avoid namespace pollution.
**`amdgpu_common.h`:**
```c
#ifndef __AMDGPU_COMMON_H__
#define __AMDGPU_COMMON_H__
uint32_t read_indexed_register(struct amdgpu_device *adev,
u32 se_num, u32 sh_num, u32 reg_offset);
```
Missing forward declarations for `struct amdgpu_device` and `struct amdgpu_ip_block`. Add them or `#include "amdgpu.h"`.
**Recommendation**: Drop the `common_sw_init()` consolidation entirely (it's not actually a common function). Keep the `read_indexed_register` and `program_aspm` deduplication but add proper `amdgpu_` prefixes. Consider placing them in existing files rather than creating a new catch-all `amdgpu_common.c`.
---
Generated by Claude Code Patch Reviewer
next prev parent reply other threads:[~2026-03-31 22:02 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-30 22:45 [PATCH] drm/amdgpu: deduplicate register access and helper routines Gabriel Almeida
2026-03-31 11:24 ` Christian König
2026-03-31 13:30 ` Alex Deucher
[not found] ` <CALsHKmUeB3=H9=Nq=+jOvtmwXxSg=wtHrASZNvVVPQwpyem2ug@mail.gmail.com>
2026-03-31 21:21 ` Alex Deucher
2026-03-31 22:02 ` Claude Code Review Bot [this message]
2026-03-31 22:02 ` 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-20260330224503.548284-1-gabrielsousa230@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