From patchwork Fri Jun 22 11:22:37 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gersner X-Patchwork-Id: 933290 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="XmYdU+Wk"; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 41Bxfx5khqz9s4V for ; Fri, 22 Jun 2018 21:48:57 +1000 (AEST) Received: from localhost ([::1]:32984 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fWKYg-0000ew-Ey for incoming@patchwork.ozlabs.org; Fri, 22 Jun 2018 07:48:54 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:58705) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fWKAO-0007XP-QV for qemu-devel@nongnu.org; Fri, 22 Jun 2018 07:23:49 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fWKAN-0005aa-PA for qemu-devel@nongnu.org; Fri, 22 Jun 2018 07:23:48 -0400 Received: from mail-wr0-x241.google.com ([2a00:1450:400c:c0c::241]:38321) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fWKAK-0005Xq-2D; Fri, 22 Jun 2018 07:23:44 -0400 Received: by mail-wr0-x241.google.com with SMTP id e18-v6so6357479wrs.5; Fri, 22 Jun 2018 04:23:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=j0tNx98jcDgo7JsdUKNiTsIOXNgYhqs7KN4HOPBLqNQ=; b=XmYdU+WkuFuUaEuyUxqIvtbd+B8qHCuyLtlLElZZAvg090juAt9le0/waWyiR+DoZY HNc6M7Dga2ELZwscPBvvKoPemDmLAkN+CCtuikllTCrbHh3c0lQ3zXvgVlI5ruB43+SH L3ymlBzNFQM3jwbu2+O1qjmPk0WvIqfcidT0r13YXkVIuxpPJzX3iBYx2N/gh7rY9LSh HlOUIdgM02wFR6TvecPQXSs2rNKfXAqqS5ZqzJGDaWIB0DKR2/LdTIitcj1g8XfHVlx1 nwgBReh00L7txrvfPM3xFHCyJ18zmo4JEzVv4zkShTNd50t7X/ogzpm6nJpoyzs/NEfj EKmQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=j0tNx98jcDgo7JsdUKNiTsIOXNgYhqs7KN4HOPBLqNQ=; b=pDWBDf3x6O59KnoY1orkzaqcoy/2NVbk6G1WNUzRiZfI5Lm8DDHwHAPvJVd3PEuSCo X/mciUQgRkrXHmYpej/6+12m0X1m1plgSUrjqtXOpbQvwk5ZzZBcK20gf5JwxTUHgR+F O8jW9mX8Q66XUaG7PY9R1xdEW1olFkcCGuziRA+pT3XH2FFec8gkGdPBxRDsvzzbeQvU s477fXmiw4sdbLkAxFJ2rBAsAFgwkVK0Hk7irHFP5UkENFS5Ome+ZHQlo49Z364DjHCL w1PcT3gQ2HoDRX8HYtLqequFNNFNQ2Yqa/97KWG58O3OjVnCmIDLSX62TOOGc9BNbCrh 7ajQ== X-Gm-Message-State: APt69E1ukmVxZR0pXiHIXCbVGzpkld+oKZcoK4kh1I0Hp6KH2Xmtxl0x flBU3Dsi3T7C0IK8w7L5rwk22S8pQWE= X-Google-Smtp-Source: AAOMgpfiYP17OoVwm9TmfKvNa5/A7fDKwf1AI95Mhdrpbs5S3HzlxvjFdqhPd1i2/SUl2GhYXGVAUw== X-Received: by 2002:adf:e48e:: with SMTP id i14-v6mr1378010wrm.8.1529666623087; Fri, 22 Jun 2018 04:23:43 -0700 (PDT) Received: from localhost.localdomain (bzq-109-64-22-141.red.bezeqint.net. [109.64.22.141]) by smtp.gmail.com with ESMTPSA id e81-v6sm1758833wmi.28.2018.06.22.04.23.41 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 22 Jun 2018 04:23:42 -0700 (PDT) From: Shimi Gersner To: qemu-block@nongnu.org, qemu-devel@nongnu.org Date: Fri, 22 Jun 2018 11:22:37 +0000 Message-Id: <20180622112237.2131-5-gersner@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180622112237.2131-1-gersner@gmail.com> References: <20180622112237.2131-1-gersner@gmail.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:400c:c0c::241 Subject: [Qemu-devel] [PATCH 5/5] nvme: Missing MSI message upon partial CQ read X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Keith Busch , Kevin Wolf , David Sariel , Shimi Gersner , Max Reitz Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" When MSIx interrupts are enabled, each CQ is associated with a vector which is expected to be called upon ready data in the CQ buffer. After guest reads from the buffer, it updates the processed buffer position using a CQ dedicated DB. Upon reading only partial data from the CQ buffer, device fails to re-send a new MSI message stating buffer still has unread data. The fix ensures a new message will be sent. Change-Id: I10190be127b8dcbd89732cfb95ea37faf8c5779b Signed-off-by: Shimi Gersner --- hw/block/nvme.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/hw/block/nvme.c b/hw/block/nvme.c index f639d7ae73..e2dca6e57f 100644 --- a/hw/block/nvme.c +++ b/hw/block/nvme.c @@ -1152,8 +1152,12 @@ static void nvme_process_db(NvmeCtrl *n, hwaddr addr, int val) } } + // When we have more messages, we should make sure irq is asserted. When MSIx is used + // this will make sure another notification is sent to the guest. if (cq->tail == cq->head) { nvme_irq_deassert(n, cq); + } else { + nvme_irq_assert(n, cq); } } else { /* Submission queue doorbell write */