On Jan 24 11:54, Minwoo Im wrote: > To support multi-path in QEMU NVMe device model, We need to have NVMe > subsystem hierarchy to map controllers and namespaces to a NVMe > subsystem. > > This patch introduced a simple nvme-subsys device model. The subsystem > will be prepared with subsystem NQN with provided in > nvme-subsys device: > > ex) -device nvme-subsys,id=subsys0: nqn.2019-08.org.qemu:subsys0 > > Signed-off-by: Minwoo Im > --- > hw/block/meson.build | 2 +- > hw/block/nvme-subsys.c | 60 ++++++++++++++++++++++++++++++++++++++++++ > hw/block/nvme-subsys.h | 25 ++++++++++++++++++ > hw/block/nvme.c | 3 +++ > 4 files changed, 89 insertions(+), 1 deletion(-) > create mode 100644 hw/block/nvme-subsys.c > create mode 100644 hw/block/nvme-subsys.h > > diff --git a/hw/block/meson.build b/hw/block/meson.build > index 602ca6c8541d..83ea2d37978d 100644 > --- a/hw/block/meson.build > +++ b/hw/block/meson.build > @@ -13,7 +13,7 @@ softmmu_ss.add(when: 'CONFIG_SSI_M25P80', if_true: files('m25p80.c')) > softmmu_ss.add(when: 'CONFIG_SWIM', if_true: files('swim.c')) > softmmu_ss.add(when: 'CONFIG_XEN', if_true: files('xen-block.c')) > softmmu_ss.add(when: 'CONFIG_SH4', if_true: files('tc58128.c')) > -softmmu_ss.add(when: 'CONFIG_NVME_PCI', if_true: files('nvme.c', 'nvme-ns.c')) > +softmmu_ss.add(when: 'CONFIG_NVME_PCI', if_true: files('nvme.c', 'nvme-ns.c', 'nvme-subsys.c')) > > specific_ss.add(when: 'CONFIG_VIRTIO_BLK', if_true: files('virtio-blk.c')) > specific_ss.add(when: 'CONFIG_VHOST_USER_BLK', if_true: files('vhost-user-blk.c')) > diff --git a/hw/block/nvme-subsys.c b/hw/block/nvme-subsys.c > new file mode 100644 > index 000000000000..aa82911b951c > --- /dev/null > +++ b/hw/block/nvme-subsys.c > @@ -0,0 +1,60 @@ > +/* > + * QEMU NVM Express Subsystem: nvme-subsys > + * > + * Copyright (c) 2021 Minwoo Im > + * > + * This code is licensed under the GNU GPL v2. Refer COPYING. > + */ > + > +#include "qemu/units.h" > +#include "qemu/osdep.h" > +#include "qemu/uuid.h" > +#include "qemu/iov.h" > +#include "qemu/cutils.h" > +#include "qapi/error.h" > +#include "hw/qdev-properties.h" > +#include "hw/qdev-core.h" > +#include "hw/block/block.h" > +#include "block/aio.h" > +#include "block/accounting.h" > +#include "sysemu/sysemu.h" > +#include "hw/pci/pci.h" > +#include "nvme.h" > +#include "nvme-subsys.h" > + This can be slimmed down to #include "qemu/osdep.h" #include "qapi/error.h" #include "hw/block/block.h" #include "sysemu/sysemu.h" #include "hw/pci/pci.h" #include "nvme.h" #include "nvme-subsys.h"