[PATCH] RISC-V: KVM: Prevent HGATP_MODE_BARE passed

Nutty.Liu nutty.liu at hotmail.com
Tue Aug 19 02:30:32 PDT 2025


On 8/19/2025 8:46 AM, guoren at kernel.org wrote:
> From: "Guo Ren (Alibaba DAMO Academy)" <guoren at kernel.org>
>
> urrent kvm_riscv_gstage_mode_detect() assumes H-extension must
s/urrent/Current
> have HGATP_MODE_SV39X4/SV32X4 at least, but the spec allows
> H-extension with HGATP_MODE_BARE alone. The KVM depends on
> !HGATP_MODE_BARE at least, so enhance the gstage-mode-detect
> to block HGATP_MODE_BARE.
>
> Move gstage-mode-check closer to gstage-mode-detect to prevent
> unnecessary init.
>
> Signed-off-by: Guo Ren (Alibaba DAMO Academy) <guoren at kernel.org>
> ---
>   arch/riscv/kvm/gstage.c | 27 ++++++++++++++++++++++++---
>   arch/riscv/kvm/main.c   | 35 +++++++++++++++++------------------
>   2 files changed, 41 insertions(+), 21 deletions(-)
Reviewed-by: Nutty Liu <nutty.liu at hotmail.com>

Thanks,
Nutty



More information about the kvm-riscv mailing list