[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20240319120410.1477713-1-mike.malyshev@gmail.com>
Date: Tue, 19 Mar 2024 12:04:09 +0000
From: Mikhail Malyshev <mike.malyshev@...il.com>
To: alex.williamson@...hat.com,
jgg@...pe.ca,
yi.l.liu@...el.com,
kevin.tian@...el.com,
tglx@...utronix.de,
reinette.chatre@...el.com,
stefanha@...hat.com
Cc: abhsahu@...dia.com,
kvm@...r.kernel.org,
linux-kernel@...r.kernel.org,
Mikhail Malyshev <mike.malyshev@...il.com>
Subject: [PATCH 0/1] Reenable runtime PM for dynamically unbound devices
When trying to run a VM with PCI passthrough of intel-eth-pci ETH device
QEMU fails with "Permission denied" error. This happens only if
intel-eth-pci driver is dynamically unbound from the device using
"echo -n $DEV > /sys/bus/pci/drivers/stmmac/unbind" command. If
"vfio-pci.ids=..." is used to bind the device to vfio-pci driver and the
device is never probed by intel-eth-pci driver the problem does not occur.
When intel-eth-pci driver is dynamically unbound from the device
remove()
intel_eth_pci_remove()
stmmac_dvr_remove()
pm_runtime_disable();
Later when QEMU tries to get the device file descriptor by calling
VFIO_GROUP_GET_DEVICE_FD ioctl pm_runtime_resume_and_get returns -EACCES.
It happens because dev->power.disable_depth == 1 .
vfio_group_fops_unl_ioctl(VFIO_GROUP_GET_DEVICE_FD)
vfio_group_ioctl_get_device_fd()
vfio_device_open()
ret = device->ops->open_device()
vfio_pci_open_device()
vfio_pci_core_enable()
ret = pm_runtime_resume_and_get();
This behavior was introduced by
commit 7ab5e10eda02 ("vfio/pci: Move the unused device into low power state with runtime PM")
This may be the case for any driver calling pm_runtime_disable() in its
remove() callback.
The case when a runtime PM may be disable for a device is not handled so we
call pm_runtime_enable() in vfio_pci_core_register_device to re-enable it.
Mikhail Malyshev (1):
vfio/pci: Reenable runtime PM for dynamically unbound devices
drivers/vfio/pci/vfio_pci_core.c | 10 ++++++++++
1 file changed, 10 insertions(+)
--
2.34.1
Powered by blists - more mailing lists