From: Manish Honap <[email protected]>

A CXL Type-2 device is also a valid plain vfio-pci device. If the
vfio-cxl provider cannot bring it up as Type-2, failing the bind would
regress a device that previously worked as plain vfio-pci.

Make a non-deferred CXL init failure non-fatal: log it, drop the provider
reference, leave cxl_ops NULL, and continue driving the device as plain
vfio-pci. The -EPROBE_DEFER path added earlier still retries rather than
falling back.

Assisted-by: LLM
Signed-off-by: Manish Honap <[email protected]>
---
 drivers/vfio/pci/vfio_pci_core.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/drivers/vfio/pci/vfio_pci_core.c b/drivers/vfio/pci/vfio_pci_core.c
index a63a4f5228b8..9a75c30b67e2 100644
--- a/drivers/vfio/pci/vfio_pci_core.c
+++ b/drivers/vfio/pci/vfio_pci_core.c
@@ -2271,9 +2271,17 @@ static int vfio_pci_core_cxl_init(struct 
vfio_pci_core_device *vdev)
                vfio_pci_put_cxl_ops(ops);
                return ret;
        }
+       /*
+        * Any other failure is non-fatal: a CXL device that cannot be brought
+        * up as Type-2 still works as plain vfio-pci, so log and continue
+        * rather than failing the bind.
+        */
        if (ret) {
+               pci_warn(vdev->pdev,
+                        "CXL init failed (%d), continuing as plain vfio-pci\n",
+                        ret);
                vfio_pci_put_cxl_ops(ops);
-               return ret;
+               return 0;
        }
 
        vdev->cxl_ops = ops;
-- 
2.25.1


Reply via email to