[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CA+EHjTwGCZY8CzM_zBQ6yWCTVu_B-GZFvvHPBUqRW-jr4LDE2A@mail.gmail.com>
Date: Wed, 21 Jul 2021 09:20:39 +0100
From: Fuad Tabba <tabba@...gle.com>
To: Quentin Perret <qperret@...gle.com>
Cc: maz@...nel.org, james.morse@....com, alexandru.elisei@....com,
suzuki.poulose@....com, catalin.marinas@....com, will@...nel.org,
linux-arm-kernel@...ts.infradead.org, kvmarm@...ts.cs.columbia.edu,
linux-kernel@...r.kernel.org, ardb@...nel.org, qwandor@...gle.com,
dbrazdil@...gle.com, kernel-team@...roid.com
Subject: Re: [PATCH 11/14] KVM: arm64: Expose kvm_pte_valid() helper
Hi Quentin,
On Mon, Jul 19, 2021 at 11:48 AM Quentin Perret <qperret@...gle.com> wrote:
>
> The KVM pgtable API exposes the kvm_pgtable_walk() function to allow
> the definition of walkers outside of pgtable.c. However, it is not easy
> to implement any of those walkers without some of the low-level helpers,
> such as kvm_pte_valid(). Make it static inline, and move it to the
> header file to allow its re-use in other places.
>
> Signed-off-by: Quentin Perret <qperret@...gle.com>
> ---
> arch/arm64/include/asm/kvm_pgtable.h | 7 +++++++
> arch/arm64/kvm/hyp/pgtable.c | 6 ------
> 2 files changed, 7 insertions(+), 6 deletions(-)
>
> diff --git a/arch/arm64/include/asm/kvm_pgtable.h b/arch/arm64/include/asm/kvm_pgtable.h
> index 1aa49d6aabb7..8240c881ae1e 100644
> --- a/arch/arm64/include/asm/kvm_pgtable.h
> +++ b/arch/arm64/include/asm/kvm_pgtable.h
> @@ -25,6 +25,13 @@ static inline u64 kvm_get_parange(u64 mmfr0)
>
> typedef u64 kvm_pte_t;
>
> +#define KVM_PTE_VALID BIT(0)
> +
I don't know if there's a better solution for this, but having the
KVM_PTE_VALID by itself here, with the rest remaining in pgtable.c
might be confusing. I see that you probably don't want to move them
all here because they are internal to pgtable.c.
Thanks,
/fuad
> +static inline bool kvm_pte_valid(kvm_pte_t pte)
> +{
> + return pte & KVM_PTE_VALID;
> +}
> +
> /**
> * struct kvm_pgtable_mm_ops - Memory management callbacks.
> * @zalloc_page: Allocate a single zeroed memory page.
> diff --git a/arch/arm64/kvm/hyp/pgtable.c b/arch/arm64/kvm/hyp/pgtable.c
> index c7120797404a..e0ae57dca827 100644
> --- a/arch/arm64/kvm/hyp/pgtable.c
> +++ b/arch/arm64/kvm/hyp/pgtable.c
> @@ -11,7 +11,6 @@
> #include <asm/kvm_pgtable.h>
> #include <asm/stage2_pgtable.h>
>
> -#define KVM_PTE_VALID BIT(0)
>
> #define KVM_PTE_TYPE BIT(1)
> #define KVM_PTE_TYPE_BLOCK 0
> @@ -135,11 +134,6 @@ static u32 kvm_pgd_pages(u32 ia_bits, u32 start_level)
> return __kvm_pgd_page_idx(&pgt, -1ULL) + 1;
> }
>
> -static bool kvm_pte_valid(kvm_pte_t pte)
> -{
> - return pte & KVM_PTE_VALID;
> -}
> -
> static bool kvm_pte_table(kvm_pte_t pte, u32 level)
> {
> if (level == KVM_PGTABLE_MAX_LEVELS - 1)
> --
> 2.32.0.402.g57bb445576-goog
>
Powered by blists - more mailing lists