On 2026-07-14 14:01, Ilya Leoshkevich wrote:
On 7/10/26 17:29, Harald Freudenberger wrote:
Add simple tests for the CPACF instructions implemented:
- kdsa - minimal as only query is implemented
- kimd - query, sha256, sha512
- klmd - query, sha256, sha512
- km - query, aes 128, 192, 256 with clear and prot key
- kmac - minimal as only query is implemented
- kmc - query, aes 128, 192, 256 with clear and prot key
- kmctr - query, aes 128, 192, 256 with clear and prot key
- pcc - query, xts aes 128, 256 and prot key xts aes 128, 256
- prno - query, trng
No test for pckmo as this is a privileged instruction.
No test for kma, kmf, kmo as these instructions are currently
not implemented at all.

Signed-off-by: Harald Freudenberger <[email protected]>
---
  target/s390x/tcg/cpacf.h        |   7 +
  tests/tcg/s390x/Makefile.target |   9 +
  tests/tcg/s390x/cpacf-kdsa.c    |  58 ++++
  tests/tcg/s390x/cpacf-kimd.c    | 166 +++++++++
  tests/tcg/s390x/cpacf-klmd.c    | 206 +++++++++++
tests/tcg/s390x/cpacf-km.c | 590 ++++++++++++++++++++++++++++++++
  tests/tcg/s390x/cpacf-kmac.c    |  58 ++++
  tests/tcg/s390x/cpacf-kmc.c     | 351 +++++++++++++++++++
  tests/tcg/s390x/cpacf-kmctr.c   | 360 +++++++++++++++++++
  tests/tcg/s390x/cpacf-pcc.c     | 245 +++++++++++++
  tests/tcg/s390x/cpacf-prno.c    | 131 +++++++
tests/tcg/s390x/cpacf.h | 571 +++++++++++++++++++++++++++++++
  12 files changed, 2752 insertions(+)
  create mode 100644 tests/tcg/s390x/cpacf-kdsa.c
  create mode 100644 tests/tcg/s390x/cpacf-kimd.c
  create mode 100644 tests/tcg/s390x/cpacf-klmd.c
  create mode 100644 tests/tcg/s390x/cpacf-km.c
  create mode 100644 tests/tcg/s390x/cpacf-kmac.c
  create mode 100644 tests/tcg/s390x/cpacf-kmc.c
  create mode 100644 tests/tcg/s390x/cpacf-kmctr.c
  create mode 100644 tests/tcg/s390x/cpacf-pcc.c
  create mode 100644 tests/tcg/s390x/cpacf-prno.c
  create mode 100644 tests/tcg/s390x/cpacf.h

I get failures when running these on a real z17, for example:

$ ./cpacf-kdsa
test_kdsa_query failed
cpacf-kdsa: 1 failures

Ok, I only tested on qemu. But of course you are right, it should
work fine on a real machine also. Will check this ...

Oh maybe one thing: query works with a fixed bitfield of subfunctions
which are supported - by the QEMU CPACF implementation. So a real
query may result in a lot of more subfunctions enabled in the result
bitfield and thus the compare will fail.

Reply via email to