[kvm-unit-tests PATCH v2 4/5] s390x: sclp: Add detection of alternate STFLE facilities

Christoph Schlameuss
2026-03-24T15:28:58Z

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 d624872cba608fcbbd0c482a25f091fe19475a43..77b2a5ec00d68ec7ee82da295f2f31c539b5c00c 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 = read_info->byte_134_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 42a2f2e9f25a45d3ebd71729df0d9d6d93a4fb50..5345e1ff8057c787f3aaea0245fc1e19096c75e9 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,8 +144,10 @@ 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_139_BIT_ASTFLEIE2 1

typedef struct ReadInfo {
SCCBHeader h;

--
2.53.0