From: Keith Busch Date: Mon, 26 Nov 2018 17:17:45 +0000 (-0700) Subject: nvme: Fix spurious interrupts X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=6da021815e752b3ca3a547eed53f3e92a8a35452;p=qmiga%2Fqemu.git nvme: Fix spurious interrupts 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 Signed-off-by: Keith Busch Tested-by: Guenter Roeck Signed-off-by: Kevin Wolf --- diff --git a/hw/block/nvme.c b/hw/block/nvme.c index 9fbe5673cb..7c8c63e8f5 100644 --- a/hw/block/nvme.c +++ b/hw/block/nvme.c @@ -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)