]> Git Repo - qemu.git/commitdiff
ppc/pnv: Link "chip" property to PnvCore::chip pointer
authorGreg Kurz <[email protected]>
Fri, 15 Nov 2019 15:56:00 +0000 (16:56 +0100)
committerDavid Gibson <[email protected]>
Mon, 16 Dec 2019 23:39:47 +0000 (10:39 +1100)
The core 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 <[email protected]>
Message-Id: <157383336007.165747.1524120147081367440[email protected]>
Signed-off-by: David Gibson <[email protected]>
hw/ppc/pnv.c
hw/ppc/pnv_core.c

index 3fa24a2d605a20706fa002445e51d9287bfb9886..2bf8a3b23bcdac43c964e152c8808331cd847b2e 100644 (file)
@@ -1327,8 +1327,8 @@ static void pnv_chip_core_realize(PnvChip *chip, Error **errp)
         object_property_set_int(OBJECT(pnv_core),
                                 pcc->core_pir(chip, core_hwid),
                                 "pir", &error_fatal);
-        object_property_add_const_link(OBJECT(pnv_core), "chip",
-                                       OBJECT(chip), &error_fatal);
+        object_property_set_link(OBJECT(pnv_core), OBJECT(chip), "chip",
+                                 &error_abort);
         object_property_set_bool(OBJECT(pnv_core), true, "realized",
                                  &error_fatal);
 
index 61b3d3ce2250eb638fff2723d6c50cf1ea845f1b..5ab75bde6cc577a8f21fcce5d2e073a8c2655302 100644 (file)
@@ -217,15 +217,8 @@ static void pnv_core_realize(DeviceState *dev, Error **errp)
     void *obj;
     int i, j;
     char name[32];
-    Object *chip;
 
-    chip = object_property_get_link(OBJECT(dev), "chip", &local_err);
-    if (!chip) {
-        error_propagate_prepend(errp, local_err,
-                                "required link 'chip' not found: ");
-        return;
-    }
-    pc->chip = PNV_CHIP(chip);
+    assert(pc->chip);
 
     pc->threads = g_new(PowerPCCPU *, cc->nr_threads);
     for (i = 0; i < cc->nr_threads; i++) {
@@ -297,6 +290,7 @@ static void pnv_core_unrealize(DeviceState *dev, Error **errp)
 
 static Property pnv_core_properties[] = {
     DEFINE_PROP_UINT32("pir", PnvCore, pir, 0),
+    DEFINE_PROP_LINK("chip", PnvCore, chip, TYPE_PNV_CHIP, PnvChip *),
     DEFINE_PROP_END_OF_LIST(),
 };
 
This page took 0.030702 seconds and 4 git commands to generate.