Message ID | 20181212082526.1676-1-clg@kaod.org |
---|---|
State | Accepted |
Headers | show |
Series | plat/qemu: fix platform initialization when the BT device is not present | expand |
Context | Check | Description |
---|---|---|
snowpatch_ozlabs/apply_patch | success | master/apply_patch Successfully applied |
snowpatch_ozlabs/snowpatch_job_snowpatch-skiboot | success | Test snowpatch/job/snowpatch-skiboot on branch master |
Cédric Le Goater <clg@kaod.org> writes: > 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@kaod.org> Thanks, merged to master as of 2f0b6af6e01c5f7b3c762647d06c4f792e2cb3b7
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,
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@kaod.org> --- platforms/qemu/qemu.c | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-)