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

Cédric Le Goater clg at kaod.org
Mon Apr 8 17:26:35 AEST 2019


On 4/8/19 5:59 AM, Oliver wrote:
> On Fri, Apr 5, 2019 at 1:58 AM Cédric Le Goater <clg at kaod.org> wrote:
>>
>> 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);
> 
> Make this PR_DEBUG or something.

Ah yes. I will just remove this one. The chosen platform is printed 
out on the console any way.

> 
>> +
>> +       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)
> 
> s/POWER8/POWER9/

yes ...

> 
>> + */
>> +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,
>> +};
> 
> It'd be nice if we had a better way to deal with platforms with very
> minor differences. I guess we could always copy the read-only platform
> into a writeable one and run-time patch some of the methods after
> probing, but that's something for another patch.

Are you thinking of a two level probing ? first scan would find 
the generic "qemu,powernv" platform and the second would create and 
populate a runtime platform depending on extra compat properties. 

> Reviewed-by: Oliver O'Halloran <oohall at gmail.com>

I will address your comments first

Thanks,

C. 


> 
>> --
>> 2.20.1
>>
>> _______________________________________________
>> Skiboot mailing list
>> Skiboot at lists.ozlabs.org
>> https://lists.ozlabs.org/listinfo/skiboot



More information about the Skiboot mailing list