[RFC PATCH v4 1/2] arch: riscv: cpu: Add callback to init each core

Green Wan green.wan at sifive.com
Tue Apr 13 10:47:28 CEST 2021


On Tue, Apr 13, 2021 at 12:17 PM Sean Anderson <seanga2 at gmail.com> wrote:
>
> On 4/13/21 12:12 AM, Rick Chen wrote:
> > Hi Sean
> >
> >> On 4/12/21 10:39 PM, Rick Chen wrote:
> >>> Hi Green,
> >>>
> >>>> From: Green Wan [mailto:green.wan at sifive.com]
> >>>> Sent: Monday, April 12, 2021 10:33 AM
> >>>> To: Sean Anderson
> >>>> Cc: Rick Chen; Rick Jian-Zhi Chen(陳建志); Bin Meng; U-Boot Mailing List; Paul Walmsley; Pragnesh Patel; Simon Glass; Atish Patra; Leo Yu-Chi Liang(梁育齊); Brad Kim
> >>>> Subject: Re: [RFC PATCH v4 1/2] arch: riscv: cpu: Add callback to init each core
> >>>>
> >>>> Hi Bin and Sean,
> >>>>
> >>>> While we keep the consistency of cache control discussion going, later
> >>>> today I'd like to send the v5 patch which is not directly relevant to
> >>>> cache control.
> >>>
> >>> I will prefer not to mix cache control issue into this patch.
> >>> Like I said, this callback is a init for all harts before lottery.
> >>
> >> Yes, but enabling caches is a very similar thing (this proposal even
> >> uses it to turn on caches, among other things). At the moment we have
> >> two calls to enable caches at almost the same time as what Green
> >> proposes. These calls only translate into work done on one platform. I
> >> think having one call (or perhaps two) for this purpose would help
> >> reduce codepaths across different platforms going forward.
> >>
> >
> > Maybe we can add two callbacks (early_lottery_init and
> > late_lottery_init) before and after lottery individually for all
> > scenarios.
>
> Yes, that is a possibility. But do we actually need that flexibility?
> This comes back around to my original question: why does ax25 disable
> cache on all harts before jumping to Linux?

I sort of agree with Sean to merge some callbacks and keep most boot
flow clean. And I feel early/late_lottery_init not a
generic/meaningful name for a bootloader. But I doubt we should
restrict all harts that must be cache enabled/disabled. Won't it
conflict with some H/W behavior or decrease flexibilities?

>
> And of course, does this actually need to be done before the lottery?
Not sure the question is for me. Since some callbacks are only called
by main hart after picking up the lottery, any init must be done
within each hart itself, we have to do them before the lottery unless
HW provides a common way to set up all harts. Of course, we can use
IPI. But IPI is not a straightforward way.

-
Geen
>
> --Sean
>


More information about the U-Boot mailing list