aspeed queue
Subsystems (2)
The following changes since commit d9a4282c4b690e45d25c2b933f318bb41eeb271d:
Merge tag 'pull-tcg-20250308' of https://gitlab.com/rth7680/qemu into staging (2025-03-09 11:45:00 +0800)
are available in the Git repository at:
https://github.com/legoater/qemu/ tags/pull-aspeed-20250309
for you to fetch changes up to 5ab179db11ca297c9e89a6d57f954d31965cbd7b:
docs/specs: Add aspeed-intc (2025-03-09 14:36:53 +0100)
----------------------------------------------------------------
aspeed queue:
* Updated Aspeed OpenBMC functional test images
* Introduced functional tests for witherspoon and bletchley machines
* Added support for Non-maskable Interrupt on AST2700 SoC
* Fixed HW strapping on AST2700 SoC
* Added AST2700 HACE support
* Added AST2700 A1 SoC support
* Intoduced new ast2700a1-evb machine
----------------------------------------------------------------
Cédric Le Goater (6):
tests/functional: Introduce a new test routine for OpenBMC images tests/functional: Update OpenBMC image of palmetto machine tests/functional: Update OpenBMC image of romulus machine tests/functional: Introduce a witherspoon machine test tests/functional: Introduce a bletchley machine test
aspeed: Remove duplicate typename in AspeedSoCClass
Jamin Lin (40):
aspeed/soc: Support Non-maskable Interrupt for AST2700
hw/misc/aspeed_hace: Fix coding style
hw/misc/aspeed_hace: Add AST2700 support
hw/arm/aspeed_ast27x0: Add HACE support for AST2700
hw/misc/aspeed_hace: Fix boot issue in the Crypto Manager Self Test hw/misc/aspeed_scu: Skipping dram_init in u-boot
hw/misc/aspeed_scu: Fix the revision ID cannot be set in the SOC layer for AST2700 hw/arm/aspeed Update HW Strap Default Values for AST2700
hw/misc/aspeed_scu: Fix the hw-strap1 cannot be set in the SOC layer for AST2700 hw/arm/aspeed_ast27x0.c Separate HW Strap Registers for SCU and SCUIO hw/arm/aspeed_ast27x0.c Fix boot issue for AST2700
hw/intc/aspeed: Support setting different memory size
hw/intc/aspeed: Rename status_addr and addr to status_reg and reg for clarity hw/intc/aspeed: Introduce dynamic allocation for regs array
hw/intc/aspeed: Support setting different register size
hw/intc/aspeed: Reduce regs array size by adding a register sub-region hw/intc/aspeed: Introduce helper functions for enable and status registers hw/intc/aspeed: Add object type name to trace events for better debugging hw/arm/aspeed: Rename IRQ table and machine name for AST2700 A0 hw/arm/aspeed_ast27x0: Sort the IRQ table by IRQ number
hw/intc/aspeed: Support different memory region ops
hw/intc/aspeed: Rename num_ints to num_inpins for clarity
hw/intc/aspeed: Add support for multiple output pins in INTC
hw/intc/aspeed: Refactor INTC to support separate input and output pin indices hw/intc/aspeed: Introduce AspeedINTCIRQ structure to save the irq index and register address hw/intc/aspeed: Introduce IRQ handler function to reduce code duplication hw/intc/aspeed: Add Support for Multi-Output IRQ Handling
hw/intc/aspeed: Add Support for AST2700 INTCIO Controller hw/misc/aspeed_scu: Add Support for AST2700/AST2750 A1 Silicon Revisions hw/arm/aspeed_ast27x0.c Support AST2700 A1 GIC Interrupt Mapping hw/arm/aspeed_ast27x0: Define an Array of AspeedINTCState with Two Instances hw/arm/aspeed_ast27x0: Support two levels of INTC controllers for AST2700 A1 hw/arm/aspeed_ast27x0: Add SoC Support for AST2700 A1
hw/arm/aspeed: Add Machine Support for AST2700 A1
hw/arm/aspeed_ast27x0: Sort the memmap table by mapping address tests/functional/aspeed: Introduce start_ast2700_test API tests/functional/aspeed: Update temperature hwmon path tests/functional/aspeed: Update test ASPEED SDK v09.05 tests/functional/aspeed: Add test case for AST2700 A1
docs/specs: Add aspeed-intc
docs/specs/aspeed-intc.rst | 136 +++++ docs/specs/index.rst | 1 + include/hw/arm/aspeed_soc.h | 4 +- include/hw/intc/aspeed_intc.h | 36 +- include/hw/misc/aspeed_hace.h | 2 + include/hw/misc/aspeed_scu.h | 2 + hw/arm/aspeed.c | 39 +- hw/arm/aspeed_ast10x0.c | 3 +- hw/arm/aspeed_ast2400.c | 4 +- hw/arm/aspeed_ast2600.c | 3 +- hw/arm/aspeed_ast27x0.c | 359 +++++++++---- hw/intc/aspeed_intc.c | 667 ++++++++++++++++++------ hw/misc/aspeed_hace.c | 55 +- hw/misc/aspeed_scu.c | 10 +- hw/intc/trace-events | 25 +- tests/functional/aspeed.py | 24 +- tests/functional/meson.build | 4 + tests/functional/test_aarch64_aspeed.py | 47 +- tests/functional/test_arm_aspeed_bletchley.py | 25 + tests/functional/test_arm_aspeed_palmetto.py | 13 +- tests/functional/test_arm_aspeed_romulus.py | 13 +- tests/functional/test_arm_aspeed_witherspoon.py | 25 + 22 files changed, 1150 insertions(+), 347 deletions(-) create mode 100644 docs/specs/aspeed-intc.rst create mode 100644 tests/functional/test_arm_aspeed_bletchley.py create mode 100644 tests/functional/test_arm_aspeed_witherspoon.py
[PULL 10/46] hw/arm/aspeed_ast27x0: Add HACE support for AST2700
From: Jamin Lin <[email protected]>
The HACE controller between AST2600 and AST2700 are almost identical. The HACE controller registers base address starts at 0x1207_0000 and its alarm interrupt is connected to GICINT4.
--- hw/arm/aspeed_ast27x0.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+)
hw/arm/aspeed_ast27x0.c +15 -0
@@ -67,6 +67,7 @@ static const hwaddr aspeed_soc_ast2700_memmap[] = { [ASPEED_DEV_RTC] = 0x12C0F000, [ASPEED_DEV_SDHCI] = 0x14080000, [ASPEED_DEV_TIMER1] = 0x12C10000, + [ASPEED_DEV_HACE] = 0x12070000, };#define AST2700_MAX_IRQ 256
@@ -401,6 +402,9 @@ static void aspeed_soc_ast2700_init(Object *obj)snprintf (typename,sizeof (typename),"aspeed.timer-%s" , socname);object_initialize_child (obj,"timerctrl" , &s->timerctrl, typename); + +snprintf (typename,sizeof (typename),"aspeed.hace-%s" , socname); +object_initialize_child (obj,"hace" , &s->hace, typename); }/*
@@ -737,6 +741,17 @@ static void aspeed_soc_ast2700_realize(DeviceState *dev, Error **errp)sysbus_connect_irq (SYS_BUS_DEVICE (&s->timerctrl), i, irq); } +/* HACE */ +object_property_set_link (OBJECT (&s->hace),"dram" ,OBJECT (s->dram_mr), + &error_abort); +if (!sysbus_realize (SYS_BUS_DEVICE (&s->hace), errp)) { +return ; + } +aspeed_mmio_map (s,SYS_BUS_DEVICE (&s->hace),0 , + sc->memmap[ASPEED_DEV_HACE ]); +sysbus_connect_irq (SYS_BUS_DEVICE (&s->hace),0 , +aspeed_soc_get_irq (s,ASPEED_DEV_HACE )); +create_unimplemented_device ("ast2700.dpmcu" ,0x11000000 ,0x40000 );create_unimplemented_device ("ast2700.iomem0" ,0x12000000 ,0x01000000 );create_unimplemented_device ("ast2700.iomem1" ,0x14000000 ,0x01000000 );
Signature · 1 line
2.48.1
[PULL 11/46] hw/misc/aspeed_hace: Fix boot issue in the Crypto Manager Self Test
In reply to Cédric Le GoaterFrom: Jamin Lin <[email protected]>
Currently, it does not support the CRYPT command. Instead, it only sends an interrupt to notify the firmware that the crypt command has completed. It is a temporary workaround to resolve the boot issue in the Crypto Manager Self Test.
Introduce a new "use_crypt_workaround" class attribute and set it to true in the AST2700 HACE model to enable this workaround by default for AST2700.
--- include/hw/misc/aspeed_hace.h | 1 + hw/misc/aspeed_hace.c | 23 +++++++++++++++++++++++ 2 files changed, 24 insertions(+)
include/hw/misc/aspeed_hace.h +1 -0
@@ -50,6 +50,7 @@ struct AspeedHACEClass {uint32_t dest_mask;uint32_t key_mask;uint32_t hash_mask; + bool raise_crypt_interrupt_workaround; };#endif /* ASPEED_HACE_H */
hw/misc/aspeed_hace.c +23 -0
@@ -59,6 +59,7 @@/* Other cmd bits */ #define HASH_IRQ_EN BIT(9)#define HASH_SG_EN BIT(18) +#define CRYPT_IRQ_EN BIT(12)/* Scatter-gather data list */ #define SG_LIST_LEN_SIZE 4#define SG_LIST_LEN_MASK 0x0FFFFFFF
@@ -343,6 +344,15 @@ static void aspeed_hace_write(void *opaque, hwaddr addr, uint64_t data,qemu_irq_lower (s->irq); } } +if (ahc->raise_crypt_interrupt_workaround) { +if (data &CRYPT_IRQ ) { + data &= ~CRYPT_IRQ ; + +if (s->regs[addr] &CRYPT_IRQ ) { +qemu_irq_lower (s->irq); + } + } + }break ;case R_HASH_SRC : data &= ahc->src_mask;
@@ -388,6 +398,12 @@ static void aspeed_hace_write(void *opaque, hwaddr addr, uint64_t data,case R_CRYPT_CMD :qemu_log_mask (LOG_UNIMP ,"%s: Crypt commands not implemented\n" , __func__); +if (ahc->raise_crypt_interrupt_workaround) { + s->regs[R_STATUS ] |=CRYPT_IRQ ; +if (data &CRYPT_IRQ_EN ) { +qemu_irq_raise (s->irq); + } + }break ;default :break ;
@@ -563,6 +579,13 @@ static void aspeed_ast2700_hace_class_init(ObjectClass *klass, void *data) ahc->dest_mask =0x7FFFFFF8 ; ahc->key_mask =0x7FFFFFF8 ; ahc->hash_mask =0x00147FFF ; + +/* +* Currently, it does not support the CRYPT command. Instead, it only +* sends an interrupt to notify the firmware that the crypt command +* has completed. It is a temporary workaround. +*/ + ahc->raise_crypt_interrupt_workaround = true; }static const TypeInfo aspeed_ast2700_hace_info = {
Signature · 1 line
2.48.1
[PULL 13/46] hw/misc/aspeed_scu: Fix the revision ID cannot be set in the SOC layer for AST2700
In reply to Cédric Le GoaterFrom: Jamin Lin <[email protected]>
According to the design of the AST2600, it has a Silicon Revision ID Register, specifically SCU004 and SCU014, to set the Revision ID for the AST2600. For the AST2600 A3, SCU004 is set to 0x05030303 and SCU014 is set to 0x05030303. In the "aspeed_ast2600_scu_reset" function, the hardcoded value "AST2600_A3_SILICON_REV" is set in SCU004, and "s->silicon_rev" is set in SCU014. The value of "s->silicon_rev" is set by the SOC layer via the "silicon-rev" property.
However, the design of the AST2700 is different. There are two SCU controllers:
SCU0 (CPU Die) and SCU1 (IO Die). In the AST2700, the firmware reads the SCU Silicon Revision ID register (SCU0_000) and the SCUIO Silicon Revision ID register (SCU1_000), combining them into a single 64-bit value.
The upper 32 bits represent the SCUIO, while the lower 32 bits correspond to the SCU. For example, the AST2700-A1 revision is represented as 0x0601010306010103. SCUIO_000 occupies bits [63:32] with a value of 0x06010103 and SCU_000 occupies bits [31:0] with a value of 0x06010103.
--- hw/misc/aspeed_scu.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
hw/misc/aspeed_scu.c +1 -2
@@ -910,7 +910,6 @@ static const MemoryRegionOps aspeed_ast2700_scu_ops = { };static const uint32_t ast2700_a0_resets[ASPEED_AST2700_SCU_NR_REGS ] = { - [AST2700_SILICON_REV ] =AST2700_A0_SILICON_REV , [AST2700_HW_STRAP1 ] =0x00000800 , [AST2700_HW_STRAP1_CLR ] =0xFFF0FFF0 , [AST2700_HW_STRAP1_LOCK ] =0x00000FFF ,
@@ -940,6 +939,7 @@ static void aspeed_ast2700_scu_reset(DeviceState *dev)AspeedSCUClass *asc =ASPEED_SCU_GET_CLASS (dev);memcpy (s->regs, asc->resets, asc->nr_regs *4 ); + s->regs[AST2700_SILICON_REV ] = s->silicon_rev; }static void aspeed_2700_scu_class_init (ObjectClass *klass,void *data)
@@ -1032,7 +1032,6 @@ static const MemoryRegionOps aspeed_ast2700_scuio_ops = { };static const uint32_t ast2700_a0_resets_io[ASPEED_AST2700_SCU_NR_REGS ] = { - [AST2700_SILICON_REV ] =0x06000003 , [AST2700_HW_STRAP1 ] =0x00000504 , [AST2700_HW_STRAP1_CLR ] =0xFFF0FFF0 , [AST2700_HW_STRAP1_LOCK ] =0x00000FFF ,
Signature · 1 line
2.48.1
[PULL 01/46] tests/functional: Introduce a new test routine for OpenBMC images
In reply to Cédric Le GoaterThe OpenBMC images currently used by QEMU to test the Aspeed machines are rather old. To prepare an update to the latest builds, we need to adjust the console patterns. Introduce a new routine to preserve the current tests.
--- tests/functional/aspeed.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+)
tests/functional/aspeed.py +18 -0
@@ -23,6 +23,24 @@ def do_test_arm_aspeed(self, machine, image): self.wait_for_console_pattern("ftgmac100 1e660000.ethernet eth0: irq ") self.wait_for_console_pattern("systemd[1]: Set hostname to") + def do_test_arm_aspeed_openbmc(self, machine, image, uboot='2019.04', + cpu_id='0x0', soc='AST2500 rev A1'): + hostname = machine.removesuffix('-bmc') + + self.set_machine(machine) + self.vm.set_console() + self.vm.add_args('-drive', f'file={image},if=mtd,format=raw', + '-snapshot') + self.vm.launch() + + self.wait_for_console_pattern(f'U-Boot {uboot}') + self.wait_for_console_pattern('## Loading kernel from FIT Image') + self.wait_for_console_pattern('Starting kernel ...') + self.wait_for_console_pattern(f'Booting Linux on physical CPU {cpu_id}') + self.wait_for_console_pattern(f'ASPEED {soc}') + self.wait_for_console_pattern('/init as init process') + self.wait_for_console_pattern(f'systemd[1]: Hostname set to <{hostname}>.') + def do_test_arm_aspeed_buildroot_start(self, image, cpu_id, pattern='Aspeed EVB'): self.require_netdev('user') self.vm.set_console()
Signature · 1 line
2.48.1
[PULL 19/46] hw/intc/aspeed: Rename status_addr and addr to status_reg and reg for clarity
In reply to Cédric Le GoaterFrom: Jamin Lin <[email protected]>
Rename the variables "status_addr" to "status_reg" and "addr" to "reg" because they are used as register index. This change makes the code more appropriate and improves readability.
--- hw/intc/aspeed_intc.c | 38 +++++++++++++++++++------------------- 1 file changed, 19 insertions(+), 19 deletions(-)
hw/intc/aspeed_intc.c +19 -19
@@ -60,7 +60,7 @@ static void aspeed_intc_set_irq(void *opaque, int irq, int level) {AspeedINTCState *s = (AspeedINTCState *)opaque;AspeedINTCClass *aic =ASPEED_INTC_GET_CLASS (s); -uint32_t status_addr =GICINT_STATUS_BASE + ((0x100 * irq) >>2 ); +uint32_t status_reg =GICINT_STATUS_BASE + ((0x100 * irq) >>2 );uint32_t select =0 ;uint32_t enable;int i;
@@ -92,7 +92,7 @@ static void aspeed_intc_set_irq(void *opaque, int irq, int level)trace_aspeed_intc_select (select); -if (s->mask[irq] || s->regs[status_addr]) { +if (s->mask[irq] || s->regs[status_reg]) {/* * a. mask is not 0 means in ISR mode * sources interrupt routine are executing.
@@ -108,8 +108,8 @@ static void aspeed_intc_set_irq(void *opaque, int irq, int level)* notify firmware which source interrupt are coming * by setting status register */ - s->regs[status_addr] = select; -trace_aspeed_intc_trigger_irq (irq, s->regs[status_addr]); + s->regs[status_reg] = select; +trace_aspeed_intc_trigger_irq (irq, s->regs[status_reg]);aspeed_intc_update (s, irq,1 ); } }
@@ -117,17 +117,17 @@ static void aspeed_intc_set_irq(void *opaque, int irq, int level)static uint64_t aspeed_intc_read (void *opaque,hwaddr offset,unsigned int size) {AspeedINTCState *s =ASPEED_INTC (opaque); -uint32_t addr = offset >>2 ; +uint32_t reg = offset >>2 ;uint32_t value =0 ; -if (addr >=ASPEED_INTC_NR_REGS ) { +if (reg >=ASPEED_INTC_NR_REGS ) {qemu_log_mask (LOG_GUEST_ERROR ,"%s: Out-of-bounds read at offset 0x%" HWADDR_PRIx"\n" , __func__, offset);return 0 ; } - value = s->regs[addr]; + value = s->regs[reg];trace_aspeed_intc_read (offset, size, value);return value;
@@ -138,12 +138,12 @@ static void aspeed_intc_write(void *opaque, hwaddr offset, uint64_t data, {AspeedINTCState *s =ASPEED_INTC (opaque);AspeedINTCClass *aic =ASPEED_INTC_GET_CLASS (s); -uint32_t addr = offset >>2 ; +uint32_t reg = offset >>2 ;uint32_t old_enable;uint32_t change;uint32_t irq; -if (addr >=ASPEED_INTC_NR_REGS ) { +if (reg >=ASPEED_INTC_NR_REGS ) {qemu_log_mask (LOG_GUEST_ERROR ,"%s: Out-of-bounds write at offset 0x%" HWADDR_PRIx"\n" , __func__, offset);
@@ -152,7 +152,7 @@ static void aspeed_intc_write(void *opaque, hwaddr offset, uint64_t data,trace_aspeed_intc_write (offset, size, data); -switch (addr) { +switch (reg) {case R_GICINT128_EN :case R_GICINT129_EN :case R_GICINT130_EN :
@@ -177,7 +177,7 @@ static void aspeed_intc_write(void *opaque, hwaddr offset, uint64_t data,/* disable all source interrupt */ if (!data && !s->enable[irq]) { - s->regs[addr] = data; + s->regs[reg] = data;return ; }
@@ -187,12 +187,12 @@ static void aspeed_intc_write(void *opaque, hwaddr offset, uint64_t data,/* enable new source interrupt */ if (old_enable != s->enable[irq]) {trace_aspeed_intc_enable (s->enable[irq]); - s->regs[addr] = data; + s->regs[reg] = data;return ; }/* mask and unmask source interrupt */ - change = s->regs[addr] ^ data; + change = s->regs[reg] ^ data;if (change & data) { s->mask[irq] &= ~change;trace_aspeed_intc_unmask (change, s->mask[irq]);
@@ -200,7 +200,7 @@ static void aspeed_intc_write(void *opaque, hwaddr offset, uint64_t data, s->mask[irq] |= change;trace_aspeed_intc_mask (change, s->mask[irq]); } - s->regs[addr] = data; + s->regs[reg] = data;break ;case R_GICINT128_STATUS :case R_GICINT129_STATUS :
@@ -220,7 +220,7 @@ static void aspeed_intc_write(void *opaque, hwaddr offset, uint64_t data, }/* clear status */ - s->regs[addr] &= ~data; + s->regs[reg] &= ~data;/* * These status registers are used for notify sources ISR are executed.
@@ -233,7 +233,7 @@ static void aspeed_intc_write(void *opaque, hwaddr offset, uint64_t data, }/* All source ISR execution are done */ -if (!s->regs[addr]) { +if (!s->regs[reg]) {trace_aspeed_intc_all_isr_done (irq);if (s->pending[irq]) {/*
@@ -241,9 +241,9 @@ static void aspeed_intc_write(void *opaque, hwaddr offset, uint64_t data,* notify firmware which source interrupt are pending * by setting status register */ - s->regs[addr] = s->pending[irq]; + s->regs[reg] = s->pending[irq]; s->pending[irq] =0 ; -trace_aspeed_intc_trigger_irq (irq, s->regs[addr]); +trace_aspeed_intc_trigger_irq (irq, s->regs[reg]);aspeed_intc_update (s, irq,1 ); }else {/* clear irq */
@@ -253,7 +253,7 @@ static void aspeed_intc_write(void *opaque, hwaddr offset, uint64_t data, }break ;default : - s->regs[addr] = data; + s->regs[reg] = data;break ; }
Signature · 1 line
2.48.1
[PULL 22/46] hw/intc/aspeed: Reduce regs array size by adding a register sub-region
In reply to Cédric Le GoaterFrom: Jamin Lin <[email protected]>
Currently, the size of the "regs" array is 0x2000, which is too large. So far, it only uses "GICINT128 to `GICINT134", and the offsets from 0 to 0x1000 are unused. To save code size and avoid mapping large unused gaps, update to only map the useful set of registers:
INTC register [0x1000 – 0x1804]
Update "reg_size" to 0x808. Introduce a new class attribute "reg_offset" to set the start offset of a "INTC" sub-region. Set the "reg_offset" to 0x1000 for INTC registers.
--- include/hw/intc/aspeed_intc.h | 1 + hw/intc/aspeed_intc.c | 50 ++++++++++++++++++++--------------- 2 files changed, 30 insertions(+), 21 deletions(-)
include/hw/intc/aspeed_intc.h +1 -0
@@ -42,6 +42,7 @@ struct AspeedINTCClass {uint32_t num_ints;uint64_t mem_size;uint64_t nr_regs; + uint64_t reg_offset; };#endif /* ASPEED_INTC_H */
hw/intc/aspeed_intc.c +29 -21
68 lines not on this page · raw message
Signature · 1 line
2.48.1
[PULL 17/46] hw/arm/aspeed_ast27x0.c Fix boot issue for AST2700
In reply to Cédric Le GoaterFrom: Jamin Lin <[email protected]>
Currently, ASPEED_DEV_SPI_BOOT is set to "0x400000000", which is the DRAM start address, and the QEMU loader is used to load the U-Boot binary into this address.
However, if users want to install FMC flash contents as a boot ROM, the DRAM address 0x400000000 would be overwritten with Boot ROM data. This causes the AST2700 to fail to boot because the U-Boot data becomes incorrect.
To fix this, change the ASPEED_DEV_SPI_BOOT address to "0x100000000", which is the FMC0 memory-mapped start address in the AST2700.
--- hw/arm/aspeed_ast27x0.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
hw/arm/aspeed_ast27x0.c +1 -1
@@ -24,7 +24,7 @@#include "qemu/log.h" static const hwaddr aspeed_soc_ast2700_memmap[] = { - [ASPEED_DEV_SPI_BOOT ] =0x400000000 , + [ASPEED_DEV_SPI_BOOT ] =0x100000000 , [ASPEED_DEV_SRAM ] =0x10000000 , [ASPEED_DEV_SDMC ] =0x12C00000 , [ASPEED_DEV_SCU ] =0x12C02000 ,
Signature · 1 line
2.48.1
[PULL 20/46] hw/intc/aspeed: Introduce dynamic allocation for regs array
In reply to Cédric Le GoaterFrom: Jamin Lin <[email protected]>
Currently, the size of the "regs" array is 0x2000, which is too large. To save code size and avoid mapping large unused gaps, will update it to only map the useful set of registers. This update will support multiple sub-regions with different sizes.
To address the redundant size issue, replace the static "regs" array with a dynamically allocated "regs" memory.
Introduce a new "aspeed_intc_unrealize" function to free the allocated "regs" memory.
--- include/hw/intc/aspeed_intc.h | 2 +- hw/intc/aspeed_intc.c | 12 +++++++++++- 2 files changed, 12 insertions(+), 2 deletions(-)
include/hw/intc/aspeed_intc.h +1 -1
@@ -27,7 +27,7 @@ struct AspeedINTCState {MemoryRegion iomem;MemoryRegion iomem_container; -uint32_t regs[ASPEED_INTC_NR_REGS ]; +uint32_t *regs;OrIRQState orgates[ASPEED_INTC_NR_INTS ];qemu_irq output_pins[ASPEED_INTC_NR_INTS ];
hw/intc/aspeed_intc.c +11 -1
@@ -289,7 +289,7 @@ static void aspeed_intc_reset(DeviceState *dev) {AspeedINTCState *s =ASPEED_INTC (dev); -memset (s->regs,0 ,sizeof (s->regs)); +memset (s->regs,0 ,ASPEED_INTC_NR_REGS <<2 );memset (s->enable,0 ,sizeof (s->enable));memset (s->mask,0 ,sizeof (s->mask));memset (s->pending,0 ,sizeof (s->pending));
@@ -307,6 +307,7 @@ static void aspeed_intc_realize(DeviceState *dev, Error **errp)sysbus_init_mmio (sbd, &s->iomem_container); + s->regs =g_new (uint32_t,ASPEED_INTC_NR_REGS );memory_region_init_io (&s->iomem,OBJECT (s), &aspeed_intc_ops, s,TYPE_ASPEED_INTC ".regs" ,ASPEED_INTC_NR_REGS <<2 );
@@ -322,12 +323,21 @@ static void aspeed_intc_realize(DeviceState *dev, Error **errp) } } +static void aspeed_intc_unrealize (DeviceState *dev) +{ +AspeedINTCState *s =ASPEED_INTC (dev); + +g_free (s->regs); + s->regs =NULL ; +} +static void aspeed_intc_class_init (ObjectClass *klass,void *data) {DeviceClass *dc =DEVICE_CLASS (klass); dc->desc ="ASPEED INTC Controller" ; dc->realize = aspeed_intc_realize; + dc->unrealize = aspeed_intc_unrealize;device_class_set_legacy_reset (dc, aspeed_intc_reset); dc->vmsd =NULL ; }
Signature · 1 line
2.48.1
[PULL 18/46] hw/intc/aspeed: Support setting different memory size
In reply to Cédric Le GoaterFrom: Jamin Lin <[email protected]>
According to the AST2700 datasheet, the INTC(CPU DIE) controller has 16KB (0x4000) of register space, and the INTCIO (I/O DIE) controller has 1KB (0x400) of register space.
Introduced a new class attribute "mem_size" to set different memory sizes for the INTC models in AST2700.
--- include/hw/intc/aspeed_intc.h | 3 +++ hw/intc/aspeed_intc.c | 9 ++++++++- 2 files changed, 11 insertions(+), 1 deletion(-)
include/hw/intc/aspeed_intc.h +3 -0
@@ -25,6 +25,8 @@ struct AspeedINTCState {/*< public >*/ MemoryRegion iomem; +MemoryRegion iomem_container; +uint32_t regs[ASPEED_INTC_NR_REGS ];OrIRQState orgates[ASPEED_INTC_NR_INTS ];qemu_irq output_pins[ASPEED_INTC_NR_INTS ];
@@ -39,6 +41,7 @@ struct AspeedINTCClass {uint32_t num_lines;uint32_t num_ints; + uint64_t mem_size; };#endif /* ASPEED_INTC_H */
hw/intc/aspeed_intc.c +8 -1
@@ -302,10 +302,16 @@ static void aspeed_intc_realize(DeviceState *dev, Error **errp)AspeedINTCClass *aic =ASPEED_INTC_GET_CLASS (s);int i; +memory_region_init (&s->iomem_container,OBJECT (s), +TYPE_ASPEED_INTC ".container" , aic->mem_size); + +sysbus_init_mmio (sbd, &s->iomem_container); +memory_region_init_io (&s->iomem,OBJECT (s), &aspeed_intc_ops, s,TYPE_ASPEED_INTC ".regs" ,ASPEED_INTC_NR_REGS <<2 ); -sysbus_init_mmio (sbd, &s->iomem); +memory_region_add_subregion (&s->iomem_container,0x0 , &s->iomem); +qdev_init_gpio_in (dev, aspeed_intc_set_irq, aic->num_ints);for (i =0 ; i < aic->num_ints; i++) {
@@ -344,6 +350,7 @@ static void aspeed_2700_intc_class_init(ObjectClass *klass, void *data) dc->desc ="ASPEED 2700 INTC Controller" ; aic->num_lines =32 ; aic->num_ints =9 ; + aic->mem_size =0x4000 ; }static const TypeInfo aspeed_2700_intc_info = {
Signature · 1 line
2.48.1
[PULL 28/46] hw/intc/aspeed: Rename num_ints to num_inpins for clarity
In reply to Cédric Le GoaterFrom: Jamin Lin <[email protected]>
To support AST2700 A1, some registers of the INTC(CPU Die) support one input pin to multiple output pins. Renamed "num_ints" to "num_inpins" in the INTC controller code for better clarity and consistency in naming conventions.
--- include/hw/intc/aspeed_intc.h | 11 ++++++----- hw/arm/aspeed_ast27x0.c | 2 +- hw/intc/aspeed_intc.c | 31 +++++++++++++++++-------------- 3 files changed, 24 insertions(+), 20 deletions(-)
include/hw/intc/aspeed_intc.h +6 -5
@@ -17,6 +17,7 @@ OBJECT_DECLARE_TYPE(AspeedINTCState, AspeedINTCClass, ASPEED_INTC)#define ASPEED_INTC_NR_INTS 9 +#define ASPEED_INTC_MAX_INPINS 9struct AspeedINTCState {/*< private >*/
@@ -27,19 +28,19 @@ struct AspeedINTCState {MemoryRegion iomem_container;uint32_t *regs; -OrIRQState orgates[ASPEED_INTC_NR_INTS ]; +OrIRQState orgates[ASPEED_INTC_MAX_INPINS ];qemu_irq output_pins[ASPEED_INTC_NR_INTS ]; -uint32_t enable[ASPEED_INTC_NR_INTS ]; -uint32_t mask[ASPEED_INTC_NR_INTS ]; -uint32_t pending[ASPEED_INTC_NR_INTS ]; +uint32_t enable[ASPEED_INTC_MAX_INPINS ]; +uint32_t mask[ASPEED_INTC_MAX_INPINS ]; +uint32_t pending[ASPEED_INTC_MAX_INPINS ]; };struct AspeedINTCClass {SysBusDeviceClass parent_class;uint32_t num_lines; -uint32_t num_ints; +uint32_t num_inpins;uint64_t mem_size;uint64_t nr_regs;uint64_t reg_offset;
hw/arm/aspeed_ast27x0.c +1 -1
@@ -535,7 +535,7 @@ static void aspeed_soc_ast2700_realize(DeviceState *dev, Error **errp) sc->memmap[ASPEED_DEV_INTC]);/* GICINT orgates -> INTC -> GIC */ -for (i =0 ; i < ic->num_ints; i++) { +for (i =0 ; i < ic->num_inpins; i++) {qdev_connect_gpio_out (DEVICE (&a->intc.orgates[i]),0 ,qdev_get_gpio_in (DEVICE (&a->intc), i)); sysbus_connect_irq(SYS_BUS_DEVICE(&a->intc), i,
hw/intc/aspeed_intc.c +17 -14
@@ -47,8 +47,9 @@ static void aspeed_intc_update(AspeedINTCState *s, int irq, int level)AspeedINTCClass *aic =ASPEED_INTC_GET_CLASS (s);const char *name =object_get_typename (OBJECT (s)); -if (irq >= aic->num_ints) { -qemu_log_mask (LOG_GUEST_ERROR ,"%s: Invalid interrupt number: %d\n" , +if (irq >= aic->num_inpins) { +qemu_log_mask (LOG_GUEST_ERROR , +"%s: Invalid input pin index: %d\n" , __func__, irq);return ; }
@@ -60,7 +61,7 @@ static void aspeed_intc_update(AspeedINTCState *s, int irq, int level)/* * The address of GICINT128 to GICINT136 are from 0x1000 to 0x1804. * Utilize "address & 0x0f00" to get the irq and irq output pin index -* The value of irq should be 0 to num_ints. +* The value of irq should be 0 to num_inpins. * The irq 0 indicates GICINT128, irq 1 indicates GICINT129 and so on. */ static void aspeed_intc_set_irq (void *opaque,int irq,int level)
@@ -73,8 +74,8 @@ static void aspeed_intc_set_irq(void *opaque, int irq, int level)uint32_t enable;int i; -if (irq >= aic->num_ints) { -qemu_log_mask (LOG_GUEST_ERROR ,"%s: Invalid interrupt number: %d\n" , +if (irq >= aic->num_inpins) { +qemu_log_mask (LOG_GUEST_ERROR ,"%s: Invalid input pin index: %d\n" , __func__, irq);return ; }
@@ -134,8 +135,9 @@ static void aspeed_intc_enable_handler(AspeedINTCState *s, hwaddr offset, irq = (offset &0x0f00 ) >>8 ; -if (irq >= aic->num_ints) { -qemu_log_mask (LOG_GUEST_ERROR ,"%s: Invalid interrupt number: %d\n" , +if (irq >= aic->num_inpins) { +qemu_log_mask (LOG_GUEST_ERROR , +"%s: Invalid input pin index: %d\n" , __func__, irq);return ; }
@@ -190,8 +192,9 @@ static void aspeed_intc_status_handler(AspeedINTCState *s, hwaddr offset, irq = (offset &0x0f00 ) >>8 ; -if (irq >= aic->num_ints) { -qemu_log_mask (LOG_GUEST_ERROR ,"%s: Invalid interrupt number: %d\n" , +if (irq >= aic->num_inpins) { +qemu_log_mask (LOG_GUEST_ERROR , +"%s: Invalid input pin index: %d\n" , __func__, irq);return ; }
@@ -299,8 +302,8 @@ static void aspeed_intc_instance_init(Object *obj)AspeedINTCClass *aic =ASPEED_INTC_GET_CLASS (s);int i; -assert (aic->num_ints <=ASPEED_INTC_NR_INTS ); -for (i =0 ; i < aic->num_ints; i++) { +assert (aic->num_inpins <=ASPEED_INTC_MAX_INPINS ); +for (i =0 ; i < aic->num_inpins; i++) {object_initialize_child (obj,"intc-orgates[*]" , &s->orgates[i],TYPE_OR_IRQ ); object_property_set_int(OBJECT(&s->orgates[i]), "num-lines",
@@ -338,9 +341,9 @@ static void aspeed_intc_realize(DeviceState *dev, Error **errp)memory_region_add_subregion (&s->iomem_container, aic->reg_offset, &s->iomem); -qdev_init_gpio_in (dev, aspeed_intc_set_irq, aic->num_ints); +qdev_init_gpio_in (dev, aspeed_intc_set_irq, aic->num_inpins); -for (i =0 ; i < aic->num_ints; i++) { +for (i =0 ; i < aic->num_inpins; i++) {if (!qdev_realize (DEVICE (&s->orgates[i]),NULL , errp)) {return ; }
@@ -387,7 +390,7 @@ static void aspeed_2700_intc_class_init(ObjectClass *klass, void *data) dc->desc ="ASPEED 2700 INTC Controller" ; aic->num_lines =32 ; - aic->num_ints =9 ; + aic->num_inpins =9 ; aic->mem_size =0x4000 ; aic->nr_regs =0x808 >>2 ; aic->reg_offset =0x1000 ;
Signature · 1 line
2.48.1
[PULL 02/46] tests/functional: Update OpenBMC image of palmetto machine
In reply to Cédric Le GoaterUse the new do_test_arm_aspeed_openbmc() routine to run the latest OpenBMC firmware build of the palmetto BMC.
--- tests/functional/test_arm_aspeed_palmetto.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-)
tests/functional/test_arm_aspeed_palmetto.py +7 -6
@@ -7,18 +7,19 @@ from qemu_test import Asset from aspeed import AspeedTest + class PalmettoMachine(AspeedTest): ASSET_PALMETTO_FLASH = Asset( - ('https://github.com/openbmc/openbmc/releases/download/2.9.0/' - 'obmc-phosphor-image-palmetto.static.mtd'), - '3e13bbbc28e424865dc42f35ad672b10f2e82cdb11846bb28fa625b48beafd0d'); + 'https://github.com/legoater/qemu-aspeed-boot/raw/master/images/palmetto-bmc/openbmc-20250128071432/obmc-phosphor-image-palmetto-20250128071432.static.mtd', + 'bce7c392eec75c707a91cfc8fad7ca9a69d7e4f10df936930d65c1cb9897ac81'); - def test_arm_ast2400_palmetto_openbmc_v2_9_0(self): + def test_arm_ast2400_palmetto_openbmc(self): image_path = self.ASSET_PALMETTO_FLASH.fetch() - self.do_test_arm_aspeed('palmetto-bmc', image_path) - + self.do_test_arm_aspeed_openbmc('palmetto-bmc', image=image_path, + uboot='2019.04', cpu_id='0x0', + soc='AST2400 rev A1'); if __name__ == '__main__': AspeedTest.main()
Signature · 1 line
2.48.1
[PULL 24/46] hw/intc/aspeed: Add object type name to trace events for better debugging
In reply to Cédric Le GoaterFrom: Jamin Lin <[email protected]>
Currently, these trace events only refer to INTC. To simplify the INTC model, both INTC(CPU Die) and INTCIO(IO Die) will share the same helper functions.
However, it is difficult to recognize whether these trace events are comes from INTC or INTCIO. To make these trace events more readable, adds object type name to the INTC trace events.
Update trace events to include the "name" field for better identification.
--- hw/intc/aspeed_intc.c | 32 +++++++++++++++++++------------- hw/intc/trace-events | 24 ++++++++++++------------ 2 files changed, 31 insertions(+), 25 deletions(-)
hw/intc/aspeed_intc.c +19 -13
@@ -45,6 +45,7 @@ REG32(GICINT136_STATUS, 0x804)static void aspeed_intc_update (AspeedINTCState *s,int irq,int level) {AspeedINTCClass *aic =ASPEED_INTC_GET_CLASS (s); +const char *name =object_get_typename (OBJECT (s));if (irq >= aic->num_ints) { qemu_log_mask(LOG_GUEST_ERROR, "%s: Invalid interrupt number: %d\n",
@@ -52,7 +53,7 @@ static void aspeed_intc_update(AspeedINTCState *s, int irq, int level)return ; } -trace_aspeed_intc_update_irq (irq, level); +trace_aspeed_intc_update_irq (name, irq, level);qemu_set_irq (s->output_pins[irq], level); }
@@ -66,6 +67,7 @@ static void aspeed_intc_set_irq(void *opaque, int irq, int level) {AspeedINTCState *s = (AspeedINTCState *)opaque;AspeedINTCClass *aic =ASPEED_INTC_GET_CLASS (s); +const char *name =object_get_typename (OBJECT (s));uint32_t status_reg =GICINT_STATUS_BASE + ((0x100 * irq) >>2 );uint32_t select =0 ;uint32_t enable;
@@ -77,7 +79,7 @@ static void aspeed_intc_set_irq(void *opaque, int irq, int level)return ; } -trace_aspeed_intc_set_irq (irq, level); +trace_aspeed_intc_set_irq (name, irq, level); enable = s->enable[irq];if (!level) {
@@ -96,7 +98,7 @@ static void aspeed_intc_set_irq(void *opaque, int irq, int level)return ; } -trace_aspeed_intc_select (select); +trace_aspeed_intc_select (name, select);if (s->mask[irq] || s->regs[status_reg]) {/*
@@ -108,14 +110,14 @@ static void aspeed_intc_set_irq(void *opaque, int irq, int level)* save source interrupt to pending variable. */ s->pending[irq] |= select; -trace_aspeed_intc_pending_irq (irq, s->pending[irq]); +trace_aspeed_intc_pending_irq (name, irq, s->pending[irq]); }else {/* * notify firmware which source interrupt are coming * by setting status register */ s->regs[status_reg] = select; -trace_aspeed_intc_trigger_irq (irq, s->regs[status_reg]); +trace_aspeed_intc_trigger_irq (name, irq, s->regs[status_reg]);aspeed_intc_update (s, irq,1 ); } }
@@ -124,6 +126,7 @@ static void aspeed_intc_enable_handler(AspeedINTCState *s, hwaddr offset, uint64_t data) {AspeedINTCClass *aic =ASPEED_INTC_GET_CLASS (s); +const char *name =object_get_typename (OBJECT (s));uint32_t reg = offset >>2 ;uint32_t old_enable;uint32_t change;
@@ -154,7 +157,7 @@ static void aspeed_intc_enable_handler(AspeedINTCState *s, hwaddr offset,/* enable new source interrupt */ if (old_enable != s->enable[irq]) { -trace_aspeed_intc_enable (s->enable[irq]); +trace_aspeed_intc_enable (name, s->enable[irq]); s->regs[reg] = data;return ; }
@@ -163,10 +166,10 @@ static void aspeed_intc_enable_handler(AspeedINTCState *s, hwaddr offset, change = s->regs[reg] ^ data;if (change & data) { s->mask[irq] &= ~change; -trace_aspeed_intc_unmask (change, s->mask[irq]); +trace_aspeed_intc_unmask (name, change, s->mask[irq]); }else { s->mask[irq] |= change; -trace_aspeed_intc_mask (change, s->mask[irq]); +trace_aspeed_intc_mask (name, change, s->mask[irq]); } s->regs[reg] = data;
@@ -176,6 +179,7 @@ static void aspeed_intc_status_handler(AspeedINTCState *s, hwaddr offset, uint64_t data) {AspeedINTCClass *aic =ASPEED_INTC_GET_CLASS (s); +const char *name =object_get_typename (OBJECT (s));uint32_t reg = offset >>2 ;uint32_t irq;
@@ -207,7 +211,7 @@ static void aspeed_intc_status_handler(AspeedINTCState *s, hwaddr offset,/* All source ISR execution are done */ if (!s->regs[reg]) { -trace_aspeed_intc_all_isr_done (irq); +trace_aspeed_intc_all_isr_done (name, irq);if (s->pending[irq]) {/* * handle pending source interrupt
@@ -216,11 +220,11 @@ static void aspeed_intc_status_handler(AspeedINTCState *s, hwaddr offset,*/ s->regs[reg] = s->pending[irq]; s->pending[irq] =0 ; -trace_aspeed_intc_trigger_irq (irq, s->regs[reg]); +trace_aspeed_intc_trigger_irq (name, irq, s->regs[reg]);aspeed_intc_update (s, irq,1 ); }else {/* clear irq */ -trace_aspeed_intc_clear_irq (irq,0 ); +trace_aspeed_intc_clear_irq (name, irq,0 );aspeed_intc_update (s, irq,0 ); } }
@@ -229,11 +233,12 @@ static void aspeed_intc_status_handler(AspeedINTCState *s, hwaddr offset,static uint64_t aspeed_intc_read (void *opaque,hwaddr offset,unsigned int size) {AspeedINTCState *s =ASPEED_INTC (opaque); +const char *name =object_get_typename (OBJECT (s));uint32_t reg = offset >>2 ;uint32_t value =0 ; value = s->regs[reg]; -trace_aspeed_intc_read (offset, size, value); +trace_aspeed_intc_read (name, offset, size, value);return value; }
@@ -242,9 +247,10 @@ static void aspeed_intc_write(void *opaque, hwaddr offset, uint64_t data, unsigned size) {AspeedINTCState *s =ASPEED_INTC (opaque); +const char *name =object_get_typename (OBJECT (s));uint32_t reg = offset >>2 ; -trace_aspeed_intc_write (offset, size, data); +trace_aspeed_intc_write (name, offset, size, data);switch (reg) {case R_GICINT128_EN :
hw/intc/trace-events +12 -12
@@ -80,18 +80,18 @@ aspeed_vic_update_irq(int flags) "Raising IRQ: %d" aspeed_vic_read(uint64_t offset, unsigned size, uint32_t value) "From 0x%" PRIx64 " of size %u: 0x%" PRIx32 aspeed_vic_write(uint64_t offset, unsigned size, uint32_t data) "To 0x%" PRIx64 " of size %u: 0x%" PRIx32 # aspeed_intc.c -aspeed_intc_read(uint64_t offset, unsigned size, uint32_t value) "From 0x%" PRIx64 " of size %u: 0x%" PRIx32 -aspeed_intc_write(uint64_t offset, unsigned size, uint32_t data) "To 0x%" PRIx64 " of size %u: 0x%" PRIx32 -aspeed_intc_set_irq(int irq, int level) "Set IRQ %d: %d" -aspeed_intc_clear_irq(int irq, int level) "Clear IRQ %d: %d" -aspeed_intc_update_irq(int irq, int level) "Update IRQ: %d: %d" -aspeed_intc_pending_irq(int irq, uint32_t value) "Pending IRQ: %d: 0x%x" -aspeed_intc_trigger_irq(int irq, uint32_t value) "Trigger IRQ: %d: 0x%x" -aspeed_intc_all_isr_done(int irq) "All source ISR execution are done: %d" -aspeed_intc_enable(uint32_t value) "Enable: 0x%x" -aspeed_intc_select(uint32_t value) "Select: 0x%x" -aspeed_intc_mask(uint32_t change, uint32_t value) "Mask: 0x%x: 0x%x" -aspeed_intc_unmask(uint32_t change, uint32_t value) "UnMask: 0x%x: 0x%x" +aspeed_intc_read(const char *s, uint64_t offset, unsigned size, uint32_t value) "%s: From 0x%" PRIx64 " of size %u: 0x%" PRIx32 +aspeed_intc_write(const char *s, uint64_t offset, unsigned size, uint32_t data) "%s: To 0x%" PRIx64 " of size %u: 0x%" PRIx32 +aspeed_intc_set_irq(const char *s, int irq, int level) "%s: Set IRQ %d: %d" +aspeed_intc_clear_irq(const char *s, int irq, int level) "%s: Clear IRQ %d: %d" +aspeed_intc_update_irq(const char *s, int irq, int level) "%s: Update IRQ: %d: %d" +aspeed_intc_pending_irq(const char *s, int irq, uint32_t value) "%s: Pending IRQ: %d: 0x%x" +aspeed_intc_trigger_irq(const char *s, int irq, uint32_t value) "%s: Trigger IRQ: %d: 0x%x" +aspeed_intc_all_isr_done(const char *s, int irq) "%s: All source ISR execution are done: %d" +aspeed_intc_enable(const char *s, uint32_t value) "%s: Enable: 0x%x" +aspeed_intc_select(const char *s, uint32_t value) "%s: Select: 0x%x" +aspeed_intc_mask(const char *s, uint32_t change, uint32_t value) "%s: Mask: 0x%x: 0x%x" +aspeed_intc_unmask(const char *s, uint32_t change, uint32_t value) "%s: UnMask: 0x%x: 0x%x" # arm_gic.c gic_enable_irq(int irq) "irq %d enabled"
Signature · 1 line
2.48.1
[PULL 32/46] hw/intc/aspeed: Introduce IRQ handler function to reduce code duplication
In reply to Cédric Le GoaterFrom: Jamin Lin <[email protected]>
The behavior of the INTC set IRQ is almost identical between INTC and INTCIO. To reduce duplicated code, introduce the "aspeed_intc_set_irq_handler" function to handle both INTC and INTCIO IRQ behavior. No functional change.
--- hw/intc/aspeed_intc.c | 70 ++++++++++++++++++++++++------------------- 1 file changed, 39 insertions(+), 31 deletions(-)
hw/intc/aspeed_intc.c +39 -31
@@ -76,11 +76,45 @@ static void aspeed_intc_update(AspeedINTCState *s, int inpin_idx,qemu_set_irq (s->output_pins[outpin_idx], level); } +static void aspeed_intc_set_irq_handler (AspeedINTCState *s, +const AspeedINTCIRQ *intc_irq, +uint32_t select) +{ +const char *name =object_get_typename (OBJECT (s)); +uint32_t status_reg; +int outpin_idx; +int inpin_idx; + + status_reg = intc_irq->status_reg; + outpin_idx = intc_irq->outpin_idx; + inpin_idx = intc_irq->inpin_idx; + +if (s->mask[inpin_idx] || s->regs[status_reg]) { +/* +* a. mask is not 0 means in ISR mode +* sources interrupt routine are executing. +* b. status register value is not 0 means previous +* source interrupt does not be executed, yet. +* +* save source interrupt to pending variable. +*/ + s->pending[inpin_idx] |= select; +trace_aspeed_intc_pending_irq (name, inpin_idx, s->pending[inpin_idx]); + }else { +/* +* notify firmware which source interrupt are coming +* by setting status register +*/ + s->regs[status_reg] = select; +trace_aspeed_intc_trigger_irq (name, inpin_idx, outpin_idx, + s->regs[status_reg]); +aspeed_intc_update (s, inpin_idx, outpin_idx,1 ); + } +} +/* -* The address of GICINT128 to GICINT136 are from 0x1000 to 0x1804. -* Utilize "address & 0x0f00" to get the irq and irq output pin index -* The value of irq should be 0 to num_inpins. -* The irq 0 indicates GICINT128, irq 1 indicates GICINT129 and so on. +* GICINT128 to GICINT136 map 1:1 to input and output IRQs 0 to 8. +* The value of input IRQ should be between 0 and the number of inputs. */ static void aspeed_intc_set_irq (void *opaque,int irq,int level) {
@@ -88,20 +122,15 @@ static void aspeed_intc_set_irq(void *opaque, int irq, int level)AspeedINTCClass *aic =ASPEED_INTC_GET_CLASS (s);const char *name =object_get_typename (OBJECT (s));const AspeedINTCIRQ *intc_irq; -uint32_t status_reg;uint32_t select =0 ;uint32_t enable; -int outpin_idx;int inpin_idx;int i;assert (irq < aic->num_inpins); intc_irq = &aic->irq_table[irq]; - status_reg = intc_irq->status_reg; - outpin_idx = intc_irq->outpin_idx; inpin_idx = intc_irq->inpin_idx; -trace_aspeed_intc_set_irq (name, inpin_idx, level); enable = s->enable[inpin_idx];
@@ -122,28 +151,7 @@ static void aspeed_intc_set_irq(void *opaque, int irq, int level) }trace_aspeed_intc_select (name, select); - -if (s->mask[inpin_idx] || s->regs[status_reg]) { -/* -* a. mask is not 0 means in ISR mode -* sources interrupt routine are executing. -* b. status register value is not 0 means previous -* source interrupt does not be executed, yet. -* -* save source interrupt to pending variable. -*/ - s->pending[inpin_idx] |= select; -trace_aspeed_intc_pending_irq (name, inpin_idx, s->pending[inpin_idx]); - }else { -/* -* notify firmware which source interrupt are coming -* by setting status register -*/ - s->regs[status_reg] = select; -trace_aspeed_intc_trigger_irq (name, inpin_idx, outpin_idx, - s->regs[status_reg]); -aspeed_intc_update (s, inpin_idx, outpin_idx,1 ); - } +aspeed_intc_set_irq_handler (s, intc_irq, select); } static void aspeed_intc_enable_handler(AspeedINTCState *s, hwaddr offset,
Signature · 1 line
2.48.1
[PULL 23/46] hw/intc/aspeed: Introduce helper functions for enable and status registers
In reply to Cédric Le GoaterFrom: Jamin Lin <[email protected]>
The behavior of the enable and status registers is almost identical between INTC(CPU Die) and INTCIO(IO Die). To reduce duplicated code, adds "aspeed_intc_enable_handler" functions to handle enable register write behavior and "aspeed_intc_status_handler" functions to handle status register write behavior. No functional change.
--- hw/intc/aspeed_intc.c | 191 ++++++++++++++++++++++++------------------ 1 file changed, 108 insertions(+), 83 deletions(-)
hw/intc/aspeed_intc.c +108 -83
@@ -120,6 +120,112 @@ static void aspeed_intc_set_irq(void *opaque, int irq, int level) } } +static void aspeed_intc_enable_handler (AspeedINTCState *s,hwaddr offset, +uint64_t data) +{ +AspeedINTCClass *aic =ASPEED_INTC_GET_CLASS (s); +uint32_t reg = offset >>2 ; +uint32_t old_enable; +uint32_t change; +uint32_t irq; + + irq = (offset &0x0f00 ) >>8 ; + +if (irq >= aic->num_ints) { +qemu_log_mask (LOG_GUEST_ERROR ,"%s: Invalid interrupt number: %d\n" , + __func__, irq); +return ; + } + +/* +* The enable registers are used to enable source interrupts. +* They also handle masking and unmasking of source interrupts +* during the execution of the source ISR. +*/ + +/* disable all source interrupt */ +if (!data && !s->enable[irq]) { + s->regs[reg] = data; +return ; + } + + old_enable = s->enable[irq]; + s->enable[irq] |= data; + +/* enable new source interrupt */ +if (old_enable != s->enable[irq]) { +trace_aspeed_intc_enable (s->enable[irq]); + s->regs[reg] = data; +return ; + } + +/* mask and unmask source interrupt */ + change = s->regs[reg] ^ data; +if (change & data) { + s->mask[irq] &= ~change; +trace_aspeed_intc_unmask (change, s->mask[irq]); + }else { + s->mask[irq] |= change; +trace_aspeed_intc_mask (change, s->mask[irq]); + } + + s->regs[reg] = data; +} + +static void aspeed_intc_status_handler (AspeedINTCState *s,hwaddr offset, +uint64_t data) +{ +AspeedINTCClass *aic =ASPEED_INTC_GET_CLASS (s); +uint32_t reg = offset >>2 ; +uint32_t irq; + +if (!data) { +qemu_log_mask (LOG_GUEST_ERROR ,"%s: Invalid data 0\n" , __func__); +return ; + } + + irq = (offset &0x0f00 ) >>8 ; + +if (irq >= aic->num_ints) { +qemu_log_mask (LOG_GUEST_ERROR ,"%s: Invalid interrupt number: %d\n" , + __func__, irq); +return ; + } + +/* clear status */ + s->regs[reg] &= ~data; + +/* +* These status registers are used for notify sources ISR are executed. +* If one source ISR is executed, it will clear one bit. +* If it clear all bits, it means to initialize this register status +* rather than sources ISR are executed. +*/ +if (data ==0xffffffff ) { +return ; + } + +/* All source ISR execution are done */ +if (!s->regs[reg]) { +trace_aspeed_intc_all_isr_done (irq); +if (s->pending[irq]) { +/* +* handle pending source interrupt +* notify firmware which source interrupt are pending +* by setting status register +*/ + s->regs[reg] = s->pending[irq]; + s->pending[irq] =0 ; +trace_aspeed_intc_trigger_irq (irq, s->regs[reg]); +aspeed_intc_update (s, irq,1 ); + }else { +/* clear irq */ +trace_aspeed_intc_clear_irq (irq,0 ); +aspeed_intc_update (s, irq,0 ); + } + } +} +static uint64_t aspeed_intc_read (void *opaque,hwaddr offset,unsigned int size) {AspeedINTCState *s =ASPEED_INTC (opaque);
@@ -136,11 +242,7 @@ static void aspeed_intc_write(void *opaque, hwaddr offset, uint64_t data, unsigned size) {AspeedINTCState *s =ASPEED_INTC (opaque); -AspeedINTCClass *aic =ASPEED_INTC_GET_CLASS (s);uint32_t reg = offset >>2 ; -uint32_t old_enable; -uint32_t change; -uint32_t irq;trace_aspeed_intc_write (offset, size, data);
@@ -154,45 +256,7 @@ static void aspeed_intc_write(void *opaque, hwaddr offset, uint64_t data,case R_GICINT134_EN :case R_GICINT135_EN :case R_GICINT136_EN : - irq = (offset &0x0f00 ) >>8 ; - -if (irq >= aic->num_ints) { -qemu_log_mask (LOG_GUEST_ERROR ,"%s: Invalid interrupt number: %d\n" , - __func__, irq); -return ; - } - -/* -* These registers are used for enable sources interrupt and -* mask and unmask source interrupt while executing source ISR. -*/ - -/* disable all source interrupt */ -if (!data && !s->enable[irq]) { - s->regs[reg] = data; -return ; - } - - old_enable = s->enable[irq]; - s->enable[irq] |= data; - -/* enable new source interrupt */ -if (old_enable != s->enable[irq]) { -trace_aspeed_intc_enable (s->enable[irq]); - s->regs[reg] = data; -return ; - } - -/* mask and unmask source interrupt */ - change = s->regs[reg] ^ data; -if (change & data) { - s->mask[irq] &= ~change; -trace_aspeed_intc_unmask (change, s->mask[irq]); - }else { - s->mask[irq] |= change; -trace_aspeed_intc_mask (change, s->mask[irq]); - } - s->regs[reg] = data; +aspeed_intc_enable_handler (s, offset, data);break ;case R_GICINT128_STATUS :case R_GICINT129_STATUS :
@@ -203,46 +267,7 @@ static void aspeed_intc_write(void *opaque, hwaddr offset, uint64_t data,case R_GICINT134_STATUS :case R_GICINT135_STATUS :case R_GICINT136_STATUS : - irq = (offset &0x0f00 ) >>8 ; - -if (irq >= aic->num_ints) { -qemu_log_mask (LOG_GUEST_ERROR ,"%s: Invalid interrupt number: %d\n" , - __func__, irq); -return ; - } - -/* clear status */ - s->regs[reg] &= ~data; - -/* -* These status registers are used for notify sources ISR are executed. -* If one source ISR is executed, it will clear one bit. -* If it clear all bits, it means to initialize this register status -* rather than sources ISR are executed. -*/ -if (data ==0xffffffff ) { -return ; - } - -/* All source ISR execution are done */ -if (!s->regs[reg]) { -trace_aspeed_intc_all_isr_done (irq); -if (s->pending[irq]) { -/* -* handle pending source interrupt -* notify firmware which source interrupt are pending -* by setting status register -*/ - s->regs[reg] = s->pending[irq]; - s->pending[irq] =0 ; -trace_aspeed_intc_trigger_irq (irq, s->regs[reg]); -aspeed_intc_update (s, irq,1 ); - }else { -/* clear irq */ -trace_aspeed_intc_clear_irq (irq,0 ); -aspeed_intc_update (s, irq,0 ); - } - } +aspeed_intc_status_handler (s, offset, data);break ;default : s->regs[reg] = data;
Signature · 1 line
2.48.1
[PULL 06/46] aspeed/soc: Support Non-maskable Interrupt for AST2700
In reply to Cédric Le GoaterFrom: Jamin Lin <[email protected]>
QEMU supports GICv3 Non-maskable Interrupt, adds to support Non-maskable Interrupt for AST2700.
Reference:
https://github.com/qemu/qemu/commit/b36a32ead
--- hw/arm/aspeed_ast27x0.c | 4 ++++ 1 file changed, 4 insertions(+)
hw/arm/aspeed_ast27x0.c +4 -0
@@ -470,6 +470,10 @@ static bool aspeed_soc_ast2700_gic_realize(DeviceState *dev, Error **errp) qdev_get_gpio_in(cpudev, ARM_CPU_VIRQ));sysbus_connect_irq (gicbusdev, i +3 * sc->num_cpus,qdev_get_gpio_in (cpudev,ARM_CPU_VFIQ )); +sysbus_connect_irq (gicbusdev, i +4 * sc->num_cpus, +qdev_get_gpio_in (cpudev,ARM_CPU_NMI )); +sysbus_connect_irq (gicbusdev, i +5 * sc->num_cpus, +qdev_get_gpio_in (cpudev,ARM_CPU_VINMI )); }return true;
Signature · 1 line
2.48.1
[PULL 21/46] hw/intc/aspeed: Support setting different register size
In reply to Cédric Le GoaterFrom: Jamin Lin <[email protected]>
Currently, the size of the regs array is 0x2000, which is too large. So far, it only use GICINT128 - GICINT134, and the offsets from 0 to 0x1000 are unused. To save code size, introduce a new class attribute "reg_size" to set the different register sizes for the INTC models in AST2700 and add a regs sub-region in the memory container.
--- include/hw/intc/aspeed_intc.h | 2 +- hw/intc/aspeed_intc.c | 22 +++++----------------- 2 files changed, 6 insertions(+), 18 deletions(-)
include/hw/intc/aspeed_intc.h +1 -1
@@ -16,7 +16,6 @@#define TYPE_ASPEED_2700_INTC TYPE_ASPEED_INTC "-ast2700" OBJECT_DECLARE_TYPE(AspeedINTCState, AspeedINTCClass, ASPEED_INTC) -#define ASPEED_INTC_NR_REGS (0x2000 >> 2)#define ASPEED_INTC_NR_INTS 9struct AspeedINTCState {
@@ -42,6 +41,7 @@ struct AspeedINTCClass {uint32_t num_lines;uint32_t num_ints;uint64_t mem_size; + uint64_t nr_regs; };#endif /* ASPEED_INTC_H */
hw/intc/aspeed_intc.c +5 -17
@@ -120,13 +120,6 @@ static uint64_t aspeed_intc_read(void *opaque, hwaddr offset, unsigned int size)uint32_t reg = offset >>2 ;uint32_t value =0 ; -if (reg >=ASPEED_INTC_NR_REGS ) { -qemu_log_mask (LOG_GUEST_ERROR , -"%s: Out-of-bounds read at offset 0x%" HWADDR_PRIx"\n" , - __func__, offset); -return 0 ; - } - value = s->regs[reg];trace_aspeed_intc_read (offset, size, value);
@@ -143,13 +136,6 @@ static void aspeed_intc_write(void *opaque, hwaddr offset, uint64_t data,uint32_t change;uint32_t irq; -if (reg >=ASPEED_INTC_NR_REGS ) { -qemu_log_mask (LOG_GUEST_ERROR , -"%s: Out-of-bounds write at offset 0x%" HWADDR_PRIx"\n" , - __func__, offset); -return ; - } -trace_aspeed_intc_write (offset, size, data);switch (reg) {
@@ -288,8 +274,9 @@ static void aspeed_intc_instance_init(Object *obj)static void aspeed_intc_reset (DeviceState *dev) {AspeedINTCState *s =ASPEED_INTC (dev); +AspeedINTCClass *aic =ASPEED_INTC_GET_CLASS (s); -memset (s->regs,0 ,ASPEED_INTC_NR_REGS <<2 ); +memset (s->regs,0 , aic->nr_regs <<2 );memset (s->enable,0 ,sizeof (s->enable));memset (s->mask,0 ,sizeof (s->mask));memset (s->pending,0 ,sizeof (s->pending));
@@ -307,9 +294,9 @@ static void aspeed_intc_realize(DeviceState *dev, Error **errp)sysbus_init_mmio (sbd, &s->iomem_container); - s->regs =g_new (uint32_t,ASPEED_INTC_NR_REGS ); + s->regs =g_new (uint32_t, aic->nr_regs);memory_region_init_io (&s->iomem,OBJECT (s), &aspeed_intc_ops, s, -TYPE_ASPEED_INTC ".regs" ,ASPEED_INTC_NR_REGS <<2 ); +TYPE_ASPEED_INTC ".regs" , aic->nr_regs <<2 );memory_region_add_subregion (&s->iomem_container,0x0 , &s->iomem);
@@ -361,6 +348,7 @@ static void aspeed_2700_intc_class_init(ObjectClass *klass, void *data) aic->num_lines =32 ; aic->num_ints =9 ; aic->mem_size =0x4000 ; + aic->nr_regs =0x2000 >>2 ; }static const TypeInfo aspeed_2700_intc_info = {
Signature · 1 line
2.48.1
[PULL 37/46] hw/arm/aspeed_ast27x0: Define an Array of AspeedINTCState with Two Instances
In reply to Cédric Le GoaterFrom: Jamin Lin <[email protected]>
Updated Aspeed27x0SoCState to include an intc[2] array instead of a single AspeedINTCState instance. Modified aspeed_soc_ast2700_get_irq and aspeed_soc_ast2700_get_irq_index to correctly reference the corresponding interrupt controller instance and OR gate index.
Currently, only GIC 192 to 201 are supported, and their source interrupts are from INTCIO and connected to INTC at input pin 0 and output pins 0 to 9 for GIC 192-201.
To support both AST2700 A1 and A0, INTC input pins 1 to 9 and output pins 10 to 18 remain to support GIC 128-136, which source interrupts from INTC.
--- include/hw/arm/aspeed_soc.h | 2 +- hw/arm/aspeed_ast27x0.c | 58 +++++++++++++++++++++++++------------ 2 files changed, 40 insertions(+), 20 deletions(-)
include/hw/arm/aspeed_soc.h +1 -1
@@ -128,7 +128,7 @@ struct Aspeed27x0SoCState {AspeedSoCState parent;ARMCPU cpu[ASPEED_CPUS_NUM ]; -AspeedINTCState intc; +AspeedINTCState intc[2 ];GICv3State gic;MemoryRegion dram_empty; };
hw/arm/aspeed_ast27x0.c +39 -19
120 lines not on this page · raw message
Signature · 1 line
2.48.1
[PULL 35/46] hw/misc/aspeed_scu: Add Support for AST2700/AST2750 A1 Silicon Revisions
In reply to Cédric Le GoaterFrom: Jamin Lin <[email protected]>
Added new definitions for AST2700_A1_SILICON_REV and AST2750_A1_SILICON_REV to identify the A1 silicon revisions.
--- include/hw/misc/aspeed_scu.h | 2 ++ hw/misc/aspeed_scu.c | 2 ++ 2 files changed, 4 insertions(+)
include/hw/misc/aspeed_scu.h +2 -0
@@ -54,6 +54,8 @@ struct AspeedSCUState {#define AST2700_A0_SILICON_REV 0x06000103U#define AST2720_A0_SILICON_REV 0x06000203U#define AST2750_A0_SILICON_REV 0x06000003U +#define AST2700_A1_SILICON_REV 0x06010103U +#define AST2750_A1_SILICON_REV 0x06010003U#define ASPEED_IS_AST2500 (si_rev) ((((si_rev) >> 24) & 0xff) == 0x04)
hw/misc/aspeed_scu.c +2 -0
@@ -560,6 +560,8 @@ static uint32_t aspeed_silicon_revs[] = {AST2700_A0_SILICON_REV ,AST2720_A0_SILICON_REV ,AST2750_A0_SILICON_REV , +AST2700_A1_SILICON_REV , + AST2750_A1_SILICON_REV, };bool is_supported_silicon_rev (uint32_t silicon_rev)
Signature · 1 line
2.48.1
[PULL 05/46] tests/functional: Introduce a bletchley machine test
In reply to Cédric Le GoaterUse do_test_arm_aspeed_openbmc() to run the latest OpenBMC firmware build of the bletchley BMC.
--- tests/functional/meson.build | 2 ++ tests/functional/test_arm_aspeed_bletchley.py | 25 +++++++++++++++++++ 2 files changed, 27 insertions(+) create mode 100644 tests/functional/test_arm_aspeed_bletchley.py
tests/functional/meson.build +2 -0
@@ -25,6 +25,7 @@ test_timeouts = { 'arm_aspeed_witherspoon' : 120, 'arm_aspeed_ast2500' : 720, 'arm_aspeed_ast2600' : 1200, + 'arm_aspeed_bletchley' : 120, 'arm_aspeed_rainier' : 480, 'arm_bpim2u' : 500, 'arm_collie' : 180,
@@ -108,6 +109,7 @@ tests_arm_system_thorough = [ 'arm_aspeed_witherspoon', 'arm_aspeed_ast2500', 'arm_aspeed_ast2600', + 'arm_aspeed_bletchley', 'arm_aspeed_rainier', 'arm_bpim2u', 'arm_canona1100',
tests/functional/test_arm_aspeed_bletchley.py new file +25 -0
@@ -0,0 +1,25 @@ +#!/usr/bin/env python3 +# +# Functional test that boots the ASPEED machines +# +# SPDX-License-Identifier: GPL-2.0-or-later + +from qemu_test import Asset +from aspeed import AspeedTest + + +class BletchleyMachine(AspeedTest): + + ASSET_BLETCHLEY_FLASH = Asset( + 'https://github.com/legoater/qemu-aspeed-boot/raw/master/images/bletchley-bmc/openbmc-20250128071329/obmc-phosphor-image-bletchley-20250128071329.static.mtd.xz', + 'db21d04d47d7bb2a276f59d308614b4dfb70b9c7c81facbbca40a3977a2d8844'); + + def test_arm_ast2600_bletchley_openbmc(self): + image_path = self.uncompress(self.ASSET_BLETCHLEY_FLASH) + + self.do_test_arm_aspeed_openbmc('bletchley-bmc', image=image_path, + uboot='2019.04', cpu_id='0xf00', + soc='AST2600 rev A3'); + +if __name__ == '__main__': + AspeedTest.main()
Signature · 1 line
2.48.1
[PULL 29/46] hw/intc/aspeed: Add support for multiple output pins in INTC
In reply to Cédric Le GoaterFrom: Jamin Lin <[email protected]>
Added support for multiple output pins in the INTC controller to accommodate the AST2700 A1.
Introduced "num_outpins" to represent the number of output pins. Updated the IRQ handling logic to initialize and connect output pins separately from input pins. Modified the "aspeed_soc_ast2700_realize" function to connect source orgates to INTC and INTC to GIC128 - GIC136. Updated the "aspeed_intc_realize" function to initialize output pins.
--- include/hw/intc/aspeed_intc.h | 5 +++-- hw/arm/aspeed_ast27x0.c | 6 +++++- hw/intc/aspeed_intc.c | 4 ++++ 3 files changed, 12 insertions(+), 3 deletions(-)
include/hw/intc/aspeed_intc.h +3 -2
@@ -16,8 +16,8 @@#define TYPE_ASPEED_2700_INTC TYPE_ASPEED_INTC "-ast2700" OBJECT_DECLARE_TYPE(AspeedINTCState, AspeedINTCClass, ASPEED_INTC) -#define ASPEED_INTC_NR_INTS 9#define ASPEED_INTC_MAX_INPINS 9 +#define ASPEED_INTC_MAX_OUTPINS 9struct AspeedINTCState {/*< private >*/
@@ -29,7 +29,7 @@ struct AspeedINTCState {uint32_t *regs;OrIRQState orgates[ASPEED_INTC_MAX_INPINS ]; -qemu_irq output_pins[ASPEED_INTC_NR_INTS ]; +qemu_irq output_pins[ASPEED_INTC_MAX_OUTPINS ];uint32_t enable[ASPEED_INTC_MAX_INPINS ];uint32_t mask[ASPEED_INTC_MAX_INPINS ];
@@ -41,6 +41,7 @@ struct AspeedINTCClass {uint32_t num_lines;uint32_t num_inpins; +uint32_t num_outpins;uint64_t mem_size;uint64_t nr_regs;uint64_t reg_offset;
hw/arm/aspeed_ast27x0.c +5 -1
@@ -534,10 +534,14 @@ static void aspeed_soc_ast2700_realize(DeviceState *dev, Error **errp)aspeed_mmio_map (s,SYS_BUS_DEVICE (&a->intc),0 , sc->memmap[ASPEED_DEV_INTC ]); -/* GICINT orgates -> INTC -> GIC */ +/* source orgates -> INTC */ for (i =0 ; i < ic->num_inpins; i++) {qdev_connect_gpio_out (DEVICE (&a->intc.orgates[i]),0 ,qdev_get_gpio_in (DEVICE (&a->intc), i)); + } + +/* INTC -> GIC128 - GIC136 */ +for (i =0 ; i < ic->num_outpins; i++) {sysbus_connect_irq (SYS_BUS_DEVICE (&a->intc), i,qdev_get_gpio_in (DEVICE (&a->gic), aspeed_soc_ast2700_gic_intcmap[i].irq));
hw/intc/aspeed_intc.c +4 -0
@@ -347,6 +347,9 @@ static void aspeed_intc_realize(DeviceState *dev, Error **errp)if (!qdev_realize (DEVICE (&s->orgates[i]),NULL , errp)) {return ; } + } + +for (i =0 ; i < aic->num_outpins; i++) {sysbus_init_irq (sbd, &s->output_pins[i]); } }
@@ -391,6 +394,7 @@ static void aspeed_2700_intc_class_init(ObjectClass *klass, void *data) dc->desc ="ASPEED 2700 INTC Controller" ; aic->num_lines =32 ; aic->num_inpins =9 ; + aic->num_outpins =9 ; aic->mem_size =0x4000 ; aic->nr_regs =0x808 >>2 ; aic->reg_offset =0x1000 ;
Signature · 1 line
2.48.1
[PULL 33/46] hw/intc/aspeed: Add Support for Multi-Output IRQ Handling
In reply to Cédric Le GoaterFrom: Jamin Lin <[email protected]>
This update introduces support for handling multi-output IRQs in the AST2700 interrupt controller (INTC), specifically for GICINT192_201. GICINT192_201 maps 1:10 to input IRQ 0 and output IRQs 0 to 9. Each status bit corresponds to a specific IRQ.
Implemented "aspeed_intc_set_irq_handler_multi_outpins" to handle IRQs with multiple output pins. Introduced "aspeed_intc_status_handler_multi_outpins" for managing status registers associated with multi-output IRQs.
Added new IRQ definitions for GICINT192_201 in INTC. Adjusted the IRQ array to accommodate 10 input pins and 19 output pins, aligning with the new GICINT192_201 mappings.
|------------------------------|
| INTC |
|inpin[0:0]--------->outpin[0] |
|inpin[0:1]--------->outpin[1] |
|inpin[0:2]--------->outpin[2] |
|inpin[0:3]--------->outpin[3] |
orgates[0]-------> |inpin[0:4]--------->outpin[4] |
|inpin[0:5]--------->outpin[5] |
|inpin[0:6]--------->outpin[6] |
|inpin[0:7]--------->outpin[7] |
|inpin[0:8]--------->outpin[8] |
|inpin[0:9]--------->outpin[9] |
| |
orgates[1]------> |inpin[1]----------->outpin[10]|
orgates[2]------> |inpin[2]----------->outpin[11]|
orgates[3]------> |inpin[3]----------->outpin[12]|
orgates[4]------> |inpin[4]----------->outpin[13]|
orgates[5]------> |inpin[5]----------->outpin[14]|
orgates[6]------> |inpin[6]----------->outpin[15]|
orgates[7]------> |inpin[7]----------->outpin[16]|
orgates[8]------> |inpin[8]----------->outpin[17]|
orgates[9]------> |inpin[9]----------->outpin[18]|
|------------------------------|--- include/hw/intc/aspeed_intc.h | 4 +- hw/intc/aspeed_intc.c | 149 ++++++++++++++++++++++++++++++---- hw/intc/trace-events | 1 + 3 files changed, 137 insertions(+), 17 deletions(-)
include/hw/intc/aspeed_intc.h +2 -2
@@ -16,8 +16,8 @@#define TYPE_ASPEED_2700_INTC TYPE_ASPEED_INTC "-ast2700" OBJECT_DECLARE_TYPE(AspeedINTCState, AspeedINTCClass, ASPEED_INTC) -#define ASPEED_INTC_MAX_INPINS 9 -#define ASPEED_INTC_MAX_OUTPINS 9 +#define ASPEED_INTC_MAX_INPINS 10 +#define ASPEED_INTC_MAX_OUTPINS 19 typedef struct AspeedINTCIRQ { int inpin_idx;
hw/intc/aspeed_intc.c +134 -15
211 lines not on this page · raw message
hw/intc/trace-events +1 -0
@@ -92,6 +92,7 @@ aspeed_intc_enable(const char *s, uint32_t value) "%s: Enable: 0x%x" aspeed_intc_select(const char *s, uint32_t value) "%s: Select: 0x%x" aspeed_intc_mask(const char *s, uint32_t change, uint32_t value) "%s: Mask: 0x%x: 0x%x" aspeed_intc_unmask(const char *s, uint32_t change, uint32_t value) "%s: UnMask: 0x%x: 0x%x" +aspeed_intc_all_isr_done_bit(const char *s, int inpin_idx, int bit) "%s: All source ISR execution are done from specific bit: %d-%d" # arm_gic.c gic_enable_irq(int irq) "irq %d enabled"
Signature · 1 line
2.48.1
[PULL 43/46] tests/functional/aspeed: Update temperature hwmon path
In reply to Cédric Le GoaterFrom: Jamin Lin <[email protected]>
Modified the temperature hwmon path to use a wildcard to handle different SDK
versions: "cat /sys/bus/i2c/devices/1-004d/hwmon/hwmon*/temp1_input".
--- tests/functional/test_aarch64_aspeed.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
tests/functional/test_aarch64_aspeed.py +2 -2
@@ -83,11 +83,11 @@ def start_ast2700_test(self, name): 'echo lm75 0x4d > /sys/class/i2c-dev/i2c-1/device/new_device ', 'i2c i2c-1: new_device: Instantiated device lm75 at 0x4d'); exec_command_and_wait_for_pattern(self, - 'cat /sys/class/hwmon/hwmon20/temp1_input', '0') + 'cat /sys/bus/i2c/devices/1-004d/hwmon/hwmon*/temp1_input', '0') self.vm.cmd('qom-set', path='/machine/peripheral/tmp-test', property='temperature', value=18000) exec_command_and_wait_for_pattern(self, - 'cat /sys/class/hwmon/hwmon20/temp1_input', '18000') + 'cat /sys/bus/i2c/devices/1-004d/hwmon/hwmon*/temp1_input', '18000') def test_aarch64_ast2700_evb_sdk_v09_03(self): self.set_machine('ast2700-evb')
Signature · 1 line
2.48.1
[PULL 40/46] hw/arm/aspeed: Add Machine Support for AST2700 A1
In reply to Cédric Le GoaterFrom: Jamin Lin <[email protected]>
Introduce "aspeed_machine_ast2700a1_evb_class_init" to initialize the AST2700 A1 EVB.
--- hw/arm/aspeed.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+)
hw/arm/aspeed.c +24 -0
@@ -1693,6 +1693,26 @@ static void aspeed_machine_ast2700a0_evb_class_init(ObjectClass *oc, void *data) mc->default_ram_size =1 * GiB;aspeed_machine_class_init_cpus_defaults (mc); } + +static void aspeed_machine_ast2700a1_evb_class_init (ObjectClass *oc,void *data) +{ +MachineClass *mc =MACHINE_CLASS (oc); +AspeedMachineClass *amc =ASPEED_MACHINE_CLASS (oc); + + mc->desc ="Aspeed AST2700 A1 EVB (Cortex-A35)" ; + amc->soc_name ="ast2700-a1" ; + amc->hw_strap1 =AST2700_EVB_HW_STRAP1 ; + amc->hw_strap2 =AST2700_EVB_HW_STRAP2 ; + amc->fmc_model ="w25q01jvq" ; + amc->spi_model ="w25q512jv" ; + amc->num_cs =2 ; + amc->macs_mask =ASPEED_MAC0_ON |ASPEED_MAC1_ON |ASPEED_MAC2_ON ; + amc->uart_default =ASPEED_DEV_UART12 ; + amc->i2c_init = ast2700_evb_i2c_init; + mc->auto_create_sdcard = true; + mc->default_ram_size =1 * GiB; +aspeed_machine_class_init_cpus_defaults (mc); +}#endif static void aspeed_machine_qcom_dc_scm_v1_class_init(ObjectClass *oc,
@@ -1821,6 +1841,10 @@ static const TypeInfo aspeed_machine_types[] = { .name = MACHINE_TYPE_NAME("ast2700a0-evb"), .parent = TYPE_ASPEED_MACHINE, .class_init = aspeed_machine_ast2700a0_evb_class_init, + }, { + .name = MACHINE_TYPE_NAME("ast2700a1-evb"), + .parent = TYPE_ASPEED_MACHINE, + .class_init = aspeed_machine_ast2700a1_evb_class_init,#endif }, { .name = TYPE_ASPEED_MACHINE,
Signature · 1 line
2.48.1
[PULL 34/46] hw/intc/aspeed: Add Support for AST2700 INTCIO Controller
In reply to Cédric Le GoaterFrom: Jamin Lin <[email protected]>
Introduce a new ast2700 INTCIO class to support AST2700 INTCIO. Added new register definitions for INTCIO, including enable and status registers for IRQs GICINT192 through GICINT197.
Created a dedicated IRQ array for INTCIO, supporting six input pins and six output pins, aligning with the newly defined registers. Implemented "aspeed_intcio_read" and "aspeed_intcio_write" to handle INTCIO-specific register access.
To GICINT196 |
ETH1 |-----------| |--------------------------|
-------->|0 | | INTCIO |
ETH2 | 4| orgates[0]------>|inpin[0]-------->outpin[0]|
-------->|1 5| orgates[1]------>|inpin[1]-------->outpin[1]|
ETH3 | 6| orgates[2]------>|inpin[2]-------->outpin[2]|
-------->|2 19| orgates[3]------>|inpin[3]-------->outpin[3]|
UART0 | 20|-->orgates[4]------>|inpin[4]-------->outpin[4]|
-------->|7 21| orgates[5]------>|inpin[5]-------->outpin[5]|
UART1 | 22| |--------------------------|
-------->|8 23|
UART2 | 24|
-------->|9 25|
UART3 | 26|
---------|10 27|
UART5 | 28|
-------->|11 29|
UART6 | |
-------->|12 30|
UART7 | 31|
-------->|13 |
UART8 | OR[0:31] |
-------->|14 |
UART9 | |
-------->|15 |
UART10 | |
-------->|16 |
UART11 | |
-------->|17 |
UART12 | |
-------->|18 |
|-----------|--- include/hw/intc/aspeed_intc.h | 1 + hw/intc/aspeed_intc.c | 112 ++++++++++++++++++++++++++++++++++ 2 files changed, 113 insertions(+)
include/hw/intc/aspeed_intc.h +1 -0
@@ -14,6 +14,7 @@#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" OBJECT_DECLARE_TYPE(AspeedINTCState, AspeedINTCClass, ASPEED_INTC)#define ASPEED_INTC_MAX_INPINS 10
hw/intc/aspeed_intc.c +112 -0
140 lines not on this page · raw message
Signature · 1 line
2.48.1
Re: [PULL 34/46] hw/intc/aspeed: Add Support for AST2700 INTCIO Controller
Quoted 33 lines · Cédric Le Goater
From: Jamin Lin <[email protected]>
Introduce a new ast2700 INTCIO class to support AST2700 INTCIO. Added new register definitions for INTCIO, including enable and status registers for IRQs GICINT192 through GICINT197.
Created a dedicated IRQ array for INTCIO, supporting six input pins and six output pins, aligning with the newly defined registers. Implemented "aspeed_intcio_read" and "aspeed_intcio_write" to handle INTCIO-specific register access.Signed-off-by Jamin Lin <[email protected]>Reviewed-by Cédric Le Goater <[email protected]>Signed-off-by Cédric Le Goater <[email protected]>--- include/hw/intc/aspeed_intc.h | 1 + hw/intc/aspeed_intc.c | 112 ++++++++++++++++++++++++++++++++++ 2 files changed, 113 insertions(+)hw/intc/aspeed_intc.c +12
-0+static uint64_t aspeed_intcio_read (void *opaque,hwaddr offset, +unsigned int size) +{ +AspeedINTCState *s =ASPEED_INTC (opaque); +const char *name =object_get_typename (OBJECT (s)); +uint32_t reg = offset >>2 ; +uint32_t value =0 ; + + value = s->regs[reg]; +trace_aspeed_intc_read (name, offset, size, value); + +return value;
hw/intc/aspeed_intc.c static void aspeed_intc_write(void *opaque, hwaddr offset, uint64_t data, · line 498
Quoted 10 lines
hw/intc/aspeed_intc.c +9
-0+} +static const MemoryRegionOps aspeed_intcio_ops = { + .read = aspeed_intcio_read, + .write = aspeed_intcio_write, + .endianness =DEVICE_LITTLE_ENDIAN , + .valid = { + .min_access_size =4 , + .max_access_size =4 , + }
Could be safer to also add .impl.min_access_size = 4.
Quoted 1 line
+};
RE: [PULL 34/46] hw/intc/aspeed: Add Support for AST2700 INTCIO Controller
Hi Philippe,
Quoted 50 lines
Subject: Re: [PULL 34/46] hw/intc/aspeed: Add Support for AST2700 INTCIO Controller
Quoted 13 lines · Cédric Le Goater
From: Jamin Lin <[email protected]>
Introduce a new ast2700 INTCIO class to support AST2700 INTCIO. Added new register definitions for INTCIO, including enable and status registers for IRQs GICINT192 through GICINT197.
Created a dedicated IRQ array for INTCIO, supporting six input pins and six output pins, aligning with the newly defined registers. Implemented "aspeed_intcio_read" and "aspeed_intcio_write" to handle INTCIO-specific register access.Signed-off-by Jamin Lin <[email protected]>Reviewed-by Cédric Le Goater <[email protected]>Quoted 7 lines
Link:
https://lore.kernel.org/qemu-devel/20250307035945.3698802-18-jamin_lin
@aspeedtech.comSigned-off-by Cédric Le Goater <[email protected]>--- include/hw/intc/aspeed_intc.h | 1 + hw/intc/aspeed_intc.c | 112++++++++++++++++++++++++++++++++++
Quoted 14 lines
2 files changed, 113 insertions(+)hw/intc/aspeed_intc.c +11
-0+static uint64_t aspeed_intcio_read (void *opaque,hwaddr offset, +unsigned int size) { +AspeedINTCState *s =ASPEED_INTC (opaque); +const char *name =object_get_typename (OBJECT (s)); +uint32_t reg = offset >>2 ; +uint32_t value =0 ; + + value = s->regs[reg]; +trace_aspeed_intc_read (name, offset, size, value); + +return value;hw/intc/aspeed_intc.c static void aspeed_intc_write(void *opaque, hwaddr offset, uint64_t data, · line 498
Quoted 10 lines
hw/intc/aspeed_intc.c +9
-0+} +static const MemoryRegionOps aspeed_intcio_ops = { + .read = aspeed_intcio_read, + .write = aspeed_intcio_write, + .endianness =DEVICE_LITTLE_ENDIAN , + .valid = { + .min_access_size =4 , + .max_access_size =4 , + }
Quoted 2 lines
Could be safer to also add .impl.min_access_size = 4.
Thanks for the suggestion.
Will do
Jamin
Quoted 1 line
Quoted 1 line
+};
[PULL 03/46] tests/functional: Update OpenBMC image of romulus machine
In reply to Cédric Le GoaterUse the new do_test_arm_aspeed_openbmc() routine to run the latest OpenBMC firmware build of the romulus BMC. Remove the older routine which is now unused.
--- tests/functional/aspeed.py | 16 ---------------- tests/functional/test_arm_aspeed_romulus.py | 13 +++++++------ 2 files changed, 7 insertions(+), 22 deletions(-)
tests/functional/aspeed.py +0 -16
@@ -7,22 +7,6 @@ class AspeedTest(LinuxKernelTest): - def do_test_arm_aspeed(self, machine, image): - self.set_machine(machine) - self.vm.set_console() - self.vm.add_args('-drive', 'file=' + image + ',if=mtd,format=raw', - '-net', 'nic', '-snapshot') - self.vm.launch() - - self.wait_for_console_pattern("U-Boot 2016.07") - self.wait_for_console_pattern("## Loading kernel from FIT Image at 20080000") - self.wait_for_console_pattern("Starting kernel ...") - self.wait_for_console_pattern("Booting Linux on physical CPU 0x0") - self.wait_for_console_pattern( - "aspeed-smc 1e620000.spi: read control register: 203b0641") - self.wait_for_console_pattern("ftgmac100 1e660000.ethernet eth0: irq ") - self.wait_for_console_pattern("systemd[1]: Set hostname to") - def do_test_arm_aspeed_openbmc(self, machine, image, uboot='2019.04', cpu_id='0x0', soc='AST2500 rev A1'): hostname = machine.removesuffix('-bmc')
tests/functional/test_arm_aspeed_romulus.py +7 -6
@@ -7,18 +7,19 @@ from qemu_test import Asset from aspeed import AspeedTest + class RomulusMachine(AspeedTest): ASSET_ROMULUS_FLASH = Asset( - ('https://github.com/openbmc/openbmc/releases/download/2.9.0/' - 'obmc-phosphor-image-romulus.static.mtd'), - '820341076803f1955bc31e647a512c79f9add4f5233d0697678bab4604c7bb25') + 'https://github.com/legoater/qemu-aspeed-boot/raw/master/images/romulus-bmc/openbmc-20250128071340/obmc-phosphor-image-romulus-20250128071340.static.mtd', + '6d031376440c82ed9d087d25e9fa76aea75b42f80daa252ec402c0bc3cf6cf5b'); - def test_arm_ast2500_romulus_openbmc_v2_9_0(self): + def test_arm_ast2500_romulus_openbmc(self): image_path = self.ASSET_ROMULUS_FLASH.fetch() - self.do_test_arm_aspeed('romulus-bmc', image_path) - + self.do_test_arm_aspeed_openbmc('romulus-bmc', image=image_path, + uboot='2019.04', cpu_id='0x0', + soc='AST2500 rev A1'); if __name__ == '__main__': AspeedTest.main()
Signature · 1 line
2.48.1
[PULL 15/46] hw/misc/aspeed_scu: Fix the hw-strap1 cannot be set in the SOC layer for AST2700
In reply to Cédric Le GoaterFrom: Jamin Lin <[email protected]>
There is one hw_strap1 register in the SCU (CPU DIE) and another hw_strap1 register in the SCUIO (IO DIE).
In the "ast2700_a0_resets" function, the hardcoded value "0x00000800" is set in SCU hw-strap1 (CPU DIE), and in "ast2700_a0_resets_io" the hardcoded value "0x00000504" is set in SCUIO hw-strap1 (IO DIE). Both values cannot be set via the SOC layer.
The value of "s->hw_strap1" is set by the SOC layer via the "hw-strap1" property. Update the "aspeed_ast2700_scu_reset" function to set the value of "s->hw_strap1" in both the SCU and SCUIO hw-strap1 registers.
--- hw/misc/aspeed_scu.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
hw/misc/aspeed_scu.c +1 -2
@@ -910,7 +910,6 @@ static const MemoryRegionOps aspeed_ast2700_scu_ops = { };static const uint32_t ast2700_a0_resets[ASPEED_AST2700_SCU_NR_REGS ] = { - [AST2700_HW_STRAP1 ] =0x00000800 , [AST2700_HW_STRAP1_CLR ] =0xFFF0FFF0 , [AST2700_HW_STRAP1_LOCK ] =0x00000FFF , [AST2700_HW_STRAP1_SEC1 ] =0x000000FF ,
@@ -940,6 +939,7 @@ static void aspeed_ast2700_scu_reset(DeviceState *dev)memcpy (s->regs, asc->resets, asc->nr_regs *4 ); s->regs[AST2700_SILICON_REV ] = s->silicon_rev; + s->regs[AST2700_HW_STRAP1 ] = s->hw_strap1; }static void aspeed_2700_scu_class_init (ObjectClass *klass,void *data)
@@ -1032,7 +1032,6 @@ static const MemoryRegionOps aspeed_ast2700_scuio_ops = { };static const uint32_t ast2700_a0_resets_io[ASPEED_AST2700_SCU_NR_REGS ] = { - [AST2700_HW_STRAP1 ] =0x00000504 , [AST2700_HW_STRAP1_CLR ] =0xFFF0FFF0 , [AST2700_HW_STRAP1_LOCK ] =0x00000FFF , [AST2700_HW_STRAP1_SEC1 ] =0x000000FF ,
Signature · 1 line
2.48.1
[PULL 45/46] tests/functional/aspeed: Add test case for AST2700 A1
In reply to Cédric Le GoaterFrom: Jamin Lin <[email protected]>
--- tests/functional/test_aarch64_aspeed.py | 10 ++++++++++ 1 file changed, 10 insertions(+)
tests/functional/test_aarch64_aspeed.py +10 -0
@@ -31,6 +31,10 @@ def do_test_aarch64_aspeed_sdk_start(self, image): 'https://github.com/AspeedTech-BMC/openbmc/releases/download/v09.05/ast2700-a0-default-obmc.tar.gz', 'cfbbd1cce72f2a3b73b9080c41eecdadebb7077fba4f7806d72ac99f3e84b74a') + ASSET_SDK_V905_AST2700A1 = Asset( + 'https://github.com/AspeedTech-BMC/openbmc/releases/download/v09.05/ast2700-default-obmc.tar.gz', + 'c1f4496aec06743c812a6e9a1a18d032f34d62f3ddb6956e924fef62aa2046a5') + def start_ast2700_test(self, name): num_cpu = 4 uboot_size = os.path.getsize(self.scratch_file(name,
@@ -95,6 +99,12 @@ def test_aarch64_ast2700_evb_sdk_v09_05(self): self.archive_extract(self.ASSET_SDK_V905_AST2700) self.start_ast2700_test('ast2700-a0-default') + def test_aarch64_ast2700a1_evb_sdk_v09_05(self): + self.set_machine('ast2700a1-evb') + + self.archive_extract(self.ASSET_SDK_V905_AST2700A1) + self.start_ast2700_test('ast2700-default') + if __name__ == '__main__': QemuSystemTest.main()
Signature · 1 line
2.48.1
Re: [PULL 45/46] tests/functional/aspeed: Add test case for AST2700 A1
Jamin,
Quoted 28 lines · Cédric Le Goater
From: Jamin Lin <[email protected]>
Signed-off-by Jamin Lin <[email protected]>Reviewed-by Cédric Le Goater <[email protected]>Signed-off-by Cédric Le Goater <[email protected]>--- tests/functional/test_aarch64_aspeed.py | 10 ++++++++++ 1 file changed, 10 insertions(+)tests/functional/test_aarch64_aspeed.py +4
-0@@ -31,6 +31,10 @@ def do_test_aarch64_aspeed_sdk_start(self, image): 'https://github.com/AspeedTech-BMC/openbmc/releases/download/v09.05/ast2700-a0-default-obmc.tar.gz', 'cfbbd1cce72f2a3b73b9080c41eecdadebb7077fba4f7806d72ac99f3e84b74a') + ASSET_SDK_V905_AST2700A1 = Asset( + 'https://github.com/AspeedTech-BMC/openbmc/releases/download/v09.05/ast2700-default-obmc.tar.gz', + 'c1f4496aec06743c812a6e9a1a18d032f34d62f3ddb6956e924fef62aa2046a5') + def start_ast2700_test(self, name): num_cpu = 4 uboot_size = os.path.getsize(self.scratch_file(name,@@ -95,6 +99,12 @@ def test_aarch64_ast2700_evb_sdk_v09_05(self): self.archive_extract(self.ASSET_SDK_V905_AST2700) self.start_ast2700_test('ast2700-a0-default')
tests/functional/test_aarch64_aspeed.py def test_aarch64_ast2700_evb_sdk_v09_05(self): · line 110
Quoted 10 lines
tests/functional/test_aarch64_aspeed.py +6
-0+ def test_aarch64_ast2700a1_evb_sdk_v09_05(self): + self.set_machine('ast2700a1-evb') + + self.archive_extract(self.ASSET_SDK_V905_AST2700A1) + self.start_ast2700_test('ast2700-default') + if __name__ == '__main__': QemuSystemTest.main()
On a BE host, if I run an ast2700a0-evb machine :
$ qemu-system-aarch64 -machine ast2700a0-evb ... ... U-Boot 2023.10-v00.05.06 (Mar 26 2025 - 05:59:26 +0000)
SOC: AST2700-A0
Model: AST2700 EVB
DRAM: 8 GiB (effective 0 Bytes)
QEMU hangs.
If the RAM size is defined to 8g
$ qemu-system-aarch64 -machine ast2700a0-evb -m 8g ... ... U-Boot 2023.10-v00.05.06 (Mar 26 2025 - 05:59:26 +0000)
SOC: AST2700-A0
Model: AST2700 EVB
DRAM: 8 GiB
aspeed_dp dp@12c0a000: aspeed_dp_probe(): Failed to access dp. version(0)
Core: 125 devices, 27 uclasses, devicetree: separate
machine boots.
Whereas, with an ast2700a1-evb machine :
$ qemu-system-aarch64 -machine ast2700a1-evb ... ... U-Boot 2023.10-v00.05.06 (Mar 26 2025 - 05:59:26 +0000)
SOC: AST2700-A1
Model: AST2700 EVB
DRAM: 1 GiB
aspeed_dp dp@12c0a000: aspeed_dp_probe(): Failed to access dp. version(0)
Core: 125 devices, 27 uclasses, devicetree: separate
machine boots.
$ qemu-system-aarch64 -machine ast2700a1-evb -m 8g ... ... U-Boot 2023.10-v00.05.06 (Mar 26 2025 - 05:59:26 +0000)
SOC: AST2700-A1
Model: AST2700 EVB
DRAM: 8 GiB
aspeed_dp dp@12c0a000: aspeed_dp_probe(): Failed to access dp. version(0)
Core: 125 devices, 27 uclasses, devicetree: separate
machine boots.
I Wonder if you could analyze this issue to check if it is related to one of our QEMU model.
Thanks,
C.
RE: [PULL 45/46] tests/functional/aspeed: Add test case for AST2700 A1
Hi Cédric
Quoted 54 lines
On a BE host, if I run an ast2700a0-evb machine :
$ qemu-system-aarch64 -machine ast2700a0-evb ... ... U-Boot 2023.10-v00.05.06 (Mar 26 2025 - 05:59:26 +0000)SOC: AST2700-A0 Model: AST2700 EVB DRAM: 8 GiB (effective 0 Bytes)QEMU hangs.
If the RAM size is defined to 8g
$ qemu-system-aarch64 -machine ast2700a0-evb -m 8g ... ... U-Boot 2023.10-v00.05.06 (Mar 26 2025 - 05:59:26 +0000)SOC: AST2700-A0
Model: AST2700 EVB
DRAM: 8 GiB
aspeed_dpdp@12c0a000:aspeed_dp_probe(): Failed to access dp.
version(0)
Core: 125 devices, 27 uclasses, devicetree: separatemachine boots.
Whereas, with an ast2700a1-evb machine :
$ qemu-system-aarch64 -machine ast2700a1-evb ... ... U-Boot 2023.10-v00.05.06 (Mar 26 2025 - 05:59:26 +0000)SOC: AST2700-A1
Model: AST2700 EVB
DRAM: 1 GiB
aspeed_dpdp@12c0a000:aspeed_dp_probe(): Failed to access dp.
version(0)
Core: 125 devices, 27 uclasses, devicetree: separatemachine boots.
$ qemu-system-aarch64 -machine ast2700a1-evb -m 8g ... ... U-Boot 2023.10-v00.05.06 (Mar 26 2025 - 05:59:26 +0000)SOC: AST2700-A1
Model: AST2700 EVB
DRAM: 8 GiB
aspeed_dpdp@12c0a000:aspeed_dp_probe(): Failed to access dp.
version(0)
Core: 125 devices, 27 uclasses, devicetree: separate
Quoted 7 lines
machine boots.
I Wonder if you could analyze this issue to check if it is related to one of our QEMU model.
Sorry, I only have a little-endian host machine (x86_64).
Is it possible to run a big-endian(POWER PC) QEMU host environment on this machine, so that I can then run the AST2700 QEMU target inside it to analyze this issue?
If you agree, could you please help me insert the following lines into the function that detects the DRAM size on the AST2700?
https://github.com/qemu/qemu/blob/master/hw/arm/aspeed_ast27x0.c#L332
https://github.com/qemu/qemu/commit/7436db1063bbfecc2e498a7d795613b33312d665
````
static void aspeed_ram_capacity_write(void *opaque, hwaddr addr, uint64_t data,
unsigned int size)
{
AspeedSoCState *s = ASPEED_SOC(opaque);
ram_addr_t ram_size;
MemTxResult result;
uint32_t read_back[4] = {0};
ram_size = object_property_get_uint(OBJECT(&s->sdmc), "ram-size",
&error_abort);
assert(ram_size > 0);
printf("jamin size %d\n", size);
printf("addr=%" PRIx64 " (addr ram_size)=%" PRIx64 "\n", addr, (addr % ram_size));
/*
* Emulate ddr capacity hardware behavior.
* If writes the data to the address which is beyond the ram size,
* it would write the data to the "address % ram_size".
*/
result = address_space_write(&s->dram_as, addr % ram_size,
MEMTXATTRS_UNSPECIFIED, &data, size);
if (result != MEMTX_OK) {
qemu_log_mask(LOG_GUEST_ERROR,
"%s: DRAM write failed, addr:0x%" HWADDR_PRIx
", data :0x%" PRIx64 "\n",
__func__, addr % ram_size, data);
}
address_space_read(&s->dram_as, addr % ram_size,
MEMTXATTRS_UNSPECIFIED, read_back,
size);
for(int i=0; i<4; i++) {
printf("jamin read_back[%d]=%x\n", i, read_back[i]);
}
}
````Also, could you please provide me with the following log?
U-Boot 2023.10-v00.05.06 (Mar 26 2025 - 05:59:26 +0000)
SOC: AST2700-A0
Model: AST2700 EVB
DRAM: jamin size 4
addr=c0000000 (addr ram_size)=0
jamin read_back[0]=eadbeef4
jamin read_back[1]=0
jamin read_back[2]=0
jamin read_back[3]=0
jamin size 4
addr=40000000 (addr ram_size)=0
jamin read_back[0]=adbeef43
jamin read_back[1]=0
jamin read_back[2]=0
jamin read_back[3]=0
jamin size 4
addr=0 (addr ram_size)=0
jamin read_back[0]=dbeef432
jamin read_back[1]=0
jamin read_back[2]=0
jamin read_back[3]=0
1 GiB
It's quite strange, because you mentioned that the A1 version works, but the A0 version doesn't. It seems detect the DRAM size failed in this loop,
https://github.com/AspeedTech-BMC/u-boot/blob/aspeed-master-v2023.10/drivers/ram/aspeed/sdram_ast2700.c#L1173
struct ddr_capacity ram_size[] = {
{0x10000000, {208, 256}}, // 256MB
{0x20000000, {208, 416}}, // 512MB
{0x40000000, {208, 560}}, // 1GB
{0x80000000, {472, 880}}, // 2GB
{0x100000000, {656, 880}}, // 4GB
{0x200000000, {880, 880}}, // 8GB
};u32 test_pattern = 0xdeadbeef
for (sz = SDRAM_SIZE_8GB - 1; sz > SDRAM_SIZE_256MB; sz--) {
test_pattern = (test_pattern << 4) + sz;
writel(test_pattern, (void *)CFG_SYS_SDRAM_BASE + ram_size[sz].size);
if (readl((void *)CFG_SYS_SDRAM_BASE) != test_pattern)
break;
}Please help to dump this register.
=> md 12c0001012c00010: 00000028 00000000 00000000 00000000 (...............
0x28-->
0010 1000
Bit0 : 0 DDR4 SDRAM
Bit:1 : 0 Reserved
Bit:4:2 : 010 --> 1GB
Thanks-Jamin
Quoted 3 lines
Thanks,
C.
Re: [PULL 45/46] tests/functional/aspeed: Add test case for AST2700 A1
Quoted 59 lines · Jamin Lin
Hi Cédric
Quoted 57 lines
On a BE host, if I run an ast2700a0-evb machine :
$ qemu-system-aarch64 -machine ast2700a0-evb ... ... U-Boot 2023.10-v00.05.06 (Mar 26 2025 - 05:59:26 +0000)SOC: AST2700-A0 Model: AST2700 EVB DRAM: 8 GiB (effective 0 Bytes)QEMU hangs.
If the RAM size is defined to 8g
$ qemu-system-aarch64 -machine ast2700a0-evb -m 8g ... ... U-Boot 2023.10-v00.05.06 (Mar 26 2025 - 05:59:26 +0000)SOC: AST2700-A0
Model: AST2700 EVB
DRAM: 8 GiB
aspeed_dpdp@12c0a000:aspeed_dp_probe(): Failed to access dp.
version(0)
Core: 125 devices, 27 uclasses, devicetree: separatemachine boots.
Whereas, with an ast2700a1-evb machine :
$ qemu-system-aarch64 -machine ast2700a1-evb ... ... U-Boot 2023.10-v00.05.06 (Mar 26 2025 - 05:59:26 +0000)SOC: AST2700-A1
Model: AST2700 EVB
DRAM: 1 GiB
aspeed_dpdp@12c0a000:aspeed_dp_probe(): Failed to access dp.
version(0)
Core: 125 devices, 27 uclasses, devicetree: separatemachine boots.
$ qemu-system-aarch64 -machine ast2700a1-evb -m 8g ... ... U-Boot 2023.10-v00.05.06 (Mar 26 2025 - 05:59:26 +0000)SOC: AST2700-A1
Model: AST2700 EVB
DRAM: 8 GiB
aspeed_dpdp@12c0a000:aspeed_dp_probe(): Failed to access dp.
version(0)
Core: 125 devices, 27 uclasses, devicetree: separatemachine boots.
Quoted 7 lines
Quoted 4 lines
I Wonder if you could analyze this issue to check if it is related to one of our QEMU model.
Sorry, I only have a little-endian host machine (
x86_64).
Is it possible to run a big-endian(POWER PC) QEMU host environment on this machine, so that I can then run the AST2700 QEMU target inside it to analyze this issue?
You can but unless you have access to a POWER hypervisor, this will be very slow because of the 2 levels of emulations.
Quoted 57 lines
If you agree, could you please help me insert the following lines into the function that detects the DRAM size on the AST2700?
https://github.com/qemu/qemu/blob/master/hw/arm/aspeed_ast27x0.c#L332
https://github.com/qemu/qemu/commit/7436db1063bbfecc2e498a7d795613b33312d665```` static void aspeed_ram_capacity_write(void *opaque, hwaddr addr, uint64_t data, unsigned int size) { AspeedSoCState *s = ASPEED_SOC(opaque); ram_addr_t ram_size; MemTxResult result; uint32_t read_back[4] = {0}; ram_size = object_property_get_uint(OBJECT(&s->sdmc), "ram-size", &error_abort); assert(ram_size > 0); printf("jamin size %d\n", size); printf("addr=%" PRIx64 " (addr ram_size)=%" PRIx64 "\n", addr, (addr % ram_size)); /* * Emulate ddr capacity hardware behavior. * If writes the data to the address which is beyond the ram size, * it would write the data to the "address % ram_size". */ result = address_space_write(&s->dram_as, addr % ram_size, MEMTXATTRS_UNSPECIFIED, &data, size); if (result != MEMTX_OK) { qemu_log_mask(LOG_GUEST_ERROR, "%s: DRAM write failed, addr:0x%" HWADDR_PRIx ", data :0x%" PRIx64 "\n", __func__, addr % ram_size, data); } address_space_read(&s->dram_as, addr % ram_size, MEMTXATTRS_UNSPECIFIED, read_back, size); for(int i=0; i<4; i++) { printf("jamin read_back[%d]=%x\n", i, read_back[i]); } } ````Also, could you please provide me with the following log?
U-Boot 2023.10-v00.05.06 (Mar 26 2025 - 05:59:26 +0000)
SOC: AST2700-A0
Model: AST2700 EVB
DRAM: jamin size 4
addr=c0000000 (addr ram_size)=0
jamin read_back[0]=eadbeef4
jamin read_back[1]=0
jamin read_back[2]=0
jamin read_back[3]=0
jamin size 4
addr=40000000 (addr ram_size)=0
jamin read_back[0]=adbeef43
jamin read_back[1]=0
jamin read_back[2]=0
Quoted 8 lines
jamin read_back[3]=0
jamin size 4
addr=0 (addr ram_size)=0
jamin read_back[0]=dbeef432
jamin read_back[1]=0
jamin read_back[2]=0
jamin read_back[3]=0
1 GiB
U-Boot 2023.10-v00.05.06 (Mar 26 2025 - 05:59:26 +0000)
SOC: AST2700-A0
Model: AST2700 EVB
DRAM: aspeed_sdmc_read reg @0x4 data: 0x28aspeed_sdmc_read reg @0x4 data: 0x28aspeed_sdmc_write reg @0x4 data: 0x34
jamin size 4
addr=c0000000 (addr ram_size)=0
jamin read_back[0]=0 <-- this is wrong
jamin read_back[1]=0
jamin read_back[2]=0
jamin read_back[3]=0aspeed_sdmc_read reg @0x4 data: 0x3caspeed_sdmc_write reg @0x4 data: 0x34aspeed_sdmc_read reg @0xc data: 0x0aspeed_sdmc_write reg @0xc data: 0x1b8aspeed_sdmc_read reg @0x40 data: 0x0
jamin size 4
addr=1bdea1f70 (addr ram_size)=3dea1f70
jamin read_back[0]=0
jamin read_back[1]=0
jamin read_back[2]=0
jamin read_back[3]=0
jamin size 4
addr=1bdea1f74 (addr ram_size)=3dea1f74
jamin read_back[0]=0
jamin read_back[1]=0
jamin read_back[2]=0
jamin read_back[3]=0
jamin size 4
Quoted 22 lines
It's quite strange, because you mentioned that the A1 version works, but the A0 version doesn't. It seems detect the DRAM size failed in this loop,
https://github.com/AspeedTech-BMC/u-boot/blob/aspeed-master-v2023.10/drivers/ram/aspeed/sdram_ast2700.c#L1173struct ddr_capacity ram_size[] = { {0x10000000, {208, 256}}, // 256MB {0x20000000, {208, 416}}, // 512MB {0x40000000, {208, 560}}, // 1GB {0x80000000, {472, 880}}, // 2GB {0x100000000, {656, 880}}, // 4GB {0x200000000, {880, 880}}, // 8GB };u32
test_pattern=0xdeadbeeffor (sz = SDRAM_SIZE_8GB - 1; sz > SDRAM_SIZE_256MB; sz--) { test_pattern = (test_pattern << 4) + sz; writel(test_pattern, (void *)CFG_SYS_SDRAM_BASE + ram_size[sz].size); if (readl((void *)CFG_SYS_SDRAM_BASE) != test_pattern) break; }
Quoted 3 lines
Please help to dump this register.
=> md12c0001012c00010: 00000028 00000000 00000000 00000000 (...............
I can't do that because the u-boot prompt is never reached. From QEMU:
(qemu) x/10x 0x12c000100000000012c00010: 0x0000003c 0x00000000 0x00000000 0x00000000 0000000012c00020: 0x00000000 0x00000000 0x00000000 0x00000000 0000000012c00030: 0x000001b8 0x00000000
Hope it helps
C.
RE: [PULL 45/46] tests/functional/aspeed: Add test case for AST2700 A1
Hi Cédric
Quoted 153 lines
Subject: Re: [PULL 45/46] tests/functional/aspeed: Add test case for AST2700 A1
Quoted 59 lines · Jamin Lin
Hi Cédric
Quoted 57 lines
On a BE host, if I run an ast2700a0-evb machine :
$ qemu-system-aarch64 -machine ast2700a0-evb ... ... U-Boot 2023.10-v00.05.06 (Mar 26 2025 - 05:59:26 +0000)SOC: AST2700-A0 Model: AST2700 EVB DRAM: 8 GiB (effective 0 Bytes)QEMU hangs.
If the RAM size is defined to 8g
$ qemu-system-aarch64 -machine ast2700a0-evb -m 8g ... ... U-Boot 2023.10-v00.05.06 (Mar 26 2025 - 05:59:26 +0000)SOC: AST2700-A0
Model: AST2700 EVB
DRAM: 8 GiB
aspeed_dpdp@12c0a000:aspeed_dp_probe(): Failed to access dp.
version(0)
Core: 125 devices, 27 uclasses, devicetree: separatemachine boots.
Whereas, with an ast2700a1-evb machine :
$ qemu-system-aarch64 -machine ast2700a1-evb ... ... U-Boot 2023.10-v00.05.06 (Mar 26 2025 - 05:59:26 +0000)SOC: AST2700-A1
Model: AST2700 EVB
DRAM: 1 GiB
aspeed_dpdp@12c0a000:aspeed_dp_probe(): Failed to access dp.
version(0)
Core: 125 devices, 27 uclasses, devicetree: separatemachine boots.
$ qemu-system-aarch64 -machine ast2700a1-evb -m 8g ... ... U-Boot 2023.10-v00.05.06 (Mar 26 2025 - 05:59:26 +0000)SOC: AST2700-A1
Model: AST2700 EVB
DRAM: 8 GiB
aspeed_dpdp@12c0a000:aspeed_dp_probe(): Failed to access dp.
version(0)
Core: 125 devices, 27 uclasses, devicetree: separatemachine boots.
Quoted 7 lines
Quoted 4 lines
I Wonder if you could analyze this issue to check if it is related to one of our QEMU model.
Sorry, I only have a little-endian host machine (
x86_64).
Is it possible to run a big-endian(POWER PC) QEMU host environment on thismachine, so that I can then run the AST2700 QEMU target inside it to analyze this issue?
You can but unless you have access to a POWER hypervisor, this will be very slow because of the 2 levels of emulations.
Quoted 1 line
If you agree, could you please help me insert the following lines into the
function that detects the DRAM size on the AST2700?
Quoted 1 line
https://github.com/qemu/qemu/blob/master/hw/arm/aspeed_ast27x0.c#L332
Quoted 1 line
https://github.com/qemu/qemu/commit/7436db1063bbfecc2e498a7d795613b
333Quoted 3 lines
12d665
````
static void aspeed_ram_capacity_write(void *opaque, hwaddr addr,uint64_tdata,
Quoted 1 line
unsigned int
size) {
Quoted 10 lines
AspeedSoCState *s = ASPEED_SOC(opaque); ram_addr_t ram_size; MemTxResult result; uint32_t read_back[4] = {0}; ram_size = object_property_get_uint(OBJECT(&s->sdmc), "ram-size", &error_abort); assert(ram_size > 0); printf("jamin size %d\n", size); printf("addr=%" PRIx64 " (addr ram_size)=%" PRIx64 "\n", addr, (addr%
ram_size));Quoted 7 lines
/*
* Emulate ddr capacity hardware behavior.
* If writes the data to the address which is beyond the ram size,
* it would write the data to the "address %ram_size". */
result = address_space_write(&s->dram_as, addr %ram_size,
MEMTXATTRS_UNSPECIFIED,&data, size);
Quoted 3 lines
if (result != MEMTX_OK) { qemu_log_mask(LOG_GUEST_ERROR, "%s: DRAM write failed, addr:0x%"
HWADDR_PRIxQuoted 30 lines
", data :0x%" PRIx64 "\n", __func__, addr % ram_size, data); } address_space_read(&s->dram_as, addr % ram_size, MEMTXATTRS_UNSPECIFIED, read_back, size); for(int i=0; i<4; i++) { printf("jamin read_back[%d]=%x\n", i, read_back[i]); } }````
Also, could you please provide me with the following log?U-Boot 2023.10-v00.05.06 (Mar 26 2025 - 05:59:26 +0000)
SOC: AST2700-A0
Model: AST2700 EVB
DRAM: jamin size 4
addr=c0000000 (addr ram_size)=0
jamin read_back[0]=eadbeef4
jamin read_back[1]=0
jamin read_back[2]=0
jamin read_back[3]=0
jamin size 4
addr=40000000 (addr ram_size)=0
jamin read_back[0]=adbeef43
jamin read_back[1]=0
jamin read_back[2]=0Quoted 8 lines
jamin read_back[3]=0
jamin size 4
addr=0 (addr ram_size)=0
jamin read_back[0]=dbeef432
jamin read_back[1]=0
jamin read_back[2]=0
jamin read_back[3]=0
1 GiB
Quoted 8 lines
U-Boot 2023.10-v00.05.06 (Mar 26 2025 - 05:59:26 +0000)
SOC: AST2700-A0
Model: AST2700 EVB
DRAM:aspeed_sdmc_readreg @0x4 data:0x28aspeed_sdmc_readreg @0x4 data:0x28aspeed_sdmc_writereg @0x4 data:0x34jamin size 4 addr=c0000000 (addr ram_size)=0
jamin read_back[0]=0 <-- this is wrong
It seems that the "data" is in the CPU 's native endianness.
I'm currently looking for a big-endian environment to test the changes I made, and will update you once I have results.
uint32_t val = cpu_to_le32((uint32_t)data);
address_space_write(&s->dram_as, addr % ram_size,
MEMTXATTRS_UNSPECIFIED, &val, 4);
Thanks-Jamin
Quoted 64 lines
jamin read_back[1]=0
jamin read_back[2]=0
jamin read_back[3]=0aspeed_sdmc_readreg @0x4 data:0x3caspeed_sdmc_writereg @0x4 data:0x34aspeed_sdmc_readreg @0xc data:0x0aspeed_sdmc_writereg @0xc data:0x1b8aspeed_sdmc_readreg @0x40 data:0x0
jamin size 4
addr=1bdea1f70 (addr ram_size)=3dea1f70
jamin read_back[0]=0
jamin read_back[1]=0
jamin read_back[2]=0
jamin read_back[3]=0
jamin size 4
addr=1bdea1f74 (addr ram_size)=3dea1f74
jamin read_back[0]=0
jamin read_back[1]=0
jamin read_back[2]=0
jamin read_back[3]=0
jamin size 4Quoted 2 lines
It's quite strange, because you mentioned that the A1 version works, but the
A0 version doesn't.
Quoted 2 lines
It seems detect the DRAM size failed in this loop,
https://github.com/AspeedTech-BMC/u-boot/blob/aspeed-master-v2023.10/d
Quoted 16 lines
rivers/ram/aspeed/sdram_ast2700.c#L1173
struct ddr_capacity ram_size[] = { {0x10000000, {208, 256}}, // 256MB {0x20000000, {208, 416}}, // 512MB {0x40000000, {208, 560}}, // 1GB {0x80000000, {472, 880}}, // 2GB {0x100000000, {656, 880}}, // 4GB {0x200000000, {880, 880}}, // 8GB };u32
test_pattern=0xdeadbeeffor (sz = SDRAM_SIZE_8GB - 1; sz > SDRAM_SIZE_256MB; sz--) { test_pattern = (test_pattern << 4) + sz; writel(test_pattern, (void *)CFG_SYS_SDRAM_BASE +ram_size[sz].size);
Quoted 7 lines
if (readl((void *)CFG_SYS_SDRAM_BASE) != test_pattern) break; }Please help to dump this register.
=> md12c0001012c00010: 00000028 00000000 00000000 00000000 (...............I can't do that because the u-boot prompt is never reached. From QEMU:
(qemu) x/10x
0x12c000100000000012c00010:0x0000003c0x000000000x000000000x000000000000000012c00020:0x000000000x000000000x000000000x000000000000000012c00030:0x000001b80x00000000Hope it helps
C.
Re: [PULL 45/46] tests/functional/aspeed: Add test case for AST2700 A1
Hello Jamin
Quoted 165 lines · Jamin Lin
Hi Cédric
Quoted 153 lines
Subject: Re: [PULL 45/46] tests/functional/aspeed: Add test case for AST2700 A1
Quoted 59 lines · Jamin Lin
Hi Cédric
Quoted 57 lines
On a BE host, if I run an ast2700a0-evb machine :
$ qemu-system-aarch64 -machine ast2700a0-evb ... ... U-Boot 2023.10-v00.05.06 (Mar 26 2025 - 05:59:26 +0000)SOC: AST2700-A0 Model: AST2700 EVB DRAM: 8 GiB (effective 0 Bytes)QEMU hangs.
If the RAM size is defined to 8g
$ qemu-system-aarch64 -machine ast2700a0-evb -m 8g ... ... U-Boot 2023.10-v00.05.06 (Mar 26 2025 - 05:59:26 +0000)SOC: AST2700-A0
Model: AST2700 EVB
DRAM: 8 GiB
aspeed_dpdp@12c0a000:aspeed_dp_probe(): Failed to access dp.
version(0)
Core: 125 devices, 27 uclasses, devicetree: separatemachine boots.
Whereas, with an ast2700a1-evb machine :
$ qemu-system-aarch64 -machine ast2700a1-evb ... ... U-Boot 2023.10-v00.05.06 (Mar 26 2025 - 05:59:26 +0000)SOC: AST2700-A1
Model: AST2700 EVB
DRAM: 1 GiB
aspeed_dpdp@12c0a000:aspeed_dp_probe(): Failed to access dp.
version(0)
Core: 125 devices, 27 uclasses, devicetree: separatemachine boots.
$ qemu-system-aarch64 -machine ast2700a1-evb -m 8g ... ... U-Boot 2023.10-v00.05.06 (Mar 26 2025 - 05:59:26 +0000)SOC: AST2700-A1
Model: AST2700 EVB
DRAM: 8 GiB
aspeed_dpdp@12c0a000:aspeed_dp_probe(): Failed to access dp.
version(0)
Core: 125 devices, 27 uclasses, devicetree: separatemachine boots.
Quoted 7 lines
Quoted 4 lines
I Wonder if you could analyze this issue to check if it is related to one of our QEMU model.
Sorry, I only have a little-endian host machine (
x86_64).
Is it possible to run a big-endian(POWER PC) QEMU host environment on thismachine, so that I can then run the AST2700 QEMU target inside it to analyze this issue?
You can but unless you have access to a POWER hypervisor, this will be very slow because of the 2 levels of emulations.
Quoted 1 line
If you agree, could you please help me insert the following lines into the
function that detects the DRAM size on the AST2700?
Quoted 1 line
https://github.com/qemu/qemu/blob/master/hw/arm/aspeed_ast27x0.c#L332
Quoted 1 line
https://github.com/qemu/qemu/commit/7436db1063bbfecc2e498a7d795613b
333Quoted 3 lines
12d665
````
static void aspeed_ram_capacity_write(void *opaque, hwaddr addr,uint64_tdata,
Quoted 1 line
unsigned int
size) {
Quoted 10 lines
AspeedSoCState *s = ASPEED_SOC(opaque); ram_addr_t ram_size; MemTxResult result; uint32_t read_back[4] = {0}; ram_size = object_property_get_uint(OBJECT(&s->sdmc), "ram-size", &error_abort); assert(ram_size > 0); printf("jamin size %d\n", size); printf("addr=%" PRIx64 " (addr ram_size)=%" PRIx64 "\n", addr, (addr%
ram_size));Quoted 7 lines
/*
* Emulate ddr capacity hardware behavior.
* If writes the data to the address which is beyond the ram size,
* it would write the data to the "address %ram_size". */
result = address_space_write(&s->dram_as, addr %ram_size,
MEMTXATTRS_UNSPECIFIED,&data, size);
Quoted 3 lines
if (result != MEMTX_OK) { qemu_log_mask(LOG_GUEST_ERROR, "%s: DRAM write failed, addr:0x%"
HWADDR_PRIxQuoted 30 lines
", data :0x%" PRIx64 "\n", __func__, addr % ram_size, data); } address_space_read(&s->dram_as, addr % ram_size, MEMTXATTRS_UNSPECIFIED, read_back, size); for(int i=0; i<4; i++) { printf("jamin read_back[%d]=%x\n", i, read_back[i]); } }````
Also, could you please provide me with the following log?U-Boot 2023.10-v00.05.06 (Mar 26 2025 - 05:59:26 +0000)
SOC: AST2700-A0
Model: AST2700 EVB
DRAM: jamin size 4
addr=c0000000 (addr ram_size)=0
jamin read_back[0]=eadbeef4
jamin read_back[1]=0
jamin read_back[2]=0
jamin read_back[3]=0
jamin size 4
addr=40000000 (addr ram_size)=0
jamin read_back[0]=adbeef43
jamin read_back[1]=0
jamin read_back[2]=0Quoted 8 lines
jamin read_back[3]=0
jamin size 4
addr=0 (addr ram_size)=0
jamin read_back[0]=dbeef432
jamin read_back[1]=0
jamin read_back[2]=0
jamin read_back[3]=0
1 GiBQuoted 8 lines
U-Boot 2023.10-v00.05.06 (Mar 26 2025 - 05:59:26 +0000)
SOC: AST2700-A0
Model: AST2700 EVB
DRAM:aspeed_sdmc_readreg @0x4 data:0x28aspeed_sdmc_readreg @0x4 data:0x28aspeed_sdmc_writereg @0x4 data:0x34jamin size 4 addr=c0000000 (addr ram_size)=0
jamin read_back[0]=0 <-- this is wrong
Quoted 6 lines
It seems that the "data" is in the CPU 's native endianness.
I'm currently looking for a big-endian environment to test the changes I made, and will update you once I have results.
uint32_tval = cpu_to_le32((uint32_t)data);
address_space_write(&s->dram_as, addr %ram_size,MEMTXATTRS_UNSPECIFIED, &val, 4);
FYI, I opened
https://gitlab.com/qemu-project/qemu/-/issues/2973
Thanks,
C.
Quoted 66 lines
Quoted 65 lines
jamin read_back[1]=0
jamin read_back[2]=0
jamin read_back[3]=0aspeed_sdmc_readreg @0x4 data:0x3caspeed_sdmc_writereg @0x4 data:0x34aspeed_sdmc_readreg @0xc data:0x0aspeed_sdmc_writereg @0xc data:0x1b8aspeed_sdmc_readreg @0x40 data:0x0
jamin size 4
addr=1bdea1f70 (addr ram_size)=3dea1f70
jamin read_back[0]=0
jamin read_back[1]=0
jamin read_back[2]=0
jamin read_back[3]=0
jamin size 4
addr=1bdea1f74 (addr ram_size)=3dea1f74
jamin read_back[0]=0
jamin read_back[1]=0
jamin read_back[2]=0
jamin read_back[3]=0
jamin size 4Quoted 2 lines
It's quite strange, because you mentioned that the A1 version works, but the
A0 version doesn't.
Quoted 2 lines
It seems detect the DRAM size failed in this loop,
https://github.com/AspeedTech-BMC/u-boot/blob/aspeed-master-v2023.10/d
Quoted 16 lines
rivers/ram/aspeed/sdram_ast2700.c#L1173
struct ddr_capacity ram_size[] = { {0x10000000, {208, 256}}, // 256MB {0x20000000, {208, 416}}, // 512MB {0x40000000, {208, 560}}, // 1GB {0x80000000, {472, 880}}, // 2GB {0x100000000, {656, 880}}, // 4GB {0x200000000, {880, 880}}, // 8GB };u32
test_pattern=0xdeadbeeffor (sz = SDRAM_SIZE_8GB - 1; sz > SDRAM_SIZE_256MB; sz--) { test_pattern = (test_pattern << 4) + sz; writel(test_pattern, (void *)CFG_SYS_SDRAM_BASE +ram_size[sz].size);
Quoted 7 lines
if (readl((void *)CFG_SYS_SDRAM_BASE) != test_pattern) break; }Please help to dump this register.
=> md12c0001012c00010: 00000028 00000000 00000000 00000000 (...............I can't do that because the u-boot prompt is never reached. From QEMU:
(qemu) x/10x
0x12c000100000000012c00010:0x0000003c0x000000000x000000000x000000000000000012c00020:0x000000000x000000000x000000000x000000000000000012c00030:0x000001b80x00000000Hope it helps
C.
[PULL 26/46] hw/arm/aspeed_ast27x0: Sort the IRQ table by IRQ number
In reply to Cédric Le GoaterFrom: Jamin Lin <[email protected]>
To improve readability, sort the IRQ table by IRQ number.
--- hw/arm/aspeed_ast27x0.c | 50 ++++++++++++++++++++--------------------- 1 file changed, 25 insertions(+), 25 deletions(-)
hw/arm/aspeed_ast27x0.c +25 -25
@@ -74,27 +74,13 @@ static const hwaddr aspeed_soc_ast2700_memmap[] = {/* Shared Peripheral Interrupt values below are offset by -32 from datasheet */ static const int aspeed_soc_ast2700a0_irqmap[] = { - [ASPEED_DEV_UART0 ] =132 , - [ASPEED_DEV_UART1 ] =132 , - [ASPEED_DEV_UART2 ] =132 , - [ASPEED_DEV_UART3 ] =132 , - [ASPEED_DEV_UART4 ] =8 , - [ASPEED_DEV_UART5 ] =132 , - [ASPEED_DEV_UART6 ] =132 , - [ASPEED_DEV_UART7 ] =132 , - [ASPEED_DEV_UART8 ] =132 , - [ASPEED_DEV_UART9 ] =132 , - [ASPEED_DEV_UART10 ] =132 , - [ASPEED_DEV_UART11 ] =132 , - [ASPEED_DEV_UART12 ] =132 , - [ASPEED_DEV_FMC ] =131 , [ASPEED_DEV_SDMC ] =0 , - [ASPEED_DEV_SCU ] =12 , - [ASPEED_DEV_ADC ] =130 , + [ASPEED_DEV_HACE ] =4 , [ASPEED_DEV_XDMA ] =5 , - [ASPEED_DEV_EMMC ] =15 , - [ASPEED_DEV_GPIO ] =130 , + [ASPEED_DEV_UART4 ] =8 , + [ASPEED_DEV_SCU ] =12 , [ASPEED_DEV_RTC ] =13 , + [ASPEED_DEV_EMMC ] =15 , [ASPEED_DEV_TIMER1 ] =16 , [ASPEED_DEV_TIMER2 ] =17 , [ASPEED_DEV_TIMER3 ] =18 ,
@@ -103,19 +89,33 @@ static const int aspeed_soc_ast2700a0_irqmap[] = { [ASPEED_DEV_TIMER6] = 21, [ASPEED_DEV_TIMER7] = 22, [ASPEED_DEV_TIMER8] = 23, - [ASPEED_DEV_WDT] = 131, - [ASPEED_DEV_PWM] = 131, + [ASPEED_DEV_DP] = 28, [ASPEED_DEV_LPC] = 128, [ASPEED_DEV_IBT] = 128, + [ASPEED_DEV_KCS] = 128, + [ASPEED_DEV_ADC] = 130, + [ASPEED_DEV_GPIO] = 130, [ASPEED_DEV_I2C] = 130, - [ASPEED_DEV_PECI] = 133, + [ASPEED_DEV_FMC] = 131, + [ASPEED_DEV_WDT] = 131, + [ASPEED_DEV_PWM] = 131, + [ASPEED_DEV_I3C] = 131, + [ASPEED_DEV_UART0] = 132, + [ASPEED_DEV_UART1] = 132, + [ASPEED_DEV_UART2] = 132, + [ASPEED_DEV_UART3] = 132, + [ASPEED_DEV_UART5] = 132, + [ASPEED_DEV_UART6] = 132, + [ASPEED_DEV_UART7] = 132, + [ASPEED_DEV_UART8] = 132, + [ASPEED_DEV_UART9] = 132, + [ASPEED_DEV_UART10] = 132, + [ASPEED_DEV_UART11] = 132, + [ASPEED_DEV_UART12] = 132, [ASPEED_DEV_ETH1] = 132, [ASPEED_DEV_ETH2] = 132, [ASPEED_DEV_ETH3] = 132, - [ASPEED_DEV_HACE] = 4, - [ASPEED_DEV_KCS] = 128, - [ASPEED_DEV_DP] = 28, - [ASPEED_DEV_I3C] = 131, + [ASPEED_DEV_PECI] = 133, [ASPEED_DEV_SDHCI] = 133, };
Signature · 1 line
2.48.1
[PULL 39/46] hw/arm/aspeed_ast27x0: Add SoC Support for AST2700 A1
In reply to Cédric Le GoaterFrom: Jamin Lin <[email protected]>
The memory map for AST2700 A1 remains compatible with AST2700 A0. However, the IRQ mapping has been updated for AST2700 A1, with GIC interrupts now ranging from 192 to 201. Add a new IRQ map table for AST2700 A1.
Add "aspeed_soc_ast2700a1_class_init" to initialize the AST2700 A1 SoC.
--- hw/arm/aspeed_ast27x0.c | 79 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 79 insertions(+)
hw/arm/aspeed_ast27x0.c +79 -0
@@ -120,6 +120,52 @@ static const int aspeed_soc_ast2700a0_irqmap[] = { [ASPEED_DEV_SDHCI] = 133, }; +static const int aspeed_soc_ast2700a1_irqmap[] = { + [ASPEED_DEV_SDMC ] =0 , + [ASPEED_DEV_HACE ] =4 , + [ASPEED_DEV_XDMA ] =5 , + [ASPEED_DEV_UART4 ] =8 , + [ASPEED_DEV_SCU ] =12 , + [ASPEED_DEV_RTC ] =13 , + [ASPEED_DEV_EMMC ] =15 , + [ASPEED_DEV_TIMER1 ] =16 , + [ASPEED_DEV_TIMER2 ] =17 , + [ASPEED_DEV_TIMER3 ] =18 , + [ASPEED_DEV_TIMER4 ] =19 , + [ASPEED_DEV_TIMER5 ] =20 , + [ASPEED_DEV_TIMER6 ] =21 , + [ASPEED_DEV_TIMER7 ] =22 , + [ASPEED_DEV_TIMER8 ] =23 , + [ASPEED_DEV_DP ] =28 , + [ASPEED_DEV_LPC ] =192 , + [ASPEED_DEV_IBT ] =192 , + [ASPEED_DEV_KCS ] =192 , + [ASPEED_DEV_I2C ] =194 , + [ASPEED_DEV_ADC ] =194 , + [ASPEED_DEV_GPIO ] =194 , + [ASPEED_DEV_FMC ] =195 , + [ASPEED_DEV_WDT ] =195 , + [ASPEED_DEV_PWM ] =195 , + [ASPEED_DEV_I3C ] =195 , + [ASPEED_DEV_UART0 ] =196 , + [ASPEED_DEV_UART1 ] =196 , + [ASPEED_DEV_UART2 ] =196 , + [ASPEED_DEV_UART3 ] =196 , + [ASPEED_DEV_UART5 ] =196 , + [ASPEED_DEV_UART6 ] =196 , + [ASPEED_DEV_UART7 ] =196 , + [ASPEED_DEV_UART8 ] =196 , + [ASPEED_DEV_UART9 ] =196 , + [ASPEED_DEV_UART10 ] =196 , + [ASPEED_DEV_UART11 ] =196 , + [ASPEED_DEV_UART12 ] =196 , + [ASPEED_DEV_ETH1 ] =196 , + [ASPEED_DEV_ETH2 ] =196 , + [ASPEED_DEV_ETH3 ] =196 , + [ASPEED_DEV_PECI ] =197 , + [ASPEED_DEV_SDHCI ] =197 , +}; +/* GICINT 128 */ /* GICINT 192 */ static const int ast2700_gic128_gic192_intcmap[] = {
@@ -864,6 +910,33 @@ static void aspeed_soc_ast2700a0_class_init(ObjectClass *oc, void *data) sc->get_irq = aspeed_soc_ast2700_get_irq; } +static void aspeed_soc_ast2700a1_class_init (ObjectClass *oc,void *data) +{ +static const char *const valid_cpu_types[] = { +ARM_CPU_TYPE_NAME ("cortex-a35" ), +NULL + }; +DeviceClass *dc =DEVICE_CLASS (oc); +AspeedSoCClass *sc =ASPEED_SOC_CLASS (oc); + +/* Reason: The Aspeed SoC can only be instantiated from a board */ + dc->user_creatable = false; + dc->realize = aspeed_soc_ast2700_realize; + + sc->valid_cpu_types = valid_cpu_types; + sc->silicon_rev =AST2700_A1_SILICON_REV ; + sc->sram_size =0x20000 ; + sc->spis_num =3 ; + sc->wdts_num =8 ; + sc->macs_num =3 ; + sc->uarts_num =13 ; + sc->num_cpus =4 ; + sc->uarts_base =ASPEED_DEV_UART0 ; + sc->irqmap = aspeed_soc_ast2700a1_irqmap; + sc->memmap = aspeed_soc_ast2700_memmap; + sc->get_irq = aspeed_soc_ast2700_get_irq; +} +static const TypeInfo aspeed_soc_ast27x0_types[] = { { .name =TYPE_ASPEED27X0_SOC ,
@@ -876,6 +949,12 @@ static const TypeInfo aspeed_soc_ast27x0_types[] = { .instance_init = aspeed_soc_ast2700_init, .class_init = aspeed_soc_ast2700a0_class_init, }, + { + .name = "ast2700-a1", + .parent = TYPE_ASPEED27X0_SOC, + .instance_init = aspeed_soc_ast2700_init, + .class_init = aspeed_soc_ast2700a1_class_init, + }, };DEFINE_TYPES (aspeed_soc_ast27x0_types)
Signature · 1 line
2.48.1
[PULL 46/46] docs/specs: Add aspeed-intc
In reply to Cédric Le GoaterFrom: Jamin Lin <[email protected]>
Add AST2700 INTC design guidance and its block diagram.
--- docs/specs/aspeed-intc.rst | 136 +++++++++++++++++++++++++++++++++++++ docs/specs/index.rst | 1 + 2 files changed, 137 insertions(+) create mode 100644 docs/specs/aspeed-intc.rst
docs/specs/aspeed-intc.rst new file +136 -0
@@ -0,0 +1,136 @@ +=========================== +ASPEED Interrupt Controller +=========================== + +AST2700 +------- +There are a total of 480 interrupt sources in AST2700. Due to the limitation of +interrupt numbers of processors, the interrupts are merged every 32 sources for +interrupt numbers greater than 127. + +There are two levels of interrupt controllers, INTC (CPU Die) and INTCIO +(I/O Die). + +Interrupt Mapping +----------------- +- INTC: Handles interrupt sources 0 - 127 and integrates signals from INTCIO. +- INTCIO: Handles interrupt sources 128 - 319 independently. + +QEMU Support +------------ +Currently, only GIC 192 to 201 are supported, and their source interrupts are +from INTCIO and connected to INTC at input pin 0 and output pins 0 to 9 for +GIC 192-201. + +Design for GICINT 196 +--------------------- +The orgate has interrupt sources ranging from 0 to 31, with its output pin +connected to INTCIO "T0 GICINT_196". The output pin is then connected to INTC +"GIC_192_201" at bit 4, and its bit 4 output pin is connected to GIC 196. + +INTC GIC_192_201 Output Pin Mapping +----------------------------------- +The design of INTC GIC_192_201 have 10 output pins, mapped as following: + +==== ==== +Bit GIC +==== ==== +0 192 +1 193 +2 194 +3 195 +4 196 +5 197 +6 198 +7 199 +8 200 +9 201 +==== ==== + +AST2700 A0 +---------- +It has only one INTC controller, and currently, only GIC 128-136 is supported. +To support both AST2700 A1 and AST2700 A0, there are 10 OR gates in the INTC, +with gates 1 to 9 supporting GIC 128-136. + +Design for GICINT 132 +--------------------- +The orgate has interrupt sources ranging from 0 to 31, with its output pin +connected to INTC. The output pin is then connected to GIC 132. + +Block Diagram of GICINT 196 for AST2700 A1 and GICINT 132 for AST2700 A0 +------------------------------------------------------------------------ + +.. code-block:: + + |-------------------------------------------------------------------------------------------------------| + | AST2700 A1 Design | + | To GICINT196 | + | | + | ETH1 |-----------| |--------------------------| |--------------| | + | -------->|0 | | INTCIO | | orgates[0] | | + | ETH2 | 4| orgates[0]------>|inpin[0]-------->outpin[0]|------->| 0 | | + | -------->|1 5| orgates[1]------>|inpin[1]-------->outpin[1]|------->| 1 | | + | ETH3 | 6| orgates[2]------>|inpin[2]-------->outpin[2]|------->| 2 | | + | -------->|2 19| orgates[3]------>|inpin[3]-------->outpin[3]|------->| 3 OR[0:9] |-----| | + | UART0 | 20|-->orgates[4]------>|inpin[4]-------->outpin[4]|------->| 4 | | | + | -------->|7 21| orgates[5]------>|inpin[5]-------->outpin[5]|------->| 5 | | | + | UART1 | 22| orgates[6]------>|inpin[6]-------->outpin[6]|------->| 6 | | | + | -------->|8 23| orgates[7]------>|inpin[7]-------->outpin[7]|------->| 7 | | | + | UART2 | 24| orgates[8]------>|inpin[8]-------->outpin[8]|------->| 8 | | | + | -------->|9 25| orgates[9]------>|inpin[9]-------->outpin[9]|------->| 9 | | | + | UART3 | 26| |--------------------------| |--------------| | | + | ---------|10 27| | | + | UART5 | 28| | | + | -------->|11 29| | | + | UART6 | | | | + | -------->|12 30| |-----------------------------------------------------------------------| | + | UART7 | 31| | | + | -------->|13 | | | + | UART8 | OR[0:31] | | |------------------------------| |----------| | + | -------->|14 | | | INTC | | GIC | | + | UART9 | | | |inpin[0:0]--------->outpin[0] |---------->|192 | | + | -------->|15 | | |inpin[0:1]--------->outpin[1] |---------->|193 | | + | UART10 | | | |inpin[0:2]--------->outpin[2] |---------->|194 | | + | -------->|16 | | |inpin[0:3]--------->outpin[3] |---------->|195 | | + | UART11 | | |--------------> |inpin[0:4]--------->outpin[4] |---------->|196 | | + | -------->|17 | |inpin[0:5]--------->outpin[5] |---------->|197 | | + | UART12 | | |inpin[0:6]--------->outpin[6] |---------->|198 | | + | -------->|18 | |inpin[0:7]--------->outpin[7] |---------->|199 | | + | |-----------| |inpin[0:8]--------->outpin[8] |---------->|200 | | + | |inpin[0:9]--------->outpin[9] |---------->|201 | | + |-------------------------------------------------------------------------------------------------------| + |-------------------------------------------------------------------------------------------------------| + | ETH1 |-----------| orgates[1]------->|inpin[1]----------->outpin[10]|---------->|128 | | + | -------->|0 | orgates[2]------->|inpin[2]----------->outpin[11]|---------->|129 | | + | ETH2 | 4| orgates[3]------->|inpin[3]----------->outpin[12]|---------->|130 | | + | -------->|1 5| orgates[4]------->|inpin[4]----------->outpin[13]|---------->|131 | | + | ETH3 | 6|---->orgates[5]------->|inpin[5]----------->outpin[14]|---------->|132 | | + | -------->|2 19| orgates[6]------->|inpin[6]----------->outpin[15]|---------->|133 | | + | UART0 | 20| orgates[7]------->|inpin[7]----------->outpin[16]|---------->|134 | | + | -------->|7 21| orgates[8]------->|inpin[8]----------->outpin[17]|---------->|135 | | + | UART1 | 22| orgates[9]------->|inpin[9]----------->outpin[18]|---------->|136 | | + | -------->|8 23| |------------------------------| |----------| | + | UART2 | 24| | + | -------->|9 25| AST2700 A0 Design | + | UART3 | 26| | + | -------->|10 27| | + | UART5 | 28| | + | -------->|11 29| GICINT132 | + | UART6 | | | + | -------->|12 30| | + | UART7 | 31| | + | -------->|13 | | + | UART8 | OR[0:31] | | + | -------->|14 | | + | UART9 | | | + | -------->|15 | | + | UART10 | | | + | -------->|16 | | + | UART11 | | | + | -------->|17 | | + | UART12 | | | + | -------->|18 | | + | |-----------| | + | | + |-------------------------------------------------------------------------------------------------------|
docs/specs/index.rst +1 -0
@@ -38,3 +38,4 @@ guest hardware that is specific to QEMU. rocker riscv-iommu riscv-aia + aspeed-intc
Signature · 1 line
2.48.1
[PULL 14/46] hw/arm/aspeed Update HW Strap Default Values for AST2700
In reply to Cédric Le GoaterFrom: Jamin Lin <[email protected]>
Separate HW Strap Registers for SCU and SCUIO. AST2700_EVB_HW_STRAP1 is used for the SCU (CPU Die) hw-strap1. AST2700_EVB_HW_STRAP2 is used for the SCUIO (IO Die) hw-strap1.
Additionally, both default values are updated based on the dump from the EVB.
--- hw/arm/aspeed.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
hw/arm/aspeed.c +4 -2
@@ -181,8 +181,10 @@ struct AspeedMachineState {#ifdef TARGET_AARCH64 /* AST2700 evb hardware value */ -#define AST2700_EVB_HW_STRAP1 0x000000C0 -#define AST2700_EVB_HW_STRAP2 0x00000003 +/* SCU HW Strap1 */ +#define AST2700_EVB_HW_STRAP1 0x00000800 +/* SCUIO HW Strap1 */ +#define AST2700_EVB_HW_STRAP2 0x00000700#endif /* Rainier hardware value: (QEMU prototype) */
Signature · 1 line
2.48.1
[PULL 31/46] hw/intc/aspeed: Introduce AspeedINTCIRQ structure to save the irq index and register address
In reply to Cédric Le GoaterFrom: Jamin Lin <[email protected]>
The INTC controller supports GICINT128 to GICINT136, mapping 1:1 to input and output IRQs 0 to 8. Previously, the formula "address & 0x0f00" was used to derive the IRQ index numbers.
However, the INTC controller also supports GICINT192_201, mapping 1 input IRQ pin to 10 output IRQ pins. The pin numbers for input and output are different. It is difficult to use a formula to determine the index number of INTC model supported input and output IRQs.
To simplify and improve readability, introduces the AspeedINTCIRQ structure to save the input/output IRQ index and its enable/status register address.
Introduce the "aspeed_2700_intc_irqs" table to store IRQ information for INTC. Introduce the "aspeed_intc_get_irq" function to retrieve the input/output IRQ pin index from the provided status/enable register address.
--- include/hw/intc/aspeed_intc.h | 10 ++++ hw/intc/aspeed_intc.c | 87 +++++++++++++++++++---------------- 2 files changed, 58 insertions(+), 39 deletions(-)
include/hw/intc/aspeed_intc.h +10 -0
@@ -19,6 +19,14 @@ OBJECT_DECLARE_TYPE(AspeedINTCState, AspeedINTCClass, ASPEED_INTC)#define ASPEED_INTC_MAX_INPINS 9#define ASPEED_INTC_MAX_OUTPINS 9 +typedef struct AspeedINTCIRQ { +int inpin_idx; +int outpin_idx; +int num_outpins; +uint32_t enable_reg; +uint32_t status_reg; +}AspeedINTCIRQ ; +struct AspeedINTCState {/*< private >*/ SysBusDevice parent_obj;
@@ -46,6 +54,8 @@ struct AspeedINTCClass {uint64_t nr_regs;uint64_t reg_offset;const MemoryRegionOps *reg_ops; +const AspeedINTCIRQ *irq_table; + int irq_table_count; };#endif /* ASPEED_INTC_H */
hw/intc/aspeed_intc.c +48 -39
152 lines not on this page · raw message
Signature · 1 line
2.48.1
[PULL 04/46] tests/functional: Introduce a witherspoon machine test
In reply to Cédric Le GoaterUse do_test_arm_aspeed_openbmc() routine to run the latest OpenBMC firmware build of the witherspoon BMC.
--- tests/functional/meson.build | 2 ++ .../functional/test_arm_aspeed_witherspoon.py | 25 +++++++++++++++++++ 2 files changed, 27 insertions(+) create mode 100644 tests/functional/test_arm_aspeed_witherspoon.py
tests/functional/meson.build +2 -0
@@ -22,6 +22,7 @@ test_timeouts = { 'acpi_bits' : 420, 'arm_aspeed_palmetto' : 120, 'arm_aspeed_romulus' : 120, + 'arm_aspeed_witherspoon' : 120, 'arm_aspeed_ast2500' : 720, 'arm_aspeed_ast2600' : 1200, 'arm_aspeed_rainier' : 480,
@@ -104,6 +105,7 @@ tests_arm_system_thorough = [ 'arm_aspeed_ast1030', 'arm_aspeed_palmetto', 'arm_aspeed_romulus', + 'arm_aspeed_witherspoon', 'arm_aspeed_ast2500', 'arm_aspeed_ast2600', 'arm_aspeed_rainier',
tests/functional/test_arm_aspeed_witherspoon.py new file +25 -0
@@ -0,0 +1,25 @@ +#!/usr/bin/env python3 +# +# Functional test that boots the ASPEED machines +# +# SPDX-License-Identifier: GPL-2.0-or-later + +from qemu_test import Asset +from aspeed import AspeedTest + + +class WitherspoonMachine(AspeedTest): + + ASSET_WITHERSPOON_FLASH = Asset( + 'https://github.com/legoater/qemu-aspeed-boot/raw/master/images/witherspoon-bmc/openbmc-20240618035022/obmc-phosphor-image-witherspoon-20240618035022.ubi.mtd', + '937d9ed449ea6c6cbed983519088a42d0cafe276bcfe4fce07772ca6673f9213'); + + def test_arm_ast2500_witherspoon_openbmc(self): + image_path = self.ASSET_WITHERSPOON_FLASH.fetch() + + self.do_test_arm_aspeed_openbmc('witherspoon-bmc', image=image_path, + uboot='2016.07', cpu_id='0x0', + soc='AST2500 rev A1'); + +if __name__ == '__main__': + AspeedTest.main()
Signature · 1 line
2.48.1
[PULL 44/46] tests/functional/aspeed: Update test ASPEED SDK v09.05
In reply to Cédric Le GoaterFrom: Jamin Lin <[email protected]>
In ASPEED SDK v09.05, the naming convention for pre-built images has been updated. The pre-built image for AST2700 A0 has been renamed to ast2700-a0-default, while ast2700-default is now used for AST2700 A1.
--- tests/functional/test_aarch64_aspeed.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
tests/functional/test_aarch64_aspeed.py +6 -6
@@ -27,9 +27,9 @@ def do_test_aarch64_aspeed_sdk_start(self, image): wait_for_console_pattern(self, '## Loading kernel from FIT Image') wait_for_console_pattern(self, 'Starting kernel ...') - ASSET_SDK_V903_AST2700 = Asset( - 'https://github.com/AspeedTech-BMC/openbmc/releases/download/v09.03/ast2700-default-obmc.tar.gz', - '91225f50d255e2905ba8d8e0c80b71b9d157c3609770c7a740cd786370d85a77') + ASSET_SDK_V905_AST2700 = Asset( + 'https://github.com/AspeedTech-BMC/openbmc/releases/download/v09.05/ast2700-a0-default-obmc.tar.gz', + 'cfbbd1cce72f2a3b73b9080c41eecdadebb7077fba4f7806d72ac99f3e84b74a') def start_ast2700_test(self, name): num_cpu = 4
@@ -89,11 +89,11 @@ def start_ast2700_test(self, name): exec_command_and_wait_for_pattern(self, 'cat /sys/bus/i2c/devices/1-004d/hwmon/hwmon*/temp1_input', '18000') - def test_aarch64_ast2700_evb_sdk_v09_03(self): + def test_aarch64_ast2700_evb_sdk_v09_05(self): self.set_machine('ast2700-evb') - self.archive_extract(self.ASSET_SDK_V903_AST2700) - self.start_ast2700_test('ast2700-default') + self.archive_extract(self.ASSET_SDK_V905_AST2700) + self.start_ast2700_test('ast2700-a0-default') if __name__ == '__main__':
Signature · 1 line
2.48.1
[PULL 27/46] hw/intc/aspeed: Support different memory region ops
In reply to Cédric Le GoaterFrom: Jamin Lin <[email protected]>
The previous implementation set the "aspeed_intc_ops" struct, containing read and write callbacks, to be used when I/O is performed on the INTC region. Both "aspeed_intc_read" and "aspeed_intc_write" callback functions were used for INTC (CPU Die).
To support the INTCIO (IO Die) model, introduces a new "reg_ops" class attribute. This allows setting different memory region operations to support different INTC models.
Will introduce "aspeed_intcio_read" and "aspeed_intcio_write" callback functions are used for INTCIO.
--- include/hw/intc/aspeed_intc.h | 1 + hw/intc/aspeed_intc.c | 5 ++++- 2 files changed, 5 insertions(+), 1 deletion(-)
include/hw/intc/aspeed_intc.h +1 -0
@@ -43,6 +43,7 @@ struct AspeedINTCClass {uint64_t mem_size;uint64_t nr_regs;uint64_t reg_offset; + const MemoryRegionOps *reg_ops; };#endif /* ASPEED_INTC_H */
hw/intc/aspeed_intc.c +4 -1
@@ -332,7 +332,7 @@ static void aspeed_intc_realize(DeviceState *dev, Error **errp)sysbus_init_mmio (sbd, &s->iomem_container); s->regs =g_new (uint32_t, aic->nr_regs); -memory_region_init_io (&s->iomem,OBJECT (s), &aspeed_intc_ops, s, +memory_region_init_io (&s->iomem,OBJECT (s), aic->reg_ops, s,TYPE_ASPEED_INTC ".regs" , aic->nr_regs <<2 ); memory_region_add_subregion(&s->iomem_container, aic->reg_offset,
@@ -359,12 +359,15 @@ static void aspeed_intc_unrealize(DeviceState *dev)static void aspeed_intc_class_init (ObjectClass *klass,void *data) {DeviceClass *dc =DEVICE_CLASS (klass); +AspeedINTCClass *aic =ASPEED_INTC_CLASS (klass); dc->desc ="ASPEED INTC Controller" ; dc->realize = aspeed_intc_realize; dc->unrealize = aspeed_intc_unrealize;device_class_set_legacy_reset (dc, aspeed_intc_reset); dc->vmsd =NULL ; + + aic->reg_ops = &aspeed_intc_ops; }static const TypeInfo aspeed_intc_info = {
Signature · 1 line
2.48.1
[PULL 42/46] tests/functional/aspeed: Introduce start_ast2700_test API
In reply to Cédric Le GoaterFrom: Jamin Lin <[email protected]>
Added a new method "start_ast2700_test" to the "AST2x00MachineSDK" class and this method centralizes the logic for starting the AST2700 test, making it reusable for different test cases.
--- tests/functional/test_aarch64_aspeed.py | 29 +++++++++++++------------ 1 file changed, 15 insertions(+), 14 deletions(-)
tests/functional/test_aarch64_aspeed.py +15 -14
@@ -31,33 +31,29 @@ def do_test_aarch64_aspeed_sdk_start(self, image): 'https://github.com/AspeedTech-BMC/openbmc/releases/download/v09.03/ast2700-default-obmc.tar.gz', '91225f50d255e2905ba8d8e0c80b71b9d157c3609770c7a740cd786370d85a77') - def test_aarch64_ast2700_evb_sdk_v09_03(self): - self.set_machine('ast2700-evb') - - self.archive_extract(self.ASSET_SDK_V903_AST2700) - + def start_ast2700_test(self, name): num_cpu = 4 - uboot_size = os.path.getsize(self.scratch_file('ast2700-default', + uboot_size = os.path.getsize(self.scratch_file(name, 'u-boot-nodtb.bin')) uboot_dtb_load_addr = hex(0x400000000 + uboot_size) load_images_list = [ { 'addr': '0x400000000', - 'file': self.scratch_file('ast2700-default', + 'file': self.scratch_file(name, 'u-boot-nodtb.bin') }, { 'addr': str(uboot_dtb_load_addr), - 'file': self.scratch_file('ast2700-default', 'u-boot.dtb') + 'file': self.scratch_file(name, 'u-boot.dtb') }, { 'addr': '0x430000000', - 'file': self.scratch_file('ast2700-default', 'bl31.bin') + 'file': self.scratch_file(name, 'bl31.bin') }, { 'addr': '0x430080000', - 'file': self.scratch_file('ast2700-default', 'optee', + 'file': self.scratch_file(name, 'optee', 'tee-raw.bin') } ]
@@ -76,13 +72,12 @@ def test_aarch64_ast2700_evb_sdk_v09_03(self): self.vm.add_args('-device', 'tmp105,bus=aspeed.i2c.bus.1,address=0x4d,id=tmp-test') self.do_test_aarch64_aspeed_sdk_start( - self.scratch_file('ast2700-default', 'image-bmc')) + self.scratch_file(name, 'image-bmc')) - wait_for_console_pattern(self, 'ast2700-default login:') + wait_for_console_pattern(self, f'{name} login:') exec_command_and_wait_for_pattern(self, 'root', 'Password:') - exec_command_and_wait_for_pattern(self, - '0penBmc', 'root@ast2700-default:~#') + exec_command_and_wait_for_pattern(self, '0penBmc', f'root@{name}:~#') exec_command_and_wait_for_pattern(self, 'echo lm75 0x4d > /sys/class/i2c-dev/i2c-1/device/new_device ',
@@ -94,6 +89,12 @@ def test_aarch64_ast2700_evb_sdk_v09_03(self): exec_command_and_wait_for_pattern(self, 'cat /sys/class/hwmon/hwmon20/temp1_input', '18000') + def test_aarch64_ast2700_evb_sdk_v09_03(self): + self.set_machine('ast2700-evb') + + self.archive_extract(self.ASSET_SDK_V903_AST2700) + self.start_ast2700_test('ast2700-default') + if __name__ == '__main__': QemuSystemTest.main()
Signature · 1 line
2.48.1
[PULL 30/46] hw/intc/aspeed: Refactor INTC to support separate input and output pin indices
In reply to Cédric Le GoaterFrom: Jamin Lin <[email protected]>
Refactors the INTC to distinguish between input and output pin indices, improving interrupt handling clarity and accuracy.
Updated the functions to handle both input and output pin indices. Added detailed logging for input and output pin indices in trace events.
These changes ensure that the INTC controller can handle multiple input and output pins, improving support for the AST2700 A1.
--- hw/intc/aspeed_intc.c | 97 +++++++++++++++++++++++++++---------------- hw/intc/trace-events | 12 +++--- 2 files changed, 67 insertions(+), 42 deletions(-)
hw/intc/aspeed_intc.c +61 -36
@@ -42,20 +42,32 @@ REG32(GICINT136_STATUS, 0x804)#define GICINT_STATUS_BASE R_GICINT128_STATUS -static void aspeed_intc_update (AspeedINTCState *s,int irq,int level) +/* +* Update the state of an interrupt controller pin by setting +* the specified output pin to the given level. +* The input pin index should be between 0 and the number of input pins. +* The output pin index should be between 0 and the number of output pins. +*/ +static void aspeed_intc_update (AspeedINTCState *s,int inpin_idx, +int outpin_idx,int level) {AspeedINTCClass *aic =ASPEED_INTC_GET_CLASS (s);const char *name =object_get_typename (OBJECT (s)); -if (irq >= aic->num_inpins) { -qemu_log_mask (LOG_GUEST_ERROR , -"%s: Invalid input pin index: %d\n" , - __func__, irq); +if (inpin_idx >= aic->num_inpins) { +qemu_log_mask (LOG_GUEST_ERROR ,"%s: Invalid input pin index: %d\n" , + __func__, inpin_idx);return ; } -trace_aspeed_intc_update_irq (name, irq, level); -qemu_set_irq (s->output_pins[irq], level); +if (outpin_idx >= aic->num_outpins) { +qemu_log_mask (LOG_GUEST_ERROR ,"%s: Invalid output pin index: %d\n" , + __func__, outpin_idx); +return ; + } + +trace_aspeed_intc_update_irq (name, inpin_idx, outpin_idx, level); +qemu_set_irq (s->output_pins[outpin_idx], level); }/*
@@ -72,23 +84,28 @@ static void aspeed_intc_set_irq(void *opaque, int irq, int level)uint32_t status_reg =GICINT_STATUS_BASE + ((0x100 * irq) >>2 );uint32_t select =0 ;uint32_t enable; +int outpin_idx; +int inpin_idx;int i; + outpin_idx = irq; + inpin_idx = irq; +if (irq >= aic->num_inpins) {qemu_log_mask (LOG_GUEST_ERROR ,"%s: Invalid input pin index: %d\n" , __func__, irq);return ; } -trace_aspeed_intc_set_irq (name, irq, level); - enable = s->enable[irq]; +trace_aspeed_intc_set_irq (name, inpin_idx, level); + enable = s->enable[inpin_idx];if (!level) {return ; }for (i =0 ; i < aic->num_lines; i++) { -if (s->orgates[irq].levels[i]) { +if (s->orgates[inpin_idx].levels[i]) {if (enable &BIT (i)) { select |=BIT (i); }
@@ -101,7 +118,7 @@ static void aspeed_intc_set_irq(void *opaque, int irq, int level)trace_aspeed_intc_select (name, select); -if (s->mask[irq] || s->regs[status_reg]) { +if (s->mask[inpin_idx] || s->regs[status_reg]) {/* * a. mask is not 0 means in ISR mode * sources interrupt routine are executing.
@@ -110,16 +127,17 @@ static void aspeed_intc_set_irq(void *opaque, int irq, int level)* * save source interrupt to pending variable. */ - s->pending[irq] |= select; -trace_aspeed_intc_pending_irq (name, irq, s->pending[irq]); + s->pending[inpin_idx] |= select; +trace_aspeed_intc_pending_irq (name, inpin_idx, s->pending[inpin_idx]); }else {/* * notify firmware which source interrupt are coming * by setting status register */ s->regs[status_reg] = select; -trace_aspeed_intc_trigger_irq (name, irq, s->regs[status_reg]); -aspeed_intc_update (s, irq,1 ); +trace_aspeed_intc_trigger_irq (name, inpin_idx, outpin_idx, + s->regs[status_reg]); +aspeed_intc_update (s, inpin_idx, outpin_idx,1 ); } }
@@ -131,14 +149,16 @@ static void aspeed_intc_enable_handler(AspeedINTCState *s, hwaddr offset,uint32_t reg = offset >>2 ;uint32_t old_enable;uint32_t change; +int inpin_idx;uint32_t irq; irq = (offset &0x0f00 ) >>8 ; + inpin_idx = irq; -if (irq >= aic->num_inpins) { +if (inpin_idx >= aic->num_inpins) {qemu_log_mask (LOG_GUEST_ERROR ,"%s: Invalid input pin index: %d\n" , - __func__, irq); + __func__, inpin_idx);return ; }
@@ -149,17 +169,17 @@ static void aspeed_intc_enable_handler(AspeedINTCState *s, hwaddr offset,*/ /* disable all source interrupt */ -if (!data && !s->enable[irq]) { +if (!data && !s->enable[inpin_idx]) { s->regs[reg] = data;return ; } - old_enable = s->enable[irq]; - s->enable[irq] |= data; + old_enable = s->enable[inpin_idx]; + s->enable[inpin_idx] |= data;/* enable new source interrupt */ -if (old_enable != s->enable[irq]) { -trace_aspeed_intc_enable (name, s->enable[irq]); +if (old_enable != s->enable[inpin_idx]) { +trace_aspeed_intc_enable (name, s->enable[inpin_idx]); s->regs[reg] = data;return ; }
@@ -167,11 +187,11 @@ static void aspeed_intc_enable_handler(AspeedINTCState *s, hwaddr offset,/* mask and unmask source interrupt */ change = s->regs[reg] ^ data;if (change & data) { - s->mask[irq] &= ~change; -trace_aspeed_intc_unmask (name, change, s->mask[irq]); + s->mask[inpin_idx] &= ~change; +trace_aspeed_intc_unmask (name, change, s->mask[inpin_idx]); }else { - s->mask[irq] |= change; -trace_aspeed_intc_mask (name, change, s->mask[irq]); + s->mask[inpin_idx] |= change; +trace_aspeed_intc_mask (name, change, s->mask[inpin_idx]); } s->regs[reg] = data;
@@ -183,6 +203,8 @@ static void aspeed_intc_status_handler(AspeedINTCState *s, hwaddr offset,AspeedINTCClass *aic =ASPEED_INTC_GET_CLASS (s);const char *name =object_get_typename (OBJECT (s));uint32_t reg = offset >>2 ; +int outpin_idx; +int inpin_idx;uint32_t irq;if (!data) {
@@ -191,11 +213,13 @@ static void aspeed_intc_status_handler(AspeedINTCState *s, hwaddr offset, } irq = (offset &0x0f00 ) >>8 ; + outpin_idx = irq; + inpin_idx = irq; -if (irq >= aic->num_inpins) { +if (inpin_idx >= aic->num_inpins) {qemu_log_mask (LOG_GUEST_ERROR ,"%s: Invalid input pin index: %d\n" , - __func__, irq); + __func__, inpin_idx);return ; }
@@ -214,21 +238,22 @@ static void aspeed_intc_status_handler(AspeedINTCState *s, hwaddr offset,/* All source ISR execution are done */ if (!s->regs[reg]) { -trace_aspeed_intc_all_isr_done (name, irq); -if (s->pending[irq]) { +trace_aspeed_intc_all_isr_done (name, inpin_idx); +if (s->pending[inpin_idx]) {/* * handle pending source interrupt * notify firmware which source interrupt are pending * by setting status register */ - s->regs[reg] = s->pending[irq]; - s->pending[irq] =0 ; -trace_aspeed_intc_trigger_irq (name, irq, s->regs[reg]); -aspeed_intc_update (s, irq,1 ); + s->regs[reg] = s->pending[inpin_idx]; + s->pending[inpin_idx] =0 ; +trace_aspeed_intc_trigger_irq (name, inpin_idx, outpin_idx, + s->regs[reg]); +aspeed_intc_update (s, inpin_idx, outpin_idx,1 ); }else {/* clear irq */ -trace_aspeed_intc_clear_irq (name, irq,0 ); -aspeed_intc_update (s, irq,0 ); +trace_aspeed_intc_clear_irq (name, inpin_idx, outpin_idx,0 ); +aspeed_intc_update (s, inpin_idx, outpin_idx,0 ); } } }
hw/intc/trace-events +6 -6
@@ -82,12 +82,12 @@ aspeed_vic_write(uint64_t offset, unsigned size, uint32_t data) "To 0x%" PRIx64 # aspeed_intc.c aspeed_intc_read(const char *s, uint64_t offset, unsigned size, uint32_t value) "%s: From 0x%" PRIx64 " of size %u: 0x%" PRIx32 aspeed_intc_write(const char *s, uint64_t offset, unsigned size, uint32_t data) "%s: To 0x%" PRIx64 " of size %u: 0x%" PRIx32 -aspeed_intc_set_irq(const char *s, int irq, int level) "%s: Set IRQ %d: %d" -aspeed_intc_clear_irq(const char *s, int irq, int level) "%s: Clear IRQ %d: %d" -aspeed_intc_update_irq(const char *s, int irq, int level) "%s: Update IRQ: %d: %d" -aspeed_intc_pending_irq(const char *s, int irq, uint32_t value) "%s: Pending IRQ: %d: 0x%x" -aspeed_intc_trigger_irq(const char *s, int irq, uint32_t value) "%s: Trigger IRQ: %d: 0x%x" -aspeed_intc_all_isr_done(const char *s, int irq) "%s: All source ISR execution are done: %d" +aspeed_intc_set_irq(const char *s, int inpin_idx, int level) "%s: Set IRQ %d: %d" +aspeed_intc_clear_irq(const char *s, int inpin_idx, int outpin_idx, int level) "%s: Clear IRQ %d-%d: %d" +aspeed_intc_update_irq(const char *s, int inpin_idx, int outpin_idx, int level) "%s: Update IRQ: %d-%d: %d" +aspeed_intc_pending_irq(const char *s, int inpin_idx, uint32_t value) "%s: Pending IRQ: %d: 0x%x" +aspeed_intc_trigger_irq(const char *s, int inpin_idx, int outpin_idx, uint32_t value) "%s: Trigger IRQ: %d-%d: 0x%x" +aspeed_intc_all_isr_done(const char *s, int inpin_idx) "%s: All source ISR execution are done: %d" aspeed_intc_enable(const char *s, uint32_t value) "%s: Enable: 0x%x" aspeed_intc_select(const char *s, uint32_t value) "%s: Select: 0x%x" aspeed_intc_mask(const char *s, uint32_t change, uint32_t value) "%s: Mask: 0x%x: 0x%x"
Signature · 1 line
2.48.1
[PULL 38/46] hw/arm/aspeed_ast27x0: Support two levels of INTC controllers for AST2700 A1
In reply to Cédric Le GoaterFrom: Jamin Lin <[email protected]>
The design of INTC controllers has significantly changed in AST2700 A1.
There are a total of 480 interrupt sources in AST2700 A1. For interrupt numbers from 0 to 127, they can route directly to PSP, SSP, and TSP. Due to the limitation of interrupt numbers of processors, the interrupts are merged every 32 sources for interrupt numbers greater than 127.
There are two levels of interrupt controllers, INTC(CPUD Die) and INTCIO (IO Die). The interrupt sources of INTC are the interrupt numbers from INTC_0 to INTC_127 and interrupts from INTCIO. The interrupt sources of INTCIO are the interrupt numbers greater than INTC_127. INTC_IO controls the interrupts INTC_128 to INTC_319 only.
Currently, only GIC 192 to 201 are supported, and their source interrupts are from INTCIO and connected to INTC at input pin 0 and output pins 0 to 9 for GIC 192-201.
The design of the orgates for GICINT 196 is as follows:
It has interrupt sources ranging from 0 to 31, with its output pin connected to INTCIO "T0 GICINT_196". The output pin is then connected to INTC "GIC_192_201" at bit 4, and its bit 4 output should be connected to GIC 196.
The design of INTC GIC_192_201 have 10 output pins, mapped as following:
Bit 0 -> GIC 192
Bit 1 -> GIC 193
Bit 2 -> GIC 194
Bit 3 -> GIC 195
Bit 4 -> GIC 196
To support both AST2700 A1 and A0, INTC input pins 1 to 9 and output pins 10 to 18 remain to support GIC 128-136, which source interrupts from INTC. These will be removed if we decide not to support AST2700 A0 in the future.
|-------------------------------------------------------------------------------------------------------| | AST2700 A1 Design | | To GICINT196 | | | | ETH1 |-----------| |--------------------------| |--------------| | | -------->|0 | | INTCIO | | orgates[0] | | | ETH2 | 4| orgates[0]------>|inpin[0]-------->outpin[0]|------->| 0 | | | -------->|1 5| orgates[1]------>|inpin[1]-------->outpin[1]|------->| 1 | | | ETH3 | 6| orgates[2]------>|inpin[2]-------->outpin[2]|------->| 2 | | | -------->|2 19| orgates[3]------>|inpin[3]-------->outpin[3]|------->| 3 OR[0:9] |-----| | | UART0 | 20|-->orgates[4]------>|inpin[4]-------->outpin[4]|------->| 4 | | | | -------->|7 21| orgates[5]------>|inpin[5]-------->outpin[5]|------->| 5 | | | | UART1 | 22| orgates[6]------>|inpin[6]-------->outpin[6]|------->| 6 | | | | -------->|8 23| orgates[7]------>|inpin[7]-------->outpin[7]|------->| 7 | | | | UART2 | 24| orgates[8]------>|inpin[8]-------->outpin[8]|------->| 8 | | | | -------->|9 25| orgates[9]------>|inpin[9]-------->outpin[9]|------->| 9 | | | | UART3 | 26| |--------------------------| |--------------| | | | ---------|10 27| | | | UART5 | 28| | | | -------->|11 29| | | | UART6 | | | | | -------->|12 30| |-----------------------------------------------------------------------| | | UART7 | 31| | | | -------->|13 | | | | UART8 | OR[0:31] | | |------------------------------| |----------| | | -------->|14 | | | INTC | | GIC | | | UART9 | | | |inpin[0:0]--------->outpin[0] |---------->|192 | | | -------->|15 | | |inpin[0:1]--------->outpin[1] |---------->|193 | | | UART10 | | | |inpin[0:2]--------->outpin[2] |---------->|194 | | | -------->|16 | | |inpin[0:3]--------->outpin[3] |---------->|195 | | | UART11 | | |--------------> |inpin[0:4]--------->outpin[4] |---------->|196 | | | -------->|17 | |inpin[0:5]--------->outpin[5] |---------->|197 | | | UART12 | | |inpin[0:6]--------->outpin[6] |---------->|198 | | | -------->|18 | |inpin[0:7]--------->outpin[7] |---------->|199 | | | |-----------| |inpin[0:8]--------->outpin[8] |---------->|200 | | | |inpin[0:9]--------->outpin[9] |---------->|201 | | |-------------------------------------------------------------------------------------------------------| |-------------------------------------------------------------------------------------------------------| | ETH1 |-----------| orgates[1]------->|inpin[1]----------->outpin[10]|---------->|128 | | | -------->|0 | orgates[2]------->|inpin[2]----------->outpin[11]|---------->|129 | | | ETH2 | 4| orgates[3]------->|inpin[3]----------->outpin[12]|---------->|130 | | | -------->|1 5| orgates[4]------->|inpin[4]----------->outpin[13]|---------->|131 | | | ETH3 | 6|---->orgates[5]------->|inpin[5]----------->outpin[14]|---------->|132 | | | -------->|2 19| orgates[6]------->|inpin[6]----------->outpin[15]|---------->|133 | | | UART0 | 20| orgates[7]------->|inpin[7]----------->outpin[16]|---------->|134 | | | -------->|7 21| orgates[8]------->|inpin[8]----------->outpin[17]|---------->|135 | | | UART1 | 22| orgates[9]------->|inpin[9]----------->outpin[18]|---------->|136 | | | -------->|8 23| |------------------------------| |----------| | | UART2 | 24| | | -------->|9 25| AST2700 A0 Design | | UART3 | 26| | | -------->|10 27| | | UART5 | 28| | | -------->|11 29| GICINT132 | | UART6 | | | | -------->|12 30| | | UART7 | 31| | | -------->|13 | | | UART8 | OR[0:31] | | | -------->|14 | | | UART9 | | | | -------->|15 | | | UART10 | | | | -------->|16 | | | UART11 | | | | -------->|17 | | | UART12 | | | | -------->|18 | | | |-----------| | | | |-------------------------------------------------------------------------------------------------------|
--- include/hw/arm/aspeed_soc.h | 1 + hw/arm/aspeed_ast27x0.c | 24 ++++++++++++++++++++++++ 2 files changed, 25 insertions(+)
include/hw/arm/aspeed_soc.h +1 -0
@@ -194,6 +194,7 @@ enum {ASPEED_DEV_EHCI2 ,ASPEED_DEV_VIC ,ASPEED_DEV_INTC , +ASPEED_DEV_INTCIO ,ASPEED_DEV_SDMC ,ASPEED_DEV_SCU , ASPEED_DEV_ADC,
hw/arm/aspeed_ast27x0.c +24 -0
@@ -57,6 +57,7 @@ static const hwaddr aspeed_soc_ast2700_memmap[] = { [ASPEED_DEV_ETH3] = 0x14070000, [ASPEED_DEV_EMMC] = 0x12090000, [ASPEED_DEV_INTC] = 0x12100000, + [ASPEED_DEV_INTCIO] = 0x14C18000, [ASPEED_DEV_SLI] = 0x12C17000, [ASPEED_DEV_SLIIO] = 0x14C1E000, [ASPEED_GIC_DIST] = 0x12200000,
@@ -411,6 +412,8 @@ static void aspeed_soc_ast2700_init(Object *obj)object_initialize_child (obj,"sli" , &s->sli,TYPE_ASPEED_2700_SLI );object_initialize_child (obj,"sliio" , &s->sliio,TYPE_ASPEED_2700_SLIIO );object_initialize_child (obj,"intc" , &a->intc[0 ],TYPE_ASPEED_2700_INTC ); +object_initialize_child (obj,"intcio" , &a->intc[1 ], +TYPE_ASPEED_2700_INTCIO );snprintf (typename,sizeof (typename),"aspeed.adc-%s" , socname);object_initialize_child (obj,"adc" , &s->adc, typename);
@@ -527,6 +530,7 @@ static void aspeed_soc_ast2700_realize(DeviceState *dev, Error **errp)AspeedSoCState *s =ASPEED_SOC (dev);AspeedSoCClass *sc =ASPEED_SOC_GET_CLASS (s);AspeedINTCClass *ic =ASPEED_INTC_GET_CLASS (&a->intc[0 ]); +AspeedINTCClass *icio =ASPEED_INTC_GET_CLASS (&a->intc[1 ]); g_autofree char *sram_name = NULL;qemu_irq irq;
@@ -564,6 +568,14 @@ static void aspeed_soc_ast2700_realize(DeviceState *dev, Error **errp)aspeed_mmio_map (s,SYS_BUS_DEVICE (&a->intc[0 ]),0 , sc->memmap[ASPEED_DEV_INTC ]); +/* INTCIO */ +if (!sysbus_realize (SYS_BUS_DEVICE (&a->intc[1 ]), errp)) { +return ; + } + +aspeed_mmio_map (s,SYS_BUS_DEVICE (&a->intc[1 ]),0 , + sc->memmap[ASPEED_DEV_INTCIO ]); +/* irq sources -> orgates -> INTC */ for (i =0 ; i < ic->num_inpins; i++) { qdev_connect_gpio_out(DEVICE(&a->intc[0].orgates[i]), 0,
@@ -578,6 +590,18 @@ static void aspeed_soc_ast2700_realize(DeviceState *dev, Error **errp) ast2700_gic_intcmap[i].irq)); } +/* irq source -> orgates -> INTCIO */ +for (i =0 ; i < icio->num_inpins; i++) { +qdev_connect_gpio_out (DEVICE (&a->intc[1 ].orgates[i]),0 , +qdev_get_gpio_in (DEVICE (&a->intc[1 ]), i)); + } + +/* INTCIO -> INTC */ +for (i =0 ; i < icio->num_outpins; i++) { +sysbus_connect_irq (SYS_BUS_DEVICE (&a->intc[1 ]), i, +qdev_get_gpio_in (DEVICE (&a->intc[0 ].orgates[0 ]), i)); + } +/* SRAM */ sram_name =g_strdup_printf ("aspeed.sram.%d" ,CPU (&a->cpu[0 ])->cpu_index); if (!memory_region_init_ram(&s->sram, OBJECT(s), sram_name, sc->sram_size,
Signature · 1 line
2.48.1
[PULL 07/46] aspeed: Remove duplicate typename in AspeedSoCClass
In reply to Cédric Le GoaterThe SoC type name is stored under AspeedSoCClass which is redundant. Use object_get_typename() instead where needed.
--- include/hw/arm/aspeed_soc.h | 1 - hw/arm/aspeed_ast10x0.c | 3 +-- hw/arm/aspeed_ast2400.c | 4 +--- hw/arm/aspeed_ast2600.c | 3 +-- hw/arm/aspeed_ast27x0.c | 3 +-- 5 files changed, 4 insertions(+), 10 deletions(-)
include/hw/arm/aspeed_soc.h +0 -1
@@ -148,7 +148,6 @@ OBJECT_DECLARE_SIMPLE_TYPE(Aspeed10x0SoCState, ASPEED10X0_SOC)struct AspeedSoCClass {DeviceClass parent_class; -const char *name;/** valid_cpu_types: NULL terminated array of a single CPU type. */ const char *const *valid_cpu_types;uint32_t silicon_rev;
hw/arm/aspeed_ast10x0.c +1 -2
@@ -116,7 +116,7 @@ static void aspeed_soc_ast1030_init(Object *obj)char typename[64 ];int i; -if (sscanf (sc->name,"%7s" , socname) !=1 ) { +if (sscanf (object_get_typename (obj),"%7s" , socname) !=1 ) {g_assert_not_reached (); }
@@ -428,7 +428,6 @@ static void aspeed_soc_ast1030_class_init(ObjectClass *klass, void *data) dc->user_creatable = false; dc->realize = aspeed_soc_ast1030_realize; - sc->name ="ast1030-a1" ; sc->valid_cpu_types = valid_cpu_types; sc->silicon_rev =AST1030_A1_SILICON_REV ; sc->sram_size =0xc0000 ;
hw/arm/aspeed_ast2400.c +1 -3
@@ -151,7 +151,7 @@ static void aspeed_ast2400_soc_init(Object *obj)char socname[8 ];char typename[64 ]; -if (sscanf (sc->name,"%7s" , socname) !=1 ) { +if (sscanf (object_get_typename (obj),"%7s" , socname) !=1 ) {g_assert_not_reached (); }
@@ -515,7 +515,6 @@ static void aspeed_soc_ast2400_class_init(ObjectClass *oc, void *data)/* Reason: Uses serial_hds and nd_table in realize() directly */ dc->user_creatable = false; - sc->name ="ast2400-a1" ; sc->valid_cpu_types = valid_cpu_types; sc->silicon_rev =AST2400_A1_SILICON_REV ; sc->sram_size =0x8000 ;
@@ -544,7 +543,6 @@ static void aspeed_soc_ast2500_class_init(ObjectClass *oc, void *data)/* Reason: Uses serial_hds and nd_table in realize() directly */ dc->user_creatable = false; - sc->name ="ast2500-a1" ; sc->valid_cpu_types = valid_cpu_types; sc->silicon_rev =AST2500_A1_SILICON_REV ; sc->sram_size =0x9000 ;
hw/arm/aspeed_ast2600.c +1 -2
@@ -157,7 +157,7 @@ static void aspeed_soc_ast2600_init(Object *obj)char socname[8 ];char typename[64 ]; -if (sscanf (sc->name,"%7s" , socname) !=1 ) { +if (sscanf (object_get_typename (obj),"%7s" , socname) !=1 ) {g_assert_not_reached (); }
@@ -666,7 +666,6 @@ static void aspeed_soc_ast2600_class_init(ObjectClass *oc, void *data)/* Reason: The Aspeed SoC can only be instantiated from a board */ dc->user_creatable = false; - sc->name ="ast2600-a3" ; sc->valid_cpu_types = valid_cpu_types; sc->silicon_rev =AST2600_A3_SILICON_REV ; sc->sram_size =0x16400 ;
hw/arm/aspeed_ast27x0.c +1 -2
@@ -316,7 +316,7 @@ static void aspeed_soc_ast2700_init(Object *obj)char socname[8 ];char typename[64 ]; -if (sscanf (sc->name,"%7s" , socname) !=1 ) { +if (sscanf (object_get_typename (obj),"%7s" , socname) !=1 ) {g_assert_not_reached (); }
@@ -757,7 +757,6 @@ static void aspeed_soc_ast2700_class_init(ObjectClass *oc, void *data) dc->user_creatable = false; dc->realize = aspeed_soc_ast2700_realize; - sc->name ="ast2700-a0" ; sc->valid_cpu_types = valid_cpu_types; sc->silicon_rev =AST2700_A0_SILICON_REV ; sc->sram_size =0x20000 ;
Signature · 1 line
2.48.1
[PULL 36/46] hw/arm/aspeed_ast27x0.c Support AST2700 A1 GIC Interrupt Mapping
In reply to Cédric Le GoaterFrom: Jamin Lin <[email protected]>
Currently, these IRQ tables support from GIC 128 - 136 for AST2700 A0. These IRQ tables can be reused for AST2700 A1 from GIC 192 - 197. Updates the interrupt mapping to include support for AST2700 A1 by extending the existing mappings to the new GIC range.
--- hw/arm/aspeed_ast27x0.c | 77 ++++++++++++++++++++++++++--------------- 1 file changed, 50 insertions(+), 27 deletions(-)
hw/arm/aspeed_ast27x0.c +50 -27
@@ -120,21 +120,27 @@ static const int aspeed_soc_ast2700a0_irqmap[] = { };/* GICINT 128 */ -static const int aspeed_soc_ast2700_gic128_intcmap[] = { +/* GICINT 192 */ +static const int ast2700_gic128_gic192_intcmap[] = { [ASPEED_DEV_LPC ] =0 , [ASPEED_DEV_IBT ] =2 , [ASPEED_DEV_KCS ] =4 , }; +/* GICINT 129 */ +/* GICINT 193 */ +/* GICINT 130 */ -static const int aspeed_soc_ast2700_gic130_intcmap[] = { +/* GICINT 194 */ +static const int ast2700_gic130_gic194_intcmap[] = { [ASPEED_DEV_I2C ] =0 , [ASPEED_DEV_ADC ] =16 , [ASPEED_DEV_GPIO ] =18 , };/* GICINT 131 */ -static const int aspeed_soc_ast2700_gic131_intcmap[] = { +/* GICINT 195 */ +static const int ast2700_gic131_gic195_intcmap[] = { [ASPEED_DEV_I3C ] =0 , [ASPEED_DEV_WDT ] =16 , [ASPEED_DEV_FMC ] =25 ,
@@ -142,7 +148,8 @@ static const int aspeed_soc_ast2700_gic131_intcmap[] = { };/* GICINT 132 */ -static const int aspeed_soc_ast2700_gic132_intcmap[] = { +/* GICINT 196 */ +static const int ast2700_gic132_gic196_intcmap[] = { [ASPEED_DEV_ETH1 ] =0 , [ASPEED_DEV_ETH2 ] =1 , [ASPEED_DEV_ETH3 ] =2 ,
@@ -161,24 +168,26 @@ static const int aspeed_soc_ast2700_gic132_intcmap[] = { };/* GICINT 133 */ -static const int aspeed_soc_ast2700_gic133_intcmap[] = { +/* GICINT 197 */ +static const int ast2700_gic133_gic197_intcmap[] = { [ASPEED_DEV_SDHCI ] =1 , [ASPEED_DEV_PECI ] =4 , };/* GICINT 128 ~ 136 */ +/* GICINT 192 ~ 201 */ struct gic_intc_irq_info {int irq;const int *ptr; }; -static const struct gic_intc_irq_info aspeed_soc_ast2700_gic_intcmap[] = { - {128 , aspeed_soc_ast2700_gic128_intcmap}, +static const struct gic_intc_irq_info ast2700_gic_intcmap[] = { + {128 , ast2700_gic128_gic192_intcmap}, {129 ,NULL }, - {130 , aspeed_soc_ast2700_gic130_intcmap}, - {131 , aspeed_soc_ast2700_gic131_intcmap}, - {132 , aspeed_soc_ast2700_gic132_intcmap}, - {133 , aspeed_soc_ast2700_gic133_intcmap}, + {130 , ast2700_gic130_gic194_intcmap}, + {131 , ast2700_gic131_gic195_intcmap}, + {132 , ast2700_gic132_gic196_intcmap}, + {133 , ast2700_gic133_gic197_intcmap}, {134 ,NULL }, {135 ,NULL }, {136 ,NULL },
@@ -190,11 +199,11 @@ static qemu_irq aspeed_soc_ast2700_get_irq(AspeedSoCState *s, int dev)AspeedSoCClass *sc =ASPEED_SOC_GET_CLASS (s);int i; -for (i =0 ; i <ARRAY_SIZE (aspeed_soc_ast2700_gic_intcmap); i++) { -if (sc->irqmap[dev] == aspeed_soc_ast2700_gic_intcmap[i].irq) { -assert (aspeed_soc_ast2700_gic_intcmap[i].ptr); +for (i =0 ; i <ARRAY_SIZE (ast2700_gic_intcmap); i++) { +if (sc->irqmap[dev] == ast2700_gic_intcmap[i].irq) { +assert (ast2700_gic_intcmap[i].ptr);return qdev_get_gpio_in (DEVICE (&a->intc.orgates[i]), - aspeed_soc_ast2700_gic_intcmap[i].ptr[dev]); + ast2700_gic_intcmap[i].ptr[dev]); } }
@@ -208,16 +217,17 @@ static qemu_irq aspeed_soc_ast2700_get_irq_index(AspeedSoCState *s, int dev,AspeedSoCClass *sc =ASPEED_SOC_GET_CLASS (s);int i; -for (i =0 ; i <ARRAY_SIZE (aspeed_soc_ast2700_gic_intcmap); i++) { -if (sc->irqmap[dev] == aspeed_soc_ast2700_gic_intcmap[i].irq) { -assert (aspeed_soc_ast2700_gic_intcmap[i].ptr); +for (i =0 ; i <ARRAY_SIZE (ast2700_gic_intcmap); i++) { +if (sc->irqmap[dev] == ast2700_gic_intcmap[i].irq) { +assert (ast2700_gic_intcmap[i].ptr);return qdev_get_gpio_in (DEVICE (&a->intc.orgates[i]), - aspeed_soc_ast2700_gic_intcmap[i].ptr[dev] + index); + ast2700_gic_intcmap[i].ptr[dev] + index); } }/* -* Invalid orgate index, device irq should be 128 to 136. +* Invalid OR gate index, device IRQ should be between 128 to 136 +* and 192 to 201. */ g_assert_not_reached (); }
@@ -534,17 +544,18 @@ static void aspeed_soc_ast2700_realize(DeviceState *dev, Error **errp)aspeed_mmio_map (s,SYS_BUS_DEVICE (&a->intc),0 , sc->memmap[ASPEED_DEV_INTC ]); -/* source orgates -> INTC */ +/* irq sources -> orgates -> INTC */ for (i =0 ; i < ic->num_inpins; i++) {qdev_connect_gpio_out (DEVICE (&a->intc.orgates[i]),0 , -qdev_get_gpio_in (DEVICE (&a->intc), i)); +qdev_get_gpio_in (DEVICE (&a->intc), i)); } +/* INTC -> GIC192 - GIC201 */ /* INTC -> GIC128 - GIC136 */ for (i =0 ; i < ic->num_outpins; i++) {sysbus_connect_irq (SYS_BUS_DEVICE (&a->intc), i,qdev_get_gpio_in (DEVICE (&a->gic), - aspeed_soc_ast2700_gic_intcmap[i].irq)); + ast2700_gic_intcmap[i].irq)); }/* SRAM */
@@ -695,10 +706,22 @@ static void aspeed_soc_ast2700_realize(DeviceState *dev, Error **errp)for (i =0 ; i <ASPEED_I2C_GET_CLASS (&s->i2c)->num_busses; i++) {/* * The AST2700 I2C controller has one source INTC per bus. -* I2C buses interrupt are connected to GICINT130_INTC -* from bit 0 to bit 15. -* I2C bus 0 is connected to GICINT130_INTC at bit 0. -* I2C bus 15 is connected to GICINT130_INTC at bit 15. +* +* For AST2700 A0: +* 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 +* GICINT130 of INTC (CPU Die). Then, the output pin is connected to +* the GIC. +* +* For AST2700 A1: +* 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 +* GICINT194 of INTCIO (IO Die). 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_I2C , i);sysbus_connect_irq (SYS_BUS_DEVICE (&s->i2c.busses[i]),0 , irq);
Signature · 1 line
2.48.1
[PULL 12/46] hw/misc/aspeed_scu: Skipping dram_init in u-boot
In reply to Cédric Le GoaterFrom: Jamin Lin <[email protected]>
Setting BIT6 in VGA0 SCRATCH register will indicate that the ddr traning is done, therefore skipping the u-boot-spl dram_init() process.
--- hw/misc/aspeed_scu.c | 2 ++ 1 file changed, 2 insertions(+)
hw/misc/aspeed_scu.c +2 -0
@@ -157,6 +157,7 @@#define AST2700_SCU_FREQ_CNTR TO_REG(0x3b0)#define AST2700_SCU_CPU_SCRATCH_0 TO_REG(0x780)#define AST2700_SCU_CPU_SCRATCH_1 TO_REG(0x784) +#define AST2700_SCU_VGA_SCRATCH_0 TO_REG(0x900)#define AST2700_SCUIO_CLK_STOP_CTL_1 TO_REG(0x240)#define AST2700_SCUIO_CLK_STOP_CLR_1 TO_REG(0x244)
@@ -930,6 +931,7 @@ static const uint32_t ast2700_a0_resets[ASPEED_AST2700_SCU_NR_REGS] = { [AST2700_SCU_FREQ_CNTR] = 0x000375eb, [AST2700_SCU_CPU_SCRATCH_0] = 0x00000000, [AST2700_SCU_CPU_SCRATCH_1] = 0x00000004, + [AST2700_SCU_VGA_SCRATCH_0] = 0x00000040, };static void aspeed_ast2700_scu_reset (DeviceState *dev)
Signature · 1 line
2.48.1
[PULL 41/46] hw/arm/aspeed_ast27x0: Sort the memmap table by mapping address
In reply to Cédric Le GoaterFrom: Jamin Lin <[email protected]>
To improve readability, sort the memmap table by mapping address
--- hw/arm/aspeed_ast27x0.c | 54 ++++++++++++++++++++--------------------- 1 file changed, 27 insertions(+), 27 deletions(-)
hw/arm/aspeed_ast27x0.c +27 -27
@@ -24,16 +24,40 @@#include "qemu/log.h" static const hwaddr aspeed_soc_ast2700_memmap[] = { - [ASPEED_DEV_SPI_BOOT ] =0x100000000 , [ASPEED_DEV_SRAM ] =0x10000000 , + [ASPEED_DEV_HACE ] =0x12070000 , + [ASPEED_DEV_EMMC ] =0x12090000 , + [ASPEED_DEV_INTC ] =0x12100000 , + [ASPEED_GIC_DIST ] =0x12200000 , + [ASPEED_GIC_REDIST ] =0x12280000 , [ASPEED_DEV_SDMC ] =0x12C00000 , [ASPEED_DEV_SCU ] =0x12C02000 , + [ASPEED_DEV_RTC ] =0x12C0F000 , + [ASPEED_DEV_TIMER1 ] =0x12C10000 , + [ASPEED_DEV_SLI ] =0x12C17000 , + [ASPEED_DEV_UART4 ] =0X12C1A000 , + [ASPEED_DEV_FMC ] =0x14000000 , + [ASPEED_DEV_SPI0 ] =0x14010000 , + [ASPEED_DEV_SPI1 ] =0x14020000 , + [ASPEED_DEV_SPI2 ] =0x14030000 , + [ASPEED_DEV_MII1 ] =0x14040000 , + [ASPEED_DEV_MII2 ] =0x14040008 , + [ASPEED_DEV_MII3 ] =0x14040010 , + [ASPEED_DEV_ETH1 ] =0x14050000 , + [ASPEED_DEV_ETH2 ] =0x14060000 , + [ASPEED_DEV_ETH3 ] =0x14070000 , + [ASPEED_DEV_SDHCI ] =0x14080000 , + [ASPEED_DEV_ADC ] =0x14C00000 , [ASPEED_DEV_SCUIO ] =0x14C02000 , + [ASPEED_DEV_GPIO ] =0x14C0B000 , + [ASPEED_DEV_I2C ] =0x14C0F000 , + [ASPEED_DEV_INTCIO ] =0x14C18000 , + [ASPEED_DEV_SLIIO ] =0x14C1E000 , + [ASPEED_DEV_VUART ] =0X14C30000 , [ASPEED_DEV_UART0 ] =0X14C33000 , [ASPEED_DEV_UART1 ] =0X14C33100 , [ASPEED_DEV_UART2 ] =0X14C33200 , [ASPEED_DEV_UART3 ] =0X14C33300 , - [ASPEED_DEV_UART4 ] =0X12C1A000 , [ASPEED_DEV_UART5 ] =0X14C33400 , [ASPEED_DEV_UART6 ] =0X14C33500 , [ASPEED_DEV_UART7 ] =0X14C33600 ,
@@ -43,32 +67,8 @@ static const hwaddr aspeed_soc_ast2700_memmap[] = { [ASPEED_DEV_UART11] = 0X14C33A00, [ASPEED_DEV_UART12] = 0X14C33B00, [ASPEED_DEV_WDT] = 0x14C37000, - [ASPEED_DEV_VUART] = 0X14C30000, - [ASPEED_DEV_FMC] = 0x14000000, - [ASPEED_DEV_SPI0] = 0x14010000, - [ASPEED_DEV_SPI1] = 0x14020000, - [ASPEED_DEV_SPI2] = 0x14030000, + [ASPEED_DEV_SPI_BOOT] = 0x100000000, [ASPEED_DEV_SDRAM] = 0x400000000, - [ASPEED_DEV_MII1] = 0x14040000, - [ASPEED_DEV_MII2] = 0x14040008, - [ASPEED_DEV_MII3] = 0x14040010, - [ASPEED_DEV_ETH1] = 0x14050000, - [ASPEED_DEV_ETH2] = 0x14060000, - [ASPEED_DEV_ETH3] = 0x14070000, - [ASPEED_DEV_EMMC] = 0x12090000, - [ASPEED_DEV_INTC] = 0x12100000, - [ASPEED_DEV_INTCIO] = 0x14C18000, - [ASPEED_DEV_SLI] = 0x12C17000, - [ASPEED_DEV_SLIIO] = 0x14C1E000, - [ASPEED_GIC_DIST] = 0x12200000, - [ASPEED_GIC_REDIST] = 0x12280000, - [ASPEED_DEV_ADC] = 0x14C00000, - [ASPEED_DEV_I2C] = 0x14C0F000, - [ASPEED_DEV_GPIO] = 0x14C0B000, - [ASPEED_DEV_RTC] = 0x12C0F000, - [ASPEED_DEV_SDHCI] = 0x14080000, - [ASPEED_DEV_TIMER1] = 0x12C10000, - [ASPEED_DEV_HACE] = 0x12070000, };#define AST2700_MAX_IRQ 256
Signature · 1 line
2.48.1
[PULL 25/46] hw/arm/aspeed: Rename IRQ table and machine name for AST2700 A0
In reply to Cédric Le GoaterFrom: Jamin Lin <[email protected]>
Currently, AST2700 SoC only supports A0. To support AST2700 A1, rename its IRQ table and machine name.
To follow the machine deprecation rule, the initial machine "ast2700-evb" is aliased to "ast2700a0-evb." In the future, we will alias "ast2700-evb" to new SoCs, such as "ast2700a1-evb."
--- hw/arm/aspeed.c | 9 +++++---- hw/arm/aspeed_ast27x0.c | 8 ++++---- 2 files changed, 9 insertions(+), 8 deletions(-)
hw/arm/aspeed.c +5 -4
@@ -1673,12 +1673,13 @@ static void ast2700_evb_i2c_init(AspeedMachineState *bmc) TYPE_TMP105, 0x4d); } -static void aspeed_machine_ast2700_evb_class_init (ObjectClass *oc,void *data) +static void aspeed_machine_ast2700a0_evb_class_init (ObjectClass *oc,void *data) {MachineClass *mc =MACHINE_CLASS (oc);AspeedMachineClass *amc =ASPEED_MACHINE_CLASS (oc); - mc->desc ="Aspeed AST2700 EVB (Cortex-A35)" ; + mc->alias ="ast2700-evb" ; + mc->desc ="Aspeed AST2700 A0 EVB (Cortex-A35)" ; amc->soc_name ="ast2700-a0" ; amc->hw_strap1 =AST2700_EVB_HW_STRAP1 ; amc->hw_strap2 =AST2700_EVB_HW_STRAP2 ;
@@ -1817,9 +1818,9 @@ static const TypeInfo aspeed_machine_types[] = { .class_init = aspeed_minibmc_machine_ast1030_evb_class_init,#ifdef TARGET_AARCH64 }, { - .name = MACHINE_TYPE_NAME("ast2700-evb"), + .name = MACHINE_TYPE_NAME("ast2700a0-evb"), .parent = TYPE_ASPEED_MACHINE, - .class_init = aspeed_machine_ast2700_evb_class_init, + .class_init = aspeed_machine_ast2700a0_evb_class_init,#endif }, { .name = TYPE_ASPEED_MACHINE,
hw/arm/aspeed_ast27x0.c +4 -4
@@ -73,7 +73,7 @@ static const hwaddr aspeed_soc_ast2700_memmap[] = {#define AST2700_MAX_IRQ 256/* Shared Peripheral Interrupt values below are offset by -32 from datasheet */ -static const int aspeed_soc_ast2700_irqmap[] = { +static const int aspeed_soc_ast2700a0_irqmap[] = { [ASPEED_DEV_UART0 ] =132 , [ASPEED_DEV_UART1 ] =132 , [ASPEED_DEV_UART2 ] =132 ,
@@ -766,7 +766,7 @@ static void aspeed_soc_ast2700_realize(DeviceState *dev, Error **errp)create_unimplemented_device ("ast2700.io" ,0x0 ,0x4000000 ); } -static void aspeed_soc_ast2700_class_init (ObjectClass *oc,void *data) +static void aspeed_soc_ast2700a0_class_init (ObjectClass *oc,void *data) {static const char *const valid_cpu_types[] = {ARM_CPU_TYPE_NAME ("cortex-a35" ),
@@ -788,7 +788,7 @@ static void aspeed_soc_ast2700_class_init(ObjectClass *oc, void *data) sc->uarts_num =13 ; sc->num_cpus =4 ; sc->uarts_base =ASPEED_DEV_UART0 ; - sc->irqmap = aspeed_soc_ast2700_irqmap; + sc->irqmap = aspeed_soc_ast2700a0_irqmap; sc->memmap = aspeed_soc_ast2700_memmap; sc->get_irq = aspeed_soc_ast2700_get_irq; }
@@ -803,7 +803,7 @@ static const TypeInfo aspeed_soc_ast27x0_types[] = { .name = "ast2700-a0", .parent = TYPE_ASPEED27X0_SOC, .instance_init = aspeed_soc_ast2700_init, - .class_init = aspeed_soc_ast2700_class_init, + .class_init = aspeed_soc_ast2700a0_class_init, }, };
Signature · 1 line
2.48.1
[PULL 08/46] hw/misc/aspeed_hace: Fix coding style
In reply to Cédric Le GoaterFrom: Jamin Lin <[email protected]>
Fix coding style issues from checkpatch.pl.
--- hw/misc/aspeed_hace.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-)
hw/misc/aspeed_hace.c +8 -4
@@ -75,9 +75,12 @@ static const struct { { HASH_ALGO_SHA1, QCRYPTO_HASH_ALGO_SHA1 }, { HASH_ALGO_SHA224, QCRYPTO_HASH_ALGO_SHA224 }, { HASH_ALGO_SHA256, QCRYPTO_HASH_ALGO_SHA256 }, - { HASH_ALGO_SHA512_SERIES | HASH_ALGO_SHA512_SHA512, QCRYPTO_HASH_ALGO_SHA512 }, - { HASH_ALGO_SHA512_SERIES | HASH_ALGO_SHA512_SHA384, QCRYPTO_HASH_ALGO_SHA384 }, - { HASH_ALGO_SHA512_SERIES | HASH_ALGO_SHA512_SHA256, QCRYPTO_HASH_ALGO_SHA256 }, + { HASH_ALGO_SHA512_SERIES | HASH_ALGO_SHA512_SHA512, + QCRYPTO_HASH_ALGO_SHA512 }, + { HASH_ALGO_SHA512_SERIES | HASH_ALGO_SHA512_SHA384, + QCRYPTO_HASH_ALGO_SHA384 }, + { HASH_ALGO_SHA512_SERIES | HASH_ALGO_SHA512_SHA256, + QCRYPTO_HASH_ALGO_SHA256 }, };static int hash_algo_lookup (uint32_t reg)
@@ -201,7 +204,8 @@ static void do_hash_operation(AspeedHACEState *s, int algo, bool sg_mode, haddr =address_space_map (&s->dram_as, addr, &plen, false,MEMTXATTRS_UNSPECIFIED );if (haddr ==NULL ) { -qemu_log_mask (LOG_GUEST_ERROR ,"%s: qcrypto failed\n" , __func__); +qemu_log_mask (LOG_GUEST_ERROR , +"%s: qcrypto failed\n" , __func__);return ; } iov[i].iov_base = haddr;
Signature · 1 line
2.48.1
[PULL 09/46] hw/misc/aspeed_hace: Add AST2700 support
In reply to Cédric Le GoaterFrom: Jamin Lin <[email protected]>
Introduce a new ast2700 class to support AST2700.
--- include/hw/misc/aspeed_hace.h | 1 + hw/misc/aspeed_hace.c | 20 ++++++++++++++++++++ 2 files changed, 21 insertions(+)
include/hw/misc/aspeed_hace.h +1 -0
@@ -18,6 +18,7 @@#define TYPE_ASPEED_AST2500_HACE TYPE_ASPEED_HACE "-ast2500"#define TYPE_ASPEED_AST2600_HACE TYPE_ASPEED_HACE "-ast2600"#define TYPE_ASPEED_AST1030_HACE TYPE_ASPEED_HACE "-ast1030" +#define TYPE_ASPEED_AST2700_HACE TYPE_ASPEED_HACE "-ast2700"OBJECT_DECLARE_TYPE (AspeedHACEState, AspeedHACEClass,ASPEED_HACE )
hw/misc/aspeed_hace.c +20 -0
@@ -552,12 +552,32 @@ static const TypeInfo aspeed_ast1030_hace_info = { .class_init = aspeed_ast1030_hace_class_init, }; +static void aspeed_ast2700_hace_class_init (ObjectClass *klass,void *data) +{ +DeviceClass *dc =DEVICE_CLASS (klass); +AspeedHACEClass *ahc =ASPEED_HACE_CLASS (klass); + + dc->desc ="AST2700 Hash and Crypto Engine" ; + + ahc->src_mask =0x7FFFFFFF ; + ahc->dest_mask =0x7FFFFFF8 ; + ahc->key_mask =0x7FFFFFF8 ; + ahc->hash_mask =0x00147FFF ; +} + +static const TypeInfo aspeed_ast2700_hace_info = { + .name =TYPE_ASPEED_AST2700_HACE , + .parent =TYPE_ASPEED_HACE , + .class_init = aspeed_ast2700_hace_class_init, +}; +static void aspeed_hace_register_types (void ) {type_register_static (&aspeed_ast2400_hace_info);type_register_static (&aspeed_ast2500_hace_info);type_register_static (&aspeed_ast2600_hace_info);type_register_static (&aspeed_ast1030_hace_info); +type_register_static (&aspeed_ast2700_hace_info);type_register_static (&aspeed_hace_info); }
Signature · 1 line
2.48.1
[PULL 16/46] hw/arm/aspeed_ast27x0.c Separate HW Strap Registers for SCU and SCUIO
In reply to Cédric Le GoaterFrom: Jamin Lin <[email protected]>
There is one hw-strap1 register in the SCU (CPU DIE) and another hw-strap1 register in the SCUIO (IO DIE). The values of these two registers should not be the same. To reuse the current design of hw-strap, hw-strap1 is assigned to the SCU and sets the value in the SCU hw-strap1 register, while hw-strap2 is assigned to the SCUIO and sets the value in the SCUIO hw-strap1 register.
--- hw/arm/aspeed_ast27x0.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-)
hw/arm/aspeed_ast27x0.c +9 -2
@@ -333,14 +333,21 @@ static void aspeed_soc_ast2700_init(Object *obj) sc->silicon_rev);object_property_add_alias (obj,"hw-strap1" ,OBJECT (&s->scu),"hw-strap1" ); -object_property_add_alias (obj,"hw-strap2" ,OBJECT (&s->scu), -"hw-strap2" );object_property_add_alias (obj,"hw-prot-key" ,OBJECT (&s->scu),"hw-prot-key" );object_initialize_child (obj,"scuio" , &s->scuio,TYPE_ASPEED_2700_SCUIO );qdev_prop_set_uint32 (DEVICE (&s->scuio),"silicon-rev" , sc->silicon_rev); +/* +* There is one hw-strap1 register in the SCU (CPU DIE) and another +* hw-strap1 register in the SCUIO (IO DIE). To reuse the current design +* of hw-strap, hw-strap1 is assigned to the SCU and sets the value in the +* SCU hw-strap1 register, while hw-strap2 is assigned to the SCUIO and +* sets the value in the SCUIO hw-strap1 register. +*/ +object_property_add_alias (obj,"hw-strap2" ,OBJECT (&s->scuio), +"hw-strap1" );snprintf (typename,sizeof (typename),"aspeed.fmc-%s" , socname);object_initialize_child (obj,"fmc" , &s->fmc, typename);
Signature · 1 line
2.48.1