]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
vfio/xe: Notify PF about VF FLR in reset_prepare
authorPiotr Piórkowski <piotr.piorkowski@intel.com>
Mon, 9 Mar 2026 15:24:49 +0000 (16:24 +0100)
committerMichał Winiarski <michal.winiarski@intel.com>
Tue, 24 Mar 2026 09:47:52 +0000 (10:47 +0100)
Hook into the PCI error handler reset_prepare() callback to notify
the PF about an upcoming VF FLR before reset_done() is executed.
This enables early FLR_PREPARE signaling and ensures that the PF is
aware of the reset before the completion wait begins.

Signed-off-by: Piotr Piórkowski <piotr.piorkowski@intel.com>
Cc: Michał Winiarski <michal.winiarski@intel.com>
Reviewed-by: Michał Winiarski <michal.winiarski@intel.com>
Reviewed-by: Alex Williamson <alex@shazbot.org>
Link: https://patch.msgid.link/20260309152449.910636-3-piotr.piorkowski@intel.com
Signed-off-by: Michał Winiarski <michal.winiarski@intel.com>
drivers/vfio/pci/xe/main.c

index fff95b2d5dde1c97f8aaaabeebde53cbd3f096cb..88acfcf840fcc46a8b81ac7cffed912dcda20d0f 100644 (file)
@@ -85,6 +85,19 @@ again:
        spin_unlock(&xe_vdev->reset_lock);
 }
 
+static void xe_vfio_pci_reset_prepare(struct pci_dev *pdev)
+{
+       struct xe_vfio_pci_core_device *xe_vdev = pci_get_drvdata(pdev);
+       int ret;
+
+       if (!pdev->is_virtfn)
+               return;
+
+       ret = xe_sriov_vfio_flr_prepare(xe_vdev->xe, xe_vdev->vfid);
+       if (ret)
+               dev_err(&pdev->dev, "Failed to prepare FLR: %d\n", ret);
+}
+
 static void xe_vfio_pci_reset_done(struct pci_dev *pdev)
 {
        struct xe_vfio_pci_core_device *xe_vdev = pci_get_drvdata(pdev);
@@ -127,6 +140,7 @@ static void xe_vfio_pci_reset_done(struct pci_dev *pdev)
 }
 
 static const struct pci_error_handlers xe_vfio_pci_err_handlers = {
+       .reset_prepare = xe_vfio_pci_reset_prepare,
        .reset_done = xe_vfio_pci_reset_done,
        .error_detected = vfio_pci_core_aer_err_detected,
 };