hw/block/nvme: support namespace attachment command
commit645ce1a70cb6bedc85a11edb547db091375dea55
authorMinwoo Im <minwoo.im.dev@gmail.com>
Sat, 6 Feb 2021 03:18:09 +0000 (6 12:18 +0900)
committerKlaus Jensen <k.jensen@samsung.com>
Tue, 9 Mar 2021 10:00:58 +0000 (9 11:00 +0100)
tree6a2898d77628f7b1d4aabd419f3d8fb397c1eb1c
parent1f46660788542ae7f86e18bc4de14bc4b642423d
hw/block/nvme: support namespace attachment command

This patch supports Namespace Attachment command for the pre-defined
nvme-ns device nodes.  Of course, attach/detach namespace should only be
supported in case 'subsys' is given.  This is because if we detach a
namespace from a controller, somebody needs to manage the detached, but
allocated namespace in the NVMe subsystem.

As command effect for the namespace attachment command is registered,
the host will be notified that namespace inventory is changed so that
host will rescan the namespace inventory after this command.  For
example, kernel driver manages this command effect via passthru IOCTL.

Signed-off-by: Minwoo Im <minwoo.im.dev@gmail.com>
Reviewed-by: Keith Busch <kbusch@kernel.org>
Reviewed-by: Klaus Jensen <k.jensen@samsung.com>
Tested-by: Klaus Jensen <k.jensen@samsung.com>
[k.jensen: rebased for dma refactor]
Signed-off-by: Klaus Jensen <k.jensen@samsung.com>
hw/block/nvme-subsys.h
hw/block/nvme.c
hw/block/nvme.h
hw/block/trace-events
include/block/nvme.h