Re: [PATCH v4 2/3] PCI: Add soft reset method as last resort
From: Alex Williamson
Date: Wed May 20 2026 - 12:14:58 EST
On Tue, 19 May 2026 07:35:50 +0200
Jose Ignacio Tornos Martinez <jtornosm@xxxxxxxxxx> wrote:
> Hello Alex,
>
> Thank you for the feedback. I understand the concern about reporting reset
> capabilities for all devices.
>
> Regarding the sysfs power state approach: I tested this, but the challenge
> is that VFIO needs automatic reset during VM crash/reassignment. When a VM
> terminates uncleanly, VFIO calls the device reset path automatically before
> reassignment - there's no opportunity for userspace to manipulate sysfs power
> state in that flow.
>
> For the device-specific approach you mentioned, what if I modify the "soft"
> method to require an explicit quirk flag? Something like:
>
> static int pci_soft_reset(struct pci_dev *dev, bool probe)
> {
> /* Only available if device explicitly quirked for soft reset */
> if (!(dev->dev_flags & PCI_DEV_FLAGS_ALLOW_SOFT_RESET))
> return -ENOTTY;
>
...
>
> Would this approach be acceptable?
Device specific resets are made for this scenario. Look at
pci_dev_specific_reset() and pci_dev_reset_methods[]. The supporting
evidence that this performs a worthwhile reset is still a bit weak, but
heuristically it seems better than nothing, which is what we're left
with otherwise. Reset via D3hot for a device that does not expose
NoSoftRst- is not something we should enable or endorse for any common
use case. Thanks,
Alex