From: Claude Code Review Bot <claude-review@example.com>
To: dri-devel-reviews@example.com
Subject: Claude review: drm/xe: Suppress Surprise Link Down on non-hotplug device
Date: Sat, 16 May 2026 13:17:50 +1000 [thread overview]
Message-ID: <review-patch5-20260512132614.1793083-12-mallesh.koujalagi@intel.com> (raw)
In-Reply-To: <20260512132614.1793083-12-mallesh.koujalagi@intel.com>
Patch Review
This patch masks the Surprise Link Down AER bit on the upstream switch port before triggering cold reset on non-hotplug slots.
**Naming concern: `pcie_` prefix on static functions**
```c
+static bool pcie_slot_is_hotplug_capable(struct pci_dev *usp)
+static void pcie_suppress_surprise_link_down(struct pci_dev *usp)
```
The `pcie_` prefix is conventionally reserved for PCI core/subsystem functions (defined in `include/linux/pci.h` and `drivers/pci/`). Using it for static driver functions risks confusion. Consider `xe_pcie_` or just descriptive names without the prefix.
**Logic is sound:**
The hierarchy is well-documented in the comment:
```c
/*
* Root Port --> Upstream Switch Port (USP) --> Virtual Switch Port (VSP) --> SGunit
*
* Cold reset power-cycles the slot, dropping the PCIe link. On a non-hotplug
* slot this triggers a spurious Surprise Link Down AER event on the USP.
*/
```
The check correctly traverses two levels up from the GPU endpoint to reach the USP, then checks the root port (one more level up) for hotplug capability:
```c
+static bool pcie_slot_is_hotplug_capable(struct pci_dev *usp)
+{
+ struct pci_dev *root_port = pci_upstream_bridge(usp);
+ ...
+ return (sltcap & (PCI_EXP_SLTCAP_HPC | PCI_EXP_SLTCAP_PCP)) ==
+ (PCI_EXP_SLTCAP_HPC | PCI_EXP_SLTCAP_PCP);
+}
```
This checks both `HPC` (Hot-Plug Capable) and `PCP` (Power Controller Present), which is the right combination for determining if the slot can handle surprise removal gracefully.
**Missing NULL check in the `#ifdef CONFIG_PCIEAER` block:**
```c
+ vsp = pci_upstream_bridge(pdev);
+ usp = vsp ? pci_upstream_bridge(vsp) : NULL;
+
+ if (usp && !pcie_slot_is_hotplug_capable(usp))
+ pcie_suppress_surprise_link_down(usp);
```
The NULL handling for `vsp` and `usp` is correct here. This is fine.
**The mask is never restored**
The Surprise Link Down mask bit is set but never cleared after recovery. If the device is successfully power-cycled and re-probed, the USP's AER configuration will have this bit permanently masked. The `aer_unmask_and_downgrade_internal_error()` function in patch 1 calls `pci_save_state(usp)` after modifying AER registers, but `pcie_suppress_surprise_link_down()` does not. After a cold reset and rescan, the PCI core should restore default AER state, so this may be moot — but it's worth confirming that this is intentional.
---
Generated by Claude Code Patch Reviewer
next prev parent reply other threads:[~2026-05-16 3:17 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-12 13:26 [PATCH v5 0/5] Introduce cold reset recovery method Mallesh Koujalagi
2026-05-12 13:26 ` [PATCH v5 1/5] Introduce Xe Uncorrectable Error Handling Mallesh Koujalagi
2026-05-16 3:17 ` Claude review: " Claude Code Review Bot
2026-05-12 13:26 ` [PATCH v5 2/5] drm: Add DRM_WEDGE_RECOVERY_COLD_RESET recovery method Mallesh Koujalagi
2026-05-14 7:59 ` Raag Jadav
2026-05-14 9:12 ` Tauro, Riana
2026-05-16 3:17 ` Claude review: " Claude Code Review Bot
2026-05-12 13:26 ` [PATCH v5 3/5] drm/doc: Document " Mallesh Koujalagi
2026-05-14 8:50 ` Raag Jadav
2026-05-16 3:17 ` Claude review: " Claude Code Review Bot
2026-05-12 13:26 ` [PATCH v5 4/5] drm/xe: Handle PUNIT errors by requesting cold-reset recovery Mallesh Koujalagi
2026-05-14 8:13 ` Raag Jadav
2026-05-16 3:17 ` Claude review: " Claude Code Review Bot
2026-05-12 13:26 ` [PATCH v5 5/5] drm/xe: Suppress Surprise Link Down on non-hotplug device Mallesh Koujalagi
2026-05-14 8:35 ` Raag Jadav
2026-05-14 9:36 ` Tauro, Riana
2026-05-16 3:17 ` Claude Code Review Bot [this message]
2026-05-16 3:17 ` Claude review: Introduce cold reset recovery method 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-patch5-20260512132614.1793083-12-mallesh.koujalagi@intel.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