nvme: Fix get/set number of queues feature
PATCH 1/1 nvme: Fix get/set number of queues feature
From: Alex Friedman <[email protected]>
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.
--- hw/block/nvme.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
hw/block/nvme.c +4 -2
@@ -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 ;
Signature · 1 line
1.9.3
Quoted 7 lines · On Fri, 5 Dec 2014, [email protected] wrote:
From: Alex Friedman <[email protected]>
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 <[email protected]>
Good catch, thanks for the fix!
Quoted 30 lines
---
hw/block/nvme.c| 6 ++++--1 file changed, 4 insertions(+), 2 deletions(-)hw/block/nvme.c +4
-2@@ -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 ;Signature · 1 line
1.9.3
*ping*
https://patchwork.ozlabs.org/patch/418107/
Alex Friedman
E8 Storage VP R&D
[email protected]
Mobile: +972-54-579-7646
Quoted 53 lines · Keith Busch
Quoted 9 lines · On Fri, 5 Dec 2014, [email protected] wrote:
From: Alex Friedman <[email protected]>
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 <[email protected]>Good catch, thanks for the fix!
Acked-by Keith Busch <[email protected]>---
Quoted 34 lines
hw/block/nvme.c| 6 ++++--1 file changed, 4 insertions(+), 2 deletions(-)hw/block/nvme.c +2
-1@@ -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;hw/block/nvme.c +2
-1@@ -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
Stefan Hajnoczi
AppliedQuoted 10 lines · On Fri, Dec 05, 2014 at 02:40:24PM +0200, [email protected] wrote:
From: Alex Friedman <[email protected]>
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 <[email protected]>--- hw/block/nvme.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
Sorry, I missed this patch.
Please CC [email protected] and [email protected] (block subsystem maintainers) on NVME patches, unless Keith is going to send a separate pull request to us himself.
Thanks, applied to my block tree:
https://github.com/stefanha/qemu/commits/block
Stefan
Quoted 12 lines · Stefan Hajnoczi
Quoted 10 lines · On Fri, Dec 05, 2014 at 02:40:24PM +0200, [email protected] wrote:
From: Alex Friedman <[email protected]>
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 <[email protected]>--- hw/block/nvme.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
Quoted 5 lines
Sorry, I missed this patch.
Please CC [email protected] and [email protected] (block subsystem maintainers) on NVME patches, unless Keith is going to send a separate pull request to us himself.
Thanks, I'm more than okay to see this go through the block subsystem. The fix is already in my qemu-nvme tree, but that repo turned into a bit of a free-for-all and needs some maintenance to make it fit for pulls. I'll fix it up once I'm inbetween projects and have more free time.
Quoted 5 lines
Thanks, applied to my block tree:
https://github.com/stefanha/qemu/commits/blockStefan