aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNiklas Cassel <niklas.cassel@wdc.com>2023-02-20 12:59:23 +0100
committerKlaus Jensen <k.jensen@samsung.com>2023-03-06 15:28:02 +0100
commit534a93d3a0bbde4248889ece1e0874ab98a96508 (patch)
tree6bad47db9af43fd69f2b9fd488b714636d829d8b
parenta555af1707be7f564320cbb444ef68448ff16549 (diff)
hw/nvme: store a pointer to the NvmeSubsystem in the NvmeNamespace
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. Reviewed-by: Keith Busch <kbusch@kernel.org> Signed-off-by: Niklas Cassel <niklas.cassel@wdc.com> Signed-off-by: Klaus Jensen <k.jensen@samsung.com>
-rw-r--r--hw/nvme/ns.c1
-rw-r--r--hw/nvme/nvme.h1
2 files changed, 2 insertions, 0 deletions
diff --git a/hw/nvme/ns.c b/hw/nvme/ns.c
index 62a1f97be0..8ebab4fbce 100644
--- a/hw/nvme/ns.c
+++ b/hw/nvme/ns.c
@@ -561,6 +561,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 16da27a69b..5d221073ac 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;