[Skiboot] [PATCH] platforms/qemu: update phandle of "interrupt-parent"

Cédric Le Goater clg at kaod.org
Fri Jul 19 22:59:16 AEST 2019


QEMU provides a DT populated with the serial devices but the
"interrupt-parent" property is empty (0x0). It was not a problem until
now. But since OpenFirmare started using a recent libdft (>= 1.4.7),
petitboot fails to boot the system image with error :

   dtc_resize: fdt_open_into returned FDT_ERR_BADMAGIC

Provide a DT fixup for "interrupt-parent" properties of the LPC bus.

Signed-off-by: Cédric Le Goater <clg at kaod.org>
---
 platforms/astbmc/astbmc.h |  1 +
 platforms/astbmc/common.c |  6 +++---
 platforms/qemu/qemu.c     | 22 ++++++++++++++++++++++
 3 files changed, 26 insertions(+), 3 deletions(-)

diff --git a/platforms/astbmc/astbmc.h b/platforms/astbmc/astbmc.h
index c302b6070d0e..122b0007aabb 100644
--- a/platforms/astbmc/astbmc.h
+++ b/platforms/astbmc/astbmc.h
@@ -96,6 +96,7 @@ extern const struct bmc_platform bmc_plat_ast2500_ami;
 extern const struct bmc_platform bmc_plat_ast2500_openbmc;
 
 extern void astbmc_early_init(void);
+extern struct dt_node *astbmc_dt_find_primary_lpc(void);
 extern int64_t astbmc_ipmi_reboot(void);
 extern int64_t astbmc_ipmi_power_down(uint64_t request);
 extern void astbmc_init(void);
diff --git a/platforms/astbmc/common.c b/platforms/astbmc/common.c
index 76fa25f8ab98..7f581bebeb90 100644
--- a/platforms/astbmc/common.c
+++ b/platforms/astbmc/common.c
@@ -381,7 +381,7 @@ static void astbmc_fixup_bmc_sensors(void)
 	}
 }
 
-static struct dt_node *dt_find_primary_lpc(void)
+struct dt_node *astbmc_dt_find_primary_lpc(void)
 {
 	struct dt_node *n, *primary_lpc = NULL;
 
@@ -406,7 +406,7 @@ static void astbmc_fixup_dt(void)
 {
 	struct dt_node *primary_lpc;
 
-	primary_lpc = dt_find_primary_lpc();
+	primary_lpc = astbmc_dt_find_primary_lpc();
 
 	if (!primary_lpc)
 		return;
@@ -496,7 +496,7 @@ void astbmc_early_init(void)
 		 * fallback.
 		 */
 		if (proc_gen == proc_gen_p9) {
-			astbmc_fixup_dt_mbox(dt_find_primary_lpc());
+			astbmc_fixup_dt_mbox(astbmc_dt_find_primary_lpc());
 			ast_setup_sio_mbox(MBOX_IO_BASE, MBOX_LPC_IRQ);
 		}
 	} else {
diff --git a/platforms/qemu/qemu.c b/platforms/qemu/qemu.c
index b528a826301a..193bec06b195 100644
--- a/platforms/qemu/qemu.c
+++ b/platforms/qemu/qemu.c
@@ -23,6 +23,26 @@
 
 static bool bt_device_present;
 
+static void qemu_fixup_dt_lpc_interrupt_parent(void)
+{
+	struct dt_node *lpc, *node;
+
+	lpc = astbmc_dt_find_primary_lpc();
+
+	if (!lpc)
+		return;
+
+	dt_for_each_child(lpc, node) {
+		struct dt_property *prop;
+
+		prop = __dt_find_property(node, "interrupt-parent");
+		if (!prop)
+			return;
+		dt_del_property(node, prop);
+		dt_add_property_cells(node, "interrupt-parent", lpc->phandle);
+	}
+}
+
 static bool qemu_probe_common(const char *compat)
 {
 	struct dt_node *n;
@@ -37,6 +57,8 @@ static bool qemu_probe_common(const char *compat)
 		bt_device_present = true;
 	}
 
+	qemu_fixup_dt_lpc_interrupt_parent();
+
 	return true;
 }
 
-- 
2.21.0



More information about the Skiboot mailing list