[Skiboot] [PATCH] plat/qemu: fix platform initialization when the BT device is not present

Cédric Le Goater clg at kaod.org
Wed Dec 12 19:25:26 AEDT 2018


A QEMU PowerNV machine does not necessarily have a BT device. It needs
to be defined on the command line with :

  -device ipmi-bmc-sim,id=bmc0 -device isa-ipmi-bt,bmc=bmc0,irq=10

When the QEMU platform is initialized by skiboot, we need to check
that such a device is present and if not, skip the AST initialization.

Fixes: 8340a9642bba ("plat/qemu: use the common OpenPOWER routines to initialize")
Signed-off-by: Cédric Le Goater <clg at kaod.org>
---
 platforms/qemu/qemu.c | 21 ++++++++++++++++++++-
 1 file changed, 20 insertions(+), 1 deletion(-)

diff --git a/platforms/qemu/qemu.c b/platforms/qemu/qemu.c
index 316231314b14..7ba7f26e155c 100644
--- a/platforms/qemu/qemu.c
+++ b/platforms/qemu/qemu.c
@@ -15,26 +15,45 @@
  */
 
 #include <skiboot.h>
+#include <console.h>
 #include <device.h>
 #include <ipmi.h>
 
 #include <platforms/astbmc/astbmc.h>
 
+static bool bt_device_present;
 
 static bool qemu_probe(void)
 {
+	struct dt_node *n;
+
 	if (!dt_node_is_compatible(dt_root, "qemu,powernv"))
 		return false;
 
         astbmc_early_init();
 
+	/* check if the BT device was defined by QEMU */
+	dt_for_each_child(dt_root, n) {
+		if (dt_node_is_compatible(n, "bt"))
+		       bt_device_present = true;
+	}
+
 	return true;
 }
 
+static void qemu_init(void)
+{
+	if (!bt_device_present) {
+		set_opal_console(&uart_opal_con);
+	} else {
+		astbmc_init();
+	}
+}
+
 DECLARE_PLATFORM(qemu) = {
 	.name		= "Qemu",
 	.probe		= qemu_probe,
-	.init		= astbmc_init,
+	.init		= qemu_init,
 	.external_irq   = astbmc_ext_irq_serirq_cpld,
 	.cec_power_down = astbmc_ipmi_power_down,
 	.cec_reboot     = astbmc_ipmi_reboot,
-- 
2.17.2



More information about the Skiboot mailing list