Skip to content

Commit

Permalink
hw/ppc/spapr_vio: Realize SPAPR_VIO_BRIDGE device before accessing it
Browse files Browse the repository at this point in the history
qbus_new() should not be called on unrealized device.

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Cédric Le Goater <clg@kaod.org>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Message-Id: <20231019131647.19690-2-philmd@linaro.org>
  • Loading branch information
philmd committed Oct 19, 2023
1 parent 0459c14 commit 880e260
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion hw/ppc/spapr_vio.c
Original file line number Diff line number Diff line change
Expand Up @@ -574,13 +574,14 @@ SpaprVioBus *spapr_vio_bus_init(void)

/* Create bridge device */
dev = qdev_new(TYPE_SPAPR_VIO_BRIDGE);
sysbus_realize_and_unref(SYS_BUS_DEVICE(dev), &error_fatal);

/* Create bus on bridge device */
qbus = qbus_new(TYPE_SPAPR_VIO_BUS, dev, "spapr-vio");
bus = SPAPR_VIO_BUS(qbus);
bus->next_reg = SPAPR_VIO_REG_BASE;

sysbus_realize_and_unref(SYS_BUS_DEVICE(dev), &error_fatal);

/* hcall-vio */
spapr_register_hypercall(H_VIO_SIGNAL, h_vio_signal);

Expand Down

0 comments on commit 880e260

Please sign in to comment.