When a device is unbound from its driver it may call pm_runtime_disable() in its ->remove() callback. When such device is bound to vfio-pci driver VFIO framework should reenable runtime PM before calling pm_runtime_xxx functions. The problem was introduced by commit 7ab5e10eda02 ("vfio/pci: Move the unused device into low power state with runtime PM") Signed-off-by: Mikhail Malyshev <mike.malyshev@xxxxxxxxx> --- drivers/vfio/pci/vfio_pci_core.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/drivers/vfio/pci/vfio_pci_core.c b/drivers/vfio/pci/vfio_pci_core.c index 1cbc990d42e0..05c25ee66ee1 100644 --- a/drivers/vfio/pci/vfio_pci_core.c +++ b/drivers/vfio/pci/vfio_pci_core.c @@ -2258,6 +2258,16 @@ int vfio_pci_core_register_device(struct vfio_pci_core_device *vdev) vfio_pci_set_power_state(vdev, PCI_D0); dev->driver->pm = &vfio_pci_core_pm_ops; + + /* + * If the device was previously associated with a driver, the + * driver might have invoked pm_runtime_disable in its remove() + * callback. We must re-enable runtime PM here to ensure the + * device can be managed. + */ + if (!pm_runtime_enabled(dev)) + pm_runtime_enable(dev); + pm_runtime_allow(dev); if (!disable_idle_d3) pm_runtime_put(dev); -- 2.34.1