[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 29/30] hw/block/nvme: fix create IO SQ/CQ status codes
From: |
Klaus Jensen |
Subject: |
[PULL 29/30] hw/block/nvme: fix create IO SQ/CQ status codes |
Date: |
Tue, 27 Oct 2020 11:49:31 +0100 |
From: Gollu Appalanaidu <anaidu.gollu@samsung.com>
Replace the Invalid Field in Command with the Invalid PRP Offset status
code in the nvme_create_{cq,sq} functions. Also, allow PRP1 to be
address 0x0.
Also replace the Completion Queue Invalid status code returned in
nvme_create_cq when the the queue identifier is invalid with the Invalid
Queue Identifier. The Completion Queue Invalid status code is
exclusively for indicating that the completion queue identifer given
when creating a submission queue is invalid.
See NVM Express v1.3d, Section 5.3 ("Create I/O Completion Queue
command") and 5.4("Create I/O Submission Queue command").
Signed-off-by: Gollu Appalanaidu <anaidu.gollu@samsung.com>
Signed-off-by: Klaus Jensen <k.jensen@samsung.com>
Reviewed-by: Keith Busch <kbusch@kernel.org>
---
hw/block/nvme.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/hw/block/nvme.c b/hw/block/nvme.c
index 2896bb49b9c0..5dfef0204c2c 100644
--- a/hw/block/nvme.c
+++ b/hw/block/nvme.c
@@ -1151,9 +1151,9 @@ static uint16_t nvme_create_sq(NvmeCtrl *n, NvmeRequest
*req)
trace_pci_nvme_err_invalid_create_sq_size(qsize);
return NVME_MAX_QSIZE_EXCEEDED | NVME_DNR;
}
- if (unlikely(!prp1 || prp1 & (n->page_size - 1))) {
+ if (unlikely(prp1 & (n->page_size - 1))) {
trace_pci_nvme_err_invalid_create_sq_addr(prp1);
- return NVME_INVALID_FIELD | NVME_DNR;
+ return NVME_INVALID_PRP_OFFSET | NVME_DNR;
}
if (unlikely(!(NVME_SQ_FLAGS_PC(qflags)))) {
trace_pci_nvme_err_invalid_create_sq_qflags(NVME_SQ_FLAGS_PC(qflags));
@@ -1400,15 +1400,15 @@ static uint16_t nvme_create_cq(NvmeCtrl *n, NvmeRequest
*req)
if (unlikely(!cqid || !nvme_check_cqid(n, cqid))) {
trace_pci_nvme_err_invalid_create_cq_cqid(cqid);
- return NVME_INVALID_CQID | NVME_DNR;
+ return NVME_INVALID_QID | NVME_DNR;
}
if (unlikely(!qsize || qsize > NVME_CAP_MQES(n->bar.cap))) {
trace_pci_nvme_err_invalid_create_cq_size(qsize);
return NVME_MAX_QSIZE_EXCEEDED | NVME_DNR;
}
- if (unlikely(!prp1)) {
+ if (unlikely(prp1 & (n->page_size - 1))) {
trace_pci_nvme_err_invalid_create_cq_addr(prp1);
- return NVME_INVALID_FIELD | NVME_DNR;
+ return NVME_INVALID_PRP_OFFSET | NVME_DNR;
}
if (unlikely(!msix_enabled(&n->parent_obj) && vector)) {
trace_pci_nvme_err_invalid_create_cq_vector(vector);
--
2.29.1
- [PULL 15/30] hw/block/nvme: support multiple namespaces, (continued)
- [PULL 15/30] hw/block/nvme: support multiple namespaces, Klaus Jensen, 2020/10/27
- [PULL 18/30] hw/block/nvme: update nsid when registered, Klaus Jensen, 2020/10/27
- [PULL 17/30] hw/block/nvme: change controller pci id, Klaus Jensen, 2020/10/27
- [PULL 19/30] hw/block/nvme: remove pointless rw indirection, Klaus Jensen, 2020/10/27
- [PULL 21/30] hw/block/nvme: support per-namespace smart log, Klaus Jensen, 2020/10/27
- [PULL 20/30] hw/block/nvme: fix log page offset check, Klaus Jensen, 2020/10/27
- [PULL 23/30] hw/block/nvme: support for admin-only command set, Klaus Jensen, 2020/10/27
- [PULL 26/30] hw/block/nvme: add trace event for requests with non-zero status code, Klaus Jensen, 2020/10/27
- [PULL 24/30] hw/block/nvme: reject io commands if only admin command set selected, Klaus Jensen, 2020/10/27
- [PULL 28/30] hw/block/nvme: fix prp mapping status codes, Klaus Jensen, 2020/10/27
- [PULL 29/30] hw/block/nvme: fix create IO SQ/CQ status codes,
Klaus Jensen <=
- [PULL 27/30] hw/block/nvme: report actual LBA data shift in LBAF, Klaus Jensen, 2020/10/27
- [PULL 22/30] hw/block/nvme: validate command set selected, Klaus Jensen, 2020/10/27
- [PULL 25/30] hw/block/nvme: add nsid to get/setfeat trace events, Klaus Jensen, 2020/10/27
- [PULL 30/30] hw/block/nvme: fix queue identifer validation, Klaus Jensen, 2020/10/27
- Re: [PULL 00/30] nvme emulation patches for 5.2, Peter Maydell, 2020/10/29