[Skiboot] [PATCH 1/3] plat/qemu: add a POWER8 and POWER9 platform

Cédric Le Goater clg at kaod.org
Fri Apr 5 01:18:58 AEDT 2019


These new QEMU platforms have characteristics closer to real OpenPOWER
systems that we use today and define a different BMC depending on the
CPU type. New platform properties are introduced for each,
"qemu,powernv8", "qemu,powernv9" and these should be compatible with
existing QEMUs which only expose the "qemu,powernv" property.

Signed-off-by: Cédric Le Goater <clg at kaod.org>
---
 platforms/qemu/qemu.c | 57 ++++++++++++++++++++++++++++++++++++++++---
 1 file changed, 54 insertions(+), 3 deletions(-)

diff --git a/platforms/qemu/qemu.c b/platforms/qemu/qemu.c
index 04bf3fb3f0ea..1969534e81f0 100644
--- a/platforms/qemu/qemu.c
+++ b/platforms/qemu/qemu.c
@@ -23,11 +23,13 @@
 
 static bool bt_device_present;
 
-static bool qemu_probe(void)
+static bool qemu_probe_common(const char *compat)
 {
 	struct dt_node *n;
 
-	if (!dt_node_is_compatible(dt_root, "qemu,powernv"))
+        prerror("Probing %s\n", compat);
+
+	if (!dt_node_is_compatible(dt_root, compat))
 		return false;
 
         astbmc_early_init();
@@ -40,6 +42,21 @@ static bool qemu_probe(void)
 	return true;
 }
 
+static bool qemu_probe(void)
+{
+	return qemu_probe_common("qemu,powernv");
+}
+
+static bool qemu_probe_powernv8(void)
+{
+	return qemu_probe_common("qemu,powernv8");
+}
+
+static bool qemu_probe_powernv9(void)
+{
+	return qemu_probe_common("qemu,powernv9");
+}
+
 static void qemu_init(void)
 {
 	if (!bt_device_present) {
@@ -50,7 +67,7 @@ static void qemu_init(void)
 }
 
 DECLARE_PLATFORM(qemu) = {
-	.name		= "Qemu",
+	.name		= "QEMU",
 	.probe		= qemu_probe,
 	.init		= qemu_init,
 	.external_irq   = astbmc_ext_irq_serirq_cpld,
@@ -60,3 +77,37 @@ DECLARE_PLATFORM(qemu) = {
 	.resource_loaded	= flash_resource_loaded,
 	.terminate	= ipmi_terminate,
 };
+
+/*
+ * For a QEMU PowerNV machine using POWER8 CPUs (Palmetto)
+ */
+DECLARE_PLATFORM(qemu_powernv8) = {
+	.name		= "QEMU POWER8",
+	.probe		= qemu_probe_powernv8,
+	.bmc		= &bmc_plat_ast2400_ami,
+	.init		= qemu_init,
+	.external_irq   = astbmc_ext_irq_serirq_cpld,
+	.cec_power_down = astbmc_ipmi_power_down,
+	.cec_reboot     = astbmc_ipmi_reboot,
+	.start_preload_resource	= flash_start_preload_resource,
+	.resource_loaded	= flash_resource_loaded,
+	.exit			= astbmc_exit,
+	.terminate	= ipmi_terminate,
+};
+
+/*
+ * For a QEMU PowerNV machine using POWER8 CPUs (Witherspoon)
+ */
+DECLARE_PLATFORM(qemu_powernv9) = {
+	.name		= "QEMU POWER9",
+	.probe		= qemu_probe_powernv9,
+	.bmc		= &bmc_plat_ast2500_openbmc,
+	.init		= qemu_init,
+	.external_irq   = astbmc_ext_irq_serirq_cpld,
+	.cec_power_down = astbmc_ipmi_power_down,
+	.cec_reboot     = astbmc_ipmi_reboot,
+	.start_preload_resource	= flash_start_preload_resource,
+	.resource_loaded	= flash_resource_loaded,
+	.exit			= astbmc_exit,
+	.terminate	= ipmi_terminate,
+};
-- 
2.20.1



More information about the Skiboot mailing list