[PATCH v1] tests/functional/aarch64/test_aspeed: Disable kernel crypto self-tests in AST2700 boot tests

Jamin Lin posted 1 patch 3 weeks ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/20260316081549.1279841-1-jamin._5Flin@aspeedtech.com
Maintainers: "Cédric Le Goater" <clg@kaod.org>, Peter Maydell <peter.maydell@linaro.org>, Steven Lee <steven_lee@aspeedtech.com>, Troy Lee <leetroy@gmail.com>, Jamin Lin <jamin_lin@aspeedtech.com>, Andrew Jeffery <andrew@codeconstruct.com.au>, Joel Stanley <joel@jms.id.au>
tests/functional/aarch64/test_aspeed_ast2700a1.py | 11 +++++++++--
tests/functional/aarch64/test_aspeed_ast2700a2.py | 11 +++++++++--
tests/functional/aarch64/test_aspeed_ast2700fc.py |  9 +++++++--
3 files changed, 25 insertions(+), 6 deletions(-)
[PATCH v1] tests/functional/aarch64/test_aspeed: Disable kernel crypto self-tests in AST2700 boot tests
Posted by Jamin Lin 3 weeks ago
Disable the kernel crypto self-tests in the AST2700 functional tests by
appending "cryptomgr.notests=1" to the U-Boot bootargs before booting
the kernel.

The ASPEED SDK enables crypto self-tests during kernel startup to
validate the hardware crypto engine. However, the current QEMU
implementation of the AST2700 HACE/crypto engine is still incomplete.
As a result, the kernel crypto self-tests trigger multiple warnings
during boot when running under QEMU.

Typical examples observed in the kernel log include failures for
several cipher modes such as DES/TDES/AES in ECB/CBC/CTR modes:

alg: self-tests for ctr(des) using aspeed-ctr-des failed (rc=-22)
alg: self-tests for ecb(des3_ede) using aspeed-ecb-tdes failed (rc=-22)
alg: self-tests for cbc(aes) using aspeed-cbc-aes failed (rc=-22)
...

To reduce noise in the functional test logs, the tests now append
the following parameter to the kernel bootargs:

  cryptomgr.notests=1

This disables the kernel crypto self-tests when running the functional
tests under QEMU.

For validating the HACE implementation, we should instead rely on the
dedicated QEMU unit tests located in:

  tests/qtest/ast2700-hace-test.c

Once the QEMU implementation of the ASPEED HACE/crypto model has
progressed further and supports the missing crypto modes, we can
reassess whether enabling the kernel crypto self-tests again in the
functional tests is appropriate.

Signed-off-by: Jamin Lin <jamin_lin@aspeedtech.com>
---
 tests/functional/aarch64/test_aspeed_ast2700a1.py | 11 +++++++++--
 tests/functional/aarch64/test_aspeed_ast2700a2.py | 11 +++++++++--
 tests/functional/aarch64/test_aspeed_ast2700fc.py |  9 +++++++--
 3 files changed, 25 insertions(+), 6 deletions(-)

diff --git a/tests/functional/aarch64/test_aspeed_ast2700a1.py b/tests/functional/aarch64/test_aspeed_ast2700a1.py
index 5c0c4b0ed5..b0c08854da 100755
--- a/tests/functional/aarch64/test_aspeed_ast2700a1.py
+++ b/tests/functional/aarch64/test_aspeed_ast2700a1.py
@@ -51,9 +51,11 @@ def verify_vbootrom_firmware_flow(self):
         wait_for_console_pattern(self, 'pass')
         wait_for_console_pattern(self, 'Jumping to BL31 (Trusted Firmware-A)')
 
+    def disable_kernel_crypto_selftest(self):
+         exec_command_and_wait_for_pattern(self,
+            'setenv bootargs "${bootargs} cryptomgr.notests=1"', '=>')
+
     def enable_ast2700_pcie2(self):
-        wait_for_console_pattern(self, 'Hit any key to stop autoboot')
-        exec_command_and_wait_for_pattern(self, '\012', '=>')
         exec_command_and_wait_for_pattern(self,
             'cp 100420000 403000000 900000', '=>')
         exec_command_and_wait_for_pattern(self,
@@ -67,8 +69,13 @@ def enable_ast2700_pcie2(self):
 
     def verify_openbmc_boot_start(self, enable_pcie=True):
         wait_for_console_pattern(self, 'U-Boot 2023.10')
+        wait_for_console_pattern(self, 'Hit any key to stop autoboot')
+        exec_command_and_wait_for_pattern(self, '\012', '=>')
+        self.disable_kernel_crypto_selftest()
         if enable_pcie:
             self.enable_ast2700_pcie2()
+        else:
+            exec_command(self, 'boot')
         wait_for_console_pattern(self, 'Linux version ')
 
     def verify_openbmc_boot_and_login(self, name, enable_pcie=True):
diff --git a/tests/functional/aarch64/test_aspeed_ast2700a2.py b/tests/functional/aarch64/test_aspeed_ast2700a2.py
index cc62a915b5..ed414999f4 100755
--- a/tests/functional/aarch64/test_aspeed_ast2700a2.py
+++ b/tests/functional/aarch64/test_aspeed_ast2700a2.py
@@ -51,9 +51,11 @@ def verify_vbootrom_firmware_flow(self):
         wait_for_console_pattern(self, 'pass')
         wait_for_console_pattern(self, 'Jumping to BL31 (Trusted Firmware-A)')
 
+    def disable_kernel_crypto_selftest(self):
+         exec_command_and_wait_for_pattern(self,
+            'setenv bootargs "${bootargs} cryptomgr.notests=1"', '=>')
+
     def enable_ast2700_pcie2(self):
-        wait_for_console_pattern(self, 'Hit any key to stop autoboot')
-        exec_command_and_wait_for_pattern(self, '\012', '=>')
         exec_command_and_wait_for_pattern(self,
             'cp 100420000 403000000 900000', '=>')
         exec_command_and_wait_for_pattern(self,
@@ -67,8 +69,13 @@ def enable_ast2700_pcie2(self):
 
     def verify_openbmc_boot_start(self, enable_pcie=True):
         wait_for_console_pattern(self, 'U-Boot 2023.10')
+        wait_for_console_pattern(self, 'Hit any key to stop autoboot')
+        exec_command_and_wait_for_pattern(self, '\012', '=>')
+        self.disable_kernel_crypto_selftest()
         if enable_pcie:
             self.enable_ast2700_pcie2()
+        else:
+            exec_command(self, 'boot')
         wait_for_console_pattern(self, 'Linux version ')
 
     def verify_openbmc_boot_and_login(self, name, enable_pcie=True):
diff --git a/tests/functional/aarch64/test_aspeed_ast2700fc.py b/tests/functional/aarch64/test_aspeed_ast2700fc.py
index f68f40a1bf..df889134ed 100755
--- a/tests/functional/aarch64/test_aspeed_ast2700fc.py
+++ b/tests/functional/aarch64/test_aspeed_ast2700fc.py
@@ -27,9 +27,11 @@ def do_test_aarch64_aspeed_sdk_start(self, image):
 
         self.vm.launch()
 
+    def disable_kernel_crypto_selftest(self):
+         exec_command_and_wait_for_pattern(self,
+            'setenv bootargs "${bootargs} cryptomgr.notests=1"', '=>')
+
     def enable_ast2700_pcie2(self):
-        wait_for_console_pattern(self, 'Hit any key to stop autoboot')
-        exec_command_and_wait_for_pattern(self, '\012', '=>')
         exec_command_and_wait_for_pattern(self,
             'cp 100420000 403000000 900000', '=>')
         exec_command_and_wait_for_pattern(self,
@@ -43,6 +45,9 @@ def enable_ast2700_pcie2(self):
 
     def verify_openbmc_boot_and_login(self, name):
         wait_for_console_pattern(self, 'U-Boot 2023.10')
+        wait_for_console_pattern(self, 'Hit any key to stop autoboot')
+        exec_command_and_wait_for_pattern(self, '\012', '=>')
+        self.disable_kernel_crypto_selftest()
         self.enable_ast2700_pcie2()
         wait_for_console_pattern(self, 'Starting kernel ...')
 
-- 
2.43.0
Re: [PATCH v1] tests/functional/aarch64/test_aspeed: Disable kernel crypto self-tests in AST2700 boot tests
Posted by Cédric Le Goater 2 weeks, 6 days ago
On 3/16/26 09:15, Jamin Lin wrote:
> Disable the kernel crypto self-tests in the AST2700 functional tests by
> appending "cryptomgr.notests=1" to the U-Boot bootargs before booting
> the kernel.
> 
> The ASPEED SDK enables crypto self-tests during kernel startup to
> validate the hardware crypto engine. However, the current QEMU
> implementation of the AST2700 HACE/crypto engine is still incomplete.
> As a result, the kernel crypto self-tests trigger multiple warnings
> during boot when running under QEMU.
> 
> Typical examples observed in the kernel log include failures for
> several cipher modes such as DES/TDES/AES in ECB/CBC/CTR modes:
> 
> alg: self-tests for ctr(des) using aspeed-ctr-des failed (rc=-22)
> alg: self-tests for ecb(des3_ede) using aspeed-ecb-tdes failed (rc=-22)
> alg: self-tests for cbc(aes) using aspeed-cbc-aes failed (rc=-22)
> ...
> 
> To reduce noise in the functional test logs, the tests now append
> the following parameter to the kernel bootargs:
> 
>    cryptomgr.notests=1
> 
> This disables the kernel crypto self-tests when running the functional
> tests under QEMU.
> 
> For validating the HACE implementation, we should instead rely on the
> dedicated QEMU unit tests located in:
> 
>    tests/qtest/ast2700-hace-test.c
> 
> Once the QEMU implementation of the ASPEED HACE/crypto model has
> progressed further and supports the missing crypto modes, we can
> reassess whether enabling the kernel crypto self-tests again in the
> functional tests is appropriate.
> 
> Signed-off-by: Jamin Lin <jamin_lin@aspeedtech.com>
> ---
>   tests/functional/aarch64/test_aspeed_ast2700a1.py | 11 +++++++++--
>   tests/functional/aarch64/test_aspeed_ast2700a2.py | 11 +++++++++--
>   tests/functional/aarch64/test_aspeed_ast2700fc.py |  9 +++++++--
>   3 files changed, 25 insertions(+), 6 deletions(-)
> 
> diff --git a/tests/functional/aarch64/test_aspeed_ast2700a1.py b/tests/functional/aarch64/test_aspeed_ast2700a1.py
> index 5c0c4b0ed5..b0c08854da 100755
> --- a/tests/functional/aarch64/test_aspeed_ast2700a1.py
> +++ b/tests/functional/aarch64/test_aspeed_ast2700a1.py
> @@ -51,9 +51,11 @@ def verify_vbootrom_firmware_flow(self):
>           wait_for_console_pattern(self, 'pass')
>           wait_for_console_pattern(self, 'Jumping to BL31 (Trusted Firmware-A)')
>   
> +    def disable_kernel_crypto_selftest(self):
> +         exec_command_and_wait_for_pattern(self,
> +            'setenv bootargs "${bootargs} cryptomgr.notests=1"', '=>')
> +
>       def enable_ast2700_pcie2(self):
> -        wait_for_console_pattern(self, 'Hit any key to stop autoboot')
> -        exec_command_and_wait_for_pattern(self, '\012', '=>')
>           exec_command_and_wait_for_pattern(self,
>               'cp 100420000 403000000 900000', '=>')
>           exec_command_and_wait_for_pattern(self,
> @@ -67,8 +69,13 @@ def enable_ast2700_pcie2(self):
>   
>       def verify_openbmc_boot_start(self, enable_pcie=True):
>           wait_for_console_pattern(self, 'U-Boot 2023.10')
> +        wait_for_console_pattern(self, 'Hit any key to stop autoboot')
> +        exec_command_and_wait_for_pattern(self, '\012', '=>')
> +        self.disable_kernel_crypto_selftest()
>           if enable_pcie:
>               self.enable_ast2700_pcie2()
> +        else:
> +            exec_command(self, 'boot')
>           wait_for_console_pattern(self, 'Linux version ')
>   
>       def verify_openbmc_boot_and_login(self, name, enable_pcie=True):
> diff --git a/tests/functional/aarch64/test_aspeed_ast2700a2.py b/tests/functional/aarch64/test_aspeed_ast2700a2.py
> index cc62a915b5..ed414999f4 100755
> --- a/tests/functional/aarch64/test_aspeed_ast2700a2.py
> +++ b/tests/functional/aarch64/test_aspeed_ast2700a2.py
> @@ -51,9 +51,11 @@ def verify_vbootrom_firmware_flow(self):
>           wait_for_console_pattern(self, 'pass')
>           wait_for_console_pattern(self, 'Jumping to BL31 (Trusted Firmware-A)')
>   
> +    def disable_kernel_crypto_selftest(self):
> +         exec_command_and_wait_for_pattern(self,
> +            'setenv bootargs "${bootargs} cryptomgr.notests=1"', '=>')
> +
>       def enable_ast2700_pcie2(self):
> -        wait_for_console_pattern(self, 'Hit any key to stop autoboot')
> -        exec_command_and_wait_for_pattern(self, '\012', '=>')
>           exec_command_and_wait_for_pattern(self,
>               'cp 100420000 403000000 900000', '=>')
>           exec_command_and_wait_for_pattern(self,
> @@ -67,8 +69,13 @@ def enable_ast2700_pcie2(self):
>   
>       def verify_openbmc_boot_start(self, enable_pcie=True):
>           wait_for_console_pattern(self, 'U-Boot 2023.10')
> +        wait_for_console_pattern(self, 'Hit any key to stop autoboot')
> +        exec_command_and_wait_for_pattern(self, '\012', '=>')
> +        self.disable_kernel_crypto_selftest()
>           if enable_pcie:
>               self.enable_ast2700_pcie2()
> +        else:
> +            exec_command(self, 'boot')
>           wait_for_console_pattern(self, 'Linux version ')
>   
>       def verify_openbmc_boot_and_login(self, name, enable_pcie=True):
> diff --git a/tests/functional/aarch64/test_aspeed_ast2700fc.py b/tests/functional/aarch64/test_aspeed_ast2700fc.py
> index f68f40a1bf..df889134ed 100755
> --- a/tests/functional/aarch64/test_aspeed_ast2700fc.py
> +++ b/tests/functional/aarch64/test_aspeed_ast2700fc.py
> @@ -27,9 +27,11 @@ def do_test_aarch64_aspeed_sdk_start(self, image):
>   
>           self.vm.launch()
>   
> +    def disable_kernel_crypto_selftest(self):
> +         exec_command_and_wait_for_pattern(self,
> +            'setenv bootargs "${bootargs} cryptomgr.notests=1"', '=>')
> +
>       def enable_ast2700_pcie2(self):
> -        wait_for_console_pattern(self, 'Hit any key to stop autoboot')
> -        exec_command_and_wait_for_pattern(self, '\012', '=>')
>           exec_command_and_wait_for_pattern(self,
>               'cp 100420000 403000000 900000', '=>')
>           exec_command_and_wait_for_pattern(self,
> @@ -43,6 +45,9 @@ def enable_ast2700_pcie2(self):
>   
>       def verify_openbmc_boot_and_login(self, name):
>           wait_for_console_pattern(self, 'U-Boot 2023.10')
> +        wait_for_console_pattern(self, 'Hit any key to stop autoboot')
> +        exec_command_and_wait_for_pattern(self, '\012', '=>')
> +        self.disable_kernel_crypto_selftest()
>           self.enable_ast2700_pcie2()
>           wait_for_console_pattern(self, 'Starting kernel ...')
>   

Applied to aspeed-next.

Thanks,

C.
Re: [PATCH v1] tests/functional/aarch64/test_aspeed: Disable kernel crypto self-tests in AST2700 boot tests
Posted by Cédric Le Goater 2 weeks, 6 days ago
On 3/16/26 09:15, Jamin Lin wrote:
> Disable the kernel crypto self-tests in the AST2700 functional tests by
> appending "cryptomgr.notests=1" to the U-Boot bootargs before booting
> the kernel.
> 
> The ASPEED SDK enables crypto self-tests during kernel startup to
> validate the hardware crypto engine. However, the current QEMU
> implementation of the AST2700 HACE/crypto engine is still incomplete.
> As a result, the kernel crypto self-tests trigger multiple warnings
> during boot when running under QEMU.
> 
> Typical examples observed in the kernel log include failures for
> several cipher modes such as DES/TDES/AES in ECB/CBC/CTR modes:
> 
> alg: self-tests for ctr(des) using aspeed-ctr-des failed (rc=-22)
> alg: self-tests for ecb(des3_ede) using aspeed-ecb-tdes failed (rc=-22)
> alg: self-tests for cbc(aes) using aspeed-cbc-aes failed (rc=-22)
> ...
> 
> To reduce noise in the functional test logs, the tests now append
> the following parameter to the kernel bootargs:
> 
>    cryptomgr.notests=1
> 
> This disables the kernel crypto self-tests when running the functional
> tests under QEMU.
> 
> For validating the HACE implementation, we should instead rely on the
> dedicated QEMU unit tests located in:
> 
>    tests/qtest/ast2700-hace-test.c
> 
> Once the QEMU implementation of the ASPEED HACE/crypto model has
> progressed further and supports the missing crypto modes, we can
> reassess whether enabling the kernel crypto self-tests again in the
> functional tests is appropriate.
> 
> Signed-off-by: Jamin Lin <jamin_lin@aspeedtech.com>

Reviewed-by: Cédric Le Goater <clg@redhat.com>

Thanks,

C.



> ---
>   tests/functional/aarch64/test_aspeed_ast2700a1.py | 11 +++++++++--
>   tests/functional/aarch64/test_aspeed_ast2700a2.py | 11 +++++++++--
>   tests/functional/aarch64/test_aspeed_ast2700fc.py |  9 +++++++--
>   3 files changed, 25 insertions(+), 6 deletions(-)
> 
> diff --git a/tests/functional/aarch64/test_aspeed_ast2700a1.py b/tests/functional/aarch64/test_aspeed_ast2700a1.py
> index 5c0c4b0ed5..b0c08854da 100755
> --- a/tests/functional/aarch64/test_aspeed_ast2700a1.py
> +++ b/tests/functional/aarch64/test_aspeed_ast2700a1.py
> @@ -51,9 +51,11 @@ def verify_vbootrom_firmware_flow(self):
>           wait_for_console_pattern(self, 'pass')
>           wait_for_console_pattern(self, 'Jumping to BL31 (Trusted Firmware-A)')
>   
> +    def disable_kernel_crypto_selftest(self):
> +         exec_command_and_wait_for_pattern(self,
> +            'setenv bootargs "${bootargs} cryptomgr.notests=1"', '=>')
> +
>       def enable_ast2700_pcie2(self):
> -        wait_for_console_pattern(self, 'Hit any key to stop autoboot')
> -        exec_command_and_wait_for_pattern(self, '\012', '=>')
>           exec_command_and_wait_for_pattern(self,
>               'cp 100420000 403000000 900000', '=>')
>           exec_command_and_wait_for_pattern(self,
> @@ -67,8 +69,13 @@ def enable_ast2700_pcie2(self):
>   
>       def verify_openbmc_boot_start(self, enable_pcie=True):
>           wait_for_console_pattern(self, 'U-Boot 2023.10')
> +        wait_for_console_pattern(self, 'Hit any key to stop autoboot')
> +        exec_command_and_wait_for_pattern(self, '\012', '=>')
> +        self.disable_kernel_crypto_selftest()
>           if enable_pcie:
>               self.enable_ast2700_pcie2()
> +        else:
> +            exec_command(self, 'boot')
>           wait_for_console_pattern(self, 'Linux version ')
>   
>       def verify_openbmc_boot_and_login(self, name, enable_pcie=True):
> diff --git a/tests/functional/aarch64/test_aspeed_ast2700a2.py b/tests/functional/aarch64/test_aspeed_ast2700a2.py
> index cc62a915b5..ed414999f4 100755
> --- a/tests/functional/aarch64/test_aspeed_ast2700a2.py
> +++ b/tests/functional/aarch64/test_aspeed_ast2700a2.py
> @@ -51,9 +51,11 @@ def verify_vbootrom_firmware_flow(self):
>           wait_for_console_pattern(self, 'pass')
>           wait_for_console_pattern(self, 'Jumping to BL31 (Trusted Firmware-A)')
>   
> +    def disable_kernel_crypto_selftest(self):
> +         exec_command_and_wait_for_pattern(self,
> +            'setenv bootargs "${bootargs} cryptomgr.notests=1"', '=>')
> +
>       def enable_ast2700_pcie2(self):
> -        wait_for_console_pattern(self, 'Hit any key to stop autoboot')
> -        exec_command_and_wait_for_pattern(self, '\012', '=>')
>           exec_command_and_wait_for_pattern(self,
>               'cp 100420000 403000000 900000', '=>')
>           exec_command_and_wait_for_pattern(self,
> @@ -67,8 +69,13 @@ def enable_ast2700_pcie2(self):
>   
>       def verify_openbmc_boot_start(self, enable_pcie=True):
>           wait_for_console_pattern(self, 'U-Boot 2023.10')
> +        wait_for_console_pattern(self, 'Hit any key to stop autoboot')
> +        exec_command_and_wait_for_pattern(self, '\012', '=>')
> +        self.disable_kernel_crypto_selftest()
>           if enable_pcie:
>               self.enable_ast2700_pcie2()
> +        else:
> +            exec_command(self, 'boot')
>           wait_for_console_pattern(self, 'Linux version ')
>   
>       def verify_openbmc_boot_and_login(self, name, enable_pcie=True):
> diff --git a/tests/functional/aarch64/test_aspeed_ast2700fc.py b/tests/functional/aarch64/test_aspeed_ast2700fc.py
> index f68f40a1bf..df889134ed 100755
> --- a/tests/functional/aarch64/test_aspeed_ast2700fc.py
> +++ b/tests/functional/aarch64/test_aspeed_ast2700fc.py
> @@ -27,9 +27,11 @@ def do_test_aarch64_aspeed_sdk_start(self, image):
>   
>           self.vm.launch()
>   
> +    def disable_kernel_crypto_selftest(self):
> +         exec_command_and_wait_for_pattern(self,
> +            'setenv bootargs "${bootargs} cryptomgr.notests=1"', '=>')
> +
>       def enable_ast2700_pcie2(self):
> -        wait_for_console_pattern(self, 'Hit any key to stop autoboot')
> -        exec_command_and_wait_for_pattern(self, '\012', '=>')
>           exec_command_and_wait_for_pattern(self,
>               'cp 100420000 403000000 900000', '=>')
>           exec_command_and_wait_for_pattern(self,
> @@ -43,6 +45,9 @@ def enable_ast2700_pcie2(self):
>   
>       def verify_openbmc_boot_and_login(self, name):
>           wait_for_console_pattern(self, 'U-Boot 2023.10')
> +        wait_for_console_pattern(self, 'Hit any key to stop autoboot')
> +        exec_command_and_wait_for_pattern(self, '\012', '=>')
> +        self.disable_kernel_crypto_selftest()
>           self.enable_ast2700_pcie2()
>           wait_for_console_pattern(self, 'Starting kernel ...')
>