From: Klaus Jensen <its@irrelevant.dk>
To: qemu-devel@nongnu.org, qemu-block@nongnu.org
Cc: "Kevin Wolf" <kwolf@redhat.com>, "Fam Zheng" <fam@euphon.net>,
"Klaus Jensen" <k.jensen@samsung.com>,
"Keith Busch" <kbusch@kernel.org>,
"Hanna Reitz" <hreitz@redhat.com>,
"Stefan Hajnoczi" <stefanha@redhat.com>,
"Klaus Jensen" <its@irrelevant.dk>,
"Philippe Mathieu-Daudé" <philmd@redhat.com>
Subject: [PATCH for-7.0 1/4] hw/nvme: add struct for zone management send
Date: Thu, 25 Nov 2021 08:37:32 +0100 [thread overview]
Message-ID: <20211125073735.248403-2-its@irrelevant.dk> (raw)
In-Reply-To: <20211125073735.248403-1-its@irrelevant.dk>
From: Klaus Jensen <k.jensen@samsung.com>
Add struct for Zone Management Send in preparation for more zone send
flags.
Signed-off-by: Klaus Jensen <k.jensen@samsung.com>
---
hw/nvme/ctrl.c | 10 ++++------
include/block/nvme.h | 18 ++++++++++++++++++
2 files changed, 22 insertions(+), 6 deletions(-)
diff --git a/hw/nvme/ctrl.c b/hw/nvme/ctrl.c
index 5f573c417b3d..489d586ab9d7 100644
--- a/hw/nvme/ctrl.c
+++ b/hw/nvme/ctrl.c
@@ -3593,26 +3593,24 @@ done:
static uint16_t nvme_zone_mgmt_send(NvmeCtrl *n, NvmeRequest *req)
{
- NvmeCmd *cmd = (NvmeCmd *)&req->cmd;
+ NvmeZoneSendCmd *cmd = (NvmeZoneSendCmd *)&req->cmd;
NvmeNamespace *ns = req->ns;
NvmeZone *zone;
NvmeZoneResetAIOCB *iocb;
uint8_t *zd_ext;
- uint32_t dw13 = le32_to_cpu(cmd->cdw13);
uint64_t slba = 0;
uint32_t zone_idx = 0;
uint16_t status;
- uint8_t action;
+ uint8_t action = cmd->zsa;
bool all;
enum NvmeZoneProcessingMask proc_mask = NVME_PROC_CURRENT_ZONE;
- action = dw13 & 0xff;
- all = !!(dw13 & 0x100);
+ all = cmd->zsflags[0] & NVME_ZSFLAG_SELECT_ALL;
req->status = NVME_SUCCESS;
if (!all) {
- status = nvme_get_mgmt_zone_slba_idx(ns, cmd, &slba, &zone_idx);
+ status = nvme_get_mgmt_zone_slba_idx(ns, &req->cmd, &slba, &zone_idx);
if (status) {
return status;
}
diff --git a/include/block/nvme.h b/include/block/nvme.h
index e3bd47bf76ab..2ee227760265 100644
--- a/include/block/nvme.h
+++ b/include/block/nvme.h
@@ -1433,6 +1433,20 @@ enum NvmeZoneType {
NVME_ZONE_TYPE_SEQ_WRITE = 0x02,
};
+typedef struct QEMU_PACKED NvmeZoneSendCmd {
+ uint8_t opcode;
+ uint8_t flags;
+ uint16_t cid;
+ uint32_t nsid;
+ uint32_t rsvd2[4];
+ NvmeCmdDptr dptr;
+ uint64_t slba;
+ uint32_t rsvd12;
+ uint8_t zsa;
+ uint8_t zsflags[3];
+ uint32_t rsvd14[2];
+} NvmeZoneSendCmd;
+
enum NvmeZoneSendAction {
NVME_ZONE_ACTION_RSD = 0x00,
NVME_ZONE_ACTION_CLOSE = 0x01,
@@ -1443,6 +1457,10 @@ enum NvmeZoneSendAction {
NVME_ZONE_ACTION_SET_ZD_EXT = 0x10,
};
+enum {
+ NVME_ZSFLAG_SELECT_ALL = 1 << 0,
+};
+
typedef struct QEMU_PACKED NvmeZoneDescr {
uint8_t zt;
uint8_t zs;
--
2.34.0
next prev parent reply other threads:[~2021-11-25 7:44 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-11-25 7:37 [PATCH for-7.0 0/4] hw/nvme: zoned random write area Klaus Jensen
2021-11-25 7:37 ` Klaus Jensen [this message]
2022-01-26 17:00 ` [PATCH for-7.0 1/4] hw/nvme: add struct for zone management send Keith Busch
2021-11-25 7:37 ` [PATCH for-7.0 2/4] hw/nvme: add zone attribute get/set helpers Klaus Jensen
2022-01-26 17:05 ` Keith Busch
2021-11-25 7:37 ` [PATCH for-7.0 3/4] hw/nvme: add ozcs enum Klaus Jensen
2022-01-26 17:06 ` Keith Busch
2021-11-25 7:37 ` [PATCH for-7.0 4/4] hw/nvme: add support for zoned random write area Klaus Jensen
2022-01-26 17:09 ` Keith Busch
2022-01-26 8:58 ` [PATCH for-7.0 0/4] hw/nvme: " Klaus Jensen
2022-01-26 13:15 ` Stefan Hajnoczi
2022-01-26 13:44 ` Klaus Jensen
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=20211125073735.248403-2-its@irrelevant.dk \
--to=its@irrelevant.dk \
--cc=fam@euphon.net \
--cc=hreitz@redhat.com \
--cc=k.jensen@samsung.com \
--cc=kbusch@kernel.org \
--cc=kwolf@redhat.com \
--cc=philmd@redhat.com \
--cc=qemu-block@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=stefanha@redhat.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.