Re: [PATCH v5 1/6] KVM: arm64: Introduce KVM_PGTABLE_S2_GUEST stage-2 flag

From: Quentin Perret
Date: Wed Jun 02 2021 - 06:43:52 EST


Hi Yanan,

On Thursday 15 Apr 2021 at 19:50:27 (+0800), Yanan Wang wrote:
> diff --git a/arch/arm64/include/asm/kvm_pgtable.h b/arch/arm64/include/asm/kvm_pgtable.h
> index c3674c47d48c..a43cbe697b37 100644
> --- a/arch/arm64/include/asm/kvm_pgtable.h
> +++ b/arch/arm64/include/asm/kvm_pgtable.h
> @@ -61,10 +61,12 @@ struct kvm_pgtable_mm_ops {
> * @KVM_PGTABLE_S2_NOFWB: Don't enforce Normal-WB even if the CPUs have
> * ARM64_HAS_STAGE2_FWB.
> * @KVM_PGTABLE_S2_IDMAP: Only use identity mappings.
> + * @KVM_PGTABLE_S2_GUEST: Whether the page-tables are guest stage-2.
> */
> enum kvm_pgtable_stage2_flags {
> KVM_PGTABLE_S2_NOFWB = BIT(0),
> KVM_PGTABLE_S2_IDMAP = BIT(1),
> + KVM_PGTABLE_S2_GUEST = BIT(2),

Assuming that we need this flag (maybe not given Marc's suggestion on
another patch), I'd recommend re-naming it to explain _what_ it does,
rather than _who_ is using it.

That's the principle we followed for e.g. KVM_PGTABLE_S2_IDMAP, so we
should be consistent here as well.

Thanks,
Quentin