Re: [PATCH v2 09/20] KVM: s390: KVM page table management functions: clear and replace

Heiko Carstens
2025-09-16T15:56:17Z

On Thu, Sep 11, 2025 at 03:27:39PM +0200, Janosch Frank wrote:
> On 9/11/25 3:19 PM, Claudio Imbrenda wrote:
> > > > +void dat_crstep_xchg(union crste *crstep, union crste new, gfn_t gfn, union asce asce)
> > > > +{
> > > > + if (crstep->h.i) {
> > > > + WRITE_ONCE(*crstep, new);
> > > > + return;
> > > > + } else if (cpu_has_edat2()) {
> > > > + crdte_crste(crstep, *crstep, new, gfn, asce);
> > > > + return;
> > > > + }
> > > > +
> > > > + if (machine_has_tlb_guest())
> > > > + idte_crste(crstep, gfn, IDTE_GUEST_ASCE, asce, IDTE_GLOBAL);
> > > > + else if (cpu_has_idte())
> > > > + idte_crste(crstep, gfn, 0, NULL_ASCE, IDTE_GLOBAL);
> > > > + else
> > > > + csp_invalidate_crste(crstep);
> > >
> > > I'm wondering if we can make stfle 3 (DTE) a requirement for KVM or
> > > Linux as a whole since it was introduced with z990 AFAIK.
> >
> > AFAIK we don't support machines older than z10 anyway
> >
> > but in that case we can only get rid of csp_invalidate_crste(), which
> > is not much.
> >
> > I can remove it, if you really think it's ugly
>
> That was more of a general question, I think we have more of those checks in
> non-kvm code. Your code is fine as is.

Until now we have a check for all privileged instructions before
executing them, since at least in theory they can go away in future
machines.

The only exception is the mvcos instruction, since it is used all over
the place.

Unless there is a really good reason (e.g. large amounts of code could
be removed, or performance) I'd like to keep it like that.