Skip to contentSkip to conversation

Introduce AST27x0 multi-SoC machine

PATCH Superseded Steven Lee via 5 participants 27 messages Dec 25, 2024 – Jan 31, 2025

Subsystems (2)

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

cover Introduce AST27x0 multi-SoC machine

This patch series introduces full cores support for the AST27x0 SoC, along with necessary updates to the ASPEED AST27x0 SOC.

The AST27x0 SoC is a new family of ASPEED SoCs featuring 4 Cortex-A35 cores and 2 Cortex-M4 cores. This patch set adds the following updates:

1. Public API updates:
Modifies the sdhci_attach_drive and write_boot_rom functions to make them accessible for broader usage.

2. SoC memory updates:
Maps unimplemented devices in the AST27x0 memory space.

3. AST27x0 CM4 SoC integration:
Adds basic support for the AST27x0 CM4 SoC.

4. AST2700-FC machine:
Introduces a new AST2700-FC machine which supports emulating 4 cortex-a35 cores and 2 coretex-m4 cores.

5. Documentation:
Updates the ASPEED documentation to include usage of the new ast2700-fc machine.

This series has been tested using ASPEED SDK image by the following
IMGDIR=./
UBOOT_SIZE=$(stat --format=%s -L ${IMGDIR}/u-boot-nodtb.bin)

  $ UBOOT_SIZE=$(stat --format=%s -L ${IMGDIR}/u-boot-nodtb.bin)
  $ wget https://github.com/stevenlee7189/zephyr/releases/download/1.0.0/ast2700-ssp.elf
  $ wget https://github.com/stevenlee7189/zephyr/releases/download/1.0.0/ast2700-tsp.elf
  $ wget https://github.com/stevenlee7189/zephyr/releases/download/1.0.0/bl31.bin
  $ wget https://github.com/stevenlee7189/zephyr/releases/download/1.0.0/tee-raw.bin
  $ wget https://github.com/stevenlee7189/zephyr/releases/download/1.0.0/u-boot-nodtb.bin
  $ wget https://github.com/stevenlee7189/zephyr/releases/download/1.0.0/u-boot.dtb
  $ wget https://github.com/stevenlee7189/zephyr/releases/download/1.0.0/image-bmc.tar.zst
  $ tar --zstd -xvf image-bmc.tar.zst
  $ qemu-system-aarch64 -machine ast2700fc \
       -device loader,force-raw=on,addr=0x400000000,file=${IMGDIR}/u-boot-nodtb.bin \
       -device loader,force-raw=on,addr=$((0x400000000 + ${UBOOT_SIZE})),file=${IMGDIR}/u-boot.dtb \
       -device loader,force-raw=on,addr=0x430000000,file=${IMGDIR}/bl31.bin \
       -device loader,force-raw=on,addr=0x430080000,file=${IMGDIR}/tee-raw.bin \
       -device loader,file=${IMGDIR}/ast2700-ssp.elf,cpu-num=4 \
       -device loader,file=${IMGDIR}/ast2700-tsp.elf,cpu-num=5 \
       -device loader,cpu-num=0,addr=0x430000000 \
       -device loader,cpu-num=1,addr=0x430000000 \
       -device loader,cpu-num=2,addr=0x430000000 \
       -device loader,cpu-num=3,addr=0x430000000 \
       -m 1G \
       -drive file=image-bmc,if=mtd,format=raw \
       -serial pty -serial pty -serial pty \
       -S -nographic

char device redirected to /dev/pts/51 (label serial0) char device redirected to /dev/pts/52 (label serial1) char device redirected to /dev/pts/53 (label serial2)

  $ tio /dev/pts/51
  $ tio /dev/pts/52
  $ tio /dev/pts/53
  $ (qemu) c

Steven Lee (5):
aspeed: Make sdhci_attach_drive and write_boot_rom public
aspeed: ast27x0: Map unimplemented devices in SoC memory
aspeed: Introduce AST27x0 SoC with Cortex-M4 support
aspeed: Introduce ast2700-fc machine
docs: aspeed: Add ast2700-fc machine section

 docs/system/arm/aspeed.rst  |  50 ++++-
 hw/arm/aspeed.c             |   4 +-
 hw/arm/aspeed_ast27x0-cm4.c | 397 ++++++++++++++++++++++++++++++++++++
 hw/arm/aspeed_ast27x0-fc.c  | 211 +++++++++++++++++++
 hw/arm/aspeed_ast27x0.c     |  45 +++-
 hw/arm/meson.build          |   5 +-
 include/hw/arm/aspeed.h     |   6 +
 include/hw/arm/aspeed_soc.h |  41 ++++
 8 files changed, 747 insertions(+), 12 deletions(-)
 create mode 100644 hw/arm/aspeed_ast27x0-cm4.c
 create mode 100644 hw/arm/aspeed_ast27x0-fc.c

--
2.34.1

#1 lore raw

PATCH 1/5 aspeed: Make sdhci_attach_drive and write_boot_rom public

sdhci_attach_drive and write_boot_rom functions may be used by the aspeed machine supporting co-processors.

---
 hw/arm/aspeed.c         | 4 ++--
 include/hw/arm/aspeed.h | 6 ++++++
 2 files changed, 8 insertions(+), 2 deletions(-)
hw/arm/aspeed.c +2 -2
index a18d4ed1fb..62ac8b7206 100644
@@ -256,7 +256,7 @@ static void aspeed_reset_secondary(ARMCPU *cpu,
     cpu_set_pc(cs, info->smp_loader_start);
 }
 
-static void write_boot_rom(BlockBackend *blk, hwaddr addr, size_t rom_size,
+void write_boot_rom(BlockBackend *blk, hwaddr addr, size_t rom_size,
                            Error **errp)
 {
     g_autofree void *storage = NULL;
@@ -325,7 +325,7 @@ void aspeed_board_init_flashes(AspeedSMCState *s, const char *flashtype,
     }
 }
 
-static void sdhci_attach_drive(SDHCIState *sdhci, DriveInfo *dinfo, bool emmc,
+void sdhci_attach_drive(SDHCIState *sdhci, DriveInfo *dinfo, bool emmc,
                                bool boot_emmc)
 {
         DeviceState *card;
include/hw/arm/aspeed.h +6 -0
index cbeacb214c..bba224c357 100644
@@ -10,7 +10,9 @@
 #define ARM_ASPEED_H
 
 #include "hw/boards.h"
+#include "hw/sd/sdhci.h"
 #include "qom/object.h"
+#include "system/blockdev.h"
 
 typedef struct AspeedMachineState AspeedMachineState;
 
@@ -41,5 +43,9 @@ struct AspeedMachineClass {
     uint32_t uart_default;
 };
 
+void sdhci_attach_drive(SDHCIState *sdhci, DriveInfo *dinfo, bool emmc,
+                               bool boot_emmc);
+void write_boot_rom(BlockBackend *blk, hwaddr addr, size_t rom_size,
+                           Error **errp);
 
 #endif
Signature · 1 line
2.34.1
Reviewed-by on v1 1/5
#2 lore raw

Re: [PATCH 1/5] aspeed: Make sdhci_attach_drive and write_boot_rom public

Quoted 25 lines · Steven Lee via

sdhci_attach_drive and write_boot_rom functions may be used by the aspeed machine supporting co-processors.

---
  hw/arm/aspeed.c         | 4 ++--
  include/hw/arm/aspeed.h | 6 ++++++
  2 files changed, 8 insertions(+), 2 deletions(-)
include/hw/arm/aspeed.h +2 -0
index cbeacb214c..bba224c357 100644
@@ -10,7 +10,9 @@
  #define ARM_ASPEED_H
 
  #include "hw/boards.h"
+#include "hw/sd/sdhci.h"
  #include "qom/object.h"
+#include "system/blockdev.h"
 
  typedef struct AspeedMachineState AspeedMachineState;
 

include/hw/arm/aspeed.h struct AspeedMachineClass { · line 47

Quoted 5 lines
include/hw/arm/aspeed.h +2 -0
@@ -41,5 +43,9 @@ struct AspeedMachineClass {
      uint32_t uart_default;
  };
 
+void sdhci_attach_drive(SDHCIState *sdhci, DriveInfo *dinfo, bool emmc,
+                               bool boot_emmc);

Indent is off.

include/hw/arm/aspeed.h struct AspeedMachineClass { · line 49

Quoted 2 lines
include/hw/arm/aspeed.h +2 -0
+void write_boot_rom(BlockBackend *blk, hwaddr addr, size_t rom_size,
+                           Error **errp);

Ditto.

Pre-existing, functions taking Error as last argument should return a boolean indicating whether error occurred or not.

Fixing indentation:

#3 lore raw

RE: [PATCH 1/5] aspeed: Make sdhci_attach_drive and write_boot_rom public

Hi Philippe,

Quoted 51 lines

-----Original Message-----
From: Philippe Mathieu-Daudé <[email protected]>
Sent: Wednesday, December 25, 2024 7:28 PM
To: Steven Lee <[email protected]>; Cédric Le Goater <[email protected]>; Peter Maydell <[email protected]>; Troy Lee <[email protected]>; Jamin Lin <[email protected]>; Andrew Jeffery <[email protected]>; Joel Stanley <[email protected]>; open list:ASPEED BMCs <[email protected]>; open list:All patches CC here <[email protected]>
Cc: Troy Lee <[email protected]>; Yunlin Tang <[email protected]>
Subject: Re: [PATCH 1/5] aspeed: Make sdhci_attach_drive and write_boot_rom public

Quoted 25 lines · Steven Lee via

sdhci_attach_drive and write_boot_rom functions may be used by the aspeed machine supporting co-processors.

---
  hw/arm/aspeed.c         | 4 ++--
  include/hw/arm/aspeed.h | 6 ++++++
  2 files changed, 8 insertions(+), 2 deletions(-)
include/hw/arm/aspeed.h index renamed from include/hw/arm/aspeed.h +0 -0

cbeacb214c..bba224c357 100644

include/hw/arm/aspeed.h +2 -0
@@ -10,7 +10,9 @@
  #define ARM_ASPEED_H
 
  #include "hw/boards.h"
+#include "hw/sd/sdhci.h"
  #include "qom/object.h"
+#include "system/blockdev.h"
 
  typedef struct AspeedMachineState AspeedMachineState;
 

include/hw/arm/aspeed.h struct AspeedMachineClass { · line 47

Quoted 5 lines
include/hw/arm/aspeed.h +2 -0
@@ -41,5 +43,9 @@ struct AspeedMachineClass {
      uint32_t uart_default;
  };
 
+void sdhci_attach_drive(SDHCIState *sdhci, DriveInfo *dinfo, bool emmc,
+                               bool boot_emmc);

Indent is off.

include/hw/arm/aspeed.h struct AspeedMachineClass { · line 49

Quoted 2 lines
include/hw/arm/aspeed.h +2 -0
+void write_boot_rom(BlockBackend *blk, hwaddr addr, size_t rom_size,
+                           Error **errp);
Quoted 6 lines

Ditto.

Pre-existing, functions taking Error as last argument should return a boolean indicating whether error occurred or not.

Fixing indentation:

Thanks for review.
Will fix it.

Steven

Quoted 1 line
#4 lore raw

Re: [PATCH 1/5] aspeed: Make sdhci_attach_drive and write_boot_rom public

In reply to Steven Lee via
Quoted 2 lines · Steven Lee

sdhci_attach_drive and write_boot_rom functions may be used by the aspeed machine supporting co-processors.

I would move these routines to aspeed_soc_common.c file and rename them with an aspeed_ prefix.

Thanks,

C.

Quoted 52 lines
---
  hw/arm/aspeed.c         | 4 ++--
  include/hw/arm/aspeed.h | 6 ++++++
  2 files changed, 8 insertions(+), 2 deletions(-)
hw/arm/aspeed.c +2 -2
index a18d4ed1fb..62ac8b7206 100644
@@ -256,7 +256,7 @@ static void aspeed_reset_secondary(ARMCPU *cpu,
      cpu_set_pc(cs, info->smp_loader_start);
  }
 
-static void write_boot_rom(BlockBackend *blk, hwaddr addr, size_t rom_size,
+void write_boot_rom(BlockBackend *blk, hwaddr addr, size_t rom_size,
                             Error **errp)
  {
      g_autofree void *storage = NULL;
@@ -325,7 +325,7 @@ void aspeed_board_init_flashes(AspeedSMCState *s, const char *flashtype,
      }
  }
 
-static void sdhci_attach_drive(SDHCIState *sdhci, DriveInfo *dinfo, bool emmc,
+void sdhci_attach_drive(SDHCIState *sdhci, DriveInfo *dinfo, bool emmc,
                                 bool boot_emmc)
  {
          DeviceState *card;
include/hw/arm/aspeed.h +6 -0
index cbeacb214c..bba224c357 100644
@@ -10,7 +10,9 @@
  #define ARM_ASPEED_H
 
  #include "hw/boards.h"
+#include "hw/sd/sdhci.h"
  #include "qom/object.h"
+#include "system/blockdev.h"
 
  typedef struct AspeedMachineState AspeedMachineState;
 
@@ -41,5 +43,9 @@ struct AspeedMachineClass {
      uint32_t uart_default;
  };
 
+void sdhci_attach_drive(SDHCIState *sdhci, DriveInfo *dinfo, bool emmc,
+                               bool boot_emmc);
+void write_boot_rom(BlockBackend *blk, hwaddr addr, size_t rom_size,
+                           Error **errp);
 
  #endif
#5 lore raw

RE: [PATCH 1/5] aspeed: Make sdhci_attach_drive and write_boot_rom public

Hi Cédric,

Quoted 18 lines

-----Original Message-----
From: Cédric Le Goater <[email protected]>
Sent: Friday, December 27, 2024 3:57 PM
To: Steven Lee <[email protected]>; Peter Maydell <[email protected]>; Troy Lee <[email protected]>; Jamin Lin <[email protected]>; Andrew Jeffery <[email protected]>; Joel Stanley <[email protected]>; open list:ASPEED BMCs <[email protected]>; open list:All patches CC here <[email protected]>
Cc: Troy Lee <[email protected]>; Yunlin Tang <[email protected]>
Subject: Re: [PATCH 1/5] aspeed: Make sdhci_attach_drive and write_boot_rom public

Quoted 2 lines · Steven Lee

sdhci_attach_drive and write_boot_rom functions may be used by the aspeed machine supporting co-processors.

Quoted 7 lines

I would move these routines to aspeed_soc_common.c file and rename them with an aspeed_ prefix.

Thanks,

C.

Thanks for the review.
I will move them to aspeed_soc_common.c and add the 'aspeed_' prefix to these functions.

Regards,
Steven

Quoted 58 lines
Quoted 58 lines
---
  hw/arm/aspeed.c         | 4 ++--
  include/hw/arm/aspeed.h | 6 ++++++
  2 files changed, 8 insertions(+), 2 deletions(-)
hw/arm/aspeed.c index renamed from hw/arm/aspeed.c +0 -0

a18d4ed1fb..62ac8b7206 100644

hw/arm/aspeed.c +1 -1
@@ -256,7 +256,7 @@ static void aspeed_reset_secondary(ARMCPU *cpu,
      cpu_set_pc(cs, info->smp_loader_start);
  }
 
-static void write_boot_rom(BlockBackend *blk, hwaddr addr, size_t
 rom_size,
+void write_boot_rom(BlockBackend *blk, hwaddr addr, size_t rom_size,
                             Error **errp)
  {
      g_autofree void *storage = NULL; @@ -325,7 +325,7 @@ void
aspeed_board_init_flashes(AspeedSMCState *s, const char *flashtype,
      }

}

-static void sdhci_attach_drive(SDHCIState *sdhci, DriveInfo *dinfo, bool emmc,

hw/arm/aspeed.c +2 -0
+void sdhci_attach_drive(SDHCIState *sdhci, DriveInfo *dinfo, bool
+emmc,
                                 bool boot_emmc)
  {
          DeviceState *card;
include/hw/arm/aspeed.h index renamed from include/hw/arm/aspeed.h +0 -0

cbeacb214c..bba224c357 100644

include/hw/arm/aspeed.h +6 -0
@@ -10,7 +10,9 @@
  #define ARM_ASPEED_H
 
  #include "hw/boards.h"
+#include "hw/sd/sdhci.h"
  #include "qom/object.h"
+#include "system/blockdev.h"
 
  typedef struct AspeedMachineState AspeedMachineState;
 
@@ -41,5 +43,9 @@ struct AspeedMachineClass {
      uint32_t uart_default;
  };
 
+void sdhci_attach_drive(SDHCIState *sdhci, DriveInfo *dinfo, bool emmc,
+                               bool boot_emmc); void
+write_boot_rom(BlockBackend *blk, hwaddr addr, size_t rom_size,
+                           Error **errp);
 
  #endif
#6 lore raw

PATCH 3/5 aspeed: Introduce AST27x0 SoC with Cortex-M4 support

In reply to Steven Lee via

This initial module adds support for the AST27x0 SoC, which features four Cortex-A35 cores and two Cortex-M4 cores. The patch enables emulation of the Cortex-M4 cores, laying the groundwork for co-processor support.

---
 hw/arm/aspeed_ast27x0-cm4.c | 397 ++++++++++++++++++++++++++++++++++++
 hw/arm/meson.build          |   1 +
 include/hw/arm/aspeed_soc.h |  23 +++
 3 files changed, 421 insertions(+)
 create mode 100644 hw/arm/aspeed_ast27x0-cm4.c
hw/arm/aspeed_ast27x0-cm4.c new file +397 -0
new file mode 100644
index 0000000000..591e54f0a7
@@ -0,0 +1,397 @@
+/*
+ * ASPEED Ast27x0 CM4 SoC
+ *
+ * Copyright (C) 2024 ASPEED Technology Inc.
+ *
+ * This code is licensed under the GPL version 2 or later.  See
+ * the COPYING file in the top-level directory.
+ *
+ * Implementation extracted from the AST2600 and adapted for Ast10x0.
+ */
+
+#include "qemu/osdep.h"
+#include "qapi/error.h"
+#include "exec/address-spaces.h"
+#include "hw/qdev-clock.h"
+#include "hw/misc/unimp.h"
+#include "hw/arm/aspeed_soc.h"
+
+#define ASPEED_SOC_IOMEM_SIZE 0x00200000
+
+static const hwaddr aspeed_soc_ast27x0ssp_memmap[] = {
+    [ASPEED_DEV_SRAM]      =  0x00000000,
+    [ASPEED_DEV_INTC]      =  0x72100000,
+    [ASPEED_DEV_INTC0]     =  0x72102000,
+    [ASPEED_DEV_INTC1]     =  0x72102100,
+    [ASPEED_DEV_INTC2]     =  0x72102200,
+    [ASPEED_DEV_INTC3]     =  0x72102300,
+    [ASPEED_DEV_INTC4]     =  0x72102400,
+    [ASPEED_DEV_INTC5]     =  0x72102500,
+    [ASPEED_DEV_INTC6]     =  0x72102600,
+    [ASPEED_DEV_INTC7]     =  0x72102700,
+    [ASPEED_DEV_INTC8]     =  0x72102800,
+    [ASPEED_DEV_SCU]       =  0x72C02000,
+    [ASPEED_DEV_SCUIO]     =  0x74C02000,
+    [ASPEED_DEV_UART0]     =  0X74C33000,
+    [ASPEED_DEV_UART1]     =  0X74C33100,
+    [ASPEED_DEV_UART2]     =  0X74C33200,
+    [ASPEED_DEV_UART3]     =  0X74C33300,
+    [ASPEED_DEV_UART4]     =  0X72C1A000,
+    [ASPEED_DEV_IPC0]      =  0x72C1C000,
+    [ASPEED_DEV_IPC1]      =  0x72C1C200,
+    [ASPEED_DEV_IPC2]      =  0x72C1C800,
+    [ASPEED_DEV_UART5]     =  0X74C33400,
+    [ASPEED_DEV_UART6]     =  0X74C33500,
+    [ASPEED_DEV_UART7]     =  0X74C33600,
+    [ASPEED_DEV_UART8]     =  0X74C33700,
+    [ASPEED_DEV_UART9]     =  0X74C33800,
+    [ASPEED_DEV_UART10]    =  0X74C33900,
+    [ASPEED_DEV_UART11]    =  0X74C33A00,
+    [ASPEED_DEV_UART12]    =  0X74C33B00,
+    [ASPEED_DEV_TIMER1]    =  0x72C10000,
+};
+
+static const int aspeed_soc_ast27x0ssp_irqmap[] = {
+    [ASPEED_DEV_SCU]       = 12,
+    [ASPEED_DEV_UART0]     = 132,
+    [ASPEED_DEV_UART1]     = 132,
+    [ASPEED_DEV_UART2]     = 132,
+    [ASPEED_DEV_UART3]     = 132,
+    [ASPEED_DEV_UART4]     = 8,
+    [ASPEED_DEV_UART5]     = 132,
+    [ASPEED_DEV_UART6]     = 140,
+    [ASPEED_DEV_UART7]     = 132,
+    [ASPEED_DEV_UART8]     = 132,
+    [ASPEED_DEV_UART9]     = 132,
+    [ASPEED_DEV_UART10]    = 132,
+    [ASPEED_DEV_UART11]    = 132,
+    [ASPEED_DEV_UART12]    = 132,
+    [ASPEED_DEV_TIMER1]    = 16,
+};
+
+static const hwaddr aspeed_soc_ast27x0tsp_memmap[] = {
+    [ASPEED_DEV_SRAM]      =  0x00000000,
+    [ASPEED_DEV_INTC]      =  0x72100000,
+    [ASPEED_DEV_INTC0]     =  0x72103000,
+    [ASPEED_DEV_INTC1]     =  0x72103100,
+    [ASPEED_DEV_INTC2]     =  0x72103200,
+    [ASPEED_DEV_INTC3]     =  0x72103300,
+    [ASPEED_DEV_INTC4]     =  0x72103400,
+    [ASPEED_DEV_INTC5]     =  0x72103500,
+    [ASPEED_DEV_INTC6]     =  0x72103600,
+    [ASPEED_DEV_INTC7]     =  0x72103700,
+    [ASPEED_DEV_INTC8]     =  0x72103800,
+    [ASPEED_DEV_SCU]       =  0x72C02000,
+    [ASPEED_DEV_SCUIO]     =  0x74C02000,
+    [ASPEED_DEV_UART0]     =  0X74C33000,
+    [ASPEED_DEV_UART1]     =  0X74C33100,
+    [ASPEED_DEV_UART2]     =  0X74C33200,
+    [ASPEED_DEV_UART3]     =  0X74C33300,
+    [ASPEED_DEV_UART4]     =  0X72C1A000,
+    [ASPEED_DEV_IPC0]      =  0x72C1C400,
+    [ASPEED_DEV_IPC1]      =  0x72C1C600,
+    [ASPEED_DEV_IPC2]      =  0x72C1C800,
+    [ASPEED_DEV_UART5]     =  0X74C33400,
+    [ASPEED_DEV_UART6]     =  0X74C33500,
+    [ASPEED_DEV_UART7]     =  0X74C33600,
+    [ASPEED_DEV_UART8]     =  0X74C33700,
+    [ASPEED_DEV_UART9]     =  0X74C33800,
+    [ASPEED_DEV_UART10]    =  0X74C33900,
+    [ASPEED_DEV_UART11]    =  0X74C33A00,
+    [ASPEED_DEV_UART12]    =  0X74C33B00,
+    [ASPEED_DEV_TIMER1]    =  0x72C10000,
+};
+
+static const int aspeed_soc_ast27x0tsp_irqmap[] = {
+    [ASPEED_DEV_SCU]       = 12,
+    [ASPEED_DEV_UART0]     = 132,
+    [ASPEED_DEV_UART1]     = 132,
+    [ASPEED_DEV_UART2]     = 132,
+    [ASPEED_DEV_UART3]     = 132,
+    [ASPEED_DEV_UART4]     = 8,
+    [ASPEED_DEV_UART5]     = 132,
+    [ASPEED_DEV_UART6]     = 140,
+    [ASPEED_DEV_UART7]     = 132,
+    [ASPEED_DEV_UART8]     = 132,
+    [ASPEED_DEV_UART9]     = 132,
+    [ASPEED_DEV_UART10]    = 132,
+    [ASPEED_DEV_UART11]    = 132,
+    [ASPEED_DEV_UART12]    = 132,
+    [ASPEED_DEV_TIMER1]    = 16,
+};
+
+static qemu_irq aspeed_soc_ast27x0ssp_get_irq(AspeedSoCState *s, int dev)
+{
+    Aspeed27x0CM4SoCState *a = ASPEED27X0CM4_SOC(s);
+    AspeedSoCClass *sc = ASPEED_SOC_GET_CLASS(s);
+
+    return qdev_get_gpio_in(DEVICE(&a->armv7m), sc->irqmap[dev]);
+}
+
+static void aspeed_soc_ast27x0ssp_init(Object *obj)
+{
+    Aspeed27x0CM4SoCState *a = ASPEED27X0CM4_SOC(obj);
+    AspeedSoCState *s = ASPEED_SOC(obj);
+    AspeedSoCClass *sc = ASPEED_SOC_GET_CLASS(s);
+    char socname[8];
+    char typename[64];
+    int i;
+
+    if (sscanf(sc->name, "%7s", socname) != 1) {
+        g_assert_not_reached();
+    }
+
+    object_initialize_child(obj, "armv7m", &a->armv7m, TYPE_ARMV7M);
+
+    s->sysclk = qdev_init_clock_in(DEVICE(s), "sysclk", NULL, NULL, 0);
+
+    snprintf(typename, sizeof(typename), "aspeed.scu-%s", socname);
+    object_initialize_child(obj, "scu", &s->scu, typename);
+    qdev_prop_set_uint32(DEVICE(&s->scu), "silicon-rev", sc->silicon_rev);
+
+    for (i = 0; i < sc->uarts_num; i++) {
+        object_initialize_child(obj, "uart[*]", &s->uart[i], TYPE_SERIAL_MM);
+    }
+
+    object_initialize_child(obj, "timerctrl", &s->timerctrl,
+                            TYPE_UNIMPLEMENTED_DEVICE);
+    object_initialize_child(obj, "intc", &s->intc,
+                            TYPE_UNIMPLEMENTED_DEVICE);
+    object_initialize_child(obj, "ipc", &s->ipc,
+                            TYPE_UNIMPLEMENTED_DEVICE);
+}
+
+static void aspeed_soc_ast27x0ssp_realize(DeviceState *dev_soc, Error **errp)
+{
+    Aspeed27x0CM4SoCState *a = ASPEED27X0CM4_SOC(dev_soc);
+    AspeedSoCState *s = ASPEED_SOC(dev_soc);
+    AspeedSoCClass *sc = ASPEED_SOC_GET_CLASS(s);
+    DeviceState *armv7m;
+    Error *err = NULL;
+    g_autofree char *sram_name = NULL;
+
+    if (!clock_has_source(s->sysclk)) {
+        error_setg(errp, "sysclk clock must be wired up by the board code");
+        return;
+    }
+
+    /* AST27X0 SSP Core */
+    armv7m = DEVICE(&a->armv7m);
+    qdev_prop_set_uint32(armv7m, "num-irq", 256);
+    qdev_prop_set_string(armv7m, "cpu-type", aspeed_soc_cpu_type(sc));
+    qdev_connect_clock_in(armv7m, "cpuclk", s->sysclk);
+    object_property_set_link(OBJECT(&a->armv7m), "memory",
+                             OBJECT(s->memory), &error_abort);
+    sysbus_realize(SYS_BUS_DEVICE(&a->armv7m), &error_abort);
+
+    /* Internal SRAM */
+    sram_name = g_strdup_printf("aspeed.sram.%d",
+                                CPU(a->armv7m.cpu)->cpu_index);
+    memory_region_init_ram(&s->sram, OBJECT(s), sram_name, sc->sram_size, &err);
+    if (err != NULL) {
+        error_propagate(errp, err);
+        return;
+    }
+    memory_region_add_subregion(s->memory,
+                                sc->memmap[ASPEED_DEV_SRAM],
+                                &s->sram);
+
+    /* SCU */
+    if (!sysbus_realize(SYS_BUS_DEVICE(&s->scu), errp)) {
+        return;
+    }
+    aspeed_mmio_map(s, SYS_BUS_DEVICE(&s->scu), 0, sc->memmap[ASPEED_DEV_SCU]);
+
+    /* UART */
+    if (!aspeed_soc_uart_realize(s, errp)) {
+        return;
+    }
+
+    aspeed_mmio_map_unimplemented(s, SYS_BUS_DEVICE(&s->timerctrl),
+                                  "aspeed.timerctrl",
+                                  sc->memmap[ASPEED_DEV_TIMER1], 0x200);
+    aspeed_mmio_map_unimplemented(s, SYS_BUS_DEVICE(&s->intc),
+                                  "aspeed.intc",
+                                  sc->memmap[ASPEED_DEV_INTC], 0x4000);
+    aspeed_mmio_map_unimplemented(s, SYS_BUS_DEVICE(&s->ipc),
+                                  "aspeed.ipc",
+                                  sc->memmap[ASPEED_DEV_IPC0], 0x1000);
+}
+
+static void aspeed_soc_ast27x0ssp_class_init(ObjectClass *klass, void *data)
+{
+    static const char * const valid_cpu_types[] = {
+        ARM_CPU_TYPE_NAME("cortex-m4"), /* TODO cortex-m4f */
+        NULL
+    };
+    DeviceClass *dc = DEVICE_CLASS(klass);
+    AspeedSoCClass *sc = ASPEED_SOC_CLASS(dc);
+
+    /* Reason: The Aspeed SoC can only be instantiated from a board */
+    dc->user_creatable = false;
+    dc->realize = aspeed_soc_ast27x0ssp_realize;
+
+    sc->name = "ast2700ssp-a0";
+    sc->valid_cpu_types = valid_cpu_types;
+    sc->silicon_rev = AST2700_A0_SILICON_REV;
+    sc->sram_size = 0x1000000;
+    sc->spis_num = 0;
+    sc->ehcis_num = 0;
+    sc->wdts_num = 0;
+    sc->macs_num = 0;
+    sc->uarts_num = 13;
+    sc->uarts_base = ASPEED_DEV_UART0;
+    sc->irqmap = aspeed_soc_ast27x0ssp_irqmap;
+    sc->memmap = aspeed_soc_ast27x0ssp_memmap;
+    sc->num_cpus = 1;
+    sc->get_irq = aspeed_soc_ast27x0ssp_get_irq;
+}
+
+static qemu_irq aspeed_soc_ast27x0tsp_get_irq(AspeedSoCState *s, int dev)
+{
+    Aspeed27x0CM4SoCState *a = ASPEED27X0CM4_SOC(s);
+    AspeedSoCClass *sc = ASPEED_SOC_GET_CLASS(s);
+
+    return qdev_get_gpio_in(DEVICE(&a->armv7m), sc->irqmap[dev]);
+}
+
+static void aspeed_soc_ast27x0tsp_init(Object *obj)
+{
+    Aspeed27x0CM4SoCState *a = ASPEED27X0CM4_SOC(obj);
+    AspeedSoCState *s = ASPEED_SOC(obj);
+    AspeedSoCClass *sc = ASPEED_SOC_GET_CLASS(s);
+    char socname[8];
+    char typename[64];
+    int i;
+
+    if (sscanf(sc->name, "%7s", socname) != 1) {
+        g_assert_not_reached();
+    }
+
+    object_initialize_child(obj, "armv7m", &a->armv7m, TYPE_ARMV7M);
+
+    s->sysclk = qdev_init_clock_in(DEVICE(s), "sysclk", NULL, NULL, 0);
+
+    snprintf(typename, sizeof(typename), "aspeed.scu-%s", socname);
+    object_initialize_child(obj, "scu", &s->scu, typename);
+    qdev_prop_set_uint32(DEVICE(&s->scu), "silicon-rev", sc->silicon_rev);
+
+    for (i = 0; i < sc->uarts_num; i++) {
+        object_initialize_child(obj, "uart[*]", &s->uart[i], TYPE_SERIAL_MM);
+    }
+
+    object_initialize_child(obj, "timerctrl", &s->timerctrl,
+                            TYPE_UNIMPLEMENTED_DEVICE);
+    object_initialize_child(obj, "intc", &s->intc,
+                            TYPE_UNIMPLEMENTED_DEVICE);
+    object_initialize_child(obj, "ipc", &s->ipc,
+                            TYPE_UNIMPLEMENTED_DEVICE);
+}
+
+static void aspeed_soc_ast27x0tsp_realize(DeviceState *dev_soc, Error **errp)
+{
+    Aspeed27x0CM4SoCState *a = ASPEED27X0CM4_SOC(dev_soc);
+    AspeedSoCState *s = ASPEED_SOC(dev_soc);
+    AspeedSoCClass *sc = ASPEED_SOC_GET_CLASS(s);
+    DeviceState *armv7m;
+    Error *err = NULL;
+    g_autofree char *sram_name = NULL;
+
+    if (!clock_has_source(s->sysclk)) {
+        error_setg(errp, "sysclk clock must be wired up by the board code");
+        return;
+    }
+
+    /* AST27X0 TSP Core */
+    armv7m = DEVICE(&a->armv7m);
+    qdev_prop_set_uint32(armv7m, "num-irq", 256);
+    qdev_prop_set_string(armv7m, "cpu-type", aspeed_soc_cpu_type(sc));
+    qdev_connect_clock_in(armv7m, "cpuclk", s->sysclk);
+    object_property_set_link(OBJECT(&a->armv7m), "memory",
+                             OBJECT(s->memory), &error_abort);
+    sysbus_realize(SYS_BUS_DEVICE(&a->armv7m), &error_abort);
+
+    /* Internal SRAM */
+    sram_name = g_strdup_printf("aspeed.sram.%d",
+                                CPU(a->armv7m.cpu)->cpu_index);
+    memory_region_init_ram(&s->sram, OBJECT(s), sram_name, sc->sram_size, &err);
+    if (err != NULL) {
+        error_propagate(errp, err);
+        return;
+    }
+    memory_region_add_subregion(s->memory,
+                                sc->memmap[ASPEED_DEV_SRAM],
+                                &s->sram);
+
+    /* SCU */
+    if (!sysbus_realize(SYS_BUS_DEVICE(&s->scu), errp)) {
+        return;
+    }
+    aspeed_mmio_map(s, SYS_BUS_DEVICE(&s->scu), 0, sc->memmap[ASPEED_DEV_SCU]);
+
+    /* UART */
+    if (!aspeed_soc_uart_realize(s, errp)) {
+        return;
+    }
+
+    aspeed_mmio_map_unimplemented(s, SYS_BUS_DEVICE(&s->timerctrl),
+                                  "aspeed.timerctrl",
+                                  sc->memmap[ASPEED_DEV_TIMER1], 0x200);
+    aspeed_mmio_map_unimplemented(s, SYS_BUS_DEVICE(&s->intc),
+                                  "aspeed.intc",
+                                  sc->memmap[ASPEED_DEV_INTC], 0x4000);
+    aspeed_mmio_map_unimplemented(s, SYS_BUS_DEVICE(&s->ipc),
+                                  "aspeed.ipc",
+                                  sc->memmap[ASPEED_DEV_IPC0], 0x1000);
+}
+
+static void aspeed_soc_ast27x0tsp_class_init(ObjectClass *klass, void *data)
+{
+    static const char * const valid_cpu_types[] = {
+        ARM_CPU_TYPE_NAME("cortex-m4"), /* TODO cortex-m4f */
+        NULL
+    };
+    DeviceClass *dc = DEVICE_CLASS(klass);
+    AspeedSoCClass *sc = ASPEED_SOC_CLASS(dc);
+
+    /* Reason: The Aspeed SoC can only be instantiated from a board */
+    dc->user_creatable = false;
+    dc->realize = aspeed_soc_ast27x0tsp_realize;
+
+    sc->name = "ast2700tsp-a0";
+    sc->valid_cpu_types = valid_cpu_types;
+    sc->silicon_rev = AST2700_A0_SILICON_REV;
+    sc->sram_size = 0x1000000;
+    sc->spis_num = 0;
+    sc->ehcis_num = 0;
+    sc->wdts_num = 0;
+    sc->macs_num = 0;
+    sc->uarts_num = 13;
+    sc->uarts_base = ASPEED_DEV_UART0;
+    sc->irqmap = aspeed_soc_ast27x0tsp_irqmap;
+    sc->memmap = aspeed_soc_ast27x0tsp_memmap;
+    sc->num_cpus = 1;
+    sc->get_irq = aspeed_soc_ast27x0tsp_get_irq;
+}
+
+
+static const TypeInfo aspeed_soc_ast27x0cm4_types[] = {
+    {
+        .name           = TYPE_ASPEED27X0CM4_SOC,
+        .parent         = TYPE_ASPEED_SOC,
+        .instance_size  = sizeof(Aspeed27x0CM4SoCState),
+        .abstract       = true,
+    }, {
+        .name           = "ast2700ssp-a0",
+        .parent         = TYPE_ASPEED27X0CM4_SOC,
+        .instance_init  = aspeed_soc_ast27x0ssp_init,
+        .class_init     = aspeed_soc_ast27x0ssp_class_init,
+    }, {
+        .name           = "ast2700tsp-a0",
+        .parent         = TYPE_ASPEED27X0CM4_SOC,
+        .instance_init  = aspeed_soc_ast27x0tsp_init,
+        .class_init     = aspeed_soc_ast27x0tsp_class_init,
+    },
+};
+
+DEFINE_TYPES(aspeed_soc_ast27x0cm4_types)
hw/arm/meson.build +1 -0
index 490234b3b8..cd7780b997 100644
@@ -43,6 +43,7 @@ arm_ss.add(when: 'CONFIG_ASPEED_SOC', if_true: files(
   'aspeed_soc_common.c',
   'aspeed_ast2400.c',
   'aspeed_ast2600.c',
+  'aspeed_ast27x0-cm4.c',
   'aspeed_ast10x0.c',
   'aspeed_eeprom.c',
   'fby35.c'))
include/hw/arm/aspeed_soc.h +23 -0
index bf885da3fc..7de69dc57d 100644
@@ -101,6 +101,8 @@ struct AspeedSoCState {
     UnimplementedDeviceState sgpiom;
     UnimplementedDeviceState ltpi;
     UnimplementedDeviceState jtag[ASPEED_JTAG_NUM];
+    UnimplementedDeviceState intc;
+    UnimplementedDeviceState ipc;
     AspeedAPB2OPBState fsi[2];
 };
 
@@ -127,6 +129,15 @@ struct Aspeed2600SoCState {
 #define TYPE_ASPEED2600_SOC "aspeed2600-soc"
 OBJECT_DECLARE_SIMPLE_TYPE(Aspeed2600SoCState, ASPEED2600_SOC)
 
+struct Aspeed27x0CM4SoCState {
+    AspeedSoCState parent;
+
+    ARMv7MState armv7m;
+};
+
+#define TYPE_ASPEED27X0CM4_SOC "aspeed27x0cm4-soc"
+OBJECT_DECLARE_SIMPLE_TYPE(Aspeed27x0CM4SoCState, ASPEED27X0CM4_SOC)
+
 struct Aspeed27x0SoCState {
     AspeedSoCState parent;
 
@@ -201,6 +212,15 @@ enum {
     ASPEED_DEV_EHCI2,
     ASPEED_DEV_VIC,
     ASPEED_DEV_INTC,
+    ASPEED_DEV_INTC0,
+    ASPEED_DEV_INTC1,
+    ASPEED_DEV_INTC2,
+    ASPEED_DEV_INTC3,
+    ASPEED_DEV_INTC4,
+    ASPEED_DEV_INTC5,
+    ASPEED_DEV_INTC6,
+    ASPEED_DEV_INTC7,
+    ASPEED_DEV_INTC8,
     ASPEED_DEV_SDMC,
     ASPEED_DEV_SCU,
     ASPEED_DEV_ADC,
@@ -253,6 +273,9 @@ enum {
     ASPEED_DEV_SCUIO,
     ASPEED_DEV_SLI,
     ASPEED_DEV_SLIIO,
+    ASPEED_DEV_IPC0,
+    ASPEED_DEV_IPC1,
+    ASPEED_DEV_IPC2,
     ASPEED_GIC_DIST,
     ASPEED_GIC_REDIST,
 };
Signature · 1 line
2.34.1
#7 lore raw

Re: [PATCH 3/5] aspeed: Introduce AST27x0 SoC with Cortex-M4 support

Hello Steven,

Quoted 3 lines · Steven Lee

This initial module adds support for the AST27x0 SoC, which features four Cortex-A35 cores and two Cortex-M4 cores. The patch enables emulation of the Cortex-M4 cores, laying the groundwork for co-processor support.

These changes introduce implementation of 2 SoCs. Please split.

Quoted 15 lines
---
  hw/arm/aspeed_ast27x0-cm4.c | 397 ++++++++++++++++++++++++++++++++++++
  hw/arm/meson.build          |   1 +
  include/hw/arm/aspeed_soc.h |  23 +++
  3 files changed, 421 insertions(+)

create mode 100644 hw/arm/aspeed_ast27x0-cm4.c

hw/arm/aspeed_ast27x0-cm4.c new file +0 -0
new file mode 100644
index 0000000000..591e54f0a7

hw/arm/aspeed_ast27x0-cm4.c line 7

Quoted 7 lines
hw/arm/aspeed_ast27x0-cm4.c new file +7 -0
@@ -0,0 +1,397 @@
+/*
+ * ASPEED Ast27x0 CM4 SoC
+ *
+ * Copyright (C) 2024 ASPEED Technology Inc.
+ *
+ * This code is licensed under the GPL version 2 or later.  See
+ * the COPYING file in the top-level directory.

Please add an SPDX-License-Identifier tag in all new files.

Quoted 172 lines
hw/arm/aspeed_ast27x0-cm4.c new file +172 -0
+ *
+ * Implementation extracted from the AST2600 and adapted for Ast10x0.
+ */
+
+#include "qemu/osdep.h"
+#include "qapi/error.h"
+#include "exec/address-spaces.h"
+#include "hw/qdev-clock.h"
+#include "hw/misc/unimp.h"
+#include "hw/arm/aspeed_soc.h"
+
+#define ASPEED_SOC_IOMEM_SIZE 0x00200000
+
+static const hwaddr aspeed_soc_ast27x0ssp_memmap[] = {
+    [ASPEED_DEV_SRAM]      =  0x00000000,
+    [ASPEED_DEV_INTC]      =  0x72100000,
+    [ASPEED_DEV_INTC0]     =  0x72102000,
+    [ASPEED_DEV_INTC1]     =  0x72102100,
+    [ASPEED_DEV_INTC2]     =  0x72102200,
+    [ASPEED_DEV_INTC3]     =  0x72102300,
+    [ASPEED_DEV_INTC4]     =  0x72102400,
+    [ASPEED_DEV_INTC5]     =  0x72102500,
+    [ASPEED_DEV_INTC6]     =  0x72102600,
+    [ASPEED_DEV_INTC7]     =  0x72102700,
+    [ASPEED_DEV_INTC8]     =  0x72102800,
+    [ASPEED_DEV_SCU]       =  0x72C02000,
+    [ASPEED_DEV_SCUIO]     =  0x74C02000,
+    [ASPEED_DEV_UART0]     =  0X74C33000,
+    [ASPEED_DEV_UART1]     =  0X74C33100,
+    [ASPEED_DEV_UART2]     =  0X74C33200,
+    [ASPEED_DEV_UART3]     =  0X74C33300,
+    [ASPEED_DEV_UART4]     =  0X72C1A000,
+    [ASPEED_DEV_IPC0]      =  0x72C1C000,
+    [ASPEED_DEV_IPC1]      =  0x72C1C200,
+    [ASPEED_DEV_IPC2]      =  0x72C1C800,
+    [ASPEED_DEV_UART5]     =  0X74C33400,
+    [ASPEED_DEV_UART6]     =  0X74C33500,
+    [ASPEED_DEV_UART7]     =  0X74C33600,
+    [ASPEED_DEV_UART8]     =  0X74C33700,
+    [ASPEED_DEV_UART9]     =  0X74C33800,
+    [ASPEED_DEV_UART10]    =  0X74C33900,
+    [ASPEED_DEV_UART11]    =  0X74C33A00,
+    [ASPEED_DEV_UART12]    =  0X74C33B00,
+    [ASPEED_DEV_TIMER1]    =  0x72C10000,
+};
+
+static const int aspeed_soc_ast27x0ssp_irqmap[] = {
+    [ASPEED_DEV_SCU]       = 12,
+    [ASPEED_DEV_UART0]     = 132,
+    [ASPEED_DEV_UART1]     = 132,
+    [ASPEED_DEV_UART2]     = 132,
+    [ASPEED_DEV_UART3]     = 132,
+    [ASPEED_DEV_UART4]     = 8,
+    [ASPEED_DEV_UART5]     = 132,
+    [ASPEED_DEV_UART6]     = 140,
+    [ASPEED_DEV_UART7]     = 132,
+    [ASPEED_DEV_UART8]     = 132,
+    [ASPEED_DEV_UART9]     = 132,
+    [ASPEED_DEV_UART10]    = 132,
+    [ASPEED_DEV_UART11]    = 132,
+    [ASPEED_DEV_UART12]    = 132,
+    [ASPEED_DEV_TIMER1]    = 16,
+};
+
+static const hwaddr aspeed_soc_ast27x0tsp_memmap[] = {
+    [ASPEED_DEV_SRAM]      =  0x00000000,
+    [ASPEED_DEV_INTC]      =  0x72100000,
+    [ASPEED_DEV_INTC0]     =  0x72103000,
+    [ASPEED_DEV_INTC1]     =  0x72103100,
+    [ASPEED_DEV_INTC2]     =  0x72103200,
+    [ASPEED_DEV_INTC3]     =  0x72103300,
+    [ASPEED_DEV_INTC4]     =  0x72103400,
+    [ASPEED_DEV_INTC5]     =  0x72103500,
+    [ASPEED_DEV_INTC6]     =  0x72103600,
+    [ASPEED_DEV_INTC7]     =  0x72103700,
+    [ASPEED_DEV_INTC8]     =  0x72103800,
+    [ASPEED_DEV_SCU]       =  0x72C02000,
+    [ASPEED_DEV_SCUIO]     =  0x74C02000,
+    [ASPEED_DEV_UART0]     =  0X74C33000,
+    [ASPEED_DEV_UART1]     =  0X74C33100,
+    [ASPEED_DEV_UART2]     =  0X74C33200,
+    [ASPEED_DEV_UART3]     =  0X74C33300,
+    [ASPEED_DEV_UART4]     =  0X72C1A000,
+    [ASPEED_DEV_IPC0]      =  0x72C1C400,
+    [ASPEED_DEV_IPC1]      =  0x72C1C600,
+    [ASPEED_DEV_IPC2]      =  0x72C1C800,
+    [ASPEED_DEV_UART5]     =  0X74C33400,
+    [ASPEED_DEV_UART6]     =  0X74C33500,
+    [ASPEED_DEV_UART7]     =  0X74C33600,
+    [ASPEED_DEV_UART8]     =  0X74C33700,
+    [ASPEED_DEV_UART9]     =  0X74C33800,
+    [ASPEED_DEV_UART10]    =  0X74C33900,
+    [ASPEED_DEV_UART11]    =  0X74C33A00,
+    [ASPEED_DEV_UART12]    =  0X74C33B00,
+    [ASPEED_DEV_TIMER1]    =  0x72C10000,
+};
+
+static const int aspeed_soc_ast27x0tsp_irqmap[] = {
+    [ASPEED_DEV_SCU]       = 12,
+    [ASPEED_DEV_UART0]     = 132,
+    [ASPEED_DEV_UART1]     = 132,
+    [ASPEED_DEV_UART2]     = 132,
+    [ASPEED_DEV_UART3]     = 132,
+    [ASPEED_DEV_UART4]     = 8,
+    [ASPEED_DEV_UART5]     = 132,
+    [ASPEED_DEV_UART6]     = 140,
+    [ASPEED_DEV_UART7]     = 132,
+    [ASPEED_DEV_UART8]     = 132,
+    [ASPEED_DEV_UART9]     = 132,
+    [ASPEED_DEV_UART10]    = 132,
+    [ASPEED_DEV_UART11]    = 132,
+    [ASPEED_DEV_UART12]    = 132,
+    [ASPEED_DEV_TIMER1]    = 16,
+};
+
+static qemu_irq aspeed_soc_ast27x0ssp_get_irq(AspeedSoCState *s, int dev)
+{
+    Aspeed27x0CM4SoCState *a = ASPEED27X0CM4_SOC(s);
+    AspeedSoCClass *sc = ASPEED_SOC_GET_CLASS(s);
+
+    return qdev_get_gpio_in(DEVICE(&a->armv7m), sc->irqmap[dev]);
+}
+
+static void aspeed_soc_ast27x0ssp_init(Object *obj)
+{
+    Aspeed27x0CM4SoCState *a = ASPEED27X0CM4_SOC(obj);
+    AspeedSoCState *s = ASPEED_SOC(obj);
+    AspeedSoCClass *sc = ASPEED_SOC_GET_CLASS(s);
+    char socname[8];
+    char typename[64];
+    int i;
+
+    if (sscanf(sc->name, "%7s", socname) != 1) {
+        g_assert_not_reached();
+    }
+
+    object_initialize_child(obj, "armv7m", &a->armv7m, TYPE_ARMV7M);
+
+    s->sysclk = qdev_init_clock_in(DEVICE(s), "sysclk", NULL, NULL, 0);
+
+    snprintf(typename, sizeof(typename), "aspeed.scu-%s", socname);
+    object_initialize_child(obj, "scu", &s->scu, typename);
+    qdev_prop_set_uint32(DEVICE(&s->scu), "silicon-rev", sc->silicon_rev);
+> +    for (i = 0; i < sc->uarts_num; i++) {
+        object_initialize_child(obj, "uart[*]", &s->uart[i], TYPE_SERIAL_MM);
+    }
+
+    object_initialize_child(obj, "timerctrl", &s->timerctrl,
+                            TYPE_UNIMPLEMENTED_DEVICE);
+    object_initialize_child(obj, "intc", &s->intc,
+                            TYPE_UNIMPLEMENTED_DEVICE);
+    object_initialize_child(obj, "ipc", &s->ipc,
+                            TYPE_UNIMPLEMENTED_DEVICE);
+}
+
+static void aspeed_soc_ast27x0ssp_realize(DeviceState *dev_soc, Error **errp)
+{
+    Aspeed27x0CM4SoCState *a = ASPEED27X0CM4_SOC(dev_soc);
+    AspeedSoCState *s = ASPEED_SOC(dev_soc);
+    AspeedSoCClass *sc = ASPEED_SOC_GET_CLASS(s);
+    DeviceState *armv7m;
+    Error *err = NULL;
+    g_autofree char *sram_name = NULL;
+
+    if (!clock_has_source(s->sysclk)) {
+        error_setg(errp, "sysclk clock must be wired up by the board code");
+        return;
+    }
+
+    /* AST27X0 SSP Core */
+    armv7m = DEVICE(&a->armv7m);
+    qdev_prop_set_uint32(armv7m, "num-irq", 256);

hw/arm/aspeed_ast27x0-cm4.c line 190

Quoted 10 lines
hw/arm/aspeed_ast27x0-cm4.c new file +10 -0
+    qdev_prop_set_string(armv7m, "cpu-type", aspeed_soc_cpu_type(sc));
+    qdev_connect_clock_in(armv7m, "cpuclk", s->sysclk);
+    object_property_set_link(OBJECT(&a->armv7m), "memory",
+                             OBJECT(s->memory), &error_abort);
+    sysbus_realize(SYS_BUS_DEVICE(&a->armv7m), &error_abort);
+
+    /* Internal SRAM */
+    sram_name = g_strdup_printf("aspeed.sram.%d",
+                                CPU(a->armv7m.cpu)->cpu_index);
+    memory_region_init_ram(&s->sram, OBJECT(s), sram_name, sc->sram_size, &err);

This is better :

    if (!memory_region_init_ram(&s->sram, OBJECT(s), sram_name, sc->sram_size, errp)) {
           return
    }

and aspeed_soc_ast1030_realize() needs a fix too btw.

include/hw/arm/aspeed_soc.h

Quoted 220 lines
hw/arm/aspeed_ast27x0-cm4.c new file +207 -0
+    if (err != NULL) {
+        error_propagate(errp, err);
+        return;
+    }
+    memory_region_add_subregion(s->memory,
+                                sc->memmap[ASPEED_DEV_SRAM],
+                                &s->sram);
+
+    /* SCU */
+    if (!sysbus_realize(SYS_BUS_DEVICE(&s->scu), errp)) {
+        return;
+    }
+    aspeed_mmio_map(s, SYS_BUS_DEVICE(&s->scu), 0, sc->memmap[ASPEED_DEV_SCU]);
+
+    /* UART */
+    if (!aspeed_soc_uart_realize(s, errp)) {
+        return;
+    }
+
+    aspeed_mmio_map_unimplemented(s, SYS_BUS_DEVICE(&s->timerctrl),
+                                  "aspeed.timerctrl",
+                                  sc->memmap[ASPEED_DEV_TIMER1], 0x200);
+    aspeed_mmio_map_unimplemented(s, SYS_BUS_DEVICE(&s->intc),
+                                  "aspeed.intc",
+                                  sc->memmap[ASPEED_DEV_INTC], 0x4000);
+    aspeed_mmio_map_unimplemented(s, SYS_BUS_DEVICE(&s->ipc),
+                                  "aspeed.ipc",
+                                  sc->memmap[ASPEED_DEV_IPC0], 0x1000);
+}
+
+static void aspeed_soc_ast27x0ssp_class_init(ObjectClass *klass, void *data)
+{
+    static const char * const valid_cpu_types[] = {
+        ARM_CPU_TYPE_NAME("cortex-m4"), /* TODO cortex-m4f */
+        NULL
+    };
+    DeviceClass *dc = DEVICE_CLASS(klass);
+    AspeedSoCClass *sc = ASPEED_SOC_CLASS(dc);
+
+    /* Reason: The Aspeed SoC can only be instantiated from a board */
+    dc->user_creatable = false;
+    dc->realize = aspeed_soc_ast27x0ssp_realize;
+
+    sc->name = "ast2700ssp-a0";
+    sc->valid_cpu_types = valid_cpu_types;
+    sc->silicon_rev = AST2700_A0_SILICON_REV;
+    sc->sram_size = 0x1000000;
+    sc->spis_num = 0;
+    sc->ehcis_num = 0;
+    sc->wdts_num = 0;
+    sc->macs_num = 0;
+    sc->uarts_num = 13;
+    sc->uarts_base = ASPEED_DEV_UART0;
+    sc->irqmap = aspeed_soc_ast27x0ssp_irqmap;
+    sc->memmap = aspeed_soc_ast27x0ssp_memmap;
+    sc->num_cpus = 1;
+    sc->get_irq = aspeed_soc_ast27x0ssp_get_irq;
+}
+
+static qemu_irq aspeed_soc_ast27x0tsp_get_irq(AspeedSoCState *s, int dev)
+{
+    Aspeed27x0CM4SoCState *a = ASPEED27X0CM4_SOC(s);
+    AspeedSoCClass *sc = ASPEED_SOC_GET_CLASS(s);
+
+    return qdev_get_gpio_in(DEVICE(&a->armv7m), sc->irqmap[dev]);
+}
+
+static void aspeed_soc_ast27x0tsp_init(Object *obj)
+{
+    Aspeed27x0CM4SoCState *a = ASPEED27X0CM4_SOC(obj);
+    AspeedSoCState *s = ASPEED_SOC(obj);
+    AspeedSoCClass *sc = ASPEED_SOC_GET_CLASS(s);
+    char socname[8];
+    char typename[64];
+    int i;
+
+    if (sscanf(sc->name, "%7s", socname) != 1) {
+        g_assert_not_reached();
+    }
+
+    object_initialize_child(obj, "armv7m", &a->armv7m, TYPE_ARMV7M);
+
+    s->sysclk = qdev_init_clock_in(DEVICE(s), "sysclk", NULL, NULL, 0);
+
+    snprintf(typename, sizeof(typename), "aspeed.scu-%s", socname);
+    object_initialize_child(obj, "scu", &s->scu, typename);
+    qdev_prop_set_uint32(DEVICE(&s->scu), "silicon-rev", sc->silicon_rev);
+
+    for (i = 0; i < sc->uarts_num; i++) {
+        object_initialize_child(obj, "uart[*]", &s->uart[i], TYPE_SERIAL_MM);
+    }
+
+    object_initialize_child(obj, "timerctrl", &s->timerctrl,
+                            TYPE_UNIMPLEMENTED_DEVICE);
+    object_initialize_child(obj, "intc", &s->intc,
+                            TYPE_UNIMPLEMENTED_DEVICE);
+    object_initialize_child(obj, "ipc", &s->ipc,
+                            TYPE_UNIMPLEMENTED_DEVICE);
+}
+
+static void aspeed_soc_ast27x0tsp_realize(DeviceState *dev_soc, Error **errp)
+{
+    Aspeed27x0CM4SoCState *a = ASPEED27X0CM4_SOC(dev_soc);
+    AspeedSoCState *s = ASPEED_SOC(dev_soc);
+    AspeedSoCClass *sc = ASPEED_SOC_GET_CLASS(s);
+    DeviceState *armv7m;
+    Error *err = NULL;
+    g_autofree char *sram_name = NULL;
+
+    if (!clock_has_source(s->sysclk)) {
+        error_setg(errp, "sysclk clock must be wired up by the board code");
+        return;
+    }
+
+    /* AST27X0 TSP Core */
+    armv7m = DEVICE(&a->armv7m);
+    qdev_prop_set_uint32(armv7m, "num-irq", 256);
+    qdev_prop_set_string(armv7m, "cpu-type", aspeed_soc_cpu_type(sc));
+    qdev_connect_clock_in(armv7m, "cpuclk", s->sysclk);
+    object_property_set_link(OBJECT(&a->armv7m), "memory",
+                             OBJECT(s->memory), &error_abort);
+    sysbus_realize(SYS_BUS_DEVICE(&a->armv7m), &error_abort);
+
+    /* Internal SRAM */
+    sram_name = g_strdup_printf("aspeed.sram.%d",
+                                CPU(a->armv7m.cpu)->cpu_index);
+    memory_region_init_ram(&s->sram, OBJECT(s), sram_name, sc->sram_size, &err);
+    if (err != NULL) {
+        error_propagate(errp, err);
+        return;
+    }
+    memory_region_add_subregion(s->memory,
+                                sc->memmap[ASPEED_DEV_SRAM],
+                                &s->sram);
+
+    /* SCU */
+    if (!sysbus_realize(SYS_BUS_DEVICE(&s->scu), errp)) {
+        return;
+    }
+    aspeed_mmio_map(s, SYS_BUS_DEVICE(&s->scu), 0, sc->memmap[ASPEED_DEV_SCU]);
+
+    /* UART */
+    if (!aspeed_soc_uart_realize(s, errp)) {
+        return;
+    }
+
+    aspeed_mmio_map_unimplemented(s, SYS_BUS_DEVICE(&s->timerctrl),
+                                  "aspeed.timerctrl",
+                                  sc->memmap[ASPEED_DEV_TIMER1], 0x200);
+    aspeed_mmio_map_unimplemented(s, SYS_BUS_DEVICE(&s->intc),
+                                  "aspeed.intc",
+                                  sc->memmap[ASPEED_DEV_INTC], 0x4000);
+    aspeed_mmio_map_unimplemented(s, SYS_BUS_DEVICE(&s->ipc),
+                                  "aspeed.ipc",
+                                  sc->memmap[ASPEED_DEV_IPC0], 0x1000);
+}
+
+static void aspeed_soc_ast27x0tsp_class_init(ObjectClass *klass, void *data)
+{
+    static const char * const valid_cpu_types[] = {
+        ARM_CPU_TYPE_NAME("cortex-m4"), /* TODO cortex-m4f */
+        NULL
+    };
+    DeviceClass *dc = DEVICE_CLASS(klass);
+    AspeedSoCClass *sc = ASPEED_SOC_CLASS(dc);
+
+    /* Reason: The Aspeed SoC can only be instantiated from a board */
+    dc->user_creatable = false;
+    dc->realize = aspeed_soc_ast27x0tsp_realize;
+
+    sc->name = "ast2700tsp-a0";
+    sc->valid_cpu_types = valid_cpu_types;
+    sc->silicon_rev = AST2700_A0_SILICON_REV;
+    sc->sram_size = 0x1000000;
+    sc->spis_num = 0;
+    sc->ehcis_num = 0;
+    sc->wdts_num = 0;
+    sc->macs_num = 0;
+    sc->uarts_num = 13;
+    sc->uarts_base = ASPEED_DEV_UART0;
+    sc->irqmap = aspeed_soc_ast27x0tsp_irqmap;
+    sc->memmap = aspeed_soc_ast27x0tsp_memmap;
+    sc->num_cpus = 1;
+    sc->get_irq = aspeed_soc_ast27x0tsp_get_irq;
+}
+
+
+static const TypeInfo aspeed_soc_ast27x0cm4_types[] = {
+    {
+        .name           = TYPE_ASPEED27X0CM4_SOC,
+        .parent         = TYPE_ASPEED_SOC,
+        .instance_size  = sizeof(Aspeed27x0CM4SoCState),
+        .abstract       = true,
+    }, {
+        .name           = "ast2700ssp-a0",
+        .parent         = TYPE_ASPEED27X0CM4_SOC,
+        .instance_init  = aspeed_soc_ast27x0ssp_init,
+        .class_init     = aspeed_soc_ast27x0ssp_class_init,
+    }, {
+        .name           = "ast2700tsp-a0",
+        .parent         = TYPE_ASPEED27X0CM4_SOC,
+        .instance_init  = aspeed_soc_ast27x0tsp_init,
+        .class_init     = aspeed_soc_ast27x0tsp_class_init,
+    },
+};
+
+DEFINE_TYPES(aspeed_soc_ast27x0cm4_types)
hw/arm/meson.build +1 -0
index 490234b3b8..cd7780b997 100644
@@ -43,6 +43,7 @@ arm_ss.add(when: 'CONFIG_ASPEED_SOC', if_true: files(
    'aspeed_soc_common.c',
    'aspeed_ast2400.c',
    'aspeed_ast2600.c',
+  'aspeed_ast27x0-cm4.c',
    'aspeed_ast10x0.c',
    'aspeed_eeprom.c',
    'fby35.c'))
include/hw/arm/aspeed_soc.h +0 -0

Please to your ~/.gitconfig

[diff]
orderFile = /path/to/qemu/scripts/git.orderfile

include/hw/arm/aspeed_soc.h struct AspeedSoCState { · line 105

Quoted 9 lines

index bf885da3fc..7de69dc57d 100644

include/hw/arm/aspeed_soc.h +2 -0
@@ -101,6 +101,8 @@ struct AspeedSoCState {
      UnimplementedDeviceState sgpiom;
      UnimplementedDeviceState ltpi;
      UnimplementedDeviceState jtag[ASPEED_JTAG_NUM];
+    UnimplementedDeviceState intc;
+    UnimplementedDeviceState ipc;

Shouldn't these 2 new attributes be moved to Aspeed27x0CM4SoCState ? I think each should be introduced in a separate patch with a small description.

include/hw/arm/aspeed_soc.h struct Aspeed2600SoCState { · line 135

Quoted 11 lines
include/hw/arm/aspeed_soc.h +4 -0
      AspeedAPB2OPBState fsi[2];
  };
 
@@ -127,6 +129,15 @@ struct Aspeed2600SoCState {
  #define TYPE_ASPEED2600_SOC "aspeed2600-soc"
  OBJECT_DECLARE_SIMPLE_TYPE(Aspeed2600SoCState, ASPEED2600_SOC)
 
+struct Aspeed27x0CM4SoCState {
+    AspeedSoCState parent;
+
+    ARMv7MState armv7m;

Why not use Aspeed10x0SoCState instead ?

Thanks,

C.

Quoted 34 lines
include/hw/arm/aspeed_soc.h +17 -0
+};
+
+#define TYPE_ASPEED27X0CM4_SOC "aspeed27x0cm4-soc"
+OBJECT_DECLARE_SIMPLE_TYPE(Aspeed27x0CM4SoCState, ASPEED27X0CM4_SOC)
+
  struct Aspeed27x0SoCState {
      AspeedSoCState parent;
 
@@ -201,6 +212,15 @@ enum {
      ASPEED_DEV_EHCI2,
      ASPEED_DEV_VIC,
      ASPEED_DEV_INTC,
+    ASPEED_DEV_INTC0,
+    ASPEED_DEV_INTC1,
+    ASPEED_DEV_INTC2,
+    ASPEED_DEV_INTC3,
+    ASPEED_DEV_INTC4,
+    ASPEED_DEV_INTC5,
+    ASPEED_DEV_INTC6,
+    ASPEED_DEV_INTC7,
+    ASPEED_DEV_INTC8,
      ASPEED_DEV_SDMC,
      ASPEED_DEV_SCU,
      ASPEED_DEV_ADC,
@@ -253,6 +273,9 @@ enum {
      ASPEED_DEV_SCUIO,
      ASPEED_DEV_SLI,
      ASPEED_DEV_SLIIO,
+    ASPEED_DEV_IPC0,
+    ASPEED_DEV_IPC1,
+    ASPEED_DEV_IPC2,
      ASPEED_GIC_DIST,
      ASPEED_GIC_REDIST,
  };
#8 lore raw

RE: [PATCH 3/5] aspeed: Introduce AST27x0 SoC with Cortex-M4 support

Hi Cédric,

Quoted 16 lines

-----Original Message-----
From: Cédric Le Goater <[email protected]>
Sent: Thursday, January 2, 2025 4:29 PM
To: Steven Lee <[email protected]>; Peter Maydell <[email protected]>; Troy Lee <[email protected]>; Jamin Lin <[email protected]>; Andrew Jeffery <[email protected]>; Joel Stanley <[email protected]>; open list:ASPEED BMCs <[email protected]>; open list:All patches CC here <[email protected]>
Cc: Troy Lee <[email protected]>; Yunlin Tang <[email protected]>
Subject: Re: [PATCH 3/5] aspeed: Introduce AST27x0 SoC with Cortex-M4 support

Hello Steven,

Quoted 8 lines
Quoted 3 lines · Steven Lee

This initial module adds support for the AST27x0 SoC, which features four Cortex-A35 cores and two Cortex-M4 cores. The patch enables emulation of the Cortex-M4 cores, laying the groundwork for co-processor

support.

These changes introduce implementation of 2 SoCs. Please split.

Thanks for the review, I will split the patch.

Quoted 10 lines
Quoted 4 lines
---
  hw/arm/aspeed_ast27x0-cm4.c | 397

++++++++++++++++++++++++++++++++++++

Quoted 5 lines
  hw/arm/meson.build          |   1 +
  include/hw/arm/aspeed_soc.h |  23 +++
  3 files changed, 421 insertions(+)

create mode 100644 hw/arm/aspeed_ast27x0-cm4.c

Quoted 15 lines

hw/arm/aspeed_ast27x0-cm4.c line 7

Quoted 12 lines
hw/arm/aspeed_ast27x0-cm4.c new file +7 -0
new file mode 100644 index 0000000000..591e54f0a7
@@ -0,0 +1,397 @@
+/*
+ * ASPEED Ast27x0 CM4 SoC
+ *
+ * Copyright (C) 2024 ASPEED Technology Inc.
+ *
+ * This code is licensed under the GPL version 2 or later.  See
+ * the COPYING file in the top-level directory.

Please add an SPDX-License-Identifier tag in all new files.

Will add SPDX tag

Quoted 187 lines
Quoted 135 lines
hw/arm/aspeed_ast27x0-cm4.c new file +135 -0
+ *
+ * Implementation extracted from the AST2600 and adapted for Ast10x0.
+ */
+
+#include "qemu/osdep.h"
+#include "qapi/error.h"
+#include "exec/address-spaces.h"
+#include "hw/qdev-clock.h"
+#include "hw/misc/unimp.h"
+#include "hw/arm/aspeed_soc.h"
+
+#define ASPEED_SOC_IOMEM_SIZE 0x00200000
+
+static const hwaddr aspeed_soc_ast27x0ssp_memmap[] = {
+    [ASPEED_DEV_SRAM]      =  0x00000000,
+    [ASPEED_DEV_INTC]      =  0x72100000,
+    [ASPEED_DEV_INTC0]     =  0x72102000,
+    [ASPEED_DEV_INTC1]     =  0x72102100,
+    [ASPEED_DEV_INTC2]     =  0x72102200,
+    [ASPEED_DEV_INTC3]     =  0x72102300,
+    [ASPEED_DEV_INTC4]     =  0x72102400,
+    [ASPEED_DEV_INTC5]     =  0x72102500,
+    [ASPEED_DEV_INTC6]     =  0x72102600,
+    [ASPEED_DEV_INTC7]     =  0x72102700,
+    [ASPEED_DEV_INTC8]     =  0x72102800,
+    [ASPEED_DEV_SCU]       =  0x72C02000,
+    [ASPEED_DEV_SCUIO]     =  0x74C02000,
+    [ASPEED_DEV_UART0]     =  0X74C33000,
+    [ASPEED_DEV_UART1]     =  0X74C33100,
+    [ASPEED_DEV_UART2]     =  0X74C33200,
+    [ASPEED_DEV_UART3]     =  0X74C33300,
+    [ASPEED_DEV_UART4]     =  0X72C1A000,
+    [ASPEED_DEV_IPC0]      =  0x72C1C000,
+    [ASPEED_DEV_IPC1]      =  0x72C1C200,
+    [ASPEED_DEV_IPC2]      =  0x72C1C800,
+    [ASPEED_DEV_UART5]     =  0X74C33400,
+    [ASPEED_DEV_UART6]     =  0X74C33500,
+    [ASPEED_DEV_UART7]     =  0X74C33600,
+    [ASPEED_DEV_UART8]     =  0X74C33700,
+    [ASPEED_DEV_UART9]     =  0X74C33800,
+    [ASPEED_DEV_UART10]    =  0X74C33900,
+    [ASPEED_DEV_UART11]    =  0X74C33A00,
+    [ASPEED_DEV_UART12]    =  0X74C33B00,
+    [ASPEED_DEV_TIMER1]    =  0x72C10000,
+};
+
+static const int aspeed_soc_ast27x0ssp_irqmap[] = {
+    [ASPEED_DEV_SCU]       = 12,
+    [ASPEED_DEV_UART0]     = 132,
+    [ASPEED_DEV_UART1]     = 132,
+    [ASPEED_DEV_UART2]     = 132,
+    [ASPEED_DEV_UART3]     = 132,
+    [ASPEED_DEV_UART4]     = 8,
+    [ASPEED_DEV_UART5]     = 132,
+    [ASPEED_DEV_UART6]     = 140,
+    [ASPEED_DEV_UART7]     = 132,
+    [ASPEED_DEV_UART8]     = 132,
+    [ASPEED_DEV_UART9]     = 132,
+    [ASPEED_DEV_UART10]    = 132,
+    [ASPEED_DEV_UART11]    = 132,
+    [ASPEED_DEV_UART12]    = 132,
+    [ASPEED_DEV_TIMER1]    = 16,
+};
+
+static const hwaddr aspeed_soc_ast27x0tsp_memmap[] = {
+    [ASPEED_DEV_SRAM]      =  0x00000000,
+    [ASPEED_DEV_INTC]      =  0x72100000,
+    [ASPEED_DEV_INTC0]     =  0x72103000,
+    [ASPEED_DEV_INTC1]     =  0x72103100,
+    [ASPEED_DEV_INTC2]     =  0x72103200,
+    [ASPEED_DEV_INTC3]     =  0x72103300,
+    [ASPEED_DEV_INTC4]     =  0x72103400,
+    [ASPEED_DEV_INTC5]     =  0x72103500,
+    [ASPEED_DEV_INTC6]     =  0x72103600,
+    [ASPEED_DEV_INTC7]     =  0x72103700,
+    [ASPEED_DEV_INTC8]     =  0x72103800,
+    [ASPEED_DEV_SCU]       =  0x72C02000,
+    [ASPEED_DEV_SCUIO]     =  0x74C02000,
+    [ASPEED_DEV_UART0]     =  0X74C33000,
+    [ASPEED_DEV_UART1]     =  0X74C33100,
+    [ASPEED_DEV_UART2]     =  0X74C33200,
+    [ASPEED_DEV_UART3]     =  0X74C33300,
+    [ASPEED_DEV_UART4]     =  0X72C1A000,
+    [ASPEED_DEV_IPC0]      =  0x72C1C400,
+    [ASPEED_DEV_IPC1]      =  0x72C1C600,
+    [ASPEED_DEV_IPC2]      =  0x72C1C800,
+    [ASPEED_DEV_UART5]     =  0X74C33400,
+    [ASPEED_DEV_UART6]     =  0X74C33500,
+    [ASPEED_DEV_UART7]     =  0X74C33600,
+    [ASPEED_DEV_UART8]     =  0X74C33700,
+    [ASPEED_DEV_UART9]     =  0X74C33800,
+    [ASPEED_DEV_UART10]    =  0X74C33900,
+    [ASPEED_DEV_UART11]    =  0X74C33A00,
+    [ASPEED_DEV_UART12]    =  0X74C33B00,
+    [ASPEED_DEV_TIMER1]    =  0x72C10000,
+};
+
+static const int aspeed_soc_ast27x0tsp_irqmap[] = {
+    [ASPEED_DEV_SCU]       = 12,
+    [ASPEED_DEV_UART0]     = 132,
+    [ASPEED_DEV_UART1]     = 132,
+    [ASPEED_DEV_UART2]     = 132,
+    [ASPEED_DEV_UART3]     = 132,
+    [ASPEED_DEV_UART4]     = 8,
+    [ASPEED_DEV_UART5]     = 132,
+    [ASPEED_DEV_UART6]     = 140,
+    [ASPEED_DEV_UART7]     = 132,
+    [ASPEED_DEV_UART8]     = 132,
+    [ASPEED_DEV_UART9]     = 132,
+    [ASPEED_DEV_UART10]    = 132,
+    [ASPEED_DEV_UART11]    = 132,
+    [ASPEED_DEV_UART12]    = 132,
+    [ASPEED_DEV_TIMER1]    = 16,
+};
+
+static qemu_irq aspeed_soc_ast27x0ssp_get_irq(AspeedSoCState *s, int
+dev) {
+    Aspeed27x0CM4SoCState *a = ASPEED27X0CM4_SOC(s);
+    AspeedSoCClass *sc = ASPEED_SOC_GET_CLASS(s);
+
+    return qdev_get_gpio_in(DEVICE(&a->armv7m), sc->irqmap[dev]); }
+
+static void aspeed_soc_ast27x0ssp_init(Object *obj) {
+    Aspeed27x0CM4SoCState *a = ASPEED27X0CM4_SOC(obj);
+    AspeedSoCState *s = ASPEED_SOC(obj);
+    AspeedSoCClass *sc = ASPEED_SOC_GET_CLASS(s);
+    char socname[8];
+    char typename[64];
+    int i;
+
+    if (sscanf(sc->name, "%7s", socname) != 1) {
+        g_assert_not_reached();
+    }
+
+    object_initialize_child(obj, "armv7m", &a->armv7m, TYPE_ARMV7M);

hw/arm/aspeed_ast27x0-cm4.c

Quoted 10 lines
hw/arm/aspeed_ast27x0-cm4.c new file +10 -0
+
+    s->sysclk = qdev_init_clock_in(DEVICE(s), "sysclk", NULL, NULL,
+ 0);
+
+    snprintf(typename, sizeof(typename), "aspeed.scu-%s", socname);
+    object_initialize_child(obj, "scu", &s->scu, typename);
+    qdev_prop_set_uint32(DEVICE(&s->scu), "silicon-rev",
+ sc->silicon_rev);
+> +    for (i = 0; i < sc->uarts_num; i++) {
+        object_initialize_child(obj, "uart[*]", &s->uart[i],

TYPE_SERIAL_MM);

Quoted 10 lines
hw/arm/aspeed_ast27x0-cm4.c new file +10 -0
+    }
+
+    object_initialize_child(obj, "timerctrl", &s->timerctrl,
+                            TYPE_UNIMPLEMENTED_DEVICE);
+    object_initialize_child(obj, "intc", &s->intc,
+                            TYPE_UNIMPLEMENTED_DEVICE);
+    object_initialize_child(obj, "ipc", &s->ipc,
+                            TYPE_UNIMPLEMENTED_DEVICE); }
+
+static void aspeed_soc_ast27x0ssp_realize(DeviceState *dev_soc, Error

hw/arm/aspeed_ast27x0-cm4.c

Quoted 10 lines
hw/arm/aspeed_ast27x0-cm4.c new file +10 -0
+**errp) {
+    Aspeed27x0CM4SoCState *a = ASPEED27X0CM4_SOC(dev_soc);
+    AspeedSoCState *s = ASPEED_SOC(dev_soc);
+    AspeedSoCClass *sc = ASPEED_SOC_GET_CLASS(s);
+    DeviceState *armv7m;
+    Error *err = NULL;
+    g_autofree char *sram_name = NULL;
+
+    if (!clock_has_source(s->sysclk)) {
+        error_setg(errp, "sysclk clock must be wired up by the board

code");

Quoted 7 lines
hw/arm/aspeed_ast27x0-cm4.c new file +7 -0
+        return;
+    }
+
+    /* AST27X0 SSP Core */
+    armv7m = DEVICE(&a->armv7m);
+    qdev_prop_set_uint32(armv7m, "num-irq", 256);
+    qdev_prop_set_string(armv7m, "cpu-type", aspeed_soc_cpu_type(sc));

hw/arm/aspeed_ast27x0-cm4.c

Quoted 10 lines
hw/arm/aspeed_ast27x0-cm4.c new file +10 -0
+    qdev_connect_clock_in(armv7m, "cpuclk", s->sysclk);
+    object_property_set_link(OBJECT(&a->armv7m), "memory",
+                             OBJECT(s->memory), &error_abort);
+    sysbus_realize(SYS_BUS_DEVICE(&a->armv7m), &error_abort);
+
+    /* Internal SRAM */
+    sram_name = g_strdup_printf("aspeed.sram.%d",
+                                CPU(a->armv7m.cpu)->cpu_index);
+    memory_region_init_ram(&s->sram, OBJECT(s), sram_name,
+ sc->sram_size, &err);

This is better :

Quoted 7 lines
     if (!memory_region_init_ram(&s->sram, OBJECT(s), sram_name,
sc->sram_size, errp)) {
            return
     }

and aspeed_soc_ast1030_realize() needs a fix too btw.

I will fix it. Thanks for the suggestion.

Quoted 234 lines
Quoted 11 lines
hw/arm/aspeed_ast27x0-cm4.c new file +11 -0
+    if (err != NULL) {
+        error_propagate(errp, err);
+        return;
+    }
+    memory_region_add_subregion(s->memory,
+                                sc->memmap[ASPEED_DEV_SRAM],
+                                &s->sram);
+
+    /* SCU */
+    if (!sysbus_realize(SYS_BUS_DEVICE(&s->scu), errp)) {
+        return;

hw/arm/aspeed_ast27x0-cm4.c

Quoted 10 lines
hw/arm/aspeed_ast27x0-cm4.c new file +10 -0
+    }
+    aspeed_mmio_map(s, SYS_BUS_DEVICE(&s->scu), 0,
+ sc->memmap[ASPEED_DEV_SCU]);
+
+    /* UART */
+    if (!aspeed_soc_uart_realize(s, errp)) {
+        return;
+    }
+
+    aspeed_mmio_map_unimplemented(s,

SYS_BUS_DEVICE(&s->timerctrl),

hw/arm/aspeed_ast27x0-cm4.c line 212

Quoted 2 lines
hw/arm/aspeed_ast27x0-cm4.c new file +2 -0
+                                  "aspeed.timerctrl",
+

sc->memmap[ASPEED_DEV_TIMER1], 0x200);

hw/arm/aspeed_ast27x0-cm4.c line 220

Quoted 3 lines
hw/arm/aspeed_ast27x0-cm4.c new file +3 -0
+    aspeed_mmio_map_unimplemented(s, SYS_BUS_DEVICE(&s->intc),
+                                  "aspeed.intc",
+

sc->memmap[ASPEED_DEV_INTC], 0x4000);

hw/arm/aspeed_ast27x0-cm4.c line 220

Quoted 3 lines
hw/arm/aspeed_ast27x0-cm4.c new file +3 -0
+    aspeed_mmio_map_unimplemented(s, SYS_BUS_DEVICE(&s->ipc),
+                                  "aspeed.ipc",
+

sc->memmap[ASPEED_DEV_IPC0],

Quoted 51 lines
hw/arm/aspeed_ast27x0-cm4.c new file +51 -0
+0x1000); }
+
+static void aspeed_soc_ast27x0ssp_class_init(ObjectClass *klass, void
+*data) {
+    static const char * const valid_cpu_types[] = {
+        ARM_CPU_TYPE_NAME("cortex-m4"), /* TODO cortex-m4f */
+        NULL
+    };
+    DeviceClass *dc = DEVICE_CLASS(klass);
+    AspeedSoCClass *sc = ASPEED_SOC_CLASS(dc);
+
+    /* Reason: The Aspeed SoC can only be instantiated from a board */
+    dc->user_creatable = false;
+    dc->realize = aspeed_soc_ast27x0ssp_realize;
+
+    sc->name = "ast2700ssp-a0";
+    sc->valid_cpu_types = valid_cpu_types;
+    sc->silicon_rev = AST2700_A0_SILICON_REV;
+    sc->sram_size = 0x1000000;
+    sc->spis_num = 0;
+    sc->ehcis_num = 0;
+    sc->wdts_num = 0;
+    sc->macs_num = 0;
+    sc->uarts_num = 13;
+    sc->uarts_base = ASPEED_DEV_UART0;
+    sc->irqmap = aspeed_soc_ast27x0ssp_irqmap;
+    sc->memmap = aspeed_soc_ast27x0ssp_memmap;
+    sc->num_cpus = 1;
+    sc->get_irq = aspeed_soc_ast27x0ssp_get_irq; }
+
+static qemu_irq aspeed_soc_ast27x0tsp_get_irq(AspeedSoCState *s, int
+dev) {
+    Aspeed27x0CM4SoCState *a = ASPEED27X0CM4_SOC(s);
+    AspeedSoCClass *sc = ASPEED_SOC_GET_CLASS(s);
+
+    return qdev_get_gpio_in(DEVICE(&a->armv7m), sc->irqmap[dev]); }
+
+static void aspeed_soc_ast27x0tsp_init(Object *obj) {
+    Aspeed27x0CM4SoCState *a = ASPEED27X0CM4_SOC(obj);
+    AspeedSoCState *s = ASPEED_SOC(obj);
+    AspeedSoCClass *sc = ASPEED_SOC_GET_CLASS(s);
+    char socname[8];
+    char typename[64];
+    int i;
+
+    if (sscanf(sc->name, "%7s", socname) != 1) {
+        g_assert_not_reached();
+    }
+
+    object_initialize_child(obj, "armv7m", &a->armv7m, TYPE_ARMV7M);
+

hw/arm/aspeed_ast27x0-cm4.c

Quoted 10 lines
hw/arm/aspeed_ast27x0-cm4.c new file +10 -0
+    s->sysclk = qdev_init_clock_in(DEVICE(s), "sysclk", NULL, NULL,
+ 0);
+
+    snprintf(typename, sizeof(typename), "aspeed.scu-%s", socname);
+    object_initialize_child(obj, "scu", &s->scu, typename);
+    qdev_prop_set_uint32(DEVICE(&s->scu), "silicon-rev",
+ sc->silicon_rev);
+
+    for (i = 0; i < sc->uarts_num; i++) {
+        object_initialize_child(obj, "uart[*]", &s->uart[i],

TYPE_SERIAL_MM);

Quoted 10 lines
hw/arm/aspeed_ast27x0-cm4.c new file +10 -0
+    }
+
+    object_initialize_child(obj, "timerctrl", &s->timerctrl,
+                            TYPE_UNIMPLEMENTED_DEVICE);
+    object_initialize_child(obj, "intc", &s->intc,
+                            TYPE_UNIMPLEMENTED_DEVICE);
+    object_initialize_child(obj, "ipc", &s->ipc,
+                            TYPE_UNIMPLEMENTED_DEVICE); }
+
+static void aspeed_soc_ast27x0tsp_realize(DeviceState *dev_soc, Error

hw/arm/aspeed_ast27x0-cm4.c

Quoted 10 lines
hw/arm/aspeed_ast27x0-cm4.c new file +10 -0
+**errp) {
+    Aspeed27x0CM4SoCState *a = ASPEED27X0CM4_SOC(dev_soc);
+    AspeedSoCState *s = ASPEED_SOC(dev_soc);
+    AspeedSoCClass *sc = ASPEED_SOC_GET_CLASS(s);
+    DeviceState *armv7m;
+    Error *err = NULL;
+    g_autofree char *sram_name = NULL;
+
+    if (!clock_has_source(s->sysclk)) {
+        error_setg(errp, "sysclk clock must be wired up by the board

code");

Quoted 6 lines
hw/arm/aspeed_ast27x0-cm4.c new file +6 -0
+        return;
+    }
+
+    /* AST27X0 TSP Core */
+    armv7m = DEVICE(&a->armv7m);
+    qdev_prop_set_uint32(armv7m, "num-irq", 256);

hw/arm/aspeed_ast27x0-cm4.c

Quoted 10 lines
hw/arm/aspeed_ast27x0-cm4.c new file +10 -0
+    qdev_prop_set_string(armv7m, "cpu-type", aspeed_soc_cpu_type(sc));
+    qdev_connect_clock_in(armv7m, "cpuclk", s->sysclk);
+    object_property_set_link(OBJECT(&a->armv7m), "memory",
+                             OBJECT(s->memory), &error_abort);
+    sysbus_realize(SYS_BUS_DEVICE(&a->armv7m), &error_abort);
+
+    /* Internal SRAM */
+    sram_name = g_strdup_printf("aspeed.sram.%d",
+                                CPU(a->armv7m.cpu)->cpu_index);
+    memory_region_init_ram(&s->sram, OBJECT(s), sram_name,

sc->sram_size, &err);

Quoted 11 lines
hw/arm/aspeed_ast27x0-cm4.c new file +11 -0
+    if (err != NULL) {
+        error_propagate(errp, err);
+        return;
+    }
+    memory_region_add_subregion(s->memory,
+                                sc->memmap[ASPEED_DEV_SRAM],
+                                &s->sram);
+
+    /* SCU */
+    if (!sysbus_realize(SYS_BUS_DEVICE(&s->scu), errp)) {
+        return;

hw/arm/aspeed_ast27x0-cm4.c

Quoted 10 lines
hw/arm/aspeed_ast27x0-cm4.c new file +10 -0
+    }
+    aspeed_mmio_map(s, SYS_BUS_DEVICE(&s->scu), 0,
+ sc->memmap[ASPEED_DEV_SCU]);
+
+    /* UART */
+    if (!aspeed_soc_uart_realize(s, errp)) {
+        return;
+    }
+
+    aspeed_mmio_map_unimplemented(s,

SYS_BUS_DEVICE(&s->timerctrl),

hw/arm/aspeed_ast27x0-cm4.c line 338

Quoted 2 lines
hw/arm/aspeed_ast27x0-cm4.c new file +2 -0
+                                  "aspeed.timerctrl",
+

sc->memmap[ASPEED_DEV_TIMER1], 0x200);

hw/arm/aspeed_ast27x0-cm4.c line 220

Quoted 3 lines
hw/arm/aspeed_ast27x0-cm4.c new file +3 -0
+    aspeed_mmio_map_unimplemented(s, SYS_BUS_DEVICE(&s->intc),
+                                  "aspeed.intc",
+

sc->memmap[ASPEED_DEV_INTC], 0x4000);

hw/arm/aspeed_ast27x0-cm4.c line 220

Quoted 3 lines
hw/arm/aspeed_ast27x0-cm4.c new file +3 -0
+    aspeed_mmio_map_unimplemented(s, SYS_BUS_DEVICE(&s->ipc),
+                                  "aspeed.ipc",
+

sc->memmap[ASPEED_DEV_IPC0],

hw/arm/meson.build arm_ss.add(when: 'CONFIG_ASPEED_SOC', if_true:

Quoted 56 lines
hw/arm/aspeed_ast27x0-cm4.c new file +51 -0
+0x1000); }
+
+static void aspeed_soc_ast27x0tsp_class_init(ObjectClass *klass, void
+*data) {
+    static const char * const valid_cpu_types[] = {
+        ARM_CPU_TYPE_NAME("cortex-m4"), /* TODO cortex-m4f */
+        NULL
+    };
+    DeviceClass *dc = DEVICE_CLASS(klass);
+    AspeedSoCClass *sc = ASPEED_SOC_CLASS(dc);
+
+    /* Reason: The Aspeed SoC can only be instantiated from a board */
+    dc->user_creatable = false;
+    dc->realize = aspeed_soc_ast27x0tsp_realize;
+
+    sc->name = "ast2700tsp-a0";
+    sc->valid_cpu_types = valid_cpu_types;
+    sc->silicon_rev = AST2700_A0_SILICON_REV;
+    sc->sram_size = 0x1000000;
+    sc->spis_num = 0;
+    sc->ehcis_num = 0;
+    sc->wdts_num = 0;
+    sc->macs_num = 0;
+    sc->uarts_num = 13;
+    sc->uarts_base = ASPEED_DEV_UART0;
+    sc->irqmap = aspeed_soc_ast27x0tsp_irqmap;
+    sc->memmap = aspeed_soc_ast27x0tsp_memmap;
+    sc->num_cpus = 1;
+    sc->get_irq = aspeed_soc_ast27x0tsp_get_irq; }
+
+
+static const TypeInfo aspeed_soc_ast27x0cm4_types[] = {
+    {
+        .name           = TYPE_ASPEED27X0CM4_SOC,
+        .parent         = TYPE_ASPEED_SOC,
+        .instance_size  = sizeof(Aspeed27x0CM4SoCState),
+        .abstract       = true,
+    }, {
+        .name           = "ast2700ssp-a0",
+        .parent         = TYPE_ASPEED27X0CM4_SOC,
+        .instance_init  = aspeed_soc_ast27x0ssp_init,
+        .class_init     = aspeed_soc_ast27x0ssp_class_init,
+    }, {
+        .name           = "ast2700tsp-a0",
+        .parent         = TYPE_ASPEED27X0CM4_SOC,
+        .instance_init  = aspeed_soc_ast27x0tsp_init,
+        .class_init     = aspeed_soc_ast27x0tsp_class_init,
+    },
+};
+
+DEFINE_TYPES(aspeed_soc_ast27x0cm4_types)
hw/arm/meson.build index renamed from hw/arm/meson.build +0 -0

490234b3b8..cd7780b997 100644

hw/arm/meson.build +0 -0
@@ -43,6 +43,7 @@ arm_ss.add(when: 'CONFIG_ASPEED_SOC', if_true:

files(

include/hw/arm/aspeed_soc.h

Quoted 8 lines
hw/arm/meson.build +1 -0
    'aspeed_soc_common.c',
    'aspeed_ast2400.c',
    'aspeed_ast2600.c',
+  'aspeed_ast27x0-cm4.c',
    'aspeed_ast10x0.c',
    'aspeed_eeprom.c',
    'fby35.c'))
include/hw/arm/aspeed_soc.h +0 -0

Please to your ~/.gitconfig

Quoted 3 lines

[diff]
orderFile = /path/to/qemu/scripts/git.orderfile

Will add to my gitconfig

Quoted 21 lines

include/hw/arm/aspeed_soc.h struct AspeedSoCState { · line 105

Quoted 9 lines

index bf885da3fc..7de69dc57d 100644

include/hw/arm/aspeed_soc.h +2 -0
@@ -101,6 +101,8 @@ struct AspeedSoCState {
      UnimplementedDeviceState sgpiom;
      UnimplementedDeviceState ltpi;
      UnimplementedDeviceState jtag[ASPEED_JTAG_NUM];
+    UnimplementedDeviceState intc;
+    UnimplementedDeviceState ipc;

Shouldn't these 2 new attributes be moved to Aspeed27x0CM4SoCState ? I think each should be introduced in a separate patch with a small description.

include/hw/arm/aspeed_soc.h struct Aspeed2600SoCState { · line 130

Quoted 6 lines
include/hw/arm/aspeed_soc.h +0 -0
      AspeedAPB2OPBState fsi[2];
  };
 
@@ -127,6 +129,15 @@ struct Aspeed2600SoCState {
  #define TYPE_ASPEED2600_SOC "aspeed2600-soc"
  OBJECT_DECLARE_SIMPLE_TYPE(Aspeed2600SoCState,

ASPEED2600_SOC)

Quoted 1 line
Quoted 7 lines

include/hw/arm/aspeed_soc.h struct Aspeed2600SoCState { · line 135

Quoted 4 lines
include/hw/arm/aspeed_soc.h +4 -0
+struct Aspeed27x0CM4SoCState {
+    AspeedSoCState parent;
+
+    ARMv7MState armv7m;

Why not use Aspeed10x0SoCState instead ?

The AST2700's CM4 is not part of the AST10x0 series SoC.
However, since the structure is identical, I can switch to using Aspeed10x0SoCState if reusing it is deemed more appropriate.

Quoted 42 lines

Thanks,

C.

include/hw/arm/aspeed_soc.h struct Aspeed2600SoCState {

Quoted 4 lines
include/hw/arm/aspeed_soc.h +4 -0
+};
+
+#define TYPE_ASPEED27X0CM4_SOC "aspeed27x0cm4-soc"
+OBJECT_DECLARE_SIMPLE_TYPE(Aspeed27x0CM4SoCState,

ASPEED27X0CM4_SOC)

Quoted 30 lines
include/hw/arm/aspeed_soc.h +13 -0
+
  struct Aspeed27x0SoCState {
      AspeedSoCState parent;
@@ -201,6 +212,15 @@ enum {
      ASPEED_DEV_EHCI2,
      ASPEED_DEV_VIC,
      ASPEED_DEV_INTC,
+    ASPEED_DEV_INTC0,
+    ASPEED_DEV_INTC1,
+    ASPEED_DEV_INTC2,
+    ASPEED_DEV_INTC3,
+    ASPEED_DEV_INTC4,
+    ASPEED_DEV_INTC5,
+    ASPEED_DEV_INTC6,
+    ASPEED_DEV_INTC7,
+    ASPEED_DEV_INTC8,
      ASPEED_DEV_SDMC,
      ASPEED_DEV_SCU,
      ASPEED_DEV_ADC,
@@ -253,6 +273,9 @@ enum {
      ASPEED_DEV_SCUIO,
      ASPEED_DEV_SLI,
      ASPEED_DEV_SLIIO,
+    ASPEED_DEV_IPC0,
+    ASPEED_DEV_IPC1,
+    ASPEED_DEV_IPC2,
      ASPEED_GIC_DIST,
      ASPEED_GIC_REDIST,
  };
#9 lore raw

Re: [PATCH 3/5] aspeed: Introduce AST27x0 SoC with Cortex-M4 support

Hello Steven,

[ ... ]

Quoted 9 lines
Quoted 7 lines

include/hw/arm/aspeed_soc.h struct Aspeed2600SoCState { · line 135

Quoted 4 lines
include/hw/arm/aspeed_soc.h +4 -0
+struct Aspeed27x0CM4SoCState {
+    AspeedSoCState parent;
+
+    ARMv7MState armv7m;

Why not use Aspeed10x0SoCState instead ?

The AST2700's CM4 is not part of the AST10x0 series SoC.

ok. These are different HW designs.

Quoted 1 line

However, since the structure is identical, I can switch to using Aspeed10x0SoCState if reusing it is deemed more appropriate.

That's fine. Let's keep it this way.

Thanks,

C.

#10 lore raw

PATCH 4/5 aspeed: Introduce ast2700-fc machine

In reply to Steven Lee via

This patch introduces a new machine, ast2700-fc, which supports all cores available in the AST27x0 SoC. In this machine
- The first 4 cores are Cortex-A35 cores.
- CPU 4 is designated as the SSP core.
- CPU 5 is designated as the TSP core.

Test Step:

    wget https://github.com/stevenlee7189/zephyr/releases/download/1.0.0/ast2700-ssp.elf
    wget https://github.com/stevenlee7189/zephyr/releases/download/1.0.0/ast2700-tsp.elf
    wget https://github.com/stevenlee7189/zephyr/releases/download/1.0.0/bl31.bin
    wget https://github.com/stevenlee7189/zephyr/releases/download/1.0.0/tee-raw.bin
    wget https://github.com/stevenlee7189/zephyr/releases/download/1.0.0/u-boot-nodtb.bin
    wget https://github.com/stevenlee7189/zephyr/releases/download/1.0.0/u-boot.dtb
    wget https://github.com/stevenlee7189/zephyr/releases/download/1.0.0/image-bmc.tar.zst
    tar --zstd -xvf image-bmc.tar.zst

    qemu-system-aarch64 -machine ast2700fc \
      -device loader,force-raw=on,addr=0x400000000,file=u-boot-nodtb.bin \
      -device loader,force-raw=on,addr=$((0x400000000 + 748896)),file=u-boot.dtb\
      -device loader,force-raw=on,addr=0x430000000,file=bl31.bin\
      -device loader,force-raw=on,addr=0x430080000,file=tee-raw.bin\
      -device loader,file=ast2700-ssp.elf,cpu-num=4 \
      -device loader,file=ast2700-tsp.elf,cpu-num=5 \
      -device loader,cpu-num=0,addr=0x430000000 \
      -device loader,cpu-num=1,addr=0x430000000 \
      -device loader,cpu-num=2,addr=0x430000000 \
      -device loader,cpu-num=3,addr=0x430000000 \
      -m 1G \
      -drive file=image-bmc,if=mtd,format=raw \
      -serial pty -serial pty -serial pty \
      -S -nographic
    char device redirected to /dev/pts/51 (label serial0)
    char device redirected to /dev/pts/52 (label serial1)
    char device redirected to /dev/pts/53 (label serial2)

    tio /dev/pts/51
    tio /dev/pts/52
    tio /dev/pts/53
    (qemu) c
---
 hw/arm/aspeed_ast27x0-fc.c  | 211 ++++++++++++++++++++++++++++++++++++
 hw/arm/meson.build          |   4 +-
 include/hw/arm/aspeed_soc.h |  12 ++
 3 files changed, 226 insertions(+), 1 deletion(-)
 create mode 100644 hw/arm/aspeed_ast27x0-fc.c
hw/arm/aspeed_ast27x0-fc.c new file +211 -0
new file mode 100644
index 0000000000..aeb0996a97
@@ -0,0 +1,211 @@
+/*
+ * ASPEED SoC 2700 family
+ *
+ * Copyright (C) 2024 ASPEED Technology Inc.
+ *
+ * This code is licensed under the GPL version 2 or later.  See
+ * the COPYING file in the top-level directory.
+ *
+ * Implementation extracted from the AST2600 and adapted for AST2700.
+ */
+
+#include "qemu/osdep.h"
+#include "qemu/units.h"
+#include "qapi/error.h"
+#include "system/block-backend.h"
+#include "system/system.h"
+#include "hw/arm/aspeed.h"
+#include "hw/boards.h"
+#include "hw/qdev-clock.h"
+#include "hw/arm/aspeed_soc.h"
+#include "hw/loader.h"
+#include "hw/arm/boot.h"
+#include "hw/block/flash.h"
+
+#define TYPE_AST2700FC MACHINE_TYPE_NAME("ast2700fc")
+OBJECT_DECLARE_SIMPLE_TYPE(Ast2700FCState, AST2700FC);
+
+static struct arm_boot_info ast2700fc_board_binfo = {
+    .board_id = -1, /* device-tree-only board */
+};
+
+struct Ast2700FCState {
+    MachineState parent_obj;
+
+    MemoryRegion ca35_memory;
+    MemoryRegion ca35_dram;
+    MemoryRegion ca35_boot_rom;
+    MemoryRegion ssp_memory;
+    MemoryRegion tsp_memory;
+
+    Clock *ssp_sysclk;
+    Clock *tsp_sysclk;
+
+    Aspeed27x0SoCState ca35;
+    Aspeed27x0CM4SoCState ssp;
+    Aspeed27x0CM4SoCState tsp;
+
+    bool mmio_exec;
+};
+
+#define AST2700FC_BMC_RAM_SIZE (1 * GiB)
+#define AST2700FC_BMC_SRAM_SIZE (1 * GiB)
+
+#define AST2700FC_HW_STRAP1 0x000000C0
+#define AST2700FC_HW_STRAP2 0x00000003
+#define AST2700FC_FMC_MODEL "w25q01jvq"
+#define AST2700FC_SPI_MODEL "w25q512jv"
+
+static void ast2700fc_install_boot_rom(Ast2700FCState *s, BlockBackend *blk,
+                                    uint64_t rom_size)
+{
+    AspeedSoCState *soc = ASPEED_SOC(&s->ca35);
+    AspeedSoCClass *sc = ASPEED_SOC_GET_CLASS(soc);
+
+    memory_region_init_rom(&s->ca35_boot_rom, NULL, "aspeed.boot_rom", rom_size,
+                           &error_abort);
+    memory_region_add_subregion_overlap(&soc->spi_boot_container, 0,
+                                        &s->ca35_boot_rom, 1);
+    write_boot_rom(blk, sc->memmap[ASPEED_DEV_SPI_BOOT],
+                   rom_size, &error_abort);
+}
+
+static void ast2700fc_ca35_init(MachineState *machine)
+{
+    Ast2700FCState *s = AST2700FC(machine);
+    AspeedSoCState *soc;
+    AspeedSoCClass *sc;
+    DriveInfo *emmc0 = NULL;
+    bool boot_emmc;
+    int i;
+
+    object_initialize_child(OBJECT(s), "ca35", &s->ca35, "ast2700-a0");
+    soc = ASPEED_SOC(&s->ca35);
+    sc = ASPEED_SOC_GET_CLASS(soc);
+
+    memory_region_init(&s->ca35_memory, OBJECT(&s->ca35), "ca35-memory",
+                       UINT64_MAX);
+
+    memory_region_init_ram(&s->ca35_dram, OBJECT(&s->ca35), "ca35-dram",
+                           AST2700FC_BMC_SRAM_SIZE, &error_abort);
+    object_property_set_link(OBJECT(&s->ca35), "memory",
+                             OBJECT(&s->ca35_memory),
+                             &error_abort);
+    object_property_set_link(OBJECT(&s->ca35), "dram", OBJECT(&s->ca35_dram),
+                             &error_abort);
+    object_property_set_int(OBJECT(&s->ca35), "ram-size",
+                            AST2700FC_BMC_RAM_SIZE,
+                            &error_abort);
+    object_property_set_int(OBJECT(&s->ca35), "hw-strap1", AST2700FC_HW_STRAP1,
+                            &error_abort);
+    object_property_set_int(OBJECT(&s->ca35), "hw-strap2", AST2700FC_HW_STRAP2,
+                            &error_abort);
+    aspeed_soc_uart_set_chr(soc, ASPEED_DEV_UART12, serial_hd(0));
+    qdev_realize(DEVICE(&s->ca35), NULL, &error_abort);
+
+    aspeed_board_init_flashes(&soc->fmc, AST2700FC_FMC_MODEL, 2, 0);
+    aspeed_board_init_flashes(&soc->spi[0], AST2700FC_SPI_MODEL, 1, 2);
+
+    for (i = 0; i < soc->sdhci.num_slots; i++) {
+        sdhci_attach_drive(&soc->sdhci.slots[i],
+                           drive_get(IF_SD, 0, i), false, false);
+    }
+    boot_emmc = sc->boot_from_emmc(soc);
+
+    if (soc->emmc.num_slots) {
+        emmc0 = drive_get(IF_SD, 0, soc->sdhci.num_slots);
+        sdhci_attach_drive(&soc->emmc.slots[0], emmc0, true, boot_emmc);
+    }
+
+    if (!s->mmio_exec) {
+        DeviceState *dev = ssi_get_cs(soc->fmc.spi, 0);
+        BlockBackend *fmc0 = dev ? m25p80_get_blk(dev) : NULL;
+
+        if (fmc0 && !boot_emmc) {
+            uint64_t rom_size = memory_region_size(&soc->spi_boot);
+            ast2700fc_install_boot_rom(s, fmc0, rom_size);
+        } else if (emmc0) {
+            ast2700fc_install_boot_rom(s, blk_by_legacy_dinfo(emmc0), 64 * KiB);
+        }
+    }
+
+    ast2700fc_board_binfo.ram_size = machine->ram_size;
+    ast2700fc_board_binfo.loader_start = sc->memmap[ASPEED_DEV_SDRAM];
+
+    arm_load_kernel(ARM_CPU(first_cpu), machine, &ast2700fc_board_binfo);
+}
+
+static void ast2700fc_ssp_init(MachineState *machine)
+{
+    AspeedSoCState *soc;
+    Ast2700FCState *s = AST2700FC(machine);
+    s->ssp_sysclk = clock_new(OBJECT(s), "SSP_SYSCLK");
+    clock_set_hz(s->ssp_sysclk, 200000000ULL);
+
+    object_initialize_child(OBJECT(s), "ssp", &s->ssp, "ast2700ssp-a0");
+    memory_region_init(&s->ssp_memory, OBJECT(&s->ssp), "ssp-memory",
+                       UINT64_MAX);
+
+    qdev_connect_clock_in(DEVICE(&s->ssp), "sysclk", s->ssp_sysclk);
+    object_property_set_link(OBJECT(&s->ssp), "memory", OBJECT(&s->ssp_memory),
+                             &error_abort);
+
+    soc = ASPEED_SOC(&s->ssp);
+    aspeed_soc_uart_set_chr(soc, ASPEED_DEV_UART4, serial_hd(1));
+    qdev_realize(DEVICE(&s->ssp), NULL, &error_abort);
+}
+
+static void ast2700fc_tsp_init(MachineState *machine)
+{
+    AspeedSoCState *soc;
+    Ast2700FCState *s = AST2700FC(machine);
+    s->tsp_sysclk = clock_new(OBJECT(s), "TSP_SYSCLK");
+    clock_set_hz(s->tsp_sysclk, 200000000ULL);
+
+    object_initialize_child(OBJECT(s), "tsp", &s->tsp, "ast2700tsp-a0");
+    memory_region_init(&s->tsp_memory, OBJECT(&s->tsp), "tsp-memory",
+                       UINT64_MAX);
+
+    qdev_connect_clock_in(DEVICE(&s->tsp), "sysclk", s->tsp_sysclk);
+    object_property_set_link(OBJECT(&s->tsp), "memory", OBJECT(&s->tsp_memory),
+                             &error_abort);
+
+    soc = ASPEED_SOC(&s->tsp);
+    aspeed_soc_uart_set_chr(soc, ASPEED_DEV_UART4, serial_hd(2));
+    qdev_realize(DEVICE(&s->tsp), NULL, &error_abort);
+}
+
+static void ast2700fc_init(MachineState *machine)
+{
+    ast2700fc_ca35_init(machine);
+    ast2700fc_ssp_init(machine);
+    ast2700fc_tsp_init(machine);
+}
+
+static void ast2700fc_instance_init(Object *obj)
+{
+    AST2700FC(obj)->mmio_exec = false;
+}
+
+static void ast2700fc_class_init(ObjectClass *oc, void *data)
+{
+    MachineClass *mc = MACHINE_CLASS(oc);
+
+    mc->desc = "ast2700 full cores support";
+    mc->init = ast2700fc_init;
+    mc->no_floppy = 1;
+    mc->no_cdrom = 1;
+    mc->min_cpus = mc->max_cpus = mc->default_cpus = 6;
+}
+
+static const TypeInfo ast2700fc_types[] = {
+    {
+        .name           = MACHINE_TYPE_NAME("ast2700fc"),
+        .parent         = TYPE_MACHINE,
+        .class_init     = ast2700fc_class_init,
+        .instance_size  = sizeof(Ast2700FCState),
+        .instance_init  = ast2700fc_instance_init,
+    },
+};
+
+DEFINE_TYPES(ast2700fc_types)
hw/arm/meson.build +3 -1
index cd7780b997..7b99f78aed 100644
@@ -47,7 +47,9 @@ arm_ss.add(when: 'CONFIG_ASPEED_SOC', if_true: files(
   'aspeed_ast10x0.c',
   'aspeed_eeprom.c',
   'fby35.c'))
-arm_ss.add(when: ['CONFIG_ASPEED_SOC', 'TARGET_AARCH64'], if_true: files('aspeed_ast27x0.c'))
+arm_ss.add(when: ['CONFIG_ASPEED_SOC', 'TARGET_AARCH64'], if_true: files(
+  'aspeed_ast27x0.c',
+  'aspeed_ast27x0-fc.c'))
 arm_ss.add(when: 'CONFIG_MPS2', if_true: files('mps2.c'))
 arm_ss.add(when: 'CONFIG_MPS2', if_true: files('mps2-tz.c'))
 arm_ss.add(when: 'CONFIG_MSF2', if_true: files('msf2-soc.c'))
include/hw/arm/aspeed_soc.h +12 -0
index 7de69dc57d..f6b38a0666 100644
@@ -129,6 +129,18 @@ struct Aspeed2600SoCState {
 #define TYPE_ASPEED2600_SOC "aspeed2600-soc"
 OBJECT_DECLARE_SIMPLE_TYPE(Aspeed2600SoCState, ASPEED2600_SOC)
 
+struct Aspeed27x0CA35SoCState {
+    AspeedSoCState parent;
+
+    ARMCPU cpu[ASPEED_CPUS_NUM];
+    AspeedINTCState intc;
+    GICv3State gic;
+    MemoryRegion dram_empty;
+};
+
+#define TYPE_ASPEED27X0CA35_SOC "aspeed27x0ca35-soc"
+OBJECT_DECLARE_SIMPLE_TYPE(Aspeed27x0CA35SoCState, ASPEED27X0CA35_SOC)
+
 struct Aspeed27x0CM4SoCState {
     AspeedSoCState parent;
 
Signature · 1 line
2.34.1
#11 lore raw

Re: [PATCH 4/5] aspeed: Introduce ast2700-fc machine

Hi Steven,

Quoted 31 lines · Steven Lee via

This patch introduces a new machine, ast2700-fc, which supports all cores available in the AST27x0 SoC. In this machine
- The first 4 cores are Cortex-A35 cores.
- CPU 4 is designated as the SSP core.
- CPU 5 is designated as the TSP core.

Test Step:

     wget https://github.com/stevenlee7189/zephyr/releases/download/1.0.0/ast2700-ssp.elf
     wget https://github.com/stevenlee7189/zephyr/releases/download/1.0.0/ast2700-tsp.elf
     wget https://github.com/stevenlee7189/zephyr/releases/download/1.0.0/bl31.bin
     wget https://github.com/stevenlee7189/zephyr/releases/download/1.0.0/tee-raw.bin
     wget https://github.com/stevenlee7189/zephyr/releases/download/1.0.0/u-boot-nodtb.bin
     wget https://github.com/stevenlee7189/zephyr/releases/download/1.0.0/u-boot.dtb
     wget https://github.com/stevenlee7189/zephyr/releases/download/1.0.0/image-bmc.tar.zst
     tar --zstd -xvf image-bmc.tar.zst

     qemu-system-aarch64 -machine ast2700fc \
       -device loader,force-raw=on,addr=0x400000000,file=u-boot-nodtb.bin \
       -device loader,force-raw=on,addr=$((0x400000000 + 748896)),file=u-boot.dtb\
       -device loader,force-raw=on,addr=0x430000000,file=bl31.bin\
       -device loader,force-raw=on,addr=0x430080000,file=tee-raw.bin\
       -device loader,file=ast2700-ssp.elf,cpu-num=4 \
       -device loader,file=ast2700-tsp.elf,cpu-num=5 \
       -device loader,cpu-num=0,addr=0x430000000 \
       -device loader,cpu-num=1,addr=0x430000000 \
       -device loader,cpu-num=2,addr=0x430000000 \
       -device loader,cpu-num=3,addr=0x430000000 \
       -m 1G \
       -drive file=image-bmc,if=mtd,format=raw \
       -serial pty -serial pty -serial pty \
       -S -nographic
Quoted 8 lines
     char device redirected to /dev/pts/51 (label serial0)
     char device redirected to /dev/pts/52 (label serial1)
     char device redirected to /dev/pts/53 (label serial2)

     tio /dev/pts/51
     tio /dev/pts/52
     tio /dev/pts/53
     (qemu) c

Could we have a functional test included in this series please?

Quoted 7 lines
---
  hw/arm/aspeed_ast27x0-fc.c  | 211 ++++++++++++++++++++++++++++++++++++
  hw/arm/meson.build          |   4 +-
  include/hw/arm/aspeed_soc.h |  12 ++
  3 files changed, 226 insertions(+), 1 deletion(-)

create mode 100644 hw/arm/aspeed_ast27x0-fc.c

#12 lore raw

RE: [PATCH 4/5] aspeed: Introduce ast2700-fc machine

Hi Philippe,

Quoted 65 lines

-----Original Message-----
From: Philippe Mathieu-Daudé <[email protected]>
Sent: Wednesday, December 25, 2024 7:30 PM
To: Steven Lee <[email protected]>; Cédric Le Goater <[email protected]>; Peter Maydell <[email protected]>; Troy Lee <[email protected]>; Jamin Lin <[email protected]>; Andrew Jeffery <[email protected]>; Joel Stanley <[email protected]>; open list:ASPEED BMCs <[email protected]>; open list:All patches CC here <[email protected]>
Cc: Troy Lee <[email protected]>; Yunlin Tang <[email protected]>
Subject: Re: [PATCH 4/5] aspeed: Introduce ast2700-fc machine

Hi Steven,

Quoted 8 lines · Steven Lee via

This patch introduces a new machine, ast2700-fc, which supports all cores available in the AST27x0 SoC. In this machine
- The first 4 cores are Cortex-A35 cores.
- CPU 4 is designated as the SSP core.
- CPU 5 is designated as the TSP core.

Test Step:
wget

https://github.com/stevenlee7189/zephyr/releases/download/1.0.0/ast2700-ss
p.elf

Quoted 1 line

wget

https://github.com/stevenlee7189/zephyr/releases/download/1.0.0/ast2700-ts
p.elf

Quoted 1 line

wget

https://github.com/stevenlee7189/zephyr/releases/download/1.0.0/bl31.bin

Quoted 1 line

wget

https://github.com/stevenlee7189/zephyr/releases/download/1.0.0/tee-raw.bi
n

Quoted 1 line

wget

https://github.com/stevenlee7189/zephyr/releases/download/1.0.0/u-boot-nod
tb.bin

Quoted 1 line

wget

https://github.com/stevenlee7189/zephyr/releases/download/1.0.0/u-boot.dtb

Quoted 1 line

wget

https://github.com/stevenlee7189/zephyr/releases/download/1.0.0/image-bm
c.tar.zst

Quoted 4 lines
     tar --zstd -xvf image-bmc.tar.zst

     qemu-system-aarch64 -machine ast2700fc \
       -device

loader,force-raw=on,addr=0x400000000,file=u-boot-nodtb.bin \

Quoted 1 line
       -device loader,force-raw=on,addr=$((0x400000000 +

748896)),file=u-boot.dtb\

Quoted 16 lines
       -device loader,force-raw=on,addr=0x430000000,file=bl31.bin\
       -device loader,force-raw=on,addr=0x430080000,file=tee-raw.bin\
       -device loader,file=ast2700-ssp.elf,cpu-num=4 \
       -device loader,file=ast2700-tsp.elf,cpu-num=5 \
       -device loader,cpu-num=0,addr=0x430000000 \
       -device loader,cpu-num=1,addr=0x430000000 \
       -device loader,cpu-num=2,addr=0x430000000 \
       -device loader,cpu-num=3,addr=0x430000000 \
       -m 1G \
       -drive file=image-bmc,if=mtd,format=raw \
       -serial pty -serial pty -serial pty \
       -S -nographic
     char device redirected to /dev/pts/51 (label serial0)
     char device redirected to /dev/pts/52 (label serial1)
     char device redirected to /dev/pts/53 (label serial2)
Quoted 7 lines
Quoted 4 lines
     tio /dev/pts/51
     tio /dev/pts/52
     tio /dev/pts/53
     (qemu) c

Could we have a functional test included in this series please?

I will add a functional test.

Thanks,
Steven

Quoted 8 lines
Quoted 3 lines
---
  hw/arm/aspeed_ast27x0-fc.c  | 211

++++++++++++++++++++++++++++++++++++

Quoted 4 lines
  hw/arm/meson.build          |   4 +-
  include/hw/arm/aspeed_soc.h |  12 ++
  3 files changed, 226 insertions(+), 1 deletion(-)

create mode 100644 hw/arm/aspeed_ast27x0-fc.c

#13 lore raw

Re: [PATCH 4/5] aspeed: Introduce ast2700-fc machine

In reply to Steven Lee via
Quoted 173 lines · Steven Lee

This patch introduces a new machine, ast2700-fc, which supports all cores available in the AST27x0 SoC. In this machine
- The first 4 cores are Cortex-A35 cores.
- CPU 4 is designated as the SSP core.
- CPU 5 is designated as the TSP core.

Test Step:

     wget https://github.com/stevenlee7189/zephyr/releases/download/1.0.0/ast2700-ssp.elf
     wget https://github.com/stevenlee7189/zephyr/releases/download/1.0.0/ast2700-tsp.elf
     wget https://github.com/stevenlee7189/zephyr/releases/download/1.0.0/bl31.bin
     wget https://github.com/stevenlee7189/zephyr/releases/download/1.0.0/tee-raw.bin
     wget https://github.com/stevenlee7189/zephyr/releases/download/1.0.0/u-boot-nodtb.bin
     wget https://github.com/stevenlee7189/zephyr/releases/download/1.0.0/u-boot.dtb
     wget https://github.com/stevenlee7189/zephyr/releases/download/1.0.0/image-bmc.tar.zst
     tar --zstd -xvf image-bmc.tar.zst

     qemu-system-aarch64 -machine ast2700fc \
       -device loader,force-raw=on,addr=0x400000000,file=u-boot-nodtb.bin \
       -device loader,force-raw=on,addr=$((0x400000000 + 748896)),file=u-boot.dtb\
       -device loader,force-raw=on,addr=0x430000000,file=bl31.bin\
       -device loader,force-raw=on,addr=0x430080000,file=tee-raw.bin\
       -device loader,file=ast2700-ssp.elf,cpu-num=4 \
       -device loader,file=ast2700-tsp.elf,cpu-num=5 \
       -device loader,cpu-num=0,addr=0x430000000 \
       -device loader,cpu-num=1,addr=0x430000000 \
       -device loader,cpu-num=2,addr=0x430000000 \
       -device loader,cpu-num=3,addr=0x430000000 \
       -m 1G \
       -drive file=image-bmc,if=mtd,format=raw \
       -serial pty -serial pty -serial pty \
       -S -nographic
     char device redirected to /dev/pts/51 (label serial0)
     char device redirected to /dev/pts/52 (label serial1)
     char device redirected to /dev/pts/53 (label serial2)

     tio /dev/pts/51
     tio /dev/pts/52
     tio /dev/pts/53
     (qemu) c
---
  hw/arm/aspeed_ast27x0-fc.c  | 211 ++++++++++++++++++++++++++++++++++++
  hw/arm/meson.build          |   4 +-
  include/hw/arm/aspeed_soc.h |  12 ++
  3 files changed, 226 insertions(+), 1 deletion(-)

create mode 100644 hw/arm/aspeed_ast27x0-fc.c

hw/arm/aspeed_ast27x0-fc.c new file +119 -0
new file mode 100644
index 0000000000..aeb0996a97
@@ -0,0 +1,211 @@
+/*
+ * ASPEED SoC 2700 family
+ *
+ * Copyright (C) 2024 ASPEED Technology Inc.
+ *
+ * This code is licensed under the GPL version 2 or later.  See
+ * the COPYING file in the top-level directory.
+ *
+ * Implementation extracted from the AST2600 and adapted for AST2700.
+ */
+
+#include "qemu/osdep.h"
+#include "qemu/units.h"
+#include "qapi/error.h"
+#include "system/block-backend.h"
+#include "system/system.h"
+#include "hw/arm/aspeed.h"
+#include "hw/boards.h"
+#include "hw/qdev-clock.h"
+#include "hw/arm/aspeed_soc.h"
+#include "hw/loader.h"
+#include "hw/arm/boot.h"
+#include "hw/block/flash.h"
+
+#define TYPE_AST2700FC MACHINE_TYPE_NAME("ast2700fc")
+OBJECT_DECLARE_SIMPLE_TYPE(Ast2700FCState, AST2700FC);
+
+static struct arm_boot_info ast2700fc_board_binfo = {
+    .board_id = -1, /* device-tree-only board */
+};
+
+struct Ast2700FCState {
+    MachineState parent_obj;
+
+    MemoryRegion ca35_memory;
+    MemoryRegion ca35_dram;
+    MemoryRegion ca35_boot_rom;
+    MemoryRegion ssp_memory;
+    MemoryRegion tsp_memory;
+
+    Clock *ssp_sysclk;
+    Clock *tsp_sysclk;
+
+    Aspeed27x0SoCState ca35;
+    Aspeed27x0CM4SoCState ssp;
+    Aspeed27x0CM4SoCState tsp;
+
+    bool mmio_exec;
+};
+
+#define AST2700FC_BMC_RAM_SIZE (1 * GiB)
+#define AST2700FC_BMC_SRAM_SIZE (1 * GiB)
+> +#define AST2700FC_HW_STRAP1 0x000000C0
+#define AST2700FC_HW_STRAP2 0x00000003
+#define AST2700FC_FMC_MODEL "w25q01jvq"
+#define AST2700FC_SPI_MODEL "w25q512jv"
+
+static void ast2700fc_install_boot_rom(Ast2700FCState *s, BlockBackend *blk,
+                                    uint64_t rom_size)
+{
+    AspeedSoCState *soc = ASPEED_SOC(&s->ca35);
+    AspeedSoCClass *sc = ASPEED_SOC_GET_CLASS(soc);
+
+    memory_region_init_rom(&s->ca35_boot_rom, NULL, "aspeed.boot_rom", rom_size,
+                           &error_abort);
+    memory_region_add_subregion_overlap(&soc->spi_boot_container, 0,
+                                        &s->ca35_boot_rom, 1);
+    write_boot_rom(blk, sc->memmap[ASPEED_DEV_SPI_BOOT],
+                   rom_size, &error_abort);
+}
+
+static void ast2700fc_ca35_init(MachineState *machine)
+{
+    Ast2700FCState *s = AST2700FC(machine);
+    AspeedSoCState *soc;
+    AspeedSoCClass *sc;
+    DriveInfo *emmc0 = NULL;
+    bool boot_emmc;
+    int i;
+
+    object_initialize_child(OBJECT(s), "ca35", &s->ca35, "ast2700-a0");
+    soc = ASPEED_SOC(&s->ca35);
+    sc = ASPEED_SOC_GET_CLASS(soc);
+
+    memory_region_init(&s->ca35_memory, OBJECT(&s->ca35), "ca35-memory",
+                       UINT64_MAX);
+
+    memory_region_init_ram(&s->ca35_dram, OBJECT(&s->ca35), "ca35-dram",
+                           AST2700FC_BMC_SRAM_SIZE, &error_abort);
+    object_property_set_link(OBJECT(&s->ca35), "memory",
+                             OBJECT(&s->ca35_memory),
+                             &error_abort);
+    object_property_set_link(OBJECT(&s->ca35), "dram", OBJECT(&s->ca35_dram),
+                             &error_abort);
+    object_property_set_int(OBJECT(&s->ca35), "ram-size",
+                            AST2700FC_BMC_RAM_SIZE,
+                            &error_abort);
+    object_property_set_int(OBJECT(&s->ca35), "hw-strap1", AST2700FC_HW_STRAP1,
+                            &error_abort);
+    object_property_set_int(OBJECT(&s->ca35), "hw-strap2", AST2700FC_HW_STRAP2,
+                            &error_abort);
+    aspeed_soc_uart_set_chr(soc, ASPEED_DEV_UART12, serial_hd(0));
+    qdev_realize(DEVICE(&s->ca35), NULL, &error_abort);
+
+    aspeed_board_init_flashes(&soc->fmc, AST2700FC_FMC_MODEL, 2, 0);
+    aspeed_board_init_flashes(&soc->spi[0], AST2700FC_SPI_MODEL, 1, 2);
+
+    for (i = 0; i < soc->sdhci.num_slots; i++) {
+        sdhci_attach_drive(&soc->sdhci.slots[i],
+                           drive_get(IF_SD, 0, i), false, false);
+    }
+    boot_emmc = sc->boot_from_emmc(soc);
+
+    if (soc->emmc.num_slots) {
+        emmc0 = drive_get(IF_SD, 0, soc->sdhci.num_slots);
+        sdhci_attach_drive(&soc->emmc.slots[0], emmc0, true, boot_emmc);
+    }
+
+    if (!s->mmio_exec) {

hw/arm/aspeed_ast27x0-fc.c line 129

Quoted 10 lines
hw/arm/aspeed_ast27x0-fc.c new file +10 -0
+        DeviceState *dev = ssi_get_cs(soc->fmc.spi, 0);
+        BlockBackend *fmc0 = dev ? m25p80_get_blk(dev) : NULL;
+
+        if (fmc0 && !boot_emmc) {
+            uint64_t rom_size = memory_region_size(&soc->spi_boot);
+            ast2700fc_install_boot_rom(s, fmc0, rom_size);
+        } else if (emmc0) {
+            ast2700fc_install_boot_rom(s, blk_by_legacy_dinfo(emmc0), 64 * KiB);
+        }
+    }

could you please remove the sdhci and emmc parts as they seem unused.

Quoted 10 lines
hw/arm/aspeed_ast27x0-fc.c new file +10 -0
+    ast2700fc_board_binfo.ram_size = machine->ram_size;
+    ast2700fc_board_binfo.loader_start = sc->memmap[ASPEED_DEV_SDRAM];
+
+    arm_load_kernel(ARM_CPU(first_cpu), machine, &ast2700fc_board_binfo);
+}
+
+static void ast2700fc_ssp_init(MachineState *machine)
+{
+    AspeedSoCState *soc;
+    Ast2700FCState *s = AST2700FC(machine);

hw/arm/aspeed_ast27x0-fc.c line 151

Quoted 10 lines
hw/arm/aspeed_ast27x0-fc.c new file +10 -0
+    s->ssp_sysclk = clock_new(OBJECT(s), "SSP_SYSCLK");
+    clock_set_hz(s->ssp_sysclk, 200000000ULL);
+
+    object_initialize_child(OBJECT(s), "ssp", &s->ssp, "ast2700ssp-a0");
+    memory_region_init(&s->ssp_memory, OBJECT(&s->ssp), "ssp-memory",
+                       UINT64_MAX);
+
+    qdev_connect_clock_in(DEVICE(&s->ssp), "sysclk", s->ssp_sysclk);
+    object_property_set_link(OBJECT(&s->ssp), "memory", OBJECT(&s->ssp_memory),
+                             &error_abort);

What is the RAM size ?

Quoted 84 lines
hw/arm/aspeed_ast27x0-fc.c new file +59 -0
+    soc = ASPEED_SOC(&s->ssp);
+    aspeed_soc_uart_set_chr(soc, ASPEED_DEV_UART4, serial_hd(1));
+    qdev_realize(DEVICE(&s->ssp), NULL, &error_abort);
+}
+
+static void ast2700fc_tsp_init(MachineState *machine)
+{
+    AspeedSoCState *soc;
+    Ast2700FCState *s = AST2700FC(machine);
+    s->tsp_sysclk = clock_new(OBJECT(s), "TSP_SYSCLK");
+    clock_set_hz(s->tsp_sysclk, 200000000ULL);
+
+    object_initialize_child(OBJECT(s), "tsp", &s->tsp, "ast2700tsp-a0");
+    memory_region_init(&s->tsp_memory, OBJECT(&s->tsp), "tsp-memory",
+                       UINT64_MAX);
+
+    qdev_connect_clock_in(DEVICE(&s->tsp), "sysclk", s->tsp_sysclk);
+    object_property_set_link(OBJECT(&s->tsp), "memory", OBJECT(&s->tsp_memory),
+                             &error_abort);
+
+    soc = ASPEED_SOC(&s->tsp);
+    aspeed_soc_uart_set_chr(soc, ASPEED_DEV_UART4, serial_hd(2));
+    qdev_realize(DEVICE(&s->tsp), NULL, &error_abort);
+}
+
+static void ast2700fc_init(MachineState *machine)
+{
+    ast2700fc_ca35_init(machine);
+    ast2700fc_ssp_init(machine);
+    ast2700fc_tsp_init(machine);
+}
+
+static void ast2700fc_instance_init(Object *obj)
+{
+    AST2700FC(obj)->mmio_exec = false;
+}
+
+static void ast2700fc_class_init(ObjectClass *oc, void *data)
+{
+    MachineClass *mc = MACHINE_CLASS(oc);
+
+    mc->desc = "ast2700 full cores support";
+    mc->init = ast2700fc_init;
+    mc->no_floppy = 1;
+    mc->no_cdrom = 1;
+    mc->min_cpus = mc->max_cpus = mc->default_cpus = 6;
+}
+
+static const TypeInfo ast2700fc_types[] = {
+    {
+        .name           = MACHINE_TYPE_NAME("ast2700fc"),
+        .parent         = TYPE_MACHINE,
+        .class_init     = ast2700fc_class_init,
+        .instance_size  = sizeof(Ast2700FCState),
+        .instance_init  = ast2700fc_instance_init,
+    },
+};
+
+DEFINE_TYPES(ast2700fc_types)
hw/arm/meson.build +3 -1
index cd7780b997..7b99f78aed 100644
@@ -47,7 +47,9 @@ arm_ss.add(when: 'CONFIG_ASPEED_SOC', if_true: files(
    'aspeed_ast10x0.c',
    'aspeed_eeprom.c',
    'fby35.c'))
-arm_ss.add(when: ['CONFIG_ASPEED_SOC', 'TARGET_AARCH64'], if_true: files('aspeed_ast27x0.c'))
+arm_ss.add(when: ['CONFIG_ASPEED_SOC', 'TARGET_AARCH64'], if_true: files(
+  'aspeed_ast27x0.c',
+  'aspeed_ast27x0-fc.c'))
  arm_ss.add(when: 'CONFIG_MPS2', if_true: files('mps2.c'))
  arm_ss.add(when: 'CONFIG_MPS2', if_true: files('mps2-tz.c'))
  arm_ss.add(when: 'CONFIG_MSF2', if_true: files('msf2-soc.c'))
include/hw/arm/aspeed_soc.h +2 -0
index 7de69dc57d..f6b38a0666 100644
@@ -129,6 +129,18 @@ struct Aspeed2600SoCState {
  #define TYPE_ASPEED2600_SOC "aspeed2600-soc"
  OBJECT_DECLARE_SIMPLE_TYPE(Aspeed2600SoCState, ASPEED2600_SOC)
 
+struct Aspeed27x0CA35SoCState {
+    AspeedSoCState parent;

include/hw/arm/aspeed_soc.h struct Aspeed2600SoCState { · line 143

Quoted 10 lines
include/hw/arm/aspeed_soc.h +10 -0
+
+    ARMCPU cpu[ASPEED_CPUS_NUM];
+    AspeedINTCState intc;
+    GICv3State gic;
+    MemoryRegion dram_empty;
+};
+
+#define TYPE_ASPEED27X0CA35_SOC "aspeed27x0ca35-soc"
+OBJECT_DECLARE_SIMPLE_TYPE(Aspeed27x0CA35SoCState, ASPEED27X0CA35_SOC)
+

This is unused.

Thanks,

C.

Quoted 3 lines
include/hw/arm/aspeed_soc.h +0 -0
  struct Aspeed27x0CM4SoCState {
      AspeedSoCState parent;
 
#14 lore raw

RE: [PATCH 4/5] aspeed: Introduce ast2700-fc machine

Hi Cédric,

Quoted 218 lines

-----Original Message-----
From: Cédric Le Goater <[email protected]>
Sent: Thursday, January 2, 2025 4:42 PM
To: Steven Lee <[email protected]>; Peter Maydell <[email protected]>; Troy Lee <[email protected]>; Jamin Lin <[email protected]>; Andrew Jeffery <[email protected]>; Joel Stanley <[email protected]>; open list:ASPEED BMCs <[email protected]>; open list:All patches CC here <[email protected]>
Cc: Troy Lee <[email protected]>; Yunlin Tang <[email protected]>
Subject: Re: [PATCH 4/5] aspeed: Introduce ast2700-fc machine

Quoted 8 lines · Steven Lee

This patch introduces a new machine, ast2700-fc, which supports all cores available in the AST27x0 SoC. In this machine
- The first 4 cores are Cortex-A35 cores.
- CPU 4 is designated as the SSP core.
- CPU 5 is designated as the TSP core.

Test Step:
wget

https://github.com/stevenlee7189/zephyr/releases/download/1.0.0/ast2700-ss
p.elf

Quoted 1 line

wget

https://github.com/stevenlee7189/zephyr/releases/download/1.0.0/ast2700-ts
p.elf

Quoted 1 line

wget

https://github.com/stevenlee7189/zephyr/releases/download/1.0.0/bl31.bin

Quoted 1 line

wget

https://github.com/stevenlee7189/zephyr/releases/download/1.0.0/tee-raw.bi
n

Quoted 1 line

wget

https://github.com/stevenlee7189/zephyr/releases/download/1.0.0/u-boot-nod
tb.bin

Quoted 1 line

wget

https://github.com/stevenlee7189/zephyr/releases/download/1.0.0/u-boot.dtb

Quoted 1 line

wget

https://github.com/stevenlee7189/zephyr/releases/download/1.0.0/image-bm
c.tar.zst

Quoted 4 lines
     tar --zstd -xvf image-bmc.tar.zst

     qemu-system-aarch64 -machine ast2700fc \
       -device

loader,force-raw=on,addr=0x400000000,file=u-boot-nodtb.bin \

Quoted 1 line
       -device loader,force-raw=on,addr=$((0x400000000 +

748896)),file=u-boot.dtb\

Quoted 21 lines
       -device loader,force-raw=on,addr=0x430000000,file=bl31.bin\
       -device loader,force-raw=on,addr=0x430080000,file=tee-raw.bin\
       -device loader,file=ast2700-ssp.elf,cpu-num=4 \
       -device loader,file=ast2700-tsp.elf,cpu-num=5 \
       -device loader,cpu-num=0,addr=0x430000000 \
       -device loader,cpu-num=1,addr=0x430000000 \
       -device loader,cpu-num=2,addr=0x430000000 \
       -device loader,cpu-num=3,addr=0x430000000 \
       -m 1G \
       -drive file=image-bmc,if=mtd,format=raw \
       -serial pty -serial pty -serial pty \
       -S -nographic
     char device redirected to /dev/pts/51 (label serial0)
     char device redirected to /dev/pts/52 (label serial1)
     char device redirected to /dev/pts/53 (label serial2)

     tio /dev/pts/51
     tio /dev/pts/52
     tio /dev/pts/53
     (qemu) c
Quoted 3 lines
---
  hw/arm/aspeed_ast27x0-fc.c  | 211

++++++++++++++++++++++++++++++++++++

Quoted 53 lines
  hw/arm/meson.build          |   4 +-
  include/hw/arm/aspeed_soc.h |  12 ++
  3 files changed, 226 insertions(+), 1 deletion(-)

create mode 100644 hw/arm/aspeed_ast27x0-fc.c

hw/arm/aspeed_ast27x0-fc.c new file +43 -0
new file mode 100644 index 0000000000..aeb0996a97
@@ -0,0 +1,211 @@
+/*
+ * ASPEED SoC 2700 family
+ *
+ * Copyright (C) 2024 ASPEED Technology Inc.
+ *
+ * This code is licensed under the GPL version 2 or later.  See
+ * the COPYING file in the top-level directory.
+ *
+ * Implementation extracted from the AST2600 and adapted for AST2700.
+ */
+
+#include "qemu/osdep.h"
+#include "qemu/units.h"
+#include "qapi/error.h"
+#include "system/block-backend.h"
+#include "system/system.h"
+#include "hw/arm/aspeed.h"
+#include "hw/boards.h"
+#include "hw/qdev-clock.h"
+#include "hw/arm/aspeed_soc.h"
+#include "hw/loader.h"
+#include "hw/arm/boot.h"
+#include "hw/block/flash.h"
+
+#define TYPE_AST2700FC MACHINE_TYPE_NAME("ast2700fc")
+OBJECT_DECLARE_SIMPLE_TYPE(Ast2700FCState, AST2700FC);
+
+static struct arm_boot_info ast2700fc_board_binfo = {
+    .board_id = -1, /* device-tree-only board */ };
+
+struct Ast2700FCState {
+    MachineState parent_obj;
+
+    MemoryRegion ca35_memory;
+    MemoryRegion ca35_dram;
+    MemoryRegion ca35_boot_rom;
+    MemoryRegion ssp_memory;
+    MemoryRegion tsp_memory;
+
+    Clock *ssp_sysclk;
+    Clock *tsp_sysclk;
+
+    Aspeed27x0SoCState ca35;

hw/arm/aspeed_ast27x0-fc.c line 53

Quoted 10 lines
hw/arm/aspeed_ast27x0-fc.c new file +10 -0
+    Aspeed27x0CM4SoCState ssp;
+    Aspeed27x0CM4SoCState tsp;
+
+    bool mmio_exec;
+};
+
+#define AST2700FC_BMC_RAM_SIZE (1 * GiB) #define
+AST2700FC_BMC_SRAM_SIZE (1 * GiB)
+> +#define AST2700FC_HW_STRAP1 0x000000C0
+#define AST2700FC_HW_STRAP2 0x00000003 #define

AST2700FC_FMC_MODEL

hw/arm/aspeed_ast27x0-fc.c

Quoted 4 lines
hw/arm/aspeed_ast27x0-fc.c new file +4 -0
+"w25q01jvq"
+#define AST2700FC_SPI_MODEL "w25q512jv"
+
+static void ast2700fc_install_boot_rom(Ast2700FCState *s, BlockBackend

*blk,

hw/arm/aspeed_ast27x0-fc.c

Quoted 5 lines
hw/arm/aspeed_ast27x0-fc.c new file +5 -0
+                                    uint64_t rom_size) {
+    AspeedSoCState *soc = ASPEED_SOC(&s->ca35);
+    AspeedSoCClass *sc = ASPEED_SOC_GET_CLASS(soc);
+
+    memory_region_init_rom(&s->ca35_boot_rom, NULL,

"aspeed.boot_rom", rom_size,

Quoted 9 lines
hw/arm/aspeed_ast27x0-fc.c new file +9 -0
+                           &error_abort);
+    memory_region_add_subregion_overlap(&soc->spi_boot_container, 0,
+                                        &s->ca35_boot_rom, 1);
+    write_boot_rom(blk, sc->memmap[ASPEED_DEV_SPI_BOOT],
+                   rom_size, &error_abort); }
+
+static void ast2700fc_ca35_init(MachineState *machine) {
+    Ast2700FCState *s = AST2700FC(machine);
+    AspeedSoCState *soc;

hw/arm/aspeed_ast27x0-fc.c

Quoted 10 lines
hw/arm/aspeed_ast27x0-fc.c new file +10 -0
+    AspeedSoCClass *sc;
+    DriveInfo *emmc0 = NULL;
+    bool boot_emmc;
+    int i;
+
+    object_initialize_child(OBJECT(s), "ca35", &s->ca35, "ast2700-a0");
+    soc = ASPEED_SOC(&s->ca35);
+    sc = ASPEED_SOC_GET_CLASS(soc);
+
+    memory_region_init(&s->ca35_memory, OBJECT(&s->ca35),

"ca35-memory",

hw/arm/aspeed_ast27x0-fc.c

Quoted 3 lines
hw/arm/aspeed_ast27x0-fc.c new file +3 -0
+                       UINT64_MAX);
+
+    memory_region_init_ram(&s->ca35_dram, OBJECT(&s->ca35),

"ca35-dram",

hw/arm/aspeed_ast27x0-fc.c line 85

Quoted 1 line
hw/arm/aspeed_ast27x0-fc.c new file +1 -0
+                           AST2700FC_BMC_SRAM_SIZE,

&error_abort);

hw/arm/aspeed_ast27x0-fc.c

Quoted 4 lines
hw/arm/aspeed_ast27x0-fc.c new file +4 -0
+    object_property_set_link(OBJECT(&s->ca35), "memory",
+                             OBJECT(&s->ca35_memory),
+                             &error_abort);
+    object_property_set_link(OBJECT(&s->ca35), "dram",

OBJECT(&s->ca35_dram),

hw/arm/aspeed_ast27x0-fc.c

Quoted 5 lines
hw/arm/aspeed_ast27x0-fc.c new file +5 -0
+                             &error_abort);
+    object_property_set_int(OBJECT(&s->ca35), "ram-size",
+                            AST2700FC_BMC_RAM_SIZE,
+                            &error_abort);
+    object_property_set_int(OBJECT(&s->ca35), "hw-strap1",

AST2700FC_HW_STRAP1,

hw/arm/aspeed_ast27x0-fc.c line 96

Quoted 2 lines
hw/arm/aspeed_ast27x0-fc.c new file +2 -0
+                            &error_abort);
+    object_property_set_int(OBJECT(&s->ca35), "hw-strap2",

AST2700FC_HW_STRAP2,

hw/arm/aspeed_ast27x0-fc.c

Quoted 5 lines
hw/arm/aspeed_ast27x0-fc.c new file +5 -0
+                            &error_abort);
+    aspeed_soc_uart_set_chr(soc, ASPEED_DEV_UART12, serial_hd(0));
+    qdev_realize(DEVICE(&s->ca35), NULL, &error_abort);
+
+    aspeed_board_init_flashes(&soc->fmc, AST2700FC_FMC_MODEL, 2,

0);

hw/arm/aspeed_ast27x0-fc.c

Quoted 12 lines
hw/arm/aspeed_ast27x0-fc.c new file +12 -0
+    aspeed_board_init_flashes(&soc->spi[0], AST2700FC_SPI_MODEL, 1,
+ 2);
+
+    for (i = 0; i < soc->sdhci.num_slots; i++) {
+        sdhci_attach_drive(&soc->sdhci.slots[i],
+                           drive_get(IF_SD, 0, i), false, false);
+    }
+    boot_emmc = sc->boot_from_emmc(soc);
+
+    if (soc->emmc.num_slots) {
+        emmc0 = drive_get(IF_SD, 0, soc->sdhci.num_slots);
+        sdhci_attach_drive(&soc->emmc.slots[0], emmc0, true,

boot_emmc);

hw/arm/aspeed_ast27x0-fc.c

Quoted 11 lines
hw/arm/aspeed_ast27x0-fc.c new file +11 -0
+    }
+
+    if (!s->mmio_exec) {
+        DeviceState *dev = ssi_get_cs(soc->fmc.spi, 0);
+        BlockBackend *fmc0 = dev ? m25p80_get_blk(dev) : NULL;
+
+        if (fmc0 && !boot_emmc) {
+            uint64_t rom_size = memory_region_size(&soc->spi_boot);
+            ast2700fc_install_boot_rom(s, fmc0, rom_size);
+        } else if (emmc0) {
+            ast2700fc_install_boot_rom(s, blk_by_legacy_dinfo(emmc0),

64 * KiB);

Quoted 5 lines

hw/arm/aspeed_ast27x0-fc.c line 126

Quoted 2 lines
hw/arm/aspeed_ast27x0-fc.c new file +2 -0
+        }
+    }

could you please remove the sdhci and emmc parts as they seem unused.

Thanks for the review.
Will remove them.

Quoted 16 lines
Quoted 5 lines
hw/arm/aspeed_ast27x0-fc.c new file +5 -0
+    ast2700fc_board_binfo.ram_size = machine->ram_size;
+    ast2700fc_board_binfo.loader_start =
+ sc->memmap[ASPEED_DEV_SDRAM];
+
+    arm_load_kernel(ARM_CPU(first_cpu), machine,

hw/arm/aspeed_ast27x0-fc.c

Quoted 10 lines
hw/arm/aspeed_ast27x0-fc.c new file +10 -0
+&ast2700fc_board_binfo); }
+
+static void ast2700fc_ssp_init(MachineState *machine) {
+    AspeedSoCState *soc;
+    Ast2700FCState *s = AST2700FC(machine);
+    s->ssp_sysclk = clock_new(OBJECT(s), "SSP_SYSCLK");
+    clock_set_hz(s->ssp_sysclk, 200000000ULL);
+
+    object_initialize_child(OBJECT(s), "ssp", &s->ssp, "ast2700ssp-a0");
+    memory_region_init(&s->ssp_memory, OBJECT(&s->ssp),

"ssp-memory",

Quoted 8 lines

hw/arm/aspeed_ast27x0-fc.c

Quoted 4 lines
hw/arm/aspeed_ast27x0-fc.c new file +4 -0
+                       UINT64_MAX);
+
+    qdev_connect_clock_in(DEVICE(&s->ssp), "sysclk", s->ssp_sysclk);
+    object_property_set_link(OBJECT(&s->ssp), "memory",

OBJECT(&s->ssp_memory),

hw/arm/aspeed_ast27x0-fc.c line 146

Quoted 1 line
hw/arm/aspeed_ast27x0-fc.c new file +1 -0
+                             &error_abort);

What is the RAM size ?

Both ssp and tsp has 32mb ram.
Will add ram-size

Quoted 81 lines

hw/arm/aspeed_ast27x0-fc.c

Quoted 13 lines
hw/arm/aspeed_ast27x0-fc.c new file +12 -0
+    soc = ASPEED_SOC(&s->ssp);
+    aspeed_soc_uart_set_chr(soc, ASPEED_DEV_UART4, serial_hd(1));
+    qdev_realize(DEVICE(&s->ssp), NULL, &error_abort); }
+
+static void ast2700fc_tsp_init(MachineState *machine) {
+    AspeedSoCState *soc;
+    Ast2700FCState *s = AST2700FC(machine);
+    s->tsp_sysclk = clock_new(OBJECT(s), "TSP_SYSCLK");
+    clock_set_hz(s->tsp_sysclk, 200000000ULL);
+
+    object_initialize_child(OBJECT(s), "tsp", &s->tsp, "ast2700tsp-a0");
+    memory_region_init(&s->tsp_memory, OBJECT(&s->tsp),

"tsp-memory",

hw/arm/aspeed_ast27x0-fc.c

Quoted 4 lines
hw/arm/aspeed_ast27x0-fc.c new file +4 -0
+                       UINT64_MAX);
+
+    qdev_connect_clock_in(DEVICE(&s->tsp), "sysclk", s->tsp_sysclk);
+    object_property_set_link(OBJECT(&s->tsp), "memory",

OBJECT(&s->tsp_memory),

hw/arm/meson.build arm_ss.add(when: 'CONFIG_ASPEED_SOC', if_true:

Quoted 40 lines
hw/arm/aspeed_ast27x0-fc.c new file +35 -0
+                             &error_abort);
+
+    soc = ASPEED_SOC(&s->tsp);
+    aspeed_soc_uart_set_chr(soc, ASPEED_DEV_UART4, serial_hd(2));
+    qdev_realize(DEVICE(&s->tsp), NULL, &error_abort); }
+
+static void ast2700fc_init(MachineState *machine) {
+    ast2700fc_ca35_init(machine);
+    ast2700fc_ssp_init(machine);
+    ast2700fc_tsp_init(machine);
+}
+
+static void ast2700fc_instance_init(Object *obj) {
+    AST2700FC(obj)->mmio_exec = false; }
+
+static void ast2700fc_class_init(ObjectClass *oc, void *data) {
+    MachineClass *mc = MACHINE_CLASS(oc);
+
+    mc->desc = "ast2700 full cores support";
+    mc->init = ast2700fc_init;
+    mc->no_floppy = 1;
+    mc->no_cdrom = 1;
+    mc->min_cpus = mc->max_cpus = mc->default_cpus = 6; }
+
+static const TypeInfo ast2700fc_types[] = {
+    {
+        .name           = MACHINE_TYPE_NAME("ast2700fc"),
+        .parent         = TYPE_MACHINE,
+        .class_init     = ast2700fc_class_init,
+        .instance_size  = sizeof(Ast2700FCState),
+        .instance_init  = ast2700fc_instance_init,
+    },
+};
+
+DEFINE_TYPES(ast2700fc_types)
hw/arm/meson.build index renamed from hw/arm/meson.build +0 -0

cd7780b997..7b99f78aed 100644

hw/arm/meson.build +0 -0
@@ -47,7 +47,9 @@ arm_ss.add(when: 'CONFIG_ASPEED_SOC', if_true:

files(

Quoted 17 lines
hw/arm/meson.build +4 -2
    'aspeed_ast10x0.c',
    'aspeed_eeprom.c',
    'fby35.c'))
-arm_ss.add(when: ['CONFIG_ASPEED_SOC', 'TARGET_AARCH64'], if_true:
 files('aspeed_ast27x0.c'))
+arm_ss.add(when: ['CONFIG_ASPEED_SOC', 'TARGET_AARCH64'], if_true:
+files(
+  'aspeed_ast27x0.c',
+  'aspeed_ast27x0-fc.c'))
  arm_ss.add(when: 'CONFIG_MPS2', if_true: files('mps2.c'))
  arm_ss.add(when: 'CONFIG_MPS2', if_true: files('mps2-tz.c'))
  arm_ss.add(when: 'CONFIG_MSF2', if_true: files('msf2-soc.c')) diff
--git a/include/hw/arm/aspeed_soc.h b/include/hw/arm/aspeed_soc.h

index 7de69dc57d..f6b38a0666 100644

include/hw/arm/aspeed_soc.h struct Aspeed2600SoCState { · line 130

Quoted 2 lines
include/hw/arm/aspeed_soc.h +0 -0
@@ -129,6 +129,18 @@ struct Aspeed2600SoCState {
  #define TYPE_ASPEED2600_SOC "aspeed2600-soc"
  OBJECT_DECLARE_SIMPLE_TYPE(Aspeed2600SoCState,

ASPEED2600_SOC)

Quoted 1 line
Quoted 17 lines

include/hw/arm/aspeed_soc.h struct Aspeed2600SoCState { · line 143

Quoted 13 lines
include/hw/arm/aspeed_soc.h +13 -0
+struct Aspeed27x0CA35SoCState {
+    AspeedSoCState parent;
+
+    ARMCPU cpu[ASPEED_CPUS_NUM];
+    AspeedINTCState intc;
+    GICv3State gic;
+    MemoryRegion dram_empty;
+};
+
+#define TYPE_ASPEED27X0CA35_SOC "aspeed27x0ca35-soc"
+OBJECT_DECLARE_SIMPLE_TYPE(Aspeed27x0CA35SoCState,
+ASPEED27X0CA35_SOC)
+

This is unused.

Will remove it.

Quoted 9 lines

Thanks,

C.

Quoted 3 lines
  struct Aspeed27x0CM4SoCState {
      AspeedSoCState parent;
#15 lore raw

PATCH 2/5 aspeed: ast27x0: Map unimplemented devices in SoC memory

In reply to Steven Lee via

Maps following unimplemented devices in SoC memory
- dpmcu
- iomem0
- iomem1
- ltpi
- io

---
 hw/arm/aspeed_ast27x0.c     | 45 +++++++++++++++++++++++++++++++------
 include/hw/arm/aspeed_soc.h |  6 +++++
 2 files changed, 44 insertions(+), 7 deletions(-)
hw/arm/aspeed_ast27x0.c +38 -7
index fee3755837..fd09872403 100644
@@ -23,11 +23,19 @@
 #include "qapi/qmp/qlist.h"
 #include "qemu/log.h"
 
+#define AST2700_SOC_IO_SIZE          0x04000000
+#define AST2700_SOC_IOMEM_SIZE       0x01000000
+#define AST2700_SOC_DPMCU_SIZE       0x00040000
+#define AST2700_SOC_LTPI_SIZE        0x01000000
+
 static const hwaddr aspeed_soc_ast2700_memmap[] = {
     [ASPEED_DEV_SPI_BOOT]  =  0x400000000,
+    [ASPEED_DEV_IOMEM]     =  0x00000000,
     [ASPEED_DEV_SRAM]      =  0x10000000,
+    [ASPEED_DEV_IOMEM0]    =  0x12000000,
     [ASPEED_DEV_SDMC]      =  0x12C00000,
     [ASPEED_DEV_SCU]       =  0x12C02000,
+    [ASPEED_DEV_IOMEM1]    =  0x14000000,
     [ASPEED_DEV_SCUIO]     =  0x14C02000,
     [ASPEED_DEV_UART0]     =  0X14C33000,
     [ASPEED_DEV_UART1]     =  0X14C33100,
@@ -66,6 +74,7 @@ static const hwaddr aspeed_soc_ast2700_memmap[] = {
     [ASPEED_DEV_GPIO]      =  0x14C0B000,
     [ASPEED_DEV_RTC]       =  0x12C0F000,
     [ASPEED_DEV_SDHCI]     =  0x14080000,
+    [ASPEED_DEV_LTPI]      =  0x30000000,
 };
 
 #define AST2700_MAX_IRQ 256
@@ -397,6 +406,14 @@ static void aspeed_soc_ast2700_init(Object *obj)
 
     object_initialize_child(obj, "emmc-controller.sdhci", &s->emmc.slots[0],
                             TYPE_SYSBUS_SDHCI);
+
+    object_initialize_child(obj, "dpmcu", &s->dpmcu, TYPE_UNIMPLEMENTED_DEVICE);
+    object_initialize_child(obj, "ltpi", &s->ltpi, TYPE_UNIMPLEMENTED_DEVICE);
+    object_initialize_child(obj, "io", &s->iomem, TYPE_UNIMPLEMENTED_DEVICE);
+    object_initialize_child(obj, "iomem0", &s->iomem0,
+            TYPE_UNIMPLEMENTED_DEVICE);
+    object_initialize_child(obj, "iomem1", &s->iomem1,
+            TYPE_UNIMPLEMENTED_DEVICE);
 }
 
 /*
@@ -432,8 +449,10 @@ static bool aspeed_soc_ast2700_gic_realize(DeviceState *dev, Error **errp)
     if (!sysbus_realize(gicbusdev, errp)) {
         return false;
     }
-    sysbus_mmio_map(gicbusdev, 0, sc->memmap[ASPEED_GIC_DIST]);
-    sysbus_mmio_map(gicbusdev, 1, sc->memmap[ASPEED_GIC_REDIST]);
+    aspeed_mmio_map(s, SYS_BUS_DEVICE(&a->gic), 0,
+                    sc->memmap[ASPEED_GIC_DIST]);
+    aspeed_mmio_map(s, SYS_BUS_DEVICE(&a->gic), 1,
+                    sc->memmap[ASPEED_GIC_REDIST]);
 
     for (i = 0; i < sc->num_cpus; i++) {
         DeviceState *cpudev = DEVICE(&a->cpu[i]);
@@ -716,11 +735,23 @@ static void aspeed_soc_ast2700_realize(DeviceState *dev, Error **errp)
     sysbus_connect_irq(SYS_BUS_DEVICE(&s->emmc), 0,
                        aspeed_soc_get_irq(s, ASPEED_DEV_EMMC));
 
-    create_unimplemented_device("ast2700.dpmcu", 0x11000000, 0x40000);
-    create_unimplemented_device("ast2700.iomem0", 0x12000000, 0x01000000);
-    create_unimplemented_device("ast2700.iomem1", 0x14000000, 0x01000000);
-    create_unimplemented_device("ast2700.ltpi", 0x30000000, 0x1000000);
-    create_unimplemented_device("ast2700.io", 0x0, 0x4000000);
+    aspeed_mmio_map_unimplemented(s, SYS_BUS_DEVICE(&s->dpmcu), "aspeed.dpmcu",
+                                  sc->memmap[ASPEED_DEV_DPMCU],
+                                  AST2700_SOC_DPMCU_SIZE);
+    aspeed_mmio_map_unimplemented(s, SYS_BUS_DEVICE(&s->ltpi), "aspeed.ltpi",
+                                  sc->memmap[ASPEED_DEV_LTPI],
+                                  AST2700_SOC_LTPI_SIZE);
+    aspeed_mmio_map_unimplemented(s, SYS_BUS_DEVICE(&s->iomem), "aspeed.io",
+                                  sc->memmap[ASPEED_DEV_IOMEM],
+                                  AST2700_SOC_IO_SIZE);
+    aspeed_mmio_map_unimplemented(s, SYS_BUS_DEVICE(&s->iomem0),
+                                  "aspeed.iomem0",
+                                  sc->memmap[ASPEED_DEV_IOMEM0],
+                                  AST2700_SOC_IOMEM_SIZE);
+    aspeed_mmio_map_unimplemented(s, SYS_BUS_DEVICE(&s->iomem1),
+                                  "aspeed.iomem1",
+                                  sc->memmap[ASPEED_DEV_IOMEM1],
+                                  AST2700_SOC_IOMEM_SIZE);
 }
 
 static void aspeed_soc_ast2700_class_init(ObjectClass *oc, void *data)
include/hw/arm/aspeed_soc.h +6 -0
index 689f52dae8..bf885da3fc 100644
@@ -90,6 +90,8 @@ struct AspeedSoCState {
     SerialMM uart[ASPEED_UARTS_NUM];
     Clock *sysclk;
     UnimplementedDeviceState iomem;
+    UnimplementedDeviceState iomem0;
+    UnimplementedDeviceState iomem1;
     UnimplementedDeviceState video;
     UnimplementedDeviceState emmc_boot_controller;
     UnimplementedDeviceState dpmcu;
@@ -97,6 +99,7 @@ struct AspeedSoCState {
     UnimplementedDeviceState espi;
     UnimplementedDeviceState udc;
     UnimplementedDeviceState sgpiom;
+    UnimplementedDeviceState ltpi;
     UnimplementedDeviceState jtag[ASPEED_JTAG_NUM];
     AspeedAPB2OPBState fsi[2];
 };
@@ -172,6 +175,9 @@ const char *aspeed_soc_cpu_type(AspeedSoCClass *sc);
 enum {
     ASPEED_DEV_SPI_BOOT,
     ASPEED_DEV_IOMEM,
+    ASPEED_DEV_IOMEM0,
+    ASPEED_DEV_IOMEM1,
+    ASPEED_DEV_LTPI,
     ASPEED_DEV_UART0,
     ASPEED_DEV_UART1,
     ASPEED_DEV_UART2,
Signature · 1 line
2.34.1
#16 lore raw

Re: [PATCH 2/5] aspeed: ast27x0: Map unimplemented devices in SoC memory

Hello,

Quoted 6 lines · Steven Lee

Maps following unimplemented devices in SoC memory
- dpmcu
- iomem0
- iomem1
- ltpi
- io

Could you please add a sentence about what these devices are ?

Thanks,

C.

Quoted 126 lines
---
  hw/arm/aspeed_ast27x0.c     | 45 +++++++++++++++++++++++++++++++------
  include/hw/arm/aspeed_soc.h |  6 +++++
  2 files changed, 44 insertions(+), 7 deletions(-)
hw/arm/aspeed_ast27x0.c +38 -7
index fee3755837..fd09872403 100644
@@ -23,11 +23,19 @@
  #include "qapi/qmp/qlist.h"
  #include "qemu/log.h"
 
+#define AST2700_SOC_IO_SIZE          0x04000000
+#define AST2700_SOC_IOMEM_SIZE       0x01000000
+#define AST2700_SOC_DPMCU_SIZE       0x00040000
+#define AST2700_SOC_LTPI_SIZE        0x01000000
+
  static const hwaddr aspeed_soc_ast2700_memmap[] = {
      [ASPEED_DEV_SPI_BOOT]  =  0x400000000,
+    [ASPEED_DEV_IOMEM]     =  0x00000000,
      [ASPEED_DEV_SRAM]      =  0x10000000,
+    [ASPEED_DEV_IOMEM0]    =  0x12000000,
      [ASPEED_DEV_SDMC]      =  0x12C00000,
      [ASPEED_DEV_SCU]       =  0x12C02000,
+    [ASPEED_DEV_IOMEM1]    =  0x14000000,
      [ASPEED_DEV_SCUIO]     =  0x14C02000,
      [ASPEED_DEV_UART0]     =  0X14C33000,
      [ASPEED_DEV_UART1]     =  0X14C33100,
@@ -66,6 +74,7 @@ static const hwaddr aspeed_soc_ast2700_memmap[] = {
      [ASPEED_DEV_GPIO]      =  0x14C0B000,
      [ASPEED_DEV_RTC]       =  0x12C0F000,
      [ASPEED_DEV_SDHCI]     =  0x14080000,
+    [ASPEED_DEV_LTPI]      =  0x30000000,
  };
 
  #define AST2700_MAX_IRQ 256
@@ -397,6 +406,14 @@ static void aspeed_soc_ast2700_init(Object *obj)
 
      object_initialize_child(obj, "emmc-controller.sdhci", &s->emmc.slots[0],
                              TYPE_SYSBUS_SDHCI);
+
+    object_initialize_child(obj, "dpmcu", &s->dpmcu, TYPE_UNIMPLEMENTED_DEVICE);
+    object_initialize_child(obj, "ltpi", &s->ltpi, TYPE_UNIMPLEMENTED_DEVICE);
+    object_initialize_child(obj, "io", &s->iomem, TYPE_UNIMPLEMENTED_DEVICE);
+    object_initialize_child(obj, "iomem0", &s->iomem0,
+            TYPE_UNIMPLEMENTED_DEVICE);
+    object_initialize_child(obj, "iomem1", &s->iomem1,
+            TYPE_UNIMPLEMENTED_DEVICE);
  }
 
  /*
@@ -432,8 +449,10 @@ static bool aspeed_soc_ast2700_gic_realize(DeviceState *dev, Error **errp)
      if (!sysbus_realize(gicbusdev, errp)) {
          return false;
      }
-    sysbus_mmio_map(gicbusdev, 0, sc->memmap[ASPEED_GIC_DIST]);
-    sysbus_mmio_map(gicbusdev, 1, sc->memmap[ASPEED_GIC_REDIST]);
+    aspeed_mmio_map(s, SYS_BUS_DEVICE(&a->gic), 0,
+                    sc->memmap[ASPEED_GIC_DIST]);
+    aspeed_mmio_map(s, SYS_BUS_DEVICE(&a->gic), 1,
+                    sc->memmap[ASPEED_GIC_REDIST]);
 
      for (i = 0; i < sc->num_cpus; i++) {
          DeviceState *cpudev = DEVICE(&a->cpu[i]);
@@ -716,11 +735,23 @@ static void aspeed_soc_ast2700_realize(DeviceState *dev, Error **errp)
      sysbus_connect_irq(SYS_BUS_DEVICE(&s->emmc), 0,
                         aspeed_soc_get_irq(s, ASPEED_DEV_EMMC));
 
-    create_unimplemented_device("ast2700.dpmcu", 0x11000000, 0x40000);
-    create_unimplemented_device("ast2700.iomem0", 0x12000000, 0x01000000);
-    create_unimplemented_device("ast2700.iomem1", 0x14000000, 0x01000000);
-    create_unimplemented_device("ast2700.ltpi", 0x30000000, 0x1000000);
-    create_unimplemented_device("ast2700.io", 0x0, 0x4000000);
+    aspeed_mmio_map_unimplemented(s, SYS_BUS_DEVICE(&s->dpmcu), "aspeed.dpmcu",
+                                  sc->memmap[ASPEED_DEV_DPMCU],
+                                  AST2700_SOC_DPMCU_SIZE);
+    aspeed_mmio_map_unimplemented(s, SYS_BUS_DEVICE(&s->ltpi), "aspeed.ltpi",
+                                  sc->memmap[ASPEED_DEV_LTPI],
+                                  AST2700_SOC_LTPI_SIZE);
+    aspeed_mmio_map_unimplemented(s, SYS_BUS_DEVICE(&s->iomem), "aspeed.io",
+                                  sc->memmap[ASPEED_DEV_IOMEM],
+                                  AST2700_SOC_IO_SIZE);
+    aspeed_mmio_map_unimplemented(s, SYS_BUS_DEVICE(&s->iomem0),
+                                  "aspeed.iomem0",
+                                  sc->memmap[ASPEED_DEV_IOMEM0],
+                                  AST2700_SOC_IOMEM_SIZE);
+    aspeed_mmio_map_unimplemented(s, SYS_BUS_DEVICE(&s->iomem1),
+                                  "aspeed.iomem1",
+                                  sc->memmap[ASPEED_DEV_IOMEM1],
+                                  AST2700_SOC_IOMEM_SIZE);
  }
 
  static void aspeed_soc_ast2700_class_init(ObjectClass *oc, void *data)
include/hw/arm/aspeed_soc.h +6 -0
index 689f52dae8..bf885da3fc 100644
@@ -90,6 +90,8 @@ struct AspeedSoCState {
      SerialMM uart[ASPEED_UARTS_NUM];
      Clock *sysclk;
      UnimplementedDeviceState iomem;
+    UnimplementedDeviceState iomem0;
+    UnimplementedDeviceState iomem1;
      UnimplementedDeviceState video;
      UnimplementedDeviceState emmc_boot_controller;
      UnimplementedDeviceState dpmcu;
@@ -97,6 +99,7 @@ struct AspeedSoCState {
      UnimplementedDeviceState espi;
      UnimplementedDeviceState udc;
      UnimplementedDeviceState sgpiom;
+    UnimplementedDeviceState ltpi;
      UnimplementedDeviceState jtag[ASPEED_JTAG_NUM];
      AspeedAPB2OPBState fsi[2];
  };
@@ -172,6 +175,9 @@ const char *aspeed_soc_cpu_type(AspeedSoCClass *sc);
  enum {
      ASPEED_DEV_SPI_BOOT,
      ASPEED_DEV_IOMEM,
+    ASPEED_DEV_IOMEM0,
+    ASPEED_DEV_IOMEM1,
+    ASPEED_DEV_LTPI,
      ASPEED_DEV_UART0,
      ASPEED_DEV_UART1,
      ASPEED_DEV_UART2,
#17 lore raw

RE: [PATCH 2/5] aspeed: ast27x0: Map unimplemented devices in SoC memory

Hi Cédric,

Quoted 24 lines

-----Original Message-----
From: Cédric Le Goater <[email protected]>
Sent: Friday, December 27, 2024 5:53 PM
To: Steven Lee <[email protected]>; Peter Maydell <[email protected]>; Troy Lee <[email protected]>; Jamin Lin <[email protected]>; Andrew Jeffery <[email protected]>; Joel Stanley <[email protected]>; open list:ASPEED BMCs <[email protected]>; open list:All patches CC here <[email protected]>
Cc: Troy Lee <[email protected]>; Yunlin Tang <[email protected]>
Subject: Re: [PATCH 2/5] aspeed: ast27x0: Map unimplemented devices in SoC memory

Hello,

Quoted 6 lines · Steven Lee

Maps following unimplemented devices in SoC memory
- dpmcu
- iomem0
- iomem1
- ltpi
- io

Quoted 6 lines

Could you please add a sentence about what these devices are ?

Thanks,

C.

DPMCU stands for Display Port MCU controller.
Regarding LTPI, when the AST1700 is connected to the AST2700, AST1070 LTPI controller's registers are mapped to 0x30000000. Io, Iomem0 and Iomem1 include unimplemented controllers in the memory ranges 0x120000000 - 0x121000000 and 0x14000000 - 0x141000000. For instance:
- USB hub at 0x12010000
- eSPI at 0x14C5000
- PWM at 0x140C0000

I will include the description in the commit message.

Thanks,
Steven

Quoted 151 lines
Quoted 4 lines
---
  hw/arm/aspeed_ast27x0.c     | 45

+++++++++++++++++++++++++++++++------

hw/arm/aspeed_ast27x0.c static const hwaddr aspeed_soc_ast2700_memmap[] =

Quoted 28 lines
  include/hw/arm/aspeed_soc.h |  6 +++++
  2 files changed, 44 insertions(+), 7 deletions(-)
hw/arm/aspeed_ast27x0.c index renamed from hw/arm/aspeed_ast27x0.c +0 -0

fee3755837..fd09872403 100644

hw/arm/aspeed_ast27x0.c +8 -0
@@ -23,11 +23,19 @@
  #include "qapi/qmp/qlist.h"
  #include "qemu/log.h"
 
+#define AST2700_SOC_IO_SIZE          0x04000000
+#define AST2700_SOC_IOMEM_SIZE       0x01000000
+#define AST2700_SOC_DPMCU_SIZE       0x00040000
+#define AST2700_SOC_LTPI_SIZE        0x01000000
+
  static const hwaddr aspeed_soc_ast2700_memmap[] = {
      [ASPEED_DEV_SPI_BOOT]  =  0x400000000,
+    [ASPEED_DEV_IOMEM]     =  0x00000000,
      [ASPEED_DEV_SRAM]      =  0x10000000,
+    [ASPEED_DEV_IOMEM0]    =  0x12000000,
      [ASPEED_DEV_SDMC]      =  0x12C00000,
      [ASPEED_DEV_SCU]       =  0x12C02000,
+    [ASPEED_DEV_IOMEM1]    =  0x14000000,
      [ASPEED_DEV_SCUIO]     =  0x14C02000,
      [ASPEED_DEV_UART0]     =  0X14C33000,
      [ASPEED_DEV_UART1]     =  0X14C33100,
@@ -66,6 +74,7 @@ static const hwaddr aspeed_soc_ast2700_memmap[] =

{

hw/arm/aspeed_ast27x0.c static void aspeed_soc_ast2700_init(Object *obj) · line 407

Quoted 10 lines
hw/arm/aspeed_ast27x0.c +1 -0
      [ASPEED_DEV_GPIO]      =  0x14C0B000,
      [ASPEED_DEV_RTC]       =  0x12C0F000,
      [ASPEED_DEV_SDHCI]     =  0x14080000,
+    [ASPEED_DEV_LTPI]      =  0x30000000,
  };
 
  #define AST2700_MAX_IRQ 256
@@ -397,6 +406,14 @@ static void aspeed_soc_ast2700_init(Object *obj)
 
      object_initialize_child(obj, "emmc-controller.sdhci",

&s->emmc.slots[0],

hw/arm/aspeed_ast27x0.c static void aspeed_soc_ast2700_init(Object *obj)

Quoted 3 lines
hw/arm/aspeed_ast27x0.c +2 -0
                              TYPE_SYSBUS_SDHCI);
+
+    object_initialize_child(obj, "dpmcu", &s->dpmcu,

TYPE_UNIMPLEMENTED_DEVICE);

hw/arm/aspeed_ast27x0.c static void aspeed_soc_ast2700_init(Object *obj) · line 411

Quoted 1 line
hw/arm/aspeed_ast27x0.c +1 -0
+    object_initialize_child(obj, "ltpi", &s->ltpi,

TYPE_UNIMPLEMENTED_DEVICE);

hw/arm/aspeed_ast27x0.c static void aspeed_soc_ast2700_init(Object *obj) · line 412

Quoted 1 line
hw/arm/aspeed_ast27x0.c +1 -0
+    object_initialize_child(obj, "io", &s->iomem,

TYPE_UNIMPLEMENTED_DEVICE);

hw/arm/aspeed_ast27x0.c static bool

Quoted 8 lines
hw/arm/aspeed_ast27x0.c +4 -0
+    object_initialize_child(obj, "iomem0", &s->iomem0,
+            TYPE_UNIMPLEMENTED_DEVICE);
+    object_initialize_child(obj, "iomem1", &s->iomem1,
+            TYPE_UNIMPLEMENTED_DEVICE);
  }
 
  /*
@@ -432,8 +449,10 @@ static bool

aspeed_soc_ast2700_gic_realize(DeviceState *dev, Error **errp)

hw/arm/aspeed_ast27x0.c static bool aspeed_soc_ast2700_gic_realize(DeviceState *dev, Error **errp)

Quoted 12 lines
hw/arm/aspeed_ast27x0.c +4 -2
      if (!sysbus_realize(gicbusdev, errp)) {
          return false;
      }
-    sysbus_mmio_map(gicbusdev, 0, sc->memmap[ASPEED_GIC_DIST]);
-    sysbus_mmio_map(gicbusdev, 1, sc->memmap[ASPEED_GIC_REDIST]);
+    aspeed_mmio_map(s, SYS_BUS_DEVICE(&a->gic), 0,
+                    sc->memmap[ASPEED_GIC_DIST]);
+    aspeed_mmio_map(s, SYS_BUS_DEVICE(&a->gic), 1,
+                    sc->memmap[ASPEED_GIC_REDIST]);
 
      for (i = 0; i < sc->num_cpus; i++) {
          DeviceState *cpudev = DEVICE(&a->cpu[i]); @@ -716,11

+735,23

Quoted 3 lines

@@ static void aspeed_soc_ast2700_realize(DeviceState *dev, Error **errp)

      sysbus_connect_irq(SYS_BUS_DEVICE(&s->emmc), 0,
                         aspeed_soc_get_irq(s,

ASPEED_DEV_EMMC));

Quoted 2 lines

- create_unimplemented_device("ast2700.dpmcu", 0x11000000,

0x40000);

Quoted 1 line

- create_unimplemented_device("ast2700.iomem0", 0x12000000,

0x01000000);

Quoted 1 line

- create_unimplemented_device("ast2700.iomem1", 0x14000000,

0x01000000);

Quoted 1 line

- create_unimplemented_device("ast2700.ltpi", 0x30000000,

0x1000000);

hw/arm/aspeed_ast27x0.c

Quoted 2 lines
hw/arm/aspeed_ast27x0.c +1 -1
-    create_unimplemented_device("ast2700.io", 0x0, 0x4000000);
+    aspeed_mmio_map_unimplemented(s, SYS_BUS_DEVICE(&s->dpmcu),

"aspeed.dpmcu",

Quoted 1 line

+

sc->memmap[ASPEED_DEV_DPMCU],

hw/arm/aspeed_ast27x0.c

Quoted 2 lines
hw/arm/aspeed_ast27x0.c +2 -0
+                                  AST2700_SOC_DPMCU_SIZE);
+    aspeed_mmio_map_unimplemented(s, SYS_BUS_DEVICE(&s->ltpi),

"aspeed.ltpi",

Quoted 1 line

+

sc->memmap[ASPEED_DEV_LTPI],

hw/arm/aspeed_ast27x0.c

Quoted 2 lines
hw/arm/aspeed_ast27x0.c +2 -0
+                                  AST2700_SOC_LTPI_SIZE);
+    aspeed_mmio_map_unimplemented(s, SYS_BUS_DEVICE(&s->iomem),

"aspeed.io",

Quoted 1 line

+

sc->memmap[ASPEED_DEV_IOMEM],

hw/arm/aspeed_ast27x0.c

Quoted 2 lines
hw/arm/aspeed_ast27x0.c +2 -0
+                                  AST2700_SOC_IO_SIZE);
+    aspeed_mmio_map_unimplemented(s,

SYS_BUS_DEVICE(&s->iomem0),

hw/arm/aspeed_ast27x0.c

Quoted 2 lines
hw/arm/aspeed_ast27x0.c +2 -0
+                                  "aspeed.iomem0",
+

sc->memmap[ASPEED_DEV_IOMEM0],

hw/arm/aspeed_ast27x0.c

Quoted 2 lines
hw/arm/aspeed_ast27x0.c +2 -0
+                                  AST2700_SOC_IOMEM_SIZE);
+    aspeed_mmio_map_unimplemented(s,

SYS_BUS_DEVICE(&s->iomem1),

hw/arm/aspeed_ast27x0.c

Quoted 2 lines
hw/arm/aspeed_ast27x0.c +2 -0
+                                  "aspeed.iomem1",
+

sc->memmap[ASPEED_DEV_IOMEM1],

include/hw/arm/aspeed_soc.h const char *aspeed_soc_cpu_type(AspeedSoCClass

Quoted 26 lines

+ AST2700_SOC_IOMEM_SIZE);
}

static void aspeed_soc_ast2700_class_init(ObjectClass *oc, void
*data) diff --git a/include/hw/arm/aspeed_soc.h b/include/hw/arm/aspeed_soc.h index 689f52dae8..bf885da3fc 100644

include/hw/arm/aspeed_soc.h +3 -0
@@ -90,6 +90,8 @@ struct AspeedSoCState {
      SerialMM uart[ASPEED_UARTS_NUM];
      Clock *sysclk;
      UnimplementedDeviceState iomem;
+    UnimplementedDeviceState iomem0;
+    UnimplementedDeviceState iomem1;
      UnimplementedDeviceState video;
      UnimplementedDeviceState emmc_boot_controller;
      UnimplementedDeviceState dpmcu;
@@ -97,6 +99,7 @@ struct AspeedSoCState {
      UnimplementedDeviceState espi;
      UnimplementedDeviceState udc;
      UnimplementedDeviceState sgpiom;
+    UnimplementedDeviceState ltpi;
      UnimplementedDeviceState jtag[ASPEED_JTAG_NUM];
      AspeedAPB2OPBState fsi[2];
  };
@@ -172,6 +175,9 @@ const char *aspeed_soc_cpu_type(AspeedSoCClass

*sc);

Quoted 9 lines
include/hw/arm/aspeed_soc.h +3 -0
  enum {
      ASPEED_DEV_SPI_BOOT,
      ASPEED_DEV_IOMEM,
+    ASPEED_DEV_IOMEM0,
+    ASPEED_DEV_IOMEM1,
+    ASPEED_DEV_LTPI,
      ASPEED_DEV_UART0,
      ASPEED_DEV_UART1,
      ASPEED_DEV_UART2,
#18 lore raw

Re: [PATCH 2/5] aspeed: ast27x0: Map unimplemented devices in SoC memory

Quoted 28 lines · Steven Lee

Hi Cédric,

Quoted 26 lines

-----Original Message-----
From: Cédric Le Goater <[email protected]>
Sent: Friday, December 27, 2024 5:53 PM
To: Steven Lee <[email protected]>; Peter Maydell <[email protected]>; Troy Lee <[email protected]>; Jamin Lin <[email protected]>; Andrew Jeffery <[email protected]>; Joel Stanley <[email protected]>; open list:ASPEED BMCs <[email protected]>; open list:All patches CC here <[email protected]>
Cc: Troy Lee <[email protected]>; Yunlin Tang <[email protected]>
Subject: Re: [PATCH 2/5] aspeed: ast27x0: Map unimplemented devices in SoC memory

Hello,

Quoted 6 lines · Steven Lee

Maps following unimplemented devices in SoC memory
- dpmcu
- iomem0
- iomem1
- ltpi
- io

Could you please add a sentence about what these devices are ?

Quoted 7 lines
Quoted 4 lines

Thanks,

C.

DPMCU stands for Display Port MCU controller.
Regarding LTPI, when the AST1700 is connected to the AST2700, AST1070 LTPI controller's registers are mapped to 0x30000000.

Is the LTPI IP a device for communication between SoCs ?

Quoted 7 lines

Io, Iomem0 and Iomem1 include unimplemented controllers in the memory ranges 0x120000000 - 0x121000000 and 0x14000000 - 0x141000000. For instance:
- USB hub at 0x12010000
- eSPI at 0x14C5000
- PWM at 0x140C0000

I will include the description in the commit message.

yes please.

Thanks,

C.

#19 lore raw

RE: [PATCH 2/5] aspeed: ast27x0: Map unimplemented devices in SoC memory

Hi Cédric,

Quoted 45 lines

-----Original Message-----
From: Cédric Le Goater <[email protected]>
Sent: Friday, January 3, 2025 5:44 PM
To: Steven Lee <[email protected]>; Peter Maydell <[email protected]>; Troy Lee <[email protected]>; Jamin Lin <[email protected]>; Andrew Jeffery <[email protected]>; Joel Stanley <[email protected]>; open list:ASPEED BMCs <[email protected]>; open list:All patches CC here <[email protected]>
Cc: Troy Lee <[email protected]>; Yunlin Tang <[email protected]>
Subject: Re: [PATCH 2/5] aspeed: ast27x0: Map unimplemented devices in SoC memory

Quoted 30 lines · Steven Lee

Hi Cédric,

Quoted 28 lines

-----Original Message-----
From: Cédric Le Goater <[email protected]>
Sent: Friday, December 27, 2024 5:53 PM
To: Steven Lee <[email protected]>; Peter Maydell <[email protected]>; Troy Lee <[email protected]>; Jamin Lin <[email protected]>; Andrew Jeffery <[email protected]>; Joel Stanley <[email protected]>; open list:ASPEED BMCs <[email protected]>; open list:All patches CC here <[email protected]>
Cc: Troy Lee <[email protected]>; Yunlin Tang <[email protected]>
Subject: Re: [PATCH 2/5] aspeed: ast27x0: Map unimplemented devices in SoC memory

Hello,

Quoted 6 lines · Steven Lee

Maps following unimplemented devices in SoC memory
- dpmcu
- iomem0
- iomem1
- ltpi
- io

Could you please add a sentence about what these devices are ?

Thanks,

Quoted 8 lines
Quoted 5 lines
Quoted 2 lines

C.

DPMCU stands for Display Port MCU controller.
Regarding LTPI, when the AST1700 is connected to the AST2700, AST1070

LTPI controller's registers are mapped to 0x30000000.

Is the LTPI IP a device for communication between SoCs ?

Yes, it can be used to connect to AST1700. AST1700 is an I/O expander that supports the DC-SCM 2.1 LTPI protocol. It provides AST2700 with additional GPIO, UART, I3C, and other interfaces.

Thanks,
Steven

Quoted 17 lines
Quoted 2 lines

Io, Iomem0 and Iomem1 include unimplemented controllers in the memory

ranges 0x120000000 - 0x121000000 and 0x14000000 - 0x141000000.

Quoted 6 lines

For instance:
- USB hub at 0x12010000
- eSPI at 0x14C5000
- PWM at 0x140C0000

I will include the description in the commit message.

yes please.

Thanks,

C.

#20 lore raw

Re: [PATCH 2/5] aspeed: ast27x0: Map unimplemented devices in SoC memory

Quoted 50 lines · Steven Lee

Hi Cédric,

Quoted 48 lines

-----Original Message-----
From: Cédric Le Goater <[email protected]>
Sent: Friday, January 3, 2025 5:44 PM
To: Steven Lee <[email protected]>; Peter Maydell <[email protected]>; Troy Lee <[email protected]>; Jamin Lin <[email protected]>; Andrew Jeffery <[email protected]>; Joel Stanley <[email protected]>; open list:ASPEED BMCs <[email protected]>; open list:All patches CC here <[email protected]>
Cc: Troy Lee <[email protected]>; Yunlin Tang <[email protected]>
Subject: Re: [PATCH 2/5] aspeed: ast27x0: Map unimplemented devices in SoC memory

Quoted 33 lines · Steven Lee

Hi Cédric,

Quoted 30 lines

-----Original Message-----
From: Cédric Le Goater <[email protected]>
Sent: Friday, December 27, 2024 5:53 PM
To: Steven Lee <[email protected]>; Peter Maydell <[email protected]>; Troy Lee <[email protected]>; Jamin Lin <[email protected]>; Andrew Jeffery <[email protected]>; Joel Stanley <[email protected]>; open list:ASPEED BMCs <[email protected]>; open list:All patches CC here <[email protected]>
Cc: Troy Lee <[email protected]>; Yunlin Tang <[email protected]>
Subject: Re: [PATCH 2/5] aspeed: ast27x0: Map unimplemented devices in SoC memory

Hello,

Quoted 6 lines · Steven Lee

Maps following unimplemented devices in SoC memory
- dpmcu
- iomem0
- iomem1
- ltpi
- io

Could you please add a sentence about what these devices are ?

Thanks,

C.

Quoted 8 lines
Quoted 5 lines
Quoted 2 lines

DPMCU stands for Display Port MCU controller.
Regarding LTPI, when the AST1700 is connected to the AST2700, AST1070

LTPI controller's registers are mapped to 0x30000000.

Is the LTPI IP a device for communication between SoCs ?

Yes, it can be used to connect to AST1700. AST1700 is an I/O expander that supports the DC-SCM 2.1 LTPI protocol. It provides AST2700 with additional GPIO, UART, I3C, and other interfaces.

This is the kind of information which would be useful to add to the description of the SoC/machine and in the commit log.

Thanks,

C.

Quoted 22 lines

Thanks,
Steven

Quoted 17 lines
Quoted 2 lines

Io, Iomem0 and Iomem1 include unimplemented controllers in the memory

ranges 0x120000000 - 0x121000000 and 0x14000000 - 0x141000000.

Quoted 6 lines

For instance:
- USB hub at 0x12010000
- eSPI at 0x14C5000
- PWM at 0x140C0000

I will include the description in the commit message.

yes please.

Thanks,

C.

#21 lore raw

PATCH 5/5 docs: aspeed: Add ast2700-fc machine section

In reply to Steven Lee via

This commit adds a section describing the ast2700-fc multi-SoC machine.

---
 docs/system/arm/aspeed.rst | 50 ++++++++++++++++++++++++++++++++++++--
 1 file changed, 48 insertions(+), 2 deletions(-)
docs/system/arm/aspeed.rst +48 -2
index fa4aa28eef..4b4200a4a5 100644
@@ -1,5 +1,5 @@
-Aspeed family boards (``ast2500-evb``, ``ast2600-evb``, ``ast2700-evb``, ``bletchley-bmc``, ``fuji-bmc``, ``fby35-bmc``, ``fp5280g2-bmc``, ``g220a-bmc``, ``palmetto-bmc``, ``qcom-dc-scm-v1-bmc``, ``qcom-firework-bmc``, ``quanta-q71l-bmc``, ``rainier-bmc``, ``romulus-bmc``, ``sonorapass-bmc``, ``supermicrox11-bmc``, ``supermicrox11spi-bmc``, ``tiogapass-bmc``, ``tacoma-bmc``, ``witherspoon-bmc``, ``yosemitev2-bmc``)
-==================================================================================================================================================================================================================================================================================================================================================================================================================================
+Aspeed family boards (``ast2500-evb``, ``ast2600-evb``, ``ast2700-evb``, ``ast2700-evb``, ``bletchley-bmc``, ``fuji-bmc``, ``fby35-bmc``, ``fp5280g2-bmc``, ``g220a-bmc``, ``palmetto-bmc``, ``qcom-dc-scm-v1-bmc``, ``qcom-firework-bmc``, ``quanta-q71l-bmc``, ``rainier-bmc``, ``romulus-bmc``, ``sonorapass-bmc``, ``supermicrox11-bmc``, ``supermicrox11spi-bmc``, ``tiogapass-bmc``, ``tacoma-bmc``, ``witherspoon-bmc``, ``yosemitev2-bmc``)
+===================================================================================================================================================================================================================================================================================================================================================================================================================================================
 
 The QEMU Aspeed machines model BMCs of various OpenPOWER systems and
 Aspeed evaluation boards. They are based on different releases of the
@@ -42,6 +42,7 @@ AST2600 SoC based machines :
 AST2700 SoC based machines :
 
 - ``ast2700-evb``          Aspeed AST2700 Evaluation board (Cortex-A35)
+- ``ast2700-fc``           Aspeed AST2700 Evaluation board featuring full core support (Cortex-A35 + Cortex-M4)
 
 Supported devices
 -----------------
@@ -270,6 +271,51 @@ Boot the AST2700 machine from the flash image, use an MTD drive :
        -drive file=${IMGDIR}/image-bmc,format=raw,if=mtd \
        -nographic
 
+Booting the ast2700-fc machine
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+Boot the AST2700 machine from the flash image, use an MTD drive :
+
+.. code-block:: bash
+
+  IMGDIR=./
+  UBOOT_SIZE=$(stat --format=%s -L ${IMGDIR}/u-boot-nodtb.bin)
+
+  $ UBOOT_SIZE=$(stat --format=%s -L ${IMGDIR}/u-boot-nodtb.bin)
+  $ wget https://github.com/stevenlee7189/zephyr/releases/download/1.0.0/ast2700-ssp.elf
+  $ wget https://github.com/stevenlee7189/zephyr/releases/download/1.0.0/ast2700-tsp.elf
+  $ wget https://github.com/stevenlee7189/zephyr/releases/download/1.0.0/bl31.bin
+  $ wget https://github.com/stevenlee7189/zephyr/releases/download/1.0.0/tee-raw.bin
+  $ wget https://github.com/stevenlee7189/zephyr/releases/download/1.0.0/u-boot-nodtb.bin
+  $ wget https://github.com/stevenlee7189/zephyr/releases/download/1.0.0/u-boot.dtb
+  $ wget https://github.com/stevenlee7189/zephyr/releases/download/1.0.0/image-bmc.tar.zst
+  $ tar --zstd -xvf image-bmc.tar.zst
+
+  $ qemu-system-aarch64 -machine ast2700fc \
+       -device loader,force-raw=on,addr=0x400000000,file=${IMGDIR}/u-boot-nodtb.bin \
+       -device loader,force-raw=on,addr=$((0x400000000 + ${UBOOT_SIZE})),file=${IMGDIR}/u-boot.dtb \
+       -device loader,force-raw=on,addr=0x430000000,file=${IMGDIR}/bl31.bin \
+       -device loader,force-raw=on,addr=0x430080000,file=${IMGDIR}/tee-raw.bin \
+       -device loader,file=${IMGDIR}/ast2700-ssp.elf,cpu-num=4 \
+       -device loader,file=${IMGDIR}/ast2700-tsp.elf,cpu-num=5 \
+       -device loader,cpu-num=0,addr=0x430000000 \
+       -device loader,cpu-num=1,addr=0x430000000 \
+       -device loader,cpu-num=2,addr=0x430000000 \
+       -device loader,cpu-num=3,addr=0x430000000 \
+       -m 1G \
+       -drive file=image-bmc,if=mtd,format=raw \
+       -serial pty -serial pty -serial pty \
+       -S -nographic
+
+    char device redirected to /dev/pts/51 (label serial0)
+    char device redirected to /dev/pts/52 (label serial1)
+    char device redirected to /dev/pts/53 (label serial2)
+
+  $ tio /dev/pts/51
+  $ tio /dev/pts/52
+  $ tio /dev/pts/53
+  $ (qemu) c
+
 Aspeed minibmc family boards (``ast1030-evb``)
 ==================================================================
 
Signature · 1 line
2.34.1
#22 lore raw

Re: [PATCH 5/5] docs: aspeed: Add ast2700-fc machine section

Quoted 28 lines · Steven Lee

This commit adds a section describing the ast2700-fc multi-SoC machine.

---
  docs/system/arm/aspeed.rst | 50 ++++++++++++++++++++++++++++++++++++--
  1 file changed, 48 insertions(+), 2 deletions(-)
docs/system/arm/aspeed.rst +3 -2
index fa4aa28eef..4b4200a4a5 100644
@@ -1,5 +1,5 @@
-Aspeed family boards (``ast2500-evb``, ``ast2600-evb``, ``ast2700-evb``, ``bletchley-bmc``, ``fuji-bmc``, ``fby35-bmc``, ``fp5280g2-bmc``, ``g220a-bmc``, ``palmetto-bmc``, ``qcom-dc-scm-v1-bmc``, ``qcom-firework-bmc``, ``quanta-q71l-bmc``, ``rainier-bmc``, ``romulus-bmc``, ``sonorapass-bmc``, ``supermicrox11-bmc``, ``supermicrox11spi-bmc``, ``tiogapass-bmc``, ``tacoma-bmc``, ``witherspoon-bmc``, ``yosemitev2-bmc``)
-==================================================================================================================================================================================================================================================================================================================================================================================================================================
+Aspeed family boards (``ast2500-evb``, ``ast2600-evb``, ``ast2700-evb``, ``ast2700-evb``, ``bletchley-bmc``, ``fuji-bmc``, ``fby35-bmc``, ``fp5280g2-bmc``, ``g220a-bmc``, ``palmetto-bmc``, ``qcom-dc-scm-v1-bmc``, ``qcom-firework-bmc``, ``quanta-q71l-bmc``, ``rainier-bmc``, ``romulus-bmc``, ``sonorapass-bmc``, ``supermicrox11-bmc``, ``supermicrox11spi-bmc``, ``tiogapass-bmc``, ``tacoma-bmc``, ``witherspoon-bmc``, ``yosemitev2-bmc``)
+===================================================================================================================================================================================================================================================================================================================================================================================================================================================
 
  The QEMU Aspeed machines model BMCs of various OpenPOWER systems and
  Aspeed evaluation boards. They are based on different releases of the
@@ -42,6 +42,7 @@ AST2600 SoC based machines :
  AST2700 SoC based machines :
 
  - ``ast2700-evb``          Aspeed AST2700 Evaluation board (Cortex-A35)
+- ``ast2700-fc``           Aspeed AST2700 Evaluation board featuring full core support (Cortex-A35 + Cortex-M4)
 
  Supported devices
  -----------------

docs/system/arm/aspeed.rst Boot the AST2700 machine from the flash image, use an MTD drive : · line 275

Quoted 5 lines
docs/system/arm/aspeed.rst +2 -0
@@ -270,6 +271,51 @@ Boot the AST2700 machine from the flash image, use an MTD drive :
         -drive file=${IMGDIR}/image-bmc,format=raw,if=mtd \
         -nographic
 
+Booting the ast2700-fc machine
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

A description of the machine would be helpful.

Thanks,

C.

Quoted 45 lines
docs/system/arm/aspeed.rst +42 -0
+Boot the AST2700 machine from the flash image, use an MTD drive :
+
+.. code-block:: bash
+
+  IMGDIR=./
+  UBOOT_SIZE=$(stat --format=%s -L ${IMGDIR}/u-boot-nodtb.bin)
+
+  $ UBOOT_SIZE=$(stat --format=%s -L ${IMGDIR}/u-boot-nodtb.bin)
+  $ wget https://github.com/stevenlee7189/zephyr/releases/download/1.0.0/ast2700-ssp.elf
+  $ wget https://github.com/stevenlee7189/zephyr/releases/download/1.0.0/ast2700-tsp.elf
+  $ wget https://github.com/stevenlee7189/zephyr/releases/download/1.0.0/bl31.bin
+  $ wget https://github.com/stevenlee7189/zephyr/releases/download/1.0.0/tee-raw.bin
+  $ wget https://github.com/stevenlee7189/zephyr/releases/download/1.0.0/u-boot-nodtb.bin
+  $ wget https://github.com/stevenlee7189/zephyr/releases/download/1.0.0/u-boot.dtb
+  $ wget https://github.com/stevenlee7189/zephyr/releases/download/1.0.0/image-bmc.tar.zst
+  $ tar --zstd -xvf image-bmc.tar.zst
+
+  $ qemu-system-aarch64 -machine ast2700fc \
+       -device loader,force-raw=on,addr=0x400000000,file=${IMGDIR}/u-boot-nodtb.bin \
+       -device loader,force-raw=on,addr=$((0x400000000 + ${UBOOT_SIZE})),file=${IMGDIR}/u-boot.dtb \
+       -device loader,force-raw=on,addr=0x430000000,file=${IMGDIR}/bl31.bin \
+       -device loader,force-raw=on,addr=0x430080000,file=${IMGDIR}/tee-raw.bin \
+       -device loader,file=${IMGDIR}/ast2700-ssp.elf,cpu-num=4 \
+       -device loader,file=${IMGDIR}/ast2700-tsp.elf,cpu-num=5 \
+       -device loader,cpu-num=0,addr=0x430000000 \
+       -device loader,cpu-num=1,addr=0x430000000 \
+       -device loader,cpu-num=2,addr=0x430000000 \
+       -device loader,cpu-num=3,addr=0x430000000 \
+       -m 1G \
+       -drive file=image-bmc,if=mtd,format=raw \
+       -serial pty -serial pty -serial pty \
+       -S -nographic
+
+    char device redirected to /dev/pts/51 (label serial0)
+    char device redirected to /dev/pts/52 (label serial1)
+    char device redirected to /dev/pts/53 (label serial2)
+
+  $ tio /dev/pts/51
+  $ tio /dev/pts/52
+  $ tio /dev/pts/53
+  $ (qemu) c
+
  Aspeed minibmc family boards (``ast1030-evb``)
  ==================================================================
 
#23 lore raw

RE: [PATCH 5/5] docs: aspeed: Add ast2700-fc machine section

Hi Cédric,

Quoted 94 lines

-----Original Message-----
From: Cédric Le Goater <[email protected]>
Sent: Thursday, January 2, 2025 4:44 PM
To: Steven Lee <[email protected]>; Peter Maydell <[email protected]>; Troy Lee <[email protected]>; Jamin Lin <[email protected]>; Andrew Jeffery <[email protected]>; Joel Stanley <[email protected]>; open list:ASPEED BMCs <[email protected]>; open list:All patches CC here <[email protected]>
Cc: Troy Lee <[email protected]>; Yunlin Tang <[email protected]>
Subject: Re: [PATCH 5/5] docs: aspeed: Add ast2700-fc machine section

Quoted 5 lines · Steven Lee

This commit adds a section describing the ast2700-fc multi-SoC machine.

---
  docs/system/arm/aspeed.rst | 50

++++++++++++++++++++++++++++++++++++--

Quoted 12 lines
  1 file changed, 48 insertions(+), 2 deletions(-)
docs/system/arm/aspeed.rst +0 -1
index fa4aa28eef..4b4200a4a5 100644
@@ -1,5 +1,5 @@
-Aspeed family boards (``ast2500-evb``, ``ast2600-evb``,
 ``ast2700-evb``, ``bletchley-bmc``, ``fuji-bmc``, ``fby35-bmc``,
 ``fp5280g2-bmc``, ``g220a-bmc``, ``palmetto-bmc``,
 ``qcom-dc-scm-v1-bmc``, ``qcom-firework-bmc``, ``quanta-q71l-bmc``,
 ``rainier-bmc``, ``romulus-bmc``, ``sonorapass-bmc``,
Quoted 3 lines

``supermicrox11-bmc``, ``supermicrox11spi-bmc``, ``tiogapass-bmc``, ``tacoma-bmc``, ``witherspoon-bmc``, ``yosemitev2-bmc``)

-===============================================================
======

Quoted 1 line

================================================================
======

Quoted 1 line

================================================================
======

Quoted 1 line

================================================================
======

Quoted 1 line

================================================================
======

Quoted 1 line

================================================================
=====

Quoted 8 lines

+Aspeed family boards (``ast2500-evb``, ``ast2600-evb``, +``ast2700-evb``, ``ast2700-evb``, ``bletchley-bmc``, ``fuji-bmc``, +``fby35-bmc``, ``fp5280g2-bmc``, ``g220a-bmc``, ``palmetto-bmc``, +``qcom-dc-scm-v1-bmc``, ``qcom-firework-bmc``, ``quanta-q71l-bmc``, +``rainier-bmc``, ``romulus-bmc``, ``sonorapass-bmc``, +``supermicrox11-bmc``, ``supermicrox11spi-bmc``, ``tiogapass-bmc``, +``tacoma-bmc``, ``witherspoon-bmc``, ``yosemitev2-bmc``)

+===============================================================
======

Quoted 1 line

+===============================================================
======

Quoted 1 line

+===============================================================
======

Quoted 1 line

+===============================================================
======

Quoted 1 line

+===============================================================
======

Quoted 1 line

+===============================================================
======

Quoted 3 lines

+=====================

The QEMU Aspeed machines model BMCs of various OpenPOWER

systems and

Quoted 5 lines

Aspeed evaluation boards. They are based on different releases of
the @@ -42,6 +42,7 @@ AST2600 SoC based machines :
AST2700 SoC based machines :

- ``ast2700-evb`` Aspeed AST2700 Evaluation board

(Cortex-A35)

Quoted 1 line

+- ``ast2700-fc`` Aspeed AST2700 Evaluation board featuring full

core support (Cortex-A35 + Cortex-M4)

docs/system/arm/aspeed.rst Boot the AST2700 machine from the flash image,

Quoted 4 lines

Supported devices
-----------------

docs/system/arm/aspeed.rst +0 -0
@@ -270,6 +271,51 @@ Boot the AST2700 machine from the flash image,

use an MTD drive :

Quoted 8 lines

docs/system/arm/aspeed.rst Boot the AST2700 machine from the flash image, use an MTD drive : · line 275

Quoted 5 lines
docs/system/arm/aspeed.rst +2 -0
         -drive file=${IMGDIR}/image-bmc,format=raw,if=mtd \
         -nographic
 
+Booting the ast2700-fc machine
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

A description of the machine would be helpful.

Thanks for the review.
Will add description for the machine.

Quoted 63 lines

Thanks,

C.

Quoted 16 lines
docs/system/arm/aspeed.rst +16 -0
+Boot the AST2700 machine from the flash image, use an MTD drive :
+
+.. code-block:: bash
+
+  IMGDIR=./
+  UBOOT_SIZE=$(stat --format=%s -L ${IMGDIR}/u-boot-nodtb.bin)
+
+  $ UBOOT_SIZE=$(stat --format=%s -L ${IMGDIR}/u-boot-nodtb.bin)  $
+ wget
+ https://github.com/stevenlee7189/zephyr/releases/download/1.0.0/ast2
+ 700-ssp.elf  $ wget
+ https://github.com/stevenlee7189/zephyr/releases/download/1.0.0/ast2
+ 700-tsp.elf  $ wget
+ https://github.com/stevenlee7189/zephyr/releases/download/1.0.0/bl31
+ .bin  $ wget
+ https://github.com/stevenlee7189/zephyr/releases/download/1.0.0/tee-

docs/system/arm/aspeed.rst Boot the AST2700 machine from the flash image, · line 301

Quoted 10 lines
docs/system/arm/aspeed.rst +10 -0
+ raw.bin  $ wget
+ https://github.com/stevenlee7189/zephyr/releases/download/1.0.0/u-bo
+ ot-nodtb.bin  $ wget
+ https://github.com/stevenlee7189/zephyr/releases/download/1.0.0/u-bo
+ ot.dtb  $ wget
+ https://github.com/stevenlee7189/zephyr/releases/download/1.0.0/imag
+ e-bmc.tar.zst  $ tar --zstd -xvf image-bmc.tar.zst
+
+  $ qemu-system-aarch64 -machine ast2700fc \
+       -device

loader,force-raw=on,addr=0x400000000,file=${IMGDIR}/u-boot-nodtb.bin \

docs/system/arm/aspeed.rst Boot the AST2700 machine from the flash image, · line 302

Quoted 1 line
docs/system/arm/aspeed.rst +1 -0
+       -device loader,force-raw=on,addr=$((0x400000000 +

${UBOOT_SIZE})),file=${IMGDIR}/u-boot.dtb \

docs/system/arm/aspeed.rst Boot the AST2700 machine from the flash image, · line 303

Quoted 1 line
docs/system/arm/aspeed.rst +1 -0
+       -device

loader,force-raw=on,addr=0x430000000,file=${IMGDIR}/bl31.bin \

docs/system/arm/aspeed.rst Boot the AST2700 machine from the flash image, · line 304

Quoted 1 line
docs/system/arm/aspeed.rst +1 -0
+       -device

loader,force-raw=on,addr=0x430080000,file=${IMGDIR}/tee-raw.bin \

Quoted 12 lines
docs/system/arm/aspeed.rst +11 -0
+       -device loader,file=${IMGDIR}/ast2700-ssp.elf,cpu-num=4 \
+       -device loader,file=${IMGDIR}/ast2700-tsp.elf,cpu-num=5 \
+       -device loader,cpu-num=0,addr=0x430000000 \
+       -device loader,cpu-num=1,addr=0x430000000 \
+       -device loader,cpu-num=2,addr=0x430000000 \
+       -device loader,cpu-num=3,addr=0x430000000 \
+       -m 1G \
+       -drive file=image-bmc,if=mtd,format=raw \
+       -serial pty -serial pty -serial pty \
+       -S -nographic
+

docs/system/arm/aspeed.rst Boot the AST2700 machine from the flash image, use an MTD drive : · line 319

Quoted 10 lines
docs/system/arm/aspeed.rst +9 -0
+    char device redirected to /dev/pts/51 (label serial0)
+    char device redirected to /dev/pts/52 (label serial1)
+    char device redirected to /dev/pts/53 (label serial2)
+
+  $ tio /dev/pts/51
+  $ tio /dev/pts/52
+  $ tio /dev/pts/53
+  $ (qemu) c
+
  Aspeed minibmc family boards (``ast1030-evb``)

================================================================
==

Quoted 1 line
#24 lore raw
In reply to Steven Lee via

Steven,

When you resend, could you please rebase on top of :

https://lore.kernel.org/qemu-devel/[email protected]/

Thanks,

C.

Quoted 85 lines · Steven Lee

This patch series introduces full cores support for the AST27x0 SoC, along with necessary updates to the ASPEED AST27x0 SOC.

The AST27x0 SoC is a new family of ASPEED SoCs featuring 4 Cortex-A35 cores and 2 Cortex-M4 cores. This patch set adds the following updates:

1. Public API updates:
Modifies the sdhci_attach_drive and write_boot_rom functions to make them accessible for broader usage.

2. SoC memory updates:
Maps unimplemented devices in the AST27x0 memory space.

3. AST27x0 CM4 SoC integration:
Adds basic support for the AST27x0 CM4 SoC.

4. AST2700-FC machine:
Introduces a new AST2700-FC machine which supports emulating 4 cortex-a35 cores and 2 coretex-m4 cores.

5. Documentation:
Updates the ASPEED documentation to include usage of the new ast2700-fc machine.

This series has been tested using ASPEED SDK image by the following
IMGDIR=./
UBOOT_SIZE=$(stat --format=%s -L ${IMGDIR}/u-boot-nodtb.bin)

   $ UBOOT_SIZE=$(stat --format=%s -L ${IMGDIR}/u-boot-nodtb.bin)
   $ wget https://github.com/stevenlee7189/zephyr/releases/download/1.0.0/ast2700-ssp.elf
   $ wget https://github.com/stevenlee7189/zephyr/releases/download/1.0.0/ast2700-tsp.elf
   $ wget https://github.com/stevenlee7189/zephyr/releases/download/1.0.0/bl31.bin
   $ wget https://github.com/stevenlee7189/zephyr/releases/download/1.0.0/tee-raw.bin
   $ wget https://github.com/stevenlee7189/zephyr/releases/download/1.0.0/u-boot-nodtb.bin
   $ wget https://github.com/stevenlee7189/zephyr/releases/download/1.0.0/u-boot.dtb
   $ wget https://github.com/stevenlee7189/zephyr/releases/download/1.0.0/image-bmc.tar.zst
   $ tar --zstd -xvf image-bmc.tar.zst
   $ qemu-system-aarch64 -machine ast2700fc \
        -device loader,force-raw=on,addr=0x400000000,file=${IMGDIR}/u-boot-nodtb.bin \
        -device loader,force-raw=on,addr=$((0x400000000 + ${UBOOT_SIZE})),file=${IMGDIR}/u-boot.dtb \
        -device loader,force-raw=on,addr=0x430000000,file=${IMGDIR}/bl31.bin \
        -device loader,force-raw=on,addr=0x430080000,file=${IMGDIR}/tee-raw.bin \
        -device loader,file=${IMGDIR}/ast2700-ssp.elf,cpu-num=4 \
        -device loader,file=${IMGDIR}/ast2700-tsp.elf,cpu-num=5 \
        -device loader,cpu-num=0,addr=0x430000000 \
        -device loader,cpu-num=1,addr=0x430000000 \
        -device loader,cpu-num=2,addr=0x430000000 \
        -device loader,cpu-num=3,addr=0x430000000 \
        -m 1G \
        -drive file=image-bmc,if=mtd,format=raw \
        -serial pty -serial pty -serial pty \
        -S -nographic

char device redirected to /dev/pts/51 (label serial0) char device redirected to /dev/pts/52 (label serial1) char device redirected to /dev/pts/53 (label serial2)

   $ tio /dev/pts/51
   $ tio /dev/pts/52
   $ tio /dev/pts/53
   $ (qemu) c

Steven Lee (5):
aspeed: Make sdhci_attach_drive and write_boot_rom public
aspeed: ast27x0: Map unimplemented devices in SoC memory
aspeed: Introduce AST27x0 SoC with Cortex-M4 support
aspeed: Introduce ast2700-fc machine
docs: aspeed: Add ast2700-fc machine section

  docs/system/arm/aspeed.rst  |  50 ++++-
  hw/arm/aspeed.c             |   4 +-
  hw/arm/aspeed_ast27x0-cm4.c | 397 ++++++++++++++++++++++++++++++++++++
  hw/arm/aspeed_ast27x0-fc.c  | 211 +++++++++++++++++++
  hw/arm/aspeed_ast27x0.c     |  45 +++-
  hw/arm/meson.build          |   5 +-
  include/hw/arm/aspeed.h     |   6 +
  include/hw/arm/aspeed_soc.h |  41 ++++
  8 files changed, 747 insertions(+), 12 deletions(-)

create mode 100644 hw/arm/aspeed_ast27x0-cm4.c
create mode 100644 hw/arm/aspeed_ast27x0-fc.c

--
2.34.1

#25 lore raw

Hi Cédric,

Quoted 13 lines

-----Original Message-----
From: Cédric Le Goater <[email protected]>
Sent: Tuesday, January 7, 2025 11:51 PM
To: Steven Lee <[email protected]>; Peter Maydell <[email protected]>; Troy Lee <[email protected]>; Jamin Lin <[email protected]>; Andrew Jeffery <[email protected]>; Joel Stanley <[email protected]>; open list:ASPEED BMCs <[email protected]>; open list:All patches CC here <[email protected]>
Cc: Troy Lee <[email protected]>; Yunlin Tang <[email protected]>
Subject: Re: [PATCH 0/5] Introduce AST27x0 multi-SoC machine

Quoted 8 lines

Steven,

When you resend, could you please rebase on top of :

https://lore.kernel.org/qemu-devel/20241216075353.1308043-1-jamin_lin@as
peedtech.com/

I will rebase my V2 patch series on top of the requested patch:

Thanks,
Steven

Quoted 108 lines

Thanks,

C.

Quoted 8 lines · Steven Lee

This patch series introduces full cores support for the AST27x0 SoC, along with necessary updates to the ASPEED AST27x0 SOC.

The AST27x0 SoC is a new family of ASPEED SoCs featuring 4 Cortex-A35 cores and 2 Cortex-M4 cores. This patch set adds the following updates:

1. Public API updates:
Modifies the sdhci_attach_drive and write_boot_rom functions to

make them

Quoted 16 lines

accessible for broader usage.

2. SoC memory updates:
Maps unimplemented devices in the AST27x0 memory space.

3. AST27x0 CM4 SoC integration:
Adds basic support for the AST27x0 CM4 SoC.

4. AST2700-FC machine:
Introduces a new AST2700-FC machine which supports emulating 4 cortex-a35 cores and 2 coretex-m4 cores.

5. Documentation:
Updates the ASPEED documentation to include usage of the new ast2700-fc machine.

Quoted 6 lines

This series has been tested using ASPEED SDK image by the following
IMGDIR=./
UBOOT_SIZE=$(stat --format=%s -L ${IMGDIR}/u-boot-nodtb.bin)

   $ UBOOT_SIZE=$(stat --format=%s -L ${IMGDIR}/u-boot-nodtb.bin)
   $ wget

https://github.com/stevenlee7189/zephyr/releases/download/1.0.0/ast2700-ss
p.elf

Quoted 1 line
   $ wget

https://github.com/stevenlee7189/zephyr/releases/download/1.0.0/ast2700-ts
p.elf

Quoted 1 line
   $ wget

https://github.com/stevenlee7189/zephyr/releases/download/1.0.0/bl31.bin

Quoted 1 line
   $ wget

https://github.com/stevenlee7189/zephyr/releases/download/1.0.0/tee-raw.bi
n

Quoted 1 line
   $ wget

https://github.com/stevenlee7189/zephyr/releases/download/1.0.0/u-boot-nod
tb.bin

Quoted 1 line
   $ wget

https://github.com/stevenlee7189/zephyr/releases/download/1.0.0/u-boot.dtb

Quoted 1 line
   $ wget

https://github.com/stevenlee7189/zephyr/releases/download/1.0.0/image-bm
c.tar.zst

Quoted 4 lines
   $ tar --zstd -xvf image-bmc.tar.zst
   $ qemu-system-aarch64 -machine ast2700fc \
        -device

loader,force-raw=on,addr=0x400000000,file=${IMGDIR}/u-boot-nodtb.bin \

Quoted 1 line
        -device loader,force-raw=on,addr=$((0x400000000 +

${UBOOT_SIZE})),file=${IMGDIR}/u-boot.dtb \

Quoted 1 line

-device

loader,force-raw=on,addr=0x430000000,file=${IMGDIR}/bl31.bin \

Quoted 1 line

-device

loader,force-raw=on,addr=0x430080000,file=${IMGDIR}/tee-raw.bin \

Quoted 27 lines
        -device loader,file=${IMGDIR}/ast2700-ssp.elf,cpu-num=4 \
        -device loader,file=${IMGDIR}/ast2700-tsp.elf,cpu-num=5 \
        -device loader,cpu-num=0,addr=0x430000000 \
        -device loader,cpu-num=1,addr=0x430000000 \
        -device loader,cpu-num=2,addr=0x430000000 \
        -device loader,cpu-num=3,addr=0x430000000 \
        -m 1G \
        -drive file=image-bmc,if=mtd,format=raw \
        -serial pty -serial pty -serial pty \
        -S -nographic

     char device redirected to /dev/pts/51 (label serial0)
     char device redirected to /dev/pts/52 (label serial1)
     char device redirected to /dev/pts/53 (label serial2)
   $ tio /dev/pts/51
   $ tio /dev/pts/52
   $ tio /dev/pts/53
   $ (qemu) c

Steven Lee (5):
aspeed: Make sdhci_attach_drive and write_boot_rom public
aspeed: ast27x0: Map unimplemented devices in SoC memory
aspeed: Introduce AST27x0 SoC with Cortex-M4 support
aspeed: Introduce ast2700-fc machine
docs: aspeed: Add ast2700-fc machine section

Quoted 3 lines
  docs/system/arm/aspeed.rst  |  50 ++++-
  hw/arm/aspeed.c             |   4 +-
  hw/arm/aspeed_ast27x0-cm4.c | 397

++++++++++++++++++++++++++++++++++++

Quoted 12 lines
  hw/arm/aspeed_ast27x0-fc.c  | 211 +++++++++++++++++++
  hw/arm/aspeed_ast27x0.c     |  45 +++-
  hw/arm/meson.build          |   5 +-
  include/hw/arm/aspeed.h     |   6 +
  include/hw/arm/aspeed_soc.h |  41 ++++
  8 files changed, 747 insertions(+), 12 deletions(-)

create mode 100644 hw/arm/aspeed_ast27x0-cm4.c
create mode 100644 hw/arm/aspeed_ast27x0-fc.c

--
2.34.1

#26 lore raw

Hello Steven,

Quoted 17 lines · Steven Lee

Hi Cédric,

Quoted 15 lines

-----Original Message-----
From: Cédric Le Goater <[email protected]>
Sent: Tuesday, January 7, 2025 11:51 PM
To: Steven Lee <[email protected]>; Peter Maydell <[email protected]>; Troy Lee <[email protected]>; Jamin Lin <[email protected]>; Andrew Jeffery <[email protected]>; Joel Stanley <[email protected]>; open list:ASPEED BMCs <[email protected]>; open list:All patches CC here <[email protected]>
Cc: Troy Lee <[email protected]>; Yunlin Tang <[email protected]>
Subject: Re: [PATCH 0/5] Introduce AST27x0 multi-SoC machine

Steven,

Quoted 8 lines
Quoted 6 lines

When you resend, could you please rebase on top of :

https://lore.kernel.org/qemu-devel/20241216075353.1308043-1-jamin_lin@as
peedtech.com/

I will rebase my V2 patch series on top of the requested patch:

It is now merged upstream.

Thanks,

C.