Skip to contentSkip to conversation

tests/functional/aarch64/test_aspeed: Disable kernel crypto self-tests in AST2700 boot tests

PATCH Applied Jamin Lin 2 participants 3 messages Mar 16 – Mar 17 Arm/Aspeed machine support

lore
Share & tools
lore

Jamin Lin

author
#0 lore raw

PATCH 1/1 tests/functional/aarch64/test_aspeed: Disable kernel crypto self-tests in AST2700 boot tests

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.

---
 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(-)
tests/functional/aarch64/test_aspeed_ast2700a1.py +9 -2
index 5c0c4b0ed5..b0c08854da 100755
@@ -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):
tests/functional/aarch64/test_aspeed_ast2700a2.py +9 -2
index cc62a915b5..ed414999f4 100755
@@ -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):
tests/functional/aarch64/test_aspeed_ast2700fc.py +7 -2
index f68f40a1bf..df889134ed 100755
@@ -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 ...')
 
Signature · 1 line
2.43.0
Reviewed-by on v1 1/1
#1 lore raw
Quoted 29 lines · Jamin Lin

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:

Quoted 8 lines
   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.

Thanks,

C.

Quoted 98 lines
---
  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(-)
tests/functional/aarch64/test_aspeed_ast2700a1.py +9 -2
index 5c0c4b0ed5..b0c08854da 100755
@@ -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):
tests/functional/aarch64/test_aspeed_ast2700a2.py +9 -2
index cc62a915b5..ed414999f4 100755
@@ -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):
tests/functional/aarch64/test_aspeed_ast2700fc.py +7 -2
index f68f40a1bf..df889134ed 100755
@@ -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 lore raw
In reply to Jamin Lin
Quoted 126 lines · Jamin Lin

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.

---
  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(-)
tests/functional/aarch64/test_aspeed_ast2700a1.py +9 -2
index 5c0c4b0ed5..b0c08854da 100755
@@ -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):
tests/functional/aarch64/test_aspeed_ast2700a2.py +9 -2
index cc62a915b5..ed414999f4 100755
@@ -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):
tests/functional/aarch64/test_aspeed_ast2700fc.py +4 -2
index f68f40a1bf..df889134ed 100755
@@ -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,

tests/functional/aarch64/test_aspeed_ast2700fc.py def enable_ast2700_pcie2(self): · line 53

Quoted 9 lines
tests/functional/aarch64/test_aspeed_ast2700fc.py +3 -0
@@ -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.