aspeed queue (v2)
Subsystems (2)
The following changes since commit 609d7596524ab204ccd71ef42c9eee4c7c338ea4:
Update version for v6.0.0 release (2021-04-29 18:05:29 +0100)
are available in the Git repository at:
https://github.com/legoater/qemu/ tags/pull-aspeed-20210503
for you to fetch changes up to 9cccb912cfa865f0bae6b156fa94e2f216dd8835:
aspeed: Add support for the quanta-q7l1-bmc board (2021-05-01 10:03:52 +0200)
----------------------------------------------------------------
Aspeed patches :
* Fixes for the DMA space
* New model for ASPEED's Hash and Crypto Engine (Joel and Klaus)
* Acceptance tests (Joel)
* A fix for the XDMA model
* Some extra features for the SMC controller.
* Two new boards : rainier-bmc and quanta-q7l1-bmc (Patrick)
----------------------------------------------------------------
Cédric Le Goater (11):
aspeed/smc: Use the RAM memory region for DMAs aspeed/smc: Remove unused "sdram-base" property aspeed/i2c: Fix DMA address mask
aspeed/i2c: Rename DMA address space hw/misc/aspeed_xdma: Add AST2600 support aspeed/smc: Add a 'features' attribute to the object class aspeed/smc: Add extra controls to request DMA tests/qtest: Rename m25p80 test in aspeed_smc test
aspeed: Deprecate the swift-bmc machine
aspeed: Add support for the rainier-bmc board hw/block: m25p80: Add support for mt25ql02g and mt25qu02g
Joel Stanley (5):
hw: Model ASPEED's Hash and Crypto Engine
aspeed: Integrate HACE
tests/qtest: Add test for Aspeed HACE tests/acceptance: Test ast2400 and ast2500 machines tests/acceptance: Test ast2600 machine
Patrick Venture (1):
aspeed: Add support for the quanta-q7l1-bmc board
Philippe Mathieu-Daudé (1):
hw/arm/aspeed: Do not sysbus-map mmio flash region directly, use alias
docs/system/arm/aspeed.rst | 2 +-
docs/system/deprecated.rst | 7 +
include/hw/arm/aspeed_soc.h | 3 +
include/hw/misc/aspeed_hace.h | 43 +++
include/hw/misc/aspeed_xdma.h | 17 +-
include/hw/ssi/aspeed_smc.h | 7 +-
hw/arm/aspeed.c | 146 ++++++-
hw/arm/aspeed_ast2600.c | 22 +-
hw/arm/aspeed_soc.c | 23 +-
hw/block/m25p80.c | 2 +
hw/i2c/aspeed_i2c.c | 5 +-
hw/misc/aspeed_hace.c | 389 +++++++++++++++++++
hw/misc/aspeed_xdma.c | 124 ++++--
hw/ssi/aspeed_smc.c | 119 ++++--
tests/qtest/aspeed_hace-test.c | 469 +++++++++++++++++++++++
tests/qtest/{m25p80-test.c => aspeed_smc-test.c} | 12 +-
MAINTAINERS | 1 +
hw/misc/meson.build | 1 +
tests/acceptance/boot_linux_console.py | 68 ++++
tests/qtest/meson.build | 5 +-
20 files changed, 1389 insertions(+), 76 deletions(-)
create mode 100644 include/hw/misc/aspeed_hace.h
create mode 100644 hw/misc/aspeed_hace.c
create mode 100644 tests/qtest/aspeed_hace-test.c
rename tests/qtest/{m25p80-test.c => aspeed_smc-test.c} (96%)[PULL 15/18] aspeed: Deprecate the swift-bmc machine
The SWIFT machine never came out of the lab and we already have enough AST2500 based OpenPower machines.
--- docs/system/deprecated.rst | 7 +++++++ hw/arm/aspeed.c | 3 +++ 2 files changed, 10 insertions(+)
docs/system/deprecated.rst +7 -0
@@ -245,6 +245,13 @@ The Raspberry Pi machines come in various models (A, A+, B, B+). To be able to distinguish which model QEMU is implementing, the ``raspi2`` and ``raspi3`` machines have been renamed ``raspi2b`` and ``raspi3b``. +Aspeed ``swift-bmc`` machine (since 6.1) +'''''''''''''''''''''''''''''''''''''''' + +This machine is deprecated because we have enough AST2500 based OpenPOWER +machines. It can be easily replaced by the ``witherspoon-bmc`` or the +``romulus-bmc`` machines. + Device options --------------
hw/arm/aspeed.c +3 -0
@@ -811,6 +811,9 @@ static void aspeed_machine_swift_class_init(ObjectClass *oc, void *data) mc->default_ram_size =512 * MiB; mc->default_cpus = mc->min_cpus = mc->max_cpus =aspeed_soc_num_cpus (amc->soc_name); + + mc->deprecation_reason ="redundant system. Please use a similar " +"OpenPOWER BMC, Witherspoon or Romulus." ; };static void aspeed_machine_witherspoon_class_init (ObjectClass *oc,void *data)
Signature · 1 line
2.26.3
[PULL 01/18] aspeed/smc: Use the RAM memory region for DMAs
In reply to Cédric Le GoaterInstead of passing the memory address space region, simply use the RAM memory region instead. This simplifies RAM accesses.
This patch breaks migration compatibility.
Message-Id: <[email protected]>
--- hw/arm/aspeed.c | 2 +- hw/ssi/aspeed_smc.c | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-)
hw/arm/aspeed.c +1 -1
@@ -327,7 +327,7 @@ static void aspeed_machine_init(MachineState *machine)object_property_set_int (OBJECT (&bmc->soc),"num-cs" , amc->num_cs, &error_abort);object_property_set_link (OBJECT (&bmc->soc),"dram" , -OBJECT (&bmc->ram_container), &error_abort); +OBJECT (machine->ram), &error_abort);if (machine->kernel_filename) {/* * When booting with a -kernel command line there is no u-boot
hw/ssi/aspeed_smc.c +1 -2
@@ -178,8 +178,7 @@* 0: 4 bytes * 0x7FFFFF: 32M bytes */ -#define DMA_DRAM_ADDR (s, val) ((s)->sdram_base | \ - ((val) & (s)->ctrl->dma_dram_mask)) +#define DMA_DRAM_ADDR (s, val) ((val) & (s)->ctrl->dma_dram_mask)#define DMA_FLASH_ADDR (s, val) ((s)->ctrl->flash_window_base | \ ((val) & (s)->ctrl->dma_flash_mask))#define DMA_LENGTH (val) ((val) & 0x01FFFFFC)
Signature · 1 line
2.26.3
[PULL 03/18] aspeed/i2c: Fix DMA address mask
In reply to Cédric Le GoaterThe RAM memory region is now used for DMAs accesses instead of the memory address space region. Mask off the top bits of the DMA address to reflect this change.
Message-Id: <[email protected]>
--- hw/i2c/aspeed_i2c.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
hw/i2c/aspeed_i2c.c +1 -1
@@ -601,7 +601,7 @@ static void aspeed_i2c_bus_write(void *opaque, hwaddr offset,break ; } - bus->dma_addr = value &0xfffffffc ; + bus->dma_addr = value &0x3ffffffc ;break ;case I2CD_DMA_LEN :
Signature · 1 line
2.26.3
[PULL 04/18] aspeed/i2c: Rename DMA address space
In reply to Cédric Le GoaterIt improves 'info mtree' output.
Message-Id: <[email protected]>
--- hw/i2c/aspeed_i2c.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
hw/i2c/aspeed_i2c.c +2 -1
@@ -816,7 +816,8 @@ static void aspeed_i2c_realize(DeviceState *dev, Error **errp)return ; } -address_space_init (&s->dram_as, s->dram_mr,"dma-dram" ); +address_space_init (&s->dram_as, s->dram_mr, +TYPE_ASPEED_I2C "-dma-dram" ); } }
Signature · 1 line
2.26.3
[PULL 10/18] tests/acceptance: Test ast2600 machine
In reply to Cédric Le GoaterFrom: Joel Stanley <[email protected]>
This tests a Debian multi-soc arm32 Linux kernel on the AST2600 based Tacoma BMC machine.
There is no root file system so the test terminates when boot reaches the stage where it attempts and fails to mount something.
[ clg : - removed comment
- removed ending self.vm.shutdown() ]
Message-Id: <[email protected]>
Message-Id: <[email protected]>
--- tests/acceptance/boot_linux_console.py | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+)
tests/acceptance/boot_linux_console.py +25 -0
@@ -1053,6 +1053,31 @@ def do_test_arm_aspeed(self, image): self.wait_for_console_pattern("ftgmac100 1e660000.ethernet eth0: irq ") self.wait_for_console_pattern("systemd[1]: Set hostname to") + def test_arm_ast2600_debian(self): + """ + :avocado: tags=arch:arm + :avocado: tags=machine:tacoma-bmc + """ + deb_url = ('http://snapshot.debian.org/archive/debian/' + '20210302T203551Z/' + 'pool/main/l/linux/' + 'linux-image-5.10.0-3-armmp_5.10.13-1_armhf.deb') + deb_hash = 'db40d32fe39255d05482bea48d72467b67d6225bb2a2a4d6f618cb8976f1e09e' + deb_path = self.fetch_asset(deb_url, asset_hash=deb_hash, + algorithm='sha256') + kernel_path = self.extract_from_deb(deb_path, '/boot/vmlinuz-5.10.0-3-armmp') + dtb_path = self.extract_from_deb(deb_path, + '/usr/lib/linux-image-5.10.0-3-armmp/aspeed-bmc-opp-tacoma.dtb') + + self.vm.set_console() + self.vm.add_args('-kernel', kernel_path, + '-dtb', dtb_path, + '-net', 'nic') + self.vm.launch() + self.wait_for_console_pattern("Booting Linux on physical CPU 0xf00") + self.wait_for_console_pattern("SMP: Total of 2 processors activated") + self.wait_for_console_pattern("No filesystem could mount root") + def test_m68k_mcf5208evb(self): """ :avocado: tags=arch:m68k
Signature · 1 line
2.26.3
[PULL 05/18] hw/arm/aspeed: Do not sysbus-map mmio flash region directly, use alias
In reply to Cédric Le GoaterFrom: Philippe Mathieu-Daudé <[email protected]>
The flash mmio region is exposed as an AddressSpace. AddressSpaces must not be sysbus-mapped, therefore map the region using an alias.
Message-Id: <[email protected]>
Message-Id: <[email protected]>
--- include/hw/ssi/aspeed_smc.h | 1 + hw/ssi/aspeed_smc.c | 7 ++++--- 2 files changed, 5 insertions(+), 3 deletions(-)
include/hw/ssi/aspeed_smc.h +1 -0
@@ -84,6 +84,7 @@ struct AspeedSMCState {MemoryRegion mmio;MemoryRegion mmio_flash; +MemoryRegion mmio_flash_alias;qemu_irq irq;int irqline;
hw/ssi/aspeed_smc.c +4 -3
@@ -179,8 +179,7 @@* 0x7FFFFF: 32M bytes */ #define DMA_DRAM_ADDR (s, val) ((val) & (s)->ctrl->dma_dram_mask) -#define DMA_FLASH_ADDR (s, val) ((s)->ctrl->flash_window_base | \ - ((val) & (s)->ctrl->dma_flash_mask)) +#define DMA_FLASH_ADDR (s, val) ((val) & (s)->ctrl->dma_flash_mask)#define DMA_LENGTH (val) ((val) & 0x01FFFFFC)/* Flash opcodes. */
@@ -1385,7 +1384,9 @@ static void aspeed_smc_realize(DeviceState *dev, Error **errp)memory_region_init_io (&s->mmio_flash,OBJECT (s), &aspeed_smc_flash_default_ops, s, name, s->ctrl->flash_window_size); -sysbus_init_mmio (sbd, &s->mmio_flash); +memory_region_init_alias (&s->mmio_flash_alias,OBJECT (s), name, + &s->mmio_flash,0 , s->ctrl->flash_window_size); +sysbus_init_mmio (sbd, &s->mmio_flash_alias); s->flashes =g_new0 (AspeedSMCFlash, s->ctrl->max_peripherals);
Signature · 1 line
2.26.3
[PULL 11/18] hw/misc/aspeed_xdma: Add AST2600 support
In reply to Cédric Le GoaterWhen we introduced support for the AST2600 SoC, the XDMA controller was forgotten. It went unnoticed because it's not used under emulation. But the register layout being different, the reset procedure is bogus and this breaks kexec.
Add a AspeedXDMAClass to take into account the register differences.
Message-Id: <[email protected]>
--- include/hw/misc/aspeed_xdma.h | 17 ++++- hw/arm/aspeed_ast2600.c | 3 +- hw/arm/aspeed_soc.c | 3 +- hw/misc/aspeed_xdma.c | 124 +++++++++++++++++++++++++++------- 4 files changed, 121 insertions(+), 26 deletions(-)
include/hw/misc/aspeed_xdma.h +16 -1
@@ -13,7 +13,10 @@#include "qom/object.h" #define TYPE_ASPEED_XDMA "aspeed.xdma" -OBJECT_DECLARE_SIMPLE_TYPE(AspeedXDMAState, ASPEED_XDMA) +#define TYPE_ASPEED_2400_XDMA TYPE_ASPEED_XDMA "-ast2400" +#define TYPE_ASPEED_2500_XDMA TYPE_ASPEED_XDMA "-ast2500" +#define TYPE_ASPEED_2600_XDMA TYPE_ASPEED_XDMA "-ast2600" +OBJECT_DECLARE_TYPE(AspeedXDMAState, AspeedXDMAClass, ASPEED_XDMA)#define ASPEED_XDMA_NUM_REGS (ASPEED_XDMA_REG_SIZE / sizeof(uint32_t))#define ASPEED_XDMA_REG_SIZE 0x7C
@@ -28,4 +31,16 @@ struct AspeedXDMAState { uint32_t regs[ASPEED_XDMA_NUM_REGS]; }; +struct AspeedXDMAClass { +SysBusDeviceClass parent_class; + +uint8_t cmdq_endp; +uint8_t cmdq_wrp; +uint8_t cmdq_rdp; +uint8_t intr_ctrl; +uint32_t intr_ctrl_mask; +uint8_t intr_status; +uint32_t intr_complete; +}; +#endif /* ASPEED_XDMA_H */
hw/arm/aspeed_ast2600.c +2 -1
@@ -187,7 +187,8 @@ static void aspeed_soc_ast2600_init(Object *obj)object_initialize_child (obj,"mii[*]" , &s->mii[i],TYPE_ASPEED_MII ); } -object_initialize_child (obj,"xdma" , &s->xdma,TYPE_ASPEED_XDMA ); +snprintf (typename,sizeof (typename),TYPE_ASPEED_XDMA "-%s" , socname); +object_initialize_child (obj,"xdma" , &s->xdma, typename);snprintf (typename,sizeof (typename),"aspeed.gpio-%s" , socname);object_initialize_child (obj,"gpio" , &s->gpio, typename);
hw/arm/aspeed_soc.c +2 -1
@@ -199,7 +199,8 @@ static void aspeed_soc_init(Object *obj) TYPE_FTGMAC100); } -object_initialize_child (obj,"xdma" , &s->xdma,TYPE_ASPEED_XDMA ); +snprintf (typename,sizeof (typename),TYPE_ASPEED_XDMA "-%s" , socname); +object_initialize_child (obj,"xdma" , &s->xdma, typename);snprintf (typename,sizeof (typename),"aspeed.gpio-%s" , socname);object_initialize_child (obj,"gpio" , &s->gpio, typename);
hw/misc/aspeed_xdma.c +101 -23
189 lines not on this page · raw message
Signature · 1 line
2.26.3
[PULL 16/18] aspeed: Add support for the rainier-bmc board
In reply to Cédric Le GoaterThe Rainier BMC board is a board for the middle range POWER10 IBM systems.
Message-Id: <[email protected]>
--- hw/arm/aspeed.c | 79 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 79 insertions(+)
hw/arm/aspeed.c +79 -0
@@ -146,6 +146,10 @@ struct AspeedMachineState {#define TACOMA_BMC_HW_STRAP1 0x00000000#define TACOMA_BMC_HW_STRAP2 0x00000040 +/* Rainier hardware value: (QEMU prototype) */ +#define RAINIER_BMC_HW_STRAP1 0x00000000 +#define RAINIER_BMC_HW_STRAP2 0x00000000 +/* * The max ram region is for firmwares that scan the address space * with load/store to guess how much RAM the SoC has.
@@ -629,6 +633,58 @@ static void g220a_bmc_i2c_init(AspeedMachineState *bmc) eeprom_buf); } +static void rainier_bmc_i2c_init (AspeedMachineState *bmc) +{ +AspeedSoCState *soc = &bmc->soc; + +/* The rainier expects a TMP275 but a TMP105 is compatible */ +i2c_slave_create_simple (aspeed_i2c_get_bus (&soc->i2c,4 ),TYPE_TMP105 , +0x48 ); +i2c_slave_create_simple (aspeed_i2c_get_bus (&soc->i2c,4 ),TYPE_TMP105 , +0x49 ); +i2c_slave_create_simple (aspeed_i2c_get_bus (&soc->i2c,4 ),TYPE_TMP105 , +0x4a ); + +i2c_slave_create_simple (aspeed_i2c_get_bus (&soc->i2c,5 ),TYPE_TMP105 , +0x48 ); +i2c_slave_create_simple (aspeed_i2c_get_bus (&soc->i2c,5 ),TYPE_TMP105 , +0x49 ); + +i2c_slave_create_simple (aspeed_i2c_get_bus (&soc->i2c,6 ),TYPE_TMP105 , +0x48 ); +i2c_slave_create_simple (aspeed_i2c_get_bus (&soc->i2c,6 ),TYPE_TMP105 , +0x4a ); +i2c_slave_create_simple (aspeed_i2c_get_bus (&soc->i2c,6 ),TYPE_TMP105 , +0x4b ); + +/* Bus 7: TODO dps310@76 */ +/* Bus 7: TODO max31785@52 */ +i2c_slave_create_simple (aspeed_i2c_get_bus (&soc->i2c,7 ),"pca9552" ,0x61 ); +/* Bus 7: TODO si7021-a20@20 */ +i2c_slave_create_simple (aspeed_i2c_get_bus (&soc->i2c,7 ),TYPE_TMP105 , +0x48 ); + +i2c_slave_create_simple (aspeed_i2c_get_bus (&soc->i2c,8 ),TYPE_TMP105 , +0x48 ); +i2c_slave_create_simple (aspeed_i2c_get_bus (&soc->i2c,8 ),TYPE_TMP105 , +0x4a ); +i2c_slave_create_simple (aspeed_i2c_get_bus (&soc->i2c,8 ),"pca9552" ,0x61 ); +/* Bus 8: ucd90320@11 */ +/* Bus 8: ucd90320@b */ +/* Bus 8: ucd90320@c */ + +i2c_slave_create_simple (aspeed_i2c_get_bus (&soc->i2c,9 ),"tmp423" ,0x4c ); +i2c_slave_create_simple (aspeed_i2c_get_bus (&soc->i2c,9 ),"tmp423" ,0x4d ); + +i2c_slave_create_simple (aspeed_i2c_get_bus (&soc->i2c,10 ),"tmp423" ,0x4c ); +i2c_slave_create_simple (aspeed_i2c_get_bus (&soc->i2c,10 ),"tmp423" ,0x4d ); + +i2c_slave_create_simple (aspeed_i2c_get_bus (&soc->i2c,11 ),TYPE_TMP105 , +0x48 ); +i2c_slave_create_simple (aspeed_i2c_get_bus (&soc->i2c,11 ),TYPE_TMP105 , +0x49 ); +} +static bool aspeed_get_mmio_exec (Object *obj,Error **errp) {return ASPEED_MACHINE (obj)->mmio_exec;
@@ -889,6 +945,25 @@ static void aspeed_machine_g220a_class_init(ObjectClass *oc, void *data)aspeed_soc_num_cpus (amc->soc_name); }; +static void aspeed_machine_rainier_class_init (ObjectClass *oc,void *data) +{ +MachineClass *mc =MACHINE_CLASS (oc); +AspeedMachineClass *amc =ASPEED_MACHINE_CLASS (oc); + + mc->desc ="IBM Rainier BMC (Cortex A7)" ; + amc->soc_name ="ast2600-a1" ; + amc->hw_strap1 =RAINIER_BMC_HW_STRAP1 ; + amc->hw_strap2 =RAINIER_BMC_HW_STRAP2 ; + amc->fmc_model ="mx66l1g45g" ; + amc->spi_model ="mx66l1g45g" ; + amc->num_cs =2 ; + amc->macs_mask =ASPEED_MAC2_ON |ASPEED_MAC3_ON ; + amc->i2c_init = rainier_bmc_i2c_init; + mc->default_ram_size =1 * GiB; + mc->default_cpus = mc->min_cpus = mc->max_cpus = +aspeed_soc_num_cpus (amc->soc_name); +}; +static const TypeInfo aspeed_machine_types[] = { { .name =MACHINE_TYPE_NAME ("palmetto-bmc" ),
@@ -930,6 +1005,10 @@ static const TypeInfo aspeed_machine_types[] = { .name = MACHINE_TYPE_NAME("g220a-bmc"), .parent = TYPE_ASPEED_MACHINE, .class_init = aspeed_machine_g220a_class_init, + }, { + .name = MACHINE_TYPE_NAME("rainier-bmc"), + .parent = TYPE_ASPEED_MACHINE, + .class_init = aspeed_machine_rainier_class_init, }, { .name = TYPE_ASPEED_MACHINE, .parent = TYPE_MACHINE,
Signature · 1 line
2.26.3
[PULL 08/18] tests/qtest: Add test for Aspeed HACE
In reply to Cédric Le GoaterFrom: Joel Stanley <[email protected]>
This adds a test for the Aspeed Hash and Crypto (HACE) engine. It tests the currently implemented behavior of the hash functionality.
The tests are similar, but are cut/pasted instead of broken out into a common function so the assert machinery produces useful output when a test fails.
Message-Id: <[email protected]>
--- tests/qtest/aspeed_hace-test.c | 469 +++++++++++++++++++++++++++++++++ MAINTAINERS | 1 + tests/qtest/meson.build | 3 + 3 files changed, 473 insertions(+) create mode 100644 tests/qtest/aspeed_hace-test.c
tests/qtest/aspeed_hace-test.c new file +469 -0
@@ -0,0 +1,469 @@ +/* +* QTest testcase for the ASPEED Hash and Crypto Engine +* +* SPDX-License-Identifier: GPL-2.0-or-later +* Copyright 2021 IBM Corp. +*/ + +#include "qemu/osdep.h" + +#include "libqos/libqtest.h" +#include "qemu-common.h" +#include "qemu/bitops.h" + +#define HACE_CMD 0x10 +#define HACE_SHA_BE_EN BIT(3) +#define HACE_MD5_LE_EN BIT(2) +#define HACE_ALGO_MD5 0 +#define HACE_ALGO_SHA1 BIT(5) +#define HACE_ALGO_SHA224 BIT(6) +#define HACE_ALGO_SHA256 (BIT(4) | BIT(6)) +#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_STS 0x1c +#define HACE_RSA_ISR BIT(13) +#define HACE_CRYPTO_ISR BIT(12) +#define HACE_HASH_ISR BIT(9) +#define HACE_RSA_BUSY BIT(2) +#define HACE_CRYPTO_BUSY BIT(1) +#define HACE_HASH_BUSY BIT(0) +#define HACE_HASH_SRC 0x20 +#define HACE_HASH_DIGEST 0x24 +#define HACE_HASH_KEY_BUFF 0x28 +#define HACE_HASH_DATA_LEN 0x2c +#define HACE_HASH_CMD 0x30 +/* Scatter-Gather Hash */ +#define SG_LIST_LEN_LAST BIT(31) +struct AspeedSgList { +uint32_t len; +uint32_t addr; +} __attribute__ ((__packed__ )); + +/* +* Test vector is the ascii "abc" +* +* Expected results were generated using command line utitiles: +* +* echo -n -e 'abc' | dd of=/tmp/test +* for hash in sha512sum sha256sum md5sum; do $hash /tmp/test; done +* +*/ +static const uint8_t test_vector[] = {0x61 ,0x62 ,0x63 }; + +static const uint8_t test_result_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_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 const uint8_t test_result_md5[] = { +0x90 ,0x01 ,0x50 ,0x98 ,0x3c ,0xd2 ,0x4f ,0xb0 ,0xd6 ,0x96 ,0x3f ,0x7d , +0x28 ,0xe1 ,0x7f ,0x72 }; + +/* +* The Scatter-Gather Test vector is the ascii "abc" "def" "ghi", broken +* into blocks of 3 characters as shown +* +* Expected results were generated using command line utitiles: +* +* echo -n -e 'abcdefghijkl' | dd of=/tmp/test +* for hash in sha512sum sha256sum; do $hash /tmp/test; done +* +*/ +static const uint8_t test_vector_sg1[] = {0x61 ,0x62 ,0x63 ,0x64 ,0x65 ,0x66 }; +static const uint8_t test_vector_sg2[] = {0x67 ,0x68 ,0x69 }; +static const uint8_t test_vector_sg3[] = {0x6a ,0x6b ,0x6c }; + +static const uint8_t test_result_sg_sha512[] = { +0x17 ,0x80 ,0x7c ,0x72 ,0x8e ,0xe3 ,0xba ,0x35 ,0xe7 ,0xcf ,0x7a ,0xf8 , +0x23 ,0x11 ,0x6d ,0x26 ,0xe4 ,0x1e ,0x5d ,0x4d ,0x6c ,0x2f ,0xf1 ,0xf3 , +0x72 ,0x0d ,0x3d ,0x96 ,0xaa ,0xcb ,0x6f ,0x69 ,0xde ,0x64 ,0x2e ,0x63 , +0xd5 ,0xb7 ,0x3f ,0xc3 ,0x96 ,0xc1 ,0x2b ,0xe3 ,0x8b ,0x2b ,0xd5 ,0xd8 , +0x84 ,0x25 ,0x7c ,0x32 ,0xc8 ,0xf6 ,0xd0 ,0x85 ,0x4a ,0xe6 ,0xb5 ,0x40 , +0xf8 ,0x6d ,0xda ,0x2e }; + +static const uint8_t test_result_sg_sha256[] = { +0xd6 ,0x82 ,0xed ,0x4c ,0xa4 ,0xd9 ,0x89 ,0xc1 ,0x34 ,0xec ,0x94 ,0xf1 , +0x55 ,0x1e ,0x1e ,0xc5 ,0x80 ,0xdd ,0x6d ,0x5a ,0x6e ,0xcd ,0xe9 ,0xf3 , +0xd3 ,0x5e ,0x6e ,0x4a ,0x71 ,0x7f ,0xbd ,0xe4 }; + + +static void write_regs (QTestState *s,uint32_t base,uint32_t src, +uint32_t length,uint32_t out,uint32_t method) +{ +qtest_writel (s, base +HACE_HASH_SRC , src); +qtest_writel (s, base +HACE_HASH_DIGEST , out); +qtest_writel (s, base +HACE_HASH_DATA_LEN , length); +qtest_writel (s, base +HACE_HASH_CMD ,HACE_SHA_BE_EN | method); +} + +static void test_md5 (const char *machine,const uint32_t base, +const uint32_t src_addr) + +{ +QTestState *s =qtest_init (machine); + +uint32_t digest_addr = src_addr +0x01000000 ; +uint8_t digest[16 ] = {0 }; + +/* 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, src_addr, test_vector,sizeof (test_vector)); + +write_regs (s, base, src_addr,sizeof (test_vector), digest_addr,HACE_ALGO_MD5 ); + +/* 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_md5,sizeof (digest)); + +qtest_quit (s); +} + +static void test_sha256 (const char *machine,const uint32_t base, +const uint32_t src_addr) +{ +QTestState *s =qtest_init (machine); + +const uint32_t digest_addr = src_addr +0x1000000 ; +uint8_t digest[32 ] = {0 }; + +/* 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, src_addr, test_vector,sizeof (test_vector)); + +write_regs (s, base, src_addr,sizeof (test_vector), digest_addr,HACE_ALGO_SHA256 ); + +/* 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_sha256,sizeof (digest)); + +qtest_quit (s); +} + +static void test_sha512 (const char *machine,const uint32_t base, +const uint32_t src_addr) +{ +QTestState *s =qtest_init (machine); + +const uint32_t digest_addr = src_addr +0x1000000 ; +uint8_t digest[64 ] = {0 }; + +/* 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, src_addr, test_vector,sizeof (test_vector)); + +write_regs (s, base, src_addr,sizeof (test_vector), digest_addr,HACE_ALGO_SHA512 ); + +/* 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_sha512,sizeof (digest)); + +qtest_quit (s); +} + +static void test_sha256_sg (const char *machine,const uint32_t base, +const uint32_t src_addr) +{ +QTestState *s =qtest_init (machine); + +const uint32_t src_addr_1 = src_addr +0x1000000 ; +const uint32_t src_addr_2 = src_addr +0x2000000 ; +const uint32_t src_addr_3 = src_addr +0x3000000 ; +const uint32_t digest_addr = src_addr +0x4000000 ; +uint8_t digest[32 ] = {0 }; +struct AspeedSgList array[] = { + {cpu_to_le32 (sizeof (test_vector_sg1)), +cpu_to_le32 (src_addr_1) }, + {cpu_to_le32 (sizeof (test_vector_sg2)), +cpu_to_le32 (src_addr_2) }, + {cpu_to_le32 (sizeof (test_vector_sg3) |SG_LIST_LEN_LAST ), +cpu_to_le32 (src_addr_3) }, + }; + +/* 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, src_addr_1, test_vector_sg1,sizeof (test_vector_sg1)); +qtest_memwrite (s, src_addr_2, test_vector_sg2,sizeof (test_vector_sg2)); +qtest_memwrite (s, src_addr_3, test_vector_sg3,sizeof (test_vector_sg3)); +qtest_memwrite (s, src_addr, array,sizeof (array)); + +write_regs (s, base, src_addr, + (sizeof (test_vector_sg1) + +sizeof (test_vector_sg2) + +sizeof (test_vector_sg3)), + digest_addr,HACE_ALGO_SHA256 |HACE_SG_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_sg_sha256,sizeof (digest)); + +qtest_quit (s); +} + +static void test_sha512_sg (const char *machine,const uint32_t base, +const uint32_t src_addr) +{ +QTestState *s =qtest_init (machine); + +const uint32_t src_addr_1 = src_addr +0x1000000 ; +const uint32_t src_addr_2 = src_addr +0x2000000 ; +const uint32_t src_addr_3 = src_addr +0x3000000 ; +const uint32_t digest_addr = src_addr +0x4000000 ; +uint8_t digest[64 ] = {0 }; +struct AspeedSgList array[] = { + {cpu_to_le32 (sizeof (test_vector_sg1)), +cpu_to_le32 (src_addr_1) }, + {cpu_to_le32 (sizeof (test_vector_sg2)), +cpu_to_le32 (src_addr_2) }, + {cpu_to_le32 (sizeof (test_vector_sg3) |SG_LIST_LEN_LAST ), +cpu_to_le32 (src_addr_3) }, + }; + +/* 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, src_addr_1, test_vector_sg1,sizeof (test_vector_sg1)); +qtest_memwrite (s, src_addr_2, test_vector_sg2,sizeof (test_vector_sg2)); +qtest_memwrite (s, src_addr_3, test_vector_sg3,sizeof (test_vector_sg3)); +qtest_memwrite (s, src_addr, array,sizeof (array)); + +write_regs (s, base, src_addr, + (sizeof (test_vector_sg1) + +sizeof (test_vector_sg2) + +sizeof (test_vector_sg3)), + digest_addr,HACE_ALGO_SHA512 |HACE_SG_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_sg_sha512,sizeof (digest)); + +qtest_quit (s); +} + +struct masks { +uint32_t src; +uint32_t dest; +uint32_t len; +}; + +static const struct masks ast2600_masks = { + .src =0x7fffffff , + .dest =0x7ffffff8 , + .len =0x0fffffff , +}; + +static const struct masks ast2500_masks = { + .src =0x3fffffff , + .dest =0x3ffffff8 , + .len =0x0fffffff , +}; + +static const struct masks ast2400_masks = { + .src =0x0fffffff , + .dest =0x0ffffff8 , + .len =0x0fffffff , +}; + +static void test_addresses (const char *machine,const uint32_t base, +const struct masks *expected) +{ +QTestState *s =qtest_init (machine); + +/* +* Check command mode is zero, meaning engine is in direct access mode, +* as this affects the masking behavior of the HASH_SRC register. +*/ + g_assert_cmphex(qtest_readl(s, base + HACE_CMD), ==, 0); + g_assert_cmphex(qtest_readl(s, base + HACE_HASH_SRC), ==, 0); + g_assert_cmphex(qtest_readl(s, base + HACE_HASH_DIGEST), ==, 0); + g_assert_cmphex(qtest_readl(s, base + HACE_HASH_DATA_LEN), ==, 0); + + +/* Check that the address masking is correct */ +qtest_writel (s, base +HACE_HASH_SRC ,0xffffffff ); + g_assert_cmphex(qtest_readl(s, base + HACE_HASH_SRC), ==, expected->src); + +qtest_writel (s, base +HACE_HASH_DIGEST ,0xffffffff ); + g_assert_cmphex(qtest_readl(s, base + HACE_HASH_DIGEST), ==, expected->dest); + +qtest_writel (s, base +HACE_HASH_DATA_LEN ,0xffffffff ); + g_assert_cmphex(qtest_readl(s, base + HACE_HASH_DATA_LEN), ==, expected->len); + +/* Reset to zero */ +qtest_writel (s, base +HACE_HASH_SRC ,0 ); +qtest_writel (s, base +HACE_HASH_DIGEST ,0 ); +qtest_writel (s, base +HACE_HASH_DATA_LEN ,0 ); + +/* Check that all bits are now zero */ + g_assert_cmphex(qtest_readl(s, base + HACE_HASH_SRC), ==, 0); + g_assert_cmphex(qtest_readl(s, base + HACE_HASH_DIGEST), ==, 0); + g_assert_cmphex(qtest_readl(s, base + HACE_HASH_DATA_LEN), ==, 0); + +qtest_quit (s); +} + +/* ast2600 */ +static void test_md5_ast2600 (void ) +{ +test_md5 ("-machine ast2600-evb" ,0x1e6d0000 ,0x80000000 ); +} + +static void test_sha256_ast2600 (void ) +{ +test_sha256 ("-machine ast2600-evb" ,0x1e6d0000 ,0x80000000 ); +} + +static void test_sha256_sg_ast2600 (void ) +{ +test_sha256_sg ("-machine ast2600-evb" ,0x1e6d0000 ,0x80000000 ); +} + +static void test_sha512_ast2600 (void ) +{ +test_sha512 ("-machine ast2600-evb" ,0x1e6d0000 ,0x80000000 ); +} + +static void test_sha512_sg_ast2600 (void ) +{ +test_sha512_sg ("-machine ast2600-evb" ,0x1e6d0000 ,0x80000000 ); +} + +static void test_addresses_ast2600 (void ) +{ +test_addresses ("-machine ast2600-evb" ,0x1e6d0000 , &ast2600_masks); +} + +/* ast2500 */ +static void test_md5_ast2500 (void ) +{ +test_md5 ("-machine ast2500-evb" ,0x1e6e3000 ,0x80000000 ); +} + +static void test_sha256_ast2500 (void ) +{ +test_sha256 ("-machine ast2500-evb" ,0x1e6e3000 ,0x80000000 ); +} + +static void test_sha512_ast2500 (void ) +{ +test_sha512 ("-machine ast2500-evb" ,0x1e6e3000 ,0x80000000 ); +} + +static void test_addresses_ast2500 (void ) +{ +test_addresses ("-machine ast2500-evb" ,0x1e6e3000 , &ast2500_masks); +} + +/* ast2400 */ +static void test_md5_ast2400 (void ) +{ +test_md5 ("-machine palmetto-bmc" ,0x1e6e3000 ,0x40000000 ); +} + +static void test_sha256_ast2400 (void ) +{ +test_sha256 ("-machine palmetto-bmc" ,0x1e6e3000 ,0x40000000 ); +} + +static void test_sha512_ast2400 (void ) +{ +test_sha512 ("-machine palmetto-bmc" ,0x1e6e3000 ,0x40000000 ); +} + +static void test_addresses_ast2400 (void ) +{ +test_addresses ("-machine palmetto-bmc" ,0x1e6e3000 , &ast2400_masks); +} + +int main (int argc,char **argv) +{ +g_test_init (&argc, &argv,NULL ); + +qtest_add_func ("ast2600/hace/addresses" , test_addresses_ast2600); +qtest_add_func ("ast2600/hace/sha512" , test_sha512_ast2600); +qtest_add_func ("ast2600/hace/sha256" , test_sha256_ast2600); +qtest_add_func ("ast2600/hace/md5" , test_md5_ast2600); + +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 ("ast2500/hace/addresses" , test_addresses_ast2500); +qtest_add_func ("ast2500/hace/sha512" , test_sha512_ast2500); +qtest_add_func ("ast2500/hace/sha256" , test_sha256_ast2500); +qtest_add_func ("ast2500/hace/md5" , test_md5_ast2500); + +qtest_add_func ("ast2400/hace/addresses" , test_addresses_ast2400); +qtest_add_func ("ast2400/hace/sha512" , test_sha512_ast2400); +qtest_add_func ("ast2400/hace/sha256" , test_sha256_ast2400); +qtest_add_func ("ast2400/hace/md5" , test_md5_ast2400); + +return g_test_run (); +}
MAINTAINERS +1 -0
@@ -1026,6 +1026,7 @@ F: include/hw/misc/pca9552*.h F: hw/net/ftgmac100.c F: include/hw/net/ftgmac100.h F: docs/system/arm/aspeed.rst +F: tests/qtest/*aspeed* NRF51 M: Joel Stanley <[email protected]>
tests/qtest/meson.build +3 -0
@@ -161,12 +161,15 @@ qtests_npcm7xx = \ 'npcm7xx_timer-test', 'npcm7xx_watchdog_timer-test'] + \ (slirp.found() ? ['npcm7xx_emc-test'] : []) +qtests_aspeed = \ + ['aspeed_hace-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'] : []) + \ (config_all_devices.has_key('CONFIG_CMSDK_APB_TIMER') ? ['cmsdk-apb-timer-test'] : []) + \ (config_all_devices.has_key('CONFIG_CMSDK_APB_WATCHDOG') ? ['cmsdk-apb-watchdog-test'] : []) + \ (config_all_devices.has_key('CONFIG_PFLASH_CFI02') ? ['pflash-cfi02-test'] : []) + \ + (config_all_devices.has_key('CONFIG_ASPEED_SOC') ? qtests_aspeed : []) + \ (config_all_devices.has_key('CONFIG_NPCM7XX') ? qtests_npcm7xx : []) + \ ['arm-cpu-features', 'microbit-test',
Signature · 1 line
2.26.3
[PULL 07/18] aspeed: Integrate HACE
In reply to Cédric Le GoaterFrom: Joel Stanley <[email protected]>
Add the hash and crypto engine model to the Aspeed socs.
Message-Id: <[email protected]>
--- docs/system/arm/aspeed.rst | 1 - include/hw/arm/aspeed_soc.h | 3 +++ hw/arm/aspeed_ast2600.c | 15 +++++++++++++++ hw/arm/aspeed_soc.c | 16 ++++++++++++++++ 4 files changed, 34 insertions(+), 1 deletion(-)
docs/system/arm/aspeed.rst +0 -1
@@ -60,7 +60,6 @@ Missing devices * PWM and Fan Controller * Slave GPIO Controller * Super I/O Controller - * Hash/Crypto Engine * PCI-Express 1 Controller * Graphic Display Controller * PECI Controller
include/hw/arm/aspeed_soc.h +3 -0
@@ -21,6 +21,7 @@#include "hw/rtc/aspeed_rtc.h" #include "hw/i2c/aspeed_i2c.h" #include "hw/ssi/aspeed_smc.h" +#include "hw/misc/aspeed_hace.h" #include "hw/watchdog/wdt_aspeed.h" #include "hw/net/ftgmac100.h" #include "target/arm/cpu.h"
@@ -50,6 +51,7 @@ struct AspeedSoCState {AspeedTimerCtrlState timerctrl;AspeedI2CState i2c;AspeedSCUState scu; +AspeedHACEState hace;AspeedXDMAState xdma;AspeedSMCState fmc;AspeedSMCState spi[ASPEED_SPIS_NUM ];
@@ -133,6 +135,7 @@ enum {ASPEED_DEV_XDMA ,ASPEED_DEV_EMMC ,ASPEED_DEV_KCS , + ASPEED_DEV_HACE, };#endif /* ASPEED_SOC_H */
hw/arm/aspeed_ast2600.c +15 -0
@@ -42,6 +42,7 @@ static const hwaddr aspeed_soc_ast2600_memmap[] = { [ASPEED_DEV_ETH2] = 0x1E680000, [ASPEED_DEV_ETH4] = 0x1E690000, [ASPEED_DEV_VIC] = 0x1E6C0000, + [ASPEED_DEV_HACE] = 0x1E6D0000, [ASPEED_DEV_SDMC] = 0x1E6E0000, [ASPEED_DEV_SCU] = 0x1E6E2000, [ASPEED_DEV_XDMA] = 0x1E6E7000,
@@ -102,6 +103,7 @@ static const int aspeed_soc_ast2600_irqmap[] = { [ASPEED_DEV_I2C] = 110, /* 110 -> 125 */ [ASPEED_DEV_ETH1] = 2, [ASPEED_DEV_ETH2] = 3, + [ASPEED_DEV_HACE] = 4, [ASPEED_DEV_ETH3] = 32, [ASPEED_DEV_ETH4] = 33, [ASPEED_DEV_KCS] = 138, /* 138 -> 142 */
@@ -213,6 +215,9 @@ static void aspeed_soc_ast2600_init(Object *obj) TYPE_SYSBUS_SDHCI);object_initialize_child (obj,"lpc" , &s->lpc,TYPE_ASPEED_LPC ); + +snprintf (typename,sizeof (typename),"aspeed.hace-%s" , socname); +object_initialize_child (obj,"hace" , &s->hace, typename); }/*
@@ -494,6 +499,16 @@ static void aspeed_soc_ast2600_realize(DeviceState *dev, Error **errp)sysbus_connect_irq (SYS_BUS_DEVICE (&s->lpc),1 + aspeed_lpc_kcs_4,qdev_get_gpio_in (DEVICE (&s->a7mpcore), sc->irqmap[ASPEED_DEV_KCS ] + aspeed_lpc_kcs_4)); + +/* 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 ; + } +sysbus_mmio_map (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 )); }static void aspeed_soc_ast2600_class_init (ObjectClass *oc,void *data)
hw/arm/aspeed_soc.c +16 -0
@@ -34,6 +34,7 @@ static const hwaddr aspeed_soc_ast2400_memmap[] = { [ASPEED_DEV_VIC] = 0x1E6C0000, [ASPEED_DEV_SDMC] = 0x1E6E0000, [ASPEED_DEV_SCU] = 0x1E6E2000, + [ASPEED_DEV_HACE] = 0x1E6E3000, [ASPEED_DEV_XDMA] = 0x1E6E7000, [ASPEED_DEV_VIDEO] = 0x1E700000, [ASPEED_DEV_ADC] = 0x1E6E9000,
@@ -65,6 +66,7 @@ static const hwaddr aspeed_soc_ast2500_memmap[] = { [ASPEED_DEV_VIC] = 0x1E6C0000, [ASPEED_DEV_SDMC] = 0x1E6E0000, [ASPEED_DEV_SCU] = 0x1E6E2000, + [ASPEED_DEV_HACE] = 0x1E6E3000, [ASPEED_DEV_XDMA] = 0x1E6E7000, [ASPEED_DEV_ADC] = 0x1E6E9000, [ASPEED_DEV_VIDEO] = 0x1E700000,
@@ -117,6 +119,7 @@ static const int aspeed_soc_ast2400_irqmap[] = { [ASPEED_DEV_ETH2] = 3, [ASPEED_DEV_XDMA] = 6, [ASPEED_DEV_SDHCI] = 26, + [ASPEED_DEV_HACE] = 4, };#define aspeed_soc_ast2500_irqmap aspeed_soc_ast2400_irqmap
@@ -212,6 +215,9 @@ static void aspeed_soc_init(Object *obj) }object_initialize_child (obj,"lpc" , &s->lpc,TYPE_ASPEED_LPC ); + +snprintf (typename,sizeof (typename),"aspeed.hace-%s" , socname); +object_initialize_child (obj,"hace" , &s->hace, typename); }static void aspeed_soc_realize (DeviceState *dev,Error **errp)
@@ -421,6 +427,16 @@ static void aspeed_soc_realize(DeviceState *dev, Error **errp)sysbus_connect_irq (SYS_BUS_DEVICE (&s->lpc),1 + aspeed_lpc_kcs_4,qdev_get_gpio_in (DEVICE (&s->lpc), aspeed_lpc_kcs_4)); + +/* 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 ; + } +sysbus_mmio_map (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 )); }static Property aspeed_soc_properties[] = { DEFINE_PROP_LINK("dram", AspeedSoCState, dram_mr, TYPE_MEMORY_REGION,
Signature · 1 line
2.26.3
[PULL 14/18] tests/qtest: Rename m25p80 test in aspeed_smc test
In reply to Cédric Le GoaterThe m25p80 test depends on the Aspeed SMC controller to test our SPI-NOR flash support. Reflect this dependency by changing the name.
Message-Id: <[email protected]>
---
tests/qtest/{m25p80-test.c => aspeed_smc-test.c} | 12 ++++++------
tests/qtest/meson.build | 4 ++--
2 files changed, 8 insertions(+), 8 deletions(-)
rename tests/qtest/{m25p80-test.c => aspeed_smc-test.c} (96%)tests/qtest/aspeed_smc-test.c renamed from tests/qtest/m25p80-test.c +6 -6
@@ -367,12 +367,12 @@ int main(int argc, char **argv)"-drive file=%s,format=raw,if=mtd" , tmp_path); -qtest_add_func ("/m25p80/read_jedec" , test_read_jedec); -qtest_add_func ("/m25p80/erase_sector" , test_erase_sector); -qtest_add_func ("/m25p80/erase_all" , test_erase_all); -qtest_add_func ("/m25p80/write_page" , test_write_page); -qtest_add_func ("/m25p80/read_page_mem" , test_read_page_mem); -qtest_add_func ("/m25p80/write_page_mem" , test_write_page_mem); +qtest_add_func ("/ast2400/smc/read_jedec" , test_read_jedec); +qtest_add_func ("/ast2400/smc/erase_sector" , test_erase_sector); +qtest_add_func ("/ast2400/smc/erase_all" , test_erase_all); +qtest_add_func ("/ast2400/smc/write_page" , test_write_page); +qtest_add_func ("/ast2400/smc/read_page_mem" , test_read_page_mem); +qtest_add_func ("/ast2400/smc/write_page_mem" , test_write_page_mem); ret =g_test_run ();
tests/qtest/meson.build +2 -2
@@ -162,7 +162,8 @@ qtests_npcm7xx = \ 'npcm7xx_watchdog_timer-test'] + \ (slirp.found() ? ['npcm7xx_emc-test'] : []) qtests_aspeed = \ - ['aspeed_hace-test'] + ['aspeed_hace-test', + 'aspeed_smc-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'] : []) + \
@@ -173,7 +174,6 @@ qtests_arm = \ (config_all_devices.has_key('CONFIG_NPCM7XX') ? qtests_npcm7xx : []) + \ ['arm-cpu-features', 'microbit-test', - 'm25p80-test', 'test-arm-mptimer', 'boot-serial-test', 'hexloader-test']
Signature · 1 line
2.26.3
[PULL 06/18] hw: Model ASPEED's Hash and Crypto Engine
In reply to Cédric Le GoaterFrom: Joel Stanley <[email protected]>
The HACE (Hash and Crypto Engine) is a device that offloads MD5, SHA1, SHA2, RSA and other cryptographic algorithms.
This initial model implements a subset of the device's functionality; currently only MD5/SHA hashing, and on the ast2600's scatter gather engine.
Message-Id: <[email protected]>
--- docs/system/arm/aspeed.rst | 1 + include/hw/misc/aspeed_hace.h | 43 ++++ hw/misc/aspeed_hace.c | 389 ++++++++++++++++++++++++++++++++++ hw/misc/meson.build | 1 + 4 files changed, 434 insertions(+) create mode 100644 include/hw/misc/aspeed_hace.h create mode 100644 hw/misc/aspeed_hace.c
docs/system/arm/aspeed.rst +1 -0
@@ -49,6 +49,7 @@ Supported devices * Ethernet controllers * Front LEDs (PCA9552 on I2C bus) * LPC Peripheral Controller (a subset of subdevices are supported) + * Hash/Crypto Engine (HACE) - Hash support only. TODO: HMAC and RSA Missing devices
include/hw/misc/aspeed_hace.h new file +43 -0
43 lines not on this page · raw message
hw/misc/aspeed_hace.c new file +389 -0
389 lines not on this page · raw message
hw/misc/meson.build +1 -0
@@ -109,6 +109,7 @@ softmmu_ss.add(when: 'CONFIG_PVPANIC_ISA', if_true: files('pvpanic-isa.c')) softmmu_ss.add(when: 'CONFIG_PVPANIC_PCI', if_true: files('pvpanic-pci.c')) softmmu_ss.add(when: 'CONFIG_AUX', if_true: files('auxbus.c')) softmmu_ss.add(when: 'CONFIG_ASPEED_SOC', if_true: files( + 'aspeed_hace.c', 'aspeed_lpc.c', 'aspeed_scu.c', 'aspeed_sdmc.c',
Signature · 1 line
2.26.3
[PULL 13/18] aspeed/smc: Add extra controls to request DMA
In reply to Cédric Le GoaterThe AST2600 SPI controllers have a set of bits to request/grant DMA access. Add a new SMC feature for these controllers and use it to check access to the DMA registers.
Message-Id: <[email protected]>
--- include/hw/ssi/aspeed_smc.h | 1 + hw/ssi/aspeed_smc.c | 74 +++++++++++++++++++++++++++++++++---- 2 files changed, 68 insertions(+), 7 deletions(-)
include/hw/ssi/aspeed_smc.h +1 -0
@@ -55,6 +55,7 @@ typedef struct AspeedSMCController { const AspeedSegments *seg);void (*reg_to_segment)(const struct AspeedSMCState *s,uint32_t reg,AspeedSegments *seg); +void (*dma_ctrl)(struct AspeedSMCState *s,uint32_t value); } AspeedSMCController; typedef struct AspeedSMCFlash {
hw/ssi/aspeed_smc.c +67 -7
177 lines not on this page · raw message
Signature · 1 line
2.26.3
[PULL 12/18] aspeed/smc: Add a 'features' attribute to the object class
In reply to Cédric Le GoaterIt will simplify extensions of the SMC model.
Message-Id: <[email protected]>
--- include/hw/ssi/aspeed_smc.h | 2 +- hw/ssi/aspeed_smc.c | 44 +++++++++++++++++++++---------------- 2 files changed, 26 insertions(+), 20 deletions(-)
include/hw/ssi/aspeed_smc.h +1 -1
@@ -47,7 +47,7 @@ typedef struct AspeedSMCController {const AspeedSegments *segments;hwaddr flash_window_base;uint32_t flash_window_size; -bool has_dma; +uint32_t features;hwaddr dma_flash_mask;hwaddr dma_dram_mask;uint32_t nregs;
hw/ssi/aspeed_smc.c +25 -19
125 lines not on this page · raw message
Signature · 1 line
2.26.3
[PULL 09/18] tests/acceptance: Test ast2400 and ast2500 machines
In reply to Cédric Le GoaterFrom: Joel Stanley <[email protected]>
Test MTD images from the OpenBMC project on AST2400 and AST2500 SoCs from ASPEED, by booting Palmetto and Romulus BMC machines.
The images are fetched from OpenBMC's release directory on github.
[ clg : - removed comment
- removed ending self.vm.shutdown() ]
Message-Id: <[email protected]>
Message-Id: <[email protected]>
--- tests/acceptance/boot_linux_console.py | 43 ++++++++++++++++++++++++++ 1 file changed, 43 insertions(+)
tests/acceptance/boot_linux_console.py +43 -0
@@ -1010,6 +1010,49 @@ def test_arm_vexpressa9(self): self.vm.add_args('-dtb', self.workdir + '/day16/vexpress-v2p-ca9.dtb') self.do_test_advcal_2018('16', tar_hash, 'winter.zImage') + def test_arm_ast2400_palmetto_openbmc_v2_9_0(self): + """ + :avocado: tags=arch:arm + :avocado: tags=machine:palmetto-bmc + """ + + image_url = ('https://github.com/openbmc/openbmc/releases/download/2.9.0/' + 'obmc-phosphor-image-palmetto.static.mtd') + image_hash = ('3e13bbbc28e424865dc42f35ad672b10f2e82cdb11846bb28fa625b48beafd0d') + image_path = self.fetch_asset(image_url, asset_hash=image_hash, + algorithm='sha256') + + self.do_test_arm_aspeed(image_path) + + def test_arm_ast2500_romulus_openbmc_v2_9_0(self): + """ + :avocado: tags=arch:arm + :avocado: tags=machine:romulus-bmc + """ + + image_url = ('https://github.com/openbmc/openbmc/releases/download/2.9.0/' + 'obmc-phosphor-image-romulus.static.mtd') + image_hash = ('820341076803f1955bc31e647a512c79f9add4f5233d0697678bab4604c7bb25') + image_path = self.fetch_asset(image_url, asset_hash=image_hash, + algorithm='sha256') + + self.do_test_arm_aspeed(image_path) + + def do_test_arm_aspeed(self, image): + self.vm.set_console() + self.vm.add_args('-drive', 'file=' + image + ',if=mtd,format=raw', + '-net', 'nic') + 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 test_m68k_mcf5208evb(self): """ :avocado: tags=arch:m68k
Signature · 1 line
2.26.3
[PULL 18/18] aspeed: Add support for the quanta-q7l1-bmc board
In reply to Cédric Le GoaterFrom: Patrick Venture <[email protected]>
The Quanta-Q71l BMC board is a board supported by OpenBMC.
Tested: Booted quanta-q71l firmware.
Message-Id: <[email protected]>
--- hw/arm/aspeed.c | 62 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 62 insertions(+)
hw/arm/aspeed.c +62 -0
@@ -138,6 +138,19 @@ struct AspeedMachineState {/* Witherspoon hardware value: 0xF10AD216 (but use romulus definition) */ #define WITHERSPOON_BMC_HW_STRAP1 ROMULUS_BMC_HW_STRAP1 +/* Quanta-Q71l hardware value */ +#define QUANTA_Q71L_BMC_HW_STRAP1 ( \ + SCU_AST2400_HW_STRAP_DRAM_SIZE(DRAM_SIZE_128MB) | \ + SCU_AST2400_HW_STRAP_DRAM_CONFIG(2/* DDR3 with CL=6, CWL=5 */) | \ +SCU_AST2400_HW_STRAP_ACPI_DIS | \ + SCU_AST2400_HW_STRAP_SET_CLK_SOURCE(AST2400_CLK_24M_IN) | \ + SCU_HW_STRAP_VGA_CLASS_CODE | \ + SCU_HW_STRAP_SPI_MODE(SCU_HW_STRAP_SPI_PASS_THROUGH) | \ + SCU_AST2400_HW_STRAP_SET_CPU_AHB_RATIO(AST2400_CPU_AHB_RATIO_2_1) | \ + SCU_HW_STRAP_SPI_WIDTH | \ + SCU_HW_STRAP_VGA_SIZE_SET(VGA_8M_DRAM) | \ + SCU_AST2400_HW_STRAP_BOOT_MODE(AST2400_SPI_BOOT)) +/* AST2600 evb hardware value */ #define AST2600_EVB_HW_STRAP1 0x000000C0#define AST2600_EVB_HW_STRAP2 0x00000003
@@ -437,6 +450,34 @@ static void palmetto_bmc_i2c_init(AspeedMachineState *bmc)object_property_set_int (OBJECT (dev),"temperature3" ,110000 , &error_abort); } +static void quanta_q71l_bmc_i2c_init (AspeedMachineState *bmc) +{ +AspeedSoCState *soc = &bmc->soc; + +/* +* The quanta-q71l platform expects tmp75s which are compatible with +* tmp105s. +*/ +i2c_slave_create_simple (aspeed_i2c_get_bus (&soc->i2c,1 ),"tmp105" ,0x4c ); +i2c_slave_create_simple (aspeed_i2c_get_bus (&soc->i2c,1 ),"tmp105" ,0x4e ); +i2c_slave_create_simple (aspeed_i2c_get_bus (&soc->i2c,1 ),"tmp105" ,0x4f ); + +/* TODO: i2c-1: Add baseboard FRU eeprom@54 24c64 */ +/* TODO: i2c-1: Add Frontpanel FRU eeprom@57 24c64 */ +/* TODO: Add Memory Riser i2c mux and eeproms. */ + +/* TODO: i2c-2: pca9546@74 */ +/* TODO: i2c-2: pca9548@77 */ +/* TODO: i2c-3: Add BIOS FRU eeprom@56 24c64 */ +/* TODO: i2c-7: Add pca9546@70 */ +/* - i2c@0: pmbus@59 */ +/* - i2c@1: pmbus@58 */ +/* - i2c@2: pmbus@58 */ +/* - i2c@3: pmbus@59 */ +/* TODO: i2c-7: Add PDB FRU eeprom@52 */ +/* TODO: i2c-8: Add BMC FRU eeprom@50 */ +} +static void ast2500_evb_i2c_init (AspeedMachineState *bmc) {AspeedSoCState *soc = &bmc->soc;
@@ -784,6 +825,23 @@ static void aspeed_machine_palmetto_class_init(ObjectClass *oc, void *data)aspeed_soc_num_cpus (amc->soc_name); }; +static void aspeed_machine_quanta_q71l_class_init (ObjectClass *oc,void *data) +{ +MachineClass *mc =MACHINE_CLASS (oc); +AspeedMachineClass *amc =ASPEED_MACHINE_CLASS (oc); + + mc->desc ="Quanta-Q71l BMC (ARM926EJ-S)" ; + amc->soc_name ="ast2400-a1" ; + amc->hw_strap1 =QUANTA_Q71L_BMC_HW_STRAP1 ; + amc->fmc_model ="n25q256a" ; + amc->spi_model ="mx25l25635e" ; + amc->num_cs =1 ; + amc->i2c_init = quanta_q71l_bmc_i2c_init; + mc->default_ram_size =128 * MiB; + mc->default_cpus = mc->min_cpus = mc->max_cpus = +aspeed_soc_num_cpus (amc->soc_name); +} +static void aspeed_machine_supermicrox11_bmc_class_init (ObjectClass *oc,void *data) {
@@ -1005,6 +1063,10 @@ static const TypeInfo aspeed_machine_types[] = { .name = MACHINE_TYPE_NAME("g220a-bmc"), .parent = TYPE_ASPEED_MACHINE, .class_init = aspeed_machine_g220a_class_init, + }, { + .name = MACHINE_TYPE_NAME("quanta-q71l-bmc"), + .parent = TYPE_ASPEED_MACHINE, + .class_init = aspeed_machine_quanta_q71l_class_init, }, { .name = MACHINE_TYPE_NAME("rainier-bmc"), .parent = TYPE_ASPEED_MACHINE,
Signature · 1 line
2.26.3
[PULL 02/18] aspeed/smc: Remove unused "sdram-base" property
In reply to Cédric Le GoaterMessage-Id: <[email protected]>
--- include/hw/ssi/aspeed_smc.h | 3 --- hw/arm/aspeed_ast2600.c | 4 ---- hw/arm/aspeed_soc.c | 4 ---- hw/ssi/aspeed_smc.c | 1 - 4 files changed, 12 deletions(-)
include/hw/ssi/aspeed_smc.h +0 -3
@@ -103,9 +103,6 @@ struct AspeedSMCState {uint8_t r_timings;uint8_t conf_enable_w0; -/* for DMA support */ -uint64_t sdram_base; -AddressSpace flash_as;MemoryRegion *dram_mr;AddressSpace dram_as;
hw/arm/aspeed_ast2600.c +0 -4
@@ -344,10 +344,6 @@ static void aspeed_soc_ast2600_realize(DeviceState *dev, Error **errp)/* FMC, The number of CS is set at the board level */ object_property_set_link (OBJECT (&s->fmc),"dram" ,OBJECT (s->dram_mr), &error_abort); -if (!object_property_set_int (OBJECT (&s->fmc),"sdram-base" , - sc->memmap[ASPEED_DEV_SDRAM ], errp)) { -return ; - }if (!sysbus_realize (SYS_BUS_DEVICE (&s->fmc), errp)) {return ; }
hw/arm/aspeed_soc.c +0 -4
@@ -301,10 +301,6 @@ static void aspeed_soc_realize(DeviceState *dev, Error **errp)/* FMC, The number of CS is set at the board level */ object_property_set_link (OBJECT (&s->fmc),"dram" ,OBJECT (s->dram_mr), &error_abort); -if (!object_property_set_int (OBJECT (&s->fmc),"sdram-base" , - sc->memmap[ASPEED_DEV_SDRAM ], errp)) { -return ; - }if (!sysbus_realize (SYS_BUS_DEVICE (&s->fmc), errp)) {return ; }
hw/ssi/aspeed_smc.c +0 -1
@@ -1431,7 +1431,6 @@ static const VMStateDescription vmstate_aspeed_smc = {static Property aspeed_smc_properties[] = {DEFINE_PROP_UINT32 ("num-cs" , AspeedSMCState, num_cs,1 ),DEFINE_PROP_BOOL ("inject-failure" , AspeedSMCState, inject_failure, false), -DEFINE_PROP_UINT64 ("sdram-base" , AspeedSMCState, sdram_base,0 ),DEFINE_PROP_LINK ("dram" , AspeedSMCState, dram_mr, TYPE_MEMORY_REGION, MemoryRegion *),DEFINE_PROP_END_OF_LIST (),
Signature · 1 line
2.26.3
[PULL 17/18] hw/block: m25p80: Add support for mt25ql02g and mt25qu02g
In reply to Cédric Le GoaterThe Micron mt25ql02g is a 3V 2Gb serial NOR flash memory supporting dual I/O and quad I/O, 4KB, 32KB, 64KB sector erase. It also supports 4B opcodes. The mt25qu02g operates at 1.8V.
--- hw/block/m25p80.c | 2 ++ 1 file changed, 2 insertions(+)
hw/block/m25p80.c +2 -0
@@ -259,6 +259,8 @@ static const FlashPartInfo known_devices[] = { { INFO_STACKED("n25q00a", 0x20bb21, 0x1000, 64 << 10, 2048, ER_4K, 4) }, { INFO_STACKED("mt25ql01g", 0x20ba21, 0x1040, 64 << 10, 2048, ER_4K, 2) }, { INFO_STACKED("mt25qu01g", 0x20bb21, 0x1040, 64 << 10, 2048, ER_4K, 2) }, + { INFO_STACKED("mt25ql02g", 0x20ba22, 0x1040, 64 << 10, 4096, ER_4K | ER_32K, 2) }, + { INFO_STACKED("mt25qu02g", 0x20bb22, 0x1040, 64 << 10, 4096, ER_4K | ER_32K, 2) },/* Spansion -- single (large) sector size only, at least * for the chips listed here (without boot sectors).
Signature · 1 line
2.26.3
Peter Maydell
AppliedQuoted 16 lines · Cédric Le Goater
The following changes since commit
609d7596524ab204ccd71ef42c9eee4c7c338ea4:Update version for v6.0.0 release (2021-04-29 18:05:29 +0100)
are available in the Git repository at:
https://github.com/legoater/qemu/ tags/pull-aspeed-20210503
for you to fetch changes up to
9cccb912cfa865f0bae6b156fa94e2f216dd8835:aspeed: Add support for the quanta-q7l1-bmc board (2021-05-01 10:03:52 +0200)
----------------------------------------------------------------
Aspeed patches :
Quoted 6 lines
* Fixes for the DMA space
* New model for ASPEED's Hash and Crypto Engine (Joel and Klaus)
* Acceptance tests (Joel)
* A fix for the XDMA model
* Some extra features for the SMC controller.
* Two new boards : rainier-bmc and quanta-q7l1-bmc (Patrick)
Applied, thanks.
Please update the changelog at https://wiki.qemu.org/ChangeLog/6.1
for any user-visible changes.
-- PMM