Re: [PATCH v2 8/9] KVM: arm64: Stage-2 huge mappings for np-guests

From: Vincent Donnefort
Date: Fri Apr 04 2025 - 13:08:24 EST


On Thu, Apr 03, 2025 at 02:21:07PM +0000, Quentin Perret wrote:
> On Thursday 06 Mar 2025 at 11:00:37 (+0000), Vincent Donnefort wrote:
> > diff --git a/arch/arm64/kvm/mmu.c b/arch/arm64/kvm/mmu.c
> > index 1f55b0c7b11d..3143f3b52c93 100644
> > --- a/arch/arm64/kvm/mmu.c
> > +++ b/arch/arm64/kvm/mmu.c
> > @@ -1525,7 +1525,7 @@ static int user_mem_abort(struct kvm_vcpu *vcpu, phys_addr_t fault_ipa,
> > * logging_active is guaranteed to never be true for VM_PFNMAP
> > * memslots.
> > */
> > - if (logging_active || is_protected_kvm_enabled()) {
> > + if (logging_active) {
> > force_pte = true;
> > vma_shift = PAGE_SHIFT;
> > } else {
> > @@ -1535,7 +1535,8 @@ static int user_mem_abort(struct kvm_vcpu *vcpu, phys_addr_t fault_ipa,
> > switch (vma_shift) {
> > #ifndef __PAGETABLE_PMD_FOLDED
> > case PUD_SHIFT:
> > - if (fault_supports_stage2_huge_mapping(memslot, hva, PUD_SIZE))
> > + if (is_protected_kvm_enabled() ||
> > + fault_supports_stage2_huge_mapping(memslot, hva, PUD_SIZE))
>
> Should this be
>
> if (!is_protected_kvm_enabled() &&
> fault_supports_stage2_huge_mapping(memslot, hva, PUD_SIZE))
>
> instead?

Duh! Indeed that's what it should be!

I'm going to send a v3 addressing all those comments of yours. Thanks for
having a look at the series!

>
> Thanks,
> Quentin