]> git.ipfire.org Git - thirdparty/qemu.git/commitdiff
virtio: support irqfd in virtio_notify_config()
authorStefan Hajnoczi <stefanha@redhat.com>
Mon, 22 Sep 2025 22:01:47 +0000 (18:01 -0400)
committerMichael S. Tsirkin <mst@redhat.com>
Sun, 5 Oct 2025 13:01:08 +0000 (09:01 -0400)
virtio_error() calls virtio_notify_config() to inject a VIRTIO
Configuration Change Notification. This doesn't work from IOThreads
because the BQL is not held and the interrupt code path requires the
BQL.

Follow the same approach as virtio_notify() and use ->config_notifier
(an irqfd) when called from the IOThread.

Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Message-ID: <20250922220149.498967-4-stefanha@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
hw/virtio/virtio.c

index 6ce5823898d1a309c51641155672224e881ed150..de89e8104a629648b06675f1ef1180d2f88c0d70 100644 (file)
@@ -2706,7 +2706,12 @@ void virtio_notify_config(VirtIODevice *vdev)
 
     virtio_set_isr(vdev, 0x3);
     vdev->generation++;
-    virtio_notify_vector(vdev, vdev->config_vector);
+
+    if (qemu_in_iothread()) {
+        defer_call(virtio_notify_irqfd_deferred_fn, &vdev->config_notifier);
+    } else {
+        virtio_notify_vector(vdev, vdev->config_vector);
+    }
 }
 
 static bool virtio_device_endian_needed(void *opaque)