s390x: Add tests for SIGP store adtl status
v3 cover s390x: Add tests for SIGP store adtl status
Changelog from v2:
----
- Remove useless one variable
- Use BIT_ULL instead of shifting 1ULL
- Minor style fixes
As suggested by Claudio, move the store adtl status I sent previously ("[kvm-unit-tests PATCH v2 0/9] s390x: Further extend instruction interception
tests") into its own file.
Nico Boehr (2):
s390x: gs: move to new header file
s390x: add test for SIGP STORE_ADTL_STATUS order
lib/s390x/asm/vector.h | 16 ++ lib/s390x/gs.h | 69 +++++++ s390x/Makefile | 1 + s390x/adtl-status.c | 408 +++++++++++++++++++++++++++++++++++++++++ s390x/gs.c | 54 +----- s390x/unittests.cfg | 25 +++ 6 files changed, 520 insertions(+), 53 deletions(-) create mode 100644 lib/s390x/asm/vector.h create mode 100644 lib/s390x/gs.h create mode 100644 s390x/adtl-status.c
Signature · 1 line
2.31.1
PATCH v3 1/2 s390x: gs: move to new header file
Move the guarded-storage related structs and instructions to a new header file because we will also need them for the SIGP store additional status tests.
--- lib/s390x/gs.h | 69 ++++++++++++++++++++++++++++++++++++++++++++++++++ s390x/gs.c | 54 +-------------------------------------- 2 files changed, 70 insertions(+), 53 deletions(-) create mode 100644 lib/s390x/gs.h
lib/s390x/gs.h new file +69 -0
@@ -0,0 +1,69 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ +/* +* Guarded storage related definitions +* +* Copyright 2018 IBM Corp. +* +* Authors: +* Martin Schwidefsky <[email protected]> +* Janosch Frank <[email protected]> +*/ +#include <stdint.h> + +#ifndef _S390X_GS_H_ +#define _S390X_GS_H_ + +struct gs_cb { +uint64_t reserved; +uint64_t gsd; +uint64_t gssm; +uint64_t gs_epl_a; +}; + +struct gs_epl { +uint8_t pad1; +union { +uint8_t gs_eam; +struct { + uint8_t : 6; +uint8_t e :1 ; +uint8_t b :1 ; + }; + }; +union { +uint8_t gs_eci; +struct { +uint8_t tx :1 ; +uint8_t cx :1 ; + uint8_t : 5; +uint8_t in :1 ; + }; + }; +union { +uint8_t gs_eai; +struct { + uint8_t : 1; +uint8_t t :1 ; +uint8_t as :2 ; +uint8_t ar :4 ; + }; + }; +uint32_t pad2; +uint64_t gs_eha; +uint64_t gs_eia; +uint64_t gs_eoa; +uint64_t gs_eir; +uint64_t gs_era; +}; + +static inline void load_gs_cb (struct gs_cb *gs_cb) +{ + asmvolatile (".insn rxy,0xe3000000004d,0,%0" : :"Q" (*gs_cb)); +} + +static inline void store_gs_cb (struct gs_cb *gs_cb) +{ + asmvolatile (".insn rxy,0xe30000000049,0,%0" : :"Q" (*gs_cb)); +} + +#endif
s390x/gs.c +1 -53
66 lines not on this page · raw message
Signature · 1 line
2.31.1
PATCH v3 2/2 s390x: add test for SIGP STORE_ADTL_STATUS order
In reply to Nico BoehrAdd a test for SIGP STORE_ADDITIONAL_STATUS order.
There are several cases to cover:
- when neither vector nor guarded-storage facility is available, check the order is rejected.
- when one of the facilities is there, test the order is rejected and adtl_status is not touched when the target CPU is running or when an invalid CPU address is specified. Also check the order is rejected in case of invalid alignment.
- when the vector facility is there, write some data to the CPU's vector registers and check we get the right contents.
- when the guarded-storage facility is there, populate the CPU's guarded-storage registers with some data and again check we get the right contents.
To make sure we cover all these cases, adjust unittests.cfg to run the test with both guarded-storage and vector facility off and on. In TCG, we don't have guarded-storage support, so we just run with vector facility off and on.
--- lib/s390x/asm/vector.h | 16 ++ s390x/Makefile | 1 + s390x/adtl-status.c | 408 +++++++++++++++++++++++++++++++++++++++++ s390x/unittests.cfg | 25 +++ 4 files changed, 450 insertions(+) create mode 100644 lib/s390x/asm/vector.h create mode 100644 s390x/adtl-status.c
lib/s390x/asm/vector.h new file +16 -0
@@ -0,0 +1,16 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ +/* +* Vector facility related defines and functions +* +* Copyright IBM Corp. 2022 +* +* Authors: +* Nico Boehr <[email protected]> +*/ +#ifndef _ASMS390X_VECTOR_H_ +#define _ASMS390X_VECTOR_H_ + +#define VEC_REGISTER_NUM 32 +#define VEC_REGISTER_SIZE 16 + +#endif
s390x/Makefile +1 -0
@@ -26,6 +26,7 @@ tests += $(TEST_DIR)/edat.elf tests += $(TEST_DIR)/mvpg-sie.elf tests += $(TEST_DIR)/spec_ex-sie.elf tests += $(TEST_DIR)/firq.elf +tests += $(TEST_DIR)/adtl-status.elf pv-tests += $(TEST_DIR)/pv-diags.elf
s390x/adtl-status.c new file +408 -0
408 lines not on this page · raw message
s390x/unittests.cfg +25 -0
@@ -136,3 +136,28 @@ file = firq.elf timeout = 20 extra_params = -smp 1,maxcpus=3 -cpu qemu -device qemu-s390x-cpu,core-id=2 -device qemu-s390x-cpu,core-id=1 accel = tcg + +[adtl-status-kvm] +file = adtl-status.elf +smp = 2 +accel = kvm +extra_params = -cpu host,gs=on,vx=on + +[adtl-status-no-vec-no-gs-kvm] +file = adtl-status.elf +smp = 2 +accel = kvm +extra_params = -cpu host,gs=off,vx=off + +[adtl-status-tcg] +file = adtl-status.elf +smp = 2 +accel = tcg +# no guarded-storage support in tcg +extra_params = -cpu qemu,vx=on + +[adtl-status-no-vec-no-gs-tcg] +file = adtl-status.elf +smp = 2 +accel = tcg +extra_params = -cpu qemu,gs=off,vx=off
Signature · 1 line
2.31.1