[PATCH v3 15/21] KVM: arm64: Convert memslot cache-flushing code to generic page-table API

Gavin Shan gshan at redhat.com
Thu Sep 3 00:52:30 EDT 2020


Hi Will,

On 8/25/20 7:39 PM, Will Deacon wrote:
> From: Quentin Perret <qperret at google.com>
> 
> Convert stage2_flush_memslot() to call the kvm_pgtable_stage2_flush()
> function of the generic page-table code instead of walking the page-table
> directly.
> 
> Cc: Marc Zyngier <maz at kernel.org>
> Signed-off-by: Quentin Perret <qperret at google.com>
> Signed-off-by: Will Deacon <will at kernel.org>
> ---
>   arch/arm64/kvm/mmu.c | 13 +------------
>   1 file changed, 1 insertion(+), 12 deletions(-)
> 

Reviewed-by: Gavin Shan <gshan at redhat.com>

> diff --git a/arch/arm64/kvm/mmu.c b/arch/arm64/kvm/mmu.c
> index ca2c37c91e0b..d4b0716a6ab4 100644
> --- a/arch/arm64/kvm/mmu.c
> +++ b/arch/arm64/kvm/mmu.c
> @@ -455,21 +455,10 @@ static void stage2_flush_p4ds(struct kvm_s2_mmu *mmu, pgd_t *pgd,
>   static void stage2_flush_memslot(struct kvm *kvm,
>   				 struct kvm_memory_slot *memslot)
>   {
> -	struct kvm_s2_mmu *mmu = &kvm->arch.mmu;
>   	phys_addr_t addr = memslot->base_gfn << PAGE_SHIFT;
>   	phys_addr_t end = addr + PAGE_SIZE * memslot->npages;
> -	phys_addr_t next;
> -	pgd_t *pgd;
> -
> -	pgd = mmu->pgd + stage2_pgd_index(kvm, addr);
> -	do {
> -		next = stage2_pgd_addr_end(kvm, addr, end);
> -		if (!stage2_pgd_none(kvm, *pgd))
> -			stage2_flush_p4ds(mmu, pgd, addr, next);
>   
> -		if (next != end)
> -			cond_resched_lock(&kvm->mmu_lock);
> -	} while (pgd++, addr = next, addr != end);
> +	stage2_apply_range_resched(kvm, addr, end, kvm_pgtable_stage2_flush);
>   }
>   
>   /**
> 

Thanks,
Gavin




More information about the linux-arm-kernel mailing list