Re: [PATCH 4/5] PCI/sysfs: Use user config accessors for link attributes
From: Keith Busch
Date: Mon Oct 26 2026 - 11:23:43 EST
On Sat, Oct 24, 2026 at 05:08:32PM -0700, Matthew Wood wrote:
> max_link_width, current_link_speed and current_link_width read the PCIe
> Link Capabilities and Link Status registers with the kernel config
> accessors. Those don't check block_cfg_access so a read that races
> with a reset goes to the device mid-reset and can fail or return a bogus
> value.
>
> Use pcie_capability_user_read_{word,dword}() instead so the read waits for
> any pci_cfg_access_lock() holder (e.g. pci_reset_function()) to finish. For
> max_link_width, this means inlining the pcie_get_width_cap() logic
> instead of creating an additional helper with this single calling location.
Looks good.
Reviewed-by: Keith Busch <kbusch@xxxxxxxxxx>