aspeed queue
The following changes since commit d5b5083cb783c447001e862c2b525e59f48ad78c:
Merge tag 'block-pull-request' of https://gitlab.com/stefanha/qemu into staging (2026-10-15 11:53:41 +0200)
are available in the Git repository at:
https://github.com/legoater/qemu/ tags/pull-aspeed-20261015
for you to fetch changes up to 4cf1f0e37d9491eb8b0c8be8dd9dab9260b8fa36:
tests/functional: give the set_machine probe VM the test workdir (2026-10-15 13:14:09 +0200)
----------------------------------------------------------------
aspeed queue:
* Fix OOB read in HACE has_padding() when padding_size is zero
* Allocate ACRY RSA qtest SRAM buffers on the heap to reduce stack usage
* Consolidate OTP layout definitions between aspeed_otp and aspeed_sbc
* Derive ABR and secure boot state from OTP config straps, removing the "emmc-abr" and "signing-settings" machine properties
* Sort device IDs alphabetically
* Add I2C test for IO expander 1 on the AST2700A2
* Update ASPEED BMCs reviewer list
* Add a create_unimplemented_devices() helper and convert all Aspeed SoCs and coprocessors to table-driven unimplemented devices
* Fix the set_machine probe VM to use the test workdir
----------------------------------------------------------------
Cédric Le Goater (1):
hw/misc/aspeed_hace: Fix OOB read in has_padding()
Emmanuel Blot (1):
tests/functional: give the set_machine probe VM the test workdir
Jamin Lin (16):
tests/qtest/aspeed-acry: Allocate SRAM buffers on the heap hw/arm/aspeed: Sort device IDs alphabetically tests/functional/aarch64/test_aspeed_ast2700a2: Add I2C test for IO expander 1
MAINTAINERS: Update ASPEED BMCs reviewers
hw/misc/unimp: Add create_unimplemented_devices() helper hw/arm/aspeed_ast2400: Use a table for unimplemented devices hw/arm/aspeed_ast2600: Use a table for unimplemented devices hw/arm/aspeed_ast27x0: Use a table for unimplemented devices hw/arm/aspeed_ast10x0: Use a table for unimplemented devices hw/arm/aspeed_ast1040: Use a table for unimplemented devices hw/arm/aspeed: Remove unused unimplemented device fields hw/arm/aspeed_ast27x0: Use a table for unimplemented devices for SSP/TSP hw/arm/aspeed_coprocessor: Remove unused unimplemented device fields hw/arm/aspeed_ast1700: Use a table for unimplemented devices hw/arm/aspeed_ast1700: Remove unused unimplemented device field hw/arm/aspeed: Remove unused aspeed_mmio_map_unimplemented()
Kane Chen (3):
hw/nvram/aspeed_otp, hw/misc/aspeed_sbc: Consolidate OTP layout definitions hw/misc/aspeed_sbc: Derive ABR state from OTP config straps hw/misc/aspeed_sbc: Derive secure boot state from OTP config
MAINTAINERS | 4 - include/hw/arm/aspeed_ast1700.h | 2 - include/hw/arm/aspeed_coprocessor.h | 5 +- include/hw/arm/aspeed_soc.h | 190 ++++++++++------------ include/hw/misc/aspeed_sbc.h | 3 - include/hw/misc/unimp.h | 21 +++ include/hw/nvram/aspeed_otp.h | 32 ++++ hw/arm/aspeed_ast1040.c | 40 ++--- hw/arm/aspeed_ast10x0.c | 55 ++----- hw/arm/aspeed_ast1700.c | 21 +-- hw/arm/aspeed_ast2400.c | 25 ++- hw/arm/aspeed_ast2600.c | 44 ++--- hw/arm/aspeed_ast27x0-ssp.c | 44 ++--- hw/arm/aspeed_ast27x0-tsp.c | 44 ++--- hw/arm/aspeed_ast27x0.c | 41 ++--- hw/arm/aspeed_soc_common.c | 11 -- hw/misc/aspeed_hace.c | 2 +- hw/misc/aspeed_sbc.c | 97 ++++++----- hw/misc/unimp.c | 20 +++ hw/nvram/aspeed_otp.c | 63 +++++++ tests/qtest/aspeed-acry-test.c | 8 +- tests/functional/aarch64/test_aspeed_ast2700a2.py | 3 + tests/functional/qemu_test/testcase.py | 2 +- 23 files changed, 378 insertions(+), 399 deletions(-)
[PULL 01/21] hw/misc/aspeed_hace: Fix OOB read in has_padding()
When total_msg_len equals total_req_len, padding_size is 0, making pad_offset equal to req_len. The subsequent padding[pad_offset] read accesses one byte past the buffer. Return false early when padding_size is zero.
--- hw/misc/aspeed_hace.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
hw/misc/aspeed_hace.c +1 -1
@@ -225,7 +225,7 @@ static bool has_padding(AspeedHACEState *s, struct iovec *iov,uint32_t padding_size = s->total_req_len - *total_msg_len;uint8_t *padding = iov->iov_base; -if (padding_size > req_len) { +if (padding_size ==0 || padding_size > req_len) {return false; }
Signature · 1 line
2.56.0
[PULL 07/21] tests/functional/aarch64/test_aspeed_ast2700a2: Add I2C test for IO expander 1
In reply to Cédric Le GoaterFrom: Jamin Lin <[email protected]>
The IO expander test only checks the I2C bus of IO expander 0. The I2C buses of IO expander 1 are not tested, so a wrong interrupt wiring for IO expander 1 can not be detected.
Add a TMP105 device on the first I2C bus of IO expander 1 and check that it can be read from firmware.
--- tests/functional/aarch64/test_aspeed_ast2700a2.py | 3 +++ 1 file changed, 3 insertions(+)
tests/functional/aarch64/test_aspeed_ast2700a2.py +3 -0
@@ -196,10 +196,13 @@ def test_aarch64_ast2700a2_evb_ioexp_v11_03(self): self.vm.set_machine('ast2700a2-evb,fmc-model=w25q512jv') self.vm.add_args('-device', 'tmp105,bus=ioexp0.0,address=0x4d,id=tmp-test-16') + self.vm.add_args('-device', + 'tmp105,bus=ioexp1.0,address=0x4d,id=tmp-test-32') self.start_ast2700_test('ast2700-dcscm-image', 8) self.verify_openbmc_boot_and_login('ast2700-dcscm', False) self.do_ast2700_i2c_test(8) self.do_ast2700_i2c_test(16) + self.do_ast2700_i2c_test(32) if __name__ == '__main__': QemuSystemTest.main()
Signature · 1 line
2.56.0
[PULL 05/21] hw/misc/aspeed_sbc: Derive secure boot state from OTP config
In reply to Cédric Le GoaterFrom: Kane Chen <[email protected]>
The secure boot state is currently controlled by the "signing-settings" machine property instead of the OTP configuration.
Derive SECURE_BOOT_EN and R_QSR from the OTP configuration when the registers are read.
Remove the "signing-settings" property as the secure boot state is now derived from OTP.
--- include/hw/misc/aspeed_sbc.h | 2 -- hw/misc/aspeed_sbc.c | 22 +++++++++++++--------- 2 files changed, 13 insertions(+), 11 deletions(-)
include/hw/misc/aspeed_sbc.h +0 -2
@@ -32,8 +32,6 @@ OBJECT_DECLARE_TYPE(AspeedSBCState, AspeedSBCClass, ASPEED_SBC)struct AspeedSBCState {SysBusDevice parent; -uint32_t signing_settings; -MemoryRegion iomem;uint32_t regs[ASPEED_SBC_NR_REGS ];
hw/misc/aspeed_sbc.c +13 -9
@@ -79,6 +79,8 @@#define MODE_REGISTER_A (0x3000)#define MODE_REGISTER_B (0x5000) +static bool aspeed_sbc_otp_read (AspeedSBCState *s,uint32_t otp_addr); +static uint64_t aspeed_sbc_read (void *opaque,hwaddr addr,unsigned int size) {AspeedSBCState *s =ASPEED_SBC (opaque);
@@ -102,8 +104,16 @@ static uint64_t aspeed_sbc_read(void *opaque, hwaddr addr, unsigned int size) val &= ~ABR_EN ; } +if (aspeed_otp_read_config (&s->otp,0 ) &BIT (1 )) { + val |=SECURE_BOOT_EN ; + }else { + val &= ~SECURE_BOOT_EN ; + } +return val; } +case R_QSR : +return aspeed_otp_read_config (&s->otp,0 );default :return s->regs[addr]; }
@@ -406,16 +416,11 @@ static void aspeed_sbc_reset_hold(Object *obj, ResetType type)memset (s->regs,0 ,sizeof (s->regs));/* -* ABR_EN is derived from OTP on every read, see aspeed_sbc_read(). -* Set secure boot enabled with RSA4096_SHA256. +* ABR_EN and SECURE_BOOT_EN are derived from OTP on every read, see +* aspeed_sbc_read(), since the SBC status register is just a +* reflection of the OTP fuse state. */ s->regs[R_STATUS ] =OTP_IDLE |OTP_MEM_IDLE ; - -if (s->signing_settings) { - s->regs[R_STATUS ] &=SECURE_BOOT_EN ; - } - - s->regs[R_QSR ] = s->signing_settings; }static void aspeed_sbc_instance_init (Object *obj)
@@ -468,7 +473,6 @@ static const VMStateDescription vmstate_aspeed_sbc = { };static const Property aspeed_sbc_properties[] = { -DEFINE_PROP_UINT32 ("signing-settings" , AspeedSBCState, signing_settings,0 ),DEFINE_PROP_LINK ("sram" , AspeedSBCState, sram, TYPE_MEMORY_REGION, MemoryRegion *), };
Signature · 1 line
2.56.0
[PULL 06/21] hw/arm/aspeed: Sort device IDs alphabetically
In reply to Cédric Le GoaterFrom: Jamin Lin <[email protected]>
The ASPEED device ID enum has grown over time without a consistent ordering rule. This makes it difficult to determine where new device IDs should be added and reduces readability and maintainability as more devices are introduced.
Sort the device IDs alphabetically to provide a consistent ordering rule. Keep related numbered devices together, such as SPI0, SPI1 and SPI2.
No functional change.
--- include/hw/arm/aspeed_soc.h | 176 ++++++++++++++++++------------------ 1 file changed, 88 insertions(+), 88 deletions(-)
include/hw/arm/aspeed_soc.h +88 -88
@@ -195,64 +195,56 @@ struct AspeedSoCClass { };enum { -ASPEED_DEV_VBOOTROM , -ASPEED_DEV_SPI_BOOT , -ASPEED_DEV_IOMEM , -ASPEED_DEV_IOMEM0 , -ASPEED_DEV_IOMEM1 , -ASPEED_DEV_UART0 , -ASPEED_DEV_UART1 , -ASPEED_DEV_UART2 , -ASPEED_DEV_UART3 , -ASPEED_DEV_UART4 , -ASPEED_DEV_UART5 , -ASPEED_DEV_UART6 , -ASPEED_DEV_UART7 , -ASPEED_DEV_UART8 , -ASPEED_DEV_UART9 , -ASPEED_DEV_UART10 , -ASPEED_DEV_UART11 , -ASPEED_DEV_UART12 , -ASPEED_DEV_UART13 , -ASPEED_DEV_VUART , -ASPEED_DEV_FMC , -ASPEED_DEV_SPI0 , -ASPEED_DEV_SPI1 , -ASPEED_DEV_SPI2 , +ASPEED_DEV_ACRY , +ASPEED_DEV_ADC , +ASPEED_DEV_DP , +ASPEED_DEV_DPMCU ,ASPEED_DEV_EHCI1 ,ASPEED_DEV_EHCI2 ,ASPEED_DEV_EHCI3 ,ASPEED_DEV_EHCI4 , -ASPEED_DEV_VIC , -ASPEED_DEV_INTC , -ASPEED_DEV_INTCIO , -ASPEED_DEV_SDMC , -ASPEED_DEV_SCU , -ASPEED_DEV_ADC , -ASPEED_DEV_SBC , +ASPEED_DEV_EMMC ,ASPEED_DEV_EMMC_BC , -ASPEED_DEV_VIDEO , -ASPEED_DEV_SRAM0 , -ASPEED_DEV_SRAM1 , -ASPEED_DEV_SDHCI , +ASPEED_DEV_ESPI , +ASPEED_DEV_ETH1 , +ASPEED_DEV_ETH2 , +ASPEED_DEV_ETH3 , +ASPEED_DEV_ETH4 , +ASPEED_DEV_FMC , +ASPEED_DEV_FSI1 , +ASPEED_DEV_FSI2 ,ASPEED_DEV_GPIO ,ASPEED_DEV_GPIO_1_8V , -ASPEED_DEV_SGPIOM0 , -ASPEED_DEV_SGPIOM1 , -ASPEED_DEV_RTC , -ASPEED_DEV_TIMER1 , -ASPEED_DEV_TIMER2 , -ASPEED_DEV_TIMER3 , -ASPEED_DEV_TIMER4 , -ASPEED_DEV_TIMER5 , -ASPEED_DEV_TIMER6 , -ASPEED_DEV_TIMER7 , -ASPEED_DEV_TIMER8 , -ASPEED_DEV_WDT , -ASPEED_DEV_PWM , -ASPEED_DEV_LPC , -ASPEED_DEV_IBT , +ASPEED_DEV_HACE ,ASPEED_DEV_I2C , +ASPEED_DEV_I3C , +ASPEED_DEV_IBT , +ASPEED_DEV_INTC , +ASPEED_DEV_INTCIO , +ASPEED_DEV_IOMEM , +ASPEED_DEV_IOMEM0 , +ASPEED_DEV_IOMEM1 , +ASPEED_DEV_IOEXP0_I2C , +ASPEED_DEV_IOEXP1_I2C , +ASPEED_DEV_IOEXP0_I3C , +ASPEED_DEV_IOEXP1_I3C , +ASPEED_DEV_IOEXP0_INTCIO , +ASPEED_DEV_IOEXP1_INTCIO , +ASPEED_DEV_IPC0 , +ASPEED_DEV_IPC1 , +ASPEED_DEV_JTAG0 , +ASPEED_DEV_JTAG1 , +ASPEED_DEV_KCS , +ASPEED_DEV_LPC , +ASPEED_DEV_LTPI_CTRL1 , +ASPEED_DEV_LTPI_CTRL2 , +ASPEED_DEV_LTPI_IO0 , +ASPEED_DEV_LTPI_IO1 , +ASPEED_DEV_MII1 , +ASPEED_DEV_MII2 , +ASPEED_DEV_MII3 , +ASPEED_DEV_MII4 , +ASPEED_DEV_OTP ,ASPEED_DEV_PCIE0 ,ASPEED_DEV_PCIE1 ,ASPEED_DEV_PCIE2 ,
@@ -263,49 +255,57 @@ enum {ASPEED_DEV_PCIE_MMIO1 ,ASPEED_DEV_PCIE_MMIO2 ,ASPEED_DEV_PECI , -ASPEED_DEV_ETH1 , -ASPEED_DEV_ETH2 , -ASPEED_DEV_ETH3 , -ASPEED_DEV_ETH4 , -ASPEED_DEV_MII1 , -ASPEED_DEV_MII2 , -ASPEED_DEV_MII3 , -ASPEED_DEV_MII4 , -ASPEED_DEV_SDRAM , -ASPEED_DEV_XDMA , -ASPEED_DEV_EMMC , -ASPEED_DEV_KCS , -ASPEED_DEV_HACE , -ASPEED_DEV_ACRY , -ASPEED_DEV_DPMCU , -ASPEED_DEV_DP , -ASPEED_DEV_I3C , -ASPEED_DEV_ESPI , -ASPEED_DEV_UDC , -ASPEED_DEV_JTAG0 , -ASPEED_DEV_JTAG1 , -ASPEED_DEV_FSI1 , -ASPEED_DEV_FSI2 , +ASPEED_DEV_PRIC0 , +ASPEED_DEV_PRIC1 , +ASPEED_DEV_PWM , +ASPEED_DEV_RTC , +ASPEED_DEV_SBC , +ASPEED_DEV_SCU ,ASPEED_DEV_SCUIO , +ASPEED_DEV_SDHCI , +ASPEED_DEV_SDMC , +ASPEED_DEV_SDRAM , +ASPEED_DEV_SGPIOM0 , +ASPEED_DEV_SGPIOM1 ,ASPEED_DEV_SLI ,ASPEED_DEV_SLIIO , +ASPEED_DEV_SPI_BOOT , +ASPEED_DEV_SPI0 , +ASPEED_DEV_SPI1 , +ASPEED_DEV_SPI2 , +ASPEED_DEV_SRAM0 , +ASPEED_DEV_SRAM1 , +ASPEED_DEV_TIMER1 , +ASPEED_DEV_TIMER2 , +ASPEED_DEV_TIMER3 , +ASPEED_DEV_TIMER4 , +ASPEED_DEV_TIMER5 , +ASPEED_DEV_TIMER6 , +ASPEED_DEV_TIMER7 , +ASPEED_DEV_TIMER8 , +ASPEED_DEV_UART0 , +ASPEED_DEV_UART1 , +ASPEED_DEV_UART2 , +ASPEED_DEV_UART3 , +ASPEED_DEV_UART4 , +ASPEED_DEV_UART5 , +ASPEED_DEV_UART6 , +ASPEED_DEV_UART7 , +ASPEED_DEV_UART8 , +ASPEED_DEV_UART9 , +ASPEED_DEV_UART10 , +ASPEED_DEV_UART11 , +ASPEED_DEV_UART12 , +ASPEED_DEV_UART13 , +ASPEED_DEV_UDC , +ASPEED_DEV_VBOOTROM , +ASPEED_DEV_VIC , +ASPEED_DEV_VIDEO , +ASPEED_DEV_VUART , +ASPEED_DEV_WDT , +ASPEED_DEV_XDMA ,ASPEED_GIC_DIST , ASPEED_GIC_REDIST, -ASPEED_DEV_IPC0 , -ASPEED_DEV_IPC1 , -ASPEED_DEV_LTPI_CTRL1 , -ASPEED_DEV_LTPI_CTRL2 , -ASPEED_DEV_LTPI_IO0 , -ASPEED_DEV_LTPI_IO1 , -ASPEED_DEV_IOEXP0_I2C , -ASPEED_DEV_IOEXP1_I2C , -ASPEED_DEV_IOEXP0_INTCIO , -ASPEED_DEV_IOEXP1_INTCIO , -ASPEED_DEV_IOEXP0_I3C , -ASPEED_DEV_IOEXP1_I3C , -ASPEED_DEV_PRIC0 , -ASPEED_DEV_PRIC1 , - ASPEED_DEV_OTP, };const char *aspeed_soc_cpu_type (const char *const *valid_cpu_types);
Signature · 1 line
2.56.0
[PULL 12/21] hw/arm/aspeed_ast27x0: Use a table for unimplemented devices
In reply to Cédric Le GoaterFrom: Jamin Lin <[email protected]>
Before this change, each unimplemented device needed its own field in AspeedSoCState. This made the variable names confusing. For example, AspeedSoCState has "udc" as an unimplemented device, but Aspeed2600SoCState also has "udc" as the real UDC model.
Use the unimp_devs table in AspeedSoCClass to describe the unimplemented devices, and use create_unimplemented_devices() to create and map them. This makes the code easier to maintain and read. Convert AST2700 to use them.
No functional change.
--- hw/arm/aspeed_ast27x0.c | 41 ++++++++++++----------------------------- 1 file changed, 12 insertions(+), 29 deletions(-)
hw/arm/aspeed_ast27x0.c +12 -29
@@ -24,10 +24,6 @@#include "qobject/qlist.h" #include "qemu/log.h" -#define AST2700_SOC_IO_SIZE 0x00FE0000 -#define AST2700_SOC_IOMEM_SIZE 0x01000000 -#define AST2700_SOC_DPMCU_SIZE 0x00040000 -static const hwaddr aspeed_soc_ast2700_memmap[] = { [ASPEED_DEV_VBOOTROM ] =0x00000000 , [ASPEED_DEV_IOMEM ] =0x00020000 ,
@@ -263,6 +259,14 @@ static const struct gic_intc_irq_info ast2700_gic_intcmap[] = { {201, 3, 1, ast2700_gic201_intcmap}, }; +static const UnimplementedDeviceConfig aspeed_soc_ast2700_unimp_devs[] = { + {"dpmcu" ,"aspeed.dpmcu" ,0x11000000 ,0x00040000 ,-1000 }, + {"iomem" ,"aspeed.io" ,0x00020000 ,0x00FE0000 ,-1000 }, + {"iomem0" ,"aspeed.iomem0" ,0x12000000 ,0x01000000 ,-1000 }, + {"iomem1" ,"aspeed.iomem1" ,0x14000000 ,0x01000000 ,-1000 }, + { } +}; +static qemu_irq aspeed_soc_ast2700_get_irq (AspeedSoCState *s,int dev) {Aspeed27x0SoCState *a =ASPEED27X0_SOC (s);
@@ -558,15 +562,6 @@ static void aspeed_soc_ast2700_init(Object *obj)qdev_prop_set_uint32 (DEVICE (&s->ioexp[i]),"silicon-rev" , sc->silicon_rev); } - -object_initialize_child (obj,"dpmcu" , &s->dpmcu, -TYPE_UNIMPLEMENTED_DEVICE ); -object_initialize_child (obj,"iomem" , &s->iomem, -TYPE_UNIMPLEMENTED_DEVICE ); -object_initialize_child (obj,"iomem0" , &s->iomem0, -TYPE_UNIMPLEMENTED_DEVICE ); -object_initialize_child (obj,"iomem1" , &s->iomem1, -TYPE_UNIMPLEMENTED_DEVICE ); }/*
@@ -1137,22 +1132,8 @@ static void aspeed_soc_ast2700_realize(DeviceState *dev, Error **errp) } } -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->iomem), -"aspeed.io" , - sc->memmap[ASPEED_DEV_IOMEM ], -AST2700_SOC_IO_SIZE ); -aspeed_mmio_map_unimplemented (s->memory,SYS_BUS_DEVICE (&s->iomem0), -"aspeed.iomem0" , - sc->memmap[ASPEED_DEV_IOMEM0 ], -AST2700_SOC_IOMEM_SIZE ); -aspeed_mmio_map_unimplemented (s->memory,SYS_BUS_DEVICE (&s->iomem1), -"aspeed.iomem1" , - sc->memmap[ASPEED_DEV_IOMEM1 ], -AST2700_SOC_IOMEM_SIZE ); +/* Unimplemented devices */ +create_unimplemented_devices (OBJECT (s), s->memory, sc->unimp_devs); }static void aspeed_soc_ast2700a1_class_init (ObjectClass *oc,const void *data)
@@ -1183,6 +1164,7 @@ static void aspeed_soc_ast2700a1_class_init(ObjectClass *oc, const void *data) sc->uarts_base =ASPEED_DEV_UART0 ; sc->irqmap = aspeed_soc_ast2700a1_irqmap; sc->memmap = aspeed_soc_ast2700_memmap; + sc->unimp_devs = aspeed_soc_ast2700_unimp_devs; }static void aspeed_soc_ast2700a2_class_init (ObjectClass *oc,const void *data)
@@ -1213,6 +1195,7 @@ static void aspeed_soc_ast2700a2_class_init(ObjectClass *oc, const void *data) sc->uarts_base =ASPEED_DEV_UART0 ; sc->irqmap = aspeed_soc_ast2700a1_irqmap; sc->memmap = aspeed_soc_ast2700_memmap; + sc->unimp_devs = aspeed_soc_ast2700_unimp_devs; }static const TypeInfo aspeed_soc_ast27x0_types[] = {
Signature · 1 line
2.56.0
[PULL 03/21] hw/nvram/aspeed_otp, hw/misc/aspeed_sbc: Consolidate OTP layout definitions
In reply to Cédric Le GoaterFrom: Kane Chen <[email protected]>
Move the OTP address-space layout definitions from aspeed_sbc.c to aspeed_otp.h, as they describe the OTP device layout.
Add an aspeed_otp_read() helper to reduce duplicated OTP read code.
Remove the redundant OTP address bounds checks, as invalid accesses are already handled by the OTP address space.
No functional change.
--- include/hw/nvram/aspeed_otp.h | 13 +++++++++ hw/misc/aspeed_sbc.c | 52 +++++++++++------------------------ 2 files changed, 29 insertions(+), 36 deletions(-)
include/hw/nvram/aspeed_otp.h +13 -0
@@ -16,6 +16,19 @@#define TYPE_ASPEED_OTP "aspeed-otp" OBJECT_DECLARE_SIMPLE_TYPE(AspeedOTPState, ASPEED_OTP) +#define OTP_MEMORY_SIZE 0x4000 + +/* +* The OTP address space is indexed by dword address and is split into +* two regions: +* +* - [0, OTP_DATA_DWORD_COUNT]: the data region. Each address contains +* 64 bits of data. +* - [OTP_DATA_DWORD_COUNT, OTP_MEMORY_SIZE / 4]: the configuration +* region. Each address contains 32 bits of data. +*/ +#define OTP_DATA_DWORD_COUNT (0x800) + typedef struct AspeedOTPState { DeviceState parent_obj;
hw/misc/aspeed_sbc.c +16 -36
87 lines not on this page · raw message
Signature · 1 line
2.56.0
[PULL 11/21] hw/arm/aspeed_ast2600: Use a table for unimplemented devices
In reply to Cédric Le GoaterFrom: Jamin Lin <[email protected]>
Before this change, each unimplemented device needed its own field in AspeedSoCState. This made the variable names confusing. For example, AspeedSoCState has "udc" as an unimplemented device, but Aspeed2600SoCState also has "udc" as the real UDC model.
Use the unimp_devs table in AspeedSoCClass to describe the unimplemented devices, and use create_unimplemented_devices() to create and map them. This makes the code easier to maintain and read. Convert AST2600 to use them.
No functional change.
--- hw/arm/aspeed_ast2600.c | 44 +++++++++++------------------------------ 1 file changed, 12 insertions(+), 32 deletions(-)
hw/arm/aspeed_ast2600.c +12 -32
@@ -19,9 +19,6 @@#include "system/system.h" #include "target/arm/cpu-qom.h" -#define ASPEED_SOC_IOMEM_SIZE 0x00200000 -#define ASPEED_SOC_DPMCU_SIZE 0x00040000 -static const hwaddr aspeed_soc_ast2600_memmap[] = { [ASPEED_DEV_SPI_BOOT ] =0x00000000 , [ASPEED_DEV_SRAM0 ] =0x10000000 ,
@@ -149,6 +146,15 @@ static const int aspeed_soc_ast2600_irqmap[] = { [ASPEED_DEV_ACRY] = 160, }; +static const UnimplementedDeviceConfig aspeed_soc_ast2600_unimp_devs[] = { + {"iomem" ,"aspeed.io" ,0x1E600000 ,0x00200000 ,-1000 }, + {"video" ,"aspeed.video" ,0x1E700000 ,0x1000 ,-1000 }, + {"dpmcu" ,"aspeed.dpmcu" ,0x18000000 ,0x00040000 ,-1000 }, + {"emmc-boot-controller" ,"aspeed.emmc-boot-controller" , +0x1E6F5000 ,0x1000 ,-1000 }, + { } +}; +static qemu_irq aspeed_soc_ast2600_get_irq (AspeedSoCState *s,int dev) {Aspeed2600SoCState *a =ASPEED2600_SOC (s);
@@ -282,13 +288,6 @@ static void aspeed_soc_ast2600_init(Object *obj)object_initialize_child (obj,"sbc" , &s->sbc,TYPE_ASPEED_AST2600_SBC ); -object_initialize_child (obj,"iomem" , &s->iomem,TYPE_UNIMPLEMENTED_DEVICE ); -object_initialize_child (obj,"video" , &s->video,TYPE_UNIMPLEMENTED_DEVICE ); -object_initialize_child (obj,"dpmcu" , &s->dpmcu,TYPE_UNIMPLEMENTED_DEVICE ); -object_initialize_child (obj,"emmc-boot-controller" , - &s->emmc_boot_controller, -TYPE_UNIMPLEMENTED_DEVICE ); -for (i =0 ; i <ASPEED_FSI_NUM ; i++) {object_initialize_child (obj,"fsi[*]" , &s->fsi[i],TYPE_ASPEED_APB2OPB ); }
@@ -382,22 +381,8 @@ static void aspeed_soc_ast2600_realize(DeviceState *dev, Error **errp)memory_region_add_subregion (s->memory, sc->memmap[ASPEED_DEV_SPI_BOOT ], &s->spi_boot_container); -/* IO space */ -aspeed_mmio_map_unimplemented (s->memory,SYS_BUS_DEVICE (&s->iomem), -"aspeed.io" , - sc->memmap[ASPEED_DEV_IOMEM ], -ASPEED_SOC_IOMEM_SIZE ); - -/* Video engine stub */ -aspeed_mmio_map_unimplemented (s->memory,SYS_BUS_DEVICE (&s->video), -"aspeed.video" , - sc->memmap[ASPEED_DEV_VIDEO ],0x1000 ); - -/* eMMC Boot Controller stub */ -aspeed_mmio_map_unimplemented (s->memory, -SYS_BUS_DEVICE (&s->emmc_boot_controller), -"aspeed.emmc-boot-controller" , - sc->memmap[ASPEED_DEV_EMMC_BC ],0x1000 ); +/* Unimplemented devices */ +create_unimplemented_devices (OBJECT (s), s->memory, sc->unimp_devs);/* CPU */ for (i =0 ; i < sc->num_cpus; i++) {
@@ -469,12 +454,6 @@ static void aspeed_soc_ast2600_realize(DeviceState *dev, Error **errp)memory_region_add_subregion (s->memory, sc->memmap[ASPEED_DEV_SRAM1 ], &s->sram_container[1 ]); -/* DPMCU */ -aspeed_mmio_map_unimplemented (s->memory,SYS_BUS_DEVICE (&s->dpmcu), -"aspeed.dpmcu" , - sc->memmap[ASPEED_DEV_DPMCU ], -ASPEED_SOC_DPMCU_SIZE ); -/* SCU */ if (!sysbus_realize (SYS_BUS_DEVICE (&s->scu), errp)) {return ;
@@ -838,6 +817,7 @@ static void aspeed_soc_ast2600_class_init(ObjectClass *oc, const void *data) sc->uarts_base =ASPEED_DEV_UART1 ; sc->irqmap = aspeed_soc_ast2600_irqmap; sc->memmap = aspeed_soc_ast2600_memmap; + sc->unimp_devs = aspeed_soc_ast2600_unimp_devs; sc->num_cpus =2 ; sc->boot_from_emmc = aspeed_soc_ast2600_boot_from_emmc; }
Signature · 1 line
2.56.0
[PULL 02/21] tests/qtest/aspeed-acry: Allocate SRAM buffers on the heap
In reply to Cédric Le GoaterFrom: Jamin Lin <[email protected]>
The ACRY RSA qtest allocates two ACRY_SRAM_SIZE buffers on the stack. Since each buffer is nearly 9 KiB, this unnecessarily increases the stack usage of test_modexp_rsa() and may cause unexpected failures on environments with a limited stack size.
This reduces the stack usage while preserving the existing test behavior.
--- tests/qtest/aspeed-acry-test.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
tests/qtest/aspeed-acry-test.c +4 -4
@@ -327,8 +327,8 @@ static void test_modexp_rsa(const void *opaque) .alg = QCRYPTO_AK_CIPHER_ALGO_RSA, .u.rsa.padding_alg = QCRYPTO_RSA_PADDING_ALGO_RAW, }; -uint8_t dram_buf[ACRY_SRAM_SIZE ] = {0 }; -uint8_t sram_buf[ACRY_SRAM_SIZE ] = {0 }; + g_autofree uint8_t *dram_buf = g_malloc0(ACRY_SRAM_SIZE); + g_autofree uint8_t *sram_buf = g_malloc0(ACRY_SRAM_SIZE);uint8_t result[ACRY_MAX_BYTES ] = {0 };QTestState *qts;
@@ -345,7 +345,7 @@ static void test_modexp_rsa(const void *opaque)put_bignum_be_bytes (dram_buf,ACRY_MOD_OFFSET , t->n, t->n_len);put_bignum_be_bytes (dram_buf,ACRY_DATA_OFFSET , t->m, t->m_len); -qtest_memwrite (qts, c->dram_addr, dram_buf,sizeof (dram_buf)); +qtest_memwrite (qts, c->dram_addr, dram_buf,ACRY_SRAM_SIZE );qtest_writel (qts, c->acry_addr +ACRY_DMA_CMD ,ACRY_DMA_CMD_DMEM_AHB );qtest_writel (qts, c->acry_addr +ACRY_DMA_SRC , c->dram_addr);
@@ -362,7 +362,7 @@ static void test_modexp_rsa(const void *opaque) g_assert_cmphex(qtest_readl(qts, c->acry_addr + ACRY_STATUS), ==,ACRY_STATUS_RSA_DONE ); -qtest_memread (qts, c->sram_addr, sram_buf,sizeof (sram_buf)); +qtest_memread (qts, c->sram_addr, sram_buf,ACRY_SRAM_SIZE );get_bignum_be_bytes (sram_buf,ACRY_DATA_OFFSET , result, t->c_len);g_assert_cmpmem (result, t->c_len, t->c, t->c_len);
Signature · 1 line
2.56.0
[PULL 04/21] hw/misc/aspeed_sbc: Derive ABR state from OTP config straps
In reply to Cédric Le GoaterFrom: Kane Chen <[email protected]>
The eMMC ABR enable state is currently controlled by the "emmc-abr" machine property instead of the OTP configuration.
Add helpers to read the OTP configuration and resolve strap values. Use the ABR strap value to update ABR_EN when R_STATUS is read.
Remove the "emmc-abr" property as the ABR state is now derived from OTP.
--- include/hw/misc/aspeed_sbc.h | 1 - include/hw/nvram/aspeed_otp.h | 23 +++++++++++-- hw/misc/aspeed_sbc.c | 29 ++++++++++++---- hw/nvram/aspeed_otp.c | 63 +++++++++++++++++++++++++++++++++++ 4 files changed, 106 insertions(+), 10 deletions(-)
include/hw/misc/aspeed_sbc.h +0 -1
@@ -32,7 +32,6 @@ OBJECT_DECLARE_TYPE(AspeedSBCState, AspeedSBCClass, ASPEED_SBC)struct AspeedSBCState {SysBusDevice parent; -bool emmc_abr;uint32_t signing_settings;MemoryRegion iomem;
include/hw/nvram/aspeed_otp.h +21 -2
@@ -24,11 +24,27 @@ OBJECT_DECLARE_SIMPLE_TYPE(AspeedOTPState, ASPEED_OTP)* * - [0, OTP_DATA_DWORD_COUNT]: the data region. Each address contains * 64 bits of data. -* - [OTP_DATA_DWORD_COUNT, OTP_MEMORY_SIZE / 4]: the configuration -* region. Each address contains 32 bits of data. +* - [OTP_DATA_DWORD_COUNT(OTP_CFG0), OTP_MEMORY_SIZE / 4]: the +* configuration region. Each address contains 32 bits of data. */ #define OTP_DATA_DWORD_COUNT (0x800) +/* Start of the OTP configuration/strap region. */ +#define OTP_CFG0 (0x800) + +/* +* OTP straps are a 64-bit value packed as two 32-bit halves starting at +* config word OTP_STRAP_START_INDEX (OTPCFG16 and OTPCFG17). Each strap +* bit is stored redundantly in OTP_STRAP_COPY_NUM config words, spaced +* (OTP_STRAP_BIT_NUM / 32) words apart -- i.e. one word per 32-bit half, +* so the two halves interleave; the effective bit value is the XOR of +* all copies, matching how the real hardware and the ast-otp reference +* tool resolve straps. +*/ +#define OTP_STRAP_START_INDEX 16 +#define OTP_STRAP_BIT_NUM 64 +#define OTP_STRAP_COPY_NUM 6 + typedef struct AspeedOTPState { DeviceState parent_obj;
@@ -43,4 +59,7 @@ typedef struct AspeedOTPState { uint8_t *storage; } AspeedOTPState; +uint32_t aspeed_otp_read_config (AspeedOTPState *s,unsigned int cfg_word); +bool aspeed_otp_read_strap (AspeedOTPState *s,unsigned int bit); +#endif /* ASPEED_OTP_H */
hw/misc/aspeed_sbc.c +22 -7
@@ -71,6 +71,9 @@#define SBC_OTP_CMD_WRITE 0x23b1e362#define SBC_OTP_CMD_PROG 0x23b1e364 +/* OTP strap bits */ +#define OTP_STRAP_ABR_EN 0x2b +/* Voltage mode */ #define MODE_REGISTER (0x1000)#define MODE_REGISTER_A (0x3000)
@@ -89,7 +92,21 @@ static uint64_t aspeed_sbc_read(void *opaque, hwaddr addr, unsigned int size)return 0 ; } -return s->regs[addr]; +switch (addr) { +case R_STATUS : { +uint32_t val = s->regs[R_STATUS ]; + +if (aspeed_otp_read_strap (&s->otp,OTP_STRAP_ABR_EN )) { + val |=ABR_EN ; + }else { + val &= ~ABR_EN ; + } + +return val; + } +default : +return s->regs[addr]; + } } static bool aspeed_otp_read(AspeedSBCState *s, uint32_t otp_addr,
@@ -388,13 +405,12 @@ static void aspeed_sbc_reset_hold(Object *obj, ResetType type)memset (s->regs,0 ,sizeof (s->regs)); -/* Set secure boot enabled with RSA4096_SHA256 and enable eMMC ABR */ +/* +* ABR_EN is derived from OTP on every read, see aspeed_sbc_read(). +* Set secure boot enabled with RSA4096_SHA256. +*/ s->regs[R_STATUS ] =OTP_IDLE |OTP_MEM_IDLE ; -if (s->emmc_abr) { - s->regs[R_STATUS ] &=ABR_EN ; - } -if (s->signing_settings) { s->regs[R_STATUS ] &=SECURE_BOOT_EN ; }
@@ -452,7 +468,6 @@ static const VMStateDescription vmstate_aspeed_sbc = { };static const Property aspeed_sbc_properties[] = { -DEFINE_PROP_BOOL ("emmc-abr" , AspeedSBCState, emmc_abr,0 ),DEFINE_PROP_UINT32 ("signing-settings" , AspeedSBCState, signing_settings,0 ),DEFINE_PROP_LINK ("sram" , AspeedSBCState, sram, TYPE_MEMORY_REGION, MemoryRegion *),
hw/nvram/aspeed_otp.c +63 -0
69 lines not on this page · raw message
Signature · 1 line
2.56.0
[PULL 19/21] hw/arm/aspeed_ast1700: Remove unused unimplemented device field
In reply to Cédric Le GoaterFrom: Jamin Lin <[email protected]>
AST1700 now uses create_unimplemented_devices() for its unimplemented devices. Remove the old "i3c" field in AspeedAST1700SoCState, which is not used anymore.
No functional change.
--- include/hw/arm/aspeed_ast1700.h | 2 -- 1 file changed, 2 deletions(-)
include/hw/arm/aspeed_ast1700.h +0 -2
@@ -47,8 +47,6 @@ struct AspeedAST1700SoCState {AspeedI2CState i2c;AspeedPWMState pwm; AspeedWDTState wdt[AST1700_WDT_NUM]; - - UnimplementedDeviceState i3c; };#endif /* ASPEED_AST1700_H */
Signature · 1 line
2.56.0
[PULL 13/21] hw/arm/aspeed_ast10x0: Use a table for unimplemented devices
In reply to Cédric Le GoaterFrom: Jamin Lin <[email protected]>
Before this change, each unimplemented device needed its own field in AspeedSoCState. This made the variable names confusing. For example, AspeedSoCState has "udc" as an unimplemented device, but Aspeed2600SoCState also has "udc" as the real UDC model.
Use the unimp_devs table in AspeedSoCClass to describe the unimplemented devices, and use create_unimplemented_devices() to create and map them. This makes the code easier to maintain and read. Convert AST1030/AST1060 to use them.
This also fixes a type mismatch. AST10x0 used the "pwm" field (AspeedPWMState) and the "sgpiom" field (AspeedSGPIOState array) to create unimplemented devices. They are not used for that anymore.
No functional change.
--- hw/arm/aspeed_ast10x0.c | 55 +++++++++++------------------------------ 1 file changed, 15 insertions(+), 40 deletions(-)
hw/arm/aspeed_ast10x0.c +15 -40
@@ -17,8 +17,6 @@#include "hw/misc/unimp.h" #include "hw/arm/aspeed_soc.h" -#define ASPEED_SOC_IOMEM_SIZE 0x00200000 -static const hwaddr aspeed_soc_ast1030_memmap[] = { [ASPEED_DEV_SRAM0 ] =0x00000000 , [ASPEED_DEV_SRAM1 ] =0x79000000 ,/* SEC SRAM */
@@ -99,6 +97,17 @@ static const int aspeed_soc_ast1030_irqmap[] = { [ASPEED_DEV_JTAG1] = 53, }; +static const UnimplementedDeviceConfig aspeed_soc_ast10x0_unimp_devs[] = { + {"iomem" ,"aspeed.io" ,0x7E600000 ,0x00200000 ,-1000 }, + {"pwm" ,"aspeed.pwm" ,0x7E610000 ,0x100 ,-1000 }, + {"espi" ,"aspeed.espi" ,0x7E6EE000 ,0x800 ,-1000 }, + {"udc" ,"aspeed.udc" ,0x7E6A2000 ,0x1000 ,-1000 }, + {"sgpiom" ,"aspeed.sgpiom" ,0x7E780500 ,0x100 ,-1000 }, + {"jtag[0]" ,"aspeed.jtag0" ,0x7E6E4000 ,0x20 ,-1000 }, + {"jtag[1]" ,"aspeed.jtag1" ,0x7E6E4100 ,0x20 ,-1000 }, + { } +}; +static qemu_irq aspeed_soc_ast1030_get_irq (AspeedSoCState *s,int dev) {Aspeed10x0SoCState *a =ASPEED10X0_SOC (s);
@@ -161,17 +170,6 @@ static void aspeed_soc_ast10x0_init(Object *obj, const char *socname)snprintf (typename,sizeof (typename),"aspeed.hace-%s" , socname);object_initialize_child (obj,"hace" , &s->hace, typename); - -object_initialize_child (obj,"iomem" , &s->iomem,TYPE_UNIMPLEMENTED_DEVICE ); -object_initialize_child (obj,"pwm" , &s->pwm,TYPE_UNIMPLEMENTED_DEVICE ); -object_initialize_child (obj,"espi" , &s->espi,TYPE_UNIMPLEMENTED_DEVICE ); -object_initialize_child (obj,"udc" , &s->udc,TYPE_UNIMPLEMENTED_DEVICE ); -object_initialize_child (obj,"sgpiom" , &s->sgpiom, -TYPE_UNIMPLEMENTED_DEVICE ); -object_initialize_child (obj,"jtag[0]" , &s->jtag[0 ], -TYPE_UNIMPLEMENTED_DEVICE ); -object_initialize_child (obj,"jtag[1]" , &s->jtag[1 ], -TYPE_UNIMPLEMENTED_DEVICE ); }static void aspeed_soc_ast1030_init (Object *obj)
@@ -215,11 +213,8 @@ static bool aspeed_soc_ast10x0_realize(Aspeed10x0SoCState *a, Error **errp)return false; } -/* General I/O memory space to catch all unimplemented device */ -aspeed_mmio_map_unimplemented (s->memory,SYS_BUS_DEVICE (&s->iomem), -"aspeed.io" , - sc->memmap[ASPEED_DEV_IOMEM ], -ASPEED_SOC_IOMEM_SIZE ); +/* Unimplemented devices */ +create_unimplemented_devices (OBJECT (s), s->memory, sc->unimp_devs);/* AST10x0 CPU Core */ armv7m =DEVICE (&a->armv7m);qdev_prop_set_uint32 (armv7m,"num-irq" ,256 );
@@ -394,28 +389,6 @@ static bool aspeed_soc_ast10x0_realize(Aspeed10x0SoCState *a, Error **errp)sysbus_connect_irq (SYS_BUS_DEVICE (&s->gpio),0 ,aspeed_soc_ast1030_get_irq (s,ASPEED_DEV_GPIO )); -aspeed_mmio_map_unimplemented (s->memory,SYS_BUS_DEVICE (&s->pwm), -"aspeed.pwm" , - sc->memmap[ASPEED_DEV_PWM ],0x100 ); - -aspeed_mmio_map_unimplemented (s->memory,SYS_BUS_DEVICE (&s->espi), -"aspeed.espi" , - sc->memmap[ASPEED_DEV_ESPI ],0x800 ); - -aspeed_mmio_map_unimplemented (s->memory,SYS_BUS_DEVICE (&s->udc), -"aspeed.udc" , - sc->memmap[ASPEED_DEV_UDC ],0x1000 ); -aspeed_mmio_map_unimplemented (s->memory,SYS_BUS_DEVICE (&s->sgpiom), -"aspeed.sgpiom" , - sc->memmap[ASPEED_DEV_SGPIOM0 ],0x100 ); - -aspeed_mmio_map_unimplemented (s->memory,SYS_BUS_DEVICE (&s->jtag[0 ]), -"aspeed.jtag" , - sc->memmap[ASPEED_DEV_JTAG0 ],0x20 ); -aspeed_mmio_map_unimplemented (s->memory,SYS_BUS_DEVICE (&s->jtag[1 ]), -"aspeed.jtag" , - sc->memmap[ASPEED_DEV_JTAG1 ],0x20 ); -return true; }
@@ -503,6 +476,7 @@ static void aspeed_soc_ast1030_class_init(ObjectClass *klass, const void *data) sc->uarts_base =ASPEED_DEV_UART1 ; sc->irqmap = aspeed_soc_ast1030_irqmap; sc->memmap = aspeed_soc_ast1030_memmap; + sc->unimp_devs = aspeed_soc_ast10x0_unimp_devs; sc->num_cpus =1 ; }
@@ -529,6 +503,7 @@ static void aspeed_soc_ast1060_class_init(ObjectClass *klass, const void *data) sc->uarts_base =ASPEED_DEV_UART5 ; sc->irqmap = aspeed_soc_ast1030_irqmap; sc->memmap = aspeed_soc_ast1030_memmap; + sc->unimp_devs = aspeed_soc_ast10x0_unimp_devs; sc->num_cpus =1 ; }
Signature · 1 line
2.56.0
[PULL 16/21] hw/arm/aspeed_ast27x0: Use a table for unimplemented devices for SSP/TSP
In reply to Cédric Le GoaterFrom: Jamin Lin <[email protected]>
Before this change, each unimplemented device needed its own field in the coprocessor state. This made the code hard to maintain.
Add an unimp_devs table in AspeedCoprocessorClass to describe the unimplemented devices, and use create_unimplemented_devices() to create and map them. This makes the code easier to maintain and read. Convert AST2700 SSP and TSP to use them.
This also fixes a type mismatch. SSP and TSP used the "timerctrl" field (AspeedTimerCtrlState) to create an unimplemented device. It is not used for that anymore.
No functional change.
--- include/hw/arm/aspeed_coprocessor.h | 1 + hw/arm/aspeed_ast27x0-ssp.c | 44 +++++++++-------------------- hw/arm/aspeed_ast27x0-tsp.c | 44 +++++++++-------------------- 3 files changed, 27 insertions(+), 62 deletions(-)
include/hw/arm/aspeed_coprocessor.h +1 -0
@@ -37,6 +37,7 @@ struct AspeedCoprocessorClass {/** valid_cpu_types: NULL terminated array of a single CPU type. */ const char *const *valid_cpu_types;const hwaddr *memmap; +const UnimplementedDeviceConfig *unimp_devs;const int *irqmap; };
hw/arm/aspeed_ast27x0-ssp.c +13 -31
68 lines not on this page · raw message
hw/arm/aspeed_ast27x0-tsp.c +13 -31
68 lines not on this page · raw message
Signature · 1 line
2.56.0
[PULL 18/21] hw/arm/aspeed_ast1700: Use a table for unimplemented devices
In reply to Cédric Le GoaterFrom: Jamin Lin <[email protected]>
Before this change, the I3C unimplemented device of AST1700 needed its own field in AspeedAST1700SoCState and was created and mapped with open-coded calls.
Describe it in a table and use create_unimplemented_devices() to create and map it in the AST1700 memory region. This makes the code easier to maintain and read.
No functional change.
--- hw/arm/aspeed_ast1700.c | 21 ++++++++------------- 1 file changed, 8 insertions(+), 13 deletions(-)
hw/arm/aspeed_ast1700.c +8 -13
@@ -15,7 +15,6 @@#define AST2700_SOC_LTPI_SIZE 0x01000000#define AST1700_SOC_SRAM_SIZE 0x00040000 -#define AST1700_SOC_I3C_SIZE 0x00010000enum {ASPEED_AST1700_DEV_SPI0 ,
@@ -51,6 +50,11 @@ static const hwaddr aspeed_ast1700_io_memmap[] = { [ASPEED_AST1700_DEV_SPI0_MEM] = 0x04000000, }; +static const UnimplementedDeviceConfig aspeed_ast1700_unimp_devs[] = { + {"ioexp-i3c" ,"ioexp-i3c" ,0x00C20000 ,0x00010000 ,-1000 }, + { } +}; +static void aspeed_ast1700_realize (DeviceState *dev,Error **errp) {AspeedAST1700SoCState *s =ASPEED_AST1700 (dev);
@@ -181,14 +185,9 @@ static void aspeed_ast1700_realize(DeviceState *dev, Error **errp) sysbus_mmio_get_region(SYS_BUS_DEVICE(&s->wdt[i]), 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 ); +/* Unimplemented devices */ +create_unimplemented_devices (OBJECT (s), &s->iomem, + aspeed_ast1700_unimp_devs); }static void aspeed_ast1700_instance_init (Object *obj)
@@ -238,10 +237,6 @@ static void aspeed_ast1700_instance_init(Object *obj) &s->wdt[i], "aspeed.wdt-ast2700"); } -/* I3C */ -object_initialize_child (obj,"ioexp-i3c" , &s->i3c, -TYPE_UNIMPLEMENTED_DEVICE ); -return ; }
Signature · 1 line
2.56.0
[PULL 14/21] hw/arm/aspeed_ast1040: Use a table for unimplemented devices
In reply to Cédric Le GoaterFrom: Jamin Lin <[email protected]>
Before this change, each unimplemented device needed its own field in AspeedSoCState. This made the variable names confusing. For example, AspeedSoCState has "udc" as an unimplemented device, but Aspeed2600SoCState also has "udc" as the real UDC model.
Use the unimp_devs table in AspeedSoCClass to describe the unimplemented devices, and use create_unimplemented_devices() to create and map them. This makes the code easier to maintain and read. Convert AST1040 to use them.
This also fixes a type mismatch. AST1040 used the "pwm" field (AspeedPWMState) to create an unimplemented device. It is not used for that anymore.
No functional change.
--- hw/arm/aspeed_ast1040.c | 40 ++++++++++++---------------------------- 1 file changed, 12 insertions(+), 28 deletions(-)
hw/arm/aspeed_ast1040.c +12 -28
@@ -81,6 +81,15 @@ static const int aspeed_soc_ast1040_irqmap[] = { [ASPEED_DEV_PECI] = 164, }; +static const UnimplementedDeviceConfig aspeed_soc_ast1040_unimp_devs[] = { + {"pwm" ,"aspeed.pwm" ,0x740C0000 ,0x10000 ,-1000 }, + {"espi" ,"aspeed.espi" ,0x74C05000 ,0x1000 ,-1000 }, + {"udc" ,"aspeed.udc" ,0x74120000 ,0x4000 ,-1000 }, + {"jtag[0]" ,"aspeed.jtag0" ,0x74C01000 ,0x100 ,-1000 }, + {"jtag[1]" ,"aspeed.jtag1" ,0x74C09000 ,0x100 ,-1000 }, + { } +}; +static qemu_irq aspeed_soc_ast1040_get_irq (AspeedSoCState *s,int dev) {Aspeed10x0SoCState *a =ASPEED10X0_SOC (s);
@@ -123,14 +132,6 @@ static void aspeed_soc_ast1040_init(Object *obj)object_initialize_child (obj,"wdt[*]" , &s->wdt[i],"aspeed.wdt-ast2700" ); } - -object_initialize_child (obj,"pwm" , &s->pwm,TYPE_UNIMPLEMENTED_DEVICE ); -object_initialize_child (obj,"espi" , &s->espi,TYPE_UNIMPLEMENTED_DEVICE ); -object_initialize_child (obj,"udc" , &s->udc,TYPE_UNIMPLEMENTED_DEVICE ); -object_initialize_child (obj,"jtag[0]" , &s->jtag[0 ], -TYPE_UNIMPLEMENTED_DEVICE ); -object_initialize_child (obj,"jtag[1]" , &s->jtag[1 ], -TYPE_UNIMPLEMENTED_DEVICE ); }static void aspeed_soc_ast1040_realize (DeviceState *dev_soc,Error **errp)
@@ -267,26 +268,8 @@ static void aspeed_soc_ast1040_realize(DeviceState *dev_soc, Error **errp)aspeed_mmio_map (s->memory,SYS_BUS_DEVICE (&s->wdt[i]),0 , wdt_offset); } -/* Unimplemented peripherals */ -aspeed_mmio_map_unimplemented (s->memory,SYS_BUS_DEVICE (&s->pwm), -"aspeed.pwm" , - sc->memmap[ASPEED_DEV_PWM ],0x10000 ); - -aspeed_mmio_map_unimplemented (s->memory,SYS_BUS_DEVICE (&s->espi), -"aspeed.espi" , - sc->memmap[ASPEED_DEV_ESPI ],0x1000 ); - -aspeed_mmio_map_unimplemented (s->memory,SYS_BUS_DEVICE (&s->udc), -"aspeed.udc" , - sc->memmap[ASPEED_DEV_UDC ],0x4000 ); - -aspeed_mmio_map_unimplemented (s->memory,SYS_BUS_DEVICE (&s->jtag[0 ]), -"aspeed.jtag0" , - sc->memmap[ASPEED_DEV_JTAG0 ],0x100 ); - -aspeed_mmio_map_unimplemented (s->memory,SYS_BUS_DEVICE (&s->jtag[1 ]), -"aspeed.jtag1" , - sc->memmap[ASPEED_DEV_JTAG1 ],0x100 ); +/* Unimplemented devices */ +create_unimplemented_devices (OBJECT (s), s->memory, sc->unimp_devs); }static void aspeed_soc_ast1040_class_init (ObjectClass *klass,const void *data)
@@ -312,6 +295,7 @@ static void aspeed_soc_ast1040_class_init(ObjectClass *klass, const void *data) sc->uarts_base =ASPEED_DEV_UART0 ; sc->irqmap = aspeed_soc_ast1040_irqmap; sc->memmap = aspeed_soc_ast1040_memmap; + sc->unimp_devs = aspeed_soc_ast1040_unimp_devs; sc->num_cpus =1 ; }
Signature · 1 line
2.56.0
[PULL 21/21] tests/functional: give the set_machine probe VM the test workdir
In reply to Cédric Le GoaterFrom: Emmanuel Blot <[email protected]>
set_machine() launches a throwaway QEMUMachine to query the available machine types, but constructs it without base_temp_dir, so it falls back to the hardcoded "/var/tmp" default instead of the writable per-test workdir that the actual test VM already uses. Pass base_temp_dir= self.workdir for consistency; this also fixes VM launch on hosts where /var/tmp is not writable.
--- tests/functional/qemu_test/testcase.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tests/functional/qemu_test/testcase.py +1 -1
@@ -317,7 +317,7 @@ def set_machine(self, machinename): cls = type(self) if not hasattr(cls, "_machines"): - tmp_vm = QEMUMachine(self.qemu_bin) + tmp_vm = QEMUMachine(self.qemu_bin, base_temp_dir=self.workdir) tmp_vm.set_machine('none') try:
Signature · 1 line
2.56.0
[PULL 08/21] MAINTAINERS: Update ASPEED BMCs reviewers
In reply to Cédric Le GoaterFrom: Jamin Lin <[email protected]>
Update the ASPEED BMCs reviewer list to reflect the current active reviewers.
--- MAINTAINERS | 4 ---- 1 file changed, 4 deletions(-)
MAINTAINERS +0 -4
@@ -1265,12 +1265,8 @@ F: tests/functional/arm/test_emcraft_sf2.py ASPEED BMCs M: Cédric Le Goater <[email protected]> M: Peter Maydell <[email protected]> -R: Steven Lee <[email protected]> -R: Troy Lee <[email protected]> R: Jamin Lin <[email protected]> R: Kane Chen <[email protected]> -R: Andrew Jeffery <[email protected]> -R: Joel Stanley <[email protected]> L: [email protected] S: Maintained F: hw/*/*aspeed*
Signature · 1 line
2.56.0
[PULL 17/21] hw/arm/aspeed_coprocessor: Remove unused unimplemented device fields
In reply to Cédric Le GoaterFrom: Jamin Lin <[email protected]>
AST2700 SSP and TSP now use the unimp_devs table and create_unimplemented_devices() for their unimplemented devices. Remove the old "ipc", "pric" and "otp" fields in Aspeed27x0CoprocessorState and the "timerctrl" field in AspeedCoprocessorState, which are not used anymore.
No functional change.
--- include/hw/arm/aspeed_coprocessor.h | 4 ---- 1 file changed, 4 deletions(-)
include/hw/arm/aspeed_coprocessor.h +0 -4
@@ -22,7 +22,6 @@ struct AspeedCoprocessorState {MemoryRegion uart_alias;Clock *sysclk; -AspeedTimerCtrlState timerctrl;SerialMM *uart;int uart_dev; };
@@ -44,9 +43,6 @@ struct AspeedCoprocessorClass {struct Aspeed27x0CoprocessorState {AspeedCoprocessorState parent;AspeedINTCState intc[2 ]; -UnimplementedDeviceState ipc[2 ]; -UnimplementedDeviceState pric[2 ]; -UnimplementedDeviceState otp;ARMv7MState armv7m;
Signature · 1 line
2.56.0
[PULL 10/21] hw/arm/aspeed_ast2400: Use a table for unimplemented devices
In reply to Cédric Le GoaterFrom: Jamin Lin <[email protected]>
Before this change, each unimplemented device needed its own field in AspeedSoCState. This made the variable names confusing. For example, AspeedSoCState has "udc" as an unimplemented device, but Aspeed2600SoCState also has "udc" as the real UDC model.
Add an unimp_devs table in AspeedSoCClass to describe the unimplemented devices, and use create_unimplemented_devices() to create and map them. This makes the code easier to maintain and read. Convert AST2400/AST2500 to use them.
No functional change.
--- include/hw/arm/aspeed_soc.h | 1 + hw/arm/aspeed_ast2400.c | 25 ++++++++++--------------- 2 files changed, 11 insertions(+), 15 deletions(-)
include/hw/arm/aspeed_soc.h +1 -0
@@ -190,6 +190,7 @@ struct AspeedSoCClass {int ioexp_num;const int *irqmap;const hwaddr *memmap; +const UnimplementedDeviceConfig *unimp_devs;uint32_t num_cpus;bool (*boot_from_emmc)(AspeedSoCState *s); };
hw/arm/aspeed_ast2400.c +10 -15
@@ -23,8 +23,6 @@#include "system/system.h" #include "target/arm/cpu-qom.h" -#define ASPEED_SOC_IOMEM_SIZE 0x00200000 -static const hwaddr aspeed_soc_ast2400_memmap[] = { [ASPEED_DEV_SPI_BOOT ] =0x00000000 , [ASPEED_DEV_IOMEM ] =0x1E600000 ,
@@ -134,6 +132,12 @@ static const int aspeed_soc_ast2400_irqmap[] = {#define aspeed_soc_ast2500_irqmap aspeed_soc_ast2400_irqmap +static const UnimplementedDeviceConfig aspeed_soc_ast2400_unimp_devs[] = { + {"iomem" ,"aspeed.io" ,0x1E600000 ,0x00200000 ,-1000 }, + {"video" ,"aspeed.video" ,0x1E700000 ,0x1000 ,-1000 }, + { } +}; +static qemu_irq aspeed_soc_ast2400_get_irq (AspeedSoCState *s,int dev) {Aspeed2400SoCState *a =ASPEED2400_SOC (s);
@@ -239,9 +243,6 @@ static void aspeed_ast2400_soc_init(Object *obj)snprintf (typename,sizeof (typename),"aspeed.hace-%s" , socname);object_initialize_child (obj,"hace" , &s->hace, typename); - -object_initialize_child (obj,"iomem" , &s->iomem,TYPE_UNIMPLEMENTED_DEVICE ); -object_initialize_child (obj,"video" , &s->video,TYPE_UNIMPLEMENTED_DEVICE ); }static void aspeed_ast2400_soc_realize (DeviceState *dev,Error **errp)
@@ -259,16 +260,8 @@ static void aspeed_ast2400_soc_realize(DeviceState *dev, Error **errp)memory_region_add_subregion (s->memory, sc->memmap[ASPEED_DEV_SPI_BOOT ], &s->spi_boot_container); -/* IO space */ -aspeed_mmio_map_unimplemented (s->memory,SYS_BUS_DEVICE (&s->iomem), -"aspeed.io" , - sc->memmap[ASPEED_DEV_IOMEM ], -ASPEED_SOC_IOMEM_SIZE ); - -/* Video engine stub */ -aspeed_mmio_map_unimplemented (s->memory,SYS_BUS_DEVICE (&s->video), -"aspeed.video" , - sc->memmap[ASPEED_DEV_VIDEO ],0x1000 ); +/* Unimplemented devices */ +create_unimplemented_devices (OBJECT (s), s->memory, sc->unimp_devs);/* CPU */ for (i =0 ; i < sc->num_cpus; i++) {
@@ -542,6 +535,7 @@ static void aspeed_soc_ast2400_class_init(ObjectClass *oc, const void *data) sc->uarts_base =ASPEED_DEV_UART1 ; sc->irqmap = aspeed_soc_ast2400_irqmap; sc->memmap = aspeed_soc_ast2400_memmap; + sc->unimp_devs = aspeed_soc_ast2400_unimp_devs; sc->num_cpus =1 ; }
@@ -569,6 +563,7 @@ static void aspeed_soc_ast2500_class_init(ObjectClass *oc, const void *data) sc->uarts_base =ASPEED_DEV_UART1 ; sc->irqmap = aspeed_soc_ast2500_irqmap; sc->memmap = aspeed_soc_ast2500_memmap; + sc->unimp_devs = aspeed_soc_ast2400_unimp_devs; sc->num_cpus =1 ; }
Signature · 1 line
2.56.0
[PULL 09/21] hw/misc/unimp: Add create_unimplemented_devices() helper
In reply to Cédric Le GoaterFrom: Jamin Lin <[email protected]>
Several boards and SoCs create many unimplemented devices. Each of them uses its own structure and helper to describe and map these devices.
Add an UnimplementedDeviceConfig structure and a create_unimplemented_devices() helper. The helper creates an unimplemented device for each entry of a table, adds it as a QOM child of the parent object, and maps it in a memory region container with the given priority. The table is terminated by an empty entry.
--- include/hw/misc/unimp.h | 21 +++++++++++++++++++++ hw/misc/unimp.c | 20 ++++++++++++++++++++ 2 files changed, 41 insertions(+)
include/hw/misc/unimp.h +21 -0
@@ -25,6 +25,27 @@ struct UnimplementedDeviceState {uint64_t size; }; +typedef struct UnimplementedDeviceConfig { +const char *qom_name; +const char *region_name; +uint64_t offset; +uint64_t size; +int priority; +}UnimplementedDeviceConfig ; + +/** +* create_unimplemented_devices: +* @parentobj: the parent object +* @container: a #MemoryRegion within which @addr is a relative address +* @devconfigs: NULL terminated array of #UnimplementedDeviceConfig +* +* For each entries in @devconfigs, create a TYPE_UNIMPLEMENTED_DEVICE +* and mmap it in @container at UnimplementedDeviceConfig::offset. +* @container is expected to be a QOM child of @parentobj. +*/ +void create_unimplemented_devices (Object *parentobj,MemoryRegion *container, +const UnimplementedDeviceConfig *devconfigs); +/** * create_unimplemented_device: create and map a dummy device * @name: name of the device for debug logging
hw/misc/unimp.c +20 -0
@@ -96,3 +96,23 @@ static void unimp_register_types(void) }type_init (unimp_register_types) + +void create_unimplemented_devices(Object *parentobj, MemoryRegion *container, +const UnimplementedDeviceConfig *devconfigs) +{ +const UnimplementedDeviceConfig *cfg; + +for (cfg = devconfigs; cfg->qom_name; cfg++) { +DeviceState *dev =qdev_new (TYPE_UNIMPLEMENTED_DEVICE ); +SysBusDevice *sbd =SYS_BUS_DEVICE (dev); + +object_property_add_child (parentobj, cfg->qom_name,OBJECT (dev)); +qdev_prop_set_string (dev,"name" , cfg->region_name); +qdev_prop_set_uint64 (dev,"size" , cfg->size); +sysbus_realize_and_unref (sbd, &error_fatal); + +memory_region_add_subregion_overlap (container, cfg->offset, +sysbus_mmio_get_region (sbd,0 ), + cfg->priority); + } +}
Signature · 1 line
2.56.0
[PULL 20/21] hw/arm/aspeed: Remove unused aspeed_mmio_map_unimplemented()
In reply to Cédric Le GoaterFrom: Jamin Lin <[email protected]>
All Aspeed SoCs now use create_unimplemented_devices() to create and map their unimplemented devices. Remove aspeed_mmio_map_unimplemented(), which is not used anymore.
No functional change.
--- include/hw/arm/aspeed_soc.h | 3 --- hw/arm/aspeed_soc_common.c | 11 ----------- 2 files changed, 14 deletions(-)
include/hw/arm/aspeed_soc.h +0 -3
@@ -307,9 +307,6 @@ void aspeed_soc_uart_set_chr(SerialMM *uart, int dev, int uarts_base,bool aspeed_soc_dram_init (AspeedSoCState *s,Error **errp);void aspeed_mmio_map (MemoryRegion *memory,SysBusDevice *dev,int n,hwaddr addr); -void aspeed_mmio_map_unimplemented (MemoryRegion *memory,SysBusDevice *dev, -const char *name,hwaddr addr, -uint64_t size);void aspeed_board_init_flashes (AspeedSMCState *s,const char *flashtype,unsigned int count,int unit0); void aspeed_write_boot_rom(BlockBackend *blk, hwaddr addr, size_t rom_size,
hw/arm/aspeed_soc_common.c +0 -11
@@ -104,17 +104,6 @@ void aspeed_mmio_map(MemoryRegion *memory, SysBusDevice *dev, int n,memory_region_add_subregion (memory, addr,sysbus_mmio_get_region (dev, n)); } -void aspeed_mmio_map_unimplemented (MemoryRegion *memory,SysBusDevice *dev, -const char *name,hwaddr addr,uint64_t size) -{ -qdev_prop_set_string (DEVICE (dev),"name" , name); -qdev_prop_set_uint64 (DEVICE (dev),"size" , size); -sysbus_realize (dev, &error_abort); - -memory_region_add_subregion_overlap (memory, addr, -sysbus_mmio_get_region (dev,0 ),-1000 ); -} -void aspeed_board_init_flashes (AspeedSMCState *s,const char *flashtype,unsigned int count,int unit0) {
Signature · 1 line
2.56.0
[PULL 15/21] hw/arm/aspeed: Remove unused unimplemented device fields
In reply to Cédric Le GoaterFrom: Jamin Lin <[email protected]>
All Aspeed SoCs now use the unimp_devs table and create_unimplemented_devices() for their unimplemented devices. Remove the old fields in AspeedSoCState and the ASPEED_JTAG_NUM define, which are not used anymore.
No functional change.
--- include/hw/arm/aspeed_soc.h | 10 ---------- 1 file changed, 10 deletions(-)
include/hw/arm/aspeed_soc.h +0 -10
@@ -59,7 +59,6 @@#define ASPEED_CPUS_NUM 4#define ASPEED_MACS_NUM 4#define ASPEED_UARTS_NUM 13 -#define ASPEED_JTAG_NUM 2#define ASPEED_PCIE_NUM 3#define ASPEED_INTC_NUM 2#define ASPEED_IOEXP_NUM 2
@@ -110,15 +109,6 @@ struct AspeedSoCState {AspeedPECIState peci;SerialMM uart[ASPEED_UARTS_NUM ];Clock *sysclk; -UnimplementedDeviceState iomem; -UnimplementedDeviceState iomem0; -UnimplementedDeviceState iomem1; -UnimplementedDeviceState video; -UnimplementedDeviceState emmc_boot_controller; -UnimplementedDeviceState dpmcu; -UnimplementedDeviceState espi; -UnimplementedDeviceState udc; -UnimplementedDeviceState jtag[ASPEED_JTAG_NUM ];AspeedAPB2OPBState fsi[2 ];AspeedLTPIState ltpi_ctrl[ASPEED_IOEXP_NUM ];AspeedAST1700SoCState ioexp[ASPEED_IOEXP_NUM ];
Signature · 1 line
2.56.0
Richard Henderson
AppliedQuoted 15 lines · Cédric Le Goater
The following changes since commit
d5b5083cb783c447001e862c2b525e59f48ad78c:Merge tag 'block-pull-request' ofhttps://gitlab.com/stefanha/qemu into staging (2026-10-15 11:53:41 +0200)are available in the Git repository at:
https://github.com/legoater/qemu/ tags/pull-aspeed-20261015for you to fetch changes up to
4cf1f0e37d9491eb8b0c8be8dd9dab9260b8fa36:tests/functional: give the set_machine probe VM the test workdir (2026-10-15 13:14:09 +0200)----------------------------------------------------------------
aspeed queue:
Quoted 11 lines
* Fix OOB read in HACE
has_padding()whenpadding_sizeis zero
* Allocate ACRY RSA qtest SRAM buffers on the heap to reduce stack usage
* Consolidate OTP layout definitions betweenaspeed_otpandaspeed_sbc
* Derive ABR and secure boot state from OTP config straps, removing the "emmc-abr" and "signing-settings" machine properties
* Sort device IDs alphabetically
* Add I2C test for IO expander 1 on the AST2700A2
* Update ASPEED BMCs reviewer list
* Add acreate_unimplemented_devices()helper and convert all Aspeed SoCs and coprocessors to table-driven unimplemented devices
* Fix theset_machineprobe VM to use the test workdir
Applied, thanks.
r~