* [kvm-unit-tests PATCH v3 0/6] s390x: Add test for STFLE interpretive execution (format-2)
@ 2026-04-21 11:31 Christoph Schlameuss
2026-04-21 11:31 ` [kvm-unit-tests PATCH v3 1/6] s390x: snippets: Add reset_guest() to lib Christoph Schlameuss
` (5 more replies)
0 siblings, 6 replies; 7+ messages in thread
From: Christoph Schlameuss @ 2026-04-21 11:31 UTC (permalink / raw)
To: linux-s390
Cc: Janosch Frank, Claudio Imbrenda, Nico Böhr,
David Hildenbrand, Thomas Huth, kvm, Christoph Schlameuss,
Nina Schoetterl-Glausch
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)
Cc: Janosch Frank <frankja@linux.ibm.com>
Cc: Claudio Imbrenda <imbrenda@linux.ibm.com>
Cc: "Nico Böhr" <nrb@linux.ibm.com>
Cc: David Hildenbrand <david@kernel.org>
Cc: Thomas Huth <thuth@redhat.com>
To: linux-s390@vger.kernel.org
Cc: kvm@vger.kernel.org
Signed-off-by: Christoph Schlameuss <schlameuss@linux.ibm.com>
---
The original series was started by Nina and finished by me.
---
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: Rework sclp_facilities_setup() for simpler control flow
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 facilities
lib/s390x/sclp.c | 30 ++++++++++++++--------
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, 111 insertions(+), 27 deletions(-)
---
base-commit: 6123bbbc271255d61873763b5fb9c4a69acfcfec
change-id: 20260202-vsie-stfle-fac-403e4467d8e2
Best regards,
--
Christoph Schlameuss <schlameuss@linux.ibm.com>
^ permalink raw reply [flat|nested] 7+ messages in thread
* [kvm-unit-tests PATCH v3 1/6] s390x: snippets: Add reset_guest() to lib
2026-04-21 11:31 [kvm-unit-tests PATCH v3 0/6] s390x: Add test for STFLE interpretive execution (format-2) Christoph Schlameuss
@ 2026-04-21 11:31 ` Christoph Schlameuss
2026-04-21 11:31 ` [kvm-unit-tests PATCH v3 2/6] s390x: sclp: Remove unnecessary padding from struct sclp_facilities Christoph Schlameuss
` (4 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: Christoph Schlameuss @ 2026-04-21 11:31 UTC (permalink / raw)
To: linux-s390
Cc: Janosch Frank, Claudio Imbrenda, Nico Böhr,
David Hildenbrand, Thomas Huth, kvm, Christoph Schlameuss,
Nina Schoetterl-Glausch
From: Nina Schoetterl-Glausch <nsg@linux.ibm.com>
Extract reset_guest from spec_ex-sie into the lib.
After reset_guest() the snippet can be executed again.
Signed-off-by: Nina Schoetterl-Glausch <nsg@linux.ibm.com>
Signed-off-by: Christoph Schlameuss <schlameuss@linux.ibm.com>
Reviewed-by: Janosch Frank <frankja@linux.ibm.com>
Reviewed-by: Nico Boehr <nrb@linux.ibm.com>
---
lib/s390x/snippet.h | 6 ++++++
s390x/spec_ex-sie.c | 10 ++--------
2 files changed, 8 insertions(+), 8 deletions(-)
diff --git a/lib/s390x/snippet.h b/lib/s390x/snippet.h
index 910849aa186c..6f611de510d8 100644
--- a/lib/s390x/snippet.h
+++ b/lib/s390x/snippet.h
@@ -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.
diff --git a/s390x/spec_ex-sie.c b/s390x/spec_ex-sie.c
index fe2f23ee3d84..75625ecffc4a 100644
--- a/s390x/spec_ex-sie.c
+++ b/s390x/spec_ex-sie.c
@@ -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
--
2.53.0
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [kvm-unit-tests PATCH v3 2/6] s390x: sclp: Remove unnecessary padding from struct sclp_facilities
2026-04-21 11:31 [kvm-unit-tests PATCH v3 0/6] s390x: Add test for STFLE interpretive execution (format-2) Christoph Schlameuss
2026-04-21 11:31 ` [kvm-unit-tests PATCH v3 1/6] s390x: snippets: Add reset_guest() to lib Christoph Schlameuss
@ 2026-04-21 11:31 ` Christoph Schlameuss
2026-04-21 11:31 ` [kvm-unit-tests PATCH v3 3/6] s390x: sclp: Rework sclp_facilities_setup() for simpler control flow Christoph Schlameuss
` (3 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: Christoph Schlameuss @ 2026-04-21 11:31 UTC (permalink / raw)
To: linux-s390
Cc: Janosch Frank, Claudio Imbrenda, Nico Böhr,
David Hildenbrand, Thomas Huth, kvm, Christoph Schlameuss
Struct 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.
Suggested-by: Janosch Frank <frankja@linux.ibm.com>
Signed-off-by: Christoph Schlameuss <schlameuss@linux.ibm.com>
Reviewed-by: Janosch Frank <frankja@linux.ibm.com>
Reviewed-by: Nico Boehr <nrb@linux.ibm.com>
---
lib/s390x/sclp.h | 1 -
1 file changed, 1 deletion(-)
diff --git a/lib/s390x/sclp.h b/lib/s390x/sclp.h
index 22f120d1b7ea..42a2f2e9f25a 100644
--- a/lib/s390x/sclp.h
+++ b/lib/s390x/sclp.h
@@ -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 */
--
2.53.0
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [kvm-unit-tests PATCH v3 3/6] s390x: sclp: Rework sclp_facilities_setup() for simpler control flow
2026-04-21 11:31 [kvm-unit-tests PATCH v3 0/6] s390x: Add test for STFLE interpretive execution (format-2) Christoph Schlameuss
2026-04-21 11:31 ` [kvm-unit-tests PATCH v3 1/6] s390x: snippets: Add reset_guest() to lib Christoph Schlameuss
2026-04-21 11:31 ` [kvm-unit-tests PATCH v3 2/6] s390x: sclp: Remove unnecessary padding from struct sclp_facilities Christoph Schlameuss
@ 2026-04-21 11:31 ` Christoph Schlameuss
2026-04-21 11:31 ` [kvm-unit-tests PATCH v3 4/6] s390x: sclp: Use sclp_feat_check directly to read DIAG318 feature bit Christoph Schlameuss
` (2 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: Christoph Schlameuss @ 2026-04-21 11:31 UTC (permalink / raw)
To: linux-s390
Cc: Janosch Frank, Claudio Imbrenda, Nico Böhr,
David Hildenbrand, Thomas Huth, kvm, Christoph Schlameuss
Reverse the order of operations to allow for early exits with increasing
cpu offsets when reading facility bits in the extended range.
This is done to ease future additions like the one in the next patch in
this series.
Signed-off-by: Christoph Schlameuss <schlameuss@linux.ibm.com>
Reviewed-by: Nico Boehr <nrb@linux.ibm.com>
---
lib/s390x/sclp.c | 25 ++++++++++++++-----------
1 file changed, 14 insertions(+), 11 deletions(-)
diff --git a/lib/s390x/sclp.c b/lib/s390x/sclp.c
index 2f902e39e785..d624872cba60 100644
--- a/lib/s390x/sclp.c
+++ b/lib/s390x/sclp.c
@@ -154,17 +154,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);
- 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_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);
for (i = 0; i < read_info->entries_cpu; i++, cpu++) {
/*
@@ -184,6 +173,20 @@ void sclp_facilities_setup(void)
break;
}
}
+
+ 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);
+ 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_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);
+
+ if (read_info->offset_cpu <= 134)
+ return;
+ sclp_facilities.has_diag318 = read_info->byte_134_diag318;
}
/* Perform service call. Return 0 on success, non-zero otherwise. */
--
2.53.0
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [kvm-unit-tests PATCH v3 4/6] s390x: sclp: Use sclp_feat_check directly to read DIAG318 feature bit
2026-04-21 11:31 [kvm-unit-tests PATCH v3 0/6] s390x: Add test for STFLE interpretive execution (format-2) Christoph Schlameuss
` (2 preceding siblings ...)
2026-04-21 11:31 ` [kvm-unit-tests PATCH v3 3/6] s390x: sclp: Rework sclp_facilities_setup() for simpler control flow Christoph Schlameuss
@ 2026-04-21 11:31 ` Christoph Schlameuss
2026-04-21 11:31 ` [kvm-unit-tests PATCH v3 5/6] s390x: sclp: Add detection of alternate STFLE facilities Christoph Schlameuss
2026-04-21 11:31 ` [kvm-unit-tests PATCH v3 6/6] s390x: Add test for STFLE interpretive execution (format-2) Christoph Schlameuss
5 siblings, 0 replies; 7+ messages in thread
From: Christoph Schlameuss @ 2026-04-21 11:31 UTC (permalink / raw)
To: linux-s390
Cc: Janosch Frank, Claudio Imbrenda, Nico Böhr,
David Hildenbrand, Thomas Huth, kvm, Christoph Schlameuss
---
lib/s390x/sclp.c | 2 +-
lib/s390x/sclp.h | 3 +--
2 files changed, 2 insertions(+), 3 deletions(-)
diff --git a/lib/s390x/sclp.c b/lib/s390x/sclp.c
index d624872cba60..ad2ba99ee1e1 100644
--- a/lib/s390x/sclp.c
+++ b/lib/s390x/sclp.c
@@ -186,7 +186,7 @@ void sclp_facilities_setup(void)
if (read_info->offset_cpu <= 134)
return;
- sclp_facilities.has_diag318 = read_info->byte_134_diag318;
+ sclp_facilities.has_diag318 = sclp_feat_check(134, SCLP_FEAT_134_BIT_DIAG318);
}
/* Perform service call. Return 0 on success, non-zero otherwise. */
diff --git a/lib/s390x/sclp.h b/lib/s390x/sclp.h
index 42a2f2e9f25a..87af429b5798 100644
--- a/lib/s390x/sclp.h
+++ b/lib/s390x/sclp.h
@@ -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
--
2.53.0
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [kvm-unit-tests PATCH v3 5/6] s390x: sclp: Add detection of alternate STFLE facilities
2026-04-21 11:31 [kvm-unit-tests PATCH v3 0/6] s390x: Add test for STFLE interpretive execution (format-2) Christoph Schlameuss
` (3 preceding siblings ...)
2026-04-21 11:31 ` [kvm-unit-tests PATCH v3 4/6] s390x: sclp: Use sclp_feat_check directly to read DIAG318 feature bit Christoph Schlameuss
@ 2026-04-21 11:31 ` Christoph Schlameuss
2026-04-21 11:31 ` [kvm-unit-tests PATCH v3 6/6] s390x: Add test for STFLE interpretive execution (format-2) Christoph Schlameuss
5 siblings, 0 replies; 7+ messages in thread
From: Christoph Schlameuss @ 2026-04-21 11:31 UTC (permalink / raw)
To: linux-s390
Cc: Janosch Frank, Claudio Imbrenda, Nico Böhr,
David Hildenbrand, Thomas Huth, kvm, Christoph Schlameuss,
Nina Schoetterl-Glausch
From: Nina Schoetterl-Glausch <nsg@linux.ibm.com>
Detect availability of alternate STFLE interpretive execution facilities
1 and 2.
Signed-off-by: Nina Schoetterl-Glausch <nsg@linux.ibm.com>
Co-developed-by: Christoph Schlameuss <schlameuss@linux.ibm.com>
Signed-off-by: Christoph Schlameuss <schlameuss@linux.ibm.com>
---
lib/s390x/sclp.c | 5 +++++
lib/s390x/sclp.h | 4 ++++
2 files changed, 9 insertions(+)
diff --git a/lib/s390x/sclp.c b/lib/s390x/sclp.c
index ad2ba99ee1e1..d4e7eff66c31 100644
--- a/lib/s390x/sclp.c
+++ b/lib/s390x/sclp.c
@@ -181,12 +181,17 @@ void sclp_facilities_setup(void)
sclp_facilities.has_cmma = sclp_feat_check(116, SCLP_FEAT_116_BIT_CMMA);
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_astfleie1 = sclp_feat_check(116, SCLP_FEAT_116_BIT_ASTFLEIE1);
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);
if (read_info->offset_cpu <= 134)
return;
sclp_facilities.has_diag318 = sclp_feat_check(134, SCLP_FEAT_134_BIT_DIAG318);
+
+ if (read_info->offset_cpu <= 139)
+ return;
+ sclp_facilities.has_astfleie2 = sclp_feat_check(139, SCLP_FEAT_139_BIT_ASTFLEIE2);
}
/* Perform service call. Return 0 on success, non-zero otherwise. */
diff --git a/lib/s390x/sclp.h b/lib/s390x/sclp.h
index 87af429b5798..eb574350d678 100644
--- a/lib/s390x/sclp.h
+++ b/lib/s390x/sclp.h
@@ -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;
--
2.53.0
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [kvm-unit-tests PATCH v3 6/6] s390x: Add test for STFLE interpretive execution (format-2)
2026-04-21 11:31 [kvm-unit-tests PATCH v3 0/6] s390x: Add test for STFLE interpretive execution (format-2) Christoph Schlameuss
` (4 preceding siblings ...)
2026-04-21 11:31 ` [kvm-unit-tests PATCH v3 5/6] s390x: sclp: Add detection of alternate STFLE facilities Christoph Schlameuss
@ 2026-04-21 11:31 ` Christoph Schlameuss
5 siblings, 0 replies; 7+ messages in thread
From: Christoph Schlameuss @ 2026-04-21 11:31 UTC (permalink / raw)
To: linux-s390
Cc: Janosch Frank, Claudio Imbrenda, Nico Böhr,
David Hildenbrand, Thomas Huth, kvm, Christoph Schlameuss,
Nina Schoetterl-Glausch
The 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.
Co-developed-by: Nina Schoetterl-Glausch <nsg@linux.ibm.com>
Signed-off-by: Nina Schoetterl-Glausch <nsg@linux.ibm.com>
Signed-off-by: Christoph Schlameuss <schlameuss@linux.ibm.com>
---
lib/s390x/sie.c | 11 +++++++++
lib/s390x/sie.h | 1 +
s390x/stfle-sie.c | 72 +++++++++++++++++++++++++++++++++++++++++++++++++++----
3 files changed, 79 insertions(+), 5 deletions(-)
diff --git a/lib/s390x/sie.c b/lib/s390x/sie.c
index 0fa915cf028a..17f0ef7eff42 100644
--- a/lib/s390x/sie.c
+++ b/lib/s390x/sie.c
@@ -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)
diff --git a/lib/s390x/sie.h b/lib/s390x/sie.h
index 3ec49ed0da64..8bea0b10b0a6 100644
--- a/lib/s390x/sie.h
+++ b/lib/s390x/sie.h
@@ -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)
diff --git a/s390x/stfle-sie.c b/s390x/stfle-sie.c
index 21cf8ff8b6f6..e3ed22ee536e 100644
--- a/s390x/stfle-sie.c
+++ b/s390x/stfle-sie.c
@@ -42,6 +42,7 @@ static struct guest_stfle_res run_guest(void)
uint64_t guest_stfle_addr;
uint64_t reg;
+ reset_guest(&vm);
sie(&vm);
assert(snippet_is_force_exit_value(&vm));
guest_stfle_addr = snippet_get_force_exit_value(&vm);
@@ -56,7 +57,6 @@ static void test_stfle_format_0(void)
{
struct guest_stfle_res res;
- report_prefix_push("format-0");
for (int j = 0; j < stfle_size(); j++)
WRITE_ONCE((*fac)[j], prng64(&prng_s));
vm.sblk->fac = (uint32_t)(uint64_t)fac;
@@ -64,6 +64,47 @@ static void test_stfle_format_0(void)
report(res.len == stfle_size(), "stfle len correct");
report(!memcmp(*fac, res.mem, res.len * sizeof(uint64_t)),
"Guest facility list as specified");
+}
+
+static void test_stfle_format_2(void)
+{
+ const int max_stfle_len = 8;
+ int guest_max_stfle_len = 0;
+ struct guest_stfle_res res;
+ bool saturated = false;
+
+ for (int i = 1; i <= max_stfle_len; i++) {
+ report_prefix_pushf("max STFLE len %d", i);
+
+ WRITE_ONCE((*fac)[0], i - 1);
+ for (int j = 0; j < i; j++)
+ WRITE_ONCE((*fac)[j + 1], prng64(&prng_s));
+ vm.sblk->fac = (uint32_t)(uint64_t)fac | 2;
+ res = run_guest();
+ /* len increases up to maximum (machine specific) */
+ if (res.len < i)
+ saturated = true;
+ if (saturated) {
+ report(res.len == guest_max_stfle_len, "stfle len correct");
+ } else {
+ report(res.len == i, "stfle len correct");
+ guest_max_stfle_len = i;
+ }
+ report(!memcmp(&(*fac)[1], res.mem, guest_max_stfle_len * sizeof(uint64_t)),
+ "Guest facility list as specified");
+
+ report_prefix_pop();
+ }
+}
+
+static void test_no_stfle_format(int format)
+{
+ report_prefix_pushf("no-stfle");
+ reset_guest(&vm);
+ vm.sblk->fac = (uint32_t)(uint64_t)fac | format;
+ sie_expect_validity(&vm);
+ sie(&vm);
+ sie_check_optional_validity(&vm, 0x1330);
report_prefix_pop();
}
@@ -119,20 +160,41 @@ static struct args parse_args(int argc, char **argv)
int main(int argc, char **argv)
{
struct args args = parse_args(argc, argv);
- bool run_format_0 = test_facility(7);
if (!sclp_facilities.has_sief2) {
report_skip("SIEF2 facility unavailable");
goto out;
}
- if (!run_format_0)
+ if (!test_facility(7)) {
report_skip("STFLE facility not available");
+ goto out;
+ }
report_info("PRNG seed: 0x%lx", args.seed);
prng_s = prng_init(args.seed);
setup_guest();
- if (run_format_0)
- test_stfle_format_0();
+ report_prefix_pushf("format-0");
+ test_stfle_format_0();
+ report_prefix_pop();
+
+ report_prefix_pushf("format-1");
+ if (!sclp_facilities.has_astfleie1)
+ test_no_stfle_format(1);
+ report_prefix_pop();
+
+ report_prefix_pushf("format-2");
+ if (!sclp_facilities.has_astfleie2) {
+ test_no_stfle_format(2);
+ report_skip("alternate STFLE interpretive-execution facility 2 not available");
+ } else {
+ test_stfle_format_2();
+ }
+ report_prefix_pop();
+
+ report_prefix_pushf("format-3");
+ test_no_stfle_format(3);
+ report_prefix_pop();
+
out:
return report_summary();
}
--
2.53.0
^ permalink raw reply related [flat|nested] 7+ messages in thread
end of thread, other threads:[~2026-04-21 11:45 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-04-21 11:31 [kvm-unit-tests PATCH v3 0/6] s390x: Add test for STFLE interpretive execution (format-2) Christoph Schlameuss
2026-04-21 11:31 ` [kvm-unit-tests PATCH v3 1/6] s390x: snippets: Add reset_guest() to lib Christoph Schlameuss
2026-04-21 11:31 ` [kvm-unit-tests PATCH v3 2/6] s390x: sclp: Remove unnecessary padding from struct sclp_facilities Christoph Schlameuss
2026-04-21 11:31 ` [kvm-unit-tests PATCH v3 3/6] s390x: sclp: Rework sclp_facilities_setup() for simpler control flow Christoph Schlameuss
2026-04-21 11:31 ` [kvm-unit-tests PATCH v3 4/6] s390x: sclp: Use sclp_feat_check directly to read DIAG318 feature bit Christoph Schlameuss
2026-04-21 11:31 ` [kvm-unit-tests PATCH v3 5/6] s390x: sclp: Add detection of alternate STFLE facilities Christoph Schlameuss
2026-04-21 11:31 ` [kvm-unit-tests PATCH v3 6/6] s390x: Add test for STFLE interpretive execution (format-2) Christoph Schlameuss
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox