Re: [PATCH] vfio/pci: Restore standard PCI config space in .slot_reset()

Lukas Wunner <[email protected]>
Newsgroups org.kernel.vger.linux-pci,dev.linux.lists.sashiko-reviews
Message-ID <[email protected]>
On Mon, Aug 17, 2026 at 08:04:04PM +0000, [email protected] wrote:
> [Severity: High]
> Is this callback reachable under normal single-device circumstances?
> 
> In pcie_do_recovery(), the report_slot_reset broadcast is gated behind
> checking if the combined error status is PCI_ERS_RESULT_NEED_RESET.
> 
> However, vfio_pci_core_aer_err_detected() unconditionally returns
> PCI_ERS_RESULT_CAN_RECOVER. The PCI recovery state machine promotes
> CAN_RECOVER to RECOVERED during the mmio_enabled phase, so the
> condition to call slot_reset evaluates to false unless another driver
> on the same PCIe bridge votes for NEED_RESET.

I have a patch on my development branch so that ->reset_slot() is
also invoked if (state == pci_channel_io_frozen), i.e. on Fatal Errors.

I have another patch pending to allow error recovery for unbound devices.

Both patches are available for testing on this branch and I hope to
submit them in the upcoming cycle:

https://github.com/l1k/linux/commits/aer_unbound/

> [Severity: High]
> Can pci_restore_state() clobber userspace runtime configurations with
> an outdated probe-time snapshot?
> 
> For a VFIO device, pdev->saved_config_space contains the host kernel's
> baseline state captured during vfio_pci_core_enable(). Subsequent
> userspace modifications (like enabling bus master or setting up MSI)
> are recorded in VFIO's virtual cache (vdev->vconfig) but do not update
> pdev->saved_config_space.

I guess the right thing to do is to write vdev->vconfig to config space
after pci_restore_state()?

Thanks,

Lukas
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.