[PATCH 5/5] powerpc/microwatt: Add SMP support
Paul Mackerras
paulus at ozlabs.org
Fri Jan 31 12:27:12 AEDT 2025
On Wed, Jan 29, 2025 at 06:12:55PM +1000, Nicholas Piggin wrote:
> On Wed Jan 29, 2025 at 4:57 PM AEST, Paul Mackerras wrote:
> > void __init microwatt_init_smp(void)
> > {
> > volatile unsigned char __iomem *syscon;
> > int ncpus;
> > int timeout;
> >
> > syscon = early_ioremap(SYSCON_BASE, 0x100);
>
> ioremap is not up by SMP init time? I always have to
> trawl through init spaghetti to work it out. I guess it's
> early SMP init.
I had a little difficulty with this, and ended up with this function
(microwatt_init_smp) being called at platform probe time, which is why
the early_ioremap. We need the secondary CPUs spinning in
__secondary_hold before smp_release_cpus() gets called, because that
is what sends them to generic_secondary_smp_init().
Now smp_release_cpus() is called in setup_arch() before even the
platform's setup_arch() function. (And also, smp_setup_cpu_maps()
gets called even earlier.) Hence the choice of the platform probe
function.
On platforms with OF and RTAS, the secondary CPUs are started and left
spinning in __secondary_hold by prom_init(), which is right at the
beginning, before the kernel proper starts executing. Microwatt
doesn't have OF or RTAS, and the secondary CPUs are held in reset
until microwatt_init_smp() releases them (and then they start at 0).
Doing that as early as possible therefore more-or-less matches what
OF/RTAS platforms do.
Paul.
More information about the Linuxppc-dev
mailing list