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

Anup Patel <[email protected]>
Newsgroups org.infradead.lists.kvm-riscv,org.infradead.lists.linux-riscv,org.kernel.vger.kvm,org.kernel.vger.linux-kernel
Message-ID <CAAhSdy0Wd2=hmJ_1ZXa1mB6ojt32HeA8AW43=GLh52_5DuZqmw@mail.gmail.com>
On Wed, May 13, 2026 at 1:09 PM <[email protected]> wrote:
>
> From: Wang Yechao <[email protected]>
>
> Add the split page cache for dirty logging enablement and the
> KVM_CLEAR_DIRTY_LOG ioctl.
>
> Signed-off-by: Wang Yechao <[email protected]>
> ---
>  arch/riscv/include/asm/kvm_host.h | 2 ++
>  arch/riscv/kvm/mmu.c              | 3 +++
>  2 files changed, 5 insertions(+)
>
> diff --git a/arch/riscv/include/asm/kvm_host.h b/arch/riscv/include/asm/kvm_host.h
> index 75b0a951c1bc..e2f40854305f 100644
> --- a/arch/riscv/include/asm/kvm_host.h
> +++ b/arch/riscv/include/asm/kvm_host.h
> @@ -93,6 +93,8 @@ struct kvm_arch {
>
>         /* KVM_CAP_RISCV_MP_STATE_RESET */
>         bool mp_state_reset;
> +
> +       struct kvm_mmu_memory_cache split_page_cache;

Rename it to pgd_split_page_cache and add it below
pgd_levels.

>  };
>
>  struct kvm_cpu_trap {
> diff --git a/arch/riscv/kvm/mmu.c b/arch/riscv/kvm/mmu.c
> index 2d3def024270..85a3fb2622a4 100644
> --- a/arch/riscv/kvm/mmu.c
> +++ b/arch/riscv/kvm/mmu.c
> @@ -549,6 +549,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.split_page_cache.gfp_zero = __GFP_ZERO;
>
>         return 0;
>  }
> @@ -572,6 +573,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.split_page_cache);
>  }
>
>  void kvm_riscv_mmu_update_hgatp(struct kvm_vcpu *vcpu)
> --
> 2.27.0

Regards,
Anup

-- 
kvm-riscv mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kvm-riscv
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.