From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:43248) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YB1rE-0002wr-6J for qemu-devel@nongnu.org; Tue, 13 Jan 2015 08:50:12 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YB1r7-0006Xj-PR for qemu-devel@nongnu.org; Tue, 13 Jan 2015 08:50:08 -0500 Received: from mx1.redhat.com ([209.132.183.28]:59713) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YB1r7-0006X8-Ix for qemu-devel@nongnu.org; Tue, 13 Jan 2015 08:50:01 -0500 From: Stefan Hajnoczi Date: Tue, 13 Jan 2015 13:48:13 +0000 Message-Id: <1421156896-11599-36-git-send-email-stefanha@redhat.com> In-Reply-To: <1421156896-11599-1-git-send-email-stefanha@redhat.com> References: <1421156896-11599-1-git-send-email-stefanha@redhat.com> Subject: [Qemu-devel] [PULL v3 35/38] 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