From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:53930) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Y9We0-0005ue-65 for qemu-devel@nongnu.org; Fri, 09 Jan 2015 05:18:17 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Y9Wdw-0001po-VA for qemu-devel@nongnu.org; Fri, 09 Jan 2015 05:18:16 -0500 Received: from mx1.redhat.com ([209.132.183.28]:38390) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Y9Wdw-0001pi-Oa for qemu-devel@nongnu.org; Fri, 09 Jan 2015 05:18:12 -0500 From: Stefan Hajnoczi Date: Fri, 9 Jan 2015 10:17:03 +0000 Message-Id: <1420798626-11428-24-git-send-email-stefanha@redhat.com> In-Reply-To: <1420798626-11428-1-git-send-email-stefanha@redhat.com> References: <1420798626-11428-1-git-send-email-stefanha@redhat.com> Subject: [Qemu-devel] [PULL 23/26] nvme: Fix get/set number of queues feature List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Peter Maydell , Alex Friedman , Stefan Hajnoczi From: Alex Friedman According to the specification, the low 16 bits should contain the number of I/O submission queues, and the high 16 bits should contain the number of I/O completion queues. Signed-off-by: Alex Friedman Acked-by: Keith Busch Signed-off-by: Stefan Hajnoczi --- hw/block/nvme.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/hw/block/nvme.c b/hw/block/nvme.c index aa1ed98..4f70f91 100644 --- a/hw/block/nvme.c +++ b/hw/block/nvme.c @@ -476,7 +476,8 @@ static uint16_t nvme_get_feature(NvmeCtrl *n, NvmeCmd *cmd, NvmeRequest *req) switch (dw10) { case NVME_NUMBER_OF_QUEUES: - req->cqe.result = cpu_to_le32(n->num_queues); + req->cqe.result = + cpu_to_le32((n->num_queues - 1) | ((n->num_queues - 1) << 16)); break; default: return NVME_INVALID_FIELD | NVME_DNR; @@ -490,7 +491,8 @@ static uint16_t nvme_set_feature(NvmeCtrl *n, NvmeCmd *cmd, NvmeRequest *req) switch (dw10) { case NVME_NUMBER_OF_QUEUES: - req->cqe.result = cpu_to_le32(n->num_queues); + req->cqe.result = + cpu_to_le32((n->num_queues - 1) | ((n->num_queues - 1) << 16)); break; default: return NVME_INVALID_FIELD | NVME_DNR; -- 2.1.0