[PATCH v2] RISC-V: Clear HSTATUS.HU on CPU initialization
Paul Walmsley
pjw at kernel.org
Wed Sep 30 20:02:16 PDT 2026
On Thu, 24 Sep 2026, Yong-Xuan Wang wrote:
> The RISC-V privileged specification does not mandate HSTATUS reset
> values, leaving the HU bit potentially set after hardware reset.
> When HU=1, hypervisor instructions (HLV/HLVX/HSV) can execute in
> U-mode to access guest memory, which may cause unintended behavior
> if not explicitly controlled.
>
> Clear HSTATUS.HU during CPU initialization to ensure hypervisor
> instructions are only available in HS-mode, preventing unexpected
> guest memory access from U-mode code.
>
> Signed-off-by: Yong-Xuan Wang <yongxuan.wang at sifive.com>
> Reviewed-by: Samuel Holland <samuel.holland at sifive.com>
Thanks, queued for v7.3-rc.
- Paul
More information about the kvm-riscv
mailing list