[PATCH v5 06/21] KVM: arm64: Add support for stage-2 map()/unmap() in generic page-table

Alexandru Elisei alexandru.elisei at arm.com
Tue Sep 15 06:47:39 EDT 2020


Hi Will,

On 9/11/20 2:25 PM, Will Deacon wrote:
> Add stage-2 map() and unmap() operations to the generic page-table code.
>
> Cc: Marc Zyngier <maz at kernel.org>
> Cc: Quentin Perret <qperret at google.com>
> Reviewed-by: Gavin Shan <gshan at redhat.com>
> Signed-off-by: Will Deacon <will at kernel.org>
> ---
>  arch/arm64/include/asm/kvm_pgtable.h |  46 +++++
>  arch/arm64/kvm/hyp/pgtable.c         | 273 +++++++++++++++++++++++++++
>  2 files changed, 319 insertions(+)
>
> diff --git a/arch/arm64/include/asm/kvm_pgtable.h b/arch/arm64/include/asm/kvm_pgtable.h
> index 21d71395a377..895b2238062b 100644
> --- a/arch/arm64/include/asm/kvm_pgtable.h
> +++ b/arch/arm64/include/asm/kvm_pgtable.h
> @@ -140,6 +140,52 @@ int kvm_pgtable_stage2_init(struct kvm_pgtable *pgt, struct kvm *kvm);
>   */
>  void kvm_pgtable_stage2_destroy(struct kvm_pgtable *pgt);
>  
> +/**
> + * kvm_pgtable_stage2_map() - Install a mapping in a guest stage-2 page-table.
> + * @pgt:	Page-table structure initialised by kvm_pgtable_stage2_init().
> + * @addr:	Intermediate physical address at which to place the mapping.
> + * @size:	Size of the mapping.
> + * @phys:	Physical address of the memory to map.
> + * @prot:	Permissions and attributes for the mapping.
> + * @mc:		Cache of pre-allocated GFP_PGTABLE_USER memory from which to
> + *		allocate page-table pages.

In v5.9-rc5, kvm_mmu_topup_memory_cache() allocates GFP_KERNEL_ACCOUNT ==
GFP_KERNEL|__GFP_ACCOUNT memory, not GFP_PGTABLE_USER ==
GFP_KERNEL|__GFP_ZERO|__GFP_ACCOUNT.

Thanks,
Alex



More information about the linux-arm-kernel mailing list