On Thu, Sep 10, 2026 at 09:49:08AM +0100, Marc Zyngier wrote:
> On Tue, 25 Aug 2026 17:00:37 +0100,
> "Lorenzo Stoakes (ARM)" <[email protected]> wrote:
> >  arch/arm64/kvm/mmu.c | 33 +++++++++++++++++++++++++++------
> >  1 file changed, 27 insertions(+), 6 deletions(-)
> >
> > diff --git a/arch/arm64/kvm/mmu.c b/arch/arm64/kvm/mmu.c
> > index 80cb520e25b9..da15da4e40e6 100644
> > --- a/arch/arm64/kvm/mmu.c
> > +++ b/arch/arm64/kvm/mmu.c
> > @@ -1607,6 +1607,11 @@ struct kvm_s2_fault_desc {
> >     struct kvm_s2_mmu       *mmu;
> >  };
> >
> > +struct kvm_s2_fault_result {
> > +   unsigned long mapping_size;
> > +   bool mapped;
> > +};
> > +
> >  static bool kvm_s2_fault_is_perm(const struct kvm_s2_fault_desc *s2fd)
> >  {
> >     return esr_fsc_is_permission_fault(s2fd->esr);
> > @@ -1632,7 +1637,17 @@ static u64 kvm_s2_perm_fault_granule(const struct 
> > kvm_s2_fault_desc *s2fd)
> >     return BIT(ARM64_HW_PGTABLE_LEVEL_SHIFT(level));
> >  }
> >
> > -static int gmem_abort(const struct kvm_s2_fault_desc *s2fd)
> > +static void populate_fault_result(struct kvm_s2_fault_result *result,
> > +                             unsigned long mapping_size)
> > +{
> > +   /* A THP upgrade may have altered mapping size. */
> > +   result->mapping_size = mapping_size;
> > +   /* -EAGAIN is swallowed so be explicit when we actually map. */
> > +   result->mapped = true;
>
> I'm not sold on this boolean. I'd rather we use the fact that the
> fault handler has passed a result pointer to return -EAGAIN rather
> than turning into a 0, because that's a clear sign that the fault
> hasn't been generated by a vcpu.

Yeah I did actually think that myself when writing it :) I was a bit in two
minds about how to do this, but yeah that's just a better way, will fix
that!

>
>
>       M.
>
> --
> Without deviation from the norm, progress is not possible.

--
Cheers, Lorenzo

Reply via email to