On Thu, 30 Apr 2026 at 10:19, Kuan-Jui Chiu <[email protected]> wrote:
>
> Add EVK axiado-scm3003 built with AX3000 SoC
>
> Signed-off-by: Kuan-Jui Chiu <[email protected]>
> ---
>  hw/arm/Kconfig                 |  5 ++++
>  hw/arm/ax3000-boards.c         | 52 ++++++++++++++++++++++++++++++++++
>  hw/arm/ax3000-evk.c            | 27 ++++++++++++++++++
>  hw/arm/meson.build             |  3 ++
>  include/hw/arm/ax3000-boards.h | 28 ++++++++++++++++++
>  5 files changed, 115 insertions(+)
>  create mode 100644 hw/arm/ax3000-boards.c
>  create mode 100644 hw/arm/ax3000-evk.c
>  create mode 100644 include/hw/arm/ax3000-boards.h
>
> diff --git a/hw/arm/Kconfig b/hw/arm/Kconfig
> index 4fb23122fd..e569d8ee9e 100644
> --- a/hw/arm/Kconfig
> +++ b/hw/arm/Kconfig
> @@ -699,3 +699,8 @@ config AXIADO_SOC
>      select CADENCE # UART
>      select AXIADO_SDHCI
>      select UNIMP
> +
> +config AXIADO_EVK
> +    bool
> +    default y
> +    select AXIADO_SOC
> diff --git a/hw/arm/ax3000-boards.c b/hw/arm/ax3000-boards.c
> new file mode 100644
> index 0000000000..cadbac8edc
> --- /dev/null
> +++ b/hw/arm/ax3000-boards.c
> @@ -0,0 +1,52 @@
> +/*
> + * Axiado Boards
> + *
> + * Author: Kuan-Jui Chiu <[email protected]>
> + *
> + * SPDX-License-Identifier: GPL-2.0-or-later
> + */
> +
> +#include "qemu/osdep.h"
> +#include "hw/arm/ax3000-boards.h"
> +#include "hw/arm/machines-qom.h"
> +#include "qemu/error-report.h"
> +#include "qom/object.h"
> +
> +static const char *ax3000_machine_get_default_cpu_type(const MachineState 
> *ms)
> +{
> +    return ARM_CPU_TYPE_NAME("cortex-a53");

There's no point in having a function just for this; you can use
  mc->default_cpu_type = ARM_CPU_TYPE_NAME("cortex-a35");
without the indirection.

> +}
> +
> +static void ax3000_machine_init(MachineState *machine)
> +{
> +    Ax3000MachineState *ams = AX3000_MACHINE(machine);
> +
> +    ams->soc = AX3000_SOC(object_new(TYPE_AX3000_SOC));
> +    object_property_add_child(OBJECT(machine), "soc", OBJECT(ams->soc));
> +    sysbus_realize_and_unref(SYS_BUS_DEVICE(ams->soc), &error_fatal);

The machine init function for an Arm board always needs to end
by calling arm_load_kernel(). As well as implementing the handling
for the -kernel "load this kernel/image file" option, it also
sets up some things like getting CPU reset to work correctly.

> +}
> +
> +static void ax3000_machine_class_init(ObjectClass *oc, const void *data)
> +{
> +    MachineClass *mc = MACHINE_CLASS(oc);
> +
> +    mc->init = ax3000_machine_init;
> +    mc->default_cpus = AX3000_NUM_CPUS;
> +    mc->min_cpus = AX3000_NUM_CPUS;
> +    mc->max_cpus = AX3000_NUM_CPUS;
> +    mc->get_default_cpu_type = ax3000_machine_get_default_cpu_type;
> +}
> +
> +static const TypeInfo ax3000_machine_types[] = {
> +    {
> +        .name          = TYPE_AX3000_MACHINE,
> +        .parent        = TYPE_MACHINE,
> +        .instance_size = sizeof(Ax3000MachineState),
> +        .class_size    = sizeof(Ax3000MachineClass),
> +        .class_init    = ax3000_machine_class_init,
> +        .interfaces    = aarch64_machine_interfaces,
> +        .abstract      = true,
> +    }

Do you really expect to have a lot of boards which are
all different subclasses of AX3000? Unless you really
need this, better to do the simple thing and implement
the MACHINE_TYPE_NAME("axiado-scm3003") without the extra
layer of class structure which is doing nothing at all.

thanks
-- PMM

Reply via email to