Peter Maydell 於 2026/5/26 下午 10:12 寫道:
CAUTION: This email originated from outside of the organization. Do not click 
links or open attachments unless you recognize the sender and know the content 
is safe.


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.


Understood.
I will remove this function and assign directly

+}
+
+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.


For ax3000 SoC, we assumed that the kernel image,which is stored in an eMMC device, would be loaded into a specific DDR address by u-boot then start booting

So I do not expect that user should use "-kernel" argument to pass the kernel image to QEMU for AX3000 SoC
This is what the command I used to launch axiado-scm3003 machine in QEMU


./qemu-system-aarch64 \
    -m 4G \
    -machine axiado-scm3003 \
    -device loader,file=u-boot.bin,addr=0x3C000000,cpu-num=0 \
    -nographic \
    -serial null \
    -serial null \
    -serial null \
    -serial mon:stdio \
    -drive if=sd,file=obmc-phosphor-image-evk-axiado-qemu.wic,format=raw

+}
+
+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.


I will introduce another machine "axiado-scm3002" in future for sensors implementation

Both of scm3002 and scm3003 are built with AX3000 SoC and they are the different EVK boards

thanks
-- PMM

Reply via email to