linux/arch/powerpc/platforms/microwatt/setup.c
Paul Mackerras aca95fb6bb powerpc/microwatt: Add SMP support
This adds support for Microwatt systems with more than one core, and
updates the device tree for a 2-core version.

The secondary CPUs are started and sent to spin in __secondary_hold
very early on, in the platform probe function.  The reason for doing
this is so that they are there when smp_release_cpus() gets called,
which is before the platform init_smp function or even the platform
setup_arch function gets called.

Note that having two CPUs in the device tree doesn't preclude
operation with only one CPU.  The SYSCON_CPU_CTRL register has a
read-only field which indicates the number of CPU cores, so
microwatt_init_smp() will only start as many CPU cores as are present
in the system, and any extra CPU device-tree nodes will just be
ignored.

Signed-off-by: Paul Mackerras <paulus@ozlabs.org>
Signed-off-by: Madhavan Srinivasan <maddy@linux.ibm.com>
Link: https://patch.msgid.link/Z5xt8aooKyXZv6Kf@thinks.paulus.ozlabs.org
2025-02-26 21:16:48 +05:30

61 lines
1.2 KiB
C

/*
* Microwatt FPGA-based SoC platform setup code.
*
* Copyright 2020 Paul Mackerras (paulus@ozlabs.org), IBM Corp.
*/
#include <linux/types.h>
#include <linux/kernel.h>
#include <linux/stddef.h>
#include <linux/init.h>
#include <linux/of.h>
#include <linux/of_platform.h>
#include <asm/machdep.h>
#include <asm/time.h>
#include <asm/xics.h>
#include <asm/udbg.h>
#include "microwatt.h"
static void __init microwatt_init_IRQ(void)
{
xics_init();
}
static int __init microwatt_populate(void)
{
return of_platform_default_populate(NULL, NULL, NULL);
}
machine_arch_initcall(microwatt, microwatt_populate);
static int __init microwatt_probe(void)
{
/* Main reason for having this is to start the other CPU(s) */
if (IS_ENABLED(CONFIG_SMP))
microwatt_init_smp();
return 1;
}
static void __init microwatt_setup_arch(void)
{
microwatt_rng_init();
}
static void microwatt_idle(void)
{
if (!prep_irq_for_idle_irqsoff())
return;
__asm__ __volatile__ ("wait");
}
define_machine(microwatt) {
.name = "microwatt",
.compatible = "microwatt-soc",
.probe = microwatt_probe,
.init_IRQ = microwatt_init_IRQ,
.setup_arch = microwatt_setup_arch,
.progress = udbg_progress,
.power_save = microwatt_idle,
};