hw/arm/aspeed: AST1700 LTPI support and device hookups
Subsystems (2)
v2 cover hw/arm/aspeed: AST1700 LTPI support and device hookups
From: Kane-Chen-AS <[email protected]>
Hi all,
LTPI (LVDS Tunneling Protocol & Interface) is defined in the OCP DC-SCM 2.0 specification (see Figure 2):
https://www.opencompute.org/documents/ocp-dc-scm-2-0-ltpi-ver-1-0-pdf
LTPI provides a protocol and physical interface for tunneling various low-speed signals between the Host Processor Module (HPM) and the Satellite Controller Module (SCM). In Figure 2 of the specification, the AST27x0 SoC (left) integrates two LTPI controllers, allowing it to connect to up to two AST1700 boards. On the other side, the AST1700 consolidates HPM FPGA functions and multiple peripheral interfaces (GPIO, UART, I2C, I3C, etc.) onto a single board.
Because the AST1700 exposes additional I/O interfaces (GPIO, I2C, I3C, and others), it acts as an I/O expander. Once connected over LTPI, the AST27x0 can control additional downstream devices through this link.
This patch series introduces a basic LTPI controller model and wires it into the AST27x0 SoC. It also adds the AST1700-specific LTPI expander device and gradually connects common peripherals on the AST1700 model. For blocks that are not yet functionally implemented (I3C, SGPIOM, PWM), their MMIO regions are modeled as unimplemented devices to reserve address space and make the missing functionality explicit, ensuring that guest probing remains stable.
In the official release images, the AST1700 functions are not included by default. To test the AST1700-related functionality, please include the following DTS files for probing:
https://github.com/AspeedTech-BMC/linux/blob/aspeed-master-v6.6/arch/arm64/boot/dts/aspeed/aspeed-ltpi0.dtsi
https://github.com/AspeedTech-BMC/linux/blob/aspeed-master-v6.6/arch/arm64/boot/dts/aspeed/aspeed-ltpi1.dtsi
After including these DTS files in the BMC image, you can verify LTPI functionality using the following scenarios:
1. In U-Boot:
Run the ltpi command to trigger the LTPI connection and display the current connection status.
2. In BMC Linux:
Run i2cdetect -y <16-38> to scan and test the I2C buses exposed by the AST1700.
Any feedback or suggestions are appreciated!
Kane
---
ChangeLog
---------
v2:
- Separate the AST1700 model into a standalone implementation
- Refine the mechanism for assigning the AST1700 board number
v1:
- Initial version
---
Kane-Chen-AS (17):
hw/arm/aspeed: Add LTPI controller
hw/arm/aspeed: Attach LTPI controller to AST27X0 platform hw/arm/aspeed: Add AST1700 LTPI expander device model hw/arm/aspeed: Integrate AST1700 device into AST27X0 hw/arm/aspeed: Integrate interrupt controller for AST1700 hw/arm/aspeed: Attach LTPI controller to AST1700 model hw/arm/aspeed: Attach UART device to AST1700 model hw/arm/aspeed: Attach SRAM device to AST1700 model hw/arm/aspeed: Attach SPI device to AST1700 model hw/arm/aspeed: Attach ADC device to AST1700 model hw/arm/aspeed: Attach SCU device to AST1700 model hw/arm/aspeed: Attach GPIO device to AST1700 model hw/arm/aspeed: Attach I2C device to AST1700 model hw/arm/aspeed: Attach WDT device to AST1700 model hw/arm/aspeed: Model AST1700 I3C block as unimplemented device hw/arm/aspeed: Model AST1700 SGPIOM block as unimplemented device hw/arm/aspeed: Model AST1700 PWM block as unimplemented device
include/hw/arm/aspeed_soc.h | 20 +- include/hw/intc/aspeed_intc.h | 2 + include/hw/misc/aspeed_ast1700.h | 51 ++++++ include/hw/misc/aspeed_ltpi.h | 25 +++ hw/arm/aspeed_ast27x0.c | 154 ++++++++++++++-- hw/intc/aspeed_intc.c | 60 ++++++ hw/misc/aspeed_ast1700.c | 303 +++++++++++++++++++++++++++++++ hw/misc/aspeed_ltpi.c | 98 ++++++++++ hw/misc/meson.build | 2 + 9 files changed, 700 insertions(+), 15 deletions(-) create mode 100644 include/hw/misc/aspeed_ast1700.h create mode 100644 include/hw/misc/aspeed_ltpi.h create mode 100644 hw/misc/aspeed_ast1700.c create mode 100644 hw/misc/aspeed_ltpi.c
Signature · 1 line
2.43.0
PATCH v2 1/17 hw/arm/aspeed: Add LTPI controller
From: Kane-Chen-AS <[email protected]>
LTPI (LVDS Tunneling Protocol & Interface) is defined in the OCP DC-SCM 2.0 specification:
https://www.opencompute.org/documents/ocp-dc-scm-2-0-ltpi-ver-1-0-pdf
LTPI is a protocol and physical interface for tunneling various low-speed signals between the HPM and SCM. As shown in Figure 2, the AST27x0 (left) integrates two LTPI controllers, allowing it to connect to up to two extended boards.
This commit introduces a simple device model for the ASPEED LTPI controller in QEMU.
The model includes basic MMIO read/write operations and sets default register values during reset to emulate a link-up state.
Implements register space with read/write callbacks.
--- include/hw/misc/aspeed_ltpi.h | 25 +++++++++ hw/misc/aspeed_ltpi.c | 98 +++++++++++++++++++++++++++++++++++ hw/misc/meson.build | 1 + 3 files changed, 124 insertions(+) create mode 100644 include/hw/misc/aspeed_ltpi.h create mode 100644 hw/misc/aspeed_ltpi.c
include/hw/misc/aspeed_ltpi.h new file +25 -0
@@ -0,0 +1,25 @@ +/* +* ASPEED LTPI Controller +* +* Copyright (C) 2025 ASPEED Technology Inc. +* +* SPDX-License-Identifier: GPL-2.0-or-later +*/ +#ifndef ASPEED_LTPI_H +#define ASPEED_LTPI_H + +#include "hw/sysbus.h" + +#define TYPE_ASPEED_LTPI "aspeed.ltpi-ctrl" +OBJECT_DECLARE_SIMPLE_TYPE(AspeedLTPIState, ASPEED_LTPI) + +#define ASPEED_LTPI_NR_REGS (0x900 >> 2) + +struct AspeedLTPIState { +SysBusDevice parent; +MemoryRegion mmio; + +uint32_t regs[ASPEED_LTPI_NR_REGS ]; +}; + +#endif /* ASPEED_LTPI_H */
hw/misc/aspeed_ltpi.c new file +98 -0
98 lines not on this page · raw message
hw/misc/meson.build +1 -0
@@ -136,6 +136,7 @@ system_ss.add(when: 'CONFIG_ASPEED_SOC', if_true: files( 'aspeed_hace.c', 'aspeed_i3c.c', 'aspeed_lpc.c', + 'aspeed_ltpi.c', 'aspeed_scu.c', 'aspeed_sbc.c', 'aspeed_sdmc.c',
Signature · 1 line
2.43.0
Re: [PATCH v2 01/17] hw/arm/aspeed: Add LTPI controller
Quoted 129 lines · Kane Chen
From: Kane-Chen-AS <[email protected]>
LTPI (LVDS Tunneling Protocol & Interface) is defined in the OCP DC-SCM 2.0 specification:
https://www.opencompute.org/documents/ocp-dc-scm-2-0-ltpi-ver-1-0-pdfLTPI is a protocol and physical interface for tunneling various low-speed signals between the HPM and SCM. As shown in Figure 2, the AST27x0 (left) integrates two LTPI controllers, allowing it to connect to up to two extended boards.
This commit introduces a simple device model for the ASPEED LTPI controller in QEMU.
The model includes basic MMIO read/write operations and sets default register values during reset to emulate a link-up state.
Implements register space with read/write callbacks.
Signed-off-by Kane-Chen-AS <[email protected]>--- include/hw/misc/aspeed_ltpi.h | 25 +++++++++ hw/misc/aspeed_ltpi.c | 98 +++++++++++++++++++++++++++++++++++ hw/misc/meson.build | 1 + 3 files changed, 124 insertions(+)create mode 100644
include/hw/misc/aspeed_ltpi.hcreate mode 100644hw/misc/aspeed_ltpi.cinclude/hw/misc/aspeed_ltpi.h new file +25
-0@@ -0,0 +1,25 @@ +/* +* ASPEED LTPI Controller +* +* Copyright (C) 2025 ASPEED Technology Inc. +* +* SPDX-License-Identifier: GPL-2.0-or-later +*/ +#ifndef ASPEED_LTPI_H +#define ASPEED_LTPI_H + +#include "hw/sysbus.h" + +#define TYPE_ASPEED_LTPI "aspeed.ltpi-ctrl" +OBJECT_DECLARE_SIMPLE_TYPE(AspeedLTPIState, ASPEED_LTPI) + +#define ASPEED_LTPI_NR_REGS (0x900 >> 2) + +struct AspeedLTPIState { +SysBusDevice parent; +MemoryRegion mmio; + +uint32_t regs[ASPEED_LTPI_NR_REGS ]; +}; + +#endif /* ASPEED_LTPI_H */ hw/misc/aspeed_ltpi.c new file +64
-0@@ -0,0 +1,98 @@ +/* +* ASPEED LTPI Controller +* +* Copyright (C) 2025 ASPEED Technology Inc. +* +* SPDX-License-Identifier: GPL-2.0-or-later +*/ + +#include "qemu/osdep.h" +#include "qemu/log.h" +#include "migration/vmstate.h" +#include "hw/misc/aspeed_ltpi.h" + +#define LTPI_LINK_MNG 0x42 +#define LTPI_PHY_MODE 0x80 + +static uint64_t aspeed_ltpi_read (void *opaque,hwaddr offset,unsigned size) +{ +AspeedLTPIState *s = opaque; +uint32_t idx = offset >>2 ; + +return s->regs[idx]; +} + +static void aspeed_ltpi_write (void *opaque,hwaddr offset, +uint64_t val,unsigned size) +{ +AspeedLTPIState *s = opaque; +uint32_t idx = offset >>2 ; + +switch (offset) { +default : + s->regs[idx] = (uint32_t )val; +break ; + } +} + +static const MemoryRegionOps aspeed_ltpi_ops = { + .read = aspeed_ltpi_read, + .write = aspeed_ltpi_write, + .endianness =DEVICE_LITTLE_ENDIAN , + .valid = { + .min_access_size =1 , + .max_access_size =4 , + }, +}; + +static void aspeed_ltpi_reset (DeviceState *dev) +{ +AspeedLTPIState *s =ASPEED_LTPI (dev); +memset (s->regs,0 ,sizeof (s->regs)); +/* set default values */ + s->regs[LTPI_LINK_MNG ] =0x11900007 ; + s->regs[LTPI_PHY_MODE ] =0x2 ; +} + + +static const VMStateDescription vmstate_aspeed_ltpi = { + .name =TYPE_ASPEED_LTPI , + .version_id =1 , + .minimum_version_id =1 , + .fields = (VMStateField []) { +VMSTATE_UINT32_ARRAY (regs, AspeedLTPIState, +ASPEED_LTPI_NR_REGS ),
hw/misc/aspeed_ltpi.c line 74
Quoted 10 lines
hw/misc/aspeed_ltpi.c new file +10
-0+ VMSTATE_END_OF_LIST() + } +}; + +static void aspeed_ltpi_realize (DeviceState *dev,Error **errp) +{ +AspeedLTPIState *s =ASPEED_LTPI (dev); + +memory_region_init_io (&s->mmio,OBJECT (s), &aspeed_ltpi_ops, s, +TYPE_ASPEED_LTPI ,ASPEED_LTPI_NR_REGS );
The MMIO aperture is not number of registers. It should be 0x900.
Also, AIUI, there are 3 different register sets under this controller. Don't we want to model them with sub regions ?
Thanks,
C.
Quoted 36 lines
hw/misc/aspeed_ltpi.c new file +24
-0+sysbus_init_mmio (SYS_BUS_DEVICE (s), &s->mmio); +} + +static void aspeed_ltpi_class_init (ObjectClass *klass,const void *data) +{ +DeviceClass *dc =DEVICE_CLASS (klass); + dc->realize = aspeed_ltpi_realize; + dc->vmsd = &vmstate_aspeed_ltpi; +device_class_set_legacy_reset (dc, aspeed_ltpi_reset); +} + +static const TypeInfo aspeed_ltpi_info = { + .name =TYPE_ASPEED_LTPI , + .parent =TYPE_SYS_BUS_DEVICE , + .instance_size =sizeof (AspeedLTPIState), + .class_init = aspeed_ltpi_class_init, +}; + +static void aspeed_ltpi_register_types (void ) +{ +type_register_static (&aspeed_ltpi_info); +} + +type_init (aspeed_ltpi_register_types);hw/misc/meson.build +1
-0@@ -136,6 +136,7 @@ system_ss.add(when: 'CONFIG_ASPEED_SOC', if_true: files( 'aspeed_hace.c', 'aspeed_i3c.c', 'aspeed_lpc.c', + 'aspeed_ltpi.c', 'aspeed_scu.c', 'aspeed_sbc.c', 'aspeed_sdmc.c',
PATCH v2 2/17 hw/arm/aspeed: Attach LTPI controller to AST27X0 platform
In reply to Kane Chen viaFrom: Kane-Chen-AS <[email protected]>
Connect the LTPI controller device (representing the AST1700 I/O expander) to the AST27X0 SoC model. This patch sets up the memory mapping and device registration according to the AST2700 SoC design, where the LTPI controller is exposed at fixed MMIO regions.
This change only handles device instantiation and integration, without implementing the controller's internal logic.
--- include/hw/arm/aspeed_soc.h | 5 +++++ hw/arm/aspeed_ast27x0.c | 18 ++++++++++++++++++ 2 files changed, 23 insertions(+)
include/hw/arm/aspeed_soc.h +5 -0
@@ -42,6 +42,7 @@#include "hw/fsi/aspeed_apb2opb.h" #include "hw/char/serial-mm.h" #include "hw/intc/arm_gicv3.h" +#include "hw/misc/aspeed_ltpi.h" #define VBOOTROM_FILE_NAME "ast27x0_bootrom.bin"
@@ -53,6 +54,7 @@#define ASPEED_UARTS_NUM 13#define ASPEED_JTAG_NUM 2#define ASPEED_PCIE_NUM 3 +#define ASPEED_IOEXP_NUM 2struct AspeedSoCState {DeviceState parent;
@@ -110,6 +112,7 @@ struct AspeedSoCState {UnimplementedDeviceState ltpi;UnimplementedDeviceState jtag[ASPEED_JTAG_NUM ];AspeedAPB2OPBState fsi[2 ]; +AspeedLTPIState ltpi_ctrl[ASPEED_IOEXP_NUM ]; };#define TYPE_ASPEED_SOC "aspeed-soc"
@@ -275,6 +278,8 @@ enum {ASPEED_GIC_REDIST ,ASPEED_DEV_IPC0 ,ASPEED_DEV_IPC1 , +ASPEED_DEV_LTPI_CTRL1 , + ASPEED_DEV_LTPI_CTRL2, };const char *aspeed_soc_cpu_type (const char *const *valid_cpu_types);
hw/arm/aspeed_ast27x0.c +18 -0
@@ -86,6 +86,8 @@ static const hwaddr aspeed_soc_ast2700_memmap[] = { [ASPEED_DEV_UART10] = 0x14C33900, [ASPEED_DEV_UART11] = 0x14C33A00, [ASPEED_DEV_UART12] = 0x14C33B00, + [ASPEED_DEV_LTPI_CTRL1] = 0x14C34000, + [ASPEED_DEV_LTPI_CTRL2] = 0x14C35000, [ASPEED_DEV_WDT] = 0x14C37000, [ASPEED_DEV_PCIE_MMIO0] = 0x60000000, [ASPEED_DEV_PCIE_MMIO1] = 0x80000000,
@@ -543,6 +545,10 @@ static void aspeed_soc_ast2700_init(Object *obj)object_property_set_int (OBJECT (&s->pcie[i]),"id" , i, &error_abort); } +for (i =0 ; i <ASPEED_IOEXP_NUM ; i++) { +object_initialize_child (obj,"ltpi-ctrl[*]" , + &s->ltpi_ctrl[i],TYPE_ASPEED_LTPI ); + }object_initialize_child (obj,"dpmcu" , &s->dpmcu,TYPE_UNIMPLEMENTED_DEVICE ); object_initialize_child(obj, "ltpi", &s->ltpi,
@@ -688,6 +694,8 @@ static void aspeed_soc_ast2700_realize(DeviceState *dev, Error **errp) g_autofree char *name = NULL;qemu_irq irq;int uart; +AspeedLTPIState *ltpi_ctrl; +hwaddr ltpi_base;/* Default boot region (SPI memory or ROMs) */ memory_region_init(&s->spi_boot_container, OBJECT(s),
@@ -1021,6 +1029,16 @@ static void aspeed_soc_ast2700_realize(DeviceState *dev, Error **errp)return ; } +/* LTPI controller */ +for (i =0 ; i <ASPEED_IOEXP_NUM ; i++) { + ltpi_ctrl =ASPEED_LTPI (&s->ltpi_ctrl[i]); + ltpi_base = sc->memmap[ASPEED_DEV_LTPI_CTRL1 + i]; + +if (!sysbus_realize (SYS_BUS_DEVICE (ltpi_ctrl), errp)) { +return ; + } +aspeed_mmio_map (s->memory,SYS_BUS_DEVICE (ltpi_ctrl),0 , ltpi_base); + } aspeed_mmio_map_unimplemented(s->memory, SYS_BUS_DEVICE(&s->dpmcu), "aspeed.dpmcu", sc->memmap[ASPEED_DEV_DPMCU],
Signature · 1 line
2.43.0
Re: [PATCH v2 02/17] hw/arm/aspeed: Attach LTPI controller to AST27X0 platform
Quoted 78 lines · Kane Chen
From: Kane-Chen-AS <[email protected]>
Connect the LTPI controller device (representing the AST1700 I/O expander) to the AST27X0 SoC model. This patch sets up the memory mapping and device registration according to the AST2700 SoC design, where the LTPI controller is exposed at fixed MMIO regions.
This change only handles device instantiation and integration, without implementing the controller's internal logic.
Signed-off-by Kane-Chen-AS <[email protected]>--- include/hw/arm/aspeed_soc.h | 5 +++++ hw/arm/aspeed_ast27x0.c | 18 ++++++++++++++++++ 2 files changed, 23 insertions(+)include/hw/arm/aspeed_soc.h +5
-0@@ -42,6 +42,7 @@#include "hw/fsi/aspeed_apb2opb.h" #include "hw/char/serial-mm.h" #include "hw/intc/arm_gicv3.h" +#include "hw/misc/aspeed_ltpi.h" #define VBOOTROM_FILE_NAME "ast27x0_bootrom.bin"@@ -53,6 +54,7 @@#define ASPEED_UARTS_NUM 13#define ASPEED_JTAG_NUM 2#define ASPEED_PCIE_NUM 3 +#define ASPEED_IOEXP_NUM 2struct AspeedSoCState {DeviceState parent;@@ -110,6 +112,7 @@ struct AspeedSoCState {UnimplementedDeviceState ltpi;UnimplementedDeviceState jtag[ASPEED_JTAG_NUM ];AspeedAPB2OPBState fsi[2 ]; +AspeedLTPIState ltpi_ctrl[ASPEED_IOEXP_NUM ]; };#define TYPE_ASPEED_SOC "aspeed-soc"@@ -275,6 +278,8 @@ enum {ASPEED_GIC_REDIST ,ASPEED_DEV_IPC0 ,ASPEED_DEV_IPC1 , +ASPEED_DEV_LTPI_CTRL1 , + ASPEED_DEV_LTPI_CTRL2, };const char *aspeed_soc_cpu_type (const char *const *valid_cpu_types);hw/arm/aspeed_ast27x0.c +6
-0@@ -86,6 +86,8 @@ static const hwaddr aspeed_soc_ast2700_memmap[] = { [ASPEED_DEV_UART10] = 0x14C33900, [ASPEED_DEV_UART11] = 0x14C33A00, [ASPEED_DEV_UART12] = 0x14C33B00, + [ASPEED_DEV_LTPI_CTRL1] = 0x14C34000, + [ASPEED_DEV_LTPI_CTRL2] = 0x14C35000, [ASPEED_DEV_WDT] = 0x14C37000, [ASPEED_DEV_PCIE_MMIO0] = 0x60000000, [ASPEED_DEV_PCIE_MMIO1] = 0x80000000,@@ -543,6 +545,10 @@ static void aspeed_soc_ast2700_init(Object *obj)object_property_set_int (OBJECT (&s->pcie[i]),"id" , i, &error_abort); } +for (i =0 ; i <ASPEED_IOEXP_NUM ; i++) { +object_initialize_child (obj,"ltpi-ctrl[*]" , + &s->ltpi_ctrl[i],TYPE_ASPEED_LTPI ); + }object_initialize_child (obj,"dpmcu" , &s->dpmcu,TYPE_UNIMPLEMENTED_DEVICE ); object_initialize_child(obj, "ltpi", &s->ltpi,
hw/arm/aspeed_ast27x0.c static void aspeed_soc_ast2700_realize(DeviceState *dev, Error **errp) · line 698
Quoted 5 lines
hw/arm/aspeed_ast27x0.c +2
-0@@ -688,6 +694,8 @@ static void aspeed_soc_ast2700_realize(DeviceState *dev, Error **errp) g_autofree char *name = NULL;qemu_irq irq;int uart; +AspeedLTPIState *ltpi_ctrl; +hwaddr ltpi_base;
These 2 variable declarations could be moved under the loop introduced below.
Thanks,
C.
Quoted 20 lines
hw/arm/aspeed_ast27x0.c +10
-0/* Default boot region (SPI memory or ROMs) */ memory_region_init(&s->spi_boot_container, OBJECT(s),@@ -1021,6 +1029,16 @@ static void aspeed_soc_ast2700_realize(DeviceState *dev, Error **errp)return ; } +/* LTPI controller */ +for (i =0 ; i <ASPEED_IOEXP_NUM ; i++) { + ltpi_ctrl =ASPEED_LTPI (&s->ltpi_ctrl[i]); + ltpi_base = sc->memmap[ASPEED_DEV_LTPI_CTRL1 + i]; + +if (!sysbus_realize (SYS_BUS_DEVICE (ltpi_ctrl), errp)) { +return ; + } +aspeed_mmio_map (s->memory,SYS_BUS_DEVICE (ltpi_ctrl),0 , ltpi_base); + } aspeed_mmio_map_unimplemented(s->memory, SYS_BUS_DEVICE(&s->dpmcu), "aspeed.dpmcu", sc->memmap[ASPEED_DEV_DPMCU],
PATCH v2 3/17 hw/arm/aspeed: Add AST1700 LTPI expander device model
In reply to Kane Chen viaFrom: Kane-Chen-AS <[email protected]>
Introduce a minimal QEMU device model for the ASPEED AST1700, an MCU-less I/O expander used in the LTPI topology defined by the DC-SCM 2.0 specification (see figure 2):
https://www.opencompute.org/documents/ocp-dc-scm-2-0-ltpi-ver-1-0-pdf
This initial implementation includes:
* Definition of aspeed.ast1700 as a SysBusDevice
* Setup of a basic memory region to reserve I/O space for future peripheral modeling
This stub establishes the foundation for LTPI-related device emulation, without implementing any functional peripherals at this stage.
--- include/hw/misc/aspeed_ast1700.h | 32 ++++++++++++++++++ hw/misc/aspeed_ast1700.c | 57 ++++++++++++++++++++++++++++++++ hw/misc/meson.build | 1 + 3 files changed, 90 insertions(+) create mode 100644 include/hw/misc/aspeed_ast1700.h create mode 100644 hw/misc/aspeed_ast1700.c
include/hw/misc/aspeed_ast1700.h new file +32 -0
@@ -0,0 +1,32 @@ +/* +* ASPEED AST1700 IO Expander +* +* Copyright (C) 2025 ASPEED Technology Inc. +* +* SPDX-License-Identifier: GPL-2.0-or-later +*/ +#ifndef ASPEED_AST1700_H +#define ASPEED_AST1700_H + +#include "hw/sysbus.h" +#include "hw/misc/aspeed_scu.h" +#include "hw/adc/aspeed_adc.h" +#include "hw/gpio/aspeed_gpio.h" +#include "hw/i2c/aspeed_i2c.h" +#include "hw/misc/aspeed_ltpi.h" +#include "hw/ssi/aspeed_smc.h" +#include "hw/watchdog/wdt_aspeed.h" +#include "hw/char/serial-mm.h" +#include "hw/misc/unimp.h" + +#define TYPE_ASPEED_AST1700 "aspeed.ast1700" + +OBJECT_DECLARE_SIMPLE_TYPE(AspeedAST1700SoCState, ASPEED_AST1700) + +struct AspeedAST1700SoCState { +SysBusDevice parent_obj; + +MemoryRegion iomem; +}; + +#endif /* ASPEED_AST1700_H */
hw/misc/aspeed_ast1700.c new file +57 -0
57 lines not on this page · raw message
hw/misc/meson.build +1 -0
@@ -133,6 +133,7 @@ system_ss.add(when: 'CONFIG_PVPANIC_PCI', if_true: files('pvpanic-pci.c')) system_ss.add(when: 'CONFIG_PVPANIC_MMIO', if_true: files('pvpanic-mmio.c')) system_ss.add(when: 'CONFIG_AUX', if_true: files('auxbus.c')) system_ss.add(when: 'CONFIG_ASPEED_SOC', if_true: files( + 'aspeed_ast1700.c', 'aspeed_hace.c', 'aspeed_i3c.c', 'aspeed_lpc.c',
Signature · 1 line
2.43.0
Re: [PATCH v2 03/17] hw/arm/aspeed: Add AST1700 LTPI expander device model
Quoted 42 lines · Kane Chen
From: Kane-Chen-AS <[email protected]>
Introduce a minimal QEMU device model for the ASPEED AST1700, an MCU-less I/O expander used in the LTPI topology defined by the DC-SCM 2.0 specification (see figure 2):
https://www.opencompute.org/documents/ocp-dc-scm-2-0-ltpi-ver-1-0-pdfThis initial implementation includes:
* Definition of aspeed.ast1700 as a SysBusDevice
* Setup of a basic memory region to reserve I/O space for future peripheral modeling
This stub establishes the foundation for LTPI-related device emulation, without implementing any functional peripherals at this stage.
Signed-off-by Kane-Chen-AS <[email protected]>--- include/hw/misc/aspeed_ast1700.h | 32 ++++++++++++++++++ hw/misc/aspeed_ast1700.c | 57 ++++++++++++++++++++++++++++++++ hw/misc/meson.build | 1 + 3 files changed, 90 insertions(+)create mode 100644
include/hw/misc/aspeed_ast1700.hcreate mode 100644hw/misc/aspeed_ast1700.cinclude/hw/misc/aspeed_ast1700.h new file +10
-0@@ -0,0 +1,32 @@ +/* +* ASPEED AST1700 IO Expander +* +* Copyright (C) 2025 ASPEED Technology Inc. +* +* SPDX-License-Identifier: GPL-2.0-or-later +*/ +#ifndef ASPEED_AST1700_H +#define ASPEED_AST1700_H +
include/hw/misc/aspeed_ast1700.h line 20
Quoted 10 lines
include/hw/misc/aspeed_ast1700.h new file +10
-0+#include "hw/sysbus.h" +#include "hw/misc/aspeed_scu.h" +#include "hw/adc/aspeed_adc.h" +#include "hw/gpio/aspeed_gpio.h" +#include "hw/i2c/aspeed_i2c.h" +#include "hw/misc/aspeed_ltpi.h" +#include "hw/ssi/aspeed_smc.h" +#include "hw/watchdog/wdt_aspeed.h" +#include "hw/char/serial-mm.h" +#include "hw/misc/unimp.h"
There are too much includes. Please introduce the minimum each time.
Quoted 23 lines
include/hw/misc/aspeed_ast1700.h new file +12
-0+ +#define TYPE_ASPEED_AST1700 "aspeed.ast1700" + +OBJECT_DECLARE_SIMPLE_TYPE(AspeedAST1700SoCState, ASPEED_AST1700) + +struct AspeedAST1700SoCState { +SysBusDevice parent_obj; + +MemoryRegion iomem; +}; + +#endif /* ASPEED_AST1700_H */ hw/misc/aspeed_ast1700.c new file +5
-0@@ -0,0 +1,57 @@ +/* +* ASPEED AST1700 IO Expander +* +* Copyright (C) 2025 ASPEED Technology Inc. +*
hw/misc/aspeed_ast1700.c line 15
Quoted 10 lines
hw/misc/aspeed_ast1700.c new file +10
-0+* SPDX-License-Identifier: GPL-2.0-or-later +*/ + +#include "qemu/osdep.h" +#include "hw/boards.h" +#include "hw/qdev-core.h" +#include "qom/object.h" +#include "hw/qdev-properties.h" +#include "qemu/log.h" +#include "migration/vmstate.h"
No vmstate ?
Quoted 8 lines
hw/misc/aspeed_ast1700.c new file +8
-0+#include "hw/misc/aspeed_ast1700.h" +> +#define AST2700_SOC_LTPI_SIZE 0x01000000 +static void aspeed_ast1700_realize (DeviceState *dev,Error **errp) +{ +AspeedAST1700SoCState *s =ASPEED_AST1700 (dev); +SysBusDevice *sbd =SYS_BUS_DEVICE (dev); + +/* Occupy memory space for all controllers in AST1700 */
hw/misc/aspeed_ast1700.c line 34
Quoted 10 lines
hw/misc/aspeed_ast1700.c new file +10
-0+memory_region_init (&s->iomem,OBJECT (s),TYPE_ASPEED_AST1700 , +AST2700_SOC_LTPI_SIZE ); +sysbus_init_mmio (sbd, &s->iomem); + +} + +static void aspeed_ast1700_instance_init (Object *obj) +{ +return ; +}
It's better to introduce a routine when needed.
Thanks,
C.
Quoted 34 lines
hw/misc/aspeed_ast1700.c new file +22
-0+static void aspeed_ast1700_class_init (ObjectClass *klass,const void *data) +{ +DeviceClass *dc =DEVICE_CLASS (klass); + + dc->realize = aspeed_ast1700_realize; +} + +static const TypeInfo aspeed_ast1700_info = { + .name =TYPE_ASPEED_AST1700 , + .parent =TYPE_SYS_BUS_DEVICE , + .instance_size =sizeof (AspeedAST1700SoCState), + .class_init = aspeed_ast1700_class_init, + .instance_init = aspeed_ast1700_instance_init, +}; + + +static void aspeed_ast1700_register_types (void ) +{ +type_register_static (&aspeed_ast1700_info); +} + +type_init (aspeed_ast1700_register_types);hw/misc/meson.build +1
-0@@ -133,6 +133,7 @@ system_ss.add(when: 'CONFIG_PVPANIC_PCI', if_true: files('pvpanic-pci.c')) system_ss.add(when: 'CONFIG_PVPANIC_MMIO', if_true: files('pvpanic-mmio.c')) system_ss.add(when: 'CONFIG_AUX', if_true: files('auxbus.c')) system_ss.add(when: 'CONFIG_ASPEED_SOC', if_true: files( + 'aspeed_ast1700.c', 'aspeed_hace.c', 'aspeed_i3c.c', 'aspeed_lpc.c',
PATCH v2 4/17 hw/arm/aspeed: Integrate AST1700 device into AST27X0
In reply to Kane Chen viaFrom: Kane-Chen-AS <[email protected]>
Connect the AST1700 device as a child of the AST27X0 model to reflect its role in DC-SCM 2.0 LTPI-based architectures. This patch wires the AST1700 device into the platform without introducing functional peripherals.
This forms the base for LTPI expander emulation in QEMU using AST27X0 as the host controller.
--- include/hw/arm/aspeed_soc.h | 9 +++++++-- include/hw/misc/aspeed_ast1700.h | 1 + hw/arm/aspeed_ast27x0.c | 30 ++++++++++++++++++++++-------- hw/misc/aspeed_ast1700.c | 6 ++++++ 4 files changed, 36 insertions(+), 10 deletions(-)
include/hw/arm/aspeed_soc.h +7 -2
@@ -43,6 +43,7 @@#include "hw/char/serial-mm.h" #include "hw/intc/arm_gicv3.h" #include "hw/misc/aspeed_ltpi.h" +#include "hw/misc/aspeed_ast1700.h" #define VBOOTROM_FILE_NAME "ast27x0_bootrom.bin"
@@ -109,10 +110,10 @@ struct AspeedSoCState {UnimplementedDeviceState espi;UnimplementedDeviceState udc;UnimplementedDeviceState sgpiom; -UnimplementedDeviceState ltpi;UnimplementedDeviceState jtag[ASPEED_JTAG_NUM ];AspeedAPB2OPBState fsi[2 ];AspeedLTPIState ltpi_ctrl[ASPEED_IOEXP_NUM ]; +AspeedAST1700SoCState ioexp[ASPEED_IOEXP_NUM ]; };#define TYPE_ASPEED_SOC "aspeed-soc"
@@ -174,6 +175,7 @@ struct AspeedSoCClass {int macs_num;int uarts_num;int uarts_base; +int ioexp_num;const int *irqmap;const hwaddr *memmap;uint32_t num_cpus;
@@ -186,7 +188,8 @@ enum {ASPEED_DEV_IOMEM ,ASPEED_DEV_IOMEM0 ,ASPEED_DEV_IOMEM1 , -ASPEED_DEV_LTPI , +ASPEED_DEV_LTPI_IO0 , +ASPEED_DEV_LTPI_IO1 ,ASPEED_DEV_UART0 ,ASPEED_DEV_UART1 , ASPEED_DEV_UART2,
@@ -280,6 +283,8 @@ enum {ASPEED_DEV_IPC1 ,ASPEED_DEV_LTPI_CTRL1 ,ASPEED_DEV_LTPI_CTRL2 , +ASPEED_DEV_IOEXP0_INTCIO , + ASPEED_DEV_IOEXP1_INTCIO, };const char *aspeed_soc_cpu_type (const char *const *valid_cpu_types);
include/hw/misc/aspeed_ast1700.h +1 -0
@@ -20,6 +20,7 @@#include "hw/misc/unimp.h" #define TYPE_ASPEED_AST1700 "aspeed.ast1700" +#define TYPE_ASPEED_AST1700_AST2700 "aspeed.ast1700-ast2700"OBJECT_DECLARE_SIMPLE_TYPE (AspeedAST1700SoCState,ASPEED_AST1700 )
hw/arm/aspeed_ast27x0.c +22 -8
@@ -26,7 +26,6 @@#define AST2700_SOC_IO_SIZE 0x00FE0000#define AST2700_SOC_IOMEM_SIZE 0x01000000#define AST2700_SOC_DPMCU_SIZE 0x00040000 -#define AST2700_SOC_LTPI_SIZE 0x01000000static const hwaddr aspeed_soc_ast2700_memmap[] = { [ASPEED_DEV_VBOOTROM ] =0x00000000 ,
@@ -89,11 +88,14 @@ static const hwaddr aspeed_soc_ast2700_memmap[] = { [ASPEED_DEV_LTPI_CTRL1] = 0x14C34000, [ASPEED_DEV_LTPI_CTRL2] = 0x14C35000, [ASPEED_DEV_WDT] = 0x14C37000, + [ASPEED_DEV_LTPI_IO0] = 0x30000000, + [ASPEED_DEV_IOEXP0_INTCIO] = 0x30C18000, + [ASPEED_DEV_LTPI_IO1] = 0x50000000, + [ASPEED_DEV_IOEXP1_INTCIO] = 0x50C18000, [ASPEED_DEV_PCIE_MMIO0] = 0x60000000, [ASPEED_DEV_PCIE_MMIO1] = 0x80000000, [ASPEED_DEV_PCIE_MMIO2] = 0xA0000000, [ASPEED_DEV_SPI_BOOT] = 0x100000000, - [ASPEED_DEV_LTPI] = 0x300000000, [ASPEED_DEV_SDRAM] = 0x400000000, };
@@ -549,10 +551,15 @@ static void aspeed_soc_ast2700_init(Object *obj)object_initialize_child (obj,"ltpi-ctrl[*]" , &s->ltpi_ctrl[i],TYPE_ASPEED_LTPI ); } + +for (i =0 ; i < sc->ioexp_num; i++) { +/* AST1700 IOEXP */ +object_initialize_child (obj,"ioexp[*]" , &s->ioexp[i], +TYPE_ASPEED_AST1700_AST2700 ); + } +object_initialize_child (obj,"dpmcu" , &s->dpmcu,TYPE_UNIMPLEMENTED_DEVICE ); -object_initialize_child (obj,"ltpi" , &s->ltpi, -TYPE_UNIMPLEMENTED_DEVICE );object_initialize_child (obj,"iomem" , &s->iomem,TYPE_UNIMPLEMENTED_DEVICE ); object_initialize_child(obj, "iomem0", &s->iomem0,
@@ -1039,14 +1046,20 @@ static void aspeed_soc_ast2700_realize(DeviceState *dev, Error **errp) }aspeed_mmio_map (s->memory,SYS_BUS_DEVICE (ltpi_ctrl),0 , ltpi_base); } + +/* IO Expander */ +for (i =0 ; i < sc->ioexp_num; i++) { +if (!sysbus_realize (SYS_BUS_DEVICE (&s->ioexp[i]), errp)) { +return ; + } +sysbus_mmio_map (SYS_BUS_DEVICE (&s->ioexp[i]),0 , + sc->memmap[ASPEED_DEV_LTPI_IO0 + i]); + } +aspeed_mmio_map_unimplemented (s->memory,SYS_BUS_DEVICE (&s->dpmcu),"aspeed.dpmcu" , sc->memmap[ASPEED_DEV_DPMCU ],AST2700_SOC_DPMCU_SIZE ); -aspeed_mmio_map_unimplemented (s->memory,SYS_BUS_DEVICE (&s->ltpi), -"aspeed.ltpi" , - sc->memmap[ASPEED_DEV_LTPI ], -AST2700_SOC_LTPI_SIZE ); aspeed_mmio_map_unimplemented(s->memory, SYS_BUS_DEVICE(&s->iomem), "aspeed.io", sc->memmap[ASPEED_DEV_IOMEM],
@@ -1112,6 +1125,7 @@ static void aspeed_soc_ast2700a1_class_init(ObjectClass *oc, const void *data) sc->macs_num =3 ; sc->uarts_num =13 ; sc->num_cpus =4 ; + sc->ioexp_num =2 ; sc->uarts_base =ASPEED_DEV_UART0 ; sc->irqmap = aspeed_soc_ast2700a1_irqmap; sc->memmap = aspeed_soc_ast2700_memmap;
hw/misc/aspeed_ast1700.c +6 -0
@@ -48,10 +48,16 @@ static const TypeInfo aspeed_ast1700_info = { .instance_init = aspeed_ast1700_instance_init, }; +static const TypeInfo aspeed_ast1700_ast2700_info = { + .name =TYPE_ASPEED_AST1700_AST2700 , + .parent =TYPE_ASPEED_AST1700 , +}; +static void aspeed_ast1700_register_types (void ) {type_register_static (&aspeed_ast1700_info); +type_register_static (&aspeed_ast1700_ast2700_info); }type_init (aspeed_ast1700_register_types);
Signature · 1 line
2.43.0
Re: [PATCH v2 04/17] hw/arm/aspeed: Integrate AST1700 device into AST27X0
Quoted 61 lines · Kane Chen
From: Kane-Chen-AS <[email protected]>
Connect the AST1700 device as a child of the AST27X0 model to reflect its role in DC-SCM 2.0 LTPI-based architectures. This patch wires the AST1700 device into the platform without introducing functional peripherals.
This forms the base for LTPI expander emulation in QEMU using AST27X0 as the host controller.
Signed-off-by Kane-Chen-AS <[email protected]>--- include/hw/arm/aspeed_soc.h | 9 +++++++-- include/hw/misc/aspeed_ast1700.h | 1 + hw/arm/aspeed_ast27x0.c | 30 ++++++++++++++++++++++-------- hw/misc/aspeed_ast1700.c | 6 ++++++ 4 files changed, 36 insertions(+), 10 deletions(-)include/hw/arm/aspeed_soc.h +5
-2@@ -43,6 +43,7 @@#include "hw/char/serial-mm.h" #include "hw/intc/arm_gicv3.h" #include "hw/misc/aspeed_ltpi.h" +#include "hw/misc/aspeed_ast1700.h" #define VBOOTROM_FILE_NAME "ast27x0_bootrom.bin"@@ -109,10 +110,10 @@ struct AspeedSoCState {UnimplementedDeviceState espi;UnimplementedDeviceState udc;UnimplementedDeviceState sgpiom; -UnimplementedDeviceState ltpi;UnimplementedDeviceState jtag[ASPEED_JTAG_NUM ];AspeedAPB2OPBState fsi[2 ];AspeedLTPIState ltpi_ctrl[ASPEED_IOEXP_NUM ]; +AspeedAST1700SoCState ioexp[ASPEED_IOEXP_NUM ]; };#define TYPE_ASPEED_SOC "aspeed-soc"@@ -174,6 +175,7 @@ struct AspeedSoCClass {int macs_num;int uarts_num;int uarts_base; +int ioexp_num;const int *irqmap;const hwaddr *memmap;uint32_t num_cpus;@@ -186,7 +188,8 @@ enum {ASPEED_DEV_IOMEM ,ASPEED_DEV_IOMEM0 ,ASPEED_DEV_IOMEM1 , -ASPEED_DEV_LTPI , +ASPEED_DEV_LTPI_IO0 , +ASPEED_DEV_LTPI_IO1 ,ASPEED_DEV_UART0 ,ASPEED_DEV_UART1 , ASPEED_DEV_UART2,
include/hw/arm/aspeed_soc.h enum { · line 287
Quoted 5 lines
include/hw/arm/aspeed_soc.h +2
-0@@ -280,6 +283,8 @@ enum {ASPEED_DEV_IPC1 ,ASPEED_DEV_LTPI_CTRL1 ,ASPEED_DEV_LTPI_CTRL2 , +ASPEED_DEV_IOEXP0_INTCIO , + ASPEED_DEV_IOEXP1_INTCIO,
Please put the index number at the end of the enum definition. These definitions are unused too. Please move in the next patch.
Quoted 99 lines
include/hw/arm/aspeed_soc.h +0
-0};const char *aspeed_soc_cpu_type (const char *const *valid_cpu_types);include/hw/misc/aspeed_ast1700.h +1
-0@@ -20,6 +20,7 @@#include "hw/misc/unimp.h" #define TYPE_ASPEED_AST1700 "aspeed.ast1700" +#define TYPE_ASPEED_AST1700_AST2700 "aspeed.ast1700-ast2700"OBJECT_DECLARE_SIMPLE_TYPE (AspeedAST1700SoCState,ASPEED_AST1700 )hw/arm/aspeed_ast27x0.c +22
-8@@ -26,7 +26,6 @@#define AST2700_SOC_IO_SIZE 0x00FE0000#define AST2700_SOC_IOMEM_SIZE 0x01000000#define AST2700_SOC_DPMCU_SIZE 0x00040000 -#define AST2700_SOC_LTPI_SIZE 0x01000000static const hwaddr aspeed_soc_ast2700_memmap[] = { [ASPEED_DEV_VBOOTROM ] =0x00000000 ,@@ -89,11 +88,14 @@ static const hwaddr aspeed_soc_ast2700_memmap[] = { [ASPEED_DEV_LTPI_CTRL1] = 0x14C34000, [ASPEED_DEV_LTPI_CTRL2] = 0x14C35000, [ASPEED_DEV_WDT] = 0x14C37000, + [ASPEED_DEV_LTPI_IO0] = 0x30000000, + [ASPEED_DEV_IOEXP0_INTCIO] = 0x30C18000, + [ASPEED_DEV_LTPI_IO1] = 0x50000000, + [ASPEED_DEV_IOEXP1_INTCIO] = 0x50C18000, [ASPEED_DEV_PCIE_MMIO0] = 0x60000000, [ASPEED_DEV_PCIE_MMIO1] = 0x80000000, [ASPEED_DEV_PCIE_MMIO2] = 0xA0000000, [ASPEED_DEV_SPI_BOOT] = 0x100000000, - [ASPEED_DEV_LTPI] = 0x300000000, [ASPEED_DEV_SDRAM] = 0x400000000, };@@ -549,10 +551,15 @@ static void aspeed_soc_ast2700_init(Object *obj)object_initialize_child (obj,"ltpi-ctrl[*]" , &s->ltpi_ctrl[i],TYPE_ASPEED_LTPI ); } + +for (i =0 ; i < sc->ioexp_num; i++) { +/* AST1700 IOEXP */ +object_initialize_child (obj,"ioexp[*]" , &s->ioexp[i], +TYPE_ASPEED_AST1700_AST2700 ); + } +object_initialize_child (obj,"dpmcu" , &s->dpmcu,TYPE_UNIMPLEMENTED_DEVICE ); -object_initialize_child (obj,"ltpi" , &s->ltpi, -TYPE_UNIMPLEMENTED_DEVICE );object_initialize_child (obj,"iomem" , &s->iomem,TYPE_UNIMPLEMENTED_DEVICE ); object_initialize_child(obj, "iomem0", &s->iomem0,@@ -1039,14 +1046,20 @@ static void aspeed_soc_ast2700_realize(DeviceState *dev, Error **errp) }aspeed_mmio_map (s->memory,SYS_BUS_DEVICE (ltpi_ctrl),0 , ltpi_base); } + +/* IO Expander */ +for (i =0 ; i < sc->ioexp_num; i++) { +if (!sysbus_realize (SYS_BUS_DEVICE (&s->ioexp[i]), errp)) { +return ; + } +sysbus_mmio_map (SYS_BUS_DEVICE (&s->ioexp[i]),0 , + sc->memmap[ASPEED_DEV_LTPI_IO0 + i]); + } +aspeed_mmio_map_unimplemented (s->memory,SYS_BUS_DEVICE (&s->dpmcu),"aspeed.dpmcu" , sc->memmap[ASPEED_DEV_DPMCU ],AST2700_SOC_DPMCU_SIZE ); -aspeed_mmio_map_unimplemented (s->memory,SYS_BUS_DEVICE (&s->ltpi), -"aspeed.ltpi" , - sc->memmap[ASPEED_DEV_LTPI ], -AST2700_SOC_LTPI_SIZE ); aspeed_mmio_map_unimplemented(s->memory, SYS_BUS_DEVICE(&s->iomem), "aspeed.io", sc->memmap[ASPEED_DEV_IOMEM],@@ -1112,6 +1125,7 @@ static void aspeed_soc_ast2700a1_class_init(ObjectClass *oc, const void *data) sc->macs_num =3 ; sc->uarts_num =13 ; sc->num_cpus =4 ; + sc->ioexp_num =2 ; sc->uarts_base =ASPEED_DEV_UART0 ; sc->irqmap = aspeed_soc_ast2700a1_irqmap; sc->memmap = aspeed_soc_ast2700_memmap;hw/misc/aspeed_ast1700.c +0
-0
hw/misc/aspeed_ast1700.c static const TypeInfo aspeed_ast1700_info = { · line 55
Quoted 8 lines
hw/misc/aspeed_ast1700.c +5
-0@@ -48,10 +48,16 @@ static const TypeInfo aspeed_ast1700_info = { .instance_init = aspeed_ast1700_instance_init, }; +static const TypeInfo aspeed_ast1700_ast2700_info = { + .name =TYPE_ASPEED_AST1700_AST2700 , + .parent =TYPE_ASPEED_AST1700 , +}; +
As discussed earlier, this type is not useful.
Thanks,
C.
Quoted 8 lines
hw/misc/aspeed_ast1700.c +1
-0static void aspeed_ast1700_register_types (void ) {type_register_static (&aspeed_ast1700_info); +type_register_static (&aspeed_ast1700_ast2700_info); }type_init (aspeed_ast1700_register_types);
PATCH v2 5/17 hw/arm/aspeed: Integrate interrupt controller for AST1700
In reply to Kane Chen viaFrom: Kane-Chen-AS <[email protected]>
Connect the AST1700 interrupt lines to the GIC in AST27X0, enabling the propagation of AST1700-originated interrupts to the host SoC.
This patch does not implement interrupt sources in AST1700 itself, only the wiring into AST27X0.
--- include/hw/arm/aspeed_soc.h | 2 +- include/hw/intc/aspeed_intc.h | 2 ++ hw/arm/aspeed_ast27x0.c | 36 +++++++++++++++++++++ hw/intc/aspeed_intc.c | 60 +++++++++++++++++++++++++++++++++++ 4 files changed, 99 insertions(+), 1 deletion(-)
include/hw/arm/aspeed_soc.h +1 -1
@@ -143,7 +143,7 @@ struct Aspeed27x0SoCState {AspeedSoCState parent;ARMCPU cpu[ASPEED_CPUS_NUM ]; -AspeedINTCState intc[2 ]; +AspeedINTCState intc[4 ];GICv3State gic;MemoryRegion dram_empty; };
include/hw/intc/aspeed_intc.h +2 -0
@@ -15,6 +15,8 @@#define TYPE_ASPEED_INTC "aspeed.intc"#define TYPE_ASPEED_2700_INTC TYPE_ASPEED_INTC "-ast2700"#define TYPE_ASPEED_2700_INTCIO TYPE_ASPEED_INTC "io-ast2700" +#define TYPE_ASPEED_2700_INTCIOEXP1 TYPE_ASPEED_INTC "ast2700-ioexp1" +#define TYPE_ASPEED_2700_INTCIOEXP2 TYPE_ASPEED_INTC "ast2700-ioexp2"#define TYPE_ASPEED_2700SSP_INTC TYPE_ASPEED_INTC "-ast2700ssp"#define TYPE_ASPEED_2700SSP_INTCIO TYPE_ASPEED_INTC "io-ast2700ssp"#define TYPE_ASPEED_2700TSP_INTC TYPE_ASPEED_INTC "-ast2700tsp"
hw/arm/aspeed_ast27x0.c +36 -0
@@ -505,6 +505,10 @@ static void aspeed_soc_ast2700_init(Object *obj)object_initialize_child (obj,"intc" , &a->intc[0 ],TYPE_ASPEED_2700_INTC );object_initialize_child (obj,"intcio" , &a->intc[1 ],TYPE_ASPEED_2700_INTCIO ); +object_initialize_child (obj,"intcioexp0" , &a->intc[2 ], +TYPE_ASPEED_2700_INTCIOEXP1 ); +object_initialize_child (obj,"intcioexp1" , &a->intc[3 ], +TYPE_ASPEED_2700_INTCIOEXP2 );snprintf (typename,sizeof (typename),"aspeed.adc-%s" , socname);object_initialize_child (obj,"adc" , &s->adc, typename);
@@ -701,6 +705,7 @@ static void aspeed_soc_ast2700_realize(DeviceState *dev, Error **errp) g_autofree char *name = NULL;qemu_irq irq;int uart; +int j;AspeedLTPIState *ltpi_ctrl;hwaddr ltpi_base;
@@ -746,6 +751,22 @@ static void aspeed_soc_ast2700_realize(DeviceState *dev, Error **errp)aspeed_mmio_map (s->memory,SYS_BUS_DEVICE (&a->intc[1 ]),0 , sc->memmap[ASPEED_DEV_INTCIO ]); +/* INTCIOEXP0 */ +if (!sysbus_realize (SYS_BUS_DEVICE (&a->intc[2 ]), errp)) { +return ; + } + +aspeed_mmio_map (s->memory,SYS_BUS_DEVICE (&a->intc[2 ]),0 , + sc->memmap[ASPEED_DEV_IOEXP0_INTCIO ]); + +/* INTCIOEXP */ +if (!sysbus_realize (SYS_BUS_DEVICE (&a->intc[3 ]), errp)) { +return ; + } + +aspeed_mmio_map (s->memory,SYS_BUS_DEVICE (&a->intc[3 ]),0 , + sc->memmap[ASPEED_DEV_IOEXP1_INTCIO ]); +/* irq sources -> orgates -> INTC */ for (i =0 ; i < ic->num_inpins; i++) { qdev_connect_gpio_out(DEVICE(&a->intc[0].orgates[i]), 0,
@@ -1054,6 +1075,21 @@ static void aspeed_soc_ast2700_realize(DeviceState *dev, Error **errp) }sysbus_mmio_map (SYS_BUS_DEVICE (&s->ioexp[i]),0 , sc->memmap[ASPEED_DEV_LTPI_IO0 + i]); + + icio =ASPEED_INTC_GET_CLASS (&a->intc[2 + i]); +/* INTC2/3 internal: orgate[i] -> input[i] */ +for (j =0 ; j < icio->num_inpins; j++) { + irq =qdev_get_gpio_in (DEVICE (&a->intc[2 + i]), j); +qdev_connect_gpio_out (DEVICE (&a->intc[2 + i].orgates[j]),0 , + irq); + } + +/* INTC2/3 output[i] -> INTC0.orgate[0].input[i] */ +for (j =0 ; j < icio->num_outpins; j++) { + irq =qdev_get_gpio_in (DEVICE (&a->intc[0 ].orgates[0 ]), j); +sysbus_connect_irq (SYS_BUS_DEVICE (&a->intc[2 + i]), j, + irq); + } } aspeed_mmio_map_unimplemented(s->memory, SYS_BUS_DEVICE(&s->dpmcu),
hw/intc/aspeed_intc.c +60 -0
72 lines not on this page · raw message
Signature · 1 line
2.43.0
Re: [PATCH v2 05/17] hw/arm/aspeed: Integrate interrupt controller for AST1700
Quoted 21 lines · Kane Chen
From: Kane-Chen-AS <[email protected]>
Connect the AST1700 interrupt lines to the GIC in AST27X0, enabling the propagation of AST1700-originated interrupts to the host SoC.
This patch does not implement interrupt sources in AST1700 itself, only the wiring into AST27X0.
Signed-off-by Kane-Chen-AS <[email protected]>--- include/hw/arm/aspeed_soc.h | 2 +- include/hw/intc/aspeed_intc.h | 2 ++ hw/arm/aspeed_ast27x0.c | 36 +++++++++++++++++++++ hw/intc/aspeed_intc.c | 60 +++++++++++++++++++++++++++++++++++ 4 files changed, 99 insertions(+), 1 deletion(-)include/hw/arm/aspeed_soc.h +0
-0
include/hw/arm/aspeed_soc.h struct Aspeed27x0SoCState { · line 146
Quoted 5 lines
include/hw/arm/aspeed_soc.h +1
-1@@ -143,7 +143,7 @@ struct Aspeed27x0SoCState {AspeedSoCState parent;ARMCPU cpu[ASPEED_CPUS_NUM ]; -AspeedINTCState intc[2 ]; +AspeedINTCState intc[4 ];
Please introduce an 'intcioexp1[2]' array instead.
Quoted 32 lines
include/hw/arm/aspeed_soc.h +0
-0GICv3State gic;MemoryRegion dram_empty; };include/hw/intc/aspeed_intc.h +2
-0@@ -15,6 +15,8 @@#define TYPE_ASPEED_INTC "aspeed.intc"#define TYPE_ASPEED_2700_INTC TYPE_ASPEED_INTC "-ast2700"#define TYPE_ASPEED_2700_INTCIO TYPE_ASPEED_INTC "io-ast2700" +#define TYPE_ASPEED_2700_INTCIOEXP1 TYPE_ASPEED_INTC "ast2700-ioexp1" +#define TYPE_ASPEED_2700_INTCIOEXP2 TYPE_ASPEED_INTC "ast2700-ioexp2"#define TYPE_ASPEED_2700SSP_INTC TYPE_ASPEED_INTC "-ast2700ssp"#define TYPE_ASPEED_2700SSP_INTCIO TYPE_ASPEED_INTC "io-ast2700ssp"#define TYPE_ASPEED_2700TSP_INTC TYPE_ASPEED_INTC "-ast2700tsp"hw/arm/aspeed_ast27x0.c +4
-0@@ -505,6 +505,10 @@ static void aspeed_soc_ast2700_init(Object *obj)object_initialize_child (obj,"intc" , &a->intc[0 ],TYPE_ASPEED_2700_INTC );object_initialize_child (obj,"intcio" , &a->intc[1 ],TYPE_ASPEED_2700_INTCIO ); +object_initialize_child (obj,"intcioexp0" , &a->intc[2 ], +TYPE_ASPEED_2700_INTCIOEXP1 ); +object_initialize_child (obj,"intcioexp1" , &a->intc[3 ], +TYPE_ASPEED_2700_INTCIOEXP2 );snprintf (typename,sizeof (typename),"aspeed.adc-%s" , socname);object_initialize_child (obj,"adc" , &s->adc, typename);
hw/arm/aspeed_ast27x0.c static void aspeed_soc_ast2700_realize(DeviceState *dev, Error **errp) · line 708
Quoted 4 lines
hw/arm/aspeed_ast27x0.c +1
-0@@ -701,6 +705,7 @@ static void aspeed_soc_ast2700_realize(DeviceState *dev, Error **errp) g_autofree char *name = NULL;qemu_irq irq;int uart; +int j;
This index variable can be local to the loop.
Quoted 118 lines
hw/arm/aspeed_ast27x0.c +31
-0AspeedLTPIState *ltpi_ctrl;hwaddr ltpi_base;@@ -746,6 +751,22 @@ static void aspeed_soc_ast2700_realize(DeviceState *dev, Error **errp)aspeed_mmio_map (s->memory,SYS_BUS_DEVICE (&a->intc[1 ]),0 , sc->memmap[ASPEED_DEV_INTCIO ]); +/* INTCIOEXP0 */ +if (!sysbus_realize (SYS_BUS_DEVICE (&a->intc[2 ]), errp)) { +return ; + } + +aspeed_mmio_map (s->memory,SYS_BUS_DEVICE (&a->intc[2 ]),0 , + sc->memmap[ASPEED_DEV_IOEXP0_INTCIO ]); + +/* INTCIOEXP */ +if (!sysbus_realize (SYS_BUS_DEVICE (&a->intc[3 ]), errp)) { +return ; + } + +aspeed_mmio_map (s->memory,SYS_BUS_DEVICE (&a->intc[3 ]),0 , + sc->memmap[ASPEED_DEV_IOEXP1_INTCIO ]); +/* irq sources -> orgates -> INTC */ for (i =0 ; i < ic->num_inpins; i++) { qdev_connect_gpio_out(DEVICE(&a->intc[0].orgates[i]), 0,@@ -1054,6 +1075,21 @@ static void aspeed_soc_ast2700_realize(DeviceState *dev, Error **errp) }sysbus_mmio_map (SYS_BUS_DEVICE (&s->ioexp[i]),0 , sc->memmap[ASPEED_DEV_LTPI_IO0 + i]); + + icio =ASPEED_INTC_GET_CLASS (&a->intc[2 + i]); +/* INTC2/3 internal: orgate[i] -> input[i] */ +for (j =0 ; j < icio->num_inpins; j++) { + irq =qdev_get_gpio_in (DEVICE (&a->intc[2 + i]), j); +qdev_connect_gpio_out (DEVICE (&a->intc[2 + i].orgates[j]),0 , + irq); + } + +/* INTC2/3 output[i] -> INTC0.orgate[0].input[i] */ +for (j =0 ; j < icio->num_outpins; j++) { + irq =qdev_get_gpio_in (DEVICE (&a->intc[0 ].orgates[0 ]), j); +sysbus_connect_irq (SYS_BUS_DEVICE (&a->intc[2 + i]), j, + irq); + } } aspeed_mmio_map_unimplemented(s->memory, SYS_BUS_DEVICE(&s->dpmcu),hw/intc/aspeed_intc.c +58
-0@@ -924,6 +924,64 @@ static const TypeInfo aspeed_2700_intc_info = { .class_init = aspeed_2700_intc_class_init, }; +static AspeedINTCIRQ aspeed_2700_intcioexp2_irqs[ASPEED_INTC_MAX_INPINS ] = { + {0 ,8 ,1 ,R_GICINT192_EN ,R_GICINT192_STATUS }, + {1 ,9 ,1 ,R_GICINT193_EN ,R_GICINT193_STATUS }, +}; + +static void aspeed_2700_intcioexp2_class_init (ObjectClass *klass, +const void *data) +{ +DeviceClass *dc =DEVICE_CLASS (klass); +AspeedINTCClass *aic =ASPEED_INTC_CLASS (klass); + + dc->desc ="ASPEED 2700 IOEXP2 INTC Controller" ; + aic->num_lines =32 ; + aic->num_inpins =2 ; + aic->num_outpins =10 ; + aic->mem_size =0x400 ; + aic->nr_regs =0x58 >>2 ; + aic->reg_offset =0x100 ; + aic->reg_ops = &aspeed_intcio_ops; + aic->irq_table = aspeed_2700_intcioexp2_irqs; + aic->irq_table_count =ARRAY_SIZE (aspeed_2700_intcioexp2_irqs); +} + +static const TypeInfo aspeed_2700_intcioexp2_info = { + .name =TYPE_ASPEED_2700_INTCIOEXP2 , + .parent =TYPE_ASPEED_INTC , + .class_init = aspeed_2700_intcioexp2_class_init, +}; + +static AspeedINTCIRQ aspeed_2700_intcioexp1_irqs[ASPEED_INTC_MAX_INPINS ] = { + {0 ,6 ,1 ,R_GICINT192_EN ,R_GICINT192_STATUS }, + {1 ,7 ,1 ,R_GICINT193_EN ,R_GICINT193_STATUS }, +}; + +static void aspeed_2700_intcioexp1_class_init (ObjectClass *klass, +const void *data) +{ +DeviceClass *dc =DEVICE_CLASS (klass); +AspeedINTCClass *aic =ASPEED_INTC_CLASS (klass); + + dc->desc ="ASPEED 2700 IOEXP1 INTC Controller" ; + aic->num_lines =32 ; + aic->num_inpins =2 ; + aic->num_outpins =10 ; + aic->mem_size =0x400 ; + aic->nr_regs =0x58 >>2 ; + aic->reg_offset =0x100 ; + aic->reg_ops = &aspeed_intcio_ops; + aic->irq_table = aspeed_2700_intcioexp1_irqs; + aic->irq_table_count =ARRAY_SIZE (aspeed_2700_intcioexp1_irqs); +} + +static const TypeInfo aspeed_2700_intcioexp1_info = { + .name =TYPE_ASPEED_2700_INTCIOEXP1 , + .parent =TYPE_ASPEED_INTC , + .class_init = aspeed_2700_intcioexp1_class_init, +}; +static AspeedINTCIRQ aspeed_2700_intcio_irqs[ASPEED_INTC_MAX_INPINS ] = { {0 ,0 ,1 ,R_GICINT192_EN ,R_GICINT192_STATUS }, {1 ,1 ,1 ,R_GICINT193_EN ,R_GICINT193_STATUS },
hw/intc/aspeed_intc.c static void aspeed_intc_register_types(void) · line 1164
Quoted 8 lines
hw/intc/aspeed_intc.c +2
-0@@ -1099,6 +1157,8 @@ static void aspeed_intc_register_types(void)type_register_static (&aspeed_intc_info);type_register_static (&aspeed_2700_intc_info);type_register_static (&aspeed_2700_intcio_info); +type_register_static (&aspeed_2700_intcioexp1_info); +type_register_static (&aspeed_2700_intcioexp2_info);type_register_static (&aspeed_2700ssp_intc_info);type_register_static (&aspeed_2700ssp_intcio_info);type_register_static (&aspeed_2700tsp_intc_info);
Thanks,
C.
RE: [PATCH v2 05/17] hw/arm/aspeed: Integrate interrupt controller for AST1700
Hi Cédric,
Thanks for reviewing. I’ll update the code based on your feedback.
Best Regards,
Kane
Quoted 223 lines
-----Original Message-----
From: Cédric Le Goater <[email protected]>
Sent: Friday, November 7, 2025 9:36 PM
To: Kane Chen <[email protected]>; Peter Maydell <[email protected]>; Steven Lee <[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]>
Subject: Re: [PATCH v2 05/17] hw/arm/aspeed: Integrate interrupt controller for AST1700Quoted 8 lines · Kane Chen
From: Kane-Chen-AS <[email protected]>
Connect the AST1700 interrupt lines to the GIC in AST27X0, enabling the propagation of AST1700-originated interrupts to the host SoC.
This patch does not implement interrupt sources in AST1700 itself, only the wiring into AST27X0.
Quoted 6 lines
Signed-off-by Kane-Chen-AS <[email protected]>--- include/hw/arm/aspeed_soc.h | 2 +- include/hw/intc/aspeed_intc.h | 2 ++ hw/arm/aspeed_ast27x0.c | 36 +++++++++++++++++++++ hw/intc/aspeed_intc.c | 60+++++++++++++++++++++++++++++++++++
include/hw/arm/aspeed_soc.h struct Aspeed27x0SoCState { · line 146
Quoted 12 lines
4 files changed, 99 insertions(+), 1 deletion(-)include/hw/arm/aspeed_soc.h +1
-1@@ -143,7 +143,7 @@ struct Aspeed27x0SoCState {AspeedSoCState parent;ARMCPU cpu[ASPEED_CPUS_NUM ]; -AspeedINTCState intc[2 ]; +AspeedINTCState intc[4 ];Please introduce an 'intcioexp1[2]' array instead.
include/hw/intc/aspeed_intc.h line 18
Quoted 12 lines
include/hw/arm/aspeed_soc.h +0
-0GICv3State gic;MemoryRegion dram_empty; };(quoted diff) +0
-0
b/include/hw/intc/aspeed_intc.hindex51288384a5..4565bbab84100644include/hw/intc/aspeed_intc.h +1
-0@@ -15,6 +15,8 @@#define TYPE_ASPEED_INTC "aspeed.intc"#define TYPE_ASPEED_2700_INTC TYPE_ASPEED_INTC "-ast2700"#define TYPE_ASPEED_2700_INTCIO TYPE_ASPEED_INTC "io-ast2700" +#define TYPE_ASPEED_2700_INTCIOEXP1 TYPE_ASPEED_INTC"ast2700-ioexp1"
include/hw/intc/aspeed_intc.h line 19
Quoted 1 line
include/hw/intc/aspeed_intc.h +1
-0+#define TYPE_ASPEED_2700_INTCIOEXP2 TYPE_ASPEED_INTC"ast2700-ioexp2"
include/hw/intc/aspeed_intc.h line 21
Quoted 2 lines
include/hw/intc/aspeed_intc.h +0
-0#define TYPE_ASPEED_2700SSP_INTC TYPE_ASPEED_INTC "-ast2700ssp"#define TYPE_ASPEED_2700SSP_INTCIO TYPE_ASPEED_INTC"io-ast2700ssp"
hw/arm/aspeed_ast27x0.c static void aspeed_soc_ast2700_init(Object *obj) · line 505
Quoted 7 lines
include/hw/intc/aspeed_intc.h +0
-0#define TYPE_ASPEED_2700TSP_INTC TYPE_ASPEED_INTC "-ast2700tsp"hw/arm/aspeed_ast27x0.c index renamed from hw/arm/aspeed_ast27x0.c +0
-0
054864467d..11625e165a100644hw/arm/aspeed_ast27x0.c +0
-0@@ -505,6 +505,10 @@ static void aspeed_soc_ast2700_init(Object *obj) object_initialize_child(obj, "intc", &a->intc[0],
TYPE_ASPEED_2700_INTC);hw/arm/aspeed_ast27x0.c static void aspeed_soc_ast2700_init(Object *obj)
Quoted 10 lines
hw/arm/aspeed_ast27x0.c +4
-1object_initialize_child (obj,"intcio" , &a->intc[1 ],TYPE_ASPEED_2700_INTCIO ); +object_initialize_child (obj,"intcioexp0" , &a->intc[2 ], +TYPE_ASPEED_2700_INTCIOEXP1 ); +object_initialize_child (obj,"intcioexp1" , &a->intc[3 ], +TYPE_ASPEED_2700_INTCIOEXP2 );snprintf (typename,sizeof (typename),"aspeed.adc-%s" , socname); object_initialize_child(obj, "adc", &s->adc, typename); @@ -701,6 +705,7 @@ static void aspeed_soc_ast2700_realize(DeviceState*dev, Error **errp)
Quoted 4 lines
g_autofree char *name = NULL; qemu_irq irq; int uart;+ int j;
This index variable can be local to the loop.
hw/arm/aspeed_ast27x0.c static void
Quoted 4 lines
AspeedLTPIState *ltpi_ctrl; hwaddr ltpi_base;hw/arm/aspeed_ast27x0.c +0
-0@@ -746,6 +751,22 @@ static void
aspeed_soc_ast2700_realize(DeviceState *dev, Error **errp)Quoted 13 lines
hw/arm/aspeed_ast27x0.c +10
-0aspeed_mmio_map (s->memory,SYS_BUS_DEVICE (&a->intc[1 ]),0 , sc->memmap[ASPEED_DEV_INTCIO ]); +/* INTCIOEXP0 */ +if (!sysbus_realize (SYS_BUS_DEVICE (&a->intc[2 ]), errp)) { +return ; + } + +aspeed_mmio_map (s->memory,SYS_BUS_DEVICE (&a->intc[2 ]),0 , + sc->memmap[ASPEED_DEV_IOEXP0_INTCIO ]); + +/* INTCIOEXP */ +if (!sysbus_realize (SYS_BUS_DEVICE (&a->intc[3 ]), errp)) {hw/arm/aspeed_ast27x0.c static void aspeed_soc_ast2700_realize(DeviceState *dev, Error **errp)
Quoted 10 lines
hw/arm/aspeed_ast27x0.c +6
-1+return ; + } + +aspeed_mmio_map (s->memory,SYS_BUS_DEVICE (&a->intc[3 ]),0 , + sc->memmap[ASPEED_DEV_IOEXP1_INTCIO ]); +/* irq sources -> orgates -> INTC */ for (i =0 ; i < ic->num_inpins; i++) { qdev_connect_gpio_out(DEVICE(&a->intc[0].orgates[i]), 0, @@ -1054,6 +1075,21 @@ static void aspeed_soc_ast2700_realize(DeviceState*dev, Error **errp)
hw/arm/aspeed_ast27x0.c static void aspeed_soc_ast2700_realize(DeviceState *dev, Error **errp)
Quoted 9 lines
} sysbus_mmio_map(SYS_BUS_DEVICE(&s->ioexp[i]), 0, sc->memmap[ASPEED_DEV_LTPI_IO0 + i]);hw/arm/aspeed_ast27x0.c +6
-0+ + icio =ASPEED_INTC_GET_CLASS (&a->intc[2 + i]); +/* INTC2/3 internal: orgate[i] -> input[i] */ +for (j =0 ; j < icio->num_inpins; j++) { + irq =qdev_get_gpio_in (DEVICE (&a->intc[2 + i]), j); + qdev_connect_gpio_out(DEVICE(&a->intc[2 + i].orgates[j]),0,
Quoted 17 lines
hw/arm/aspeed_ast27x0.c +9
-0+ irq); + } + +/* INTC2/3 output[i] -> INTC0.orgate[0].input[i] */ +for (j =0 ; j < icio->num_outpins; j++) { + irq =qdev_get_gpio_in (DEVICE (&a->intc[0 ].orgates[0 ]), j); +sysbus_connect_irq (SYS_BUS_DEVICE (&a->intc[2 + i]), j, + irq); + } } aspeed_mmio_map_unimplemented(s->memory,
SYS_BUS_DEVICE(&s->dpmcu), diff --gita/hw/intc/aspeed_intc.cb/hw/intc/aspeed_intc.cindex5cd786dee6..a04005ee7c100644hw/intc/aspeed_intc.c static const TypeInfo aspeed_2700_intc_info = { · line 927
Quoted 4 lines
hw/intc/aspeed_intc.c +1
-0@@ -924,6 +924,64 @@ static const TypeInfo aspeed_2700_intc_info = { .class_init = aspeed_2700_intc_class_init, }; +static AspeedINTCIRQaspeed_2700_intcioexp2_irqs[ASPEED_INTC_MAX_INPINS] = {
hw/intc/aspeed_intc.c static const TypeInfo aspeed_2700_intc_info = { · line 933
Quoted 5 lines
hw/intc/aspeed_intc.c +5
-0+ {0, 8, 1, R_GICINT192_EN, R_GICINT192_STATUS}, + {1, 9, 1, R_GICINT193_EN, R_GICINT193_STATUS}, }; + +static void aspeed_2700_intcioexp2_class_init (ObjectClass *klass, +const void *data){
Quoted 12 lines
hw/intc/aspeed_intc.c +12
-0+DeviceClass *dc =DEVICE_CLASS (klass); +AspeedINTCClass *aic =ASPEED_INTC_CLASS (klass); + + dc->desc ="ASPEED 2700 IOEXP2 INTC Controller" ; + aic->num_lines =32 ; + aic->num_inpins =2 ; + aic->num_outpins =10 ; + aic->mem_size =0x400 ; + aic->nr_regs =0x58 >>2 ; + aic->reg_offset =0x100 ; + aic->reg_ops = &aspeed_intcio_ops; + aic->irq_table = aspeed_2700_intcioexp2_irqs;hw/intc/aspeed_intc.c static const TypeInfo aspeed_2700_intc_info = {
Quoted 10 lines
hw/intc/aspeed_intc.c +10
-0+ aic->irq_table_count =ARRAY_SIZE (aspeed_2700_intcioexp2_irqs); +} + +static const TypeInfo aspeed_2700_intcioexp2_info = { + .name =TYPE_ASPEED_2700_INTCIOEXP2 , + .parent =TYPE_ASPEED_INTC , + .class_init = aspeed_2700_intcioexp2_class_init, +}; + +static AspeedINTCIRQaspeed_2700_intcioexp1_irqs[ASPEED_INTC_MAX_INPINS] = {
hw/intc/aspeed_intc.c static const TypeInfo aspeed_2700_intc_info = { · line 962
Quoted 5 lines
hw/intc/aspeed_intc.c +5
-0+ {0, 6, 1, R_GICINT192_EN, R_GICINT192_STATUS}, + {1, 7, 1, R_GICINT193_EN, R_GICINT193_STATUS}, }; + +static void aspeed_2700_intcioexp1_class_init (ObjectClass *klass, +const void *data){
Quoted 12 lines
hw/intc/aspeed_intc.c +12
-0+DeviceClass *dc =DEVICE_CLASS (klass); +AspeedINTCClass *aic =ASPEED_INTC_CLASS (klass); + + dc->desc ="ASPEED 2700 IOEXP1 INTC Controller" ; + aic->num_lines =32 ; + aic->num_inpins =2 ; + aic->num_outpins =10 ; + aic->mem_size =0x400 ; + aic->nr_regs =0x58 >>2 ; + aic->reg_offset =0x100 ; + aic->reg_ops = &aspeed_intcio_ops; + aic->irq_table = aspeed_2700_intcioexp1_irqs;hw/intc/aspeed_intc.c static const TypeInfo aspeed_2700_intc_info = {
Quoted 10 lines
hw/intc/aspeed_intc.c +9
-0+ aic->irq_table_count =ARRAY_SIZE (aspeed_2700_intcioexp1_irqs); +} + +static const TypeInfo aspeed_2700_intcioexp1_info = { + .name =TYPE_ASPEED_2700_INTCIOEXP1 , + .parent =TYPE_ASPEED_INTC , + .class_init = aspeed_2700_intcioexp1_class_init, +}; + static AspeedINTCIRQaspeed_2700_intcio_irqs[ASPEED_INTC_MAX_INPINS] = {
hw/intc/aspeed_intc.c static void aspeed_intc_register_types(void) · line 1164
Quoted 11 lines
hw/intc/aspeed_intc.c +3
-0{0, 0, 1, R_GICINT192_EN, R_GICINT192_STATUS}, {1, 1, 1, R_GICINT193_EN, R_GICINT193_STATUS}, @@ -1099,6 +1157,8 @@ static void aspeed_intc_register_types(void) type_register_static(&aspeed_intc_info);type_register_static (&aspeed_2700_intc_info);type_register_static (&aspeed_2700_intcio_info); +type_register_static (&aspeed_2700_intcioexp1_info); +type_register_static (&aspeed_2700_intcioexp2_info);type_register_static (&aspeed_2700ssp_intc_info);type_register_static (&aspeed_2700ssp_intcio_info);type_register_static (&aspeed_2700tsp_intc_info);Thanks,
C.
PATCH v2 6/17 hw/arm/aspeed: Attach LTPI controller to AST1700 model
In reply to Kane Chen viaFrom: Kane-Chen-AS <[email protected]>
Connect the LTPI controller to the AST1700 model by mapping its MMIO region and wiring its interrupt line.
--- include/hw/misc/aspeed_ast1700.h | 2 ++ hw/misc/aspeed_ast1700.c | 21 +++++++++++++++++++++ 2 files changed, 23 insertions(+)
include/hw/misc/aspeed_ast1700.h +2 -0
@@ -28,6 +28,8 @@ struct AspeedAST1700SoCState {SysBusDevice parent_obj;MemoryRegion iomem; + + AspeedLTPIState ltpi; };#endif /* ASPEED_AST1700_H */
hw/misc/aspeed_ast1700.c +21 -0
@@ -16,6 +16,14 @@#include "hw/misc/aspeed_ast1700.h" #define AST2700_SOC_LTPI_SIZE 0x01000000 + +enum { +ASPEED_AST1700_DEV_LTPI_CTRL , +}; + +static const hwaddr aspeed_ast1700_io_memmap[] = { + [ASPEED_AST1700_DEV_LTPI_CTRL ] =0x00C34000 , +};static void aspeed_ast1700_realize (DeviceState *dev,Error **errp) {AspeedAST1700SoCState *s =ASPEED_AST1700 (dev);
@@ -26,10 +34,23 @@ static void aspeed_ast1700_realize(DeviceState *dev, Error **errp) AST2700_SOC_LTPI_SIZE);sysbus_init_mmio (sbd, &s->iomem); +/* LTPI controller */ +if (!sysbus_realize (SYS_BUS_DEVICE (&s->ltpi), errp)) { +return ; + } +memory_region_add_subregion (&s->iomem, + aspeed_ast1700_io_memmap[ASPEED_AST1700_DEV_LTPI_CTRL ], +sysbus_mmio_get_region (SYS_BUS_DEVICE (&s->ltpi),0 )); }static void aspeed_ast1700_instance_init (Object *obj) { +AspeedAST1700SoCState *s =ASPEED_AST1700 (obj); + +/* LTPI controller */ +object_initialize_child (obj,"ltpi-ctrl" , + &s->ltpi,TYPE_ASPEED_LTPI ); +return ; }
Signature · 1 line
2.43.0
Re: [PATCH v2 06/17] hw/arm/aspeed: Attach LTPI controller to AST1700 model
Quoted 57 lines · Kane Chen
From: Kane-Chen-AS <[email protected]>
Connect the LTPI controller to the AST1700 model by mapping its MMIO region and wiring its interrupt line.
Signed-off-by Kane-Chen-AS <[email protected]>--- include/hw/misc/aspeed_ast1700.h | 2 ++ hw/misc/aspeed_ast1700.c | 21 +++++++++++++++++++++ 2 files changed, 23 insertions(+)include/hw/misc/aspeed_ast1700.h +2
-0@@ -28,6 +28,8 @@ struct AspeedAST1700SoCState {SysBusDevice parent_obj;MemoryRegion iomem; + + AspeedLTPIState ltpi; };#endif /* ASPEED_AST1700_H */ hw/misc/aspeed_ast1700.c +15
-0@@ -16,6 +16,14 @@#include "hw/misc/aspeed_ast1700.h" #define AST2700_SOC_LTPI_SIZE 0x01000000 + +enum { +ASPEED_AST1700_DEV_LTPI_CTRL , +}; + +static const hwaddr aspeed_ast1700_io_memmap[] = { + [ASPEED_AST1700_DEV_LTPI_CTRL ] =0x00C34000 , +};static void aspeed_ast1700_realize (DeviceState *dev,Error **errp) {AspeedAST1700SoCState *s =ASPEED_AST1700 (dev);@@ -26,10 +34,23 @@ static void aspeed_ast1700_realize(DeviceState *dev, Error **errp) AST2700_SOC_LTPI_SIZE);sysbus_init_mmio (sbd, &s->iomem); +/* LTPI controller */ +if (!sysbus_realize (SYS_BUS_DEVICE (&s->ltpi), errp)) { +return ; + } +memory_region_add_subregion (&s->iomem, + aspeed_ast1700_io_memmap[ASPEED_AST1700_DEV_LTPI_CTRL ], +sysbus_mmio_get_region (SYS_BUS_DEVICE (&s->ltpi),0 )); }static void aspeed_ast1700_instance_init (Object *obj)
hw/misc/aspeed_ast1700.c static void aspeed_ast1700_realize(DeviceState *dev, Error **errp) · line 56
Quoted 10 lines
hw/misc/aspeed_ast1700.c +6
-0{ +AspeedAST1700SoCState *s =ASPEED_AST1700 (obj); + +/* LTPI controller */ +object_initialize_child (obj,"ltpi-ctrl" , + &s->ltpi,TYPE_ASPEED_LTPI ); +return ; }
Thanks,
C.
RE: [PATCH v2 06/17] hw/arm/aspeed: Attach LTPI controller to AST1700 model
Hi Cédric,
Thanks for reviewing.
Best Regards,
Kane
Quoted 92 lines
-----Original Message-----
From: Cédric Le Goater <[email protected]>
Sent: Friday, November 7, 2025 9:37 PM
To: Kane Chen <[email protected]>; Peter Maydell <[email protected]>; Steven Lee <[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]>
Subject: Re: [PATCH v2 06/17] hw/arm/aspeed: Attach LTPI controller to AST1700 modelQuoted 33 lines · Kane Chen
From: Kane-Chen-AS <[email protected]>
Connect the LTPI controller to the AST1700 model by mapping its MMIO region and wiring its interrupt line.
Signed-off-by Kane-Chen-AS <[email protected]>--- include/hw/misc/aspeed_ast1700.h | 2 ++ hw/misc/aspeed_ast1700.c | 21 +++++++++++++++++++++ 2 files changed, 23 insertions(+)include/hw/misc/aspeed_ast1700.h +2
-0@@ -28,6 +28,8 @@ struct AspeedAST1700SoCState {SysBusDevice parent_obj;MemoryRegion iomem; + + AspeedLTPIState ltpi; };#endif /* ASPEED_AST1700_H */ hw/misc/aspeed_ast1700.c index renamed from hw/misc/aspeed_ast1700.c +0
-0
3125bec795..0ca2b90ff0100644hw/misc/aspeed_ast1700.c +0
-0@@ -16,6 +16,14 @@#include "hw/misc/aspeed_ast1700.h" #define AST2700_SOC_LTPI_SIZE 0x01000000hw/misc/aspeed_ast1700.c line 28
Quoted 10 lines
hw/misc/aspeed_ast1700.c +7
-0+ +enum { +ASPEED_AST1700_DEV_LTPI_CTRL , +}; + +static const hwaddr aspeed_ast1700_io_memmap[] = { + [ASPEED_AST1700_DEV_LTPI_CTRL ] =0x00C34000 , };static void aspeed_ast1700_realize (DeviceState *dev,Error **errp) { AspeedAST1700SoCState *s = ASPEED_AST1700(dev); @@ -26,10+34,23
hw/misc/aspeed_ast1700.c static void aspeed_ast1700_realize(DeviceState *dev, Error **errp) · line 49
Quoted 10 lines
@@ static void
aspeed_ast1700_realize(DeviceState *dev, Error **errp)AST2700_SOC_LTPI_SIZE); sysbus_init_mmio(sbd, &s->iomem);hw/misc/aspeed_ast1700.c +6
-0+/* LTPI controller */ +if (!sysbus_realize (SYS_BUS_DEVICE (&s->ltpi), errp)) { +return ; + } + memory_region_add_subregion(&s->iomem, +aspeed_ast1700_io_memmap[ASPEED_AST1700_DEV_LTPI_CTRL],
Quoted 5 lines
hw/misc/aspeed_ast1700.c +2
-0+ + sysbus_mmio_get_region(SYS_BUS_DEVICE(&s->ltpi), 0)); }hw/misc/aspeed_ast1700.c static void aspeed_ast1700_realize(DeviceState *dev, Error **errp) · line 55
Quoted 10 lines
hw/misc/aspeed_ast1700.c +6
-0static void aspeed_ast1700_instance_init (Object *obj) { +AspeedAST1700SoCState *s =ASPEED_AST1700 (obj); + +/* LTPI controller */ +object_initialize_child (obj,"ltpi-ctrl" , + &s->ltpi,TYPE_ASPEED_LTPI ); +return ; }Reviewed-by Cédric Le Goater <[email protected]>Thanks,
C.
PATCH v2 7/17 hw/arm/aspeed: Attach UART device to AST1700 model
In reply to Kane Chen viaFrom: Kane-Chen-AS <[email protected]>
Connect the UART controller to the AST1700 model by mapping its MMIO region.
--- include/hw/misc/aspeed_ast1700.h | 2 ++ hw/arm/aspeed_ast27x0.c | 2 ++ hw/misc/aspeed_ast1700.c | 26 ++++++++++++++++++++++++++ 3 files changed, 30 insertions(+)
include/hw/misc/aspeed_ast1700.h +2 -0
@@ -28,8 +28,10 @@ struct AspeedAST1700SoCState {SysBusDevice parent_obj;MemoryRegion iomem; +hwaddr mapped_base;AspeedLTPIState ltpi; + SerialMM uart; };#endif /* ASPEED_AST1700_H */
hw/arm/aspeed_ast27x0.c +2 -0
@@ -1070,6 +1070,8 @@ static void aspeed_soc_ast2700_realize(DeviceState *dev, Error **errp)/* IO Expander */ for (i =0 ; i < sc->ioexp_num; i++) { +qdev_prop_set_uint64 (DEVICE (&s->ioexp[i]),"mapped-base" , + sc->memmap[ASPEED_DEV_LTPI_IO0 + i]);if (!sysbus_realize (SYS_BUS_DEVICE (&s->ioexp[i]), errp)) {return ; }
hw/misc/aspeed_ast1700.c +26 -0
@@ -18,22 +18,39 @@#define AST2700_SOC_LTPI_SIZE 0x01000000enum { +ASPEED_AST1700_DEV_UART12 ,ASPEED_AST1700_DEV_LTPI_CTRL , };static const hwaddr aspeed_ast1700_io_memmap[] = { + [ASPEED_AST1700_DEV_UART12 ] =0x00C33B00 , [ASPEED_AST1700_DEV_LTPI_CTRL ] =0x00C34000 , };static void aspeed_ast1700_realize (DeviceState *dev,Error **errp) {AspeedAST1700SoCState *s =ASPEED_AST1700 (dev);SysBusDevice *sbd =SYS_BUS_DEVICE (dev); +hwaddr uart_base;/* Occupy memory space for all controllers in AST1700 */ memory_region_init (&s->iomem,OBJECT (s),TYPE_ASPEED_AST1700 ,AST2700_SOC_LTPI_SIZE );sysbus_init_mmio (sbd, &s->iomem); +/* UART */ + uart_base = s->mapped_base + + aspeed_ast1700_io_memmap[ASPEED_AST1700_DEV_UART12 ]; +qdev_prop_set_uint8 (DEVICE (&s->uart),"regshift" ,2 ); +qdev_prop_set_uint32 (DEVICE (&s->uart),"baudbase" ,38400 ); +qdev_set_legacy_instance_id (DEVICE (&s->uart), uart_base,2 ); +qdev_prop_set_uint8 (DEVICE (&s->uart),"endianness" ,DEVICE_LITTLE_ENDIAN ); +if (!sysbus_realize (SYS_BUS_DEVICE (&s->uart), errp)) { +return ; + } +memory_region_add_subregion (&s->iomem, + aspeed_ast1700_io_memmap[ASPEED_AST1700_DEV_UART12 ], +sysbus_mmio_get_region (SYS_BUS_DEVICE (&s->uart),0 )); +/* LTPI controller */ if (!sysbus_realize (SYS_BUS_DEVICE (&s->ltpi), errp)) {return ;
@@ -47,6 +64,10 @@ static void aspeed_ast1700_instance_init(Object *obj) {AspeedAST1700SoCState *s =ASPEED_AST1700 (obj); +/* UART */ +object_initialize_child (obj,"uart[*]" , &s->uart, +TYPE_SERIAL_MM ); +/* LTPI controller */ object_initialize_child (obj,"ltpi-ctrl" , &s->ltpi,TYPE_ASPEED_LTPI );
@@ -54,11 +75,16 @@ static void aspeed_ast1700_instance_init(Object *obj)return ; } +static const Property aspeed_ast1700_props[] = { +DEFINE_PROP_UINT64 ("mapped-base" , AspeedAST1700SoCState, mapped_base,0 ), +}; +static void aspeed_ast1700_class_init (ObjectClass *klass,const void *data) {DeviceClass *dc =DEVICE_CLASS (klass); dc->realize = aspeed_ast1700_realize; +device_class_set_props (dc, aspeed_ast1700_props); }static const TypeInfo aspeed_ast1700_info = {
Signature · 1 line
2.43.0
Re: [PATCH v2 07/17] hw/arm/aspeed: Attach UART device to AST1700 model
Hi,
This change appears complex due to the use of routine qdev_set_legacy_instance_id(). It was introduced 15 years ago by commit 4d2ffa08b601 ("vmstate: Add support for alias ID"), for the PC world AIUI.
Adding Jan, Peter, Fabiano for feedback on the current relevance of qdev_set_legacy_instance_id(), particularly in the ARM/BMC world. I feel we could get rid of it and simplify this patch.
Thanks,
C.
Quoted 112 lines · Kane Chen
From: Kane-Chen-AS <[email protected]>
Connect the UART controller to the AST1700 model by mapping its MMIO region.
Signed-off-by Kane-Chen-AS <[email protected]>--- include/hw/misc/aspeed_ast1700.h | 2 ++ hw/arm/aspeed_ast27x0.c | 2 ++ hw/misc/aspeed_ast1700.c | 26 ++++++++++++++++++++++++++ 3 files changed, 30 insertions(+)include/hw/misc/aspeed_ast1700.h +2
-0@@ -28,8 +28,10 @@ struct AspeedAST1700SoCState {SysBusDevice parent_obj;MemoryRegion iomem; +hwaddr mapped_base;AspeedLTPIState ltpi; + SerialMM uart; };#endif /* ASPEED_AST1700_H */ hw/arm/aspeed_ast27x0.c +2
-0@@ -1070,6 +1070,8 @@ static void aspeed_soc_ast2700_realize(DeviceState *dev, Error **errp)/* IO Expander */ for (i =0 ; i < sc->ioexp_num; i++) { +qdev_prop_set_uint64 (DEVICE (&s->ioexp[i]),"mapped-base" , + sc->memmap[ASPEED_DEV_LTPI_IO0 + i]);if (!sysbus_realize (SYS_BUS_DEVICE (&s->ioexp[i]), errp)) {return ; }hw/misc/aspeed_ast1700.c +26
-0@@ -18,22 +18,39 @@#define AST2700_SOC_LTPI_SIZE 0x01000000enum { +ASPEED_AST1700_DEV_UART12 ,ASPEED_AST1700_DEV_LTPI_CTRL , };static const hwaddr aspeed_ast1700_io_memmap[] = { + [ASPEED_AST1700_DEV_UART12 ] =0x00C33B00 , [ASPEED_AST1700_DEV_LTPI_CTRL ] =0x00C34000 , };static void aspeed_ast1700_realize (DeviceState *dev,Error **errp) {AspeedAST1700SoCState *s =ASPEED_AST1700 (dev);SysBusDevice *sbd =SYS_BUS_DEVICE (dev); +hwaddr uart_base;/* Occupy memory space for all controllers in AST1700 */ memory_region_init (&s->iomem,OBJECT (s),TYPE_ASPEED_AST1700 ,AST2700_SOC_LTPI_SIZE );sysbus_init_mmio (sbd, &s->iomem); +/* UART */ + uart_base = s->mapped_base + + aspeed_ast1700_io_memmap[ASPEED_AST1700_DEV_UART12 ]; +qdev_prop_set_uint8 (DEVICE (&s->uart),"regshift" ,2 ); +qdev_prop_set_uint32 (DEVICE (&s->uart),"baudbase" ,38400 ); +qdev_set_legacy_instance_id (DEVICE (&s->uart), uart_base,2 ); +qdev_prop_set_uint8 (DEVICE (&s->uart),"endianness" ,DEVICE_LITTLE_ENDIAN ); +if (!sysbus_realize (SYS_BUS_DEVICE (&s->uart), errp)) { +return ; + } +memory_region_add_subregion (&s->iomem, + aspeed_ast1700_io_memmap[ASPEED_AST1700_DEV_UART12 ], +sysbus_mmio_get_region (SYS_BUS_DEVICE (&s->uart),0 )); +/* LTPI controller */ if (!sysbus_realize (SYS_BUS_DEVICE (&s->ltpi), errp)) {return ;@@ -47,6 +64,10 @@ static void aspeed_ast1700_instance_init(Object *obj) {AspeedAST1700SoCState *s =ASPEED_AST1700 (obj); +/* UART */ +object_initialize_child (obj,"uart[*]" , &s->uart, +TYPE_SERIAL_MM ); +/* LTPI controller */ object_initialize_child (obj,"ltpi-ctrl" , &s->ltpi,TYPE_ASPEED_LTPI );@@ -54,11 +75,16 @@ static void aspeed_ast1700_instance_init(Object *obj)return ; } +static const Property aspeed_ast1700_props[] = { +DEFINE_PROP_UINT64 ("mapped-base" , AspeedAST1700SoCState, mapped_base,0 ), +}; +static void aspeed_ast1700_class_init (ObjectClass *klass,const void *data) {DeviceClass *dc =DEVICE_CLASS (klass); dc->realize = aspeed_ast1700_realize; +device_class_set_props (dc, aspeed_ast1700_props); }static const TypeInfo aspeed_ast1700_info = {
Re: [PATCH v2 07/17] hw/arm/aspeed: Attach UART device to AST1700 model
Quoted 11 lines · Cédric Le Goater
Hi,
This change appears complex due to the use of routine
qdev_set_legacy_instance_id(). It was introduced 15 years ago by commit4d2ffa08b601("vmstate: Add support for alias ID"), for the PC world AIUI.Adding Jan, Peter, Fabiano for feedback on the current relevance of
qdev_set_legacy_instance_id(), particularly in the ARM/BMC world. I feel we could get rid of it and simplify this patch.
I have to dig deep in my memories but if I got it correctly again, qdev_set_legacy_instance_id is (was) only there to transition an existing but self-registered vmstate for an existing device model to qdev-registered vmstate. We neither have a pre-existing device here, nor do the aspeed machines or devices open-code their vmstate registrations.
Jan
Quoted 117 lines
Thanks,
C.
Quoted 107 lines · Kane Chen
From: Kane-Chen-AS <[email protected]>
Connect the UART controller to the AST1700 model by mapping its MMIO region.
Signed-off-by Kane-Chen-AS <[email protected]>---
include/hw/misc/aspeed_ast1700.h| 2 ++ hw/arm/aspeed_ast27x0.c | 2 ++ hw/misc/aspeed_ast1700.c | 26 ++++++++++++++++++++++++++3 files changed, 30 insertions(+)include/hw/misc/ renamed from include/hw/misc/aspeed_ast1700.h +0
-0
aspeed_ast1700.h
indexc2bea11346..e105ceb027100644include/hw/misc/aspeed_ast1700.h +2
-0@@ -28,8 +28,10 @@ struct AspeedAST1700SoCState { SysBusDevice parent_obj; MemoryRegion iomem; + hwaddr mapped_base; AspeedLTPIState ltpi; + SerialMM uart; }; #endif /* ASPEED_AST1700_H */hw/arm/aspeed_ast27x0.c +2
-0@@ -1070,6 +1070,8 @@ static void aspeed_soc_ast2700_realize(DeviceState *dev, Error **errp) /* IO Expander */ for (i = 0; i < sc->ioexp_num; i++) { + qdev_prop_set_uint64(DEVICE(&s->ioexp[i]), "mapped-base", + sc->memmap[ASPEED_DEV_LTPI_IO0 + i]); if (!sysbus_realize(SYS_BUS_DEVICE(&s->ioexp[i]), errp)) { return; }hw/misc/aspeed_ast1700.c +3
-0@@ -18,22 +18,39 @@ #define AST2700_SOC_LTPI_SIZE 0x01000000 enum { + ASPEED_AST1700_DEV_UART12, ASPEED_AST1700_DEV_LTPI_CTRL, }; static const hwaddr aspeed_ast1700_io_memmap[] = { + [ASPEED_AST1700_DEV_UART12] = 0x00C33B00, [ASPEED_AST1700_DEV_LTPI_CTRL] = 0x00C34000, }; static void aspeed_ast1700_realize(DeviceState *dev, Error **errp) { AspeedAST1700SoCState *s = ASPEED_AST1700(dev); SysBusDevice *sbd = SYS_BUS_DEVICE(dev); + hwaddr uart_base; /* Occupy memory space for all controllers in AST1700 */ memory_region_init(&s->iomem, OBJECT(s), TYPE_ASPEED_AST1700, AST2700_SOC_LTPI_SIZE); sysbus_init_mmio(sbd, &s->iomem);+ /* UART */
+uart_base=s->mapped_base+
+ aspeed_ast1700_io_memmap[ASPEED_AST1700_DEV_UART12]; +qdev_prop_set_uint8(DEVICE(&s->uart), "regshift", 2); +qdev_prop_set_uint32(DEVICE(&s->uart), "baudbase", 38400); +qdev_set_legacy_instance_id(DEVICE(&s->uart), uart_base, 2); +qdev_prop_set_uint8(DEVICE(&s->uart), "endianness", DEVICE_LITTLE_ENDIAN);
+ if (!sysbus_realize(SYS_BUS_DEVICE(&s->uart), errp)) { + return;
+ }
+ memory_region_add_subregion(&s->iomem,
+
aspeed_ast1700_io_memmap[ASPEED_AST1700_DEV_UART12],
+ sysbus_mmio_get_region(SYS_BUS_DEVICE(&s-Quoted 1 line
uart), 0));
+
/* LTPI controller */
if (!sysbus_realize(SYS_BUS_DEVICE(&s->ltpi), errp)) { return;hw/misc/aspeed_ast1700.c +0
-0@@ -47,6 +64,10 @@ static void aspeed_ast1700_instance_init(Object *obj) { AspeedAST1700SoCState *s = ASPEED_AST1700(obj);+ /* UART */
+object_initialize_child(obj, "uart[*]", &s->uart, + TYPE_SERIAL_MM);
+
/* LTPI controller */object_initialize_child(obj, "ltpi-ctrl", &s->ltpi, TYPE_ASPEED_LTPI);hw/misc/aspeed_ast1700.c +3
-0@@ -54,11 +75,16 @@ static void aspeed_ast1700_instance_init(Object *obj) return; } +static const Property aspeed_ast1700_props[] = { + DEFINE_PROP_UINT64("mapped-base", AspeedAST1700SoCState, mapped_base,0 ), +}; +static void
aspeed_ast1700_class_init(ObjectClass *klass, const void *data)
{
DeviceClass *dc =DEVICE_CLASS(klass);
dc->realize=aspeed_ast1700_realize;
+device_class_set_props(dc, aspeed_ast1700_props);
}
static const TypeInfoaspeed_ast1700_info= {
Signature · 2 lines
Siemens AG, Foundational Technologies Linux Expert Center
PATCH v2 8/17 hw/arm/aspeed: Attach SRAM device to AST1700 model
In reply to Kane Chen viaFrom: Kane-Chen-AS <[email protected]>
Map the SRAM device to AST1700 model
--- include/hw/misc/aspeed_ast1700.h | 1 + hw/misc/aspeed_ast1700.c | 25 +++++++++++++++++++++++++ 2 files changed, 26 insertions(+)
include/hw/misc/aspeed_ast1700.h +1 -0
@@ -32,6 +32,7 @@ struct AspeedAST1700SoCState {AspeedLTPIState ltpi;SerialMM uart; + MemoryRegion sram; };#endif /* ASPEED_AST1700_H */
hw/misc/aspeed_ast1700.c +25 -0
@@ -15,14 +15,18 @@#include "migration/vmstate.h" #include "hw/misc/aspeed_ast1700.h" +#define AST1700_BOARD1_MEM_ADDR 0x30000000#define AST2700_SOC_LTPI_SIZE 0x01000000 +#define AST1700_SOC_SRAM_SIZE 0x00040000enum { +ASPEED_AST1700_DEV_SRAM ,ASPEED_AST1700_DEV_UART12 ,ASPEED_AST1700_DEV_LTPI_CTRL , };static const hwaddr aspeed_ast1700_io_memmap[] = { + [ASPEED_AST1700_DEV_SRAM ] =0x00BC0000 , [ASPEED_AST1700_DEV_UART12 ] =0x00C33B00 , [ASPEED_AST1700_DEV_LTPI_CTRL ] =0x00C34000 , };
@@ -31,12 +35,33 @@ static void aspeed_ast1700_realize(DeviceState *dev, Error **errp)AspeedAST1700SoCState *s =ASPEED_AST1700 (dev);SysBusDevice *sbd =SYS_BUS_DEVICE (dev);hwaddr uart_base; +Error *err =NULL ; +int board_idx; +char sram_name[32 ]; + +if (s->mapped_base ==AST1700_BOARD1_MEM_ADDR ) { + board_idx =0 ; + }else { + board_idx =1 ; + }/* Occupy memory space for all controllers in AST1700 */ memory_region_init (&s->iomem,OBJECT (s),TYPE_ASPEED_AST1700 ,AST2700_SOC_LTPI_SIZE );sysbus_init_mmio (sbd, &s->iomem); +/* SRAM */ +snprintf (sram_name,sizeof (sram_name),"aspeed.ioexp-sram.%d" , board_idx); +memory_region_init_ram (&s->sram,OBJECT (s), sram_name, +AST1700_SOC_SRAM_SIZE , &err); +if (err !=NULL ) { +error_propagate (errp, err); +return ; + } +memory_region_add_subregion (&s->iomem, + aspeed_ast1700_io_memmap[ASPEED_AST1700_DEV_SRAM ], + &s->sram); +/* UART */ uart_base = s->mapped_base + aspeed_ast1700_io_memmap[ASPEED_AST1700_DEV_UART12 ];
Signature · 1 line
2.43.0
Re: [PATCH v2 08/17] hw/arm/aspeed: Attach SRAM device to AST1700 model
Quoted 46 lines · Kane Chen
From: Kane-Chen-AS <[email protected]>
Map the SRAM device to AST1700 model
Signed-off-by Kane-Chen-AS <[email protected]>--- include/hw/misc/aspeed_ast1700.h | 1 + hw/misc/aspeed_ast1700.c | 25 +++++++++++++++++++++++++ 2 files changed, 26 insertions(+)include/hw/misc/aspeed_ast1700.h +1
-0@@ -32,6 +32,7 @@ struct AspeedAST1700SoCState {AspeedLTPIState ltpi;SerialMM uart; + MemoryRegion sram; };#endif /* ASPEED_AST1700_H */ hw/misc/aspeed_ast1700.c +4
-0@@ -15,14 +15,18 @@#include "migration/vmstate.h" #include "hw/misc/aspeed_ast1700.h" +#define AST1700_BOARD1_MEM_ADDR 0x30000000#define AST2700_SOC_LTPI_SIZE 0x01000000 +#define AST1700_SOC_SRAM_SIZE 0x00040000enum { +ASPEED_AST1700_DEV_SRAM ,ASPEED_AST1700_DEV_UART12 ,ASPEED_AST1700_DEV_LTPI_CTRL , };static const hwaddr aspeed_ast1700_io_memmap[] = { + [ASPEED_AST1700_DEV_SRAM ] =0x00BC0000 , [ASPEED_AST1700_DEV_UART12 ] =0x00C33B00 , [ASPEED_AST1700_DEV_LTPI_CTRL ] =0x00C34000 , };
hw/misc/aspeed_ast1700.c static void aspeed_ast1700_realize(DeviceState *dev, Error **errp) · line 38
Quoted 4 lines
hw/misc/aspeed_ast1700.c +1
-0@@ -31,12 +35,33 @@ static void aspeed_ast1700_realize(DeviceState *dev, Error **errp)AspeedAST1700SoCState *s =ASPEED_AST1700 (dev);SysBusDevice *sbd =SYS_BUS_DEVICE (dev);hwaddr uart_base; +Error *err =NULL ;
This variable could be avoided.
hw/misc/aspeed_ast1700.c static void aspeed_ast1700_realize(DeviceState *dev, Error **errp) · line 46
Quoted 8 lines
hw/misc/aspeed_ast1700.c +8
-0+int board_idx; +char sram_name[32 ]; + +if (s->mapped_base ==AST1700_BOARD1_MEM_ADDR ) { + board_idx =0 ; + }else { + board_idx =1 ; + }
That's a bit hacky.
An "index" property set at the SoC level would avoid this weak heuristic.
hw/misc/aspeed_ast1700.c static void aspeed_ast1700_realize(DeviceState *dev, Error **errp) · line 56
Quoted 10 lines
hw/misc/aspeed_ast1700.c +4
-0/* Occupy memory space for all controllers in AST1700 */ memory_region_init (&s->iomem,OBJECT (s),TYPE_ASPEED_AST1700 ,AST2700_SOC_LTPI_SIZE );sysbus_init_mmio (sbd, &s->iomem); +/* SRAM */ +snprintf (sram_name,sizeof (sram_name),"aspeed.ioexp-sram.%d" , board_idx); +memory_region_init_ram (&s->sram,OBJECT (s), sram_name, +AST1700_SOC_SRAM_SIZE , &err);
Just pass 'errp' and test the return value of memory_region_init_ram()
Thanks,
C.
Quoted 11 lines
hw/misc/aspeed_ast1700.c +8
-0+if (err !=NULL ) { +error_propagate (errp, err); +return ; + } +memory_region_add_subregion (&s->iomem, + aspeed_ast1700_io_memmap[ASPEED_AST1700_DEV_SRAM ], + &s->sram); +/* UART */ uart_base = s->mapped_base + aspeed_ast1700_io_memmap[ASPEED_AST1700_DEV_UART12 ];
RE: [PATCH v2 08/17] hw/arm/aspeed: Attach SRAM device to AST1700 model
Hi Cédric,
Thanks for reviewing. I will adjust the code based the feedback.
Best Regards,
Kane
Quoted 119 lines
-----Original Message-----
From: Cédric Le Goater <[email protected]>
Sent: Tuesday, November 11, 2025 12:08 AM
To: Kane Chen <[email protected]>; Peter Maydell <[email protected]>; Steven Lee <[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]>
Subject: Re: [PATCH v2 08/17] hw/arm/aspeed: Attach SRAM device to AST1700 modelQuoted 8 lines · Kane Chen
From: Kane-Chen-AS <[email protected]>
Map the SRAM device to AST1700 model
Signed-off-by Kane-Chen-AS <[email protected]>--- include/hw/misc/aspeed_ast1700.h | 1 + hw/misc/aspeed_ast1700.c | 25+++++++++++++++++++++++++
hw/misc/aspeed_ast1700.c static void aspeed_ast1700_realize(DeviceState
Quoted 39 lines
2 files changed, 26 insertions(+)include/hw/misc/aspeed_ast1700.h +1
-0@@ -32,6 +32,7 @@ struct AspeedAST1700SoCState {AspeedLTPIState ltpi;SerialMM uart; + MemoryRegion sram; };#endif /* ASPEED_AST1700_H */ hw/misc/aspeed_ast1700.c index renamed from hw/misc/aspeed_ast1700.c +0
-0
1c2d367cdb..6f7ff625b5100644hw/misc/aspeed_ast1700.c +4
-0@@ -15,14 +15,18 @@#include "migration/vmstate.h" #include "hw/misc/aspeed_ast1700.h" +#define AST1700_BOARD1_MEM_ADDR 0x30000000#define AST2700_SOC_LTPI_SIZE 0x01000000 +#define AST1700_SOC_SRAM_SIZE 0x00040000enum { +ASPEED_AST1700_DEV_SRAM ,ASPEED_AST1700_DEV_UART12 ,ASPEED_AST1700_DEV_LTPI_CTRL , };static const hwaddr aspeed_ast1700_io_memmap[] = { + [ASPEED_AST1700_DEV_SRAM ] =0x00BC0000 , [ASPEED_AST1700_DEV_UART12 ] =0x00C33B00 , [ASPEED_AST1700_DEV_LTPI_CTRL ] =0x00C34000 , };@@ -31,12 +35,33 @@ static void aspeed_ast1700_realize(DeviceState*dev, Error **errp)
hw/misc/aspeed_ast1700.c static void aspeed_ast1700_realize(DeviceState *dev, Error **errp) · line 38
Quoted 4 lines
hw/misc/aspeed_ast1700.c +1
-0AspeedAST1700SoCState *s =ASPEED_AST1700 (dev);SysBusDevice *sbd =SYS_BUS_DEVICE (dev);hwaddr uart_base; +Error *err =NULL ;This variable could be avoided.
hw/misc/aspeed_ast1700.c static void aspeed_ast1700_realize(DeviceState *dev, Error **errp) · line 46
Quoted 8 lines
hw/misc/aspeed_ast1700.c +8
-0+int board_idx; +char sram_name[32 ]; + +if (s->mapped_base ==AST1700_BOARD1_MEM_ADDR ) { + board_idx =0 ; + }else { + board_idx =1 ; + }That's a bit hacky.
An "index" property set at the SoC level would avoid this weak heuristic.
hw/misc/aspeed_ast1700.c static void aspeed_ast1700_realize(DeviceState · line 48
Quoted 3 lines
hw/misc/aspeed_ast1700.c +0
-0/* Occupy memory space for all controllers in AST1700 */ memory_region_init(&s->iomem, OBJECT(s),
TYPE_ASPEED_AST1700,hw/misc/aspeed_ast1700.c static void aspeed_ast1700_realize(DeviceState *dev, Error **errp)
Quoted 5 lines
hw/misc/aspeed_ast1700.c +2
-0AST2700_SOC_LTPI_SIZE);sysbus_init_mmio (sbd, &s->iomem); +/* SRAM */ + snprintf(sram_name, sizeof(sram_name), "aspeed.ioexp-sram.%d",
board_idx);hw/misc/aspeed_ast1700.c static void aspeed_ast1700_realize(DeviceState *dev, Error **errp) · line 56
Quoted 2 lines
hw/misc/aspeed_ast1700.c +2
-0+memory_region_init_ram (&s->sram,OBJECT (s), sram_name, +AST1700_SOC_SRAM_SIZE , &err);Just pass 'errp' and test the return value of
memory_region_init_ram()Thanks,
C.
hw/misc/aspeed_ast1700.c static void aspeed_ast1700_realize(DeviceState *dev, Error **errp) · line 64
Quoted 6 lines
hw/misc/aspeed_ast1700.c +6
-0+if (err !=NULL ) { +error_propagate (errp, err); +return ; + } + memory_region_add_subregion(&s->iomem, +aspeed_ast1700_io_memmap[ASPEED_AST1700_DEV_SRAM],
hw/misc/aspeed_ast1700.c static void aspeed_ast1700_realize(DeviceState *dev, Error **errp)
Quoted 5 lines
hw/misc/aspeed_ast1700.c +2
-0+ &s->sram); +/* UART */ uart_base = s->mapped_base +aspeed_ast1700_io_memmap[ASPEED_AST1700_DEV_UART12];
PATCH v2 9/17 hw/arm/aspeed: Attach SPI device to AST1700 model
In reply to Kane Chen viaFrom: Kane-Chen-AS <[email protected]>
Connect the SPI device to AST1700 model.
--- include/hw/misc/aspeed_ast1700.h | 1 + hw/misc/aspeed_ast1700.c | 28 ++++++++++++++++++++++++++++ 2 files changed, 29 insertions(+)
include/hw/misc/aspeed_ast1700.h +1 -0
@@ -33,6 +33,7 @@ struct AspeedAST1700SoCState {AspeedLTPIState ltpi;SerialMM uart;MemoryRegion sram; + AspeedSMCState spi; };#endif /* ASPEED_AST1700_H */
hw/misc/aspeed_ast1700.c +28 -0
@@ -20,15 +20,19 @@#define AST1700_SOC_SRAM_SIZE 0x00040000enum { +ASPEED_AST1700_DEV_SPI0 ,ASPEED_AST1700_DEV_SRAM ,ASPEED_AST1700_DEV_UART12 ,ASPEED_AST1700_DEV_LTPI_CTRL , +ASPEED_AST1700_DEV_SPI0_MEM , };static const hwaddr aspeed_ast1700_io_memmap[] = { + [ASPEED_AST1700_DEV_SPI0 ] =0x00030000 , [ASPEED_AST1700_DEV_SRAM ] =0x00BC0000 , [ASPEED_AST1700_DEV_UART12 ] =0x00C33B00 , [ASPEED_AST1700_DEV_LTPI_CTRL ] =0x00C34000 , + [ASPEED_AST1700_DEV_SPI0_MEM ] =0x04000000 , };static void aspeed_ast1700_realize (DeviceState *dev,Error **errp) {
@@ -76,6 +80,20 @@ static void aspeed_ast1700_realize(DeviceState *dev, Error **errp) aspeed_ast1700_io_memmap[ASPEED_AST1700_DEV_UART12 ], sysbus_mmio_get_region(SYS_BUS_DEVICE(&s->uart), 0)); +/* SPI */ +object_property_set_link (OBJECT (&s->spi),"dram" , +OBJECT (&s->iomem), &error_abort); +if (!sysbus_realize (SYS_BUS_DEVICE (&s->spi), errp)) { +return ; + } +memory_region_add_subregion (&s->iomem, + aspeed_ast1700_io_memmap[ASPEED_AST1700_DEV_SPI0 ], +sysbus_mmio_get_region (SYS_BUS_DEVICE (&s->spi),0 )); + +memory_region_add_subregion (&s->iomem, + aspeed_ast1700_io_memmap[ASPEED_AST1700_DEV_SPI0_MEM ], +sysbus_mmio_get_region (SYS_BUS_DEVICE (&s->spi),1 )); +/* LTPI controller */ if (!sysbus_realize (SYS_BUS_DEVICE (&s->ltpi), errp)) {return ;
@@ -88,11 +106,21 @@ static void aspeed_ast1700_realize(DeviceState *dev, Error **errp)static void aspeed_ast1700_instance_init (Object *obj) {AspeedAST1700SoCState *s =ASPEED_AST1700 (obj); +char socname[8 ]; +char typename[64 ]; + +if (sscanf (object_get_typename (obj),"aspeed.ast1700-%7s" , socname) !=1 ) { +g_assert_not_reached (); + }/* UART */ object_initialize_child (obj,"uart[*]" , &s->uart,TYPE_SERIAL_MM ); +/* SPI */ +snprintf (typename,sizeof (typename),"aspeed.spi%d-%s" ,0 , socname); +object_initialize_child (obj,"ioexp-spi[*]" , &s->spi, + typename);/* LTPI controller */ object_initialize_child (obj,"ltpi-ctrl" , &s->ltpi,TYPE_ASPEED_LTPI );
Signature · 1 line
2.43.0
Re: [PATCH v2 09/17] hw/arm/aspeed: Attach SPI device to AST1700 model
This patch seems to break qtest-arm
``` 37/56 qemu:qtest+qtest-arm / qtest-arm/device-introspect-test ERROR 5.18s killed by signal 6 SIGABRT >>> QTEST_QEMU_IMG=./qemu-img G_TEST_DBUS_DAEMON=/b/f/w/src/git/qemu/tests/dbus-vmstate-daemon.sh QTEST_QEMU_BINARY=./qemu-system-arm PYTHON=/b/f/w/src/git/qemu/build/pyvenv/bin/python3 MSAN_OPTIONS=halt_on_error=1:abort_on_error=1:print_summary=1:print_stacktrace=1 MESON_TEST_ITERATION=1 UBSAN_OPTIONS=halt_on_error=1:abort_on_error=1:print_summary=1:print_stacktrace=1 QTEST_QEMU_STORAGE_DAEMON_BINARY=./storage-daemon/qemu-storage-daemon RUST_BACKTRACE=1 ASAN_OPTIONS=halt_on_error=1:abort_on_error=1:print_summary=1 MALLOC_PERTURB_=175 /b/f/w/src/git/qemu/build/tests/qtest/device-introspect-test --tap -k ――――――――――――――――――――――――――――――――――――― ✀ ――――――――――――――――――――――――――――――――――――― stderr: ** ERROR:../hw/misc/aspeed_ast1700.c:113:aspeed_ast1700_instance_init: code should not be reached Broken pipe ../tests/qtest/libqtest.c:208: kill_qemu() detected QEMU death from signal 6 (Aborted) (core dumped) (test program exited with status code -6) ```
Failed by running:
```
./configure \
--target-list=arm-softmmu,arm-linux-user,aarch64-softmmu,aarch64-linux-user,i386-softmmu
\
--cc=clang-18 --extra-cflags=-Wno-deprecated-declarations \
--cxx=clang++-18 --extra-cxxflags=-Wno-deprecated-declarations
make -j 32 all check-report-unit.junit.xml
check-report-qtest-arm.junit.xml check-report-qtest-aarch64.junit.xml check-report-qtest-i386.junit.xml
Thanks,
Nabih
Nabih Estefan (he/him) | Software Engineer |
[email protected] | 857-308-9574
Quoted 94 lines · Kane Chen via
From: Kane-Chen-AS <[email protected]>
Connect the SPI device to AST1700 model.
Signed-off-by Kane-Chen-AS <[email protected]>--- include/hw/misc/aspeed_ast1700.h | 1 + hw/misc/aspeed_ast1700.c | 28 ++++++++++++++++++++++++++++ 2 files changed, 29 insertions(+)include/hw/misc/aspeed_ast1700.h +1
-0@@ -33,6 +33,7 @@ struct AspeedAST1700SoCState {AspeedLTPIState ltpi;SerialMM uart;MemoryRegion sram; + AspeedSMCState spi; };#endif /* ASPEED_AST1700_H */ hw/misc/aspeed_ast1700.c +28
-1@@ -20,15 +20,19 @@#define AST1700_SOC_SRAM_SIZE 0x00040000enum { +ASPEED_AST1700_DEV_SPI0 ,ASPEED_AST1700_DEV_SRAM ,ASPEED_AST1700_DEV_UART12 ,ASPEED_AST1700_DEV_LTPI_CTRL , +ASPEED_AST1700_DEV_SPI0_MEM , };static const hwaddr aspeed_ast1700_io_memmap[] = { + [ASPEED_AST1700_DEV_SPI0 ] =0x00030000 , [ASPEED_AST1700_DEV_SRAM ] =0x00BC0000 , [ASPEED_AST1700_DEV_UART12 ] =0x00C33B00 , [ASPEED_AST1700_DEV_LTPI_CTRL ] =0x00C34000 , + [ASPEED_AST1700_DEV_SPI0_MEM ] =0x04000000 , };static void aspeed_ast1700_realize (DeviceState *dev,Error **errp) {@@ -76,6 +80,20 @@ static void aspeed_ast1700_realize(DeviceState *dev, Error **errp) aspeed_ast1700_io_memmap[ASPEED_AST1700_DEV_UART12 ], sysbus_mmio_get_region(SYS_BUS_DEVICE(&s->uart), 0)); +/* SPI */ +object_property_set_link (OBJECT (&s->spi),"dram" , +OBJECT (&s->iomem), &error_abort); +if (!sysbus_realize (SYS_BUS_DEVICE (&s->spi), errp)) { +return ; + } +memory_region_add_subregion (&s->iomem, + aspeed_ast1700_io_memmap[ASPEED_AST1700_DEV_SPI0 ], +sysbus_mmio_get_region (SYS_BUS_DEVICE (&s->spi),0 )); + +memory_region_add_subregion (&s->iomem, + aspeed_ast1700_io_memmap[ASPEED_AST1700_DEV_SPI0_MEM ], +sysbus_mmio_get_region (SYS_BUS_DEVICE (&s->spi),1 )); +/* LTPI controller */ if (!sysbus_realize (SYS_BUS_DEVICE (&s->ltpi), errp)) {return ;@@ -88,11 +106,21 @@ static void aspeed_ast1700_realize(DeviceState *dev, Error **errp)static void aspeed_ast1700_instance_init (Object *obj) {AspeedAST1700SoCState *s =ASPEED_AST1700 (obj); +char socname[8 ]; +char typename[64 ]; + +if (sscanf (object_get_typename (obj),"aspeed.ast1700-%7s" , socname) !=1 ) { +g_assert_not_reached (); + }/* UART */ object_initialize_child (obj,"uart[*]" , &s->uart,TYPE_SERIAL_MM ); +/* SPI */ +snprintf (typename,sizeof (typename),"aspeed.spi%d-%s" ,0 , socname); +object_initialize_child (obj,"ioexp-spi[*]" , &s->spi, + typename);/* LTPI controller */ object_initialize_child (obj,"ltpi-ctrl" , &s->ltpi,TYPE_ASPEED_LTPI ); --2.43.0
RE: [PATCH v2 09/17] hw/arm/aspeed: Attach SPI device to AST1700 model
Hi Nabih,
Thanks for pointing this out. It seems I need to add the abstract attribute to the aspeed_ast1700_info structure, as shown below:
hw/misc/aspeed_ast1700.c +1 -0
@@ -286,6 +286,7 @@ static const TypeInfo aspeed_ast1700_info = { .instance_size = sizeof(AspeedAST1700SoCState), .class_init = aspeed_ast1700_class_init, .instance_init = aspeed_ast1700_instance_init, + .abstract = true, };
On the other hand, I encountered a timeout error while running the make check-functional test. I need to investigate why the test case failed.
Once this issue is clarified, I’ll submit another patch for further review.
Best Regards,
Kane
Quoted 176 lines
-----Original Message-----
From: Nabih Estefan <[email protected]>
Sent: Thursday, November 6, 2025 5:20 AM
To: Kane Chen <[email protected]>
Cc: Cédric Le Goater <[email protected]>; Peter Maydell <[email protected]>; Steven Lee <[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]>; Troy Lee <[email protected]>
Subject: Re: [PATCH v2 09/17] hw/arm/aspeed: Attach SPI device to AST1700 modelThis patch seems to break qtest-arm
``` 37/56 qemu:qtest+qtest-arm / qtest-arm/device-introspect-test ERROR 5.18s killed by signal 6 SIGABRT >>> QTEST_QEMU_IMG=./qemu-img >>> G_TEST_DBUS_DAEMON=/b/f/w/src/git/qemu/tests/dbus-vmstate-daemon.s h >>> QTEST_QEMU_BINARY=./qemu-system-arm >>> PYTHON=/b/f/w/src/git/qemu/build/pyvenv/bin/python3 >>> MSAN_OPTIONS=halt_on_error=1:abort_on_error=1:print_summary=1:print_ >>> stacktrace=1 MESON_TEST_ITERATION=1 >>> UBSAN_OPTIONS=halt_on_error=1:abort_on_error=1:print_summary=1:print >>> _stacktrace=1 >>> QTEST_QEMU_STORAGE_DAEMON_BINARY=./storage-daemon/qemu-storag e-daemo >>> n RUST_BACKTRACE=1 >>> ASAN_OPTIONS=halt_on_error=1:abort_on_error=1:print_summary=1 >>> MALLOC_PERTURB_=175 >>> /b/f/w/src/git/qemu/build/tests/qtest/device-introspect-test --tap >>> -k ――――――――――――――――――――――――――――――――――――― ✀ ――――――――――――――――――――――――――――――――――――― stderr: ** ERROR:../hw/misc/aspeed_ast1700.c:113:aspeed_ast1700_instance_init: code should not be reached Broken pipe ../tests/qtest/libqtest.c:208: kill_qemu() detected QEMU death from signal 6 (Aborted) (core dumped) (test program exited with status code -6) ``` Failed by running: ```./configure \
--target-list=arm-softmmu,arm-linux-user,aarch64-softmmu,aarch64-linux-us er,i386-softmmu
\
--cc=clang-18 --extra-cflags=-Wno-deprecated-declarations \
--cxx=clang++-18 --extra-cxxflags=-Wno-deprecated-declarations
make -j 32 all check-report-unit.junit.xml check-report-qtest-arm.junit.xml check-report-qtest-aarch64.junit.xml check-report-qtest-i386.junit.xmlThanks,
NabihNabih Estefan (he/him) | Software Engineer | [email protected] | 857-308-9574
Quoted 9 lines · Kane Chen via
From: Kane-Chen-AS <[email protected]>
Connect the SPI device to AST1700 model.
Signed-off-by Kane-Chen-AS <[email protected]>--- include/hw/misc/aspeed_ast1700.h | 1 + hw/misc/aspeed_ast1700.c | 28++++++++++++++++++++++++++++
hw/misc/aspeed_ast1700.c static void aspeed_ast1700_realize(DeviceState *dev,
Quoted 39 lines
2 files changed, 29 insertions(+)include/hw/misc/aspeed_ast1700.h +1
-0@@ -33,6 +33,7 @@ struct AspeedAST1700SoCState {AspeedLTPIState ltpi;SerialMM uart;MemoryRegion sram; + AspeedSMCState spi; };#endif /* ASPEED_AST1700_H */ hw/misc/aspeed_ast1700.c index renamed from hw/misc/aspeed_ast1700.c +0
-0
6f7ff625b5..ba44e484e8100644hw/misc/aspeed_ast1700.c +4
-0@@ -20,15 +20,19 @@#define AST1700_SOC_SRAM_SIZE 0x00040000enum { +ASPEED_AST1700_DEV_SPI0 ,ASPEED_AST1700_DEV_SRAM ,ASPEED_AST1700_DEV_UART12 ,ASPEED_AST1700_DEV_LTPI_CTRL , +ASPEED_AST1700_DEV_SPI0_MEM , };static const hwaddr aspeed_ast1700_io_memmap[] = { + [ASPEED_AST1700_DEV_SPI0 ] =0x00030000 , [ASPEED_AST1700_DEV_SRAM ] =0x00BC0000 , [ASPEED_AST1700_DEV_UART12 ] =0x00C33B00 , [ASPEED_AST1700_DEV_LTPI_CTRL ] =0x00C34000 , + [ASPEED_AST1700_DEV_SPI0_MEM ] =0x04000000 , };static void aspeed_ast1700_realize (DeviceState *dev,Error **errp) {@@ -76,6 +80,20 @@ static void aspeed_ast1700_realize(DeviceState *dev,Error **errp)
Quoted 1 line
aspeed_ast1700_io_memmap[ASPEED_AST1700_DEV_UART12],
hw/misc/aspeed_ast1700.c
Quoted 11 lines
sysbus_mmio_get_region(SYS_BUS_DEVICE(&s->uart), 0));hw/misc/aspeed_ast1700.c +8
-0+/* SPI */ +object_property_set_link (OBJECT (&s->spi),"dram" , +OBJECT (&s->iomem), &error_abort); +if (!sysbus_realize (SYS_BUS_DEVICE (&s->spi), errp)) { +return ; + } + memory_region_add_subregion(&s->iomem, +aspeed_ast1700_io_memmap[ASPEED_AST1700_DEV_SPI0],
hw/misc/aspeed_ast1700.c
Quoted 5 lines
hw/misc/aspeed_ast1700.c +5
-0+ + sysbus_mmio_get_region(SYS_BUS_DEVICE(&s->spi), 0)); + + memory_region_add_subregion(&s->iomem, +aspeed_ast1700_io_memmap[ASPEED_AST1700_DEV_SPI0_MEM],
Quoted 7 lines
hw/misc/aspeed_ast1700.c +3
-0+ + sysbus_mmio_get_region(SYS_BUS_DEVICE(&s->spi), 1)); +/* LTPI controller */ if (!sysbus_realize (SYS_BUS_DEVICE (&s->ltpi), errp)) {return ;hw/misc/aspeed_ast1700.c static void aspeed_ast1700_realize(DeviceState · line 112
Quoted 7 lines
hw/misc/aspeed_ast1700.c +4
-0@@ -88,11 +106,21 @@ static void aspeed_ast1700_realize(DeviceState *dev, Error **errp) static void aspeed_ast1700_instance_init(Object *obj) {AspeedAST1700SoCState *s =ASPEED_AST1700 (obj); +char socname[8 ]; +char typename[64 ]; + + if (sscanf(object_get_typename(obj), "aspeed.ast1700-%7s",socname) != 1) {
hw/misc/aspeed_ast1700.c static void aspeed_ast1700_realize(DeviceState · line 121
Quoted 9 lines
hw/misc/aspeed_ast1700.c +4
-0+g_assert_not_reached (); + }/* UART */ object_initialize_child (obj,"uart[*]" , &s->uart,TYPE_SERIAL_MM ); +/* SPI */ + snprintf(typename, sizeof(typename), "aspeed.spi%d-%s", 0,socname);
Quoted 9 lines
hw/misc/aspeed_ast1700.c +2
-1+object_initialize_child (obj,"ioexp-spi[*]" , &s->spi, + typename);/* LTPI controller */ object_initialize_child (obj,"ltpi-ctrl" , &s->ltpi,TYPE_ASPEED_LTPI ); --2.43.0
Re: [PATCH v2 09/17] hw/arm/aspeed: Attach SPI device to AST1700 model
Quoted 10 lines · Kane Chen
Hi Nabih,
Thanks for pointing this out. It seems I need to add the abstract attribute to the
aspeed_ast1700_infostructure, as shown below:hw/misc/aspeed_ast1700.c +0
-0
hw/misc/aspeed_ast1700.c static const TypeInfo aspeed_ast1700_info = { · line 290
Quoted 5 lines
hw/misc/aspeed_ast1700.c +1
-0@@ -286,6 +286,7 @@ static const TypeInfo aspeed_ast1700_info = { .instance_size = sizeof(AspeedAST1700SoCState), .class_init = aspeed_ast1700_class_init, .instance_init = aspeed_ast1700_instance_init, + .abstract = true, };
Hmm,
Please rework all typenames in aspeed_ast1700_instance_init(): remove all snprintf() and use directly strings like "aspeed.gpio-ast2700". For now, It should be fine. We will see if extensions are needed in the future.
Also, I don't see why you need :
static const TypeInfo aspeed_ast1700_ast2700_info = {
.name = TYPE_ASPEED_AST1700_AST2700,
.parent = TYPE_ASPEED_AST1700,
};Can't you use directly TYPE_ASPEED_AST1700 instead ?
Quoted 3 lines
On the other hand, I encountered a timeout error while running the make check-functional test. I need to investigate why the test case failed.
Once this issue is clarified, I’ll submit another patch for further review.
Wait for some feedback from me before resending.
Thanks,
C.
RE: [PATCH v2 09/17] hw/arm/aspeed: Attach SPI device to AST1700 model
Hi Cédric,
The reason I registered TypeInfo aspeed_ast1700_ast2700_info is that AST1700 may be connected to another SoC in the future. As you mentioned, at the current stage it should be fine to use a fixed type name, since we only have AST2700 supporting AST1700. I'll update the related code and remove aspeed_ast1700_ast2700_info accordingly.
If you have any other comments on the remaining patches, please let me know. I'll wait for feedback from you or others before proceeding further.
Best Regards,
Kane
Quoted 56 lines
-----Original Message-----
From: Cédric Le Goater <[email protected]>
Sent: Thursday, November 6, 2025 6:22 PM
To: Kane Chen <[email protected]>; Nabih Estefan <[email protected]>
Cc: Peter Maydell <[email protected]>; Steven Lee <[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]>; Troy Lee <[email protected]>
Subject: Re: [PATCH v2 09/17] hw/arm/aspeed: Attach SPI device to AST1700 modelQuoted 10 lines · Kane Chen
Hi Nabih,
Thanks for pointing this out. It seems I need to add the abstract attribute to the
aspeed_ast1700_infostructure, as shown below:hw/misc/aspeed_ast1700.c index renamed from hw/misc/aspeed_ast1700.c +0
-0
3d9a920a7a..ec95217f16100644hw/misc/aspeed_ast1700.c static const TypeInfo aspeed_ast1700_info = { · line 290
Quoted 5 lines
hw/misc/aspeed_ast1700.c +1
-0@@ -286,6 +286,7 @@ static const TypeInfo aspeed_ast1700_info = { .instance_size = sizeof(AspeedAST1700SoCState), .class_init = aspeed_ast1700_class_init, .instance_init = aspeed_ast1700_instance_init, + .abstract = true, };Hmm,
Please rework all typenames in
aspeed_ast1700_instance_init(): remove allsnprintf()and use directly strings like "aspeed.gpio-ast2700". For now, It should be fine. We will see if extensions are needed in the future.Also, I don't see why you need :
static const TypeInfo aspeed_ast1700_ast2700_info = { .name = TYPE_ASPEED_AST1700_AST2700, .parent = TYPE_ASPEED_AST1700, };Can't you use directly
TYPE_ASPEED_AST1700instead ?Quoted 1 line
On the other hand, I encountered a timeout error while running the make
check-functional test.
Quoted 2 lines
I need to investigate why the test case failed.
Once this issue is clarified, I’ll submit another patch for further review.Wait for some feedback from me before resending.
Thanks,
C.
Re: [PATCH v2 09/17] hw/arm/aspeed: Attach SPI device to AST1700 model
Hello Kane,
Quoted 6 lines · Kane Chen
Hi Cédric,
The reason I registered TypeInfo
aspeed_ast1700_ast2700_infois that AST1700 may be connected to another SoC in the future. As you mentioned, at the current stage it should be fine to use a fixed type name, since we only have AST2700 supporting AST1700.
It is good to prepare ground but it's a bit early. Let's keep it simple for now.
Quoted 5 lines
I'll update the related code and remove
aspeed_ast1700_ast2700_infoaccordingly.If you have any other comments on the remaining patches, please let me know. I'll wait for feedback from you or others before proceeding further.
I will review in the following weeks.
Current focus is on QEMU 10.2 fixes. Please test !
Thanks,
C.
PATCH v2 10/17 hw/arm/aspeed: Attach ADC device to AST1700 model
In reply to Kane Chen viaFrom: Kane-Chen-AS <[email protected]>
Connect the ADC device to AST1700 model.
--- include/hw/misc/aspeed_ast1700.h | 1 + hw/arm/aspeed_ast27x0.c | 4 ++++ hw/misc/aspeed_ast1700.c | 15 +++++++++++++++ 3 files changed, 20 insertions(+)
include/hw/misc/aspeed_ast1700.h +1 -0
@@ -34,6 +34,7 @@ struct AspeedAST1700SoCState {SerialMM uart;MemoryRegion sram;AspeedSMCState spi; + AspeedADCState adc; };#endif /* ASPEED_AST1700_H */
hw/arm/aspeed_ast27x0.c +4 -0
@@ -1092,6 +1092,10 @@ static void aspeed_soc_ast2700_realize(DeviceState *dev, Error **errp)sysbus_connect_irq (SYS_BUS_DEVICE (&a->intc[2 + i]), j, irq); } + +/* ADC */ +sysbus_connect_irq (SYS_BUS_DEVICE (&s->ioexp[i].adc),0 , +aspeed_soc_ast2700_get_irq (s,ASPEED_DEV_ADC )); } aspeed_mmio_map_unimplemented(s->memory, SYS_BUS_DEVICE(&s->dpmcu),
hw/misc/aspeed_ast1700.c +15 -0
@@ -22,6 +22,7 @@enum {ASPEED_AST1700_DEV_SPI0 ,ASPEED_AST1700_DEV_SRAM , +ASPEED_AST1700_DEV_ADC ,ASPEED_AST1700_DEV_UART12 ,ASPEED_AST1700_DEV_LTPI_CTRL ,ASPEED_AST1700_DEV_SPI0_MEM ,
@@ -30,6 +31,7 @@ enum {static const hwaddr aspeed_ast1700_io_memmap[] = { [ASPEED_AST1700_DEV_SPI0 ] =0x00030000 , [ASPEED_AST1700_DEV_SRAM ] =0x00BC0000 , + [ASPEED_AST1700_DEV_ADC ] =0x00C00000 , [ASPEED_AST1700_DEV_UART12 ] =0x00C33B00 , [ASPEED_AST1700_DEV_LTPI_CTRL ] =0x00C34000 , [ASPEED_AST1700_DEV_SPI0_MEM ] =0x04000000 ,
@@ -94,6 +96,14 @@ static void aspeed_ast1700_realize(DeviceState *dev, Error **errp) aspeed_ast1700_io_memmap[ASPEED_AST1700_DEV_SPI0_MEM ], sysbus_mmio_get_region(SYS_BUS_DEVICE(&s->spi), 1)); +/* ADC */ +if (!sysbus_realize (SYS_BUS_DEVICE (&s->adc), errp)) { +return ; + } +memory_region_add_subregion (&s->iomem, + aspeed_ast1700_io_memmap[ASPEED_AST1700_DEV_ADC ], +sysbus_mmio_get_region (SYS_BUS_DEVICE (&s->adc),0 )); +/* LTPI controller */ if (!sysbus_realize (SYS_BUS_DEVICE (&s->ltpi), errp)) {return ;
@@ -121,6 +131,11 @@ static void aspeed_ast1700_instance_init(Object *obj)snprintf (typename,sizeof (typename),"aspeed.spi%d-%s" ,0 , socname);object_initialize_child (obj,"ioexp-spi[*]" , &s->spi, typename); + +/* ADC */ +snprintf (typename,sizeof (typename),"aspeed.adc-%s" , socname); +object_initialize_child (obj,"ioexp-adc[*]" , &s->adc, + typename);/* LTPI controller */ object_initialize_child (obj,"ltpi-ctrl" , &s->ltpi,TYPE_ASPEED_LTPI );
Signature · 1 line
2.43.0
PATCH v2 11/17 hw/arm/aspeed: Attach SCU device to AST1700 model
In reply to Kane Chen viaFrom: Kane-Chen-AS <[email protected]>
Connect the SCU device to AST1700 model.
--- include/hw/misc/aspeed_ast1700.h | 2 ++ hw/arm/aspeed_ast27x0.c | 2 ++ hw/misc/aspeed_ast1700.c | 17 +++++++++++++++++ 3 files changed, 21 insertions(+)
include/hw/misc/aspeed_ast1700.h +2 -0
@@ -29,12 +29,14 @@ struct AspeedAST1700SoCState {MemoryRegion iomem;hwaddr mapped_base; +uint32_t silicon_rev;AspeedLTPIState ltpi;SerialMM uart;MemoryRegion sram;AspeedSMCState spi;AspeedADCState adc; + AspeedSCUState scu; };#endif /* ASPEED_AST1700_H */
hw/arm/aspeed_ast27x0.c +2 -0
@@ -560,6 +560,8 @@ static void aspeed_soc_ast2700_init(Object *obj)/* AST1700 IOEXP */ object_initialize_child (obj,"ioexp[*]" , &s->ioexp[i],TYPE_ASPEED_AST1700_AST2700 ); +qdev_prop_set_uint32 (DEVICE (&s->ioexp[i]),"silicon-rev" , + sc->silicon_rev); } object_initialize_child(obj, "dpmcu", &s->dpmcu,
hw/misc/aspeed_ast1700.c +17 -0
@@ -23,6 +23,7 @@ enum {ASPEED_AST1700_DEV_SPI0 ,ASPEED_AST1700_DEV_SRAM ,ASPEED_AST1700_DEV_ADC , +ASPEED_AST1700_DEV_SCU ,ASPEED_AST1700_DEV_UART12 ,ASPEED_AST1700_DEV_LTPI_CTRL , ASPEED_AST1700_DEV_SPI0_MEM,
@@ -32,6 +33,7 @@ static const hwaddr aspeed_ast1700_io_memmap[] = { [ASPEED_AST1700_DEV_SPI0] = 0x00030000, [ASPEED_AST1700_DEV_SRAM] = 0x00BC0000, [ASPEED_AST1700_DEV_ADC] = 0x00C00000, + [ASPEED_AST1700_DEV_SCU] = 0x00C02000, [ASPEED_AST1700_DEV_UART12] = 0x00C33B00, [ASPEED_AST1700_DEV_LTPI_CTRL] = 0x00C34000, [ASPEED_AST1700_DEV_SPI0_MEM] = 0x04000000,
@@ -104,6 +106,16 @@ static void aspeed_ast1700_realize(DeviceState *dev, Error **errp) aspeed_ast1700_io_memmap[ASPEED_AST1700_DEV_ADC ], sysbus_mmio_get_region(SYS_BUS_DEVICE(&s->adc), 0)); +/* SCU */ +qdev_prop_set_uint32 (DEVICE (&s->scu),"silicon-rev" , + s->silicon_rev); +if (!sysbus_realize (SYS_BUS_DEVICE (&s->scu), errp)) { +return ; + } +memory_region_add_subregion (&s->iomem, + aspeed_ast1700_io_memmap[ASPEED_AST1700_DEV_SCU ], +sysbus_mmio_get_region (SYS_BUS_DEVICE (&s->scu),0 )); +/* LTPI controller */ if (!sysbus_realize (SYS_BUS_DEVICE (&s->ltpi), errp)) {return ;
@@ -136,6 +148,10 @@ static void aspeed_ast1700_instance_init(Object *obj)snprintf (typename,sizeof (typename),"aspeed.adc-%s" , socname);object_initialize_child (obj,"ioexp-adc[*]" , &s->adc, typename); + +/* SCU */ +object_initialize_child (obj,"ioexp-scu[*]" , &s->scu, +TYPE_ASPEED_2700_SCU );/* LTPI controller */ object_initialize_child (obj,"ltpi-ctrl" , &s->ltpi,TYPE_ASPEED_LTPI );
@@ -145,6 +161,7 @@ static void aspeed_ast1700_instance_init(Object *obj)static const Property aspeed_ast1700_props[] = {DEFINE_PROP_UINT64 ("mapped-base" , AspeedAST1700SoCState, mapped_base,0 ), +DEFINE_PROP_UINT32 ("silicon-rev" , AspeedAST1700SoCState, silicon_rev,0 ), };static void aspeed_ast1700_class_init (ObjectClass *klass,const void *data)
Signature · 1 line
2.43.0
PATCH v2 12/17 hw/arm/aspeed: Attach GPIO device to AST1700 model
In reply to Kane Chen viaFrom: Kane-Chen-AS <[email protected]>
Connect the GPIO controller to the AST1700 model by mapping its MMIO region and wiring its interrupt line.
--- include/hw/misc/aspeed_ast1700.h | 1 + hw/arm/aspeed_ast27x0.c | 4 ++++ hw/misc/aspeed_ast1700.c | 14 ++++++++++++++ 3 files changed, 19 insertions(+)
include/hw/misc/aspeed_ast1700.h +1 -0
@@ -37,6 +37,7 @@ struct AspeedAST1700SoCState {AspeedSMCState spi;AspeedADCState adc;AspeedSCUState scu; + AspeedGPIOState gpio; };#endif /* ASPEED_AST1700_H */
hw/arm/aspeed_ast27x0.c +4 -0
@@ -1098,6 +1098,10 @@ static void aspeed_soc_ast2700_realize(DeviceState *dev, Error **errp)/* ADC */ sysbus_connect_irq (SYS_BUS_DEVICE (&s->ioexp[i].adc),0 ,aspeed_soc_ast2700_get_irq (s,ASPEED_DEV_ADC )); + +/* GPIO */ +sysbus_connect_irq (SYS_BUS_DEVICE (&s->ioexp[i].gpio),0 , +aspeed_soc_ast2700_get_irq (s,ASPEED_DEV_GPIO )); } aspeed_mmio_map_unimplemented(s->memory, SYS_BUS_DEVICE(&s->dpmcu),
hw/misc/aspeed_ast1700.c +14 -0
@@ -24,6 +24,7 @@ enum {ASPEED_AST1700_DEV_SRAM ,ASPEED_AST1700_DEV_ADC ,ASPEED_AST1700_DEV_SCU , +ASPEED_AST1700_DEV_GPIO ,ASPEED_AST1700_DEV_UART12 ,ASPEED_AST1700_DEV_LTPI_CTRL , ASPEED_AST1700_DEV_SPI0_MEM,
@@ -34,6 +35,7 @@ static const hwaddr aspeed_ast1700_io_memmap[] = { [ASPEED_AST1700_DEV_SRAM] = 0x00BC0000, [ASPEED_AST1700_DEV_ADC] = 0x00C00000, [ASPEED_AST1700_DEV_SCU] = 0x00C02000, + [ASPEED_AST1700_DEV_GPIO] = 0x00C0B000, [ASPEED_AST1700_DEV_UART12] = 0x00C33B00, [ASPEED_AST1700_DEV_LTPI_CTRL] = 0x00C34000, [ASPEED_AST1700_DEV_SPI0_MEM] = 0x04000000,
@@ -116,6 +118,14 @@ static void aspeed_ast1700_realize(DeviceState *dev, Error **errp) aspeed_ast1700_io_memmap[ASPEED_AST1700_DEV_SCU ], sysbus_mmio_get_region(SYS_BUS_DEVICE(&s->scu), 0)); +/* GPIO */ +if (!sysbus_realize (SYS_BUS_DEVICE (&s->gpio), errp)) { +return ; + } +memory_region_add_subregion (&s->iomem, + aspeed_ast1700_io_memmap[ASPEED_AST1700_DEV_GPIO ], +sysbus_mmio_get_region (SYS_BUS_DEVICE (&s->gpio),0 )); +/* LTPI controller */ if (!sysbus_realize (SYS_BUS_DEVICE (&s->ltpi), errp)) {return ;
@@ -152,6 +162,10 @@ static void aspeed_ast1700_instance_init(Object *obj)/* SCU */ object_initialize_child (obj,"ioexp-scu[*]" , &s->scu,TYPE_ASPEED_2700_SCU ); + +/* GPIO */ +snprintf (typename,sizeof (typename),"aspeed.gpio-%s" , socname); +object_initialize_child (obj,"ioexp-gpio[*]" , &s->gpio, typename);/* LTPI controller */ object_initialize_child (obj,"ltpi-ctrl" , &s->ltpi,TYPE_ASPEED_LTPI );
Signature · 1 line
2.43.0
PATCH v2 13/17 hw/arm/aspeed: Attach I2C device to AST1700 model
In reply to Kane Chen viaFrom: Kane-Chen-AS <[email protected]>
Connect the I2C controller to the AST1700 model by mapping its MMIO region and wiring its interrupt line.
--- include/hw/arm/aspeed_soc.h | 2 ++ include/hw/misc/aspeed_ast1700.h | 1 + hw/arm/aspeed_ast27x0.c | 39 ++++++++++++++++++++++++++++++-- hw/misc/aspeed_ast1700.c | 17 ++++++++++++++ 4 files changed, 57 insertions(+), 2 deletions(-)
include/hw/arm/aspeed_soc.h +2 -0
@@ -283,6 +283,8 @@ enum {ASPEED_DEV_IPC1 ,ASPEED_DEV_LTPI_CTRL1 ,ASPEED_DEV_LTPI_CTRL2 , +ASPEED_DEV_IOEXP0_I2C , +ASPEED_DEV_IOEXP1_I2C ,ASPEED_DEV_IOEXP0_INTCIO , ASPEED_DEV_IOEXP1_INTCIO, };
include/hw/misc/aspeed_ast1700.h +1 -0
@@ -38,6 +38,7 @@ struct AspeedAST1700SoCState {AspeedADCState adc;AspeedSCUState scu;AspeedGPIOState gpio; + AspeedI2CState i2c; };#endif /* ASPEED_AST1700_H */
hw/arm/aspeed_ast27x0.c +37 -2
@@ -199,6 +199,8 @@ static const int aspeed_soc_ast2700a1_irqmap[] = { [ASPEED_DEV_ETH3] = 196, [ASPEED_DEV_PECI] = 197, [ASPEED_DEV_SDHCI] = 197, + [ASPEED_DEV_IOEXP0_I2C] = 198, + [ASPEED_DEV_IOEXP1_I2C] = 200, };/* GICINT 128 */
@@ -259,6 +261,17 @@ static const int ast2700_gic133_gic197_intcmap[] = { [ASPEED_DEV_PECI] = 4, }; +/* Primary AST1700 Interrupts */ +/* A1: GICINT 198 */ +static const int ast2700_gic198_intcmap[] = { + [ASPEED_DEV_IOEXP0_I2C ] =0 ,/* 0 - 15 */ +}; + +/* Secondary AST1700 Interrupts */ +/* A1: GINTC 200 */ +static const int ast2700_gic200_intcmap[] = { + [ASPEED_DEV_IOEXP1_I2C ] =0 ,/* 0 - 15 */ +};/* GICINT 128 ~ 136 */ /* GICINT 192 ~ 201 */ struct gic_intc_irq_info {
@@ -275,9 +288,9 @@ static const struct gic_intc_irq_info ast2700_gic_intcmap[] = { {195, 1, 3, ast2700_gic131_gic195_intcmap}, {196, 1, 4, ast2700_gic132_gic196_intcmap}, {197, 1, 5, ast2700_gic133_gic197_intcmap}, - {198, 1, 6, NULL}, + {198, 2, 0, ast2700_gic198_intcmap}, {199, 1, 7, NULL}, - {200, 1, 8, NULL}, + {200, 3, 0, ast2700_gic200_intcmap}, {201, 1, 9, NULL}, {128, 0, 1, ast2700_gic128_gic192_intcmap}, {129, 0, 2, NULL},
@@ -708,6 +721,7 @@ static void aspeed_soc_ast2700_realize(DeviceState *dev, Error **errp)qemu_irq irq;int uart;int j; +AspeedI2CClass *i2c_ctl;AspeedLTPIState *ltpi_ctrl;hwaddr ltpi_base;
@@ -1102,6 +1116,27 @@ static void aspeed_soc_ast2700_realize(DeviceState *dev, Error **errp)/* GPIO */ sysbus_connect_irq (SYS_BUS_DEVICE (&s->ioexp[i].gpio),0 ,aspeed_soc_ast2700_get_irq (s,ASPEED_DEV_GPIO )); + +/* I2C */ + i2c_ctl =ASPEED_I2C_GET_CLASS (&s->ioexp[i].i2c); +for (j =0 ; j < i2c_ctl->num_busses; j++) { +/* +* For I2C on AST1700: +* I2C bus interrupts are connected to the OR gate from bit 0 to bit +* 15, and the OR gate output pin is connected to the input pin of +* GICINT192 of IO expander Interrupt controller (INTC2/3). Then, +* the output pin is connected to the INTC (CPU Die) input pin, and +* its output pin is connected to the GIC. +* +* I2C bus 0 is connected to the OR gate at bit 0. +* I2C bus 15 is connected to the OR gate at bit 15. +*/ + irq =aspeed_soc_ast2700_get_irq_index (s, +ASPEED_DEV_IOEXP0_I2C + i, + j); +sysbus_connect_irq (SYS_BUS_DEVICE (&s->ioexp[i].i2c.busses[j]), +0 , irq); + } } aspeed_mmio_map_unimplemented(s->memory, SYS_BUS_DEVICE(&s->dpmcu),
hw/misc/aspeed_ast1700.c +17 -0
@@ -25,6 +25,7 @@ enum {ASPEED_AST1700_DEV_ADC ,ASPEED_AST1700_DEV_SCU ,ASPEED_AST1700_DEV_GPIO , +ASPEED_AST1700_DEV_I2C ,ASPEED_AST1700_DEV_UART12 ,ASPEED_AST1700_DEV_LTPI_CTRL , ASPEED_AST1700_DEV_SPI0_MEM,
@@ -36,6 +37,7 @@ static const hwaddr aspeed_ast1700_io_memmap[] = { [ASPEED_AST1700_DEV_ADC] = 0x00C00000, [ASPEED_AST1700_DEV_SCU] = 0x00C02000, [ASPEED_AST1700_DEV_GPIO] = 0x00C0B000, + [ASPEED_AST1700_DEV_I2C] = 0x00C0F000, [ASPEED_AST1700_DEV_UART12] = 0x00C33B00, [ASPEED_AST1700_DEV_LTPI_CTRL] = 0x00C34000, [ASPEED_AST1700_DEV_SPI0_MEM] = 0x04000000,
@@ -126,6 +128,16 @@ static void aspeed_ast1700_realize(DeviceState *dev, Error **errp) aspeed_ast1700_io_memmap[ASPEED_AST1700_DEV_GPIO ], sysbus_mmio_get_region(SYS_BUS_DEVICE(&s->gpio), 0)); +/* I2C */ +object_property_set_link (OBJECT (&s->i2c),"dram" , +OBJECT (&s->iomem), &error_abort); +if (!sysbus_realize (SYS_BUS_DEVICE (&s->i2c), errp)) { +return ; + } +memory_region_add_subregion (&s->iomem, + aspeed_ast1700_io_memmap[ASPEED_AST1700_DEV_I2C ], +sysbus_mmio_get_region (SYS_BUS_DEVICE (&s->i2c),0 )); +/* LTPI controller */ if (!sysbus_realize (SYS_BUS_DEVICE (&s->ltpi), errp)) {return ;
@@ -166,6 +178,11 @@ static void aspeed_ast1700_instance_init(Object *obj)/* GPIO */ snprintf (typename,sizeof (typename),"aspeed.gpio-%s" , socname);object_initialize_child (obj,"ioexp-gpio[*]" , &s->gpio, typename); + +/* I2C */ +snprintf (typename,sizeof (typename),"aspeed.i2c-%s" , socname); +object_initialize_child (obj,"ioexp-i2c[*]" , &s->i2c, + typename);/* LTPI controller */ object_initialize_child (obj,"ltpi-ctrl" , &s->ltpi,TYPE_ASPEED_LTPI );
Signature · 1 line
2.43.0
PATCH v2 14/17 hw/arm/aspeed: Attach WDT device to AST1700 model
In reply to Kane Chen viaFrom: Kane-Chen-AS <[email protected]>
Connect the WDT device to AST1700 model.
--- include/hw/misc/aspeed_ast1700.h | 3 +++ hw/misc/aspeed_ast1700.c | 28 ++++++++++++++++++++++++++++ 2 files changed, 31 insertions(+)
include/hw/misc/aspeed_ast1700.h +3 -0
@@ -19,6 +19,8 @@#include "hw/char/serial-mm.h" #include "hw/misc/unimp.h" +#define AST1700_WDT_NUM 9 +#define TYPE_ASPEED_AST1700 "aspeed.ast1700"#define TYPE_ASPEED_AST1700_AST2700 "aspeed.ast1700-ast2700"
@@ -39,6 +41,7 @@ struct AspeedAST1700SoCState {AspeedSCUState scu;AspeedGPIOState gpio;AspeedI2CState i2c; + AspeedWDTState wdt[AST1700_WDT_NUM]; };#endif /* ASPEED_AST1700_H */
hw/misc/aspeed_ast1700.c +28 -0
@@ -28,6 +28,7 @@ enum {ASPEED_AST1700_DEV_I2C ,ASPEED_AST1700_DEV_UART12 ,ASPEED_AST1700_DEV_LTPI_CTRL , +ASPEED_AST1700_DEV_WDT , ASPEED_AST1700_DEV_SPI0_MEM, };
@@ -40,10 +41,13 @@ static const hwaddr aspeed_ast1700_io_memmap[] = { [ASPEED_AST1700_DEV_I2C] = 0x00C0F000, [ASPEED_AST1700_DEV_UART12] = 0x00C33B00, [ASPEED_AST1700_DEV_LTPI_CTRL] = 0x00C34000, + [ASPEED_AST1700_DEV_WDT] = 0x00C37000, [ASPEED_AST1700_DEV_SPI0_MEM] = 0x04000000, }; +static void aspeed_ast1700_realize (DeviceState *dev,Error **errp) { +int i;AspeedAST1700SoCState *s =ASPEED_AST1700 (dev);SysBusDevice *sbd =SYS_BUS_DEVICE (dev);hwaddr uart_base;
@@ -145,10 +149,27 @@ static void aspeed_ast1700_realize(DeviceState *dev, Error **errp)memory_region_add_subregion (&s->iomem, aspeed_ast1700_io_memmap[ASPEED_AST1700_DEV_LTPI_CTRL ],sysbus_mmio_get_region (SYS_BUS_DEVICE (&s->ltpi),0 )); + +/* WDT */ +for (i =0 ; i <AST1700_WDT_NUM ; i++) { +AspeedWDTClass *awc =ASPEED_WDT_GET_CLASS (&s->wdt[i]); +hwaddr wdt_offset = aspeed_ast1700_io_memmap[ASPEED_AST1700_DEV_WDT ] + + i * awc->iosize; + +object_property_set_link (OBJECT (&s->wdt[i]),"scu" ,OBJECT (&s->scu), + &error_abort); +if (!sysbus_realize (SYS_BUS_DEVICE (&s->wdt[i]), errp)) { +return ; + } +memory_region_add_subregion (&s->iomem, + wdt_offset, +sysbus_mmio_get_region (SYS_BUS_DEVICE (&s->wdt[i]),0 )); + } }static void aspeed_ast1700_instance_init (Object *obj) { +int i;AspeedAST1700SoCState *s =ASPEED_AST1700 (obj);char socname[8 ];char typename[64 ];
@@ -187,6 +208,13 @@ static void aspeed_ast1700_instance_init(Object *obj)object_initialize_child (obj,"ltpi-ctrl" , &s->ltpi,TYPE_ASPEED_LTPI ); +/* WDT */ +for (i =0 ; i <AST1700_WDT_NUM ; i++) { +snprintf (typename,sizeof (typename),"aspeed.wdt-%s" , socname); +object_initialize_child (obj,"ioexp-wdt[*]" , + &s->wdt[i], typename); + } +return ; }
Signature · 1 line
2.43.0
PATCH v2 15/17 hw/arm/aspeed: Model AST1700 I3C block as unimplemented device
In reply to Kane Chen viaFrom: Kane-Chen-AS <[email protected]>
AST1700 exposes more I3C buses than the current dummy I3C model provides. When Linux probes the I3C devices on AST1700 this mismatch can trigger a kernel panic. Model the I3C block as an unimplemented device to make the missing functionality explicit and avoid unexpected side effects.
This wires up the I3C interrupt lines for the IO expanders and adds the corresponding device entries for the AST1700 model.
No functional I3C emulation is provided yet; this only prevents crashes and documents the missing piece.
--- include/hw/arm/aspeed_soc.h | 2 ++ include/hw/misc/aspeed_ast1700.h | 2 ++ hw/arm/aspeed_ast27x0.c | 19 +++++++++++++++++-- hw/misc/aspeed_ast1700.c | 17 +++++++++++++++++ 4 files changed, 38 insertions(+), 2 deletions(-)
include/hw/arm/aspeed_soc.h +2 -0
@@ -287,6 +287,8 @@ enum {ASPEED_DEV_IOEXP1_I2C ,ASPEED_DEV_IOEXP0_INTCIO ,ASPEED_DEV_IOEXP1_INTCIO , +ASPEED_DEV_IOEXP0_I3C , + ASPEED_DEV_IOEXP1_I3C, };const char *aspeed_soc_cpu_type (const char *const *valid_cpu_types);
include/hw/misc/aspeed_ast1700.h +2 -0
@@ -42,6 +42,8 @@ struct AspeedAST1700SoCState {AspeedGPIOState gpio;AspeedI2CState i2c;AspeedWDTState wdt[AST1700_WDT_NUM ]; + + UnimplementedDeviceState i3c; };#endif /* ASPEED_AST1700_H */
hw/arm/aspeed_ast27x0.c +17 -2
@@ -200,7 +200,9 @@ static const int aspeed_soc_ast2700a1_irqmap[] = { [ASPEED_DEV_PECI] = 197, [ASPEED_DEV_SDHCI] = 197, [ASPEED_DEV_IOEXP0_I2C] = 198, + [ASPEED_DEV_IOEXP0_I3C] = 199, [ASPEED_DEV_IOEXP1_I2C] = 200, + [ASPEED_DEV_IOEXP1_I3C] = 201, };/* GICINT 128 */
@@ -267,11 +269,24 @@ static const int ast2700_gic198_intcmap[] = { [ASPEED_DEV_IOEXP0_I2C] = 0, /* 0 - 15 */ }; +/* Primary AST1700 Interrupts */ +/* A1: GINTC 199 */ +static const int ast2700_gic199_intcmap[] = { + [ASPEED_DEV_IOEXP0_I3C ] =0 ,/* 0 - 15 */ +}; +/* Secondary AST1700 Interrupts */ /* A1: GINTC 200 */ static const int ast2700_gic200_intcmap[] = { [ASPEED_DEV_IOEXP1_I2C ] =0 ,/* 0 - 15 */ }; + +/* Secondary AST1700 Interrupts */ +/* A1: GINTC 201 */ +static const int ast2700_gic201_intcmap[] = { + [ASPEED_DEV_IOEXP1_I3C ] =0 ,/* 0 - 15 */ +}; +/* GICINT 128 ~ 136 */ /* GICINT 192 ~ 201 */ struct gic_intc_irq_info {
@@ -289,9 +304,9 @@ static const struct gic_intc_irq_info ast2700_gic_intcmap[] = { {196, 1, 4, ast2700_gic132_gic196_intcmap}, {197, 1, 5, ast2700_gic133_gic197_intcmap}, {198, 2, 0, ast2700_gic198_intcmap}, - {199, 1, 7, NULL}, + {199, 2, 1, ast2700_gic199_intcmap}, {200, 3, 0, ast2700_gic200_intcmap}, - {201, 1, 9, NULL}, + {201, 3, 1, ast2700_gic201_intcmap}, {128, 0, 1, ast2700_gic128_gic192_intcmap}, {129, 0, 2, NULL}, {130, 0, 3, ast2700_gic130_gic194_intcmap},
hw/misc/aspeed_ast1700.c +17 -0
@@ -18,6 +18,7 @@#define AST1700_BOARD1_MEM_ADDR 0x30000000#define AST2700_SOC_LTPI_SIZE 0x01000000#define AST1700_SOC_SRAM_SIZE 0x00040000 +#define AST1700_SOC_I3C_SIZE 0x00010000enum {ASPEED_AST1700_DEV_SPI0 ,
@@ -26,6 +27,7 @@ enum {ASPEED_AST1700_DEV_SCU ,ASPEED_AST1700_DEV_GPIO ,ASPEED_AST1700_DEV_I2C , +ASPEED_AST1700_DEV_I3C ,ASPEED_AST1700_DEV_UART12 ,ASPEED_AST1700_DEV_LTPI_CTRL , ASPEED_AST1700_DEV_WDT,
@@ -39,6 +41,7 @@ static const hwaddr aspeed_ast1700_io_memmap[] = { [ASPEED_AST1700_DEV_SCU] = 0x00C02000, [ASPEED_AST1700_DEV_GPIO] = 0x00C0B000, [ASPEED_AST1700_DEV_I2C] = 0x00C0F000, + [ASPEED_AST1700_DEV_I3C] = 0x00C20000, [ASPEED_AST1700_DEV_UART12] = 0x00C33B00, [ASPEED_AST1700_DEV_LTPI_CTRL] = 0x00C34000, [ASPEED_AST1700_DEV_WDT] = 0x00C37000,
@@ -142,6 +145,15 @@ static void aspeed_ast1700_realize(DeviceState *dev, Error **errp) aspeed_ast1700_io_memmap[ASPEED_AST1700_DEV_I2C ], sysbus_mmio_get_region(SYS_BUS_DEVICE(&s->i2c), 0)); +/* I3C */ +qdev_prop_set_string (DEVICE (&s->i3c),"name" ,"ioexp-i3c" ); +qdev_prop_set_uint64 (DEVICE (&s->i3c),"size" ,AST1700_SOC_I3C_SIZE ); +sysbus_realize (SYS_BUS_DEVICE (&s->i3c), errp); +memory_region_add_subregion_overlap (&s->iomem, + aspeed_ast1700_io_memmap[ASPEED_AST1700_DEV_I3C ], +sysbus_mmio_get_region (SYS_BUS_DEVICE (&s->i3c),0 ), +-1000 ); +/* LTPI controller */ if (!sysbus_realize (SYS_BUS_DEVICE (&s->ltpi), errp)) {return ;
@@ -204,6 +216,11 @@ static void aspeed_ast1700_instance_init(Object *obj)snprintf (typename,sizeof (typename),"aspeed.i2c-%s" , socname);object_initialize_child (obj,"ioexp-i2c[*]" , &s->i2c, typename); + +/* I3C */ +object_initialize_child (obj,"ioexp-i3c[*]" , &s->i3c, +TYPE_UNIMPLEMENTED_DEVICE ); +/* LTPI controller */ object_initialize_child (obj,"ltpi-ctrl" , &s->ltpi,TYPE_ASPEED_LTPI );
Signature · 1 line
2.43.0
Re: [PATCH v2 15/17] hw/arm/aspeed: Model AST1700 I3C block as unimplemented device
Hello,
+ Joe, Patrick
Quoted 14 lines · Kane Chen
From: Kane-Chen-AS <[email protected]>
AST1700 exposes more I3C buses than the current dummy I3C model provides. When Linux probes the I3C devices on AST1700 this mismatch can trigger a kernel panic. Model the I3C block as an unimplemented device to make the missing functionality explicit and avoid unexpected side effects.
This wires up the I3C interrupt lines for the IO expanders and adds the corresponding device entries for the AST1700 model.
No functional I3C emulation is provided yet; this only prevents crashes and documents the missing piece.
Quoted 7 lines
Signed-off-by Kane-Chen-AS <[email protected]>--- include/hw/arm/aspeed_soc.h | 2 ++ include/hw/misc/aspeed_ast1700.h | 2 ++ hw/arm/aspeed_ast27x0.c | 19 +++++++++++++++++-- hw/misc/aspeed_ast1700.c | 17 +++++++++++++++++ 4 files changed, 38 insertions(+), 2 deletions(-)
Joe sent (twice) changes adding I3C support [1].
I’ve been maintaining it in my branch, and from both a code and testing perspective, it looks solid. I believe it’s ready to be merged. We now just need maintainers and reviewers to step in.
Would it be useful for this model ? If so, that would be an additional reason.
Thanks,
C.
RE: [PATCH v2 15/17] hw/arm/aspeed: Model AST1700 I3C block as unimplemented device
Hi Cédric,
If I use the current I3C model, it causes a kernel crash because the value of ASPEED_I3C_NR_DEVICES is smaller than what AST1700 supports:
https://github.com/qemu/qemu/blob/master/include/hw/misc/aspeed_i3c.h#L21
The AST1700 can support up to 16 I3C buses. In the current I3C model (and in Joe's patches), the value of ASPEED_I3C_NR_DEVICES remains 6, so I would encounter the same issue if I used them directly.
I plan to either increase the value of ASPEED_I3C_NR_DEVICES or add a configurable method to set the number of I3C buses after Joe's patches are merged.
After that, I'll update the AST1700 I3C model to use the new I3C framework.
If you have any comments or suggestions, please let me know.
Best Regards,
Kane
Quoted 56 lines
-----Original Message-----
From: Cédric Le Goater <[email protected]>
Sent: Friday, November 7, 2025 4:06 PM
To: Kane Chen <[email protected]>; Peter Maydell <[email protected]>; Steven Lee <[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]>; Joe Komlodi <[email protected]>; Patrick Leis <[email protected]>
Cc: Troy Lee <[email protected]>
Subject: Re: [PATCH v2 15/17] hw/arm/aspeed: Model AST1700 I3C block as unimplemented deviceHello,
+ Joe, Patrick
Quoted 14 lines · Kane Chen
From: Kane-Chen-AS <[email protected]>
AST1700 exposes more I3C buses than the current dummy I3C model provides. When Linux probes the I3C devices on AST1700 this mismatch can trigger a kernel panic. Model the I3C block as an unimplemented device to make the missing functionality explicit and avoid unexpected side effects.
This wires up the I3C interrupt lines for the IO expanders and adds the corresponding device entries for the AST1700 model.
No functional I3C emulation is provided yet; this only prevents crashes and documents the missing piece.
Quoted 7 lines
Signed-off-by Kane-Chen-AS <[email protected]>--- include/hw/arm/aspeed_soc.h | 2 ++ include/hw/misc/aspeed_ast1700.h | 2 ++ hw/arm/aspeed_ast27x0.c | 19 +++++++++++++++++-- hw/misc/aspeed_ast1700.c | 17 +++++++++++++++++ 4 files changed, 38 insertions(+), 2 deletions(-)Joe sent (twice) changes adding I3C support [1].
I’ve been maintaining it in my branch, and from both a code and testing perspective, it looks solid. I believe it’s ready to be merged. We now just need maintainers and reviewers to step in.
Would it be useful for this model ? If so, that would be an additional reason.
Thanks,
C.
[1]
https://lore.kernel.org/qemu-devel/20250613000411.1516521-1-komlodi@g
oogle.com/
PATCH v2 16/17 hw/arm/aspeed: Model AST1700 SGPIOM block as unimplemented device
In reply to Kane Chen viaFrom: Kane-Chen-AS <[email protected]>
AST1700 includes an SGPIOM block, but QEMU has no functional model yet. Expose it as an unimplemented device so the address space is reserved and the missing functionality is explicit to users/guests.
--- include/hw/misc/aspeed_ast1700.h | 1 + hw/misc/aspeed_ast1700.c | 16 ++++++++++++++++ 2 files changed, 17 insertions(+)
include/hw/misc/aspeed_ast1700.h +1 -0
@@ -44,6 +44,7 @@ struct AspeedAST1700SoCState {AspeedWDTState wdt[AST1700_WDT_NUM ];UnimplementedDeviceState i3c; + UnimplementedDeviceState sgpiom; };#endif /* ASPEED_AST1700_H */
hw/misc/aspeed_ast1700.c +16 -0
@@ -19,6 +19,7 @@#define AST2700_SOC_LTPI_SIZE 0x01000000#define AST1700_SOC_SRAM_SIZE 0x00040000#define AST1700_SOC_I3C_SIZE 0x00010000 +#define AST1700_SOC_SGPIOM_SIZE 0x00002000enum {ASPEED_AST1700_DEV_SPI0 ,
@@ -26,6 +27,7 @@ enum {ASPEED_AST1700_DEV_ADC ,ASPEED_AST1700_DEV_SCU ,ASPEED_AST1700_DEV_GPIO , +ASPEED_AST1700_DEV_SGPIOM ,ASPEED_AST1700_DEV_I2C ,ASPEED_AST1700_DEV_I3C , ASPEED_AST1700_DEV_UART12,
@@ -40,6 +42,7 @@ static const hwaddr aspeed_ast1700_io_memmap[] = { [ASPEED_AST1700_DEV_ADC] = 0x00C00000, [ASPEED_AST1700_DEV_SCU] = 0x00C02000, [ASPEED_AST1700_DEV_GPIO] = 0x00C0B000, + [ASPEED_AST1700_DEV_SGPIOM] = 0x00C0C000, [ASPEED_AST1700_DEV_I2C] = 0x00C0F000, [ASPEED_AST1700_DEV_I3C] = 0x00C20000, [ASPEED_AST1700_DEV_UART12] = 0x00C33B00,
@@ -162,6 +165,15 @@ static void aspeed_ast1700_realize(DeviceState *dev, Error **errp) aspeed_ast1700_io_memmap[ASPEED_AST1700_DEV_LTPI_CTRL ], sysbus_mmio_get_region(SYS_BUS_DEVICE(&s->ltpi), 0)); +/* SGPIOM */ +qdev_prop_set_string (DEVICE (&s->sgpiom),"name" ,"ioexp-sgpiom" ); +qdev_prop_set_uint64 (DEVICE (&s->sgpiom),"size" ,AST1700_SOC_SGPIOM_SIZE ); +sysbus_realize (SYS_BUS_DEVICE (&s->sgpiom), errp); +memory_region_add_subregion_overlap (&s->iomem, + aspeed_ast1700_io_memmap[ASPEED_AST1700_DEV_SGPIOM ], +sysbus_mmio_get_region (SYS_BUS_DEVICE (&s->sgpiom),0 ), +-1000 ); +/* WDT */ for (i =0 ; i <AST1700_WDT_NUM ; i++) {AspeedWDTClass *awc =ASPEED_WDT_GET_CLASS (&s->wdt[i]);
@@ -225,6 +237,10 @@ static void aspeed_ast1700_instance_init(Object *obj)object_initialize_child (obj,"ltpi-ctrl" , &s->ltpi,TYPE_ASPEED_LTPI ); +/* SGPIOM */ +object_initialize_child (obj,"ioexp-sgpiom[*]" , &s->sgpiom, +TYPE_UNIMPLEMENTED_DEVICE ); +/* WDT */ for (i =0 ; i <AST1700_WDT_NUM ; i++) {snprintf (typename,sizeof (typename),"aspeed.wdt-%s" , socname);
Signature · 1 line
2.43.0
Re: [PATCH v2 16/17] hw/arm/aspeed: Model AST1700 SGPIOM block as unimplemented device
Hello,
Quoted 3 lines · Kane Chen
From: Kane-Chen-AS <[email protected]>
AST1700 includes an SGPIOM block, but QEMU has no functional model yet.
Does the series "hw/gpio: Add Aspeed Serial GPIO (SGPIO) controller" [1] proposed by Yubin Zou fill this gap ?
Thanks,
C.
[1] https://lore.kernel.org//qemu-devel/[email protected]
Quoted 76 lines
Expose it as an unimplemented device so the address space is reserved and the missing functionality is explicit to users/guests.
Signed-off-by Kane-Chen-AS <[email protected]>--- include/hw/misc/aspeed_ast1700.h | 1 + hw/misc/aspeed_ast1700.c | 16 ++++++++++++++++ 2 files changed, 17 insertions(+)include/hw/misc/aspeed_ast1700.h +1
-0@@ -44,6 +44,7 @@ struct AspeedAST1700SoCState {AspeedWDTState wdt[AST1700_WDT_NUM ];UnimplementedDeviceState i3c; + UnimplementedDeviceState sgpiom; };#endif /* ASPEED_AST1700_H */ hw/misc/aspeed_ast1700.c +16
-0@@ -19,6 +19,7 @@#define AST2700_SOC_LTPI_SIZE 0x01000000#define AST1700_SOC_SRAM_SIZE 0x00040000#define AST1700_SOC_I3C_SIZE 0x00010000 +#define AST1700_SOC_SGPIOM_SIZE 0x00002000enum {ASPEED_AST1700_DEV_SPI0 ,@@ -26,6 +27,7 @@ enum {ASPEED_AST1700_DEV_ADC ,ASPEED_AST1700_DEV_SCU ,ASPEED_AST1700_DEV_GPIO , +ASPEED_AST1700_DEV_SGPIOM ,ASPEED_AST1700_DEV_I2C ,ASPEED_AST1700_DEV_I3C , ASPEED_AST1700_DEV_UART12,@@ -40,6 +42,7 @@ static const hwaddr aspeed_ast1700_io_memmap[] = { [ASPEED_AST1700_DEV_ADC] = 0x00C00000, [ASPEED_AST1700_DEV_SCU] = 0x00C02000, [ASPEED_AST1700_DEV_GPIO] = 0x00C0B000, + [ASPEED_AST1700_DEV_SGPIOM] = 0x00C0C000, [ASPEED_AST1700_DEV_I2C] = 0x00C0F000, [ASPEED_AST1700_DEV_I3C] = 0x00C20000, [ASPEED_AST1700_DEV_UART12] = 0x00C33B00,@@ -162,6 +165,15 @@ static void aspeed_ast1700_realize(DeviceState *dev, Error **errp) aspeed_ast1700_io_memmap[ASPEED_AST1700_DEV_LTPI_CTRL ], sysbus_mmio_get_region(SYS_BUS_DEVICE(&s->ltpi), 0)); +/* SGPIOM */ +qdev_prop_set_string (DEVICE (&s->sgpiom),"name" ,"ioexp-sgpiom" ); +qdev_prop_set_uint64 (DEVICE (&s->sgpiom),"size" ,AST1700_SOC_SGPIOM_SIZE ); +sysbus_realize (SYS_BUS_DEVICE (&s->sgpiom), errp); +memory_region_add_subregion_overlap (&s->iomem, + aspeed_ast1700_io_memmap[ASPEED_AST1700_DEV_SGPIOM ], +sysbus_mmio_get_region (SYS_BUS_DEVICE (&s->sgpiom),0 ), +-1000 ); +/* WDT */ for (i =0 ; i <AST1700_WDT_NUM ; i++) {AspeedWDTClass *awc =ASPEED_WDT_GET_CLASS (&s->wdt[i]);@@ -225,6 +237,10 @@ static void aspeed_ast1700_instance_init(Object *obj)object_initialize_child (obj,"ltpi-ctrl" , &s->ltpi,TYPE_ASPEED_LTPI ); +/* SGPIOM */ +object_initialize_child (obj,"ioexp-sgpiom[*]" , &s->sgpiom, +TYPE_UNIMPLEMENTED_DEVICE ); +/* WDT */ for (i =0 ; i <AST1700_WDT_NUM ; i++) {snprintf (typename,sizeof (typename),"aspeed.wdt-%s" , socname);
RE: [PATCH v2 16/17] hw/arm/aspeed: Model AST1700 SGPIOM block as unimplemented device
Hi Cédric,
Thanks for the information. I'll investigate this model and integrate it.
Best Regards,
Kane
Quoted 118 lines
-----Original Message-----
From: Cédric Le Goater <[email protected]>
Sent: Tuesday, November 11, 2025 12:15 AM
To: Kane Chen <[email protected]>; Peter Maydell <[email protected]>; Steven Lee <[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]>; Yubin Zou <[email protected]>
Cc: Troy Lee <[email protected]>
Subject: Re: [PATCH v2 16/17] hw/arm/aspeed: Model AST1700 SGPIOM block as unimplemented deviceHello,
Quoted 3 lines · Kane Chen
From: Kane-Chen-AS <[email protected]>
AST1700 includes an SGPIOM block, but QEMU has no functional model yet.
Does the series "hw/gpio: Add Aspeed Serial GPIO (SGPIO) controller" [1] proposed by Yubin Zou fill this gap ?
Thanks,
C.
[1]
https://lore.kernel.org//qemu-devel/20251106-aspeed-sgpio-v1-0-b0260937
[email protected]hw/misc/aspeed_ast1700.c static const hwaddr aspeed_ast1700_io_memmap[] =
Quoted 43 lines
Expose it as an unimplemented device so the address space is reserved and the missing functionality is explicit to users/guests.
Signed-off-by Kane-Chen-AS <[email protected]>--- include/hw/misc/aspeed_ast1700.h | 1 + hw/misc/aspeed_ast1700.c | 16 ++++++++++++++++ 2 files changed, 17 insertions(+)include/hw/misc/aspeed_ast1700.h +1
-0@@ -44,6 +44,7 @@ struct AspeedAST1700SoCState {AspeedWDTState wdt[AST1700_WDT_NUM ];UnimplementedDeviceState i3c; + UnimplementedDeviceState sgpiom; };#endif /* ASPEED_AST1700_H */ hw/misc/aspeed_ast1700.c index renamed from hw/misc/aspeed_ast1700.c +0
-0
37b2946fc0..66a5f21d27100644hw/misc/aspeed_ast1700.c +2
-0@@ -19,6 +19,7 @@#define AST2700_SOC_LTPI_SIZE 0x01000000#define AST1700_SOC_SRAM_SIZE 0x00040000#define AST1700_SOC_I3C_SIZE 0x00010000 +#define AST1700_SOC_SGPIOM_SIZE 0x00002000enum {ASPEED_AST1700_DEV_SPI0 ,@@ -26,6 +27,7 @@ enum {ASPEED_AST1700_DEV_ADC ,ASPEED_AST1700_DEV_SCU ,ASPEED_AST1700_DEV_GPIO , +ASPEED_AST1700_DEV_SGPIOM ,ASPEED_AST1700_DEV_I2C ,ASPEED_AST1700_DEV_I3C , ASPEED_AST1700_DEV_UART12,@@ -40,6 +42,7 @@ static const hwaddr aspeed_ast1700_io_memmap[] ={
hw/misc/aspeed_ast1700.c static void aspeed_ast1700_realize(DeviceState
Quoted 8 lines
hw/misc/aspeed_ast1700.c +1
-0[ASPEED_AST1700_DEV_ADC] = 0x00C00000, [ASPEED_AST1700_DEV_SCU] = 0x00C02000, [ASPEED_AST1700_DEV_GPIO] = 0x00C0B000, + [ASPEED_AST1700_DEV_SGPIOM] = 0x00C0C000, [ASPEED_AST1700_DEV_I2C] = 0x00C0F000, [ASPEED_AST1700_DEV_I3C] = 0x00C20000, [ASPEED_AST1700_DEV_UART12] = 0x00C33B00,@@ -162,6 +165,15 @@ static void aspeed_ast1700_realize(DeviceState*dev, Error **errp)
Quoted 1 line
aspeed_ast1700_io_memmap[ASPEED_AST1700_DEV_LTPI_CTRL],
hw/misc/aspeed_ast1700.c static void aspeed_ast1700_realize(DeviceState *dev, Error **errp)
Quoted 6 lines
sysbus_mmio_get_region(SYS_BUS_DEVICE(&s->ltpi), 0));hw/misc/aspeed_ast1700.c +3
-0+/* SGPIOM */ +qdev_prop_set_string (DEVICE (&s->sgpiom),"name" ,"ioexp-sgpiom" ); + qdev_prop_set_uint64(DEVICE(&s->sgpiom), "size",
AST1700_SOC_SGPIOM_SIZE);hw/misc/aspeed_ast1700.c static void aspeed_ast1700_realize(DeviceState *dev, Error **errp) · line 176
Quoted 3 lines
hw/misc/aspeed_ast1700.c +3
-0+sysbus_realize (SYS_BUS_DEVICE (&s->sgpiom), errp); + memory_region_add_subregion_overlap(&s->iomem, +aspeed_ast1700_io_memmap[ASPEED_AST1700_DEV_SGPIOM],
Quoted 1 line
+
sysbus_mmio_get_region(SYS_BUS_DEVICE(&s->sgpiom), 0),hw/misc/aspeed_ast1700.c static void aspeed_ast1700_realize(DeviceState *dev, Error **errp)
Quoted 5 lines
hw/misc/aspeed_ast1700.c +2
-0+ -1000); +/* WDT */ for (i =0 ; i <AST1700_WDT_NUM ; i++) { AspeedWDTClass *awc =
ASPEED_WDT_GET_CLASS(&s->wdt[i]); @@Quoted 12 lines
-225,6 +237,10 @@ static void
aspeed_ast1700_instance_init(Object *obj)object_initialize_child(obj, "ltpi-ctrl", &s->ltpi, TYPE_ASPEED_LTPI);hw/misc/aspeed_ast1700.c +4
-0+/* SGPIOM */ +object_initialize_child (obj,"ioexp-sgpiom[*]" , &s->sgpiom, +TYPE_UNIMPLEMENTED_DEVICE ); +/* WDT */ for (i =0 ; i <AST1700_WDT_NUM ; i++) { snprintf(typename, sizeof(typename), "aspeed.wdt-%s",socname);
Re: [PATCH v2 16/17] hw/arm/aspeed: Model AST1700 SGPIOM block as unimplemented device
Hello,
Quoted 3 lines · Kane Chen
Hi Cédric,
Thanks for the information. I'll investigate this model and integrate it.
Help with reviewing is welcome !
Thanks,
C.
Quoted 122 lines
Best Regards,
KaneQuoted 118 lines
-----Original Message-----
From: Cédric Le Goater <[email protected]>
Sent: Tuesday, November 11, 2025 12:15 AM
To: Kane Chen <[email protected]>; Peter Maydell <[email protected]>; Steven Lee <[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]>; Yubin Zou <[email protected]>
Cc: Troy Lee <[email protected]>
Subject: Re: [PATCH v2 16/17] hw/arm/aspeed: Model AST1700 SGPIOM block as unimplemented deviceHello,
Quoted 3 lines · Kane Chen
From: Kane-Chen-AS <[email protected]>
AST1700 includes an SGPIOM block, but QEMU has no functional model yet.
Does the series "hw/gpio: Add Aspeed Serial GPIO (SGPIO) controller" [1] proposed by Yubin Zou fill this gap ?
Thanks,
C.
[1]
https://lore.kernel.org//qemu-devel/20251106-aspeed-sgpio-v1-0-b0260937
[email protected]hw/misc/aspeed_ast1700.c static const hwaddr aspeed_ast1700_io_memmap[] =
Quoted 43 lines
Expose it as an unimplemented device so the address space is reserved and the missing functionality is explicit to users/guests.
Signed-off-by Kane-Chen-AS <[email protected]>--- include/hw/misc/aspeed_ast1700.h | 1 + hw/misc/aspeed_ast1700.c | 16 ++++++++++++++++ 2 files changed, 17 insertions(+)include/hw/misc/aspeed_ast1700.h +1
-0@@ -44,6 +44,7 @@ struct AspeedAST1700SoCState {AspeedWDTState wdt[AST1700_WDT_NUM ];UnimplementedDeviceState i3c; + UnimplementedDeviceState sgpiom; };#endif /* ASPEED_AST1700_H */ hw/misc/aspeed_ast1700.c index renamed from hw/misc/aspeed_ast1700.c +0
-0
37b2946fc0..66a5f21d27100644hw/misc/aspeed_ast1700.c +2
-0@@ -19,6 +19,7 @@#define AST2700_SOC_LTPI_SIZE 0x01000000#define AST1700_SOC_SRAM_SIZE 0x00040000#define AST1700_SOC_I3C_SIZE 0x00010000 +#define AST1700_SOC_SGPIOM_SIZE 0x00002000enum {ASPEED_AST1700_DEV_SPI0 ,@@ -26,6 +27,7 @@ enum {ASPEED_AST1700_DEV_ADC ,ASPEED_AST1700_DEV_SCU ,ASPEED_AST1700_DEV_GPIO , +ASPEED_AST1700_DEV_SGPIOM ,ASPEED_AST1700_DEV_I2C ,ASPEED_AST1700_DEV_I3C , ASPEED_AST1700_DEV_UART12,@@ -40,6 +42,7 @@ static const hwaddr aspeed_ast1700_io_memmap[] ={
hw/misc/aspeed_ast1700.c static void aspeed_ast1700_realize(DeviceState
Quoted 8 lines
hw/misc/aspeed_ast1700.c +1
-0[ASPEED_AST1700_DEV_ADC] = 0x00C00000, [ASPEED_AST1700_DEV_SCU] = 0x00C02000, [ASPEED_AST1700_DEV_GPIO] = 0x00C0B000, + [ASPEED_AST1700_DEV_SGPIOM] = 0x00C0C000, [ASPEED_AST1700_DEV_I2C] = 0x00C0F000, [ASPEED_AST1700_DEV_I3C] = 0x00C20000, [ASPEED_AST1700_DEV_UART12] = 0x00C33B00,@@ -162,6 +165,15 @@ static void aspeed_ast1700_realize(DeviceState*dev, Error **errp)
Quoted 1 line
aspeed_ast1700_io_memmap[ASPEED_AST1700_DEV_LTPI_CTRL],
hw/misc/aspeed_ast1700.c static void aspeed_ast1700_realize(DeviceState *dev, Error **errp)
Quoted 6 lines
sysbus_mmio_get_region(SYS_BUS_DEVICE(&s->ltpi), 0));hw/misc/aspeed_ast1700.c +3
-0+/* SGPIOM */ +qdev_prop_set_string (DEVICE (&s->sgpiom),"name" ,"ioexp-sgpiom" ); + qdev_prop_set_uint64(DEVICE(&s->sgpiom), "size",
AST1700_SOC_SGPIOM_SIZE);hw/misc/aspeed_ast1700.c static void aspeed_ast1700_realize(DeviceState *dev, Error **errp) · line 176
Quoted 3 lines
hw/misc/aspeed_ast1700.c +3
-0+sysbus_realize (SYS_BUS_DEVICE (&s->sgpiom), errp); + memory_region_add_subregion_overlap(&s->iomem, +aspeed_ast1700_io_memmap[ASPEED_AST1700_DEV_SGPIOM],
Quoted 1 line
+
sysbus_mmio_get_region(SYS_BUS_DEVICE(&s->sgpiom), 0),hw/misc/aspeed_ast1700.c static void aspeed_ast1700_realize(DeviceState *dev, Error **errp)
Quoted 5 lines
hw/misc/aspeed_ast1700.c +2
-0+ -1000); +/* WDT */ for (i =0 ; i <AST1700_WDT_NUM ; i++) { AspeedWDTClass *awc =
ASPEED_WDT_GET_CLASS(&s->wdt[i]); @@Quoted 12 lines
-225,6 +237,10 @@ static void
aspeed_ast1700_instance_init(Object *obj)object_initialize_child(obj, "ltpi-ctrl", &s->ltpi, TYPE_ASPEED_LTPI);hw/misc/aspeed_ast1700.c +4
-0+/* SGPIOM */ +object_initialize_child (obj,"ioexp-sgpiom[*]" , &s->sgpiom, +TYPE_UNIMPLEMENTED_DEVICE ); +/* WDT */ for (i =0 ; i <AST1700_WDT_NUM ; i++) { snprintf(typename, sizeof(typename), "aspeed.wdt-%s",socname);
PATCH v2 17/17 hw/arm/aspeed: Model AST1700 PWM block as unimplemented device
In reply to Kane Chen viaFrom: Kane-Chen-AS <[email protected]>
AST1700 includes an PWM block, but QEMU has no functional model for aspeed product yet. Expose it as an unimplemented device so the address space is reserved and the missing functionality is explicit to users/guests.
--- include/hw/misc/aspeed_ast1700.h | 1 + hw/misc/aspeed_ast1700.c | 16 ++++++++++++++++ 2 files changed, 17 insertions(+)
include/hw/misc/aspeed_ast1700.h +1 -0
@@ -45,6 +45,7 @@ struct AspeedAST1700SoCState {UnimplementedDeviceState i3c;UnimplementedDeviceState sgpiom; + UnimplementedDeviceState pwm; };#endif /* ASPEED_AST1700_H */
hw/misc/aspeed_ast1700.c +16 -0
@@ -20,9 +20,11 @@#define AST1700_SOC_SRAM_SIZE 0x00040000#define AST1700_SOC_I3C_SIZE 0x00010000#define AST1700_SOC_SGPIOM_SIZE 0x00002000 +#define AST1700_SOC_PWM_SIZE 0x00000200enum {ASPEED_AST1700_DEV_SPI0 , +ASPEED_AST1700_DEV_PWM ,ASPEED_AST1700_DEV_SRAM ,ASPEED_AST1700_DEV_ADC ,ASPEED_AST1700_DEV_SCU ,
@@ -38,6 +40,7 @@ enum {static const hwaddr aspeed_ast1700_io_memmap[] = { [ASPEED_AST1700_DEV_SPI0 ] =0x00030000 , + [ASPEED_AST1700_DEV_PWM ] =0x000C0000 , [ASPEED_AST1700_DEV_SRAM ] =0x00BC0000 , [ASPEED_AST1700_DEV_ADC ] =0x00C00000 , [ASPEED_AST1700_DEV_SCU ] =0x00C02000 ,
@@ -174,6 +177,15 @@ static void aspeed_ast1700_realize(DeviceState *dev, Error **errp)sysbus_mmio_get_region (SYS_BUS_DEVICE (&s->sgpiom),0 ), -1000); +/* PWM */ +qdev_prop_set_string (DEVICE (&s->pwm),"name" ,"ioexp-pwm" ); +qdev_prop_set_uint64 (DEVICE (&s->pwm),"size" ,AST1700_SOC_PWM_SIZE ); +sysbus_realize (SYS_BUS_DEVICE (&s->pwm), errp); +memory_region_add_subregion_overlap (&s->iomem, + aspeed_ast1700_io_memmap[ASPEED_AST1700_DEV_PWM ], +sysbus_mmio_get_region (SYS_BUS_DEVICE (&s->pwm),0 ), +-1000 ); +/* WDT */ for (i =0 ; i <AST1700_WDT_NUM ; i++) {AspeedWDTClass *awc =ASPEED_WDT_GET_CLASS (&s->wdt[i]);
@@ -241,6 +253,10 @@ static void aspeed_ast1700_instance_init(Object *obj)object_initialize_child (obj,"ioexp-sgpiom[*]" , &s->sgpiom,TYPE_UNIMPLEMENTED_DEVICE ); +/* PWM */ +object_initialize_child (obj,"ioexp-pwm" , &s->pwm, +TYPE_UNIMPLEMENTED_DEVICE ); +/* WDT */ for (i =0 ; i <AST1700_WDT_NUM ; i++) {snprintf (typename,sizeof (typename),"aspeed.wdt-%s" , socname);
Signature · 1 line
2.43.0
Re: [PATCH v2 17/17] hw/arm/aspeed: Model AST1700 PWM block as unimplemented device
Quoted 4 lines · Kane Chen
From: Kane-Chen-AS <[email protected]>
AST1700 includes an PWM block, but QEMU has no functional model for aspeed product yet.
We could start with a dummy PWM model :
https://github.com/legoater/qemu/commit/9d77c84b04c2d9ae5685b3ccb5c434873666ca78
Feel free to add to your series.
Thanks,
C.
Expose it as an unimplemented device so the
Quoted 72 lines
address space is reserved and the missing functionality is explicit to users/guests.
Signed-off-by Kane-Chen-AS <[email protected]>--- include/hw/misc/aspeed_ast1700.h | 1 + hw/misc/aspeed_ast1700.c | 16 ++++++++++++++++ 2 files changed, 17 insertions(+)include/hw/misc/aspeed_ast1700.h +1
-0@@ -45,6 +45,7 @@ struct AspeedAST1700SoCState {UnimplementedDeviceState i3c;UnimplementedDeviceState sgpiom; + UnimplementedDeviceState pwm; };#endif /* ASPEED_AST1700_H */ hw/misc/aspeed_ast1700.c +16
-0@@ -20,9 +20,11 @@#define AST1700_SOC_SRAM_SIZE 0x00040000#define AST1700_SOC_I3C_SIZE 0x00010000#define AST1700_SOC_SGPIOM_SIZE 0x00002000 +#define AST1700_SOC_PWM_SIZE 0x00000200enum {ASPEED_AST1700_DEV_SPI0 , +ASPEED_AST1700_DEV_PWM ,ASPEED_AST1700_DEV_SRAM ,ASPEED_AST1700_DEV_ADC ,ASPEED_AST1700_DEV_SCU ,@@ -38,6 +40,7 @@ enum {static const hwaddr aspeed_ast1700_io_memmap[] = { [ASPEED_AST1700_DEV_SPI0 ] =0x00030000 , + [ASPEED_AST1700_DEV_PWM ] =0x000C0000 , [ASPEED_AST1700_DEV_SRAM ] =0x00BC0000 , [ASPEED_AST1700_DEV_ADC ] =0x00C00000 , [ASPEED_AST1700_DEV_SCU ] =0x00C02000 ,@@ -174,6 +177,15 @@ static void aspeed_ast1700_realize(DeviceState *dev, Error **errp)sysbus_mmio_get_region (SYS_BUS_DEVICE (&s->sgpiom),0 ), -1000); +/* PWM */ +qdev_prop_set_string (DEVICE (&s->pwm),"name" ,"ioexp-pwm" ); +qdev_prop_set_uint64 (DEVICE (&s->pwm),"size" ,AST1700_SOC_PWM_SIZE ); +sysbus_realize (SYS_BUS_DEVICE (&s->pwm), errp); +memory_region_add_subregion_overlap (&s->iomem, + aspeed_ast1700_io_memmap[ASPEED_AST1700_DEV_PWM ], +sysbus_mmio_get_region (SYS_BUS_DEVICE (&s->pwm),0 ), +-1000 ); +/* WDT */ for (i =0 ; i <AST1700_WDT_NUM ; i++) {AspeedWDTClass *awc =ASPEED_WDT_GET_CLASS (&s->wdt[i]);@@ -241,6 +253,10 @@ static void aspeed_ast1700_instance_init(Object *obj)object_initialize_child (obj,"ioexp-sgpiom[*]" , &s->sgpiom,TYPE_UNIMPLEMENTED_DEVICE ); +/* PWM */ +object_initialize_child (obj,"ioexp-pwm" , &s->pwm, +TYPE_UNIMPLEMENTED_DEVICE ); +/* WDT */ for (i =0 ; i <AST1700_WDT_NUM ; i++) {snprintf (typename,sizeof (typename),"aspeed.wdt-%s" , socname);
RE: [PATCH v2 17/17] hw/arm/aspeed: Model AST1700 PWM block as unimplemented device
Hi Cédric,
Thanks for the information. I'll try integrating this PWM model.
Best Regards,
Kane
Quoted 114 lines
-----Original Message-----
From: Cédric Le Goater <[email protected]>
Sent: Tuesday, November 11, 2025 12:17 AM
To: Kane Chen <[email protected]>; Peter Maydell <[email protected]>; Steven Lee <[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]>
Subject: Re: [PATCH v2 17/17] hw/arm/aspeed: Model AST1700 PWM block as unimplemented deviceQuoted 4 lines · Kane Chen
From: Kane-Chen-AS <[email protected]>
AST1700 includes an PWM block, but QEMU has no functional model for aspeed product yet.
We could start with a dummy PWM model :
https://github.com/legoater/qemu/commit/9d77c84b04c2d9ae5685b3ccb5c4
34873666ca78Feel free to add to your series.
Thanks,
C.
Expose it as an unimplemented device so the
hw/misc/aspeed_ast1700.c static void aspeed_ast1700_realize(DeviceState
Quoted 47 lines
address space is reserved and the missing functionality is explicit to users/guests.
Signed-off-by Kane-Chen-AS <[email protected]>--- include/hw/misc/aspeed_ast1700.h | 1 + hw/misc/aspeed_ast1700.c | 16 ++++++++++++++++ 2 files changed, 17 insertions(+)include/hw/misc/aspeed_ast1700.h +1
-0@@ -45,6 +45,7 @@ struct AspeedAST1700SoCState {UnimplementedDeviceState i3c;UnimplementedDeviceState sgpiom; + UnimplementedDeviceState pwm; };#endif /* ASPEED_AST1700_H */ hw/misc/aspeed_ast1700.c index renamed from hw/misc/aspeed_ast1700.c +0
-0
66a5f21d27..3d9a920a7a100644hw/misc/aspeed_ast1700.c +3
-0@@ -20,9 +20,11 @@#define AST1700_SOC_SRAM_SIZE 0x00040000#define AST1700_SOC_I3C_SIZE 0x00010000#define AST1700_SOC_SGPIOM_SIZE 0x00002000 +#define AST1700_SOC_PWM_SIZE 0x00000200enum {ASPEED_AST1700_DEV_SPI0 , +ASPEED_AST1700_DEV_PWM ,ASPEED_AST1700_DEV_SRAM ,ASPEED_AST1700_DEV_ADC ,ASPEED_AST1700_DEV_SCU ,@@ -38,6 +40,7 @@ enum {static const hwaddr aspeed_ast1700_io_memmap[] = { [ASPEED_AST1700_DEV_SPI0 ] =0x00030000 , + [ASPEED_AST1700_DEV_PWM ] =0x000C0000 , [ASPEED_AST1700_DEV_SRAM ] =0x00BC0000 , [ASPEED_AST1700_DEV_ADC ] =0x00C00000 , [ASPEED_AST1700_DEV_SCU ] =0x00C02000 ,@@ -174,6 +177,15 @@ static void aspeed_ast1700_realize(DeviceState*dev, Error **errp)
Quoted 1 line
sysbus_mmio_get_region(SYS_BUS_DEVICE(&s->sgpiom), 0),hw/misc/aspeed_ast1700.c static void aspeed_ast1700_realize(DeviceState *dev, Error **errp)
Quoted 5 lines
-1000);hw/misc/aspeed_ast1700.c +3
-0+/* PWM */ +qdev_prop_set_string (DEVICE (&s->pwm),"name" ,"ioexp-pwm" ); + qdev_prop_set_uint64(DEVICE(&s->pwm), "size",
AST1700_SOC_PWM_SIZE);hw/misc/aspeed_ast1700.c static void aspeed_ast1700_realize(DeviceState *dev, Error **errp) · line 188
Quoted 3 lines
hw/misc/aspeed_ast1700.c +3
-0+sysbus_realize (SYS_BUS_DEVICE (&s->pwm), errp); + memory_region_add_subregion_overlap(&s->iomem, +aspeed_ast1700_io_memmap[ASPEED_AST1700_DEV_PWM],
Quoted 1 line
+
sysbus_mmio_get_region(SYS_BUS_DEVICE(&s->pwm), 0),hw/misc/aspeed_ast1700.c static void aspeed_ast1700_realize(DeviceState *dev, Error **errp)
Quoted 5 lines
hw/misc/aspeed_ast1700.c +2
-0+ -1000); +/* WDT */ for (i =0 ; i <AST1700_WDT_NUM ; i++) { AspeedWDTClass *awc =
ASPEED_WDT_GET_CLASS(&s->wdt[i]); @@Quoted 12 lines
-241,6 +253,10 @@ static void
aspeed_ast1700_instance_init(Object *obj)object_initialize_child(obj, "ioexp-sgpiom[*]", &s->sgpiom, TYPE_UNIMPLEMENTED_DEVICE);hw/misc/aspeed_ast1700.c +4
-0+/* PWM */ +object_initialize_child (obj,"ioexp-pwm" , &s->pwm, +TYPE_UNIMPLEMENTED_DEVICE ); +/* WDT */ for (i =0 ; i <AST1700_WDT_NUM ; i++) { snprintf(typename, sizeof(typename), "aspeed.wdt-%s",socname);
Quoted 37 lines · Kane Chen
From: Kane-Chen-AS <[email protected]>
Hi all,
LTPI (LVDS Tunneling Protocol & Interface) is defined in the OCP DC-SCM 2.0 specification (see Figure 2):
https://www.opencompute.org/documents/ocp-dc-scm-2-0-ltpi-ver-1-0-pdfLTPI provides a protocol and physical interface for tunneling various low-speed signals between the Host Processor Module (HPM) and the Satellite Controller Module (SCM). In Figure 2 of the specification, the AST27x0 SoC (left) integrates two LTPI controllers, allowing it to connect to up to two AST1700 boards. On the other side, the AST1700 consolidates HPM FPGA functions and multiple peripheral interfaces (GPIO, UART, I2C, I3C, etc.) onto a single board.
Because the AST1700 exposes additional I/O interfaces (GPIO, I2C, I3C, and others), it acts as an I/O expander. Once connected over LTPI, the AST27x0 can control additional downstream devices through this link.
This patch series introduces a basic LTPI controller model and wires it into the AST27x0 SoC. It also adds the AST1700-specific LTPI expander device and gradually connects common peripherals on the AST1700 model. For blocks that are not yet functionally implemented (I3C, SGPIOM, PWM), their MMIO regions are modeled as unimplemented devices to reserve address space and make the missing functionality explicit, ensuring that guest probing remains stable.
In the official release images, the AST1700 functions are not included by default. To test the AST1700-related functionality, please include the following DTS files for probing:
https://github.com/AspeedTech-BMC/linux/blob/aspeed-master-v6.6/arch/arm64/boot/dts/aspeed/aspeed-ltpi0.dtsi
https://github.com/AspeedTech-BMC/linux/blob/aspeed-master-v6.6/arch/arm64/boot/dts/aspeed/aspeed-ltpi1.dtsiAfter including these DTS files in the BMC image, you can verify LTPI functionality using the following scenarios:
Quoted 9 lines
1. In U-Boot:
Run the ltpi command to trigger the LTPI connection and display the current connection status.
2. In BMC Linux:
Run i2cdetect -y <16-38> to scan and test the I2C buses exposed by the AST1700.Any feedback or suggestions are appreciated!
Thanks for the update. The models look better. Let's consider them for QEMU 11.0.
Did you run "make check" and "make check-functional" ?
Thanks,
C.
Hi Cédric,
I haven't run the "make check" or "make check-functional" tests yet, but I did verify that QEMU could boot the official image properly after applying each patch. I'll run the tests soon, and if I find anything, I'll let you know.
Best Regards,
Kane
Quoted 76 lines
-----Original Message-----
From: Cédric Le Goater <[email protected]>
Sent: Wednesday, November 5, 2025 6:27 PM
To: Kane Chen <[email protected]>; Peter Maydell <[email protected]>; Steven Lee <[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]>
Subject: Re: [PATCH v2 00/17] hw/arm/aspeed: AST1700 LTPI support and device hookupsQuoted 17 lines · Kane Chen
From: Kane-Chen-AS <[email protected]>
Hi all,
LTPI (LVDS Tunneling Protocol & Interface) is defined in the OCP DC-SCM
2.0 specification (see Figure 2):
https://www.opencompute.org/documents/ocp-dc-scm-2-0-ltpi-ver-1-0-pdfLTPI provides a protocol and physical interface for tunneling various low-speed signals between the Host Processor Module (HPM) and the Satellite Controller Module (SCM). In Figure 2 of the specification, the AST27x0 SoC (left) integrates two LTPI controllers, allowing it to connect to up to two AST1700 boards. On the other side, the AST1700 consolidates HPM FPGA functions and multiple peripheral interfaces (GPIO, UART, I2C, I3C, etc.) onto a single board.
Quoted 7 lines
Because the AST1700 exposes additional I/O interfaces (GPIO, I2C, I3C, and others), it acts as an I/O expander. Once connected over LTPI, the AST27x0 can control additional downstream devices through this link.
This patch series introduces a basic LTPI controller model and wires it into the AST27x0 SoC. It also adds the AST1700-specific LTPI expander device and gradually connects common peripherals on the
AST1700 model.
Quoted 9 lines
For blocks that are not yet functionally implemented (I3C, SGPIOM, PWM), their MMIO regions are modeled as unimplemented devices to reserve address space and make the missing functionality explicit, ensuring that guest probing remains stable.
In the official release images, the AST1700 functions are not included by default. To test the AST1700-related functionality, please include the following DTS files for probing:
https://github.com/AspeedTech-BMC/linux/blob/aspeed-master-v6.6/arch/a
Quoted 2 lines
rm64/boot/dts/aspeed/aspeed-ltpi0.dtsihttps://github.com/AspeedTech-BMC/linux/blob/aspeed-master-v6.6/arch/a
Quoted 5 lines
rm64/boot/dts/aspeed/aspeed-ltpi1.dtsiAfter including these DTS files in the BMC image, you can verify LTPI functionality using the following scenarios:
Quoted 9 lines
1. In U-Boot:
Run the ltpi command to trigger the LTPI connection and display the current connection status.
2. In BMC Linux:
Run i2cdetect -y <16-38> to scan and test the I2C buses exposed by the AST1700.Any feedback or suggestions are appreciated!
Thanks for the update. The models look better. Let's consider them for QEMU 11.0.
Did you run "make check" and "make check-functional" ?
Thanks,
C.
Quoted 20 lines · Kane Chen
From: Kane-Chen-AS <[email protected]>
Hi all,
LTPI (LVDS Tunneling Protocol & Interface) is defined in the OCP DC-SCM 2.0 specification (see Figure 2):
https://www.opencompute.org/documents/ocp-dc-scm-2-0-ltpi-ver-1-0-pdfLTPI provides a protocol and physical interface for tunneling various low-speed signals between the Host Processor Module (HPM) and the Satellite Controller Module (SCM). In Figure 2 of the specification, the AST27x0 SoC (left) integrates two LTPI controllers, allowing it to connect to up to two AST1700 boards. On the other side, the AST1700 consolidates HPM FPGA functions and multiple peripheral interfaces (GPIO, UART, I2C, I3C, etc.) onto a single board.
Because the AST1700 exposes additional I/O interfaces (GPIO, I2C, I3C, and others), it acts as an I/O expander. Once connected over LTPI, the AST27x0 can control additional downstream devices through this link.
Quoted 7 lines
This patch series introduces a basic LTPI controller model and wires it into the AST27x0 SoC. It also adds the AST1700-specific LTPI expander device and gradually connects common peripherals on the AST1700 model. For blocks that are not yet functionally implemented (I3C, SGPIOM, PWM), their MMIO regions are modeled as unimplemented devices to reserve address space and make the missing functionality explicit, ensuring that guest probing remains stable.
Thanks for the improved cover letter.
Quoted 5 lines
In the official release images, the AST1700 functions are not included by default. To test the AST1700-related functionality, please include the following DTS files for probing:
https://github.com/AspeedTech-BMC/linux/blob/aspeed-master-v6.6/arch/arm64/boot/dts/aspeed/aspeed-ltpi0.dtsi
https://github.com/AspeedTech-BMC/linux/blob/aspeed-master-v6.6/arch/arm64/boot/dts/aspeed/aspeed-ltpi1.dtsi
Is a release planned ?
Quoted 9 lines
After including these DTS files in the BMC image, you can verify LTPI functionality using the following scenarios:
1. In U-Boot:
Run the ltpi command to trigger the LTPI connection and display the current connection status.
2. In BMC Linux:
Run i2cdetect -y <16-38> to scan and test the I2C buses exposed by the AST1700.
because this would be good to have for functional tests.
Quoted 2 lines
Any feedback or suggestions are appreciated!
The AST1700 model is rather big and very similar to a SoC, without CPUs. Perhaps we should move the model under hw/arm instead ?
Thanks,
C.
Quoted 48 lines
Kane
---ChangeLog
---------
v2:
- Separate the AST1700 model into a standalone implementation
- Refine the mechanism for assigning the AST1700 board numberv1:
- Initial version
---Kane-Chen-AS (17):
hw/arm/aspeed: Add LTPI controller
hw/arm/aspeed: Attach LTPI controller to AST27X0 platform hw/arm/aspeed: Add AST1700 LTPI expander device model hw/arm/aspeed: Integrate AST1700 device into AST27X0 hw/arm/aspeed: Integrate interrupt controller for AST1700 hw/arm/aspeed: Attach LTPI controller to AST1700 model hw/arm/aspeed: Attach UART device to AST1700 model hw/arm/aspeed: Attach SRAM device to AST1700 model hw/arm/aspeed: Attach SPI device to AST1700 model hw/arm/aspeed: Attach ADC device to AST1700 model hw/arm/aspeed: Attach SCU device to AST1700 model hw/arm/aspeed: Attach GPIO device to AST1700 model hw/arm/aspeed: Attach I2C device to AST1700 model hw/arm/aspeed: Attach WDT device to AST1700 model hw/arm/aspeed: Model AST1700 I3C block as unimplemented device hw/arm/aspeed: Model AST1700 SGPIOM block as unimplemented device hw/arm/aspeed: Model AST1700 PWM block as unimplemented deviceinclude/hw/arm/aspeed_soc.h | 20 +- include/hw/intc/aspeed_intc.h | 2 + include/hw/misc/aspeed_ast1700.h | 51 ++++++ include/hw/misc/aspeed_ltpi.h | 25 +++ hw/arm/aspeed_ast27x0.c | 154 ++++++++++++++-- hw/intc/aspeed_intc.c | 60 ++++++ hw/misc/aspeed_ast1700.c | 303 +++++++++++++++++++++++++++++++ hw/misc/aspeed_ltpi.c | 98 ++++++++++ hw/misc/meson.build | 2 + 9 files changed, 700 insertions(+), 15 deletions(-)create mode 100644
include/hw/misc/aspeed_ast1700.hcreate mode 100644include/hw/misc/aspeed_ltpi.hcreate mode 100644hw/misc/aspeed_ast1700.ccreate mode 100644hw/misc/aspeed_ltpi.c
Hi Cédric,
In the short term, there's no plan to release an image that includes the AST1700. Once such an image becomes available, I'll submit a patch series for functional testing.
I'll also try moving the AST1700 code to the hw/arm directory. If I encounter any Issues during this process, I'll let you know.
Best regards,
Kane
Quoted 132 lines
-----Original Message-----
From: Cédric Le Goater <[email protected]>
Sent: Tuesday, November 11, 2025 12:44 AM
To: Kane Chen <[email protected]>; Peter Maydell <[email protected]>; Steven Lee <[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]>
Subject: Re: [PATCH v2 00/17] hw/arm/aspeed: AST1700 LTPI support and device hookupsQuoted 17 lines · Kane Chen
From: Kane-Chen-AS <[email protected]>
Hi all,
LTPI (LVDS Tunneling Protocol & Interface) is defined in the OCP DC-SCM
2.0 specification (see Figure 2):
https://www.opencompute.org/documents/ocp-dc-scm-2-0-ltpi-ver-1-0-pdfLTPI provides a protocol and physical interface for tunneling various low-speed signals between the Host Processor Module (HPM) and the Satellite Controller Module (SCM). In Figure 2 of the specification, the AST27x0 SoC (left) integrates two LTPI controllers, allowing it to connect to up to two AST1700 boards. On the other side, the AST1700 consolidates HPM FPGA functions and multiple peripheral interfaces (GPIO, UART, I2C, I3C, etc.) onto a single board.
Quoted 7 lines
Because the AST1700 exposes additional I/O interfaces (GPIO, I2C, I3C, and others), it acts as an I/O expander. Once connected over LTPI, the AST27x0 can control additional downstream devices through this link.
This patch series introduces a basic LTPI controller model and wires it into the AST27x0 SoC. It also adds the AST1700-specific LTPI expander device and gradually connects common peripherals on the
AST1700 model.
Quoted 4 lines
For blocks that are not yet functionally implemented (I3C, SGPIOM, PWM), their MMIO regions are modeled as unimplemented devices to reserve address space and make the missing functionality explicit, ensuring that guest probing remains stable.
Thanks for the improved cover letter.
Quoted 4 lines
In the official release images, the AST1700 functions are not included by default. To test the AST1700-related functionality, please include the following DTS files for probing:
https://github.com/AspeedTech-BMC/linux/blob/aspeed-master-v6.6/arch/a
Quoted 2 lines
rm64/boot/dts/aspeed/aspeed-ltpi0.dtsihttps://github.com/AspeedTech-BMC/linux/blob/aspeed-master-v6.6/arch/a
Quoted 1 line
rm64/boot/dts/aspeed/aspeed-ltpi1.dtsiIs a release planned ?
Quoted 9 lines
After including these DTS files in the BMC image, you can verify LTPI functionality using the following scenarios:
1. In U-Boot:
Run the ltpi command to trigger the LTPI connection and display the current connection status.
2. In BMC Linux:
Run i2cdetect -y <16-38> to scan and test the I2C buses exposed by the AST1700.because this would be good to have for functional tests.
Quoted 2 lines
Any feedback or suggestions are appreciated!
The AST1700 model is rather big and very similar to a SoC, without CPUs. Perhaps we should move the model under hw/arm instead ?
Thanks,
C.
Quoted 23 lines
Kane
---ChangeLog
---------
v2:
- Separate the AST1700 model into a standalone implementation
- Refine the mechanism for assigning the AST1700 board numberv1:
- Initial version
---Kane-Chen-AS (17):
hw/arm/aspeed: Add LTPI controller hw/arm/aspeed: Attach LTPI controller to AST27X0 platform hw/arm/aspeed: Add AST1700 LTPI expander device model hw/arm/aspeed: Integrate AST1700 device into AST27X0 hw/arm/aspeed: Integrate interrupt controller for AST1700 hw/arm/aspeed: Attach LTPI controller to AST1700 model hw/arm/aspeed: Attach UART device to AST1700 model hw/arm/aspeed: Attach SRAM device to AST1700 modelQuoted 8 lines
hw/arm/aspeed: Attach SPI device to AST1700 model hw/arm/aspeed: Attach ADC device to AST1700 model hw/arm/aspeed: Attach SCU device to AST1700 model hw/arm/aspeed: Attach GPIO device to AST1700 model hw/arm/aspeed: Attach I2C device to AST1700 model hw/arm/aspeed: Attach WDT device to AST1700 model hw/arm/aspeed: Model AST1700 I3C block as unimplemented device hw/arm/aspeed: Model AST1700 SGPIOM block as unimplemented
device
Quoted 9 lines
hw/arm/aspeed: Model AST1700 PWM block as unimplemented device
include/hw/arm/aspeed_soc.h | 20 +- include/hw/intc/aspeed_intc.h | 2 + include/hw/misc/aspeed_ast1700.h | 51 ++++++ include/hw/misc/aspeed_ltpi.h | 25 +++ hw/arm/aspeed_ast27x0.c | 154 ++++++++++++++-- hw/intc/aspeed_intc.c | 60 ++++++ hw/misc/aspeed_ast1700.c | 303+++++++++++++++++++++++++++++++
Quoted 8 lines
hw/misc/aspeed_ltpi.c | 98 ++++++++++ hw/misc/meson.build | 2 + 9 files changed, 700 insertions(+), 15 deletions(-)create mode 100644
include/hw/misc/aspeed_ast1700.hcreate mode 100644include/hw/misc/aspeed_ltpi.hcreate mode 100644hw/misc/aspeed_ast1700.ccreate mode 100644hw/misc/aspeed_ltpi.c