]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
KVM: s390: vsie: Allow non-zarch guests
authorEric Farman <farman@linux.ibm.com>
Wed, 1 Apr 2026 15:12:18 +0000 (17:12 +0200)
committerJanosch Frank <frankja@linux.ibm.com>
Thu, 2 Apr 2026 13:37:01 +0000 (15:37 +0200)
Linux/KVM runs in z/Architecture-only mode. Although z/Architecture
is built upon a long history of hardware refinements, any other
CPU mode is not permitted.

Allow a userspace to explicitly enable the use of ESA mode for
nested guests, otherwise usage will be rejected.

Reviewed-by: Janosch Frank <frankja@linux.ibm.com>
Signed-off-by: Eric Farman <farman@linux.ibm.com>
Reviewed-by: Hendrik Brueckner <brueckner@linux.ibm.com>
Reviewed-by: Christian Borntraeger <borntraeger@linux.ibm.com>
Signed-off-by: Janosch Frank <frankja@linux.ibm.com>
arch/s390/include/asm/kvm_host.h
arch/s390/kvm/vsie.c

index 64a50f0862aabb994089090c750bd312a7233e2c..b58faad8a7cee858f4e0409c3f5f65e429e864c8 100644 (file)
@@ -656,6 +656,7 @@ struct kvm_arch {
        int user_stsi;
        int user_instr0;
        int user_operexec;
+       int allow_vsie_esamode;
        struct s390_io_adapter *adapters[MAX_S390_IO_ADAPTERS];
        wait_queue_head_t ipte_wq;
        int ipte_lock_count;
index d249b10044eb7595295fc20e9287e0629958d896..aa43c6848217aaa1ca6809d3640b613338ffd8ff 100644 (file)
@@ -125,8 +125,8 @@ static int prepare_cpuflags(struct kvm_vcpu *vcpu, struct vsie_page *vsie_page)
        struct kvm_s390_sie_block *scb_o = vsie_page->scb_o;
        int newflags, cpuflags = atomic_read(&scb_o->cpuflags);
 
-       /* we don't allow ESA/390 guests */
-       if (!(cpuflags & CPUSTAT_ZARCH))
+       /* we don't allow ESA/390 guests unless explicitly enabled */
+       if (!(cpuflags & CPUSTAT_ZARCH) && !vcpu->kvm->arch.allow_vsie_esamode)
                return set_validity_icpt(scb_s, 0x0001U);
 
        if (cpuflags & (CPUSTAT_RRF | CPUSTAT_MCDS))
@@ -135,7 +135,9 @@ static int prepare_cpuflags(struct kvm_vcpu *vcpu, struct vsie_page *vsie_page)
                return set_validity_icpt(scb_s, 0x0007U);
 
        /* intervention requests will be set later */
-       newflags = CPUSTAT_ZARCH;
+       newflags = 0;
+       if (cpuflags & CPUSTAT_ZARCH)
+               newflags = CPUSTAT_ZARCH;
        if (cpuflags & CPUSTAT_GED && test_kvm_facility(vcpu->kvm, 8))
                newflags |= CPUSTAT_GED;
        if (cpuflags & CPUSTAT_GED2 && test_kvm_facility(vcpu->kvm, 78)) {