Skip to contentSkip to conversation

Add Axiado SoC AX3000 and EVK board

PATCH Superseded Kuan-Jui Chiu 2 participants 8 messages Mar 6 – Apr 24

Subsystems (2)

v1 of 7 Superseded Latest is v7 →

lore
Share & tools
lore
#0 lore raw

cover Add Axiado SoC AX3000 and EVK board

This patchset introduces Axiado SoC AX3000 and a EVK SCM3003 for emulation The model for Axiado SoC AX3000 supports
4 Cortex-A53 CPUs
Arm Generic Interrupt Controller v3
4 Cadence UARTs
1 SDHCI controller with PHY

Verified the machine "axiado-scm3003" with following command

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-github.wic,format=raw

Kuan-Jui Chiu (2):
hw/arm: Add Axiado SoC AX3000
hw/arm: Add Axiado EVK board

 hw/arm/Kconfig                 |   8 +
 hw/arm/axiado-boards.c         |  78 +++++++++
 hw/arm/axiado-evk.c            |  38 +++++
 hw/arm/axiado-soc.c            | 287 +++++++++++++++++++++++++++++++++
 hw/arm/meson.build             |   4 +
 include/hw/arm/axiado-boards.h |  41 +++++
 include/hw/arm/axiado-soc.h    | 152 +++++++++++++++++
 7 files changed, 608 insertions(+)
 create mode 100644 hw/arm/axiado-boards.c
 create mode 100644 hw/arm/axiado-evk.c
 create mode 100644 hw/arm/axiado-soc.c
 create mode 100644 include/hw/arm/axiado-boards.h
 create mode 100644 include/hw/arm/axiado-soc.h
Signature · 1 line
2.34.1
#1 lore raw

PATCH 1/2 hw/arm: Add Axiado SoC AX3000

This patch adds new model for Axiado SoC AX3000 which supports
4 Cortex-A53 ARM64 CPUs
Arm Generic Interrupt Controller v3
4 Cadence UARTs
1 SDHCI controller with PHY

---
 hw/arm/Kconfig              |   8 +
 hw/arm/axiado-soc.c         | 287 ++++++++++++++++++++++++++++++++++++
 hw/arm/meson.build          |   2 +
 include/hw/arm/axiado-soc.h | 152 +++++++++++++++++++
 4 files changed, 449 insertions(+)
 create mode 100644 hw/arm/axiado-soc.c
 create mode 100644 include/hw/arm/axiado-soc.h
hw/arm/Kconfig +8 -0
index c66c452737..a91b81b298 100644
@@ -699,3 +699,11 @@ config ARMSSE
     select UNIMP
     select SSE_COUNTER
     select SSE_TIMER
+
+config AXIADO_SOC
+    bool
+    default y
+    depends on ARM
+    select ARM_GIC
+    select CADENCE # UART
+    select SDHCI
hw/arm/axiado-soc.c new file +287 -0

287 lines not on this page · raw message

hw/arm/meson.build +2 -0
index 47cdc51d13..c3c96c0a70 100644
@@ -105,6 +105,8 @@ arm_common_ss.add(when: 'CONFIG_STRONGARM', if_true: files('strongarm.c'))
 arm_common_ss.add(when: 'CONFIG_SX1', if_true: files('omap_sx1.c'))
 arm_common_ss.add(when: 'CONFIG_VERSATILE', if_true: files('versatilepb.c'))
 arm_common_ss.add(when: 'CONFIG_VEXPRESS', if_true: files('vexpress.c'))
+arm_common_ss.add(when: ['CONFIG_AXIADO_SOC', 'TARGET_AARCH64'], if_true: files(
+  'axiado-soc.c'))
 
 arm_common_ss.add(files('boot.c'))
 
include/hw/arm/axiado-soc.h new file +152 -0

152 lines not on this page · raw message

Signature · 1 line
2.34.1
#2 lore raw

Re: [PATCH v1 1/2] hw/arm: Add Axiado SoC AX3000

Quoted 8 lines · Kuan-Jui Chiu

This patch adds new model for Axiado SoC AX3000 which supports
4 Cortex-A53 ARM64 CPUs
Arm Generic Interrupt Controller v3
4 Cadence UARTs
1 SDHCI controller with PHY

Hi; thanks for this patch; my review comments are below. I have some comments about structure but nothing too major I think.

Quoted 38 lines
---
 hw/arm/Kconfig              |   8 +
 hw/arm/axiado-soc.c         | 287 ++++++++++++++++++++++++++++++++++++
 hw/arm/meson.build          |   2 +
 include/hw/arm/axiado-soc.h | 152 +++++++++++++++++++
 4 files changed, 449 insertions(+)
 create mode 100644 hw/arm/axiado-soc.c
 create mode 100644 include/hw/arm/axiado-soc.h
hw/arm/Kconfig +8 -0
index c66c452737..a91b81b298 100644
@@ -699,3 +699,11 @@ config ARMSSE
     select UNIMP
     select SSE_COUNTER
     select SSE_TIMER
+
+config AXIADO_SOC
+    bool
+    default y
+    depends on ARM
+    select ARM_GIC
+    select CADENCE # UART
+    select SDHCI
hw/arm/axiado-soc.c new file +7 -0
new file mode 100644
index 0000000000..e23410c147
@@ -0,0 +1,287 @@
+/*
+ * Axiado SoC AX3000
+ *
+ * Author: Kuan-Jui Chiu <[email protected]>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as

hw/arm/axiado-soc.c line 17

Quoted 10 lines
hw/arm/axiado-soc.c new file +10 -0
+ * published by the Free Software Foundation; either version 2 or
+ * (at your option) version 3 of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, see <http://www.gnu.org/licenses/>.

If you run scripts/checkpatch.pl on your patches, it should warn you that we prefer to use SPDX identifiers rather than the traditional GPL license boilerplate.

hw/arm/axiado-soc.c line 18

Quoted 1 line
hw/arm/axiado-soc.c new file +1 -0
+ */

Is there a data sheet for this SoC? The top level comment is a good place to put the URL for it.

Without a datasheet, it's trickier to review.

Quoted 28 lines
hw/arm/axiado-soc.c new file +28 -0
+
+#include "qemu/osdep.h"
+#include "system/address-spaces.h"
+#include "hw/arm/bsa.h"
+#include "hw/arm/axiado-soc.h"
+#include "system/system.h"
+#include "qobject/qlist.h"
+#include "qom/object.h"
+
+static uint64_t sdhci_phy_read(void *opaque, hwaddr offset, unsigned size)
+{
+    uint32_t val = 0x00;
+
+    switch (offset) {
+    case REG_ID:
+        val = 0x3dff6870;
+        break;
+    case REG_STATUS:
+        // Make DLL_RDY | CAL_DONE
+        val =  (1u << 0) | (1u << 6);
+        break;
+    default:
+        break;
+    }
+
+    return val;
+}
+

hw/arm/axiado-soc.c line 56

Quoted 10 lines
hw/arm/axiado-soc.c new file +10 -0
+static void sdhci_phy_write(void *opaque, hwaddr offset, uint64_t val, unsigned size)
+{
+    /* TBD */
+}
+
+static const MemoryRegionOps sdhci_phy_ops = {
+    .read = sdhci_phy_read,
+    .write = sdhci_phy_write,
+    .endianness = DEVICE_LITTLE_ENDIAN,
+};

Please put models of sub-devices of the SoC into their own source files in the appropriate subdirectory of the hw/ directory.

Quoted 6 lines
hw/arm/axiado-soc.c new file +6 -0
+
+static uint64_t timer_ctrl_read(void *opaque, hwaddr offset, unsigned size)
+{
+    return 0x0;
+}
+

hw/arm/axiado-soc.c line 72

Quoted 10 lines
hw/arm/axiado-soc.c new file +10 -0
+static void timer_ctrl_write(void *opaque, hwaddr offset, uint64_t val, unsigned size)
+{
+    /* TBD */
+}
+
+static const MemoryRegionOps timer_ctrl_ops = {
+    .read = timer_ctrl_read,
+    .write = timer_ctrl_write,
+    .endianness = DEVICE_LITTLE_ENDIAN,
+};

If you can get by with absolutely no implementation of a device, consider using TYPE_UNIMPLEMENTED_DEVICE (from hw/misc/unimp.c), which will give you a "reads as zero, writes ignored" block which also logs when the guest touches it. (You can either create the device directly, or use the create_unimplemented_device() helper function.)

Quoted 52 lines
hw/arm/axiado-soc.c new file +52 -0
+
+static uint64_t pll_read(void *opaque, hwaddr offset, unsigned size)
+{
+    switch (offset) {
+    case CLKRST_CPU_PLL_POSTDIV_OFFSET:
+        return 0x20891b;
+    case CLKRST_CPU_PLL_STS_OFFSET:
+        return 0x01;
+    default:
+        return 0x00;
+    }
+}
+
+static void pll_write(void *opaque, hwaddr offset, uint64_t val, unsigned size)
+{
+    /* TBD */
+}
+
+static const MemoryRegionOps pll_ops = {
+    .read = pll_read,
+    .write = pll_write,
+    .endianness = DEVICE_LITTLE_ENDIAN,
+};
+
+static void ax3000_init(Object *obj)
+{
+    AxiadoSoCState *s = AXIADO_SOC(obj);
+    AxiadoSoCClass *sc = AXIADO_SOC_GET_CLASS(s);
+    int i;
+
+    for (i = 0; i < sc->num_cpus; i++) {
+        g_autofree char *name = g_strdup_printf("cpu%d", i);
+        object_initialize_child(obj, name, &s->cpu[i], ARM_CPU_TYPE_NAME("cortex-a53"));
+    }
+
+    object_initialize_child(obj, "gic", &s->gic, gicv3_class_name());
+
+    for (i = 0; i < AX3000_NUM_UARTS; i++) {
+        g_autofree char *name = g_strdup_printf("uart%d", i);
+        object_initialize_child(obj, name, &s->uart[i], TYPE_CADENCE_UART);
+    }
+
+    object_initialize_child(obj, "sdhci0", &s->sdhci0, TYPE_SYSBUS_SDHCI);
+}
+
+static void ax3000_realize(DeviceState *dev, Error **errp)
+{
+    AxiadoSoCState *s = AXIADO_SOC(dev);
+    AxiadoSoCClass *sc = AXIADO_SOC_GET_CLASS(s);
+    SysBusDevice *gicsbd = SYS_BUS_DEVICE(&s->gic);
+    DeviceState *gicdev = DEVICE(&s->gic);
+    QList *redist_region_count;

hw/arm/axiado-soc.c line 134

Quoted 10 lines
hw/arm/axiado-soc.c new file +10 -0
+    int i;
+
+    /* CPUs */
+    for (i = 0; i < sc->num_cpus; i++) {
+        object_property_set_int(OBJECT(&s->cpu[i]), "cntfrq", 8000000,
+                                &error_abort);
+
+        if (object_property_find(OBJECT(&s->cpu[i]), "has_el3")) {
+            object_property_set_bool(OBJECT(&s->cpu[i]), "has_el3",
+                                     false, &error_abort);

Does your SoC really not implement EL3 ?

Quoted 311 lines
hw/arm/axiado-soc.c new file +153 -0
+        }
+
+        if (!qdev_realize(DEVICE(&s->cpu[i]), NULL, errp)) {
+            return;
+        }
+    }
+
+    /* GIC */
+    qdev_prop_set_uint32(gicdev, "num-cpu", sc->num_cpus);
+    qdev_prop_set_uint32(gicdev, "num-irq",
+                         AX3000_NUM_IRQS + GIC_INTERNAL);
+
+    redist_region_count = qlist_new();
+    qlist_append_int(redist_region_count, sc->num_cpus);
+    qdev_prop_set_array(gicdev, "redist-region-count", redist_region_count);
+
+    if (!sysbus_realize(gicsbd, errp)) {
+        return;
+    }
+
+    sysbus_mmio_map(gicsbd, 0, AX3000_GIC_DIST_BASE);
+    sysbus_mmio_map(gicsbd, 1, AX3000_GIC_REDIST_BASE);
+
+    /*
+     * Wire the outputs from each CPU's generic timer and the GICv3
+     * maintenance interrupt signal to the appropriate GIC PPI inputs, and
+     * the GIC's IRQ/FIQ interrupt outputs to the CPU's inputs.
+     */
+    for (i = 0; i < sc->num_cpus; i++) {
+        DeviceState *cpudev = DEVICE(&s->cpu[i]);
+        int intidbase = AX3000_NUM_IRQS + i * GIC_INTERNAL;
+        qemu_irq irq;
+
+        /*
+         * Mapping from the output timer irq lines from the CPU to the
+         * GIC PPI inputs.
+         */
+        static const int timer_irqs[] = {
+            [GTIMER_PHYS] = ARCH_TIMER_NS_EL1_IRQ,
+            [GTIMER_VIRT] = ARCH_TIMER_VIRT_IRQ,
+            [GTIMER_HYP]  = ARCH_TIMER_NS_EL2_IRQ,
+            [GTIMER_SEC]  = ARCH_TIMER_S_EL1_IRQ
+        };
+
+        for (int j = 0; j < ARRAY_SIZE(timer_irqs); j++) {
+            irq = qdev_get_gpio_in(gicdev, intidbase + timer_irqs[j]);
+            qdev_connect_gpio_out(cpudev, j, irq);
+        }
+
+        irq = qdev_get_gpio_in(gicdev, intidbase + ARCH_GIC_MAINT_IRQ);
+        qdev_connect_gpio_out_named(cpudev, "gicv3-maintenance-interrupt",
+                                        0, irq);
+
+        sysbus_connect_irq(gicsbd, i,
+                           qdev_get_gpio_in(cpudev, ARM_CPU_IRQ));
+        sysbus_connect_irq(gicsbd, i + sc->num_cpus,
+                           qdev_get_gpio_in(cpudev, ARM_CPU_FIQ));
+        sysbus_connect_irq(gicsbd, i + 2 * sc->num_cpus,
+                           qdev_get_gpio_in(cpudev, ARM_CPU_VIRQ));
+        sysbus_connect_irq(gicsbd, i + 3 * sc->num_cpus,
+                           qdev_get_gpio_in(cpudev, ARM_CPU_VFIQ));
+    }
+
+    /* DRAM */
+    for (i = 0; i < AX3000_NUM_BANKS; i++) {
+        struct {
+            hwaddr addr;
+            size_t size;
+            const char *name;
+        } dram_table[] = {
+            { AX3000_DRAM0_BASE, AX3000_DRAM0_SIZE, "dram0" },
+            { AX3000_DRAM1_BASE, AX3000_DRAM1_SIZE, "dram1" }
+        };
+
+        memory_region_init_ram(&s->dram[i], OBJECT(s), dram_table[i].name,
+                               dram_table[i].size, &error_fatal);
+        memory_region_add_subregion(get_system_memory(), dram_table[i].addr,
+                                    &s->dram[i]);
+    }
+
+    /* UARTs */
+    for (i = 0; i < AX3000_NUM_UARTS; i++) {
+        struct {
+            hwaddr addr;
+            unsigned int irq;
+        } serial_table[] = {
+            { AX3000_UART0_BASE, AX3000_UART0_IRQ },
+            { AX3000_UART1_BASE, AX3000_UART1_IRQ },
+            { AX3000_UART2_BASE, AX3000_UART2_IRQ },
+            { AX3000_UART3_BASE, AX3000_UART3_IRQ }
+        };
+
+        qdev_prop_set_chr(DEVICE(&s->uart[i]), "chardev", serial_hd(i));
+        if (!sysbus_realize(SYS_BUS_DEVICE(&s->uart[i]), errp)) {
+            return;
+        }
+
+        sysbus_mmio_map(SYS_BUS_DEVICE(&s->uart[i]), 0, serial_table[i].addr);
+        sysbus_connect_irq(SYS_BUS_DEVICE(&s->uart[i]), 0,
+                           qdev_get_gpio_in(gicdev, serial_table[i].irq));
+    }
+
+    /* Timer control*/
+    memory_region_init_io(&s->timer_ctrl, OBJECT(s), &timer_ctrl_ops, s,
+                          "timer_ctrl", 32);
+    memory_region_add_subregion(get_system_memory(), AX3000_TIMER_CTRL,
+                                &s->timer_ctrl);
+
+    /* PLL control */
+    memory_region_init_io(&s->pll_ctrl, OBJECT(s), &pll_ops, s, "pll_ctrl",
+                          32);
+    memory_region_add_subregion(get_system_memory(), AX3000_PLL_BASE,
+                                &s->pll_ctrl);
+
+    /* SDHCI */
+    qdev_prop_set_uint64(DEVICE(&s->sdhci0), "capareg", 0x216737eed0b0);
+    qdev_prop_set_uint64(DEVICE(&s->sdhci0), "sd-spec-version", 3);
+
+    if (!sysbus_realize(SYS_BUS_DEVICE(&s->sdhci0), errp)) {
+        return;
+    }
+
+    sysbus_mmio_map(SYS_BUS_DEVICE(&s->sdhci0), 0, AX3000_SDHCI0_BASE);
+    sysbus_connect_irq(SYS_BUS_DEVICE(&s->sdhci0), 0,
+                       qdev_get_gpio_in(gicdev, AX3000_SDHCI0_IRQ));
+
+    memory_region_init_io(&s->sdhci_phy, OBJECT(s), &sdhci_phy_ops, s,
+                           "sdhci_phy", AX3000_SDHCI0_PHY_SIZE);
+    memory_region_add_subregion(get_system_memory(), AX3000_SDHCI0_PHY_BASE,
+                                &s->sdhci_phy);
+}
+
+static void ax3000_class_init(ObjectClass *oc, const void *data)
+{
+    DeviceClass *dc = DEVICE_CLASS(oc);
+    AxiadoSoCClass *sc = AXIADO_SOC_CLASS(oc);
+
+    dc->desc = "Axiado SoC AX3000";
+    dc->realize = ax3000_realize;
+    sc->num_cpus = AX3000_NUM_CPUS;
+}
+
+static const TypeInfo axiado_soc_types[] = {
+    {
+        .name           = TYPE_AXIADO_SOC,
+        .parent         = TYPE_SYS_BUS_DEVICE,
+        .instance_size  = sizeof(AxiadoSoCState),
+        .instance_init  = ax3000_init,
+        .class_init     = ax3000_class_init,
+    }
+};
+
+DEFINE_TYPES(axiado_soc_types)
hw/arm/meson.build +2 -0
index 47cdc51d13..c3c96c0a70 100644
@@ -105,6 +105,8 @@ arm_common_ss.add(when: 'CONFIG_STRONGARM', if_true: files('strongarm.c'))
 arm_common_ss.add(when: 'CONFIG_SX1', if_true: files('omap_sx1.c'))
 arm_common_ss.add(when: 'CONFIG_VERSATILE', if_true: files('versatilepb.c'))
 arm_common_ss.add(when: 'CONFIG_VEXPRESS', if_true: files('vexpress.c'))
+arm_common_ss.add(when: ['CONFIG_AXIADO_SOC', 'TARGET_AARCH64'], if_true: files(
+  'axiado-soc.c'))
 
 arm_common_ss.add(files('boot.c'))
 
include/hw/arm/axiado-soc.h new file +139 -0
new file mode 100644
index 0000000000..2483bdd8c2
@@ -0,0 +1,152 @@
+/*
+ * Axiado SoC AX3000
+ *
+ * Author: Kuan-Jui Chiu <[email protected]>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 or
+ * (at your option) version 3 of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef AXIADO_AX3000_H
+#define AXIADO_AX3000_H
+
+#include "cpu.h"
+#include "hw/intc/arm_gicv3_common.h"
+#include "hw/char/cadence_uart.h"
+#include "hw/sd/sdhci.h"
+#include "hw/core/sysbus.h"
+#include "qemu/units.h"
+
+#define TYPE_AXIADO_SOC "ax3000"
+OBJECT_DECLARE_TYPE(AxiadoSoCState, AxiadoSoCClass, AXIADO_SOC)
+
+#define AX3000_RAM_START        0x3C000000
+#define AX3000_RAM_SIZE_MAX     (16 * GiB)
+
+#define AX3000_DRAM0_BASE       AX3000_RAM_START
+#define AX3000_DRAM0_SIZE       (1088 * MiB)
+#define AX3000_DRAM1_BASE       0x400000000
+#define AX3000_DRAM1_SIZE       (2 * GiB)
+
+#define AX3000_GIC_DIST_BASE    0x80300000
+#define AX3000_GIC_DIST_SIZE    (64 * KiB)
+#define AX3000_GIC_REDIST_BASE  0x80380000
+#define AX3000_GIC_REDIST_SIZE  (512 * KiB)
+
+#define AX3000_UART0_BASE       0x80520000
+#define AX3000_UART0_SIZE       (256)
+#define AX3000_UART1_BASE       0x805a0000
+#define AX3000_UART1_SIZE       (256)
+#define AX3000_UART2_BASE       0x80620000
+#define AX3000_UART2_SIZE       (256)
+#define AX3000_UART3_BASE       0x80520800
+#define AX3000_UART3_SIZE       (256)
+
+#define AX3000_SDHCI0_BASE      0x86000000
+#define AX3000_SDHCI0_PHY_BASE  0x80801C00
+#define AX3000_SDHCI0_PHY_SIZE  (256)
+
+#define AX3000_GPIO0_BASE       0x80500000
+#define AX3000_GPIO0_SIZE       (1024)
+#define AX3000_GPIO1_BASE       0x80580000
+#define AX3000_GPIO1_SIZE       (1024)
+#define AX3000_GPIO2_BASE       0x80600000
+#define AX3000_GPIO2_SIZE       (1024)
+#define AX3000_GPIO3_BASE       0x80680000
+#define AX3000_GPIO3_SIZE       (1024)
+#define AX3000_GPIO4_BASE       0x80700000
+#define AX3000_GPIO4_SIZE       (1024)
+#define AX3000_GPIO5_BASE       0x80780000
+#define AX3000_GPIO5_SIZE       (1024)
+#define AX3000_GPIO6_BASE       0x80800000
+#define AX3000_GPIO6_SIZE       (1024)
+#define AX3000_GPIO7_BASE       0x80880000
+#define AX3000_GPIO7_SIZE       (1024)
+
+#define AX3000_TIMER_CTRL        0x8A020000
+#define AX3000_PLL_BASE          0x80000000
+#define CLKRST_CPU_PLL_POSTDIV_OFFSET   0x0C
+#define CLKRST_CPU_PLL_STS_OFFSET       0x14
+
+
+enum Ax3000Configuration {
+    AX3000_NUM_CPUS     = 4,
+    AX3000_NUM_IRQS     = 224,
+    AX3000_NUM_BANKS    = 2,
+    AX3000_NUM_UARTS    = 4,
+    AX3000_NUM_GPIOS    = 8,
+};
+
+typedef struct AxiadoSoCState {
+    SysBusDevice        parent;
+
+    ARMCPU              cpu[AX3000_NUM_CPUS];
+    GICv3State          gic;
+    MemoryRegion        dram[AX3000_NUM_BANKS];
+    MemoryRegion        timer_ctrl;
+    MemoryRegion        pll_ctrl;
+    CadenceUARTState    uart[AX3000_NUM_UARTS];
+    SDHCIState          sdhci0;
+    MemoryRegion        sdhci_phy;
+} AxiadoSoCState;
+
+typedef struct AxiadoSoCClass {
+    SysBusDeviceClass   parent;
+
+    uint32_t            num_cpus;
+} AxiadoSoCClass;
+
+enum Ax3000MemoryRegions {
+    AX3000_GIC_DIST,
+    AX3000_GIC_REDIST,
+    AX3000_DRAM0,
+    AX3000_DRAM1,
+    AX3000_UART0,
+    AX3000_UART1,
+    AX3000_UART2,
+    AX3000_UART3,
+    AX3000_SDHCI0,
+    AX3000_GPIO0,
+    AX3000_GPIO1,
+    AX3000_GPIO2,
+    AX3000_GPIO3,
+    AX3000_GPIO4,
+    AX3000_GPIO5,
+    AX3000_GPIO6,
+    AX3000_GPIO7,
+};
+
+enum Ax3000Irqs {
+    AX3000_UART0_IRQ    = 112,
+    AX3000_UART1_IRQ    = 113,
+    AX3000_UART2_IRQ    = 114,
+    AX3000_UART3_IRQ    = 170,
+
+    AX3000_SDHCI0_IRQ    = 123,
+
+    AX3000_GPIO0_IRQ    = 183,
+    AX3000_GPIO1_IRQ    = 184,
+    AX3000_GPIO2_IRQ    = 185,

include/hw/arm/axiado-soc.h line 149

Quoted 10 lines
include/hw/arm/axiado-soc.h new file +10 -0
+    AX3000_GPIO3_IRQ    = 186,
+    AX3000_GPIO4_IRQ    = 187,
+    AX3000_GPIO5_IRQ    = 188,
+    AX3000_GPIO6_IRQ    = 189,
+    AX3000_GPIO7_IRQ    = 190,
+};
+
+enum SDHCI_PHY_REG {
+    REG_ID        = 0x00,   // ID
+    REG_STATUS    = 0x50,   // READY/LOCK/CAL_DONE bits

Don't use C++ style // comments, please. checkpatch will warn about that too, I think.

Quoted 5 lines
include/hw/arm/axiado-soc.h new file +3 -1
+};
+
+#endif /* AXIADO_AX3000_H */
--

2.34.1

thanks
-- PMM

#3 lore raw

Re: [PATCH v1 1/2] hw/arm: Add Axiado SoC AX3000

Hi Peter

Please check the my replies below

I will send v2 patchset soon

If you still have concerns, please let me know

B.R.
Howard

Peter Maydell 於 2026/4/9 下午 11:17 寫道:

Quoted 57 lines

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.

Quoted 7 lines · Kuan-Jui Chiu

This patch adds new model for Axiado SoC AX3000 which supports
4 Cortex-A53 ARM64 CPUs
Arm Generic Interrupt Controller v3
4 Cadence UARTs
1 SDHCI controller with PHY

Hi; thanks for this patch; my review comments are below. I have some comments about structure but nothing too major I think.

Quoted 43 lines
---
  hw/arm/Kconfig              |   8 +
  hw/arm/axiado-soc.c         | 287 ++++++++++++++++++++++++++++++++++++
  hw/arm/meson.build          |   2 +
  include/hw/arm/axiado-soc.h | 152 +++++++++++++++++++
  4 files changed, 449 insertions(+)

create mode 100644 hw/arm/axiado-soc.c
create mode 100644 include/hw/arm/axiado-soc.h

hw/arm/Kconfig +8 -0
index c66c452737..a91b81b298 100644
@@ -699,3 +699,11 @@ config ARMSSE
      select UNIMP
      select SSE_COUNTER
      select SSE_TIMER
+
+config AXIADO_SOC
+    bool
+    default y
+    depends on ARM
+    select ARM_GIC
+    select CADENCE # UART
+    select SDHCI
hw/arm/axiado-soc.c new file +12 -0
new file mode 100644
index 0000000000..e23410c147
@@ -0,0 +1,287 @@
+/*
+ * Axiado SoC AX3000
+ *
+ * Author: Kuan-Jui Chiu <[email protected]>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 or
+ * (at your option) version 3 of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
Quoted 8 lines

hw/arm/axiado-soc.c line 17

Quoted 5 lines
hw/arm/axiado-soc.c new file +5 -0
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, see <http://www.gnu.org/licenses/>.

If you run scripts/checkpatch.pl on your patches, it should warn you that we prefer to use SPDX identifiers rather than the traditional GPL license boilerplate.

No problem I will fix them.

Quoted 6 lines

hw/arm/axiado-soc.c line 18

Quoted 2 lines
hw/arm/axiado-soc.c new file +1 -0
+ */

Is there a data sheet for this SoC? The top level comment is a good place to put the URL for it.

Without a datasheet, it's trickier to review.

I will attach a URL to our website for reference
If you still need more information about our SoC please let me know.

Quoted 33 lines
Quoted 33 lines
hw/arm/axiado-soc.c new file +32 -0
+
+#include "qemu/osdep.h"
+#include "system/address-spaces.h"
+#include "hw/arm/bsa.h"
+#include "hw/arm/axiado-soc.h"
+#include "system/system.h"
+#include "qobject/qlist.h"
+#include "qom/object.h"
+
+static uint64_t sdhci_phy_read(void *opaque, hwaddr offset, unsigned size)
+{
+    uint32_t val = 0x00;
+
+    switch (offset) {
+    case REG_ID:
+        val = 0x3dff6870;
+        break;
+    case REG_STATUS:
+        // Make DLL_RDY | CAL_DONE
+        val =  (1u << 0) | (1u << 6);
+        break;
+    default:
+        break;
+    }
+
+    return val;
+}
+
+static void sdhci_phy_write(void *opaque, hwaddr offset, uint64_t val, unsigned size)
+{
+    /* TBD */
+}
Quoted 8 lines

hw/arm/axiado-soc.c line 56

Quoted 6 lines
hw/arm/axiado-soc.c new file +6 -0
+
+static const MemoryRegionOps sdhci_phy_ops = {
+    .read = sdhci_phy_read,
+    .write = sdhci_phy_write,
+    .endianness = DEVICE_LITTLE_ENDIAN,
+};

Please put models of sub-devices of the SoC into their own source files in the appropriate subdirectory of the hw/ directory.

No problem, I will create a axiado_sdhci device in hw/sd , which includes this PHY device for our eMMC

Quoted 14 lines
Quoted 14 lines
hw/arm/axiado-soc.c new file +14 -0
+
+static uint64_t timer_ctrl_read(void *opaque, hwaddr offset, unsigned size)
+{
+    return 0x0;
+}
+
+static void timer_ctrl_write(void *opaque, hwaddr offset, uint64_t val, unsigned size)
+{
+    /* TBD */
+}
+
+static const MemoryRegionOps timer_ctrl_ops = {
+    .read = timer_ctrl_read,
+    .write = timer_ctrl_write,
Quoted 8 lines

hw/arm/axiado-soc.c line 72

Quoted 2 lines
hw/arm/axiado-soc.c new file +2 -0
+    .endianness = DEVICE_LITTLE_ENDIAN,
+};

If you can get by with absolutely no implementation of a device, consider using TYPE_UNIMPLEMENTED_DEVICE (from hw/misc/unimp.c), which will give you a "reads as zero, writes ignored" block which also logs when the guest touches it. (You can either create the device directly, or use the create_unimplemented_device() helper function.)

No problem, I will use create_unimplemented_device() for this dummy device

Quoted 55 lines
Quoted 55 lines
hw/arm/axiado-soc.c new file +55 -0
+
+static uint64_t pll_read(void *opaque, hwaddr offset, unsigned size)
+{
+    switch (offset) {
+    case CLKRST_CPU_PLL_POSTDIV_OFFSET:
+        return 0x20891b;
+    case CLKRST_CPU_PLL_STS_OFFSET:
+        return 0x01;
+    default:
+        return 0x00;
+    }
+}
+
+static void pll_write(void *opaque, hwaddr offset, uint64_t val, unsigned size)
+{
+    /* TBD */
+}
+
+static const MemoryRegionOps pll_ops = {
+    .read = pll_read,
+    .write = pll_write,
+    .endianness = DEVICE_LITTLE_ENDIAN,
+};
+
+static void ax3000_init(Object *obj)
+{
+    AxiadoSoCState *s = AXIADO_SOC(obj);
+    AxiadoSoCClass *sc = AXIADO_SOC_GET_CLASS(s);
+    int i;
+
+    for (i = 0; i < sc->num_cpus; i++) {
+        g_autofree char *name = g_strdup_printf("cpu%d", i);
+        object_initialize_child(obj, name, &s->cpu[i], ARM_CPU_TYPE_NAME("cortex-a53"));
+    }
+
+    object_initialize_child(obj, "gic", &s->gic, gicv3_class_name());
+
+    for (i = 0; i < AX3000_NUM_UARTS; i++) {
+        g_autofree char *name = g_strdup_printf("uart%d", i);
+        object_initialize_child(obj, name, &s->uart[i], TYPE_CADENCE_UART);
+    }
+
+    object_initialize_child(obj, "sdhci0", &s->sdhci0, TYPE_SYSBUS_SDHCI);
+}
+
+static void ax3000_realize(DeviceState *dev, Error **errp)
+{
+    AxiadoSoCState *s = AXIADO_SOC(dev);
+    AxiadoSoCClass *sc = AXIADO_SOC_GET_CLASS(s);
+    SysBusDevice *gicsbd = SYS_BUS_DEVICE(&s->gic);
+    DeviceState *gicdev = DEVICE(&s->gic);
+    QList *redist_region_count;
+    int i;
+
+    /* CPUs */
Quoted 8 lines

hw/arm/axiado-soc.c line 134

Quoted 7 lines
hw/arm/axiado-soc.c new file +7 -0
+    for (i = 0; i < sc->num_cpus; i++) {
+        object_property_set_int(OBJECT(&s->cpu[i]), "cntfrq", 8000000,
+                                &error_abort);
+
+        if (object_property_find(OBJECT(&s->cpu[i]), "has_el3")) {
+            object_property_set_bool(OBJECT(&s->cpu[i]), "has_el3",
+                                     false, &error_abort);

Does your SoC really not implement EL3 ?

I was facing a problem that QEMU crashed in our u-boot because it will execute a assembly code while running in EL3

So I disabled the EL3 in QEMU to avoid this problem

I would re-enable it once we remove this assembly code from our u-boot

Quoted 315 lines
Quoted 315 lines
hw/arm/axiado-soc.c new file +153 -0
+        }
+
+        if (!qdev_realize(DEVICE(&s->cpu[i]), NULL, errp)) {
+            return;
+        }
+    }
+
+    /* GIC */
+    qdev_prop_set_uint32(gicdev, "num-cpu", sc->num_cpus);
+    qdev_prop_set_uint32(gicdev, "num-irq",
+                         AX3000_NUM_IRQS + GIC_INTERNAL);
+
+    redist_region_count = qlist_new();
+    qlist_append_int(redist_region_count, sc->num_cpus);
+    qdev_prop_set_array(gicdev, "redist-region-count", redist_region_count);
+
+    if (!sysbus_realize(gicsbd, errp)) {
+        return;
+    }
+
+    sysbus_mmio_map(gicsbd, 0, AX3000_GIC_DIST_BASE);
+    sysbus_mmio_map(gicsbd, 1, AX3000_GIC_REDIST_BASE);
+
+    /*
+     * Wire the outputs from each CPU's generic timer and the GICv3
+     * maintenance interrupt signal to the appropriate GIC PPI inputs, and
+     * the GIC's IRQ/FIQ interrupt outputs to the CPU's inputs.
+     */
+    for (i = 0; i < sc->num_cpus; i++) {
+        DeviceState *cpudev = DEVICE(&s->cpu[i]);
+        int intidbase = AX3000_NUM_IRQS + i * GIC_INTERNAL;
+        qemu_irq irq;
+
+        /*
+         * Mapping from the output timer irq lines from the CPU to the
+         * GIC PPI inputs.
+         */
+        static const int timer_irqs[] = {
+            [GTIMER_PHYS] = ARCH_TIMER_NS_EL1_IRQ,
+            [GTIMER_VIRT] = ARCH_TIMER_VIRT_IRQ,
+            [GTIMER_HYP]  = ARCH_TIMER_NS_EL2_IRQ,
+            [GTIMER_SEC]  = ARCH_TIMER_S_EL1_IRQ
+        };
+
+        for (int j = 0; j < ARRAY_SIZE(timer_irqs); j++) {
+            irq = qdev_get_gpio_in(gicdev, intidbase + timer_irqs[j]);
+            qdev_connect_gpio_out(cpudev, j, irq);
+        }
+
+        irq = qdev_get_gpio_in(gicdev, intidbase + ARCH_GIC_MAINT_IRQ);
+        qdev_connect_gpio_out_named(cpudev, "gicv3-maintenance-interrupt",
+                                        0, irq);
+
+        sysbus_connect_irq(gicsbd, i,
+                           qdev_get_gpio_in(cpudev, ARM_CPU_IRQ));
+        sysbus_connect_irq(gicsbd, i + sc->num_cpus,
+                           qdev_get_gpio_in(cpudev, ARM_CPU_FIQ));
+        sysbus_connect_irq(gicsbd, i + 2 * sc->num_cpus,
+                           qdev_get_gpio_in(cpudev, ARM_CPU_VIRQ));
+        sysbus_connect_irq(gicsbd, i + 3 * sc->num_cpus,
+                           qdev_get_gpio_in(cpudev, ARM_CPU_VFIQ));
+    }
+
+    /* DRAM */
+    for (i = 0; i < AX3000_NUM_BANKS; i++) {
+        struct {
+            hwaddr addr;
+            size_t size;
+            const char *name;
+        } dram_table[] = {
+            { AX3000_DRAM0_BASE, AX3000_DRAM0_SIZE, "dram0" },
+            { AX3000_DRAM1_BASE, AX3000_DRAM1_SIZE, "dram1" }
+        };
+
+        memory_region_init_ram(&s->dram[i], OBJECT(s), dram_table[i].name,
+                               dram_table[i].size, &error_fatal);
+        memory_region_add_subregion(get_system_memory(), dram_table[i].addr,
+                                    &s->dram[i]);
+    }
+
+    /* UARTs */
+    for (i = 0; i < AX3000_NUM_UARTS; i++) {
+        struct {
+            hwaddr addr;
+            unsigned int irq;
+        } serial_table[] = {
+            { AX3000_UART0_BASE, AX3000_UART0_IRQ },
+            { AX3000_UART1_BASE, AX3000_UART1_IRQ },
+            { AX3000_UART2_BASE, AX3000_UART2_IRQ },
+            { AX3000_UART3_BASE, AX3000_UART3_IRQ }
+        };
+
+        qdev_prop_set_chr(DEVICE(&s->uart[i]), "chardev", serial_hd(i));
+        if (!sysbus_realize(SYS_BUS_DEVICE(&s->uart[i]), errp)) {
+            return;
+        }
+
+        sysbus_mmio_map(SYS_BUS_DEVICE(&s->uart[i]), 0, serial_table[i].addr);
+        sysbus_connect_irq(SYS_BUS_DEVICE(&s->uart[i]), 0,
+                           qdev_get_gpio_in(gicdev, serial_table[i].irq));
+    }
+
+    /* Timer control*/
+    memory_region_init_io(&s->timer_ctrl, OBJECT(s), &timer_ctrl_ops, s,
+                          "timer_ctrl", 32);
+    memory_region_add_subregion(get_system_memory(), AX3000_TIMER_CTRL,
+                                &s->timer_ctrl);
+
+    /* PLL control */
+    memory_region_init_io(&s->pll_ctrl, OBJECT(s), &pll_ops, s, "pll_ctrl",
+                          32);
+    memory_region_add_subregion(get_system_memory(), AX3000_PLL_BASE,
+                                &s->pll_ctrl);
+
+    /* SDHCI */
+    qdev_prop_set_uint64(DEVICE(&s->sdhci0), "capareg", 0x216737eed0b0);
+    qdev_prop_set_uint64(DEVICE(&s->sdhci0), "sd-spec-version", 3);
+
+    if (!sysbus_realize(SYS_BUS_DEVICE(&s->sdhci0), errp)) {
+        return;
+    }
+
+    sysbus_mmio_map(SYS_BUS_DEVICE(&s->sdhci0), 0, AX3000_SDHCI0_BASE);
+    sysbus_connect_irq(SYS_BUS_DEVICE(&s->sdhci0), 0,
+                       qdev_get_gpio_in(gicdev, AX3000_SDHCI0_IRQ));
+
+    memory_region_init_io(&s->sdhci_phy, OBJECT(s), &sdhci_phy_ops, s,
+                           "sdhci_phy", AX3000_SDHCI0_PHY_SIZE);
+    memory_region_add_subregion(get_system_memory(), AX3000_SDHCI0_PHY_BASE,
+                                &s->sdhci_phy);
+}
+
+static void ax3000_class_init(ObjectClass *oc, const void *data)
+{
+    DeviceClass *dc = DEVICE_CLASS(oc);
+    AxiadoSoCClass *sc = AXIADO_SOC_CLASS(oc);
+
+    dc->desc = "Axiado SoC AX3000";
+    dc->realize = ax3000_realize;
+    sc->num_cpus = AX3000_NUM_CPUS;
+}
+
+static const TypeInfo axiado_soc_types[] = {
+    {
+        .name           = TYPE_AXIADO_SOC,
+        .parent         = TYPE_SYS_BUS_DEVICE,
+        .instance_size  = sizeof(AxiadoSoCState),
+        .instance_init  = ax3000_init,
+        .class_init     = ax3000_class_init,
+    }
+};
+
+DEFINE_TYPES(axiado_soc_types)
hw/arm/meson.build +2 -0
index 47cdc51d13..c3c96c0a70 100644
@@ -105,6 +105,8 @@ arm_common_ss.add(when: 'CONFIG_STRONGARM', if_true: files('strongarm.c'))
  arm_common_ss.add(when: 'CONFIG_SX1', if_true: files('omap_sx1.c'))
  arm_common_ss.add(when: 'CONFIG_VERSATILE', if_true: files('versatilepb.c'))
  arm_common_ss.add(when: 'CONFIG_VEXPRESS', if_true: files('vexpress.c'))
+arm_common_ss.add(when: ['CONFIG_AXIADO_SOC', 'TARGET_AARCH64'], if_true: files(
+  'axiado-soc.c'))
 
  arm_common_ss.add(files('boot.c'))
 
include/hw/arm/axiado-soc.h new file +143 -0
new file mode 100644
index 0000000000..2483bdd8c2
@@ -0,0 +1,152 @@
+/*
+ * Axiado SoC AX3000
+ *
+ * Author: Kuan-Jui Chiu <[email protected]>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 or
+ * (at your option) version 3 of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef AXIADO_AX3000_H
+#define AXIADO_AX3000_H
+
+#include "cpu.h"
+#include "hw/intc/arm_gicv3_common.h"
+#include "hw/char/cadence_uart.h"
+#include "hw/sd/sdhci.h"
+#include "hw/core/sysbus.h"
+#include "qemu/units.h"
+
+#define TYPE_AXIADO_SOC "ax3000"
+OBJECT_DECLARE_TYPE(AxiadoSoCState, AxiadoSoCClass, AXIADO_SOC)
+
+#define AX3000_RAM_START        0x3C000000
+#define AX3000_RAM_SIZE_MAX     (16 * GiB)
+
+#define AX3000_DRAM0_BASE       AX3000_RAM_START
+#define AX3000_DRAM0_SIZE       (1088 * MiB)
+#define AX3000_DRAM1_BASE       0x400000000
+#define AX3000_DRAM1_SIZE       (2 * GiB)
+
+#define AX3000_GIC_DIST_BASE    0x80300000
+#define AX3000_GIC_DIST_SIZE    (64 * KiB)
+#define AX3000_GIC_REDIST_BASE  0x80380000
+#define AX3000_GIC_REDIST_SIZE  (512 * KiB)
+
+#define AX3000_UART0_BASE       0x80520000
+#define AX3000_UART0_SIZE       (256)
+#define AX3000_UART1_BASE       0x805a0000
+#define AX3000_UART1_SIZE       (256)
+#define AX3000_UART2_BASE       0x80620000
+#define AX3000_UART2_SIZE       (256)
+#define AX3000_UART3_BASE       0x80520800
+#define AX3000_UART3_SIZE       (256)
+
+#define AX3000_SDHCI0_BASE      0x86000000
+#define AX3000_SDHCI0_PHY_BASE  0x80801C00
+#define AX3000_SDHCI0_PHY_SIZE  (256)
+
+#define AX3000_GPIO0_BASE       0x80500000
+#define AX3000_GPIO0_SIZE       (1024)
+#define AX3000_GPIO1_BASE       0x80580000
+#define AX3000_GPIO1_SIZE       (1024)
+#define AX3000_GPIO2_BASE       0x80600000
+#define AX3000_GPIO2_SIZE       (1024)
+#define AX3000_GPIO3_BASE       0x80680000
+#define AX3000_GPIO3_SIZE       (1024)
+#define AX3000_GPIO4_BASE       0x80700000
+#define AX3000_GPIO4_SIZE       (1024)
+#define AX3000_GPIO5_BASE       0x80780000
+#define AX3000_GPIO5_SIZE       (1024)
+#define AX3000_GPIO6_BASE       0x80800000
+#define AX3000_GPIO6_SIZE       (1024)
+#define AX3000_GPIO7_BASE       0x80880000
+#define AX3000_GPIO7_SIZE       (1024)
+
+#define AX3000_TIMER_CTRL        0x8A020000
+#define AX3000_PLL_BASE          0x80000000
+#define CLKRST_CPU_PLL_POSTDIV_OFFSET   0x0C
+#define CLKRST_CPU_PLL_STS_OFFSET       0x14
+
+
+enum Ax3000Configuration {
+    AX3000_NUM_CPUS     = 4,
+    AX3000_NUM_IRQS     = 224,
+    AX3000_NUM_BANKS    = 2,
+    AX3000_NUM_UARTS    = 4,
+    AX3000_NUM_GPIOS    = 8,
+};
+
+typedef struct AxiadoSoCState {
+    SysBusDevice        parent;
+
+    ARMCPU              cpu[AX3000_NUM_CPUS];
+    GICv3State          gic;
+    MemoryRegion        dram[AX3000_NUM_BANKS];
+    MemoryRegion        timer_ctrl;
+    MemoryRegion        pll_ctrl;
+    CadenceUARTState    uart[AX3000_NUM_UARTS];
+    SDHCIState          sdhci0;
+    MemoryRegion        sdhci_phy;
+} AxiadoSoCState;
+
+typedef struct AxiadoSoCClass {
+    SysBusDeviceClass   parent;
+
+    uint32_t            num_cpus;
+} AxiadoSoCClass;
+
+enum Ax3000MemoryRegions {
+    AX3000_GIC_DIST,
+    AX3000_GIC_REDIST,
+    AX3000_DRAM0,
+    AX3000_DRAM1,
+    AX3000_UART0,
+    AX3000_UART1,
+    AX3000_UART2,
+    AX3000_UART3,
+    AX3000_SDHCI0,
+    AX3000_GPIO0,
+    AX3000_GPIO1,
+    AX3000_GPIO2,
+    AX3000_GPIO3,
+    AX3000_GPIO4,
+    AX3000_GPIO5,
+    AX3000_GPIO6,
+    AX3000_GPIO7,
+};
+
+enum Ax3000Irqs {
+    AX3000_UART0_IRQ    = 112,
+    AX3000_UART1_IRQ    = 113,
+    AX3000_UART2_IRQ    = 114,
+    AX3000_UART3_IRQ    = 170,
+
+    AX3000_SDHCI0_IRQ    = 123,
+
+    AX3000_GPIO0_IRQ    = 183,
+    AX3000_GPIO1_IRQ    = 184,
+    AX3000_GPIO2_IRQ    = 185,
+    AX3000_GPIO3_IRQ    = 186,
+    AX3000_GPIO4_IRQ    = 187,
+    AX3000_GPIO5_IRQ    = 188,
+    AX3000_GPIO6_IRQ    = 189,
Quoted 8 lines

include/hw/arm/axiado-soc.h line 149

Quoted 6 lines
include/hw/arm/axiado-soc.h new file +6 -0
+    AX3000_GPIO7_IRQ    = 190,
+};
+
+enum SDHCI_PHY_REG {
+    REG_ID        = 0x00,   // ID
+    REG_STATUS    = 0x50,   // READY/LOCK/CAL_DONE bits

Don't use C++ style // comments, please. checkpatch will warn about that too, I think.

No problem, I will fix them.

Quoted 7 lines
Quoted 5 lines
include/hw/arm/axiado-soc.h new file +3 -1
+};
+
+#endif /* AXIADO_AX3000_H */
--

2.34.1

thanks
-- PMM

#4 lore raw

PATCH 2/2 hw/arm: Add Axiado EVK board

In reply to Kuan-Jui Chiu

This patch adds a new model for Axiado SCM3003 EVK with Axiado SoC AX3000

---
 hw/arm/axiado-boards.c         | 78 ++++++++++++++++++++++++++++++++++
 hw/arm/axiado-evk.c            | 38 +++++++++++++++++
 hw/arm/meson.build             |  4 +-
 include/hw/arm/axiado-boards.h | 41 ++++++++++++++++++
 4 files changed, 160 insertions(+), 1 deletion(-)
 create mode 100644 hw/arm/axiado-boards.c
 create mode 100644 hw/arm/axiado-evk.c
 create mode 100644 include/hw/arm/axiado-boards.h
hw/arm/axiado-boards.c new file +78 -0
new file mode 100644
index 0000000000..802d2e5665
@@ -0,0 +1,78 @@
+/*
+ * Axiado Boards
+ *
+ * Author: Kuan-Jui Chiu <[email protected]>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 or
+ * (at your option) version 3 of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include "qemu/osdep.h"
+#include "hw/arm/axiado-boards.h"
+#include "hw/arm/machines-qom.h"
+#include "qemu/error-report.h"
+#include "qom/object.h"
+
+static void axiado_machine_init(MachineState *machine)
+{
+    AxiadoMachineState *ams = AXIADO_MACHINE(machine);
+    AxiadoMachineClass *amc = AXIADO_MACHINE_GET_CLASS(machine);
+
+    if (machine->ram_size > AX3000_RAM_SIZE_MAX) {
+        error_report("RAM size " RAM_ADDR_FMT " above max supported (%08" PRIx64 ")",
+                     machine->ram_size, AX3000_RAM_SIZE_MAX);
+        exit(1);
+    }
+
+    ams->soc = AXIADO_SOC(object_new(amc->soc_type));
+    object_property_add_child(OBJECT(machine), "soc", OBJECT(ams->soc));
+    sysbus_realize_and_unref(SYS_BUS_DEVICE(ams->soc), &error_fatal);
+
+    DeviceState *card = qdev_new(TYPE_SD_CARD);
+    DriveInfo *di = drive_get(IF_SD, 0, 0);
+    qdev_prop_set_drive_err(card, "drive", blk_by_legacy_dinfo(di), &error_fatal);
+    qdev_realize_and_unref(card, qdev_get_child_bus(DEVICE(&ams->soc->sdhci0),
+                           "sd-bus"), &error_fatal);
+}
+
+static const char *axiado_machine_get_default_cpu_type(const MachineState *ms)
+{
+    return ARM_CPU_TYPE_NAME("cortex-a53");
+}
+
+static void axiado_machine_class_init(ObjectClass *oc, const void *data)
+{
+    MachineClass *mc = MACHINE_CLASS(oc);
+    AxiadoMachineClass *amc = AXIADO_MACHINE_CLASS(oc);
+
+    mc->init = axiado_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 = axiado_machine_get_default_cpu_type;
+    amc->soc_type = TYPE_AXIADO_SOC;
+}
+
+static const TypeInfo axiado_machine_types[] = {
+    {
+        .name          = TYPE_AXIADO_MACHINE,
+        .parent        = TYPE_MACHINE,
+        .instance_size = sizeof(AxiadoMachineState),
+        .class_size    = sizeof(AxiadoMachineClass),
+        .class_init    = axiado_machine_class_init,
+        .interfaces    = aarch64_machine_interfaces,
+        .abstract      = true,
+    }
+};
+
+DEFINE_TYPES(axiado_machine_types)
hw/arm/axiado-evk.c new file +38 -0
new file mode 100644
index 0000000000..ddfb68d5c0
@@ -0,0 +1,38 @@
+/*
+ * Axiado Evaluation Kit Emulation
+ *
+ * Author: Kuan-Jui Chiu <[email protected]>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 or
+ * (at your option) version 3 of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include "qemu/osdep.h"
+#include "hw/arm/axiado-boards.h"
+
+static void axiado_scm3003_class_init(ObjectClass *oc, const void *data)
+{
+    MachineClass *mc = MACHINE_CLASS(oc);
+
+    mc->desc = "Axiado SCM3003 EVK Board";
+}
+
+static const TypeInfo axiado_evk_types[] = {
+    {
+        .name          = MACHINE_TYPE_NAME("axiado-scm3003"),
+        .parent        = TYPE_AXIADO_MACHINE,
+        .class_init    = axiado_scm3003_class_init,
+    }
+};
+
+DEFINE_TYPES(axiado_evk_types)
hw/arm/meson.build +3 -1
index c3c96c0a70..993a95d33a 100644
@@ -106,7 +106,9 @@ arm_common_ss.add(when: 'CONFIG_SX1', if_true: files('omap_sx1.c'))
 arm_common_ss.add(when: 'CONFIG_VERSATILE', if_true: files('versatilepb.c'))
 arm_common_ss.add(when: 'CONFIG_VEXPRESS', if_true: files('vexpress.c'))
 arm_common_ss.add(when: ['CONFIG_AXIADO_SOC', 'TARGET_AARCH64'], if_true: files(
-  'axiado-soc.c'))
+  'axiado-soc.c',
+  'axiado-boards.c',
+  'axiado-evk.c'))
 
 arm_common_ss.add(files('boot.c'))
 
include/hw/arm/axiado-boards.h new file +41 -0

41 lines not on this page · raw message

Signature · 1 line
2.34.1
#5 lore raw

Re: [PATCH v1 2/2] hw/arm: Add Axiado EVK board

Quoted 16 lines · Kuan-Jui Chiu

This patch adds a new model for Axiado SCM3003 EVK with Axiado SoC AX3000

---
 hw/arm/axiado-boards.c         | 78 ++++++++++++++++++++++++++++++++++
 hw/arm/axiado-evk.c            | 38 +++++++++++++++++
 hw/arm/meson.build             |  4 +-
 include/hw/arm/axiado-boards.h | 41 ++++++++++++++++++
 4 files changed, 160 insertions(+), 1 deletion(-)
 create mode 100644 hw/arm/axiado-boards.c
 create mode 100644 hw/arm/axiado-evk.c
 create mode 100644 include/hw/arm/axiado-boards.h
hw/arm/axiado-boards.c new file +1 -0
+static const TypeInfo axiado_machine_types[] = {

hw/arm/axiado-boards.c line 76

Quoted 10 lines
hw/arm/axiado-boards.c new file +10 -0
+    {
+        .name          = TYPE_AXIADO_MACHINE,
+        .parent        = TYPE_MACHINE,
+        .instance_size = sizeof(AxiadoMachineState),
+        .class_size    = sizeof(AxiadoMachineClass),
+        .class_init    = axiado_machine_class_init,
+        .interfaces    = aarch64_machine_interfaces,
+        .abstract      = true,
+    }
+};

Are we really going to have lots of Axiado machines such that we need all this machinery with an abstract base class? The simple thing is to define one machine that directly instantiates the SoC, etc.

hw/arm/meson.build arm_common_ss.add(when: 'CONFIG_SX1', if_true: files('omap_sx1.c')) · line 111

Quoted 13 lines
hw/arm/axiado-evk.c new file +1 -0
+DEFINE_TYPES(axiado_evk_types)
hw/arm/meson.build +3 -1
index c3c96c0a70..993a95d33a 100644
@@ -106,7 +106,9 @@ arm_common_ss.add(when: 'CONFIG_SX1', if_true: files('omap_sx1.c'))
 arm_common_ss.add(when: 'CONFIG_VERSATILE', if_true: files('versatilepb.c'))
 arm_common_ss.add(when: 'CONFIG_VEXPRESS', if_true: files('vexpress.c'))
 arm_common_ss.add(when: ['CONFIG_AXIADO_SOC', 'TARGET_AARCH64'], if_true: files(
-  'axiado-soc.c'))
+  'axiado-soc.c',
+  'axiado-boards.c',
+  'axiado-evk.c'))

Don't hook everything under a single KConfig symbol like this. You should generally speaking have separate Kconfig symbols for:
- each separate devices that is part of the SoC
- the SoC itself
- the board

and the Kconfig stanza for the board says it needs the SoC, the SoC says it needs all the devices, and so on. The way we do the various imx6 boards is an example of this.

thanks
-- PMM

#6 lore raw

Re: [PATCH v1 2/2] hw/arm: Add Axiado EVK board

Hi Peter

Please check my replies below

I will send v2 patch soon

If you still have concerns, please let me know

Peter Maydell 於 2026/4/9 下午 11:22 寫道:

Quoted 17 lines

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.

Quoted 13 lines · Kuan-Jui Chiu

This patch adds a new model for Axiado SCM3003 EVK with Axiado SoC AX3000

---
  hw/arm/axiado-boards.c         | 78 ++++++++++++++++++++++++++++++++++
  hw/arm/axiado-evk.c            | 38 +++++++++++++++++
  hw/arm/meson.build             |  4 +-
  include/hw/arm/axiado-boards.h | 41 ++++++++++++++++++
  4 files changed, 160 insertions(+), 1 deletion(-)

create mode 100644 hw/arm/axiado-boards.c create mode 100644 hw/arm/axiado-evk.c create mode 100644 include/hw/arm/axiado-boards.h

Quoted 15 lines

hw/arm/axiado-boards.c line 76

Quoted 11 lines
hw/arm/axiado-boards.c new file +11 -0
+static const TypeInfo axiado_machine_types[] = {
+    {
+        .name          = TYPE_AXIADO_MACHINE,
+        .parent        = TYPE_MACHINE,
+        .instance_size = sizeof(AxiadoMachineState),
+        .class_size    = sizeof(AxiadoMachineClass),
+        .class_init    = axiado_machine_class_init,
+        .interfaces    = aarch64_machine_interfaces,
+        .abstract      = true,
+    }
+};

Are we really going to have lots of Axiado machines such that we need all this machinery with an abstract base class? The simple thing is to define one machine that directly instantiates the SoC, etc.

Yes, I will create another axiado-scm3002 (maybe more) in future for our EVK support in QEMU

There are a little difference between these two EVKs

Quoted 19 lines

hw/arm/meson.build arm_common_ss.add(when: 'CONFIG_SX1', if_true: files('omap_sx1.c')) · line 111

Quoted 13 lines
hw/arm/axiado-evk.c new file +1 -0
+DEFINE_TYPES(axiado_evk_types)
hw/arm/meson.build +3 -1
index c3c96c0a70..993a95d33a 100644
@@ -106,7 +106,9 @@ arm_common_ss.add(when: 'CONFIG_SX1', if_true: files('omap_sx1.c'))
  arm_common_ss.add(when: 'CONFIG_VERSATILE', if_true: files('versatilepb.c'))
  arm_common_ss.add(when: 'CONFIG_VEXPRESS', if_true: files('vexpress.c'))
  arm_common_ss.add(when: ['CONFIG_AXIADO_SOC', 'TARGET_AARCH64'], if_true: files(
-  'axiado-soc.c'))
+  'axiado-soc.c',
+  'axiado-boards.c',
+  'axiado-evk.c'))

Don't hook everything under a single KConfig symbol like this. You should generally speaking have separate Kconfig symbols for:
- each separate devices that is part of the SoC
- the SoC itself
- the board

Quoted 3 lines

and the Kconfig stanza for the board says it needs the SoC, the SoC says it needs all the devices, and so on. The way we do the various imx6 boards is an example of this.

No problem, I will create two configs : one for Axiado SoCs, another for Axiado EVKs which select AXIADO_SOC by default

Quoted 2 lines

thanks
-- PMM

#7 lore raw
In reply to Kuan-Jui Chiu
Quoted 21 lines · Kuan-Jui Chiu

This patchset introduces Axiado SoC AX3000 and a EVK SCM3003 for emulation The model for Axiado SoC AX3000 supports
4 Cortex-A53 CPUs
Arm Generic Interrupt Controller v3
4 Cadence UARTs
1 SDHCI controller with PHY

Verified the machine "axiado-scm3003" with following command

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-github.wic,format=raw
Quoted 3 lines

Kuan-Jui Chiu (2):
hw/arm: Add Axiado SoC AX3000
hw/arm: Add Axiado EVK board

Hi; thanks for sending these patches; this is just a note to let you know that they are on my to-review queue, but it might take me a little longer than usual to get to them, because I will be prioritizing work for the 11.0 release (which goes into softfreeze tomorrow).

thanks
-- PMM