Re: [PATCH v15 02/37] KVM: arm64: Avoid including linux/kvm_host.h in kvm_pgtable.h
From: Marc Zyngier
Date: Wed Jul 15 2026 - 11:57:50 EST
On Wed, 15 Jul 2026 15:28:04 +0100,
Steven Price <steven.price@xxxxxxx> wrote:
>
> To avoid future include cycles, drop the linux/kvm_host.h include in
> kvm_pgtable.h and include the lightweight headers required for the types and
> inline helpers used there. Additionally provide a forward declaration for
> struct kvm_s2_mmu as it's only used as a pointer in this file.
>
> Both pgtable.c and kvm_pkvm.h relied on the indirect inclusion of
> kvm_host.h, so make that explicit.
>
> Signed-off-by: Steven Price <steven.price@xxxxxxx>
> ---
> New patch in v13
> ---
> arch/arm64/include/asm/kvm_pgtable.h | 6 +++++-
> arch/arm64/include/asm/kvm_pkvm.h | 2 +-
> arch/arm64/kvm/hyp/pgtable.c | 1 +
> 3 files changed, 7 insertions(+), 2 deletions(-)
>
> diff --git a/arch/arm64/include/asm/kvm_pgtable.h b/arch/arm64/include/asm/kvm_pgtable.h
> index 41a8687938eb..c2e4b29e605f 100644
> --- a/arch/arm64/include/asm/kvm_pgtable.h
> +++ b/arch/arm64/include/asm/kvm_pgtable.h
> @@ -8,9 +8,13 @@
> #define __ARM64_KVM_PGTABLE_H__
>
> #include <linux/bits.h>
> -#include <linux/kvm_host.h>
> +#include <linux/kvm_types.h>
> +#include <linux/rbtree_types.h>
> +#include <linux/rcupdate.h>
> #include <linux/types.h>
>
> +struct kvm_s2_mmu;
> +
> #define KVM_PGTABLE_FIRST_LEVEL -1
> #define KVM_PGTABLE_LAST_LEVEL 3
>
> diff --git a/arch/arm64/include/asm/kvm_pkvm.h b/arch/arm64/include/asm/kvm_pkvm.h
> index 74fedd9c5ff0..a0f7a699d690 100644
> --- a/arch/arm64/include/asm/kvm_pkvm.h
> +++ b/arch/arm64/include/asm/kvm_pkvm.h
> @@ -9,7 +9,7 @@
> #include <linux/arm_ffa.h>
> #include <linux/memblock.h>
> #include <linux/scatterlist.h>
> -#include <asm/kvm_host.h>
> +#include <linux/kvm_host.h>
nit: please keep the include directives in alphabetical order.
M.
--
Jazz isn't dead. It just smells funny.