Re: [PATCH 20/30] KVM: arm64: Introduce hypercall to force reclaim of a protected page

Will Deacon
2026-01-09T17:48:02Z

On Tue, Jan 06, 2026 at 03:44:06PM +0000, Quentin Perret wrote:
> > +static int host_stage2_decode_gfn_meta(kvm_pte_t pte, struct pkvm_hyp_vm **vm,
> > + u64 *gfn)
> > +{
> > + pkvm_handle_t handle;
> > + u64 meta;
> > +
> > + if (kvm_pte_valid(pte))
> > + return -EINVAL;
>
> Nit:
>
> I can't think of any cases where we'd end up returning -EINVAL here that
> isn't indicative of a major problem (e.g taking a stage-2 perm fault we
> don't expect) given that we've extensively checked the state of the page
> already. Upgrade to WARN()? It's fatal, but the system is unlikely to
> make much more progress if we return cleanly anyways, so we might as
> well make it obvious where things went wrong.

Good spot. We already confirmed the NOPAGE state, so a WARN() if the pte
is valid makes perfect sense to me.

Will