The commit 51ef3a004b1e ("vfio/pci: Restore device state on PM transition") added a wrapper function vfio_pci_probe_power_state(). For the devices which do not have No_Soft_Reset bit set in its PMCSR config register, inside this function, the current PCI state will be saved locally in 'vfio_pci_core_device::pm_save' during D0->D3hot transition and same will be restored back during D3hot->D0 transition. We have few IOCTLs and internal functions in vfio-pci driver which can be invoked when the device power state is non-D0. This patch series fixes issues around reset-related API's if reset is invoked in the D3hot state. * Changes in v3 - Split the changes into 2 patches. - Updated comments and commit message according to updated changes. - Added code to wakeup devices for vfio_pci_dev_set_try_reset(). * Changes in v2 - Add the Fixes tag and sent this patch independently. - Invoke vfio_pci_set_power_state() before invoking reset related API's. - Removed saving of power state locally. - Removed warning before 'kfree(vdev->pm_save)'. - Updated comments and commit message according to updated changes. * v1 of this patch was sent in https://lore.kernel.org/lkml/20220124181726.19174-4-abhsahu@xxxxxxxxxx/ Abhishek Sahu (2): vfio/pci: fix memory leak during D3hot to D0 transition vfio/pci: wake-up devices around reset functions drivers/vfio/pci/vfio_pci_core.c | 61 ++++++++++++++++++++++++++++++++ 1 file changed, 61 insertions(+) -- 2.17.1