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

From: Quentin Perret
Date: Thu Apr 03 2025 - 10:27:40 EST


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?

Thanks,
Quentin