On 8/6/26 17:13, 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
- pckmo - run query and check for SIGILL
- prno - query, trng
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 | 10 +
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-pckmo.c | 45 +++
tests/tcg/s390x/cpacf-prno.c | 131 +++++++
tests/tcg/s390x/cpacf.h | 571 +++++++++++++++++++++++++++++++
13 files changed, 2798 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-pckmo.c
create mode 100644 tests/tcg/s390x/cpacf-prno.c
create mode 100644 tests/tcg/s390x/cpacf.h
diff --git a/target/s390x/tcg/cpacf.h b/target/s390x/tcg/cpacf.h
index dc29834cf8..2f0cabc85a 100644
--- a/target/s390x/tcg/cpacf.h
+++ b/target/s390x/tcg/cpacf.h
@@ -223,6 +223,8 @@
#define CPACF_KDSA_PSIGN_ED25519 48
#define CPACF_KDSA_PSIGN_ED448 52
+#ifndef CPACF_H_INCLUDE_FOR_TESTS
+
/* from cpacf_sha256.c */
int cpacf_sha256(CPUS390XState *env, const int mmu_idx, uintptr_t ra,
uint64_t param_addr, uint64_t *message_reg, uint64_t
*len_reg,
@@ -254,6 +256,8 @@ int cpacf_aes_xts(CPUS390XState *env, const int mmu_idx,
uintptr_t ra,
uint64_t *src_ptr_reg, uint64_t *src_len_reg,
uint32_t type, uint8_t fc, uint8_t mod);
+#endif /* CPACF_H_INCLUDE_FOR_TESTS */
Could you please split this header in two instead?
For example: cpacf-arch.h that is usable from both emulation and tests
and cpacf.h just for emulation.
With that:
Acked-by: Ilya Leoshkevich <[email protected]>