From: fangyu.yu@linux.alibaba.com
To: radim.krcmar@oss.qualcomm.com
Cc: alex@ghiti.fr, andrew.jones@oss.qualcomm.com,
anup@brainfault.org, aou@eecs.berkeley.edu,
atish.patra@linux.dev, corbet@lwn.net,
fangyu.yu@linux.alibaba.com, guoren@kernel.org,
kvm-riscv@lists.infradead.org, kvm@vger.kernel.org,
linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-riscv@lists.infradead.org, palmer@dabbelt.com,
pbonzini@redhat.com, pjw@kernel.org, skhan@linuxfoundation.org
Subject: Re: Re: [PATCH v7 1/4] RISC-V: KVM: Support runtime configuration for per-VM's HGATP mode
Date: Fri, 3 Apr 2026 10:13:14 +0800 [thread overview]
Message-ID: <20260403021314.37990-1-fangyu.yu@linux.alibaba.com> (raw)
In-Reply-To: <DHIV81G43OJO.2HY4RIYFRD0RL@oss.qualcomm.com>
>> From: Fangyu Yu <fangyu.yu@linux.alibaba.com>
>>
>> Introduces one per-VM architecture-specific fields to support runtime
>> configuration of the G-stage page table format:
>>
>> - kvm->arch.pgd_levels: the corresponding number of page table levels
>> for the selected mode.
>>
>> These fields replace the previous global variables
>> kvm_riscv_gstage_mode and kvm_riscv_gstage_pgd_levels, enabling different
>> virtual machines to independently select their G-stage page table format
>> instead of being forced to share the maximum mode detected by the kernel
>> at boot time.
>>
>> Signed-off-by: Fangyu Yu <fangyu.yu@linux.alibaba.com>
>> Reviewed-by: Andrew Jones <andrew.jones@oss.qualcomm.com>
>> Reviewed-by: Anup Patel <anup@brainfault.org>
>> Reviewed-by: Guo Ren <guoren@kernel.org>
>> ---
>> diff --git a/arch/riscv/kvm/vm.c b/arch/riscv/kvm/vm.c
>> @@ -199,7 +199,7 @@ int kvm_vm_ioctl_check_extension(struct kvm *kvm, long ext)
>> r = KVM_USER_MEM_SLOTS;
>> break;
>> case KVM_CAP_VM_GPA_BITS:
>> - r = kvm_riscv_gstage_gpa_bits;
>> + r = kvm_riscv_gstage_gpa_bits(kvm->arch.pgd_levels);
>
>kvm_vm_ioctl_check_extension() also gets called from with kvm == NULL
>from kvm_dev_ioctl(). I think we can continue to return
>...(kvm_riscv_gstage_max_pgd_levels) in that case.
>
Thanks for catching this. I’ll handle the kvm == NULL case (from kvm_dev_ioctl)
and return the host maximum based on kvm_riscv_gstage_max_pgd_levels in v8.
Also, if the intended semantics of KVM_CAP_VM_GPA_BITS is to report the maximum
supported value, then we could simply always return the host maximum based on
kvm_riscv_gstage_max_pgd_levels.
Thanks,
Fangyu
>Thanks.
next prev parent reply other threads:[~2026-04-03 2:13 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-02 13:22 [PATCH v7 0/4] Support runtime configuration for per-VM's HGATP mode fangyu.yu
2026-04-02 13:23 ` [PATCH v7 1/4] RISC-V: KVM: " fangyu.yu
2026-04-02 18:03 ` Radim Krčmář
2026-04-03 2:13 ` fangyu.yu [this message]
2026-04-02 13:23 ` [PATCH v7 2/4] RISC-V: KVM: Cache gstage pgd_levels in struct kvm_gstage fangyu.yu
2026-04-02 13:23 ` [PATCH v7 3/4] RISC-V: KVM: Detect and expose supported HGATP G-stage modes fangyu.yu
2026-04-02 14:40 ` Anup Patel
2026-04-02 18:19 ` Radim Krčmář
2026-04-03 2:31 ` fangyu.yu
2026-04-02 13:23 ` [PATCH v7 4/4] RISC-V: KVM: add KVM_CAP_RISCV_SET_HGATP_MODE fangyu.yu
2026-04-02 14:50 ` Anup Patel
2026-04-03 1:31 ` fangyu.yu
2026-04-03 2:02 ` fangyu.yu
2026-04-03 6:19 ` Anup Patel
2026-04-03 7:07 ` fangyu.yu
2026-04-03 8:11 ` Anup Patel
2026-04-02 18:27 ` Radim Krčmář
2026-04-03 2:59 ` fangyu.yu
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260403021314.37990-1-fangyu.yu@linux.alibaba.com \
--to=fangyu.yu@linux.alibaba.com \
--cc=alex@ghiti.fr \
--cc=andrew.jones@oss.qualcomm.com \
--cc=anup@brainfault.org \
--cc=aou@eecs.berkeley.edu \
--cc=atish.patra@linux.dev \
--cc=corbet@lwn.net \
--cc=guoren@kernel.org \
--cc=kvm-riscv@lists.infradead.org \
--cc=kvm@vger.kernel.org \
--cc=linux-doc@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-riscv@lists.infradead.org \
--cc=palmer@dabbelt.com \
--cc=pbonzini@redhat.com \
--cc=pjw@kernel.org \
--cc=radim.krcmar@oss.qualcomm.com \
--cc=skhan@linuxfoundation.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox