mbox series

[v2,0/3] hw/nvme: add irqfd support

Message ID 20220825074746.2047420-1-fanjinhao21s@ict.ac.cn
Headers show
Series hw/nvme: add irqfd support | expand

Message

Jinhao Fan Aug. 25, 2022, 7:47 a.m. UTC
This patch series changes qemu-nvme's interrupt emulation to use event
notifiers, which can ensure thread-safe interrupt delivery when iothread
is used. In the first patche, I convert qemu-nvme's IO emulation
logic to send irq via eventfd, so that the actual assertion and
deassertion is always done in the main loop thread with BQL held. In the
second patch, support is added to send irq via KVM irqfd, bypassing
qemu's MSI-x emulation. In the last patch, I add MSI-x mask handlers
when irqfd is enabled so that qemu-nvme knows which vector is masked
even when qemu's MSI-x emulation is bypassed.

Changes since v1:
 - Made nvme_irq_(de)assert wrappers around eventfd call and actual irq
   assertion
 - Dropped the previous first patch to avoid duplicate checks for 
   irq_enabled and msix_enabled

Jinhao Fan (3):
  hw/nvme: support irq(de)assertion with eventfd
  hw/nvme: use KVM irqfd when available
  hw/nvme: add MSI-x mask handlers for irqfd

 hw/nvme/ctrl.c       | 264 ++++++++++++++++++++++++++++++++++++++++---
 hw/nvme/nvme.h       |   7 ++
 hw/nvme/trace-events |   3 +
 3 files changed, 257 insertions(+), 17 deletions(-)