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

Anup Patel anup at brainfault.org
Thu Nov 22 04:00:05 UTC 2018


On Wed, Nov 21, 2018 at 9:58 PM 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 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.

Yes, it's a temporary thingy to emulate misa and mhartid in BBL.

Eventually, U-Boot will be fixed to avoid direct access of misa and mhartid.

Regards,
Anup


More information about the U-Boot mailing list