Re: [PATCH v3 10/21] KVM: arm64: Enable forcing page-level stage-2 mappings

From: Fuad Tabba
Date: Tue Aug 03 2021 - 06:44:12 EST


Hi Quentin,

> > > +static bool stage2_block_mapping_allowed(u64 addr, u64 end, u32 level,
> > > + struct stage2_map_data *data)
> > > +{
> > > + if (data->force_pte && (level < (KVM_PGTABLE_MAX_LEVELS - 1)))
> > > + return false;
> >
> > I'm not sure I understand why checking the level is necessary. Can
> > there be block mapping at the last possible level?
>
> That's probably just a matter of naming, but this function is in fact
> called at every level, just like kvm_block_mapping_supported() was
> before. And we rely on it returning true at the last level, so I need to
> do that check here.
>
> Maybe renaming this stage2_leaf_mapping_allowed() would clarify?

Yes it would.

Thanks,
/fuad