On 23/9/25 00:01, Stefan Hajnoczi wrote:
The difference between these two functions:
- virtio_notify() uses the interrupt code path (MSI or classic IRQs)
- virtio_notify_irqfd() uses guest notifiers (irqfds)
virtio_notify() can only be called with the BQL held because the
interrupt code path requires the BQL. Device models use
virtio_notify_irqfd() from IOThreads since the BQL is not held.
The two functions can be unified by pushing down the if
(qemu_in_iothread()) check from virtio-blk and virtio-scsi into core
virtio code. This is in preparation for the next commit that will add
irqfd support to virtio_notify_config() and where it's unattractive to
introduce another irqfd-only API for device model callers.
Signed-off-by: Stefan Hajnoczi <[email protected]>
---
include/hw/virtio/virtio.h | 1 -
hw/block/virtio-blk.c | 6 +-----
hw/scsi/virtio-scsi.c | 6 +-----
hw/virtio/virtio.c | 28 +++++++++++++---------------
hw/virtio/trace-events | 1 -
5 files changed, 15 insertions(+), 27 deletions(-)
Nice cleanup.
Reviewed-by: Philippe Mathieu-Daudé <[email protected]>