From: Dmitry Fomichev <dmitry.fomichev@wdc.com>
To: "Keith Busch" <kbusch@kernel.org>,
"Klaus Jensen" <k.jensen@samsung.com>,
"Kevin Wolf" <kwolf@redhat.com>,
"Philippe Mathieu-Daudé" <philmd@redhat.com>,
"Maxim Levitsky" <mlevitsky@redhat.com>,
"Fam Zheng" <fam@euphon.net>
Cc: Niklas Cassel <niklas.cassel@wdc.com>,
Damien Le Moal <damien.lemoal@wdc.com>,
qemu-block@nongnu.org, Dmitry Fomichev <dmitry.fomichev@wdc.com>,
qemu-devel@nongnu.org,
Alistair Francis <alistair.francis@wdc.com>,
Matias Bjorling <matias.bjorling@wdc.com>
Subject: [PATCH v2 01/15] hw/block/nvme: Define 64 bit cqe.result
Date: Sun, 13 Sep 2020 07:54:16 +0900 [thread overview]
Message-ID: <20200912225430.1772-2-dmitry.fomichev@wdc.com> (raw)
In-Reply-To: <20200912225430.1772-1-dmitry.fomichev@wdc.com>
From: Ajay Joshi <ajay.joshi@wdc.com>
A new write command, Zone Append, is added as a part of Zoned
Namespace Command Set. Upon successful completion of this command,
the controller returns the start LBA of the performed write operation
in cqe.result field. Therefore, the maximum size of this variable
needs to be changed from 32 to 64 bit, consuming the reserved 32 bit
field that follows the result in CQE struct. Since the existing
commands are expected to return a 32 bit LE value, two separate
variables, result32 and result64, are now kept in a union.
Signed-off-by: Ajay Joshi <ajay.joshi@wdc.com>
Signed-off-by: Dmitry Fomichev <dmitry.fomichev@wdc.com>
Reviewed-by: Klaus Jensen <k.jensen@samsung.com>
---
block/nvme.c | 2 +-
block/trace-events | 2 +-
hw/block/nvme.c | 10 +++++-----
include/block/nvme.h | 6 ++++--
4 files changed, 11 insertions(+), 9 deletions(-)
diff --git a/block/nvme.c b/block/nvme.c
index 05485fdd11..45e1a5dcd1 100644
--- a/block/nvme.c
+++ b/block/nvme.c
@@ -333,7 +333,7 @@ static inline int nvme_translate_error(const NvmeCqe *c)
{
uint16_t status = (le16_to_cpu(c->status) >> 1) & 0xFF;
if (status) {
- trace_nvme_error(le32_to_cpu(c->result),
+ trace_nvme_error(le64_to_cpu(c->result64),
le16_to_cpu(c->sq_head),
le16_to_cpu(c->sq_id),
le16_to_cpu(c->cid),
diff --git a/block/trace-events b/block/trace-events
index e1c79a910d..55c54a18c3 100644
--- a/block/trace-events
+++ b/block/trace-events
@@ -139,7 +139,7 @@ qed_aio_write_main(void *s, void *acb, int ret, uint64_t offset, size_t len) "s
# nvme.c
nvme_kick(void *s, int queue) "s %p queue %d"
nvme_dma_flush_queue_wait(void *s) "s %p"
-nvme_error(int cmd_specific, int sq_head, int sqid, int cid, int status) "cmd_specific %d sq_head %d sqid %d cid %d status 0x%x"
+nvme_error(uint64_t cmd_specific, int sq_head, int sqid, int cid, int status) "cmd_specific %ld sq_head %d sqid %d cid %d status 0x%x"
nvme_process_completion(void *s, int index, int inflight) "s %p queue %d inflight %d"
nvme_process_completion_queue_plugged(void *s, int index) "s %p queue %d"
nvme_complete_command(void *s, int index, int cid) "s %p queue %d cid %d"
diff --git a/hw/block/nvme.c b/hw/block/nvme.c
index 63078f6009..3a90d80694 100644
--- a/hw/block/nvme.c
+++ b/hw/block/nvme.c
@@ -524,7 +524,7 @@ static void nvme_process_aers(void *opaque)
req = n->aer_reqs[n->outstanding_aers];
- result = (NvmeAerResult *) &req->cqe.result;
+ result = (NvmeAerResult *) &req->cqe.result32;
result->event_type = event->result.event_type;
result->event_info = event->result.event_info;
result->log_page = event->result.log_page;
@@ -1247,7 +1247,7 @@ static uint16_t nvme_abort(NvmeCtrl *n, NvmeRequest *req)
{
uint16_t sqid = le32_to_cpu(req->cmd.cdw10) & 0xffff;
- req->cqe.result = 1;
+ req->cqe.result32 = 1;
if (nvme_check_sqid(n, sqid)) {
return NVME_INVALID_FIELD | NVME_DNR;
}
@@ -1425,7 +1425,7 @@ defaults:
}
out:
- req->cqe.result = cpu_to_le32(result);
+ req->cqe.result32 = cpu_to_le32(result);
return NVME_SUCCESS;
}
@@ -1534,8 +1534,8 @@ static uint16_t nvme_set_feature(NvmeCtrl *n, NvmeRequest *req)
((dw11 >> 16) & 0xFFFF) + 1,
n->params.max_ioqpairs,
n->params.max_ioqpairs);
- req->cqe.result = cpu_to_le32((n->params.max_ioqpairs - 1) |
- ((n->params.max_ioqpairs - 1) << 16));
+ req->cqe.result32 = cpu_to_le32((n->params.max_ioqpairs - 1) |
+ ((n->params.max_ioqpairs - 1) << 16));
break;
case NVME_ASYNCHRONOUS_EVENT_CONF:
n->features.async_config = dw11;
diff --git a/include/block/nvme.h b/include/block/nvme.h
index 65e68a82c8..ac0ccfcb26 100644
--- a/include/block/nvme.h
+++ b/include/block/nvme.h
@@ -617,8 +617,10 @@ typedef struct QEMU_PACKED NvmeAerResult {
} NvmeAerResult;
typedef struct QEMU_PACKED NvmeCqe {
- uint32_t result;
- uint32_t rsvd;
+ union {
+ uint64_t result64;
+ uint32_t result32;
+ };
uint16_t sq_head;
uint16_t sq_id;
uint16_t cid;
--
2.21.0
next prev parent reply other threads:[~2020-09-12 22:56 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-09-12 22:54 [PATCH v2 00/15] hw/block/nvme: Support Namespace Types and Zoned Namespace Command Set Dmitry Fomichev
2020-09-12 22:54 ` Dmitry Fomichev [this message]
2020-09-12 22:54 ` [PATCH v2 02/15] hw/block/nvme: Report actual LBA data shift in LBAF Dmitry Fomichev
2020-09-12 22:54 ` [PATCH v2 03/15] hw/block/nvme: Add Commands Supported and Effects log Dmitry Fomichev
2020-09-12 22:54 ` [PATCH v2 04/15] hw/block/nvme: Introduce the Namespace Types definitions Dmitry Fomichev
2020-09-12 22:54 ` [PATCH v2 05/15] hw/block/nvme: Define trace events related to NS Types Dmitry Fomichev
2020-09-12 22:54 ` [PATCH v2 06/15] hw/block/nvme: Add support for Namespace Types Dmitry Fomichev
2020-09-12 22:54 ` [PATCH v2 07/15] hw/block/nvme: Add support for active/inactive namespaces Dmitry Fomichev
2020-09-12 22:54 ` [PATCH v2 08/15] hw/block/nvme: Make Zoned NS Command Set definitions Dmitry Fomichev
2020-09-12 22:54 ` [PATCH v2 09/15] hw/block/nvme: Define Zoned NS Command Set trace events Dmitry Fomichev
2020-09-12 22:54 ` [PATCH v2 10/15] hw/block/nvme: Support Zoned Namespace Command Set Dmitry Fomichev
2020-09-12 22:54 ` [PATCH v2 11/15] hw/block/nvme: Introduce max active and open zone limits Dmitry Fomichev
2020-09-12 22:54 ` [PATCH v2 12/15] hw/block/nvme: Support Zone Descriptor Extensions Dmitry Fomichev
2020-09-12 22:54 ` [PATCH v2 13/15] hw/block/nvme: Add injection of Offline/Read-Only zones Dmitry Fomichev
2020-09-12 22:54 ` [PATCH v2 14/15] hw/block/nvme: Use zone metadata file for persistence Dmitry Fomichev
2020-09-12 22:54 ` [PATCH v2 15/15] hw/block/nvme: Document zoned parameters in usage text Dmitry Fomichev
2020-09-12 23:12 ` [PATCH v2 00/15] hw/block/nvme: Support Namespace Types and Zoned Namespace Command Set no-reply
2020-09-15 7:43 ` Klaus Jensen
2020-09-15 18:55 ` Dmitry Fomichev
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200912225430.1772-2-dmitry.fomichev@wdc.com \
--to=dmitry.fomichev@wdc.com \
--cc=alistair.francis@wdc.com \
--cc=damien.lemoal@wdc.com \
--cc=fam@euphon.net \
--cc=k.jensen@samsung.com \
--cc=kbusch@kernel.org \
--cc=kwolf@redhat.com \
--cc=matias.bjorling@wdc.com \
--cc=mlevitsky@redhat.com \
--cc=niklas.cassel@wdc.com \
--cc=philmd@redhat.com \
--cc=qemu-block@nongnu.org \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).