@samitouri / QOSamiQemu / commits / 2d2b5c13c9

s390x/kvm: Add ASTFLE facility 2 for nested virtualization

Allow propagation of the ASTFLEIE2 feature bit. If the host does have the ASTFLE Interpretive Execution Facility 2 the guest can enable the ASTFLE format 2 for its guests. Signed-off-by: Christoph Schlameuss <schlameuss@linux.ibm.com> Reviewed-by: Nina Schoetterl-Glausch <nsg@linux.ibm.com> Message-ID: <20260701-astfleie2-v3-2-f692dc7f4f24@linux.ibm.com> Signed-off-by: Cornelia Huck <cohuck@redhat.com>

Christoph Schlameuss committed Jul 1, 2026 at 10:23 UTC 2d2b5c13c9c397e8af3e681011485608c928ba37
8 files changed +16 -1
hw/s390x/sclp.c
+2
@@ -146,6 +146,8 @@ static void read_SCP_info(SCLPDevice *sclp, SCCB *sccb)
146 if (s390_has_feat(S390_FEAT_EXTENDED_LENGTH_SCCB)) {
147 s390_get_feat_block(S390_FEAT_TYPE_SCLP_FAC134,
148 &read_info->fac134);
149 + s390_get_feat_block(S390_FEAT_TYPE_SCLP_FAC139,
150 + &read_info->fac139);
151 }
152
153 read_info->facilities = cpu_to_be64(SCLP_HAS_CPU_INFO |
include/hw/s390x/sclp.h
+3 -1
@@ -136,7 +136,9 @@ typedef struct ReadInfo {
136 uint32_t hmfai;
137 uint8_t _reserved7[134 - 128]; /* 128-133 */
138 uint8_t fac134;
139 - uint8_t _reserved8[144 - 135]; /* 135-143 */
139 + uint8_t _reserved8[139 - 135]; /* 135-138 */
140 + uint8_t fac139;
141 + uint8_t _reserved9[144 - 140]; /* 140-143 */
142 struct CPUEntry entries[];
143 /*
144 * When the Extended-Length SCCB (ELS) feature is enabled the
target/s390x/cpu_features.c
+3
@@ -148,6 +148,9 @@ void s390_fill_feat_block(const S390FeatBitmap features, S390FeatType type,
148 case S390_FEAT_TYPE_SCLP_FAC134:
149 clear_be_bit(s390_feat_def(S390_FEAT_DIAG_318)->bit, data);
150 break;
151 + case S390_FEAT_TYPE_SCLP_FAC139:
152 + clear_be_bit(s390_feat_def(S390_FEAT_SIE_ASTFLEIE2)->bit, data);
153 + break;
154 default:
155 return;
156 }
target/s390x/cpu_features.h
+1
@@ -24,6 +24,7 @@ typedef enum {
24 S390_FEAT_TYPE_SCLP_CONF_CHAR,
25 S390_FEAT_TYPE_SCLP_CONF_CHAR_EXT,
26 S390_FEAT_TYPE_SCLP_FAC134,
27 + S390_FEAT_TYPE_SCLP_FAC139,
28 S390_FEAT_TYPE_SCLP_CPU,
29 S390_FEAT_TYPE_MISC,
30 S390_FEAT_TYPE_PLO,
target/s390x/cpu_features_def.h.inc
+3
@@ -139,6 +139,9 @@ DEF_FEAT(SIE_IBS, "ibs", SCLP_CONF_CHAR_EXT, 10, "SIE: Interlock-and-broadcast-s
139 /* Features exposed via SCLP SCCB Facilities byte 134 (bit numbers relative to byte-134) */
140 DEF_FEAT(DIAG_318, "diag318", SCLP_FAC134, 0, "Control program name and version codes")
141
142 +/* Features exposed via SCLP SCCB Facilities byte 139 (bit numbers relative to byte-139) */
143 +DEF_FEAT(SIE_ASTFLEIE2, "astfleie2", SCLP_FAC139, 1, "SIE: ASTFLE interpretation execution facility 2")
144 +
145 /* Features exposed via SCLP CPU info. */
146 DEF_FEAT(SIE_F2, "sief2", SCLP_CPU, 4, "SIE: interception format 2 (Virtual SIE)")
147 DEF_FEAT(SIE_SKEY, "skey", SCLP_CPU, 5, "SIE: Storage-key facility")
target/s390x/cpu_models.c
+2
@@ -263,6 +263,7 @@ bool s390_has_feat(S390Feat feat)
263 case S390_FEAT_SIE_PFMFI:
264 case S390_FEAT_SIE_IBS:
265 case S390_FEAT_CONFIGURATION_TOPOLOGY:
266 + case S390_FEAT_SIE_ASTFLEIE2:
267 return false;
268 break;
269 default:
@@ -553,6 +554,7 @@ static void check_consistency(const S390CPUModel *model)
554 { S390_FEAT_PLO_QSTG, S390_FEAT_PLO_EXT },
555 { S390_FEAT_PLO_QSTX, S390_FEAT_PLO_EXT },
556 { S390_FEAT_PLO_QSTO, S390_FEAT_PLO_EXT },
557 + { S390_FEAT_SIE_ASTFLEIE2, S390_FEAT_STFLE },
558 };
559 int i;
560
target/s390x/gen-features.c
+1
@@ -720,6 +720,7 @@ static uint16_t full_GEN16_GA1[] = {
720 S390_FEAT_PAIE,
721 S390_FEAT_UV_FEAT_AP,
722 S390_FEAT_UV_FEAT_AP_INTR,
723 + S390_FEAT_SIE_ASTFLEIE2,
724 };
725
726 static uint16_t full_GEN17_GA1[] = {
target/s390x/kvm/kvm.c
+1
@@ -2288,6 +2288,7 @@ static int kvm_to_feat[][2] = {
2288 { KVM_S390_VM_CPU_FEAT_PFMFI, S390_FEAT_SIE_PFMFI},
2289 { KVM_S390_VM_CPU_FEAT_SIGPIF, S390_FEAT_SIE_SIGPIF},
2290 { KVM_S390_VM_CPU_FEAT_KSS, S390_FEAT_SIE_KSS},
2291 + { KVM_S390_VM_CPU_FEAT_ASTFLEIE2, S390_FEAT_SIE_ASTFLEIE2 },
2292 };
2293
2294 static int query_cpu_feat(S390FeatBitmap features)