Commit 2202e218e0 for qemu.org
commit 2202e218e0a92e9ba5be8099b81c6a2efd61df9c
Author: Cédric Le Goater <clg@redhat.com>
Date: Wed May 6 17:23:53 2026 +0200
vfio/pci: Replace abort() with g_assert_not_reached()
This check was originally introduced in commit b3ebc10c373e
("vfio-pci: Add debug config options to disable MSI/X KVM support") as
part of a debug block to retrieve the MSI/MSIX message, and was later
moved by commit 0de70dc7bab1 ("vfio/pci: Rename MSI/X functions for
easier tracing") into the main interrupt handling path, becoming
production code.
Under normal conditions, this code path cannot be reached because the
BQL serializes all handler registration, vdev->interrupt updates, and
handler removal. Replace abort() with g_assert_not_reached(), which is
preferred nowdays, and add a comment clarifying the purpose.
Cc: Alex Williamson <alex@shazbot.org>
Acked-by: Alex Williamson <alex@shazbot.org>
Link: https://lore.kernel.org/qemu-devel/20260506152353.1657838-1-clg@redhat.com
Signed-off-by: Cédric Le Goater <clg@redhat.com>
diff --git a/hw/vfio/pci.c b/hw/vfio/pci.c
index b2a07f6bb4..9c06b25e63 100644
--- a/hw/vfio/pci.c
+++ b/hw/vfio/pci.c
@@ -451,7 +451,12 @@ static void vfio_msi_interrupt(void *opaque)
get_msg = msi_get_message;
notify = msi_notify;
} else {
- abort();
+ /*
+ * Interrupt state transitions (MSI/MSI-X -> NONE/INTx) are
+ * protected by the BQL, and eventfd handlers are strictly
+ * unregistered before vdev->interrupt is modified.
+ */
+ g_assert_not_reached();
}
msg = get_msg(pdev, nr);