Re: [PATCH v2] RISC-V: Clear HSTATUS.HU on CPU initialization

From: Paul Walmsley

Date: Wed Sep 30 2026 - 23:02:27 EST


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@xxxxxxxxxx>
> Reviewed-by: Samuel Holland <samuel.holland@xxxxxxxxxx>

Thanks, queued for v7.3-rc.


- Paul