Skip to contentSkip to conversation

Add Axiado SoC AX3005 and EVB

PATCH New Kuan-Jui Chiu 1 participant 14 messages Nov 19

Subsystems (2)
lore
Share & tools
lore
#3 lore raw

PATCH v8 3/13 hw/arm/ax3000-soc: Enable BXRS support of CADENCE UART

In reply to Kuan-Jui Chiu

In order to access BXRS (RX FIFO Byte Status) register at runtime, set property brk-support of CADENCE UART to true

---
 hw/arm/ax3000-soc.c | 1 +
 1 file changed, 1 insertion(+)
hw/arm/ax3000-soc.c +1 -0
index ebe174fb97..7b96466860 100644
@@ -155,6 +155,7 @@ static void ax3000_realize(DeviceState *dev, Error **errp)
 
     for (int i = 0; i < AX3000_NUM_UARTS; i++) {
         qdev_prop_set_chr(DEVICE(&s->uart[i]), "chardev", serial_hd(i));
+        qdev_prop_set_bit(DEVICE(&s->uart[i]), "brk-support", true);
         if (!sysbus_realize(SYS_BUS_DEVICE(&s->uart[i]), errp)) {
             return;
         }
Signature · 1 line
2.34.1
#4 lore raw

PATCH v8 4/13 hw/arm: Rename ax3000-boards as axiado-boards

In reply to Kuan-Jui Chiu

Rename header file ax3000-boards.h as axiado-boards.h for sharing across different Axiado SoC series

---
 hw/arm/ax3000-boards.c                              | 2 +-
 hw/arm/ax3000-evk.c                                 | 2 +-
 include/hw/arm/{ax3000-boards.h => axiado-boards.h} | 0
 3 files changed, 2 insertions(+), 2 deletions(-)
 rename include/hw/arm/{ax3000-boards.h => axiado-boards.h} (100%)
hw/arm/ax3000-boards.c +1 -1
index dc98ee7b71..b4e7ec6f1c 100644
@@ -7,7 +7,7 @@
  */
 
 #include "qemu/osdep.h"
-#include "hw/arm/ax3000-boards.h"
+#include "hw/arm/axiado-boards.h"
 #include "hw/arm/boot.h"
 #include "qemu/error-report.h"
 #include "qom/object.h"
hw/arm/ax3000-evk.c +1 -1
index a170848871..f491de7521 100644
@@ -7,7 +7,7 @@
  */
 
 #include "qemu/osdep.h"
-#include "hw/arm/ax3000-boards.h"
+#include "hw/arm/axiado-boards.h"
 
 static void axiado_scm3003_class_init(ObjectClass *oc, const void *data)
 {
include/hw/arm/axiado-boards.h renamed from include/hw/arm/ax3000-boards.h +0 -0
similarity index 100%
rename from include/hw/arm/ax3000-boards.h
rename to include/hw/arm/axiado-boards.h
Signature · 1 line
2.34.1
#9 lore raw

PATCH v8 9/13 hw/arm/ax3000-soc: Revise variables accodring to QEMU idioms

In reply to Kuan-Jui Chiu

1. Change the first declaration of struct to parent_obj/parent_class
2. Remove unnecessary typedef since macros add it automatically

---
 include/hw/arm/ax3000-soc.h | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)
include/hw/arm/ax3000-soc.h +6 -6
index 4987ee3834..e09cd56c30 100644
@@ -60,8 +60,8 @@ enum Ax3000Configuration {
     AX3000_NUM_GPIOS    = 8,
 };
 
-typedef struct Ax3000SoCState {
-    SysBusDevice        parent;
+struct Ax3000SoCState {
+    SysBusDevice        parent_obj;
 
     ARMCPU              cpu[AX3000_NUM_CPUS];
     GICv3State          gic;
@@ -70,13 +70,13 @@ typedef struct Ax3000SoCState {
     CadenceUARTState    uart[AX3000_NUM_UARTS];
     CadenceGPIOState    gpio[AX3000_NUM_GPIOS];
     AxiadoSDHCIState    sdhci0;
-} Ax3000SoCState;
+};
 
-typedef struct Ax3000SoCClass {
-    SysBusDeviceClass   parent;
+struct Ax3000SoCClass {
+    SysBusDeviceClass   parent_class;
 
     uint32_t            num_cpus;
-} Ax3000SoCClass;
+};
 
 enum Ax3000Irqs {
     AX3000_UART0_IRQ    = 112,
Signature · 1 line
2.34.1
#8 lore raw

PATCH v8 8/13 hw/arm/ax3000-boards: Remove redundant pointer from struct

In reply to Kuan-Jui Chiu

Since ax3000-boards is bound with Ax3000 SoC, we don't need to have a pointer in struct for SoC type

This patch remove pointer soc from Ax3000MachineState and create instance in init() directly

---
 hw/arm/ax3000-boards.c         | 10 +++++-----
 include/hw/arm/axiado-boards.h |  1 -
 2 files changed, 5 insertions(+), 6 deletions(-)
hw/arm/ax3000-boards.c +5 -5
index 75e0aedb4d..3ca4a6f93a 100644
@@ -68,7 +68,7 @@ static struct arm_boot_info ax3000_binfo = {
 
 static void ax3000_machine_init(MachineState *machine)
 {
-    Ax3000MachineState *ams = AX3000_MACHINE(machine);
+    Ax3000SoCState *s;
 
     if (machine->ram_size != AX3000_DRAM_SIZE) {
         g_autofree char *size_str = size_to_str(AX3000_DRAM_SIZE);
@@ -77,12 +77,12 @@ static void ax3000_machine_init(MachineState *machine)
         exit(1);
     }
 
-    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);
+    s = AX3000_SOC(object_new_with_props(TYPE_AX3000_SOC, OBJECT(machine),
+                                         "soc", &error_fatal, NULL));
+    sysbus_realize_and_unref(SYS_BUS_DEVICE(s), &error_fatal);
 
     ax3000_binfo.ram_size = machine->ram_size;
-    arm_load_kernel(&ams->soc->cpu[0], machine, &ax3000_binfo);
+    arm_load_kernel(&s->cpu[0], machine, &ax3000_binfo);
 }
 
 static void ax3000_machine_class_init(ObjectClass *oc, const void *data)
include/hw/arm/axiado-boards.h +0 -1
index 4a632661e1..566f22cd96 100644
@@ -18,7 +18,6 @@ OBJECT_DECLARE_TYPE(Ax3000MachineState, Ax3000MachineClass, AX3000_MACHINE)
 typedef struct Ax3000MachineState {
     MachineState parent;
 
-    Ax3000SoCState *soc;
 } Ax3000MachineState;
 
 typedef struct Ax3000MachineClass {
Signature · 1 line
2.34.1
#10 lore raw

PATCH v8 10/13 hw/arm: Add Axiado SoC AX3005

In reply to Kuan-Jui Chiu

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

---
 MAINTAINERS                 |   3 +
 hw/arm/ax3005-soc.c         | 226 ++++++++++++++++++++++++++++++++++++
 hw/arm/meson.build          |   3 +-
 include/hw/arm/ax3005-soc.h | 102 ++++++++++++++++
 4 files changed, 333 insertions(+), 1 deletion(-)
 create mode 100644 hw/arm/ax3005-soc.c
 create mode 100644 include/hw/arm/ax3005-soc.h
MAINTAINERS +3 -0
index 15942aaba3..e5f37262cf 100644
@@ -1324,11 +1324,14 @@ F: rust/hw/char/pl011/
 
 Axiado SoCs and EVKs
 M: Kuan-Jui Chiu <[email protected]>
+M: Prasad Bolisetty <[email protected]>
 L: [email protected]
 S: Maintained
 F: hw/arm/ax3000*.c
+F: hw/arm/ax3005*.c
 F: hw/*/axiado*.c
 F: include/hw/arm/ax3000*.h
+F: include/hw/arm/ax3005*.h
 F: include/hw/*/axiado*.h
 
 AVR Machines
hw/arm/ax3005-soc.c new file +226 -0

226 lines not on this page · raw message

hw/arm/meson.build +2 -1
index f3c1b0e00f..f54aaffef2 100644
@@ -113,7 +113,8 @@ 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(
-  'ax3000-soc.c'))
+  'ax3000-soc.c',
+  'ax3005-soc.c'))
 arm_common_ss.add(when: ['CONFIG_AXIADO_EVK', 'TARGET_AARCH64'], if_true: files(
   'ax3000-boards.c',
   'ax3000-evk.c'))
include/hw/arm/ax3005-soc.h new file +102 -0

102 lines not on this page · raw message

Signature · 1 line
2.34.1
#5 lore raw

PATCH v8 5/13 hw/arm/ax3000: Specify SoC name in header and variable

In reply to Kuan-Jui Chiu
---
 hw/arm/ax3000-boards.c | 2 +-
 hw/arm/ax3000-evk.c    | 2 +-
 hw/arm/ax3000-soc.c    | 4 ++--
 3 files changed, 4 insertions(+), 4 deletions(-)
hw/arm/ax3000-boards.c +1 -1
index b4e7ec6f1c..b3ee6c4a69 100644
@@ -1,5 +1,5 @@
 /*
- * Axiado Boards
+ * Axiado Ax3000 Boards
  *
  * Author: Kuan-Jui Chiu <[email protected]>
  *
hw/arm/ax3000-evk.c +1 -1
index f491de7521..adcad2f340 100644
@@ -1,5 +1,5 @@
 /*
- * Axiado Evaluation Kit Emulation
+ * Axiado Ax3000 Evaluation Kit Emulation
  *
  * Author: Kuan-Jui Chiu <[email protected]>
  *
hw/arm/ax3000-soc.c +2 -2
index 7b96466860..37c938d942 100644
@@ -230,7 +230,7 @@ static void ax3000_class_init(ObjectClass *oc, const void *data)
     sc->num_cpus = AX3000_NUM_CPUS;
 }
 
-static const TypeInfo axiado_soc_types[] = {
+static const TypeInfo ax3000_soc_types[] = {
     {
         .name           = TYPE_AX3000_SOC,
         .parent         = TYPE_SYS_BUS_DEVICE,
@@ -241,4 +241,4 @@ static const TypeInfo axiado_soc_types[] = {
     }
 };
 
-DEFINE_TYPES(axiado_soc_types)
+DEFINE_TYPES(ax3000_soc_types)
Signature · 1 line
2.34.1
#11 lore raw

PATCH v8 11/13 hw/arm: Add Axiado Ax3005 EVB

In reply to Kuan-Jui Chiu

Add EVK ax3005-evb built with AX3005 SoC

---
 hw/arm/ax3005-evk.c            | 115 +++++++++++++++++++++++++++++++++
 hw/arm/meson.build             |   3 +-
 include/hw/arm/axiado-boards.h |   9 +++
 3 files changed, 126 insertions(+), 1 deletion(-)
 create mode 100644 hw/arm/ax3005-evk.c
hw/arm/ax3005-evk.c new file +115 -0
new file mode 100644
index 0000000000..0bc309f244
@@ -0,0 +1,115 @@
+/*
+ * Axiado Ax3005 Evaluation Kit Emulation
+ *
+ * Author: Kuan-Jui Chiu <[email protected]>
+ *
+ * SPDX-License-Identifier: GPL-2.0-or-later
+ */
+
+#include "qemu/osdep.h"
+#include <libfdt.h>
+#include "hw/arm/axiado-boards.h"
+#include "hw/arm/boot.h"
+#include "qemu/cutils.h"
+#include "qemu/error-report.h"
+#include "qom/object.h"
+#include "system/device_tree.h"
+
+#define RAMROFS_BASE     0x90000000
+#define RAMROFS_SIZE     (100 * MiB)
+
+/*
+ * Reserve the ramrofs window so that Linux keeps it out of the linear map and
+ * the phram driver can hand it to the guest as a block device.  Any ramrofs
+ * reservation the supplied DTB carries is replaced, so that the reservation
+ * cannot drift away from RAMROFS_BASE.
+ */
+static void ax3005_modify_dtb(const struct arm_boot_info *info, void *fdt)
+{
+    g_autofree char *nodename = NULL;
+    uint64_t reg[2];
+    char **node_path;
+    Error *err = NULL;
+    int offset;
+    int i;
+
+    node_path = qemu_fdt_node_unit_path(fdt, "ramrofs", &err);
+    if (err) {
+        error_report_err(err);
+        exit(1);
+    }
+    for (i = 0; node_path[i]; i++) {
+        qemu_fdt_nop_node(fdt, node_path[i]);
+    }
+    g_strfreev(node_path);
+
+    offset = fdt_path_offset(fdt, "/reserved-memory");
+    if (offset < 0) {
+        qemu_fdt_add_subnode(fdt, "/reserved-memory");
+        qemu_fdt_setprop_cell(fdt, "/reserved-memory", "#address-cells", 2);
+        qemu_fdt_setprop_cell(fdt, "/reserved-memory", "#size-cells", 2);
+        qemu_fdt_setprop(fdt, "/reserved-memory", "ranges", NULL, 0);
+    } else if (fdt_address_cells(fdt, offset) != 2 ||
+               fdt_size_cells(fdt, offset) != 2) {
+        error_report("/reserved-memory must use two address and size cells");
+        exit(1);
+    }
+
+    nodename = g_strdup_printf("/reserved-memory/ramrofs@%" HWADDR_PRIx,
+                               (hwaddr)RAMROFS_BASE);
+    reg[0] = cpu_to_be64(RAMROFS_BASE);
+    reg[1] = cpu_to_be64(RAMROFS_SIZE);
+
+    qemu_fdt_add_subnode(fdt, nodename);
+    qemu_fdt_setprop(fdt, nodename, "reg", reg, sizeof(reg));
+    qemu_fdt_setprop(fdt, nodename, "no-map", NULL, 0);
+}
+
+static struct arm_boot_info ax3005_binfo = {
+    .loader_start = AX3005_DRAM_BASE,
+    .board_id = -1,
+    .modify_dtb = ax3005_modify_dtb,
+};
+
+static void ax3005_evb_machine_init(MachineState *machine)
+{
+    Ax3005SoCState *s;
+
+    if (machine->ram_size != AX3005_DRAM_SIZE) {
+        g_autofree char *size_str = size_to_str(AX3005_DRAM_SIZE);
+
+        error_report("Invalid RAM size, should be %s", size_str);
+        exit(1);
+    }
+
+    s = AX3005_SOC(object_new_with_props(TYPE_AX3005_SOC, OBJECT(machine),
+                                         "soc", &error_fatal, NULL));
+    sysbus_realize_and_unref(SYS_BUS_DEVICE(s), &error_fatal);
+
+    ax3005_binfo.ram_size = machine->ram_size;
+    arm_load_kernel(&s->cpu[0], machine, &ax3005_binfo);
+}
+
+static void ax3005_evb_class_init(ObjectClass *oc, const void *data)
+{
+    MachineClass *mc = MACHINE_CLASS(oc);
+
+    mc->desc = "Axiado AX3005 Evaluation Board";
+    mc->init = ax3005_evb_machine_init;
+    mc->default_cpus = AX3005_NUM_CPUS;
+    mc->min_cpus = AX3005_NUM_CPUS;
+    mc->max_cpus = AX3005_NUM_CPUS;
+    mc->default_cpu_type = ARM_CPU_TYPE_NAME("cortex-a53");
+    mc->default_ram_size = AX3005_DRAM_SIZE;
+}
+
+static const TypeInfo ax3005_evk_types[] = {
+    {
+        .name          = TYPE_AX3005_MACHINE,
+        .parent        = TYPE_MACHINE,
+        .instance_size = sizeof(Ax3005MachineState),
+        .class_init    = ax3005_evb_class_init,
+    }
+};
+
+DEFINE_TYPES(ax3005_evk_types)
hw/arm/meson.build +2 -1
index f54aaffef2..434cabdfd0 100644
@@ -117,7 +117,8 @@ arm_common_ss.add(when: ['CONFIG_AXIADO_SOC', 'TARGET_AARCH64'], if_true: files(
   'ax3005-soc.c'))
 arm_common_ss.add(when: ['CONFIG_AXIADO_EVK', 'TARGET_AARCH64'], if_true: files(
   'ax3000-boards.c',
-  'ax3000-evk.c'))
+  'ax3000-evk.c',
+  'ax3005-evk.c'))
 
 arm_common_ss.add(files('boot.c'))
 
include/hw/arm/axiado-boards.h +9 -0
index 566f22cd96..0f2c586d40 100644
@@ -11,6 +11,7 @@
 
 #include "hw/core/boards.h"
 #include "hw/arm/ax3000-soc.h"
+#include "hw/arm/ax3005-soc.h"
 
 #define TYPE_AX3000_MACHINE       MACHINE_TYPE_NAME("ax3000")
 OBJECT_DECLARE_TYPE(Ax3000MachineState, Ax3000MachineClass, AX3000_MACHINE)
@@ -24,4 +25,12 @@ typedef struct Ax3000MachineClass {
     MachineClass parent;
 
 } Ax3000MachineClass;
+
+#define TYPE_AX3005_MACHINE       MACHINE_TYPE_NAME("ax3005-evb")
+OBJECT_DECLARE_SIMPLE_TYPE(Ax3005MachineState, AX3005_MACHINE)
+
+struct Ax3005MachineState {
+    MachineState parent;
+
+};
 #endif
Signature · 1 line
2.34.1
#6 lore raw

PATCH v8 6/13 hw/arm/ax3000-boards: Add memory guard

In reply to Kuan-Jui Chiu

Ax3000 SoC reserves 3136 MiB memory for access totally QEMU allows -m option to set the ram_size which would cause the inconsistent size issue while running in QMP

This patch adds a guard to check if ram_size is different from RAM size of SoC and setup the default_ram_size

---
 hw/arm/ax3000-boards.c      | 9 +++++++++
 include/hw/arm/ax3000-soc.h | 1 +
 2 files changed, 10 insertions(+)
hw/arm/ax3000-boards.c +9 -0
index b3ee6c4a69..bc1f818d74 100644
@@ -9,6 +9,7 @@
 #include "qemu/osdep.h"
 #include "hw/arm/axiado-boards.h"
 #include "hw/arm/boot.h"
+#include "qemu/cutils.h"
 #include "qemu/error-report.h"
 #include "qom/object.h"
 
@@ -21,6 +22,13 @@ static void ax3000_machine_init(MachineState *machine)
 {
     Ax3000MachineState *ams = AX3000_MACHINE(machine);
 
+    if (machine->ram_size != AX3000_DRAM_SIZE) {
+        g_autofree char *size_str = size_to_str(AX3000_DRAM_SIZE);
+
+        error_report("Invalid RAM size, should be %s", size_str);
+        exit(1);
+    }
+
     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);
@@ -38,6 +46,7 @@ static void ax3000_machine_class_init(ObjectClass *oc, const void *data)
     mc->min_cpus = AX3000_NUM_CPUS;
     mc->max_cpus = AX3000_NUM_CPUS;
     mc->default_cpu_type = ARM_CPU_TYPE_NAME("cortex-a53");
+    mc->default_ram_size = AX3000_DRAM_SIZE;
 }
 
 static const TypeInfo ax3000_machine_types[] = {
include/hw/arm/ax3000-soc.h +1 -0
index 344fcb6f3c..4987ee3834 100644
@@ -25,6 +25,7 @@ OBJECT_DECLARE_TYPE(Ax3000SoCState, Ax3000SoCClass, AX3000_SOC)
 #define AX3000_DRAM0_SIZE       (1088 * MiB)
 #define AX3000_DRAM1_BASE       0x400000000
 #define AX3000_DRAM1_SIZE       (2 * GiB)
+#define AX3000_DRAM_SIZE        (AX3000_DRAM0_SIZE + AX3000_DRAM1_SIZE)
 
 #define AX3000_GIC_DIST_BASE    0x80300000
 #define AX3000_GIC_DIST_SIZE    (64 * KiB)
Signature · 1 line
2.34.1
#0 lore raw

v8 cover Add Axiado SoC AX3005 and EVB

This patchset introduces Axiado SoC AX3005 and evaluation board for emulation The model for Axiado SoC AX3005 supports
4 Cortex-A53 CPUs
Arm Generic Interrupt Controller v3
9 Cadence UARTs
1 SDHCI controller with PHY
8 Cadence GPIOs

Refer Axiado website for more product information
https://axiado.com/products/

and minor changes for the compatibility with existing AX3000 SoC model

Test plan:
1. Verified the machine "ax3005-evb" with following command

qemu-system-aarch64 \
    -machine ax3005-evb \
    -device loader,file=bl31.bin,addr=0x88300000 \
    -device loader,file=tee-raw.bin,addr=0x88400000 \
    -device loader,file=u-boot.bin,addr=0x80000000 \
    -device loader,file=fitImage,addr=0x80100000 \
    -device loader,file=obmc-phosphor-image-evk-ax3005-qemu.squashfs-xz,addr=0x80B00000 \
    -device loader,cpu-num=0,addr=0x88300000 \
    -device loader,cpu-num=1,addr=0x88300000 \
    -device loader,cpu-num=2,addr=0x88300000 \
    -device loader,cpu-num=3,addr=0x88300000 \
    -nographic \
    -serial null \
    -serial null \
    -serial null \
    -serial mon:stdio \
    -drive if=sd,file=obmc-phosphor-image-evk-ax3005-qemu.wic.qcow2,format=qcow2

2. Run QEMU test suite
make check

Ok:                369
Fail:              0
Skipped:           22

make check-functional

Ok:                31
Fail:              0
Skipped:           6

Changes in v8:
1. Fix C0103 invalid-name error during check-functional test
2. Correct the file path of functional test in MAINTAINERS

Changes in v7:
1. Add patch ("hw/arm/ax3000-soc: Revise variables accodring to QEMU idioms") to revise the name of the first member in struct and remove redundant typedef keyword
2. Add Prasad Bolisetty into maintainer list
3. Fix typo

Changes in v6:
1. Drop patch ("hw/sd/axiado_sdhci: Add header guard") since it had been merged
2. Remove redundant machines-qom.h

Changes in v5:
1. Add patch ("hw/char/cadence_uart: Add BXRS register definition") to add BXRS register into CADENCE UART model and add new property to control this feature.
2. Drop patch ("hw/char/cadence_uart: Reserve MMIO with dynamic size")
3. Add patch ("hw/arm/ax3000-soc: Enable BXRS support of CADENCE UART") to enable BXRS support in Ax3000 SoC
4. Add patch ("hw/char/cadence_uart: Reduce the size of MMIO to 0x80") to

     change the MMIO size to 0x80 from 0x1000.

5. Add patch for Ax3000 SoC
("hw/arm/ax3000-boards: Add modify_dtb for discontiguous memory") to fix memory issue while -dtb option is applied
6. Add patch for Ax3000 SoC
("hw/arm/ax3000-boards: Remove redundant pointer from struct") to create SoC instance during init() and remove redundant pointer from struct
7. Add document for Axiado SoCs and EVKs
8. Add functional test for Axiado SoCs and EVKs

Changes in v4:
1. Add patch ("hw/char/cadence_uart: Reserve MMIO with dynamic size") which allow other models to revise the MMIO size of Cadence UART
2. Change the MMIO size of Cadence UART to 512 KiB in Ax3000/Ax3005 SoC to resolve the overlapping region issue
3. Add memory guard in Ax3000/Ax3005 EVK to check the memory size specified by -m option and set the default_ram_size to the RAM size supported by Axiado SoC

Changes in v3:
1. Remove patch ("hw/arm/ax3000-soc: Add missing class_size to TypeInfo") because it was fixed by commit 4f50d637e2 ("hw/arm/ax3000-soc: fix heap overflow from missing class_size")

Changes in v2:
1. Add patch "hw/arm/ax3000-soc: Add missing class_size to TypeInfo" to fix incorrect class size
2. Add missing class_size "Ax3005SoCClass" to ax3005_soc_types

Kuan-Jui Chiu (13):
hw/char/cadence_uart: Reduce the size of MMIO to 0x80 hw/char/cadence_uart: Add BXRS register definition hw/arm/ax3000-soc: Enable BXRS support of CADENCE UART hw/arm: Rename ax3000-boards as axiado-boards hw/arm/ax3000: Specify SoC name in header and variable hw/arm/ax3000-boards: Add memory guard hw/arm/ax3000-boards: Add modify_dtb for discontiguous memory hw/arm/ax3000-boards: Remove redundant pointer from struct hw/arm/ax3000-soc: Revise variables accodring to QEMU idioms hw/arm: Add Axiado SoC AX3005
hw/arm: Add Axiado Ax3005 EVB
docs/system/arm: Document Axiado boards tests/functional/aarch64: Add functional test for Axiado EVKs

 MAINTAINERS                                   |   6 +
 docs/system/arm/axiado.rst                    | 128 ++++++++++
 docs/system/target-arm.rst                    |   1 +
 hw/arm/ax3000-boards.c                        |  71 +++++-
 hw/arm/ax3000-evk.c                           |   4 +-
 hw/arm/ax3000-soc.c                           |   5 +-
 hw/arm/ax3005-evk.c                           | 115 +++++++++
 hw/arm/ax3005-soc.c                           | 226 ++++++++++++++++++
 hw/arm/meson.build                            |   6 +-
 hw/char/cadence_uart.c                        |  17 +-
 include/hw/arm/ax3000-soc.h                   |  13 +-
 include/hw/arm/ax3005-soc.h                   | 102 ++++++++
 .../arm/{ax3000-boards.h => axiado-boards.h}  |  10 +-
 include/hw/char/cadence_uart.h                |   4 +-
 tests/functional/aarch64/meson.build          |   4 +
 tests/functional/aarch64/test_ax3005_evb.py   | 140 +++++++++++
 .../functional/aarch64/test_axiado_scm3003.py |  62 +++++
 17 files changed, 889 insertions(+), 25 deletions(-)
 create mode 100644 docs/system/arm/axiado.rst
 create mode 100644 hw/arm/ax3005-evk.c
 create mode 100644 hw/arm/ax3005-soc.c
 create mode 100644 include/hw/arm/ax3005-soc.h
 rename include/hw/arm/{ax3000-boards.h => axiado-boards.h} (71%)
 create mode 100755 tests/functional/aarch64/test_ax3005_evb.py
 create mode 100755 tests/functional/aarch64/test_axiado_scm3003.py
Signature · 1 line
2.34.1
#1 lore raw

PATCH v8 1/13 hw/char/cadence_uart: Reduce the size of MMIO to 0x80

We don't need to reserve 4 KiB for MMIO since the last register implemented is R_TTRIG at address 0x44

This patch reduces the size of MMIO to 0x80 from 0x1000

---
 hw/char/cadence_uart.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
hw/char/cadence_uart.c +1 -1
index eff6a3c4d1..8e23a378c4 100644
@@ -559,7 +559,7 @@ static void cadence_uart_init(Object *obj)
     SysBusDevice *sbd = SYS_BUS_DEVICE(obj);
     CadenceUARTState *s = CADENCE_UART(obj);
 
-    memory_region_init_io(&s->iomem, obj, &uart_ops, s, "uart", 0x1000);
+    memory_region_init_io(&s->iomem, obj, &uart_ops, s, "uart", 0x80);
     sysbus_init_mmio(sbd, &s->iomem);
     sysbus_init_irq(sbd, &s->irq);
 
Signature · 1 line
2.34.1
#12 lore raw

PATCH v8 12/13 docs/system/arm: Document Axiado boards

In reply to Kuan-Jui Chiu
---
 MAINTAINERS                |   1 +
 docs/system/arm/axiado.rst | 128 +++++++++++++++++++++++++++++++++++++
 docs/system/target-arm.rst |   1 +
 3 files changed, 130 insertions(+)
 create mode 100644 docs/system/arm/axiado.rst
MAINTAINERS +1 -0
index e5f37262cf..53e15069ed 100644
@@ -1333,6 +1333,7 @@ F: hw/*/axiado*.c
 F: include/hw/arm/ax3000*.h
 F: include/hw/arm/ax3005*.h
 F: include/hw/*/axiado*.h
+F: docs/system/arm/axiado.rst
 
 AVR Machines
 -------------
docs/system/arm/axiado.rst new file +128 -0

128 lines not on this page · raw message

docs/system/target-arm.rst +1 -0
index 260cd7e4d6..1b038b41de 100644
@@ -80,6 +80,7 @@ Board-specific documentation
    arm/versatile
    arm/vexpress
    arm/aspeed
+   arm/axiado
    arm/bananapi_m2u.rst
    arm/b-l475e-iot01a.rst
    arm/sabrelite
Signature · 1 line
2.34.1
#7 lore raw

PATCH v8 7/13 hw/arm/ax3000-boards: Add modify_dtb for discontiguous memory

In reply to Kuan-Jui Chiu

Ax3000 SoC has two memory banks:
1. 0x3C000000 with 1088 MiB
2. 0x400000000 wit 2 GiB

When user boot kernel directly on axiado-scm3003 models, kernel would believe these memory are contiguous which cause the crash

This patch add modify_dtb callback to revise the memory block

---
 hw/arm/ax3000-boards.c | 48 ++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 48 insertions(+)
hw/arm/ax3000-boards.c +48 -0
index bc1f818d74..75e0aedb4d 100644
@@ -12,10 +12,58 @@
 #include "qemu/cutils.h"
 #include "qemu/error-report.h"
 #include "qom/object.h"
+#include "system/device_tree.h"
+
+/*
+ * arm_load_dtb() drops every /memory node found in the DTB and replaces them
+ * with a single node spanning [loader_start, loader_start + ram_size).  The
+ * AX3000 DRAM is split into two banks with the MMIO region in between, so the
+ * generated node would describe unbacked addresses as RAM.  Describe the banks
+ * ourselves instead.
+ */
+static void ax3000_modify_dtb(const struct arm_boot_info *info, void *fdt)
+{
+    g_autofree char *nodename = NULL;
+    uint64_t reg[AX3000_NUM_BANKS * 2];
+    char **node_path;
+    Error *err = NULL;
+    int i;
+
+    node_path = qemu_fdt_node_unit_path(fdt, "memory", &err);
+    if (err) {
+        error_report_err(err);
+        exit(1);
+    }
+    for (i = 0; node_path[i]; i++) {
+        if (g_str_has_prefix(node_path[i], "/memory")) {
+            qemu_fdt_nop_node(fdt, node_path[i]);
+        }
+    }
+    g_strfreev(node_path);
+
+    const struct {
+        hwaddr addr;
+        size_t size;
+    } dram_table[] = {
+        { AX3000_DRAM0_BASE, AX3000_DRAM0_SIZE},
+        { AX3000_DRAM1_BASE, AX3000_DRAM1_SIZE}
+    };
+
+    for (i = 0; i < AX3000_NUM_BANKS; i++) {
+        reg[i * 2] = cpu_to_be64(dram_table[i].addr);
+        reg[i * 2 + 1] = cpu_to_be64(dram_table[i].size);
+    }
+
+    nodename = g_strdup_printf("/memory@%" HWADDR_PRIx, dram_table[0].addr);
+    qemu_fdt_add_subnode(fdt, nodename);
+    qemu_fdt_setprop_string(fdt, nodename, "device_type", "memory");
+    qemu_fdt_setprop(fdt, nodename, "reg", reg, sizeof(reg));
+}
 
 static struct arm_boot_info ax3000_binfo = {
     .loader_start = AX3000_DRAM0_BASE,
     .board_id = -1,
+    .modify_dtb = ax3000_modify_dtb,
 };
 
 static void ax3000_machine_init(MachineState *machine)
Signature · 1 line
2.34.1
#2 lore raw

PATCH v8 2/13 hw/char/cadence_uart: Add BXRS register definition

In reply to Kuan-Jui Chiu

The RXBS (RX FIFO Byte Status) register at 0x48 is only exposed to the guest when the brk_support property is set, so the accessible size should be CADENCE_UART_R_MAX_BRK in that case and CADENCE_UART_R_MAX otherwise.

---
 hw/char/cadence_uart.c         | 15 ++++++++++++---
 include/hw/char/cadence_uart.h |  4 +++-
 2 files changed, 15 insertions(+), 4 deletions(-)
hw/char/cadence_uart.c +12 -3
index 8e23a378c4..8746a96619 100644
@@ -120,6 +120,13 @@
 #define R_PMIN     (0x3C/4)
 #define R_PWID     (0x40/4)
 #define R_TTRIG    (0x44/4)
+#define R_RXBS     (0x48/4)
+
+/* Number of registers reachable by the guest, depending on brk_support */
+static inline unsigned int uart_r_max(const CadenceUARTState *s)
+{
+    return s->brk_support ? CADENCE_UART_R_MAX_BRK : CADENCE_UART_R_MAX;
+}
 
 
 static void uart_update_status(CadenceUARTState *s)
@@ -424,7 +431,7 @@ static MemTxResult uart_write(void *opaque, hwaddr offset,
 
     DB_PRINT(" offset:%x data:%08x\n", (unsigned)offset, (unsigned)value);
     offset >>= 2;
-    if (offset >= CADENCE_UART_R_MAX) {
+    if (offset >= uart_r_max(s)) {
         return MEMTX_DECODE_ERROR;
     }
     switch (offset) {
@@ -492,7 +499,7 @@ static MemTxResult uart_read(void *opaque, hwaddr offset,
     }
 
     offset >>= 2;
-    if (offset >= CADENCE_UART_R_MAX) {
+    if (offset >= uart_r_max(s)) {
         return MEMTX_DECODE_ERROR;
     }
     if (offset == R_TX_RX) {
@@ -523,6 +530,7 @@ static void cadence_uart_reset_init(Object *obj, ResetType type)
     s->r[R_BRGR] = 0x0000028B;
     s->r[R_BDIV] = 0x0000000F;
     s->r[R_TTRIG] = 0x00000020;
+    s->r[R_RXBS] = 0;
 }
 
 static void cadence_uart_reset_hold(Object *obj, ResetType type)
@@ -603,7 +611,7 @@ static const VMStateDescription vmstate_cadence_uart = {
     .pre_load = cadence_uart_pre_load,
     .post_load = cadence_uart_post_load,
     .fields = (const VMStateField[]) {
-        VMSTATE_UINT32_ARRAY(r, CadenceUARTState, CADENCE_UART_R_MAX),
+        VMSTATE_UINT32_ARRAY(r, CadenceUARTState, CADENCE_UART_R_MAX_BRK),
         VMSTATE_UINT8_ARRAY(rx_fifo, CadenceUARTState,
                             CADENCE_UART_RX_FIFO_SIZE),
         VMSTATE_UINT8_ARRAY(tx_fifo, CadenceUARTState,
@@ -619,6 +627,7 @@ static const VMStateDescription vmstate_cadence_uart = {
 
 static const Property cadence_uart_properties[] = {
     DEFINE_PROP_CHR("chardev", CadenceUARTState, chr),
+    DEFINE_PROP_BOOL("brk-support", CadenceUARTState, brk_support, false),
 };
 
 static void cadence_uart_class_init(ObjectClass *klass, const void *data)
include/hw/char/cadence_uart.h +3 -1
index 751a751248..1d5fc7f328 100644
@@ -30,6 +30,7 @@
 #define CADENCE_UART_TX_FIFO_SIZE           16
 
 #define CADENCE_UART_R_MAX (0x48/4)
+#define CADENCE_UART_R_MAX_BRK (0x4C/4)
 
 #define TYPE_CADENCE_UART "cadence_uart"
 OBJECT_DECLARE_SIMPLE_TYPE(CadenceUARTState, CADENCE_UART)
@@ -40,7 +41,7 @@ struct CadenceUARTState {
 
     /*< public >*/
     MemoryRegion iomem;
-    uint32_t r[CADENCE_UART_R_MAX];
+    uint32_t r[CADENCE_UART_R_MAX_BRK];
     uint8_t rx_fifo[CADENCE_UART_RX_FIFO_SIZE];
     uint8_t tx_fifo[CADENCE_UART_TX_FIFO_SIZE];
     uint32_t rx_wpos;
@@ -51,6 +52,7 @@ struct CadenceUARTState {
     qemu_irq irq;
     QEMUTimer *fifo_trigger_handle;
     Clock *refclk;
+    bool brk_support;
 };
 
 #endif
Signature · 1 line
2.34.1
#13 lore raw

PATCH v8 13/13 tests/functional/aarch64: Add functional test for Axiado EVKs

In reply to Kuan-Jui Chiu

Introduce funtional test for boot process from the kernel to systemd

Add additional subtest to include ARM TrustedZone firmware into boot process for ax3005-evb model

---
 MAINTAINERS                                   |   2 +
 tests/functional/aarch64/meson.build          |   4 +
 tests/functional/aarch64/test_ax3005_evb.py   | 140 ++++++++++++++++++
 .../functional/aarch64/test_axiado_scm3003.py |  62 ++++++++
 4 files changed, 208 insertions(+)
 create mode 100755 tests/functional/aarch64/test_ax3005_evb.py
 create mode 100755 tests/functional/aarch64/test_axiado_scm3003.py
MAINTAINERS +2 -0
index 53e15069ed..297c8685d6 100644
@@ -1333,6 +1333,8 @@ F: hw/*/axiado*.c
 F: include/hw/arm/ax3000*.h
 F: include/hw/arm/ax3005*.h
 F: include/hw/*/axiado*.h
+F: tests/functional/aarch64/test_axiado_scm3003.py
+F: tests/functional/aarch64/test_ax3005_evb.py
 F: docs/system/arm/axiado.rst
 
 AVR Machines
tests/functional/aarch64/meson.build +4 -0
index f0881bed16..3e3d918486 100644
@@ -4,6 +4,8 @@ test_aarch64_timeouts = {
   'aspeed_ast2700a1' : 600,
   'aspeed_ast2700a2' : 600,
   'aspeed_ast2700fc' : 600,
+  'ax3005_evb' : 180,
+  'axiado_scm3003' : 240,
   'device_passthrough' : 720,
   'imx8mm_evk' : 240,
   'imx8mp_evk' : 240,
@@ -33,6 +35,8 @@ tests_aarch64_system_thorough = [
   'aspeed_ast2700a1',
   'aspeed_ast2700a2',
   'aspeed_ast2700fc',
+  'ax3005_evb',
+  'axiado_scm3003',
   'device_passthrough',
   'hotplug_pci',
   'imx8mm_evk',
tests/functional/aarch64/test_ax3005_evb.py new file +140 -0

140 lines not on this page · raw message

tests/functional/aarch64/test_axiado_scm3003.py new file +62 -0

62 lines not on this page · raw message

Signature · 1 line
2.34.1