s390x: Add test for STFLE interpretive execution (format-2)
v5 cover s390x: Add test for STFLE interpretive execution (format-2)
Test the shadowing of format-2 facility list when running in VSIE.
The tests will skip the format 2 tests
* if running with unpatched kernels or qemu in G1 or G2
* if running on machines prior IBM z16 GA1 (where ASTFLEIE2 is not available)
---
The original series was started by Nina and finished by me.
---
Changes in v5:
- readd reading the astfleie1 feature bit. Thanks Janosch
Changes in v4:
- check feature bit presence before reading feature bits
- revert sclp_facilities_setup() early returns
Changes in v3:
- Remove unnecessary format loop in test_stfle_format_0() - formats are already addressed explicitly
- Added patch to use sclp_feat_check directly for DIAG318
- Add no-stfle prefix to improve test log
- Move prefixes to main() to have prefixes in no-stfle checks
Changes in v2:
- Rework sclp_facilities_setup()
- Removed explicit manual padding from struct sclp_facilities
---
Christoph Schlameuss (4):
s390x: sclp: Remove unnecessary padding from struct sclp_facilities
s390x: sclp: Check sclp byte before reading feature bits
s390x: sclp: Use sclp_feat_check directly to read DIAG318 feature bit
s390x: Add test for STFLE interpretive execution (format-2)Nina Schoetterl-Glausch (2):
s390x: snippets: Add reset_guest() to lib
s390x: sclp: Add detection of alternate STFLE facilitieslib/s390x/sclp.c | 8 ++++-- lib/s390x/sclp.h | 8 +++--- lib/s390x/sie.c | 11 ++++++++ lib/s390x/sie.h | 1 + lib/s390x/snippet.h | 6 +++++ s390x/spec_ex-sie.c | 10 ++------ s390x/stfle-sie.c | 72 +++++++++++++++++++++++++++++++++++++++++++++++++---- 7 files changed, 98 insertions(+), 18 deletions(-)
---
base-commit: ea91ac1763561b23e7eba3f7c1fa3d45f29b89be
change-id: 20260202-vsie-stfle-fac-403e4467d8e2
prerequisite-change-id: 20260423-b4-cmdline-a812ed022659:v2
prerequisite-patch-id: a4f8fe5f0bfda36807ec96fce6497f3c343553fa
prerequisite-patch-id: b63bd69e2333a37621826d6a5f17ff351c94b9fa
prerequisite-patch-id: 590688853b16bb736963593be0d0e4adc81e309f
prerequisite-patch-id: a156d54bf3a24dee421f0a6b34065cb3536affc8
Best regards,
Signature · 1 line
Christoph Schlameuss <[email protected]>
PATCH v5 1/6 s390x: snippets: Add reset_guest() to lib
From: Nina Schoetterl-Glausch <[email protected]>
Extract reset_guest from spec_ex-sie into the lib. After reset_guest() the snippet can be executed again.
--- lib/s390x/snippet.h | 6 ++++++ s390x/spec_ex-sie.c | 10 ++-------- 2 files changed, 8 insertions(+), 8 deletions(-)
lib/s390x/snippet.h +6 -0
@@ -83,6 +83,12 @@ static inline void snippet_init(struct vm *vm, const char *gbin, vm->sblk->ictl =ICTL_OPEREXC |ICTL_PINT ; } +static inline void reset_guest (struct vm *vm) +{ + vm->sblk->gpsw = snippet_psw; + vm->sblk->icptcode =0 ; +} +/* * Sets up a snippet UV/PV guest on top of an existing and initialized * SIE vm struct.
s390x/spec_ex-sie.c +2 -8
@@ -31,12 +31,6 @@ static void setup_guest(void) SNIPPET_LEN(c, spec_ex), SNIPPET_UNPACK_OFF); } -static void reset_guest (void ) -{ - vm.sblk->gpsw = snippet_psw; - vm.sblk->icptcode =0 ; -} -static void test_spec_ex_sie (void ) {const char *msg;
@@ -45,7 +39,7 @@ static void test_spec_ex_sie(void)report_prefix_push ("SIE spec ex interpretation" );report_prefix_push ("off" ); -reset_guest (); +reset_guest (&vm);sie (&vm);/* interpretation off -> initial exception must cause interception */ report(vm.sblk->icptcode == ICPT_PROGI
@@ -56,7 +50,7 @@ static void test_spec_ex_sie(void)report_prefix_push ("on" ); vm.sblk->ecb |=ECB_SPECI ; -reset_guest (); +reset_guest (&vm);sie (&vm);/* interpretation on -> configuration dependent if initial exception causes * interception, but invalid new program PSW must
Signature · 1 line
2.53.0
PATCH v5 2/6 s390x: sclp: Remove unnecessary padding from struct sclp_facilities
In reply to Christoph SchlameussStruct sclp_facilities is only used within the guest to keep the facility information. Nothing bad should happen when the struct size changes in the future.
--- lib/s390x/sclp.h | 1 - 1 file changed, 1 deletion(-)
lib/s390x/sclp.h +0 -1
@@ -132,7 +132,6 @@ struct sclp_facilities { uint64_t has_kss : 1; uint64_t has_pfmfi : 1; uint64_t has_ibs : 1; - uint64_t : 64 - 15; };/* bit number within a certain byte */
Signature · 1 line
2.53.0
PATCH v5 3/6 s390x: sclp: Check sclp byte before reading feature bits
In reply to Christoph SchlameussImprove the readability and simplicity of the code in sclp_facilities_setup() by moving the check for availabity of feature bits into sclp_feat_check().
--- lib/s390x/sclp.c | 3 +++ 1 file changed, 3 insertions(+)
lib/s390x/sclp.c +3 -0
@@ -142,6 +142,9 @@ static bool sclp_feat_check(int byte, int bit) {uint8_t *rib = (uint8_t *)read_info; +if (read_info->offset_cpu <= byte) +return false; +return !!(rib[byte] & (0x80 >> bit)); }
Signature · 1 line
2.53.0
PATCH v5 4/6 s390x: sclp: Use sclp_feat_check directly to read DIAG318 feature bit
In reply to Christoph SchlameussThe additional entry in struct ReadInfo is only used to set sclp_facilities where we are aware where these bits actually are in _read_info. So it is more readable to directly check the bit here.
While at it order feat checks by byte and bit.
--- lib/s390x/sclp.c | 3 +-- lib/s390x/sclp.h | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-)
lib/s390x/sclp.c +1 -2
@@ -157,8 +157,6 @@ void sclp_facilities_setup(void)assert (read_info); cpu =sclp_get_cpu_entries (); -if (read_info->offset_cpu >134 ) - sclp_facilities.has_diag318 = read_info->byte_134_diag318; sclp_facilities.has_sop =sclp_feat_check (80 ,SCLP_FEAT_80_BIT_SOP ); sclp_facilities.has_gsls =sclp_feat_check (85 ,SCLP_FEAT_85_BIT_GSLS ); sclp_facilities.has_esop =sclp_feat_check (85 ,SCLP_FEAT_85_BIT_ESOP );
@@ -168,6 +166,7 @@ void sclp_facilities_setup(void) sclp_facilities.has_esca =sclp_feat_check (116 ,SCLP_FEAT_116_BIT_ESCA ); sclp_facilities.has_ibs =sclp_feat_check (117 ,SCLP_FEAT_117_BIT_IBS ); sclp_facilities.has_pfmfi =sclp_feat_check (117 ,SCLP_FEAT_117_BIT_PFMFI ); + sclp_facilities.has_diag318 =sclp_feat_check (134 ,SCLP_FEAT_134_BIT_DIAG318 );for (i =0 ; i < read_info->entries_cpu; i++, cpu++) {/*
lib/s390x/sclp.h +1 -2
@@ -144,6 +144,7 @@ struct sclp_facilities {#define SCLP_FEAT_116_BIT_ESCA 4#define SCLP_FEAT_117_BIT_PFMFI 1#define SCLP_FEAT_117_BIT_IBS 2 +#define SCLP_FEAT_134_BIT_DIAG318 0 typedef struct ReadInfo { SCCBHeader h;
@@ -169,8 +170,6 @@ typedef struct ReadInfo {uint8_t _reserved5[124 -122 ];/* 122-123 */ uint32_t hmfai;uint8_t reserved7[134 -128 ];/* 128-133 */ - uint8_t byte_134_diag318 : 1; - uint8_t : 7;/* * At the end of the ReadInfo, there are also the CPU entries (see * struct CPUEntry). When the Extended-Length SCCB (ELS) feature is
Signature · 1 line
2.53.0
PATCH v5 5/6 s390x: sclp: Add detection of alternate STFLE facilities
In reply to Christoph SchlameussFrom: Nina Schoetterl-Glausch <[email protected]>
Detect availability of alternate STFLE interpretive execution facilities 1 and 2.
--- lib/s390x/sclp.c | 2 ++ lib/s390x/sclp.h | 4 ++++ 2 files changed, 6 insertions(+)
lib/s390x/sclp.c +2 -0
@@ -162,11 +162,13 @@ void sclp_facilities_setup(void) sclp_facilities.has_esop =sclp_feat_check (85 ,SCLP_FEAT_85_BIT_ESOP ); sclp_facilities.has_kss =sclp_feat_check (98 ,SCLP_FEAT_98_BIT_KSS ); sclp_facilities.has_cmma =sclp_feat_check (116 ,SCLP_FEAT_116_BIT_CMMA ); + sclp_facilities.has_astfleie1 =sclp_feat_check (116 ,SCLP_FEAT_116_BIT_ASTFLEIE1 ); sclp_facilities.has_64bscao =sclp_feat_check (116 ,SCLP_FEAT_116_BIT_64BSCAO ); sclp_facilities.has_esca =sclp_feat_check (116 ,SCLP_FEAT_116_BIT_ESCA ); sclp_facilities.has_ibs =sclp_feat_check (117 ,SCLP_FEAT_117_BIT_IBS ); sclp_facilities.has_pfmfi =sclp_feat_check (117 ,SCLP_FEAT_117_BIT_PFMFI ); sclp_facilities.has_diag318 =sclp_feat_check (134 ,SCLP_FEAT_134_BIT_DIAG318 ); + sclp_facilities.has_astfleie2 =sclp_feat_check (139 ,SCLP_FEAT_139_BIT_ASTFLEIE2 );for (i =0 ; i < read_info->entries_cpu; i++, cpu++) {/*
lib/s390x/sclp.h +4 -0
@@ -129,9 +129,11 @@ struct sclp_facilities { uint64_t has_cmma : 1; uint64_t has_64bscao : 1; uint64_t has_esca : 1; + uint64_t has_astfleie1 : 1; uint64_t has_kss : 1; uint64_t has_pfmfi : 1; uint64_t has_ibs : 1; + uint64_t has_astfleie2 : 1; };/* bit number within a certain byte */
@@ -142,9 +144,11 @@ struct sclp_facilities {#define SCLP_FEAT_116_BIT_64BSCAO 0#define SCLP_FEAT_116_BIT_CMMA 1#define SCLP_FEAT_116_BIT_ESCA 4 +#define SCLP_FEAT_116_BIT_ASTFLEIE1 7#define SCLP_FEAT_117_BIT_PFMFI 1#define SCLP_FEAT_117_BIT_IBS 2#define SCLP_FEAT_134_BIT_DIAG318 0 +#define SCLP_FEAT_139_BIT_ASTFLEIE2 1 typedef struct ReadInfo { SCCBHeader h;
Signature · 1 line
2.53.0
Re: [kvm-unit-tests PATCH v5 5/6] s390x: sclp: Add detection of alternate STFLE facilities
Quoted 8 lines · Christoph Schlameuss
From: Nina Schoetterl-Glausch <[email protected]>
Detect availability of alternate STFLE interpretive execution facilities 1 and 2.
Signed-off-by Nina Schoetterl-Glausch <[email protected]>Co-developed-by Christoph Schlameuss <[email protected]>Signed-off-by Christoph Schlameuss <[email protected]>
PATCH v5 6/6 s390x: Add test for STFLE interpretive execution (format-2)
In reply to Christoph SchlameussThe STFLE instruction indicates installed facilities. SIE has facilities for the interpretive execution of STFLE. There are multiple possible formats for the control block. Use a snippet guest executing STFLE to get the result of interpretive execution and check the result.
With the addition of the format-2 control block invalid format specifiers are now possible.
Test for the occurrence of optional validity intercepts.
Move prefixes into main method to improve the readability of the log by having prefixes for reports by tests called from multiple places.
--- lib/s390x/sie.c | 11 +++++++++ lib/s390x/sie.h | 1 + s390x/stfle-sie.c | 72 +++++++++++++++++++++++++++++++++++++++++++++++++++---- 3 files changed, 79 insertions(+), 5 deletions(-)
lib/s390x/sie.c +11 -0
@@ -42,6 +42,17 @@ void sie_check_validity(struct vm *vm, uint16_t vir_exp)report (vir_exp == vir,"VALIDITY: %x" , vir); } +void sie_check_optional_validity (struct vm *vm,uint16_t vir_exp) +{ +uint16_t vir =sie_get_validity (vm); + +if (vir ==0xffff ) +report_pass ("optional VALIDITY: no" ); +else +report (vir_exp == vir,"optional VALIDITY: %x" , vir); + vm->validity_expected = false; +} +void sie_handle_validity (struct vm *vm) {if (vm->sblk->icptcode !=ICPT_VALIDITY )
lib/s390x/sie.h +1 -0
@@ -51,6 +51,7 @@ void sie(struct vm *vm);void sie_expect_validity (struct vm *vm);uint16_t sie_get_validity (struct vm *vm);void sie_check_validity (struct vm *vm,uint16_t vir_exp); +void sie_check_optional_validity (struct vm *vm,uint16_t vir_exp);void sie_handle_validity (struct vm *vm);static inline bool sie_is_pv (struct vm *vm)
s390x/stfle-sie.c +67 -5
106 lines not on this page · raw message
Signature · 1 line
2.53.0