Cc: Riana
On Thu, Aug 27, 2026 at 03:47:50PM +0530, Arvind Yadav wrote:
> PCI error recovery currently uses xe->wedged.flag to block driver
> access. This mixes a temporary AER reset with a permanent device wedge.
>
> If the device wedges during AER recovery, the wedge is not seen as the
> first transition. The AER resume callback may then clear the flag and
> make the permanently wedged device appear usable again.
>
> Keep the old device blocked while slot reset removes it, and block the
> new device until the AER resume callback.
>
> The old AER path took a runtime PM reference to balance
> xe_device_wedged_fini(), which drops one when wedged.flag is set. AER no
> longer sets that flag, so keeping the Xe-owned reference would leak it.
> pcie_do_recovery() holds a PCI-core runtime PM reference across the
> error_detected, slot_reset and resume callbacks.
...
> +/*
> + * Return true when device access must be blocked either permanently because
> + * the device is wedged or temporarily while PCI error recovery is running.
> + *
> + * Do not use this helper for one-way wedged-device decisions such as DMA
> + * isolation, IRQ resume suppression or recovery-method reporting.
> + */
> +static inline bool xe_device_io_blocked(struct xe_device *xe)
> +{
> + return xe_device_wedged(xe) || xe_device_is_in_reset(xe);
> +}
This is already documented below but still FYI:
The long term plan to reuse FLR flow[1] in AER path and move over from
'reset' states to temporary wedging.
Raag
[1] https://patchwork.freedesktop.org/series/162055/
> @@ -116,7 +116,6 @@ static pci_ers_result_t xe_pci_error_slot_reset(struct
> pci_dev *pdev)
> * TODO: optimize by re-initializing only the hardware state and
> re-creating
> * kernel BOs.
> */
> - xe_device_clear_in_reset(xe);
> pdev->driver->remove(pdev);
> devres_release_group(&pdev->dev, xe->devres_group);