Re: [PATCH v18 3/4] vfio/pci: Add a reset_done callback for vfio-pci driver

From: Farhan Ali

Date: Thu Jun 04 2026 - 13:24:40 EST



On 6/4/2026 1:28 AM, Keith Busch wrote:
On Wed, Jun 03, 2026 at 11:24:14AM -0700, Farhan Ali wrote:
+static void vfio_pci_core_aer_reset_done(struct pci_dev *pdev)
+{
+ struct vfio_pci_core_device *vdev = dev_get_drvdata(&pdev->dev);
+
+ if (!vdev->pci_saved_state)
+ return;
+
+ pci_load_saved_state(pdev, vdev->pci_saved_state);
+ pci_restore_state(pdev);
+}
Shouldn't there be a cooresponding user space notification that the
device has been restored? There's an eventfd on the error detected side
so user space can know the device needs recovery, but how does it come
to know that the reset is completed?

I think if the VFIO_DEVICE_RESET ioctl completes successfully it should be an indication that the reset has completed? AFAIU the ioctl will drive a reset via pci_try_reset_function(). If reset completes completes successfully the reset_done() callback is called via pci_dev_restore(). So I don't think we need an eventfd to notify on reset completion. Otherwise we would have the same problem today, where userspace is unaware that VFIO_DEVICE_RESET did indeed successfully reset the device, no? Or am I missing something?

Thanks

Farhan