Re: [PATCH v1 1/4] KVM: s390: vsie: Allow non-zarch guests

Eric Farman
2026-04-01T13:31:34Z

On Wed, 2026-04-01 at 13:25 +0200, Janosch Frank wrote:
> On 4/1/26 04:09, Eric Farman wrote:
> > 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.
> >
> > Signed-off-by: Eric Farman <farman@linux.ibm.com>
> > ---
> > arch/s390/include/asm/kvm_host.h | 1 +
> > arch/s390/kvm/vsie.c | 8 +++++---
> > 2 files changed, 6 insertions(+), 3 deletions(-)
> >
> > diff --git a/arch/s390/include/asm/kvm_host.h b/arch/s390/include/asm/kvm_host.h
> > index 3039c88daa63..8a4f4a39f7a2 100644
> > --- a/arch/s390/include/asm/kvm_host.h
> > +++ b/arch/s390/include/asm/kvm_host.h
> > @@ -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;
> > diff --git a/arch/s390/kvm/vsie.c b/arch/s390/kvm/vsie.c
> > index 72895dddc39a..888370a02ef7 100644
> > --- a/arch/s390/kvm/vsie.c
> > +++ b/arch/s390/kvm/vsie.c
> > @@ -125,8 +125,9 @@ 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))
> > + newflags = 0;
>
> Not sure why you have that here but removed setting newflags below.

Yeah, I don't have any good reason for it here.

>
> > + /* 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 +136,8 @@ 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;
>
> I'd leave this but set it to 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)) {
>
> I can fix that up if you want.

This makes more sense. And if you don't mind, that would be wonderful!

>
> Reviewed-by: Janosch Frank <frankja@linux.ibm.com>

Thank you!