Received: from eggs.gnu.org ([2001:4830:134:3::10]:39890) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Xwv4t-0005qq-K3 for qemu-devel@nongnu.org; Fri, 05 Dec 2014 10:45:59 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Xwv4l-0006sf-1D for qemu-devel@nongnu.org; Fri, 05 Dec 2014 10:45:55 -0500 Received: from mga09.intel.com ([134.134.136.24]:33775) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Xwv4k-0006qn-RT for qemu-devel@nongnu.org; Fri, 05 Dec 2014 10:45:46 -0500 Date: Fri, 5 Dec 2014 15:45:20 +0000 (UTC) From: Keith Busch In-Reply-To: <1417783224-8825-1-git-send-email-alex@e8storage.com> Message-ID: References: <1417783224-8825-1-git-send-email-alex@e8storage.com> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; format=flowed; charset=US-ASCII Subject: Re: [Qemu-devel] [PATCH] nvme: Fix get/set number of queues feature List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Alex Friedman Cc: keith.busch@intel.com, qemu-devel@nongnu.org On Fri, 5 Dec 2014, alex@e8storage.com wrote: > 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 Good catch, thanks for the fix! Acked-by: Keith Busch > --- > 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 b6263dc..405cf4f 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; > -- > 1.9.3