Message ID | 20220627114731.356462-3-niklas.cassel@wdc.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | hw/nvme: add support for TP4084 | expand |
On Jun 27 13:47, Niklas Cassel wrote: > Each NvmeNamespace can be used by serveral controllers, > but a NvmeNamespace can at most belong to a single NvmeSubsystem. > Store a pointer to the NvmeSubsystem, if the namespace was realized > with a NvmeSubsystem. > > This will be used by a follow up patch. > > Signed-off-by: Niklas Cassel <niklas.cassel@wdc.com> > --- > hw/nvme/ns.c | 1 + > hw/nvme/nvme.h | 1 + > 2 files changed, 2 insertions(+) > > diff --git a/hw/nvme/ns.c b/hw/nvme/ns.c > index 870c3ca1a2..8bee3e8b3b 100644 > --- a/hw/nvme/ns.c > +++ b/hw/nvme/ns.c > @@ -559,6 +559,7 @@ static void nvme_ns_realize(DeviceState *dev, Error **errp) > if (!qdev_set_parent_bus(dev, &subsys->bus.parent_bus, errp)) { > return; > } > + ns->subsys = subsys; > } > > if (nvme_ns_setup(ns, errp)) { > diff --git a/hw/nvme/nvme.h b/hw/nvme/nvme.h > index 0711b9748c..5487e2db40 100644 > --- a/hw/nvme/nvme.h > +++ b/hw/nvme/nvme.h > @@ -167,6 +167,7 @@ typedef struct NvmeNamespace { > int32_t nr_active_zones; > > NvmeNamespaceParams params; > + NvmeSubsystem *subsys; > > struct { > uint32_t err_rec; > -- > 2.36.1 > No problemo. Reviewed-by: Klaus Jensen <k.jensen@samsung.com>
diff --git a/hw/nvme/ns.c b/hw/nvme/ns.c index 870c3ca1a2..8bee3e8b3b 100644 --- a/hw/nvme/ns.c +++ b/hw/nvme/ns.c @@ -559,6 +559,7 @@ static void nvme_ns_realize(DeviceState *dev, Error **errp) if (!qdev_set_parent_bus(dev, &subsys->bus.parent_bus, errp)) { return; } + ns->subsys = subsys; } if (nvme_ns_setup(ns, errp)) { diff --git a/hw/nvme/nvme.h b/hw/nvme/nvme.h index 0711b9748c..5487e2db40 100644 --- a/hw/nvme/nvme.h +++ b/hw/nvme/nvme.h @@ -167,6 +167,7 @@ typedef struct NvmeNamespace { int32_t nr_active_zones; NvmeNamespaceParams params; + NvmeSubsystem *subsys; struct { uint32_t err_rec;
Each NvmeNamespace can be used by serveral controllers, but a NvmeNamespace can at most belong to a single NvmeSubsystem. Store a pointer to the NvmeSubsystem, if the namespace was realized with a NvmeSubsystem. This will be used by a follow up patch. Signed-off-by: Niklas Cassel <niklas.cassel@wdc.com> --- hw/nvme/ns.c | 1 + hw/nvme/nvme.h | 1 + 2 files changed, 2 insertions(+)