[U-Boot] [PATCH v3 1/3] riscv: Add kconfig option to run u-boot in S-mode

Bin Meng bmeng.cn at gmail.com
Thu Nov 22 14:36:03 UTC 2018


Hi Palmer,

On Thu, Nov 22, 2018 at 12:28 AM Palmer Dabbelt <palmer at sifive.com> wrote:
>
> On Tue, 20 Nov 2018 19:41:10 PST (-0800), anup at brainfault.org wrote:
> > This patch adds kconfig option RISCV_SMODE to run u-boot in
> > S-mode. When this opition is enabled we use s<xyz> CSRs instead
> > of m<xyz> CSRs.
> >
> > It is important to note that there is no equivalent S-mode CSR
> > for misa and mhartid CSRs so we expect M-mode runtime firmware
> > (BBL or equivalent) to emulate misa and mhartid CSR read.
> >
> > In-future, we will have more patches to avoid accessing misa and
> > mhartid CSRs from S-mode.
>
> Ya, I don't like this.  Our current boot protocol puts mhartid in a1 upon
> entering the supervisor, and allows the detection of misa via a device tree
> pointer provided in a0.
>

As Anup mentioned in the commit message, the read of mhartid in
*S-mode* should be fixed in future patches. We still need it for
M-mode.

> As long as everyone agrees this isn't what we're actually looking for then I'm
> fine with the patch, I just don't want to end up requiring this "M mode
> emulates some CSRs for S mode" interface.  Since we don't have an actual
> platform spec we've got to be careful to avoid a bunch of defacto interfaces
> that we'll need to support later.
>

Agreed.

Regards,
Bin


More information about the U-Boot mailing list