Commit c5d75e36cd for qemu.org
commit c5d75e36cd729131237ffcfc3a52a72c871c6aa7
Author: Markku Ahvenjärvi <mankku@gmail.com>
Date: Wed Sep 23 15:20:03 2026 +0300
hw/nvme: fix missed CQ updates
When doorbell buffers are enabled, CQ head updates may race with
completion posting. When a CQ doorbell leaves pending completions, the
event index may become stale and cause the guest to suppress the next
MMIO doorbell write. QEMU may then fail to observe that the CQ has
been drained. With legacy INTx, this can leave the interrupt asserted
indefinitely and cause an interrupt storm.
Update the CQ event index as part of doorbell processing to ensure that
subsequent head updates notify QEMU.
Cc: qemu-stable@nongnu.org
Fixes: 3f7fe8de3d49 ("hw/nvme: Implement shadow doorbell buffer support")
Fixes: 2e53b0b45024 ("hw/nvme: Use ioeventfd to handle doorbell updates")
Signed-off-by: Markku Ahvenjärvi <mankku@gmail.com>
Reviewed-by: Klaus Jensen <k.jensen@samsung.com>
Signed-off-by: Klaus Jensen <k.jensen@samsung.com>
diff --git a/hw/nvme/ctrl.c b/hw/nvme/ctrl.c
index e591842a4a..52fa4b327c 100644
--- a/hw/nvme/ctrl.c
+++ b/hw/nvme/ctrl.c
@@ -4789,6 +4789,7 @@ static void nvme_cq_notifier(EventNotifier *e)
return;
}
+ nvme_update_cq_eventidx(cq);
nvme_update_cq_head(cq);
if (cq->tail == cq->head) {
@@ -8633,6 +8634,8 @@ static void nvme_process_db(NvmeCtrl *n, hwaddr addr, int val)
}
nvme_irq_deassert(n, cq);
+ } else if (n->dbbuf_enabled) {
+ nvme_update_cq_eventidx(cq);
}
} else {
/* Submission queue doorbell write */