Re: [PATCH v4 2/3] PCI: Add soft reset method as last resort

From: Jose Ignacio Tornos Martinez

Date: Tue May 19 2026 - 01:36:55 EST


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;

if (pci_pm_reset(dev, true) == 0)
return -ENOTTY;

if (pci_d3cold_reset(dev, true) == 0)
return -ENOTTY;

if (!dev->pm_cap)
return -ENOTTY;

if (probe)
return 0;

return pci_do_d3hot_transition(dev);
}

DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_QCOM, 0x1103, quirk_allow_soft_reset);
DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_QCOM, 0x1107, quirk_allow_soft_reset);
DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_QCOM, 0x0308, quirk_allow_soft_reset);

This way:
- Only proven device IDs get soft reset capability (no broad reset reporting)
- Device-specific version matching device IDs (as you suggested)
- Generic infrastructure but explicit opt-in per device
- Different from v2: new method with quirk, not modifying pm reset behavior

Would this approach be acceptable?

Thanks

Best regards
José Ignacio