aspeed queue
Subsystems (2)
The following changes since commit f5643914a9e8f79c606a76e6a9d7ea82a3fc3e65:
Merge tag 'pull-9p-20220501' of https://github.com/cschoenebeck/qemu into staging (2022-05-01 07:48:11 -0700)
are available in the Git repository at:
https://github.com/legoater/qemu/ tags/pull-aspeed-20220503
for you to fetch changes up to e056c52233910ef156e6d790ce41b33cd838bad6:
aspeed/hace: Support AST1030 HACE (2022-05-03 07:17:20 +0200)
----------------------------------------------------------------
aspeed queue:
* New AST1030 SoC and eval board
* Accumulative mode support for HACE controller
* GPIO fix and unit test
* Clock modeling adjustments for the AST2600
* Dummy eMMC Boot Controller model
* Change of AST2500 EVB and AST2600 EVB flash model (for quad IO)
----------------------------------------------------------------
Jae Hyun Yoo (1):
hw/arm/aspeed: fix AST2500/AST2600 EVB fmc model
Jamin Lin (2):
aspeed: Add an AST1030 eval board test/avocado/machine_aspeed.py: Add ast1030 test case
Joel Stanley (2):
aspeed: sbc: Correct default reset values
aspeed: Add eMMC Boot Controller stub
Peter Delevoryas (1):
hw/gpio/aspeed_gpio: Fix QOM pin property
Steven Lee (13):
hw: aspeed_scu: Add AST2600 apb_freq and hpll calculation function
hw: aspeed_scu: Introduce clkin_25Mhz attribute aspeed/adc: Add AST1030 support
aspeed/smc: Add AST1030 support
aspeed/wdt: Fix ast2500/ast2600 default reload value aspeed/wdt: Add AST1030 support
aspeed/timer: Add AST1030 support
aspeed/scu: Add AST1030 support
aspeed/soc : Add AST1030 support
aspeed/hace: Support HMAC Key Buffer register. aspeed/hace: Support AST2600 HACE
tests/qtest: Add test for Aspeed HACE accumulative mode aspeed/hace: Support AST1030 HACE
include/hw/adc/aspeed_adc.h | 1 + include/hw/arm/aspeed_soc.h | 4 + include/hw/misc/aspeed_hace.h | 7 + include/hw/misc/aspeed_scu.h | 45 ++++++ include/hw/timer/aspeed_timer.h | 1 + include/hw/watchdog/wdt_aspeed.h | 3 + hw/adc/aspeed_adc.c | 16 +++ hw/arm/aspeed.c | 70 ++++++++- hw/arm/aspeed_ast10x0.c | 299 +++++++++++++++++++++++++++++++++++++++ hw/arm/aspeed_ast2600.c | 6 + hw/gpio/aspeed_gpio.c | 2 +- hw/misc/aspeed_hace.c | 159 ++++++++++++++++++++- hw/misc/aspeed_sbc.c | 7 +- hw/misc/aspeed_scu.c | 108 +++++++++++++- hw/ssi/aspeed_smc.c | 157 ++++++++++++++++++++ hw/timer/aspeed_timer.c | 17 +++ hw/watchdog/wdt_aspeed.c | 34 ++++- tests/qtest/aspeed_gpio-test.c | 87 ++++++++++++ tests/qtest/aspeed_hace-test.c | 147 +++++++++++++++++++ hw/arm/meson.build | 6 +- tests/avocado/machine_aspeed.py | 36 +++++ tests/qtest/meson.build | 3 +- 22 files changed, 1199 insertions(+), 16 deletions(-) create mode 100644 hw/arm/aspeed_ast10x0.c create mode 100644 tests/qtest/aspeed_gpio-test.c create mode 100644 tests/avocado/machine_aspeed.py
[PULL 01/19] hw: aspeed_scu: Add AST2600 apb_freq and hpll calculation function
From: Steven Lee <[email protected]>
AST2600's HPLL register offset and bit definition are different from AST2500. Add a hpll calculation function and an apb frequency calculation function based on SCU200 register description in ast2600v11.pdf.
Message-Id: <[email protected]>
--- include/hw/misc/aspeed_scu.h | 19 ++++++++++++++++++ hw/misc/aspeed_scu.c | 39 +++++++++++++++++++++++++++++++++++- 2 files changed, 57 insertions(+), 1 deletion(-)
include/hw/misc/aspeed_scu.h +19 -0
@@ -56,6 +56,7 @@ struct AspeedSCUClass {const uint32_t *resets;uint32_t (*calc_hpll)(AspeedSCUState *s,uint32_t hpll_reg); +uint32_t (*get_apb)(AspeedSCUState *s);uint32_t apb_divider;uint32_t nr_regs;const MemoryRegionOps *ops;
@@ -316,4 +317,22 @@ uint32_t aspeed_scu_get_apb_freq(AspeedSCUState *s); SCU_HW_STRAP_VGA_SIZE_SET(VGA_16M_DRAM) | \ SCU_AST2500_HW_STRAP_RESERVED1) +/* +* SCU200 H-PLL Parameter Register (for Aspeed AST2600 SOC) +* +* 28:26 H-PLL Parameters +* 25 Enable H-PLL reset +* 24 Enable H-PLL bypass mode +* 23 Turn off H-PLL +* 22:19 H-PLL Post Divider (P) +* 18:13 H-PLL Numerator (M) +* 12:0 H-PLL Denumerator (N) +* +* (Output frequency) = CLKIN(25MHz) * [(M+1) / (N+1)] / (P+1) +* +* The default frequency is 1200Mhz when CLKIN = 25MHz +*/ +#define SCU_AST2600_H_PLL_BYPASS_EN (0x1 << 24) +#define SCU_AST2600_H_PLL_OFF (0x1 << 23) +#endif /* ASPEED_SCU_H */
hw/misc/aspeed_scu.c +38 -1
@@ -213,6 +213,11 @@ static uint32_t aspeed_scu_get_random(void) }uint32_t aspeed_scu_get_apb_freq (AspeedSCUState *s) +{ +return ASPEED_SCU_GET_CLASS (s)->get_apb (s); +} + +static uint32_t aspeed_2400_scu_get_apb_freq (AspeedSCUState *s) {AspeedSCUClass *asc =ASPEED_SCU_GET_CLASS (s);uint32_t hpll = asc->calc_hpll (s, s->regs[HPLL_PARAM ]);
@@ -221,6 +226,15 @@ uint32_t aspeed_scu_get_apb_freq(AspeedSCUState *s) / asc->apb_divider; } +static uint32_t aspeed_2600_scu_get_apb_freq (AspeedSCUState *s) +{ +AspeedSCUClass *asc =ASPEED_SCU_GET_CLASS (s); +uint32_t hpll = asc->calc_hpll (s, s->regs[AST2600_HPLL_PARAM ]); + +return hpll / (SCU_CLK_GET_PCLK_DIV (s->regs[AST2600_CLK_SEL ]) +1 ) + / asc->apb_divider; +} +static uint64_t aspeed_scu_read (void *opaque,hwaddr offset,unsigned size) {AspeedSCUState *s =ASPEED_SCU (opaque);
@@ -426,6 +440,26 @@ static uint32_t aspeed_2500_scu_calc_hpll(AspeedSCUState *s, uint32_t hpll_reg)return clkin * multiplier; } +static uint32_t aspeed_2600_scu_calc_hpll (AspeedSCUState *s,uint32_t hpll_reg) +{ +uint32_t multiplier =1 ; +uint32_t clkin =aspeed_scu_get_clkin (s); + +if (hpll_reg &SCU_AST2600_H_PLL_OFF ) { +return 0 ; + } + +if (!(hpll_reg &SCU_AST2600_H_PLL_BYPASS_EN )) { +uint32_t p = (hpll_reg >>19 ) &0xf ; +uint32_t n = (hpll_reg >>13 ) &0x3f ; +uint32_t m = hpll_reg &0x1fff ; + + multiplier = ((m +1 ) / (n +1 )) / (p +1 ); + } + +return clkin * multiplier; +} +static void aspeed_scu_reset (DeviceState *dev) {AspeedSCUState *s =ASPEED_SCU (dev);
@@ -525,6 +559,7 @@ static void aspeed_2400_scu_class_init(ObjectClass *klass, void *data) dc->desc ="ASPEED 2400 System Control Unit" ; asc->resets = ast2400_a0_resets; asc->calc_hpll = aspeed_2400_scu_calc_hpll; + asc->get_apb = aspeed_2400_scu_get_apb_freq; asc->apb_divider =2 ; asc->nr_regs =ASPEED_SCU_NR_REGS ; asc->ops = &aspeed_ast2400_scu_ops;
@@ -545,6 +580,7 @@ static void aspeed_2500_scu_class_init(ObjectClass *klass, void *data) dc->desc ="ASPEED 2500 System Control Unit" ; asc->resets = ast2500_a1_resets; asc->calc_hpll = aspeed_2500_scu_calc_hpll; + asc->get_apb = aspeed_2400_scu_get_apb_freq; asc->apb_divider =4 ; asc->nr_regs =ASPEED_SCU_NR_REGS ; asc->ops = &aspeed_ast2500_scu_ops;
@@ -716,7 +752,8 @@ static void aspeed_2600_scu_class_init(ObjectClass *klass, void *data) dc->desc ="ASPEED 2600 System Control Unit" ; dc->reset = aspeed_ast2600_scu_reset; asc->resets = ast2600_a3_resets; - asc->calc_hpll = aspeed_2500_scu_calc_hpll;/* No change since AST2500 */ + asc->calc_hpll = aspeed_2600_scu_calc_hpll; + asc->get_apb = aspeed_2600_scu_get_apb_freq; asc->apb_divider =4 ; asc->nr_regs =ASPEED_AST2600_SCU_NR_REGS ; asc->ops = &aspeed_ast2600_scu_ops;
Signature · 1 line
2.35.1
[PULL 06/19] aspeed/smc: Add AST1030 support
In reply to Cédric Le GoaterFrom: Steven Lee <[email protected]>
AST1030 spi controller's address decoding unit is 1MB that is identical to ast2600, but fmc address decoding unit is 512kb. Introduce seg_to_reg and reg_to_seg handlers for ast1030 fmc controller. In addition, add ast1030 fmc, spi1, and spi2 class init handler.
Message-Id: <[email protected]>
--- hw/ssi/aspeed_smc.c | 157 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 157 insertions(+)
hw/ssi/aspeed_smc.c +157 -0
@@ -1696,6 +1696,160 @@ static const TypeInfo aspeed_2600_spi2_info = { .class_init = aspeed_2600_spi2_class_init, }; +/* +* The FMC Segment Registers of the AST1030 have a 512KB unit. +* Only bits [27:19] are used for decoding. +*/ +#define AST1030_SEG_ADDR_MASK 0x0ff80000 + +static uint32_t aspeed_1030_smc_segment_to_reg (const AspeedSMCState *s, +const AspeedSegments *seg) +{ +uint32_t reg =0 ; + +/* Disabled segments have a nil register */ +if (!seg->size) { +return 0 ; + } + + reg |= (seg->addr &AST1030_SEG_ADDR_MASK ) >>16 ;/* start offset */ + reg |= (seg->addr + seg->size -1 ) &AST1030_SEG_ADDR_MASK ;/* end offset */ +return reg; +} + +static void aspeed_1030_smc_reg_to_segment (const AspeedSMCState *s, +uint32_t reg,AspeedSegments *seg) +{ +uint32_t start_offset = (reg <<16 ) &AST1030_SEG_ADDR_MASK ; +uint32_t end_offset = reg &AST1030_SEG_ADDR_MASK ; +AspeedSMCClass *asc =ASPEED_SMC_GET_CLASS (s); + +if (reg) { + seg->addr = asc->flash_window_base + start_offset; + seg->size = end_offset + (512 * KiB) - start_offset; + }else { + seg->addr = asc->flash_window_base; + seg->size =0 ; + } +} + +static const uint32_t aspeed_1030_fmc_resets[ASPEED_SMC_R_MAX ] = { + [R_CONF ] = (CONF_FLASH_TYPE_SPI <<CONF_FLASH_TYPE0 | +CONF_FLASH_TYPE_SPI <<CONF_FLASH_TYPE1 ), +}; + +static const AspeedSegments aspeed_1030_fmc_segments[] = { + {0x0 ,128 * MiB },/* start address is readonly */ + {128 * MiB,128 * MiB },/* default is disabled but needed for -kernel */ + {0x0 ,0 },/* disabled */ +}; + +static void aspeed_1030_fmc_class_init (ObjectClass *klass,void *data) +{ +DeviceClass *dc =DEVICE_CLASS (klass); +AspeedSMCClass *asc =ASPEED_SMC_CLASS (klass); + + dc->desc ="Aspeed 1030 FMC Controller" ; + asc->r_conf =R_CONF ; + asc->r_ce_ctrl =R_CE_CTRL ; + asc->r_ctrl0 =R_CTRL0 ; + asc->r_timings =R_TIMINGS ; + asc->nregs_timings =2 ; + asc->conf_enable_w0 =CONF_ENABLE_W0 ; + asc->cs_num_max =2 ; + asc->segments = aspeed_1030_fmc_segments; + asc->segment_addr_mask =0x0ff80ff8 ; + asc->resets = aspeed_1030_fmc_resets; + asc->flash_window_base =0x80000000 ; + asc->flash_window_size =0x10000000 ; + asc->features =ASPEED_SMC_FEATURE_DMA ; + asc->dma_flash_mask =0x0FFFFFFC ; + asc->dma_dram_mask =0x000BFFFC ; + asc->nregs =ASPEED_SMC_R_MAX ; + asc->segment_to_reg = aspeed_1030_smc_segment_to_reg; + asc->reg_to_segment = aspeed_1030_smc_reg_to_segment; + asc->dma_ctrl = aspeed_2600_smc_dma_ctrl; +} + +static const TypeInfo aspeed_1030_fmc_info = { + .name ="aspeed.fmc-ast1030" , + .parent =TYPE_ASPEED_SMC , + .class_init = aspeed_1030_fmc_class_init, +}; + +static const AspeedSegments aspeed_1030_spi1_segments[] = { + {0x0 ,128 * MiB },/* start address is readonly */ + {0x0 ,0 },/* disabled */ +}; + +static void aspeed_1030_spi1_class_init (ObjectClass *klass,void *data) +{ +DeviceClass *dc =DEVICE_CLASS (klass); +AspeedSMCClass *asc =ASPEED_SMC_CLASS (klass); + + dc->desc ="Aspeed 1030 SPI1 Controller" ; + asc->r_conf =R_CONF ; + asc->r_ce_ctrl =R_CE_CTRL ; + asc->r_ctrl0 =R_CTRL0 ; + asc->r_timings =R_TIMINGS ; + asc->nregs_timings =2 ; + asc->conf_enable_w0 =CONF_ENABLE_W0 ; + asc->cs_num_max =2 ; + asc->segments = aspeed_1030_spi1_segments; + asc->segment_addr_mask =0x0ff00ff0 ; + asc->flash_window_base =0x90000000 ; + asc->flash_window_size =0x10000000 ; + asc->features =ASPEED_SMC_FEATURE_DMA ; + asc->dma_flash_mask =0x0FFFFFFC ; + asc->dma_dram_mask =0x000BFFFC ; + asc->nregs =ASPEED_SMC_R_MAX ; + asc->segment_to_reg = aspeed_2600_smc_segment_to_reg; + asc->reg_to_segment = aspeed_2600_smc_reg_to_segment; + asc->dma_ctrl = aspeed_2600_smc_dma_ctrl; +} + +static const TypeInfo aspeed_1030_spi1_info = { + .name ="aspeed.spi1-ast1030" , + .parent =TYPE_ASPEED_SMC , + .class_init = aspeed_1030_spi1_class_init, +}; +static const AspeedSegments aspeed_1030_spi2_segments[] = { + {0x0 ,128 * MiB },/* start address is readonly */ + {0x0 ,0 },/* disabled */ +}; + +static void aspeed_1030_spi2_class_init (ObjectClass *klass,void *data) +{ +DeviceClass *dc =DEVICE_CLASS (klass); +AspeedSMCClass *asc =ASPEED_SMC_CLASS (klass); + + dc->desc ="Aspeed 1030 SPI2 Controller" ; + asc->r_conf =R_CONF ; + asc->r_ce_ctrl =R_CE_CTRL ; + asc->r_ctrl0 =R_CTRL0 ; + asc->r_timings =R_TIMINGS ; + asc->nregs_timings =2 ; + asc->conf_enable_w0 =CONF_ENABLE_W0 ; + asc->cs_num_max =2 ; + asc->segments = aspeed_1030_spi2_segments; + asc->segment_addr_mask =0x0ff00ff0 ; + asc->flash_window_base =0xb0000000 ; + asc->flash_window_size =0x10000000 ; + asc->features =ASPEED_SMC_FEATURE_DMA ; + asc->dma_flash_mask =0x0FFFFFFC ; + asc->dma_dram_mask =0x000BFFFC ; + asc->nregs =ASPEED_SMC_R_MAX ; + asc->segment_to_reg = aspeed_2600_smc_segment_to_reg; + asc->reg_to_segment = aspeed_2600_smc_reg_to_segment; + asc->dma_ctrl = aspeed_2600_smc_dma_ctrl; +} + +static const TypeInfo aspeed_1030_spi2_info = { + .name ="aspeed.spi2-ast1030" , + .parent =TYPE_ASPEED_SMC , + .class_init = aspeed_1030_spi2_class_init, +}; +static void aspeed_smc_register_types (void ) {type_register_static (&aspeed_smc_flash_info);
@@ -1709,6 +1863,9 @@ static void aspeed_smc_register_types(void)type_register_static (&aspeed_2600_fmc_info);type_register_static (&aspeed_2600_spi1_info);type_register_static (&aspeed_2600_spi2_info); +type_register_static (&aspeed_1030_fmc_info); +type_register_static (&aspeed_1030_spi1_info); +type_register_static (&aspeed_1030_spi2_info); }type_init (aspeed_smc_register_types)
Signature · 1 line
2.35.1
[PULL 03/19] aspeed: sbc: Correct default reset values
In reply to Cédric Le GoaterFrom: Joel Stanley <[email protected]>
In order to correctly report secure boot running firmware, these values must be set. They are taken from a running machine when secure boot is enabled.
We don't yet have documentation from ASPEED on what they mean. Set the raw values for now, and in the future improve the model with properties to set these on a per-machine basis.
Message-Id: <[email protected]>
--- hw/misc/aspeed_sbc.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
hw/misc/aspeed_sbc.c +5 -2
@@ -17,6 +17,7 @@#define R_PROT (0x000 / 4)#define R_STATUS (0x014 / 4) +#define R_QSR (0x040 / 4)static uint64_t aspeed_sbc_read (void *opaque,hwaddr addr,unsigned int size) {
@@ -50,6 +51,7 @@ static void aspeed_sbc_write(void *opaque, hwaddr addr, uint64_t data,switch (addr) {case R_STATUS : +case R_QSR :qemu_log_mask (LOG_GUEST_ERROR ,"%s: write to read only register 0x%" HWADDR_PRIx"\n" , __func__, addr <<2 );
@@ -77,8 +79,9 @@ static void aspeed_sbc_reset(DeviceState *dev)memset (s->regs,0 ,sizeof (s->regs)); -/* Set secure boot enabled, and boot from emmc/spi */ - s->regs[R_STATUS ] =1 <<6 |1 <<5 ; +/* Set secure boot enabled with RSA4096_SHA256 and enable eMMC ABR */ + s->regs[R_STATUS ] =0x000044C6 ; + s->regs[R_QSR ] =0x07C07C89 ; }static void aspeed_sbc_realize (DeviceState *dev,Error **errp)
Signature · 1 line
2.35.1
[PULL 08/19] aspeed/wdt: Add AST1030 support
In reply to Cédric Le GoaterFrom: Steven Lee <[email protected]>
AST1030 wdt controller is similiar to AST2600's wdt, but it has extra registers.
Introduce ast1030 object class and increse the number of regs(offset) of ast1030 model.
Message-Id: <[email protected]>
--- include/hw/watchdog/wdt_aspeed.h | 1 + hw/watchdog/wdt_aspeed.c | 24 ++++++++++++++++++++++++ 2 files changed, 25 insertions(+)
include/hw/watchdog/wdt_aspeed.h +1 -0
@@ -19,6 +19,7 @@ OBJECT_DECLARE_TYPE(AspeedWDTState, AspeedWDTClass, ASPEED_WDT)#define TYPE_ASPEED_2400_WDT TYPE_ASPEED_WDT "-ast2400"#define TYPE_ASPEED_2500_WDT TYPE_ASPEED_WDT "-ast2500"#define TYPE_ASPEED_2600_WDT TYPE_ASPEED_WDT "-ast2600" +#define TYPE_ASPEED_1030_WDT TYPE_ASPEED_WDT "-ast1030"#define ASPEED_WDT_REGS_MAX (0x20 / 4)
hw/watchdog/wdt_aspeed.c +24 -0
@@ -391,6 +391,29 @@ static const TypeInfo aspeed_2600_wdt_info = { .class_init = aspeed_2600_wdt_class_init, }; +static void aspeed_1030_wdt_class_init (ObjectClass *klass,void *data) +{ +DeviceClass *dc =DEVICE_CLASS (klass); +AspeedWDTClass *awc =ASPEED_WDT_CLASS (klass); + + dc->desc ="ASPEED 1030 Watchdog Controller" ; + awc->offset =0x80 ; + awc->ext_pulse_width_mask =0xfffff ;/* TODO */ + awc->reset_ctrl_reg =AST2600_SCU_RESET_CONTROL1 ; + awc->reset_pulse = aspeed_2500_wdt_reset_pulse; + awc->wdt_reload = aspeed_wdt_reload_1mhz; + awc->sanitize_ctrl = aspeed_2600_sanitize_ctrl; + awc->default_status =0x014FB180 ; + awc->default_reload_value =0x014FB180 ; +} + +static const TypeInfo aspeed_1030_wdt_info = { + .name =TYPE_ASPEED_1030_WDT , + .parent =TYPE_ASPEED_WDT , + .instance_size =sizeof (AspeedWDTState), + .class_init = aspeed_1030_wdt_class_init, +}; +static void wdt_aspeed_register_types (void ) {watchdog_add_model (&model);
@@ -398,6 +421,7 @@ static void wdt_aspeed_register_types(void)type_register_static (&aspeed_2400_wdt_info);type_register_static (&aspeed_2500_wdt_info);type_register_static (&aspeed_2600_wdt_info); +type_register_static (&aspeed_1030_wdt_info); }type_init (wdt_aspeed_register_types)
Signature · 1 line
2.35.1
[PULL 09/19] aspeed/timer: Add AST1030 support
In reply to Cédric Le GoaterFrom: Steven Lee <[email protected]>
ast1030 tmc(timer controller) is identical to ast2600 tmc.
Message-Id: <[email protected]>
--- include/hw/timer/aspeed_timer.h | 1 + hw/timer/aspeed_timer.c | 17 +++++++++++++++++ 2 files changed, 18 insertions(+)
include/hw/timer/aspeed_timer.h +1 -0
@@ -31,6 +31,7 @@ OBJECT_DECLARE_TYPE(AspeedTimerCtrlState, AspeedTimerClass, ASPEED_TIMER)#define TYPE_ASPEED_2400_TIMER TYPE_ASPEED_TIMER "-ast2400"#define TYPE_ASPEED_2500_TIMER TYPE_ASPEED_TIMER "-ast2500"#define TYPE_ASPEED_2600_TIMER TYPE_ASPEED_TIMER "-ast2600" +#define TYPE_ASPEED_1030_TIMER TYPE_ASPEED_TIMER "-ast1030"#define ASPEED_TIMER_NR_TIMERS 8
hw/timer/aspeed_timer.c +17 -0
@@ -745,12 +745,29 @@ static const TypeInfo aspeed_2600_timer_info = { .class_init = aspeed_2600_timer_class_init, }; +static void aspeed_1030_timer_class_init (ObjectClass *klass,void *data) +{ +DeviceClass *dc =DEVICE_CLASS (klass); +AspeedTimerClass *awc =ASPEED_TIMER_CLASS (klass); + + dc->desc ="ASPEED 1030 Timer" ; + awc->read = aspeed_2600_timer_read; + awc->write = aspeed_2600_timer_write; +} + +static const TypeInfo aspeed_1030_timer_info = { + .name =TYPE_ASPEED_1030_TIMER , + .parent =TYPE_ASPEED_TIMER , + .class_init = aspeed_1030_timer_class_init, +}; +static void aspeed_timer_register_types (void ) {type_register_static (&aspeed_timer_info);type_register_static (&aspeed_2400_timer_info);type_register_static (&aspeed_2500_timer_info);type_register_static (&aspeed_2600_timer_info); +type_register_static (&aspeed_1030_timer_info); }type_init (aspeed_timer_register_types)
Signature · 1 line
2.35.1
[PULL 02/19] hw: aspeed_scu: Introduce clkin_25Mhz attribute
In reply to Cédric Le GoaterFrom: Steven Lee <[email protected]>
AST2600 clkin is always 25MHz, introduce clkin_25Mhz attribute for aspeed_scu_get_clkin() to return the correct clkin for ast2600.
Message-Id: <[email protected]>
--- include/hw/misc/aspeed_scu.h | 1 + hw/misc/aspeed_scu.c | 6 +++++- 2 files changed, 6 insertions(+), 1 deletion(-)
include/hw/misc/aspeed_scu.h +1 -0
@@ -59,6 +59,7 @@ struct AspeedSCUClass {uint32_t (*get_apb)(AspeedSCUState *s);uint32_t apb_divider;uint32_t nr_regs; +bool clkin_25Mhz;const MemoryRegionOps *ops; };
hw/misc/aspeed_scu.c +5 -1
@@ -371,7 +371,8 @@ static const MemoryRegionOps aspeed_ast2500_scu_ops = {static uint32_t aspeed_scu_get_clkin (AspeedSCUState *s) { -if (s->hw_strap1 &SCU_HW_STRAP_CLK_25M_IN ) { +if (s->hw_strap1 &SCU_HW_STRAP_CLK_25M_IN || +ASPEED_SCU_GET_CLASS (s)->clkin_25Mhz) {return 25000000 ; }else if (s->hw_strap1 &SCU_HW_STRAP_CLK_48M_IN ) {return 48000000 ;
@@ -562,6 +563,7 @@ static void aspeed_2400_scu_class_init(ObjectClass *klass, void *data) asc->get_apb = aspeed_2400_scu_get_apb_freq; asc->apb_divider =2 ; asc->nr_regs =ASPEED_SCU_NR_REGS ; + asc->clkin_25Mhz = false; asc->ops = &aspeed_ast2400_scu_ops; }
@@ -583,6 +585,7 @@ static void aspeed_2500_scu_class_init(ObjectClass *klass, void *data) asc->get_apb = aspeed_2400_scu_get_apb_freq; asc->apb_divider =4 ; asc->nr_regs =ASPEED_SCU_NR_REGS ; + asc->clkin_25Mhz = false; asc->ops = &aspeed_ast2500_scu_ops; }
@@ -756,6 +759,7 @@ static void aspeed_2600_scu_class_init(ObjectClass *klass, void *data) asc->get_apb = aspeed_2600_scu_get_apb_freq; asc->apb_divider =4 ; asc->nr_regs =ASPEED_AST2600_SCU_NR_REGS ; + asc->clkin_25Mhz = true; asc->ops = &aspeed_ast2600_scu_ops; }
Signature · 1 line
2.35.1
[PULL 05/19] aspeed/adc: Add AST1030 support
In reply to Cédric Le GoaterFrom: Steven Lee <[email protected]>
Per ast1030_v7.pdf, AST1030 ADC engine is identical to AST2600's ADC.
Message-Id: <[email protected]>
--- include/hw/adc/aspeed_adc.h | 1 + hw/adc/aspeed_adc.c | 16 ++++++++++++++++ 2 files changed, 17 insertions(+)
include/hw/adc/aspeed_adc.h +1 -0
@@ -17,6 +17,7 @@#define TYPE_ASPEED_2400_ADC TYPE_ASPEED_ADC "-ast2400"#define TYPE_ASPEED_2500_ADC TYPE_ASPEED_ADC "-ast2500"#define TYPE_ASPEED_2600_ADC TYPE_ASPEED_ADC "-ast2600" +#define TYPE_ASPEED_1030_ADC TYPE_ASPEED_ADC "-ast1030" OBJECT_DECLARE_TYPE(AspeedADCState, AspeedADCClass, ASPEED_ADC)#define TYPE_ASPEED_ADC_ENGINE "aspeed.adc.engine"
hw/adc/aspeed_adc.c +16 -0
@@ -389,6 +389,15 @@ static void aspeed_2600_adc_class_init(ObjectClass *klass, void *data) aac->nr_engines =2 ; } +static void aspeed_1030_adc_class_init (ObjectClass *klass,void *data) +{ +DeviceClass *dc =DEVICE_CLASS (klass); +AspeedADCClass *aac =ASPEED_ADC_CLASS (klass); + + dc->desc ="ASPEED 1030 ADC Controller" ; + aac->nr_engines =2 ; +} +static const TypeInfo aspeed_adc_info = { .name =TYPE_ASPEED_ADC , .parent =TYPE_SYS_BUS_DEVICE ,
@@ -415,6 +424,12 @@ static const TypeInfo aspeed_2600_adc_info = { .class_init = aspeed_2600_adc_class_init, }; +static const TypeInfo aspeed_1030_adc_info = { + .name =TYPE_ASPEED_1030_ADC , + .parent =TYPE_ASPEED_ADC , + .class_init = aspeed_1030_adc_class_init,/* No change since AST2600 */ +}; +static void aspeed_adc_register_types (void ) {type_register_static (&aspeed_adc_engine_info);
@@ -422,6 +437,7 @@ static void aspeed_adc_register_types(void)type_register_static (&aspeed_2400_adc_info);type_register_static (&aspeed_2500_adc_info);type_register_static (&aspeed_2600_adc_info); +type_register_static (&aspeed_1030_adc_info); }type_init (aspeed_adc_register_types);
Signature · 1 line
2.35.1
[PULL 11/19] aspeed/soc : Add AST1030 support
In reply to Cédric Le GoaterFrom: Steven Lee <[email protected]>
The embedded core of AST1030 SoC is ARM Coretex M4. It is hard to be integrated in the common Aspeed Soc framework. We introduce a new ast1030 class with instance_init and realize handlers.
Message-Id: <[email protected]>
--- include/hw/arm/aspeed_soc.h | 3 + hw/arm/aspeed_ast10x0.c | 299 ++++++++++++++++++++++++++++++++++++ hw/arm/meson.build | 6 +- 3 files changed, 307 insertions(+), 1 deletion(-) create mode 100644 hw/arm/aspeed_ast10x0.c
include/hw/arm/aspeed_soc.h +3 -0
@@ -13,6 +13,7 @@#define ASPEED_SOC_H #include "hw/cpu/a15mpcore.h" +#include "hw/arm/armv7m.h" #include "hw/intc/aspeed_vic.h" #include "hw/misc/aspeed_scu.h" #include "hw/adc/aspeed_adc.h"
@@ -47,6 +48,7 @@ struct AspeedSoCState {/*< public >*/ ARMCPU cpu[ASPEED_CPUS_NUM ];A15MPPrivState a7mpcore; +ARMv7MState armv7m;MemoryRegion *dram_mr;MemoryRegion sram;AspeedVICState vic;
@@ -72,6 +74,7 @@ struct AspeedSoCState {AspeedSDHCIState emmc;AspeedLPCState lpc;uint32_t uart_default; +Clock *sysclk; };#define TYPE_ASPEED_SOC "aspeed-soc"
hw/arm/aspeed_ast10x0.c new file +299 -0
299 lines not on this page · raw message
hw/arm/meson.build +5 -1
@@ -47,7 +47,11 @@ arm_ss.add(when: 'CONFIG_XLNX_VERSAL', if_true: files('xlnx-versal.c', 'xlnx-ver arm_ss.add(when: 'CONFIG_FSL_IMX25', if_true: files('fsl-imx25.c', 'imx25_pdk.c')) arm_ss.add(when: 'CONFIG_FSL_IMX31', if_true: files('fsl-imx31.c', 'kzm.c')) arm_ss.add(when: 'CONFIG_FSL_IMX6', if_true: files('fsl-imx6.c')) -arm_ss.add(when: 'CONFIG_ASPEED_SOC', if_true: files('aspeed_soc.c', 'aspeed.c', 'aspeed_ast2600.c')) +arm_ss.add(when: 'CONFIG_ASPEED_SOC', if_true: files( + 'aspeed_soc.c', + 'aspeed.c', + 'aspeed_ast2600.c', + 'aspeed_ast10x0.c')) arm_ss.add(when: 'CONFIG_MPS2', if_true: files('mps2.c')) arm_ss.add(when: 'CONFIG_MPS2', if_true: files('mps2-tz.c')) arm_ss.add(when: 'CONFIG_MSF2', if_true: files('msf2-soc.c'))
Signature · 1 line
2.35.1
[PULL 12/19] aspeed: Add an AST1030 eval board
In reply to Cédric Le GoaterFrom: Jamin Lin <[email protected]>
The image should be supplied with ELF binary.
$ qemu-system-arm -M ast1030-evb -kernel zephyr.elf -nographic
Message-Id: <[email protected]>
--- hw/arm/aspeed.c | 66 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 66 insertions(+)
hw/arm/aspeed.c +66 -0
@@ -24,6 +24,7 @@#include "hw/loader.h" #include "qemu/error-report.h" #include "qemu/units.h" +#include "hw/qdev-clock.h" static struct arm_boot_info aspeed_board_binfo = { .board_id =-1 ,/* device-tree-only board */
@@ -1292,6 +1293,67 @@ static void aspeed_machine_bletchley_class_init(ObjectClass *oc, void *data)aspeed_soc_num_cpus (amc->soc_name); } +#define AST1030_INTERNAL_FLASH_SIZE (1024 * 1024) +/* Main SYSCLK frequency in Hz (200MHz) */ +#define SYSCLK_FRQ 200000000ULL + +static void aspeed_minibmc_machine_init (MachineState *machine) +{ +AspeedMachineState *bmc =ASPEED_MACHINE (machine); +AspeedMachineClass *amc =ASPEED_MACHINE_GET_CLASS (machine); +Clock *sysclk; + + sysclk =clock_new (OBJECT (machine),"SYSCLK" ); +clock_set_hz (sysclk,SYSCLK_FRQ ); + +object_initialize_child (OBJECT (machine),"soc" , &bmc->soc, amc->soc_name); +qdev_connect_clock_in (DEVICE (&bmc->soc),"sysclk" , sysclk); + +qdev_prop_set_uint32 (DEVICE (&bmc->soc),"uart-default" , + amc->uart_default); +qdev_realize (DEVICE (&bmc->soc),NULL , &error_abort); + +aspeed_board_init_flashes (&bmc->soc.fmc, + bmc->fmc_model ? bmc->fmc_model : amc->fmc_model, + amc->num_cs, +0 ); + +aspeed_board_init_flashes (&bmc->soc.spi[0 ], + bmc->spi_model ? bmc->spi_model : amc->spi_model, + amc->num_cs, amc->num_cs); + +aspeed_board_init_flashes (&bmc->soc.spi[1 ], + bmc->spi_model ? bmc->spi_model : amc->spi_model, + amc->num_cs, (amc->num_cs *2 )); + +if (amc->i2c_init) { + amc->i2c_init (bmc); + } + +armv7m_load_kernel (ARM_CPU (first_cpu), + machine->kernel_filename, +AST1030_INTERNAL_FLASH_SIZE ); +} + +static void aspeed_minibmc_machine_ast1030_evb_class_init (ObjectClass *oc, +void *data) +{ +MachineClass *mc =MACHINE_CLASS (oc); +AspeedMachineClass *amc =ASPEED_MACHINE_CLASS (oc); + + mc->desc ="Aspeed AST1030 MiniBMC (Cortex-M4)" ; + amc->soc_name ="ast1030-a1" ; + amc->hw_strap1 =0 ; + amc->hw_strap2 =0 ; + mc->init = aspeed_minibmc_machine_init; + mc->default_ram_size =0 ; + mc->default_cpus = mc->min_cpus = mc->max_cpus =1 ; + amc->fmc_model ="sst25vf032b" ; + amc->spi_model ="sst25vf032b" ; + amc->num_cs =2 ; + amc->macs_mask =0 ; +} +static const TypeInfo aspeed_machine_types[] = { { .name =MACHINE_TYPE_NAME ("palmetto-bmc" ),
@@ -1349,6 +1411,10 @@ static const TypeInfo aspeed_machine_types[] = { .name = MACHINE_TYPE_NAME("bletchley-bmc"), .parent = TYPE_ASPEED_MACHINE, .class_init = aspeed_machine_bletchley_class_init, + }, { + .name = MACHINE_TYPE_NAME("ast1030-evb"), + .parent = TYPE_ASPEED_MACHINE, + .class_init = aspeed_minibmc_machine_ast1030_evb_class_init, }, { .name = TYPE_ASPEED_MACHINE, .parent = TYPE_MACHINE,
Signature · 1 line
2.35.1
[PULL 04/19] aspeed: Add eMMC Boot Controller stub
In reply to Cédric Le GoaterFrom: Joel Stanley <[email protected]>
Guest code (u-boot) pokes at this on boot. No functionality is required for guest code to work correctly, but it helps to document the region being read from.
Message-Id: <[email protected]>
--- include/hw/arm/aspeed_soc.h | 1 + hw/arm/aspeed_ast2600.c | 6 ++++++ 2 files changed, 7 insertions(+)
include/hw/arm/aspeed_soc.h +1 -0
@@ -112,6 +112,7 @@ enum {ASPEED_DEV_SCU ,ASPEED_DEV_ADC ,ASPEED_DEV_SBC , +ASPEED_DEV_EMMC_BC ,ASPEED_DEV_VIDEO ,ASPEED_DEV_SRAM , ASPEED_DEV_SDHCI,
hw/arm/aspeed_ast2600.c +6 -0
@@ -48,6 +48,7 @@ static const hwaddr aspeed_soc_ast2600_memmap[] = { [ASPEED_DEV_ADC] = 0x1E6E9000, [ASPEED_DEV_DP] = 0x1E6EB000, [ASPEED_DEV_SBC] = 0x1E6F2000, + [ASPEED_DEV_EMMC_BC] = 0x1E6f5000, [ASPEED_DEV_VIDEO] = 0x1E700000, [ASPEED_DEV_SDHCI] = 0x1E740000, [ASPEED_DEV_EMMC] = 0x1E750000,
@@ -257,6 +258,11 @@ static void aspeed_soc_ast2600_realize(DeviceState *dev, Error **errp)create_unimplemented_device ("aspeed.video" , sc->memmap[ASPEED_DEV_VIDEO ],0x1000 ); +/* eMMC Boot Controller stub */ +create_unimplemented_device ("aspeed.emmc-boot-controller" , + sc->memmap[ASPEED_DEV_EMMC_BC ], +0x1000 ); +/* CPU */ for (i =0 ; i < sc->num_cpus; i++) {if (sc->num_cpus >1 ) {
Signature · 1 line
2.35.1
[PULL 13/19] test/avocado/machine_aspeed.py: Add ast1030 test case
In reply to Cédric Le GoaterFrom: Jamin Lin <[email protected]>
Add test case to test "ast1030-evb" machine with zephyr os
Message-Id: <[email protected]>
--- tests/avocado/machine_aspeed.py | 36 +++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 tests/avocado/machine_aspeed.py
tests/avocado/machine_aspeed.py new file +36 -0
@@ -0,0 +1,36 @@ +# Functional test that boots the ASPEED SoCs with firmware +# +# Copyright (C) 2022 ASPEED Technology Inc +# +# This work is licensed under the terms of the GNU GPL, version 2 or +# later. See the COPYING file in the top-level directory. + +from avocado_qemu import QemuSystemTest +from avocado_qemu import wait_for_console_pattern +from avocado_qemu import exec_command_and_wait_for_pattern +from avocado.utils import archive + + +class AST1030Machine(QemuSystemTest): + """Boots the zephyr os and checks that the console is operational""" + + timeout = 10 + + def test_ast1030_zephyros(self): + """ + :avocado: tags=arch:arm + :avocado: tags=machine:ast1030-evb + """ + tar_url = ('https://github.com/AspeedTech-BMC' + '/zephyr/releases/download/v00.01.04/ast1030-evb-demo.zip') + tar_hash = '4c6a8ce3a8ba76ef1a65dae419ae3409343c4b20' + tar_path = self.fetch_asset(tar_url, asset_hash=tar_hash) + archive.extract(tar_path, self.workdir) + kernel_file = self.workdir + "/ast1030-evb-demo/zephyr.elf" + self.vm.set_console() + self.vm.add_args('-kernel', kernel_file, + '-nographic') + self.vm.launch() + wait_for_console_pattern(self, "Booting Zephyr OS") + exec_command_and_wait_for_pattern(self, "help", + "Available commands")
Signature · 1 line
2.35.1
[PULL 15/19] aspeed/hace: Support HMAC Key Buffer register.
In reply to Cédric Le GoaterFrom: Steven Lee <[email protected]>
Support HACE28: Hash HMAC Key Buffer Base Address Register.
Message-Id: <[email protected]>
--- include/hw/misc/aspeed_hace.h | 1 + hw/misc/aspeed_hace.c | 7 +++++++ 2 files changed, 8 insertions(+)
include/hw/misc/aspeed_hace.h +1 -0
@@ -37,6 +37,7 @@ struct AspeedHACEClass {uint32_t src_mask;uint32_t dest_mask; +uint32_t key_mask;uint32_t hash_mask; };
hw/misc/aspeed_hace.c +7 -0
@@ -27,6 +27,7 @@#define R_HASH_SRC (0x20 / 4)#define R_HASH_DEST (0x24 / 4) +#define R_HASH_KEY_BUFF (0x28 / 4)#define R_HASH_SRC_LEN (0x2c / 4)#define R_HASH_CMD (0x30 / 4)
@@ -210,6 +211,9 @@ static void aspeed_hace_write(void *opaque, hwaddr addr, uint64_t data,case R_HASH_DEST : data &= ahc->dest_mask;break ; +case R_HASH_KEY_BUFF : + data &= ahc->key_mask; +break ;case R_HASH_SRC_LEN : data &=0x0FFFFFFF ;break ;
@@ -333,6 +337,7 @@ static void aspeed_ast2400_hace_class_init(ObjectClass *klass, void *data) ahc->src_mask =0x0FFFFFFF ; ahc->dest_mask =0x0FFFFFF8 ; + ahc->key_mask =0x0FFFFFC0 ; ahc->hash_mask =0x000003ff ;/* No SG or SHA512 modes */ }
@@ -351,6 +356,7 @@ static void aspeed_ast2500_hace_class_init(ObjectClass *klass, void *data) ahc->src_mask =0x3fffffff ; ahc->dest_mask =0x3ffffff8 ; + ahc->key_mask =0x3FFFFFC0 ; ahc->hash_mask =0x000003ff ;/* No SG or SHA512 modes */ }
@@ -369,6 +375,7 @@ static void aspeed_ast2600_hace_class_init(ObjectClass *klass, void *data) ahc->src_mask =0x7FFFFFFF ; ahc->dest_mask =0x7FFFFFF8 ; + ahc->key_mask =0x7FFFFFF8 ; ahc->hash_mask =0x00147FFF ; }
Signature · 1 line
2.35.1
[PULL 18/19] hw/gpio/aspeed_gpio: Fix QOM pin property
In reply to Cédric Le GoaterFrom: Peter Delevoryas <[email protected]>
I was setting gpioV4-7 to "1110" using the QOM pin property handler and noticed that lowering gpioV7 was inadvertently lowering gpioV4-6 too.
(qemu) qom-set /machine/soc/gpio gpioV4 true
(qemu) qom-set /machine/soc/gpio gpioV5 true
(qemu) qom-set /machine/soc/gpio gpioV6 true
(qemu) qom-get /machine/soc/gpio gpioV4
true
(qemu) qom-set /machine/soc/gpio gpioV7 false
(qemu) qom-get /machine/soc/gpio gpioV4
false
An expression in aspeed_gpio_set_pin_level was using a logical NOT operator instead of a bitwise NOT operator:
value &= !pin_mask;
The original author probably intended to make a bitwise NOT expression "~", but mistakenly used a logical NOT operator "!" instead. Some programming languages like Rust use "!" for both purposes.
AST2500")
Message-Id: <[email protected]>
--- hw/gpio/aspeed_gpio.c | 2 +- tests/qtest/aspeed_gpio-test.c | 87 ++++++++++++++++++++++++++++++++++ tests/qtest/meson.build | 3 +- 3 files changed, 90 insertions(+), 2 deletions(-) create mode 100644 tests/qtest/aspeed_gpio-test.c
hw/gpio/aspeed_gpio.c +1 -1
@@ -312,7 +312,7 @@ static void aspeed_gpio_set_pin_level(AspeedGPIOState *s, uint32_t set_idx,if (level) { value |= pin_mask; }else { - value &= !pin_mask; + value &= ~pin_mask; }aspeed_gpio_update (s, &s->sets[set_idx], value);
tests/qtest/aspeed_gpio-test.c new file +87 -0
87 lines not on this page · raw message
tests/qtest/meson.build +2 -1
@@ -189,7 +189,8 @@ qtests_npcm7xx = \ (slirp.found() ? ['npcm7xx_emc-test'] : []) qtests_aspeed = \ ['aspeed_hace-test', - 'aspeed_smc-test'] + 'aspeed_smc-test', + 'aspeed_gpio-test'] qtests_arm = \ (config_all_devices.has_key('CONFIG_MPS2') ? ['sse-timer-test'] : []) + \ (config_all_devices.has_key('CONFIG_CMSDK_APB_DUALTIMER') ? ['cmsdk-apb-dualtimer-test'] : []) + \
Signature · 1 line
2.35.1
[PULL 19/19] aspeed/hace: Support AST1030 HACE
In reply to Cédric Le GoaterFrom: Steven Lee <[email protected]>
Per ast1030_v7.pdf, AST1030 HACE engine is identical to AST2600's HACE engine.
--- include/hw/misc/aspeed_hace.h | 2 ++ hw/misc/aspeed_hace.c | 20 ++++++++++++++++++++ 2 files changed, 22 insertions(+)
include/hw/misc/aspeed_hace.h +2 -0
@@ -15,6 +15,8 @@#define TYPE_ASPEED_AST2400_HACE TYPE_ASPEED_HACE "-ast2400"#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" + OBJECT_DECLARE_TYPE(AspeedHACEState, AspeedHACEClass, ASPEED_HACE)#define ASPEED_HACE_NR_REGS (0x64 >> 2)
hw/misc/aspeed_hace.c +20 -0
@@ -507,11 +507,31 @@ static const TypeInfo aspeed_ast2600_hace_info = { .class_init = aspeed_ast2600_hace_class_init, }; +static void aspeed_ast1030_hace_class_init (ObjectClass *klass,void *data) +{ +DeviceClass *dc =DEVICE_CLASS (klass); +AspeedHACEClass *ahc =ASPEED_HACE_CLASS (klass); + + dc->desc ="AST1030 Hash and Crypto Engine" ; + + ahc->src_mask =0x7FFFFFFF ; + ahc->dest_mask =0x7FFFFFF8 ; + ahc->key_mask =0x7FFFFFF8 ; + ahc->hash_mask =0x00147FFF ; +} + +static const TypeInfo aspeed_ast1030_hace_info = { + .name =TYPE_ASPEED_AST1030_HACE , + .parent =TYPE_ASPEED_HACE , + .class_init = aspeed_ast1030_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_hace_info); }
Signature · 1 line
2.35.1
[PULL 17/19] tests/qtest: Add test for Aspeed HACE accumulative mode
In reply to Cédric Le GoaterFrom: Steven Lee <[email protected]>
This add two addition test cases for accumulative mode under sg enabled.
The input vector was manually craft with "abc" + bit 1 + padding zeros + L. The padding length depends on algorithm, i.e. SHA512 (1024 bit), SHA256 (512 bit).
The result was calculated by command line sha512sum/sha256sum utilities without padding, i.e. only "abc" ascii text.
Message-Id: <[email protected]>
--- tests/qtest/aspeed_hace-test.c | 147 +++++++++++++++++++++++++++++++++ 1 file changed, 147 insertions(+)
tests/qtest/aspeed_hace-test.c +147 -0
@@ -20,6 +20,7 @@#define HACE_ALGO_SHA512 (BIT(5) | BIT(6))#define HACE_ALGO_SHA384 (BIT(5) | BIT(6) | BIT(10))#define HACE_SG_EN BIT(18) +#define HACE_ACCUM_EN BIT(8)#define HACE_STS 0x1c#define HACE_RSA_ISR BIT(13)
@@ -95,6 +96,57 @@ static const uint8_t test_result_sg_sha256[] = {0x55 ,0x1e ,0x1e ,0xc5 ,0x80 ,0xdd ,0x6d ,0x5a ,0x6e ,0xcd ,0xe9 ,0xf3 , 0xd3, 0x5e, 0x6e, 0x4a, 0x71, 0x7f, 0xbd, 0xe4}; +/* +* The accumulative mode requires firmware to provide internal initial state +* and message padding (including length L at the end of padding). +* +* This test vector is a ascii text "abc" with padding message. +* +* Expected results were generated using command line utitiles: +* +* echo -n -e 'abc' | dd of=/tmp/test +* for hash in sha512sum sha256sum; do $hash /tmp/test; done +*/ +static const uint8_t test_vector_accum_512[] = { +0x61 ,0x62 ,0x63 ,0x80 ,0x00 ,0x00 ,0x00 ,0x00 , +0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 , +0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 , +0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 , +0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 , +0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 , +0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 , +0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 , +0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 , +0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 , +0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 , +0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 , +0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 , +0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 , +0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 , +0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x18 }; + +static const uint8_t test_vector_accum_256[] = { +0x61 ,0x62 ,0x63 ,0x80 ,0x00 ,0x00 ,0x00 ,0x00 , +0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 , +0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 , +0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 , +0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 , +0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 , +0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 , +0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x18 }; + +static const uint8_t test_result_accum_sha512[] = { +0xdd ,0xaf ,0x35 ,0xa1 ,0x93 ,0x61 ,0x7a ,0xba ,0xcc ,0x41 ,0x73 ,0x49 , +0xae ,0x20 ,0x41 ,0x31 ,0x12 ,0xe6 ,0xfa ,0x4e ,0x89 ,0xa9 ,0x7e ,0xa2 , +0x0a ,0x9e ,0xee ,0xe6 ,0x4b ,0x55 ,0xd3 ,0x9a ,0x21 ,0x92 ,0x99 ,0x2a , +0x27 ,0x4f ,0xc1 ,0xa8 ,0x36 ,0xba ,0x3c ,0x23 ,0xa3 ,0xfe ,0xeb ,0xbd , +0x45 ,0x4d ,0x44 ,0x23 ,0x64 ,0x3c ,0xe8 ,0x0e ,0x2a ,0x9a ,0xc9 ,0x4f , +0xa5 ,0x4c ,0xa4 ,0x9f }; + +static const uint8_t test_result_accum_sha256[] = { +0xba ,0x78 ,0x16 ,0xbf ,0x8f ,0x01 ,0xcf ,0xea ,0x41 ,0x41 ,0x40 ,0xde , +0x5d ,0xae ,0x22 ,0x23 ,0xb0 ,0x03 ,0x61 ,0xa3 ,0x96 ,0x17 ,0x7a ,0x9c , +0xb4 ,0x10 ,0xff ,0x61 ,0xf2 ,0x00 ,0x15 ,0xad };static void write_regs (QTestState *s,uint32_t base,uint32_t src,uint32_t length,uint32_t out,uint32_t method)
@@ -307,6 +359,88 @@ static void test_sha512_sg(const char *machine, const uint32_t base,qtest_quit (s); } +static void test_sha256_accum (const char *machine,const uint32_t base, +const uint32_t src_addr) +{ +QTestState *s =qtest_init (machine); + +const uint32_t buffer_addr = src_addr +0x1000000 ; +const uint32_t digest_addr = src_addr +0x4000000 ; +uint8_t digest[32 ] = {0 }; +struct AspeedSgList array[] = { + {cpu_to_le32 (sizeof (test_vector_accum_256) |SG_LIST_LEN_LAST ), +cpu_to_le32 (buffer_addr) }, + }; + +/* Check engine is idle, no busy or irq bits set */ + g_assert_cmphex(qtest_readl(s, base + HACE_STS), ==, 0); + +/* Write test vector into memory */ +qtest_memwrite (s, buffer_addr, test_vector_accum_256, +sizeof (test_vector_accum_256)); +qtest_memwrite (s, src_addr, array,sizeof (array)); + +write_regs (s, base, src_addr,sizeof (test_vector_accum_256), + digest_addr,HACE_ALGO_SHA256 |HACE_SG_EN |HACE_ACCUM_EN ); + +/* Check hash IRQ status is asserted */ + g_assert_cmphex(qtest_readl(s, base + HACE_STS), ==, 0x00000200); + +/* Clear IRQ status and check status is deasserted */ +qtest_writel (s, base +HACE_STS ,0x00000200 ); + g_assert_cmphex(qtest_readl(s, base + HACE_STS), ==, 0); + +/* Read computed digest from memory */ +qtest_memread (s, digest_addr, digest,sizeof (digest)); + +/* Check result of computation */ +g_assert_cmpmem (digest,sizeof (digest), + test_result_accum_sha256,sizeof (digest)); + +qtest_quit (s); +} + +static void test_sha512_accum (const char *machine,const uint32_t base, +const uint32_t src_addr) +{ +QTestState *s =qtest_init (machine); + +const uint32_t buffer_addr = src_addr +0x1000000 ; +const uint32_t digest_addr = src_addr +0x4000000 ; +uint8_t digest[64 ] = {0 }; +struct AspeedSgList array[] = { + {cpu_to_le32 (sizeof (test_vector_accum_512) |SG_LIST_LEN_LAST ), +cpu_to_le32 (buffer_addr) }, + }; + +/* Check engine is idle, no busy or irq bits set */ + g_assert_cmphex(qtest_readl(s, base + HACE_STS), ==, 0); + +/* Write test vector into memory */ +qtest_memwrite (s, buffer_addr, test_vector_accum_512, +sizeof (test_vector_accum_512)); +qtest_memwrite (s, src_addr, array,sizeof (array)); + +write_regs (s, base, src_addr,sizeof (test_vector_accum_512), + digest_addr,HACE_ALGO_SHA512 |HACE_SG_EN |HACE_ACCUM_EN ); + +/* Check hash IRQ status is asserted */ + g_assert_cmphex(qtest_readl(s, base + HACE_STS), ==, 0x00000200); + +/* Clear IRQ status and check status is deasserted */ +qtest_writel (s, base +HACE_STS ,0x00000200 ); + g_assert_cmphex(qtest_readl(s, base + HACE_STS), ==, 0); + +/* Read computed digest from memory */ +qtest_memread (s, digest_addr, digest,sizeof (digest)); + +/* Check result of computation */ +g_assert_cmpmem (digest,sizeof (digest), + test_result_accum_sha512,sizeof (digest)); + +qtest_quit (s); +} +struct masks {uint32_t src;uint32_t dest;
@@ -395,6 +529,16 @@ static void test_sha512_sg_ast2600(void)test_sha512_sg ("-machine ast2600-evb" ,0x1e6d0000 ,0x80000000 ); } +static void test_sha256_accum_ast2600 (void ) +{ +test_sha256_accum ("-machine ast2600-evb" ,0x1e6d0000 ,0x80000000 ); +} + +static void test_sha512_accum_ast2600 (void ) +{ +test_sha512_accum ("-machine ast2600-evb" ,0x1e6d0000 ,0x80000000 ); +} +static void test_addresses_ast2600 (void ) {test_addresses ("-machine ast2600-evb" ,0x1e6d0000 , &ast2600_masks);
@@ -454,6 +598,9 @@ int main(int argc, char **argv)qtest_add_func ("ast2600/hace/sha512_sg" , test_sha512_sg_ast2600);qtest_add_func ("ast2600/hace/sha256_sg" , test_sha256_sg_ast2600); +qtest_add_func ("ast2600/hace/sha512_accum" , test_sha512_accum_ast2600); +qtest_add_func ("ast2600/hace/sha256_accum" , test_sha256_accum_ast2600); +qtest_add_func ("ast2500/hace/addresses" , test_addresses_ast2500);qtest_add_func ("ast2500/hace/sha512" , test_sha512_ast2500);qtest_add_func ("ast2500/hace/sha256" , test_sha256_ast2500);
Signature · 1 line
2.35.1
[PULL 07/19] aspeed/wdt: Fix ast2500/ast2600 default reload value
In reply to Cédric Le GoaterFrom: Steven Lee <[email protected]>
Per ast2500_2520_datasheet_v1.8 and ast2600v11.pdf, the default value of WDT00 and WDT04 is 0x014FB180 for ast2500/ast2600.
Add default_status and default_reload_value attributes for storing counter status and reload value as they are different from ast2400.
Message-Id: <[email protected]>
--- include/hw/watchdog/wdt_aspeed.h | 2 ++ hw/watchdog/wdt_aspeed.c | 10 ++++++++-- 2 files changed, 10 insertions(+), 2 deletions(-)
include/hw/watchdog/wdt_aspeed.h +2 -0
@@ -45,6 +45,8 @@ struct AspeedWDTClass {void (*reset_pulse)(AspeedWDTState *s,uint32_t property);void (*wdt_reload)(AspeedWDTState *s);uint64_t (*sanitize_ctrl)(uint64_t data); +uint32_t default_status; + uint32_t default_reload_value; };#endif /* WDT_ASPEED_H */
hw/watchdog/wdt_aspeed.c +8 -2
@@ -232,8 +232,8 @@ static void aspeed_wdt_reset(DeviceState *dev)AspeedWDTState *s =ASPEED_WDT (dev);AspeedWDTClass *awc =ASPEED_WDT_GET_CLASS (s); - s->regs[WDT_STATUS ] =0x3EF1480 ; - s->regs[WDT_RELOAD_VALUE ] =0x03EF1480 ; + s->regs[WDT_STATUS ] = awc->default_status; + s->regs[WDT_RELOAD_VALUE ] = awc->default_reload_value; s->regs[WDT_RESTART ] =0 ; s->regs[WDT_CTRL ] = awc->sanitize_ctrl (0 ); s->regs[WDT_RESET_WIDTH ] =0xFF ;
@@ -319,6 +319,8 @@ static void aspeed_2400_wdt_class_init(ObjectClass *klass, void *data) awc->reset_ctrl_reg =SCU_RESET_CONTROL1 ; awc->wdt_reload = aspeed_wdt_reload; awc->sanitize_ctrl = aspeed_2400_sanitize_ctrl; + awc->default_status =0x03EF1480 ; + awc->default_reload_value =0x03EF1480 ; }static const TypeInfo aspeed_2400_wdt_info = {
@@ -355,6 +357,8 @@ static void aspeed_2500_wdt_class_init(ObjectClass *klass, void *data) awc->reset_pulse = aspeed_2500_wdt_reset_pulse; awc->wdt_reload = aspeed_wdt_reload_1mhz; awc->sanitize_ctrl = aspeed_2500_sanitize_ctrl; + awc->default_status =0x014FB180 ; + awc->default_reload_value =0x014FB180 ; }static const TypeInfo aspeed_2500_wdt_info = {
@@ -376,6 +380,8 @@ static void aspeed_2600_wdt_class_init(ObjectClass *klass, void *data) awc->reset_pulse = aspeed_2500_wdt_reset_pulse; awc->wdt_reload = aspeed_wdt_reload_1mhz; awc->sanitize_ctrl = aspeed_2600_sanitize_ctrl; + awc->default_status =0x014FB180 ; + awc->default_reload_value =0x014FB180 ; }static const TypeInfo aspeed_2600_wdt_info = {
Signature · 1 line
2.35.1
[PULL 10/19] aspeed/scu: Add AST1030 support
In reply to Cédric Le GoaterFrom: Steven Lee <[email protected]>
Per ast1030_v07.pdf, AST1030 SOC doesn't have SCU300, the pclk divider selection is defined in SCU310[11:8].
Add a get_apb_freq function and a class init handler for ast1030.
Message-Id: <[email protected]>
--- include/hw/misc/aspeed_scu.h | 25 ++++++++++++++ hw/misc/aspeed_scu.c | 63 ++++++++++++++++++++++++++++++++++++ 2 files changed, 88 insertions(+)
include/hw/misc/aspeed_scu.h +25 -0
@@ -19,6 +19,7 @@ OBJECT_DECLARE_TYPE(AspeedSCUState, AspeedSCUClass, ASPEED_SCU)#define TYPE_ASPEED_2400_SCU TYPE_ASPEED_SCU "-ast2400"#define TYPE_ASPEED_2500_SCU TYPE_ASPEED_SCU "-ast2500"#define TYPE_ASPEED_2600_SCU TYPE_ASPEED_SCU "-ast2600" +#define TYPE_ASPEED_1030_SCU TYPE_ASPEED_SCU "-ast1030"#define ASPEED_SCU_NR_REGS (0x1A8 >> 2)#define ASPEED_AST2600_SCU_NR_REGS (0xE20 >> 2)
@@ -45,6 +46,8 @@ struct AspeedSCUState {#define AST2600_A1_SILICON_REV 0x05010303U#define AST2600_A2_SILICON_REV 0x05020303U#define AST2600_A3_SILICON_REV 0x05030303U +#define AST1030_A0_SILICON_REV 0x80000000U +#define AST1030_A1_SILICON_REV 0x80010000U#define ASPEED_IS_AST2500 (si_rev) ((((si_rev) >> 24) & 0xff) == 0x04)
@@ -336,4 +339,26 @@ uint32_t aspeed_scu_get_apb_freq(AspeedSCUState *s);#define SCU_AST2600_H_PLL_BYPASS_EN (0x1 << 24)#define SCU_AST2600_H_PLL_OFF (0x1 << 23) +/* +* SCU310 Clock Selection Register Set 4 (for Aspeed AST1030 SOC) +* +* 31 I3C Clock Source selection +* 30:28 I3C clock divider selection +* 26:24 MAC AHB clock divider selection +* 22:20 RGMII 125MHz clock divider ration +* 19:16 RGMII 50MHz clock divider ration +* 15 LHCLK clock generation/output enable control +* 14:12 LHCLK divider selection +* 11:8 APB Bus PCLK divider selection +* 7 Select PECI clock source +* 6 Select UART debug port clock source +* 5 Select UART6 clock source +* 4 Select UART5 clock source +* 3 Select UART4 clock source +* 2 Select UART3 clock source +* 1 Select UART2 clock source +* 0 Select UART1 clock source +*/ +#define SCU_AST1030_CLK_GET_PCLK_DIV (x) (((x) >> 8) & 0xf) +#endif /* ASPEED_SCU_H */
hw/misc/aspeed_scu.c +63 -0
87 lines not on this page · raw message
Signature · 1 line
2.35.1
[PULL 14/19] hw/arm/aspeed: fix AST2500/AST2600 EVB fmc model
In reply to Cédric Le GoaterFrom: Jae Hyun Yoo <[email protected]>
Current fmc model of AST2500 EVB and AST2600 EVB can't emulate quad mode properly so fix them using equivalent mx25l25635e and mx66u51235f respectively.
These default settings still can be overridden using the 'fmc-model' command line option.
Message-Id: <[email protected]>
--- hw/arm/aspeed.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
hw/arm/aspeed.c +2 -2
@@ -1093,7 +1093,7 @@ static void aspeed_machine_ast2500_evb_class_init(ObjectClass *oc, void *data) mc->desc ="Aspeed AST2500 EVB (ARM1176)" ; amc->soc_name ="ast2500-a1" ; amc->hw_strap1 =AST2500_EVB_HW_STRAP1 ; - amc->fmc_model ="w25q256" ; + amc->fmc_model ="mx25l25635e" ; amc->spi_model ="mx25l25635e" ; amc->num_cs =1 ; amc->i2c_init = ast2500_evb_i2c_init;
@@ -1162,7 +1162,7 @@ static void aspeed_machine_ast2600_evb_class_init(ObjectClass *oc, void *data) amc->soc_name ="ast2600-a3" ; amc->hw_strap1 =AST2600_EVB_HW_STRAP1 ; amc->hw_strap2 =AST2600_EVB_HW_STRAP2 ; - amc->fmc_model ="w25q512jv" ; + amc->fmc_model ="mx66u51235f" ; amc->spi_model ="mx66u51235f" ; amc->num_cs =1 ; amc->macs_mask = ASPEED_MAC0_ON | ASPEED_MAC1_ON | ASPEED_MAC2_ON |
Signature · 1 line
2.35.1
[PULL 16/19] aspeed/hace: Support AST2600 HACE
In reply to Cédric Le GoaterFrom: Steven Lee <[email protected]>
The aspeed ast2600 accumulative mode is described in datasheet ast2600v10.pdf section 25.6.4:
1. Allocating and initiating accumulative hash digest write buffer with initial state.
* Since QEMU crypto/hash api doesn't provide the API to set initial state of hash library, and the initial state is already set by crypto library (gcrypt/glib/...), so skip this step.
2. Calculating accumulative hash digest.
(a) When receiving the last accumulative data, software need to add padding message at the end of the accumulative data. Padding message described in specific of MD5, SHA-1, SHA224, SHA256, SHA512, SHA512/224, SHA512/256.
* Since the crypto library (gcrypt/glib) already pad the padding message internally.
* This patch is to remove the padding message which fed byguest machine driver.
Message-Id: <[email protected]>
--- include/hw/misc/aspeed_hace.h | 4 ++ hw/misc/aspeed_hace.c | 132 ++++++++++++++++++++++++++++++++-- 2 files changed, 131 insertions(+), 5 deletions(-)
include/hw/misc/aspeed_hace.h +4 -0
@@ -18,6 +18,7 @@ OBJECT_DECLARE_TYPE(AspeedHACEState, AspeedHACEClass, ASPEED_HACE)#define ASPEED_HACE_NR_REGS (0x64 >> 2) +#define ASPEED_HACE_MAX_SG 256/* max number of entries */ struct AspeedHACEState {SysBusDevice parent;
@@ -25,7 +26,10 @@ struct AspeedHACEState {MemoryRegion iomem;qemu_irq irq; +struct iovec iov_cache[ASPEED_HACE_MAX_SG ];uint32_t regs[ASPEED_HACE_NR_REGS ]; +uint32_t total_req_len; +uint32_t iov_count;MemoryRegion *dram_mr;AddressSpace dram_as;
hw/misc/aspeed_hace.c +127 -5
180 lines not on this page · raw message
Signature · 1 line
2.35.1
Richard Henderson
AppliedQuoted 15 lines · Cédric Le Goater
The following changes since commit
f5643914a9e8f79c606a76e6a9d7ea82a3fc3e65:Merge tag 'pull-9p-20220501' of https://github.com/cschoenebeck/qemu into staging (2022-05-01 07:48:11 -0700)are available in the Git repository at:
https://github.com/legoater/qemu/ tags/pull-aspeed-20220503for you to fetch changes up to
e056c52233910ef156e6d790ce41b33cd838bad6:aspeed/hace: Support AST1030 HACE (2022-05-03 07:17:20 +0200)----------------------------------------------------------------
aspeed queue:
Quoted 6 lines
* New AST1030 SoC and eval board
* Accumulative mode support for HACE controller
* GPIO fix and unit test
* Clock modeling adjustments for the AST2600
* Dummy eMMC Boot Controller model
* Change of AST2500 EVB and AST2600 EVB flash model (for quad IO)
Applied, thanks. Please update https://wiki.qemu.org/ChangeLog/7.1 as appropriate.
r~
Quoted 58 lines
----------------------------------------------------------------
Jae Hyun Yoo (1):
hw/arm/aspeed: fix AST2500/AST2600 EVB fmc modelJamin Lin (2):
aspeed: Add an AST1030 eval boardtest/avocado/machine_aspeed.py: Add ast1030 test caseJoel Stanley (2):
aspeed: sbc: Correct default reset values
aspeed: Add eMMC Boot Controller stubPeter Delevoryas (1):
hw/gpio/aspeed_gpio: Fix QOM pin propertySteven Lee (13):
hw:aspeed_scu: Add AST2600apb_freqand hpll calculation function
hw:aspeed_scu: Introduceclkin_25Mhzattribute aspeed/adc: Add AST1030 support
aspeed/smc: Add AST1030 support
aspeed/wdt: Fix ast2500/ast2600 default reload value aspeed/wdt: Add AST1030 support
aspeed/timer: Add AST1030 support
aspeed/scu: Add AST1030 support
aspeed/soc : Add AST1030 support
aspeed/hace: Support HMAC Key Buffer register. aspeed/hace: Support AST2600 HACE
tests/qtest: Add test for Aspeed HACE accumulative mode aspeed/hace: Support AST1030 HACEinclude/hw/adc/aspeed_adc.h | 1 + include/hw/arm/aspeed_soc.h | 4 + include/hw/misc/aspeed_hace.h | 7 + include/hw/misc/aspeed_scu.h | 45 ++++++ include/hw/timer/aspeed_timer.h | 1 + include/hw/watchdog/wdt_aspeed.h | 3 + hw/adc/aspeed_adc.c | 16 +++ hw/arm/aspeed.c | 70 ++++++++- hw/arm/aspeed_ast10x0.c | 299 +++++++++++++++++++++++++++++++++++++++ hw/arm/aspeed_ast2600.c | 6 + hw/gpio/aspeed_gpio.c | 2 +- hw/misc/aspeed_hace.c | 159 ++++++++++++++++++++- hw/misc/aspeed_sbc.c | 7 +- hw/misc/aspeed_scu.c | 108 +++++++++++++- hw/ssi/aspeed_smc.c | 157 ++++++++++++++++++++ hw/timer/aspeed_timer.c | 17 +++ hw/watchdog/wdt_aspeed.c | 34 ++++- tests/qtest/aspeed_gpio-test.c | 87 ++++++++++++ tests/qtest/aspeed_hace-test.c | 147 +++++++++++++++++++ hw/arm/meson.build | 6 +- tests/avocado/machine_aspeed.py | 36 +++++ tests/qtest/meson.build | 3 +- 22 files changed, 1199 insertions(+), 16 deletions(-)create mode 100644
hw/arm/aspeed_ast10x0.ccreate mode 100644tests/qtest/aspeed_gpio-test.ccreate mode 100644tests/avocado/machine_aspeed.py