Re: [PATCH v5 1/5] RISC-V: KVM: Add the split page cache for ioctl context

Anup Patel <[email protected]> Sat, 1 Aug 2026 12:07:14 +0530
Newsgroups org.kernel.vger.kvm,org.infradead.lists.kvm-riscv,org.infradead.lists.linux-riscv,org.kernel.vger.linux-kernel
Message-ID <CAAhSdy1d_7w4vJS9CfuSJg6o9CYgnn8j-Bky-KtcCwuP2oo0Hw@mail.gmail.com>
On Fri, Jul 31, 2026 at 2:46 PM Wang Yechao <[email protected]> wrote:
>
> Add the split page cache for dirty logging enablement and the
> KVM_CLEAR_DIRTY_LOG ioctl.
>
> Signed-off-by: Wang Yechao <[email protected]>

LGTM.

Reviewed-by: Anup Patel <[email protected]>

Thanks,
Anup

> ---
>  arch/riscv/include/asm/kvm_host.h | 1 +
>  arch/riscv/kvm/mmu.c              | 3 +++
>  2 files changed, 4 insertions(+)
>
> diff --git a/arch/riscv/include/asm/kvm_host.h b/arch/riscv/include/asm/kvm_host.h
> index e2d5808169e44..71e455d166905 100644
> --- a/arch/riscv/include/asm/kvm_host.h
> +++ b/arch/riscv/include/asm/kvm_host.h
> @@ -86,6 +86,7 @@ struct kvm_arch {
>         pgd_t *pgd;
>         phys_addr_t pgd_phys;
>         unsigned long pgd_levels;
> +       struct kvm_mmu_memory_cache pgd_split_page_cache;
>
>         /* Guest Timer */
>         struct kvm_guest_timer timer;
> diff --git a/arch/riscv/kvm/mmu.c b/arch/riscv/kvm/mmu.c
> index 8a0aa5e0e216e..2017d292f4ca7 100644
> --- a/arch/riscv/kvm/mmu.c
> +++ b/arch/riscv/kvm/mmu.c
> @@ -677,6 +677,7 @@ int kvm_riscv_mmu_alloc_pgd(struct kvm *kvm)
>         kvm->arch.pgd = page_to_virt(pgd_page);
>         kvm->arch.pgd_phys = page_to_phys(pgd_page);
>         kvm->arch.pgd_levels = kvm_riscv_gstage_max_pgd_levels;
> +       kvm->arch.pgd_split_page_cache.gfp_zero = __GFP_ZERO;
>
>         return 0;
>  }
> @@ -704,6 +705,8 @@ void kvm_riscv_mmu_free_pgd(struct kvm *kvm)
>
>         if (pgd)
>                 free_pages((unsigned long)pgd, get_order(kvm_riscv_gstage_pgd_size));
> +
> +       kvm_mmu_free_memory_cache(&kvm->arch.pgd_split_page_cache);
>  }
>
>  void kvm_riscv_mmu_update_hgatp(struct kvm_vcpu *vcpu)
> --
> 2.39.3
>