diff options
author | Minwoo Im <minwoo.im.dev@gmail.com> | 2021-02-06 12:18:09 +0900 |
---|---|---|
committer | Klaus Jensen <k.jensen@samsung.com> | 2021-03-09 11:00:58 +0100 |
commit | 645ce1a70cb6bedc85a11edb547db091375dea55 (patch) | |
tree | 6a2898d77628f7b1d4aabd419f3d8fb397c1eb1c /hw/block/nvme-subsys.h | |
parent | 1f46660788542ae7f86e18bc4de14bc4b642423d (diff) | |
download | qemu-645ce1a70cb6bedc85a11edb547db091375dea55.zip qemu-645ce1a70cb6bedc85a11edb547db091375dea55.tar.gz qemu-645ce1a70cb6bedc85a11edb547db091375dea55.tar.bz2 |
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>
Diffstat (limited to 'hw/block/nvme-subsys.h')
-rw-r--r-- | hw/block/nvme-subsys.h | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/hw/block/nvme-subsys.h b/hw/block/nvme-subsys.h index 83a6427..fb66ae7 100644 --- a/hw/block/nvme-subsys.h +++ b/hw/block/nvme-subsys.h @@ -34,6 +34,16 @@ typedef struct NvmeSubsystem { int nvme_subsys_register_ctrl(NvmeCtrl *n, Error **errp); int nvme_subsys_register_ns(NvmeNamespace *ns, Error **errp); +static inline NvmeCtrl *nvme_subsys_ctrl(NvmeSubsystem *subsys, + uint32_t cntlid) +{ + if (!subsys) { + return NULL; + } + + return subsys->ctrls[cntlid]; +} + /* * Return allocated namespace of the specified nsid in the subsystem. */ |