Re: [PATCH v4 25/27] KVM: s390: arm64: Implement vCPU IOCTLs

From: Marc Zyngier

Date: Mon Jul 13 2026 - 11:46:58 EST


On Fri, 10 Jul 2026 15:07:52 +0100,
Steffen Eiden <seiden@xxxxxxxxxxxxx> wrote:
>
> On Wed, Jul 08, 2026 at 11:44:37AM +0100, Marc Zyngier wrote:
> > On Mon, 06 Jul 2026 09:52:25 +0100,
> > Steffen Eiden <seiden@xxxxxxxxxxxxx> wrote:
> > >
> > > +static void adjust_pc(struct kvm_vcpu *vcpu)
> > > +{
> > > + if (vcpu_get_flag(vcpu, INCREMENT_PC)) {
> > > + kvm_skip_instr(vcpu);
> > > + vcpu_clear_flag(vcpu, INCREMENT_PC);
> > > + }
> > > +}
> >
> > Can you clarify the semantics of adjust_pc() here? arm64 also deals
> > with exceptions in the same code, and I wonder how you deal with this.
> >
>
> We will do the same thing as native arm64 does. The KVM in this series
> has no clue what an exception is. Thus I skipped the handling here. The
> exception stuff is added in the second series anlongside with the sysreg
> handling.

Hmm, OK. Maybe I tend to view these things as tied together:

- updating PC on the back of taking an exception

- injecting an exception on the back of taking another exception

These two are the basic primitives to affect the guest's execution
flow, and the sysreg stuff builds on top of that.

But if that's the other way around makes more sense to you, fair
enough.

>
> ...
>
> > > +
> > > + kvm_sigset_deactivate(vcpu);
> > > +out:
> > > + if (unlikely(vcpu_get_flag(vcpu, INCREMENT_PC)))
> > > + adjust_pc(vcpu);
> >
> > arm64 has the following statements:
> >
> > if (unlikely(vcpu_get_flag(vcpu, PENDING_EXCEPTION) ||
> > vcpu_get_flag(vcpu, INCREMENT_PC)))
> > kvm_call_hyp(__kvm_adjust_pc, vcpu);
> >
> > It isn't clear to me why you can afford not to deal with pending
> > exceptions when returning to userspace.
> >
>
> Same reasoning like above. We'll do the exact same thing as native arm64
> with the next series.
>
> Thanks for looking into s390 code :)

I have the ugly feeling that this is going to come with the
territory... ;-)

M.

--
Jazz isn't dead. It just smells funny.