@samitouri / QOSamiQemu / commits / 2293d8b4bd

hw/nvme: fix admin cq msix setup

If MSI-X is not enabled when the admin completion queue is created, msix_vector_use() is not called. But, if MSI-X is subsequently enabled, msix_notify() will fail to fire the interrupt because the use count for the vector remains at 0. msix_vector_use/unuse should be called if MSI-X is *present*, not *enabled*. Fix this. Cc: qemu-stable@nongnu.org Reported-by: Andreas Hindborg <a.hindborg@samsung.com> Signed-off-by: Klaus Jensen <k.jensen@samsung.com>

Klaus Jensen committed Mar 18, 2026 at 10:26 UTC 2293d8b4bd88d3f29730cfd608935f77247919b6
1 file changed +2 -2
hw/nvme/ctrl.c
+2 -2
@@ -5519,7 +5519,7 @@ static void nvme_free_cq(NvmeCQueue *cq, NvmeCtrl *n)
5519 event_notifier_set_handler(&cq->notifier, NULL);
5520 event_notifier_cleanup(&cq->notifier);
5521 }
5522 - if (msix_enabled(pci) && cq->irq_enabled) {
5522 + if (msix_present(pci) && cq->irq_enabled) {
5523 msix_vector_unuse(pci, cq->vector);
5524 }
5525 if (cq->cqid) {
@@ -5560,7 +5560,7 @@ static void nvme_init_cq(NvmeCQueue *cq, NvmeCtrl *n, uint64_t dma_addr,
5560 {
5561 PCIDevice *pci = PCI_DEVICE(n);
5562
5563 - if (msix_enabled(pci) && irq_enabled) {
5563 + if (msix_present(pci) && irq_enabled) {
5564 msix_vector_use(pci, vector);
5565 }
5566