]> git.ipfire.org Git - thirdparty/qemu.git/commitdiff
nvme: Fix spurious interrupts
authorKeith Busch <keith.busch@intel.com>
Mon, 26 Nov 2018 17:17:45 +0000 (10:17 -0700)
committerKevin Wolf <kwolf@redhat.com>
Tue, 27 Nov 2018 11:59:00 +0000 (12:59 +0100)
The code had asserted an interrupt every time it was requested to check
for new completion queue entries.This can result in spurious interrupts
seen by the guest OS.

Fix this by asserting an interrupt only if there are un-acknowledged
completion queue entries available.

Reported-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Keith Busch <keith.busch@intel.com>
Tested-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
hw/block/nvme.c

index 9fbe5673cb966ba7bd0afff15b1cc5c1611d42f1..7c8c63e8f5e2215d98fd1f91c78ef485708e7df9 100644 (file)
@@ -272,7 +272,9 @@ static void nvme_post_cqes(void *opaque)
             sizeof(req->cqe));
         QTAILQ_INSERT_TAIL(&sq->req_list, req, entry);
     }
-    nvme_irq_assert(n, cq);
+    if (cq->tail != cq->head) {
+        nvme_irq_assert(n, cq);
+    }
 }
 
 static void nvme_enqueue_req_completion(NvmeCQueue *cq, NvmeRequest *req)