On Mon, 2023-01-23 at 18:56 +0200, Oleksii wrote:
> Hi Alistair and community,
> 
> I am working on RISC-V support upstream for Xen based on your and
> Bobby
> patches.
> 
> Adding the RISC-V support I realized that Xen is ran in S-mode.
> Output
> of OpenSBI:
>     ...
>     Domain0 Next Mode         : S-mode
>     ...
> So the first my question is shouldn't it be in H-mode?

There is no H-mode in RISC-V.

When the Hypervisor extension exists the standard S-mode automatically
becomes HS-mode. The two names can be used interchangeably (although
the spec calls it HS-mode).

In this way Linux (with or without KVM support) and Xen all boot in the
same mode and can choose to use virtulisation if desired.

> 
> If I am right than it looks like we have to do a patch to OpenSBI to
> add support of H-mode as it is not supported now:
> [1]
> https://github.com/riscv-software-src/opensbi/blob/master/lib/sbi/sbi_domain.c#L380
> [2]
> https://github.com/riscv-software-src/opensbi/blob/master/include/sbi/riscv_encoding.h#L110
> Please correct me if I am wrong.
> 
> The other option I see is to switch to H-mode in U-boot as I
> understand
> the classical boot flow is:
>     OpenSBI -> U-boot -> Xen -> Domain{0,...}
> If it is at all possible since U-boot will be in S mode after
> OpenSBI.

S-mode is where you want to be. That's what Xen should start in.

Alistair

> 
> Thanks in advance.
> 
> ~ Oleksii

Reply via email to