[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v11 07/13] hw/block/nvme: Support allocated CNS command variants
From: |
Dmitry Fomichev |
Subject: |
[PATCH v11 07/13] hw/block/nvme: Support allocated CNS command variants |
Date: |
Wed, 9 Dec 2020 05:04:04 +0900 |
From: Niklas Cassel <niklas.cassel@wdc.com>
Many CNS commands have "allocated" command variants. These include
a namespace as long as it is allocated, that is a namespace is
included regardless if it is active (attached) or not.
While these commands are optional (they are mandatory for controllers
supporting the namespace attachment command), our QEMU implementation
is more complete by actually providing support for these CNS values.
However, since our QEMU model currently does not support the namespace
attachment command, these new allocated CNS commands will return the
same result as the active CNS command variants.
The reason for not hooking up this command completely is because the
NVMe specification requires the namespace management command to be
supported if the namespace attachment command is supported.
Signed-off-by: Niklas Cassel <niklas.cassel@wdc.com>
Signed-off-by: Dmitry Fomichev <dmitry.fomichev@wdc.com>
Reviewed-by: Keith Busch <kbusch@kernel.org>
---
include/block/nvme.h | 20 ++++++++++++--------
hw/block/nvme.c | 8 ++++++++
2 files changed, 20 insertions(+), 8 deletions(-)
diff --git a/include/block/nvme.h b/include/block/nvme.h
index 890977db4b..29d826ab19 100644
--- a/include/block/nvme.h
+++ b/include/block/nvme.h
@@ -807,14 +807,18 @@ typedef struct QEMU_PACKED NvmePSD {
#define NVME_IDENTIFY_DATA_SIZE 4096
enum NvmeIdCns {
- NVME_ID_CNS_NS = 0x00,
- NVME_ID_CNS_CTRL = 0x01,
- NVME_ID_CNS_NS_ACTIVE_LIST = 0x02,
- NVME_ID_CNS_NS_DESCR_LIST = 0x03,
- NVME_ID_CNS_CS_NS = 0x05,
- NVME_ID_CNS_CS_CTRL = 0x06,
- NVME_ID_CNS_CS_NS_ACTIVE_LIST = 0x07,
- NVME_ID_CNS_IO_COMMAND_SET = 0x1c,
+ NVME_ID_CNS_NS = 0x00,
+ NVME_ID_CNS_CTRL = 0x01,
+ NVME_ID_CNS_NS_ACTIVE_LIST = 0x02,
+ NVME_ID_CNS_NS_DESCR_LIST = 0x03,
+ NVME_ID_CNS_CS_NS = 0x05,
+ NVME_ID_CNS_CS_CTRL = 0x06,
+ NVME_ID_CNS_CS_NS_ACTIVE_LIST = 0x07,
+ NVME_ID_CNS_NS_PRESENT_LIST = 0x10,
+ NVME_ID_CNS_NS_PRESENT = 0x11,
+ NVME_ID_CNS_CS_NS_PRESENT_LIST = 0x1a,
+ NVME_ID_CNS_CS_NS_PRESENT = 0x1b,
+ NVME_ID_CNS_IO_COMMAND_SET = 0x1c,
};
typedef struct QEMU_PACKED NvmeIdCtrl {
diff --git a/hw/block/nvme.c b/hw/block/nvme.c
index 16eed37533..7035896649 100644
--- a/hw/block/nvme.c
+++ b/hw/block/nvme.c
@@ -1901,16 +1901,24 @@ static uint16_t nvme_identify(NvmeCtrl *n, NvmeRequest
*req)
switch (le32_to_cpu(c->cns)) {
case NVME_ID_CNS_NS:
+ /* fall through */
+ case NVME_ID_CNS_NS_PRESENT:
return nvme_identify_ns(n, req);
case NVME_ID_CNS_CS_NS:
+ /* fall through */
+ case NVME_ID_CNS_CS_NS_PRESENT:
return nvme_identify_ns_csi(n, req);
case NVME_ID_CNS_CTRL:
return nvme_identify_ctrl(n, req);
case NVME_ID_CNS_CS_CTRL:
return nvme_identify_ctrl_csi(n, req);
case NVME_ID_CNS_NS_ACTIVE_LIST:
+ /* fall through */
+ case NVME_ID_CNS_NS_PRESENT_LIST:
return nvme_identify_nslist(n, req);
case NVME_ID_CNS_CS_NS_ACTIVE_LIST:
+ /* fall through */
+ case NVME_ID_CNS_CS_NS_PRESENT_LIST:
return nvme_identify_nslist_csi(n, req);
case NVME_ID_CNS_NS_DESCR_LIST:
return nvme_identify_ns_descr_list(n, req);
--
2.28.0
- [PATCH v11 00/13] hw/block/nvme: Support Namespace Types and Zoned Namespace Command Set, Dmitry Fomichev, 2020/12/08
- [PATCH v11 02/13] hw/block/nvme: Generate namespace UUIDs, Dmitry Fomichev, 2020/12/08
- [PATCH v11 01/13] hw/block/nvme: Process controller reset and shutdown differently, Dmitry Fomichev, 2020/12/08
- [PATCH v11 03/13] hw/block/nvme: Separate read and write handlers, Dmitry Fomichev, 2020/12/08
- [PATCH v11 04/13] hw/block/nvme: Combine nvme_write_zeroes() and nvme_write(), Dmitry Fomichev, 2020/12/08
- [PATCH v11 05/13] hw/block/nvme: Add Commands Supported and Effects log, Dmitry Fomichev, 2020/12/08
- [PATCH v11 07/13] hw/block/nvme: Support allocated CNS command variants,
Dmitry Fomichev <=
- [PATCH v11 08/13] block/nvme: Make ZNS-related definitions, Dmitry Fomichev, 2020/12/08
- [PATCH v11 06/13] hw/block/nvme: Add support for Namespace Types, Dmitry Fomichev, 2020/12/08
- [PATCH v11 09/13] hw/block/nvme: Support Zoned Namespace Command Set, Dmitry Fomichev, 2020/12/08
- [PATCH v11 10/13] hw/block/nvme: Introduce max active and open zone limits, Dmitry Fomichev, 2020/12/08
- [PATCH v11 11/13] hw/block/nvme: Support Zone Descriptor Extensions, Dmitry Fomichev, 2020/12/08
- [PATCH v11 12/13] hw/block/nvme: Add injection of Offline/Read-Only zones, Dmitry Fomichev, 2020/12/08
- [PATCH v11 13/13] hw/block/nvme: Document zoned parameters in usage text, Dmitry Fomichev, 2020/12/08
- Re: [PATCH v11 00/13] hw/block/nvme: Support Namespace Types and Zoned Namespace Command Set, Klaus Jensen, 2020/12/09