Re: [PATCH v2 3/5] KVM: s390: refactor some functions in priv.c

From: Claudio Imbrenda
Date: Tue May 27 2025 - 05:15:06 EST


On Tue, 27 May 2025 09:18:01 +0200
"Nico Boehr" <nrb@xxxxxxxxxxxxx> wrote:

this patch had so many issues, and brought no real advantages, so I
dropped it from v3 onwards

> On Tue May 20, 2025 at 8:26 PM CEST, Claudio Imbrenda wrote:
> [...]
> > diff --git a/arch/s390/kvm/priv.c b/arch/s390/kvm/priv.c
> > index 9253c70897a8..15843e7e57e6 100644
> > --- a/arch/s390/kvm/priv.c
> > +++ b/arch/s390/kvm/priv.c
> [...]
> > +static int skeys_common_checks(struct kvm_vcpu *vcpu, struct skeys_ops_state *state)
> > +{
> > + int rc;
> > +
> > + if (vcpu->arch.sie_block->gpsw.mask & PSW_MASK_PSTATE) {
> > + rc = kvm_s390_inject_program_int(vcpu, PGM_PRIVILEGED_OP);
> > + return rc ? rc : -EAGAIN;
>
> What has changed that
>
> return kvm_s390_inject_program_int()
>
> is not sufficient any more?
>
> [...]
> > + get_regs_rre_ptr(vcpu, &state->reg1, &state->reg2, &state->r1, &state->r2);
> > +
> > + state->effective = vcpu->run->s.regs.gprs[state->reg2] & PAGE_MASK;
>
> *state->r2?
>
> [...]
> > static int handle_pfmf(struct kvm_vcpu *vcpu)
> > {
> [...]
> > + if (r1.fsc) {
> > + end = kvm_s390_logical_to_effective(vcpu, end);
> > + if (kvm_s390_is_amode_64(vcpu))
> > + replace_selected_bits(r2, PAGE_MASK, end);
> > + else
> > + replace_selected_bits(r2, 0xfffff000, end);
>
> Maybe I'm missing something, but I don't get why you need replace_selected_bits
> here. kvm_s390_logical_to_effective() already does the neccesary masking, no?