]> www.infradead.org Git - qemu-nvme.git/commit
hw/block/nvme: Add support for active/inactive namespaces
authorNiklas Cassel <niklas.cassel@wdc.com>
Mon, 28 Sep 2020 02:35:20 +0000 (11:35 +0900)
committerKeith Busch <kbusch@kernel.org>
Wed, 30 Sep 2020 21:28:27 +0000 (14:28 -0700)
commitab3909bf2cb1147c368e48fdd6b557eb48ca62b7
tree99d51a73b884cda1c58aa310d84692589a908aec
parent45157cab2e700155b05f0bd28533f73d7e399ab8
hw/block/nvme: Add support for active/inactive namespaces

In NVMe, a namespace is active if it exists and is attached to the
controller.

CAP.CSS (together with the I/O Command Set data structure) defines what
command sets are supported by the controller.

CC.CSS (together with Set Profile) can be set to enable a subset of the
available command sets. The namespaces belonging to a disabled command set
will not be able to attach to the controller, and will thus be inactive.

E.g., if the user sets CC.CSS to Admin Only, NVM namespaces should be
marked as inactive.

The identify namespace, the identify namespace CSI specific, and the namespace
list commands have two different versions, one that only shows active
namespaces, and the other version that shows existing namespaces, regardless
of whether the namespace is attached or not.

Add an attached member to struct NvmeNamespace, and implement the missing CNS
commands.

The added functionality will also simplify the implementation of namespace
management in the future, since namespace management can also attach and
detach namespaces.

Signed-off-by: Niklas Cassel <niklas.cassel@wdc.com>
Signed-off-by: Dmitry Fomichev <dmitry.fomichev@wdc.com>
Signed-off-by: Keith Busch <kbusch@kernel.org>
hw/block/nvme-ns.h
hw/block/nvme.c
include/block/nvme.h