[PATCH v4 0/4] Support HACE to AST2700 (resend)

Jamin Lin via posted 4 patches 1 month ago
include/hw/misc/aspeed_hace.h |  2 ++
hw/arm/aspeed_ast27x0.c       | 15 ++++++++++
hw/misc/aspeed_hace.c         | 55 ++++++++++++++++++++++++++++++++---
3 files changed, 68 insertions(+), 4 deletions(-)
[PATCH v4 0/4] Support HACE to AST2700 (resend)
Posted by Jamin Lin via 1 month ago
This patch series is from https://patchwork.kernel.org/project/qemu-devel/cover/20250213033531.3367697-1-jamin_lin@aspeedtech.com/. 
To expedite the review process, I have separated the HACE patches portion from
the https://patchwork.kernel.org/project/qemu-devel/cover/20250213033531.3367697-1-jamin_lin@aspeedtech.com/ patch series into this new patch series.

v4: Support HACE to AST2700

Jamin Lin (4):
  hw/misc/aspeed_hace: Fix coding style
  hw/misc/aspeed_hace: Add AST2700 support
  hw/arm/aspeed_ast27x0: Add HACE support for AST2700
  hw/misc/aspeed_hace: Fix boot issue in the Crypto Manager Self Test

 include/hw/misc/aspeed_hace.h |  2 ++
 hw/arm/aspeed_ast27x0.c       | 15 ++++++++++
 hw/misc/aspeed_hace.c         | 55 ++++++++++++++++++++++++++++++++---
 3 files changed, 68 insertions(+), 4 deletions(-)

-- 
2.34.1
Re: [PATCH v4 0/4] Support HACE to AST2700 (resend)
Posted by Cédric Le Goater 3 weeks ago
Jamin,

On 2/25/25 08:56, Jamin Lin wrote:
> This patch series is from https://patchwork.kernel.org/project/qemu-devel/cover/20250213033531.3367697-1-jamin_lin@aspeedtech.com/.
> To expedite the review process, I have separated the HACE patches portion from
> the https://patchwork.kernel.org/project/qemu-devel/cover/20250213033531.3367697-1-jamin_lin@aspeedtech.com/ patch series into this new patch series.
> 
> v4: Support HACE to AST2700
> 
> Jamin Lin (4):
>    hw/misc/aspeed_hace: Fix coding style
>    hw/misc/aspeed_hace: Add AST2700 support
>    hw/arm/aspeed_ast27x0: Add HACE support for AST2700
>    hw/misc/aspeed_hace: Fix boot issue in the Crypto Manager Self Test
> 
>   include/hw/misc/aspeed_hace.h |  2 ++
>   hw/arm/aspeed_ast27x0.c       | 15 ++++++++++
>   hw/misc/aspeed_hace.c         | 55 ++++++++++++++++++++++++++++++++---
>   3 files changed, 68 insertions(+), 4 deletions(-)
> 

The kernel reports a lot of errors when running the crypto tests on a
AST2700 A1 Soc. See the functional test logs :
     
     $ grep alg: build/tests/functional/aarch64/test_aarch64_aspeed.AST2x00MachineSDK.test_aarch64_ast2700a1_evb_sdk_v09_05/console.log

     2025-03-12 10:10:42,705: [    2.206831] alg: skcipher: aspeed-ctr-tdes encryption test failed (wrong result) on test vector 0, cfg="in-place (one sglist)"
     2025-03-12 10:10:42,706: [    2.207328] alg: self-tests for ctr(des3_ede) using aspeed-ctr-tdes failed (rc=-22)
     2025-03-12 10:10:42,707: [    2.207894] alg: self-tests for ctr(des3_ede) using aspeed-ctr-tdes failed (rc=-22)
     2025-03-12 10:10:42,725: [    2.219342] alg: skcipher: aspeed-ctr-des encryption test failed (wrong result) on test vector 0, cfg="in-place (one sglist)"
     2025-03-12 10:10:42,725: [    2.219511] alg: self-tests for ctr(des) using aspeed-ctr-des failed (rc=-22)
     2025-03-12 10:10:42,725: [    2.219651] alg: self-tests for ctr(des) using aspeed-ctr-des failed (rc=-22)
     2025-03-12 10:10:42,733: [    2.224344] alg: skcipher: aspeed-ctr-aes encryption test failed (wrong result) on test vector 0, cfg="in-place (one sglist)"
     2025-03-12 10:10:42,734: [    2.224775] alg: self-tests for ctr(aes) using aspeed-ctr-aes failed (rc=-22)
     2025-03-12 10:10:42,734: [    2.225015] alg: self-tests for ctr(aes) using aspeed-ctr-aes failed (rc=-22)
     ...

What is something missing in the models ?

Thanks,

C.
RE: [PATCH v4 0/4] Support HACE to AST2700 (resend)
Posted by Jamin Lin 3 weeks ago
Hi Cedric,

> -----Original Message-----
> From: Cédric Le Goater <clg@kaod.org>
> Sent: Wednesday, March 12, 2025 5:25 PM
> To: Jamin Lin <jamin_lin@aspeedtech.com>; Peter Maydell
> <peter.maydell@linaro.org>; Steven Lee <steven_lee@aspeedtech.com>; Troy
> Lee <leetroy@gmail.com>; Andrew Jeffery <andrew@codeconstruct.com.au>;
> Joel Stanley <joel@jms.id.au>; open list:ASPEED BMCs
> <qemu-arm@nongnu.org>; open list:All patches CC here
> <qemu-devel@nongnu.org>
> Cc: Troy Lee <troy_lee@aspeedtech.com>
> Subject: Re: [PATCH v4 0/4] Support HACE to AST2700 (resend)
> 
> Jamin,
> 
> On 2/25/25 08:56, Jamin Lin wrote:
> > This patch series is from
> https://patchwork.kernel.org/project/qemu-devel/cover/20250213033531.336
> 7697-1-jamin_lin@aspeedtech.com/.
> > To expedite the review process, I have separated the HACE patches
> > portion from the
> https://patchwork.kernel.org/project/qemu-devel/cover/20250213033531.336
> 7697-1-jamin_lin@aspeedtech.com/ patch series into this new patch series.
> >
> > v4: Support HACE to AST2700
> >
> > Jamin Lin (4):
> >    hw/misc/aspeed_hace: Fix coding style
> >    hw/misc/aspeed_hace: Add AST2700 support
> >    hw/arm/aspeed_ast27x0: Add HACE support for AST2700
> >    hw/misc/aspeed_hace: Fix boot issue in the Crypto Manager Self Test
> >
> >   include/hw/misc/aspeed_hace.h |  2 ++
> >   hw/arm/aspeed_ast27x0.c       | 15 ++++++++++
> >   hw/misc/aspeed_hace.c         | 55
> ++++++++++++++++++++++++++++++++---
> >   3 files changed, 68 insertions(+), 4 deletions(-)
> >
> 
> The kernel reports a lot of errors when running the crypto tests on a
> AST2700 A1 Soc. See the functional test logs :
> 
>      $ grep alg:
> build/tests/functional/aarch64/test_aarch64_aspeed.AST2x00MachineSDK.test
> _aarch64_ast2700a1_evb_sdk_v09_05/console.log
> 
>      2025-03-12 10:10:42,705: [    2.206831] alg: skcipher: aspeed-ctr-tdes
> encryption test failed (wrong result) on test vector 0, cfg="in-place (one sglist)"
>      2025-03-12 10:10:42,706: [    2.207328] alg: self-tests for
> ctr(des3_ede) using aspeed-ctr-tdes failed (rc=-22)
>      2025-03-12 10:10:42,707: [    2.207894] alg: self-tests for
> ctr(des3_ede) using aspeed-ctr-tdes failed (rc=-22)
>      2025-03-12 10:10:42,725: [    2.219342] alg: skcipher: aspeed-ctr-des
> encryption test failed (wrong result) on test vector 0, cfg="in-place (one sglist)"
>      2025-03-12 10:10:42,725: [    2.219511] alg: self-tests for ctr(des)
> using aspeed-ctr-des failed (rc=-22)
>      2025-03-12 10:10:42,725: [    2.219651] alg: self-tests for ctr(des)
> using aspeed-ctr-des failed (rc=-22)
>      2025-03-12 10:10:42,733: [    2.224344] alg: skcipher: aspeed-ctr-aes
> encryption test failed (wrong result) on test vector 0, cfg="in-place (one sglist)"
>      2025-03-12 10:10:42,734: [    2.224775] alg: self-tests for ctr(aes)
> using aspeed-ctr-aes failed (rc=-22)
>      2025-03-12 10:10:42,734: [    2.225015] alg: self-tests for ctr(aes)
> using aspeed-ctr-aes failed (rc=-22)
>      ...
> 
> What is something missing in the models ?
> 

Currently, we do not implement HACE/CRYPT in aspeed_hace.c. 
https://patchwork.kernel.org/project/qemu-devel/patch/20250225075622.305515-5-jamin_lin@aspeedtech.com/

Known Issue:
The HACE crypto and hash engine is enable by default since AST2700 A1.
However, aspeed_hace.c(HACE model) currently does not support the CRYPTO command.
To boot AST2700 A1, created a patch which temporarily resolves the
issue by sending an interrupt to notify the firmware that the cryptographic
command has completed. It is a temporary workaround to resolve the boot issue
in the Crypto Manager SelfTest.

As a result, you will encounter the following kernel warning due to the
Crypto Manager test failure.

```
alg: skcipher: aspeed-ctr-tdes encryption test failed (wrong result) on test vector 0, cfg="in-place (one sglist)"
[    5.035966] alg: self-tests for ctr(des3_ede) using aspeed-ctr-tdes failed (rc=-22)
[    5.036139] ------------[ cut here ]------------
[    5.037188] alg: self-tests for ctr(des3_ede) using aspeed-ctr-tdes failed (rc=-22)
[    5.037312] WARNING: CPU: 2 PID: 109 at /crypto/testmgr.c:5936 alg_test+0x42c/0x548
[    5.038049] Modules linked in:
[    5.038302] CPU: 2 PID: 109 Comm: cryptomgr_test Tainted: G        W          6.6.52-v00.06.04-gf52a0cf7c475 #1
[    5.038787] Hardware name: AST2700-EVB (DT)
[    5.038988] pstate: 60000005 (nZCv daif -PAN -UAO -TCO -DIT -SSBS BTYPE=--)
[    5.039315] pc : alg_test+0x42c/0x548
[    5.039505] lr : alg_test+0x42c/0x548
[    5.039697] sp : ffffffc0825e3d50
[    5.039862] x29: ffffffc0825e3df0 x28: 0000000000000004 x27: 0000000000000000
[    5.040226] x26: ffffffc080bcada0 x25: ffffffc081dac9d0 x24: 0000000000000004
[    5.040700] x23: 0000000000001285 x22: ffffff8003ded280 x21: ffffff8003ded200
[    5.041458] x20: 00000000ffffffff x19: 00000000ffffffea x18: ffffffffffffffff
[    5.041915] x17: 282064656c696166 x16: 20736564742d7274 x15: 00000000fffffffe
[    5.042287] x14: 0000000000000000 x13: ffffffc081ba555c x12: 65742d666c657320
[    5.042684] x11: 00000000fffeffff x10: ffffffc0818ff048 x9 : ffffffc0800a36e4
[    5.043077] x8 : 000000000017ffe8 x7 : c0000000fffeffff x6 : 000000000057ffa8
[    5.043461] x5 : 000000000000ffff x4 : 0000000000000000 x3 : 0000000000000000
[    5.043751] x2 : 0000000000000000 x1 : 0000000000000000 x0 : ffffff800415e740
[    5.045544] Call trace:
[    5.045693]  alg_test+0x42c/0x548
[    5.045878]  cryptomgr_test+0x28/0x48
[    5.046052]  kthread+0x114/0x120
[    5.046226]  ret_from_fork+0x10/0x20
[    5.046413] ---[ end trace 0000000000000000 ]---
[    5.071510] alg: skcipher: aspeed-ctr-des encryption test failed (wrong result) on test vector 0, cfg="in-place (one sglist)"
[    5.072145] alg: self-tests for ctr(des) using aspeed-ctr-des failed (rc=-22)
```

Thanks-Jamin

> Thanks,
> 
> C.
> 

Re: [PATCH v4 0/4] Support HACE to AST2700 (resend)
Posted by Cédric Le Goater 1 month ago
On 2/25/25 08:56, Jamin Lin wrote:
> This patch series is from https://patchwork.kernel.org/project/qemu-devel/cover/20250213033531.3367697-1-jamin_lin@aspeedtech.com/.
> To expedite the review process, I have separated the HACE patches portion from
> the https://patchwork.kernel.org/project/qemu-devel/cover/20250213033531.3367697-1-jamin_lin@aspeedtech.com/ patch series into this new patch series.
> 
> v4: Support HACE to AST2700
> 
> Jamin Lin (4):
>    hw/misc/aspeed_hace: Fix coding style
>    hw/misc/aspeed_hace: Add AST2700 support
>    hw/arm/aspeed_ast27x0: Add HACE support for AST2700
>    hw/misc/aspeed_hace: Fix boot issue in the Crypto Manager Self Test
> 
>   include/hw/misc/aspeed_hace.h |  2 ++
>   hw/arm/aspeed_ast27x0.c       | 15 ++++++++++
>   hw/misc/aspeed_hace.c         | 55 ++++++++++++++++++++++++++++++++---
>   3 files changed, 68 insertions(+), 4 deletions(-)
> 


Applied to aspeed-next.

Thanks,

C.