hw/block/nvme: support for multi-controller in subsystem
commite36a261d4bf7057a8ffee336422210b58c661a21
authorMinwoo Im <minwoo.im.dev@gmail.com>
Sun, 24 Jan 2021 02:54:48 +0000 (24 11:54 +0900)
committerKlaus Jensen <k.jensen@samsung.com>
Tue, 9 Mar 2021 10:00:57 +0000 (9 11:00 +0100)
treeb8e0a7456bb34c932ddcbad4801540e835d5304a
parent66b7e9bed0aee4342aa7cb824b8c46a42cacf7e2
hw/block/nvme: support for multi-controller in subsystem

We have nvme-subsys and nvme devices mapped together.  To support
multi-controller scheme to this setup, controller identifier(id) has to
be managed.  Earlier, cntlid(controller id) used to be always 0 because
we didn't have any subsystem scheme that controller id matters.

This patch introduced 'cntlid' attribute to the nvme controller
instance(NvmeCtrl) and make it allocated by the nvme-subsys device
mapped to the controller.  If nvme-subsys is not given to the
controller, then it will always be 0 as it was.

Added 'ctrls' array in the nvme-subsys instance to manage attached
controllers to the subsystem with a limit(32).  This patch didn't take
list for the controllers to make it seamless with nvme-ns device.

Signed-off-by: Minwoo Im <minwoo.im.dev@gmail.com>
Tested-by: Klaus Jensen <k.jensen@samsung.com>
Reviewed-by: Klaus Jensen <k.jensen@samsung.com>
Reviewed-by: Keith Busch <kbusch@kernel.org>
Signed-off-by: Klaus Jensen <k.jensen@samsung.com>
hw/block/nvme-subsys.c
hw/block/nvme-subsys.h
hw/block/nvme.c
hw/block/nvme.h