Claude review: accel/amdxdna: Initial support for AIE4 platform

Claude Code Review Bot
2026-03-31T07:05:08Z

Overall Series Review

Subject: accel/amdxdna: Initial support for AIE4 platform
Author: Lizhi Hou <lizhi.hou@amd.com>
Patches: 10
Reviewed: 2026-03-31T17:05:08.529572

---

This 6-patch series adds initial AIE4 (NPU3) Physical Function support with SR-IOV to the amdxdna accel driver (PCI IDs 0x17F2 and 0x1B0B). The approach is to refactor existing AIE2-specific mailbox, PSP, and SMU code into shared "aie_" common code, then build AIE4 support on top.

**Overall assessment: The refactoring approach is sound**, and the series is structured logically (common code first, then AIE4 specifics). However, there are several issues:

1. **Two `struct amdxdna_dev_hdl` definitions** — AIE2 (`aie2_pci.h`) and AIE4 (`aie4_pci.h`) define completely different structs with the same name. This works because they're compiled in separate translation units, but it's fragile and makes the codebase confusing. A more scalable approach would use different names or a proper inheritance pattern.

2. **Two `struct amdxdna_dev_priv` definitions** — same problem. Both `aie2_pci.h` and `aie4_pci.h` define this struct differently.

3. **Behavioral change in status checking** — The old `DECLARE_AIE2_MSG` used `MAX_AIE2_STATUS_CODE` for the status sentinel, the new `DECLARE_AIE_MSG` uses `-1`. This changes how success/failure is determined in `aie_send_mgmt_msg_wait()`.

4. **UAPI gap** — `AMDXDNA_DEV_TYPE_PF = 2` skips value 1, which should be explicitly documented.

5. **Missing `sriov_configure` in existing ops** — NULL dereference is avoided by a check, but the ops struct lacks the field declaration in the same patch that adds it.

---

---
Generated by Claude Code Patch Reviewer