[PATCH v1 05/12] KVM: arm64: Maintain page-table format info in struct kvm_pgtable

Oliver Upton oliver.upton at linux.dev
Mon Dec 19 11:45:44 PST 2022


Hi Ryan,

On Tue, Dec 06, 2022 at 01:59:23PM +0000, Ryan Roberts wrote:
> As the next step on the journey to supporting FEAT_LPA2 in KVM, add a
> flag to struct kvm_pgtable, which functions can then use to select the
> approprate behavior for either the `classic` or `lpa2` page-table
> formats. For now, all page-tables remain in the `classic` format.
> 
> No functional changes are intended.
> 
> Signed-off-by: Ryan Roberts <ryan.roberts at arm.com>
> ---
>  arch/arm64/include/asm/kvm_pgtable.h | 2 ++
>  arch/arm64/kvm/hyp/pgtable.c         | 2 ++
>  arch/arm64/kvm/mmu.c                 | 1 +
>  3 files changed, 5 insertions(+)
> 
> diff --git a/arch/arm64/include/asm/kvm_pgtable.h b/arch/arm64/include/asm/kvm_pgtable.h
> index 2247ed74871a..744e224d964b 100644
> --- a/arch/arm64/include/asm/kvm_pgtable.h
> +++ b/arch/arm64/include/asm/kvm_pgtable.h
> @@ -157,6 +157,7 @@ typedef bool (*kvm_pgtable_force_pte_cb_t)(u64 addr, u64 end,
>   * @start_level:	Level at which the page-table walk starts.
>   * @pgd:		Pointer to the first top-level entry of the page-table.
>   * @mm_ops:		Memory management callbacks.
> + * @lpa2_ena:		Format used for page-table; false->classic, true->lpa2.

I'd prefer that we describe the paging structure purely in terms of
input and output address. If you add the latter it should be possible to
decide if LPA2 is actually in use.

(i.e. PAGE_SIZE != SZ_64K && pgt->oa_bits > 48)

--
Thanks,
Oliver



More information about the linux-arm-kernel mailing list