aboutsummaryrefslogtreecommitdiff
path: root/hw/intc/pnv_xive.c
diff options
context:
space:
mode:
authorGreg Kurz <groug@kaod.org>2019-11-15 16:56:05 +0100
committerDavid Gibson <david@gibson.dropbear.id.au>2019-12-17 10:39:47 +1100
commit7ae54cc3a00d28cfb0bc4f377faf157b2e55b25c (patch)
tree75e61e459df413a5ebf0b99b03b2d51e963bc805 /hw/intc/pnv_xive.c
parent158e17a65e1ad0f2bd1e300c2f30f9481901a485 (diff)
downloadqemu-7ae54cc3a00d28cfb0bc4f377faf157b2e55b25c.zip
qemu-7ae54cc3a00d28cfb0bc4f377faf157b2e55b25c.tar.gz
qemu-7ae54cc3a00d28cfb0bc4f377faf157b2e55b25c.tar.bz2
ppc/pnv: Link "chip" property to PnvXive::chip pointer
The XIVE object has both a pointer and a "chip" property pointing to the chip object. Confusing bugs could arise if these ever go out of sync. Change the property definition so that it explicitely sets the pointer. Signed-off-by: Greg Kurz <groug@kaod.org> Message-Id: <157383336564.165747.10250365296928442882.stgit@bahia.lan> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Diffstat (limited to 'hw/intc/pnv_xive.c')
-rw-r--r--hw/intc/pnv_xive.c13
1 files changed, 3 insertions, 10 deletions
diff --git a/hw/intc/pnv_xive.c b/hw/intc/pnv_xive.c
index 6aa7aee..4e56c2e 100644
--- a/hw/intc/pnv_xive.c
+++ b/hw/intc/pnv_xive.c
@@ -1675,17 +1675,8 @@ static void pnv_xive_realize(DeviceState *dev, Error **errp)
XiveSource *xsrc = &xive->ipi_source;
XiveENDSource *end_xsrc = &xive->end_source;
Error *local_err = NULL;
- Object *obj;
- obj = object_property_get_link(OBJECT(dev), "chip", &local_err);
- if (!obj) {
- error_propagate(errp, local_err);
- error_prepend(errp, "required link 'chip' not found: ");
- return;
- }
-
- /* The PnvChip id identifies the XIVE interrupt controller. */
- xive->chip = PNV_CHIP(obj);
+ assert(xive->chip);
/*
* The XiveSource and XiveENDSource objects are realized with the
@@ -1800,6 +1791,8 @@ static Property pnv_xive_properties[] = {
DEFINE_PROP_UINT64("vc-bar", PnvXive, vc_base, 0),
DEFINE_PROP_UINT64("pc-bar", PnvXive, pc_base, 0),
DEFINE_PROP_UINT64("tm-bar", PnvXive, tm_base, 0),
+ /* The PnvChip id identifies the XIVE interrupt controller. */
+ DEFINE_PROP_LINK("chip", PnvXive, chip, TYPE_PNV_CHIP, PnvChip *),
DEFINE_PROP_END_OF_LIST(),
};