* [PATCH v2 0/5] Microwatt updates
@ 2025-01-31 6:26 Paul Mackerras
2025-01-31 6:27 ` [PATCH v2 1/5] powerpc/microwatt: Select COMMON_CLK in order to get the clock framework Paul Mackerras
` (5 more replies)
0 siblings, 6 replies; 7+ messages in thread
From: Paul Mackerras @ 2025-01-31 6:26 UTC (permalink / raw)
To: linuxppc-dev
This patch series updates the kernel support for the Microwatt
soft-core and its implementation on FPGA systems, particularly the
Digilent Arty A7-100 FPGA development board.
Microwatt now supports almost all of the features of the SFFS (Scalar
Fixed-point and Floating-point Subset) compliancy subset of Power ISA
version 3.1C, including prefixed instructions and the fixed-point hash
(ROP mitigation) instructions. It is also now SMP-capable, and a
dual-core system will fit on the Arty A7-100 board.
Microwatt does not have broadcast TLB invalidations in SMP systems;
the kernel already has code to deal with this. One of the patches in
this series provides a config option to allow platforms to select
unconditionally the behaviour where cross-CPU TLB invalidations are
handled using inter-processor interrupts.
Tested on an Arty A7-100 FPGA board with 2 CPUs. Compile-tested for
pseries and powernv.
Paul.
---
v2: Address review comments
arch/powerpc/boot/dts/microwatt.dts | 107 +++++++++++++++++++++++----
arch/powerpc/mm/book3s64/pgtable.c | 4 +-
arch/powerpc/platforms/Kconfig.cputype | 13 ++++
arch/powerpc/platforms/microwatt/Kconfig | 3 +-
arch/powerpc/platforms/microwatt/Makefile | 1 +
arch/powerpc/platforms/microwatt/microwatt.h | 1 +
arch/powerpc/platforms/microwatt/setup.c | 18 +++++
arch/powerpc/platforms/microwatt/smp.c | 80 ++++++++++++++++++++
arch/powerpc/platforms/powernv/Kconfig | 1 +
arch/powerpc/platforms/pseries/Kconfig | 1 +
10 files changed, 213 insertions(+), 16 deletions(-)
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH v2 1/5] powerpc/microwatt: Select COMMON_CLK in order to get the clock framework
2025-01-31 6:26 [PATCH v2 0/5] Microwatt updates Paul Mackerras
@ 2025-01-31 6:27 ` Paul Mackerras
2025-01-31 6:28 ` [PATCH v2 2/5] powerpc/microwatt: Device-tree updates Paul Mackerras
` (4 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: Paul Mackerras @ 2025-01-31 6:27 UTC (permalink / raw)
To: linuxppc-dev
This is to allow us to select Litex MMC host controller driver, which
drives the litesdcard gateware.
Signed-off-by: Paul Mackerras <paulus@ozlabs.org>
Acked-by: Nicholas Piggin <npiggin@gmail.com>
---
arch/powerpc/platforms/microwatt/Kconfig | 1 +
1 file changed, 1 insertion(+)
diff --git a/arch/powerpc/platforms/microwatt/Kconfig b/arch/powerpc/platforms/microwatt/Kconfig
index 6af443a1db99..5e41adadac1f 100644
--- a/arch/powerpc/platforms/microwatt/Kconfig
+++ b/arch/powerpc/platforms/microwatt/Kconfig
@@ -6,6 +6,7 @@ config PPC_MICROWATT
select PPC_ICS_NATIVE
select PPC_ICP_NATIVE
select PPC_UDBG_16550
+ select COMMON_CLK
help
This option enables support for FPGA-based Microwatt implementations.
--
2.47.1
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH v2 2/5] powerpc/microwatt: Device-tree updates
2025-01-31 6:26 [PATCH v2 0/5] Microwatt updates Paul Mackerras
2025-01-31 6:27 ` [PATCH v2 1/5] powerpc/microwatt: Select COMMON_CLK in order to get the clock framework Paul Mackerras
@ 2025-01-31 6:28 ` Paul Mackerras
2025-01-31 6:28 ` [PATCH v2 3/5] powerpc/microwatt: Define an idle power-save function Paul Mackerras
` (3 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: Paul Mackerras @ 2025-01-31 6:28 UTC (permalink / raw)
To: linuxppc-dev
Microwatt now implements ISA v3.1 (SFFS compliancy subset), including
prefixed instructions, scv/rfscv, and the FSCR, HFSCR, TAR, and CTRL
registers. The privileged mode of operation is now hypervisor mode
and there is no privileged non-hypervisor mode; the MSR[HV] bit is
forced to 1.
Besides updating the ibm,powerpc-cpu-features property to reflect the
above, this also makes the following changes relating to peripheral
devices:
- Add gpio controller.
- Remove high-speed property from SD controller, for the case where
the interface is connected through 200 ohm protection resisters.
- Put an alias for the ethernet in /chosen.
Signed-off-by: Paul Mackerras <paulus@ozlabs.org>
Acked-by: Nicholas Piggin <npiggin@gmail.com>
---
v2: scv node specifies ISA v3.0
arch/powerpc/boot/dts/microwatt.dts | 73 ++++++++++++++++++++++++-----
1 file changed, 62 insertions(+), 11 deletions(-)
diff --git a/arch/powerpc/boot/dts/microwatt.dts b/arch/powerpc/boot/dts/microwatt.dts
index 269e930b3b0b..833d22822189 100644
--- a/arch/powerpc/boot/dts/microwatt.dts
+++ b/arch/powerpc/boot/dts/microwatt.dts
@@ -1,4 +1,5 @@
/dts-v1/;
+#include <dt-bindings/gpio/gpio.h>
/ {
#size-cells = <0x02>;
@@ -8,6 +9,7 @@ / {
aliases {
serial0 = &UART0;
+ ethernet = &enet0;
};
reserved-memory {
@@ -35,40 +37,79 @@ cpus {
ibm,powerpc-cpu-features {
display-name = "Microwatt";
- isa = <3000>;
+ isa = <3010>;
device_type = "cpu-features";
compatible = "ibm,powerpc-cpu-features";
mmu-radix {
isa = <3000>;
- usable-privilege = <2>;
+ usable-privilege = <6>;
+ os-support = <0>;
};
little-endian {
- isa = <2050>;
- usable-privilege = <3>;
+ isa = <0>;
+ usable-privilege = <7>;
+ os-support = <0>;
hwcap-bit-nr = <1>;
};
cache-inhibited-large-page {
- isa = <2040>;
- usable-privilege = <2>;
+ isa = <0>;
+ usable-privilege = <6>;
+ os-support = <0>;
};
fixed-point-v3 {
isa = <3000>;
- usable-privilege = <3>;
+ usable-privilege = <7>;
};
no-execute {
- isa = <2010>;
+ isa = <0x00>;
usable-privilege = <2>;
+ os-support = <0>;
};
floating-point {
+ hfscr-bit-nr = <0>;
hwcap-bit-nr = <27>;
isa = <0>;
- usable-privilege = <3>;
+ usable-privilege = <7>;
+ hv-support = <1>;
+ os-support = <0>;
+ };
+
+ prefixed-instructions {
+ hfscr-bit-nr = <13>;
+ fscr-bit-nr = <13>;
+ isa = <3010>;
+ usable-privilege = <7>;
+ os-support = <1>;
+ hv-support = <1>;
+ };
+
+ tar {
+ hfscr-bit-nr = <8>;
+ fscr-bit-nr = <8>;
+ isa = <2070>;
+ usable-privilege = <7>;
+ os-support = <1>;
+ hv-support = <1>;
+ hwcap-bit-nr = <58>;
+ };
+
+ control-register {
+ isa = <0>;
+ usable-privilege = <7>;
+ };
+
+ system-call-vectored {
+ isa = <3000>;
+ usable-privilege = <7>;
+ os-support = <1>;
+ fscr-bit-nr = <12>;
+ hwcap-bit-nr = <52>;
};
};
@@ -138,7 +179,18 @@ UART0: serial@2000 {
interrupts = <0x10 0x1>;
};
- ethernet@8020000 {
+ gpio: gpio@7000 {
+ device_type = "gpio";
+ compatible = "faraday,ftgpio010";
+ gpio-controller;
+ #gpio-cells = <2>;
+ reg = <0x7000 0x80>;
+ interrupts = <0x14 1>;
+ interrupt-controller;
+ #interrupt-cells = <2>;
+ };
+
+ enet0: ethernet@8020000 {
compatible = "litex,liteeth";
reg = <0x8021000 0x100
0x8020800 0x100
@@ -160,7 +212,6 @@ mmc@8040000 {
reg-names = "phy", "core", "reader", "writer", "irq";
bus-width = <4>;
interrupts = <0x13 1>;
- cap-sd-highspeed;
clocks = <&sys_clk>;
};
};
--
2.47.1
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH v2 3/5] powerpc/microwatt: Define an idle power-save function
2025-01-31 6:26 [PATCH v2 0/5] Microwatt updates Paul Mackerras
2025-01-31 6:27 ` [PATCH v2 1/5] powerpc/microwatt: Select COMMON_CLK in order to get the clock framework Paul Mackerras
2025-01-31 6:28 ` [PATCH v2 2/5] powerpc/microwatt: Device-tree updates Paul Mackerras
@ 2025-01-31 6:28 ` Paul Mackerras
2025-01-31 6:29 ` [PATCH v2 4/5] powerpc: Define config option for processors with broadcast TLBIE Paul Mackerras
` (2 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: Paul Mackerras @ 2025-01-31 6:28 UTC (permalink / raw)
To: linuxppc-dev
This uses the 'wait' instruction to pause instruction execution when
idle until an interrupt occurs.
Signed-off-by: Paul Mackerras <paulus@ozlabs.org>
---
v2: Use prep_irq_for_idle_irqsoff()
arch/powerpc/platforms/microwatt/setup.c | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/arch/powerpc/platforms/microwatt/setup.c b/arch/powerpc/platforms/microwatt/setup.c
index 5e1c0997170d..a942c446aeab 100644
--- a/arch/powerpc/platforms/microwatt/setup.c
+++ b/arch/powerpc/platforms/microwatt/setup.c
@@ -34,10 +34,19 @@ 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",
.init_IRQ = microwatt_init_IRQ,
.setup_arch = microwatt_setup_arch,
.progress = udbg_progress,
+ .power_save = microwatt_idle,
};
--
2.47.1
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH v2 4/5] powerpc: Define config option for processors with broadcast TLBIE
2025-01-31 6:26 [PATCH v2 0/5] Microwatt updates Paul Mackerras
` (2 preceding siblings ...)
2025-01-31 6:28 ` [PATCH v2 3/5] powerpc/microwatt: Define an idle power-save function Paul Mackerras
@ 2025-01-31 6:29 ` Paul Mackerras
2025-01-31 6:30 ` [PATCH v2 5/5] powerpc/microwatt: Add SMP support Paul Mackerras
2025-03-02 4:40 ` [PATCH v2 0/5] Microwatt updates Madhavan Srinivasan
5 siblings, 0 replies; 7+ messages in thread
From: Paul Mackerras @ 2025-01-31 6:29 UTC (permalink / raw)
To: linuxppc-dev
Power ISA v3.0 (and later) implementations in the Linux Compliancy
Subset and lower are not required to implement broadcast TLBIE, and in
fact Microwatt doesn't.
To avoid the need to specify "disable_tlbie" on the kernel command
line on SMP Microwatt systems, this defines a config option that
asserts that the platform implements broadcast TLBIE. This option is
selected by the pseries and powernv platforms, but not by microwatt.
Note that this option is only relevant when the radix MMU is being
used, so platforms without a radix MMU don't need it.
Signed-off-by: Paul Mackerras <paulus@ozlabs.org>
---
v2: Made the option positive (has broadcast) rather than negative
arch/powerpc/mm/book3s64/pgtable.c | 4 ++--
arch/powerpc/platforms/Kconfig.cputype | 13 +++++++++++++
arch/powerpc/platforms/powernv/Kconfig | 1 +
arch/powerpc/platforms/pseries/Kconfig | 1 +
4 files changed, 17 insertions(+), 2 deletions(-)
diff --git a/arch/powerpc/mm/book3s64/pgtable.c b/arch/powerpc/mm/book3s64/pgtable.c
index 374542528080..da0bba29a9d7 100644
--- a/arch/powerpc/mm/book3s64/pgtable.c
+++ b/arch/powerpc/mm/book3s64/pgtable.c
@@ -591,7 +591,7 @@ int pmd_move_must_withdraw(struct spinlock *new_pmd_ptl,
/*
* Does the CPU support tlbie?
*/
-bool tlbie_capable __read_mostly = true;
+bool tlbie_capable __read_mostly = IS_ENABLED(CONFIG_PPC_RADIX_BROADCAST_TLBIE);
EXPORT_SYMBOL(tlbie_capable);
/*
@@ -599,7 +599,7 @@ EXPORT_SYMBOL(tlbie_capable);
* address spaces? tlbie may still be used for nMMU accelerators, and for KVM
* guest address spaces.
*/
-bool tlbie_enabled __read_mostly = true;
+bool tlbie_enabled __read_mostly = IS_ENABLED(CONFIG_PPC_RADIX_BROADCAST_TLBIE);
static int __init setup_disable_tlbie(char *str)
{
diff --git a/arch/powerpc/platforms/Kconfig.cputype b/arch/powerpc/platforms/Kconfig.cputype
index 1453ccc900c4..613b383ed8b3 100644
--- a/arch/powerpc/platforms/Kconfig.cputype
+++ b/arch/powerpc/platforms/Kconfig.cputype
@@ -449,6 +449,19 @@ config PPC_RADIX_MMU_DEFAULT
If you're unsure, say Y.
+config PPC_RADIX_BROADCAST_TLBIE
+ bool
+ depends on PPC_RADIX_MMU
+ help
+ Power ISA v3.0 and later implementations in the Linux Compliancy Subset
+ and lower are not required to implement broadcast TLBIE instructions.
+ Platforms with CPUs that do implement TLBIE broadcast, that is, where
+ a TLB invalidation instruction performed on one CPU operates on the
+ TLBs of all CPUs in the system, should select this option. If this
+ option is selected, the disable_tlbie kernel command line option can
+ be used to cause global TLB invalidations to be done via IPIs; without
+ it, IPIs will be used unconditionally.
+
config PPC_KERNEL_PREFIXED
depends on PPC_HAVE_PREFIXED_SUPPORT
depends on CC_HAS_PREFIXED
diff --git a/arch/powerpc/platforms/powernv/Kconfig b/arch/powerpc/platforms/powernv/Kconfig
index 70a46acc70d6..3fbe0295ce14 100644
--- a/arch/powerpc/platforms/powernv/Kconfig
+++ b/arch/powerpc/platforms/powernv/Kconfig
@@ -17,6 +17,7 @@ config PPC_POWERNV
select MMU_NOTIFIER
select FORCE_SMP
select ARCH_SUPPORTS_PER_VMA_LOCK
+ select PPC_RADIX_BROADCAST_TLBIE
default y
config OPAL_PRD
diff --git a/arch/powerpc/platforms/pseries/Kconfig b/arch/powerpc/platforms/pseries/Kconfig
index 42fc66e97539..206dfa0a3b33 100644
--- a/arch/powerpc/platforms/pseries/Kconfig
+++ b/arch/powerpc/platforms/pseries/Kconfig
@@ -23,6 +23,7 @@ config PPC_PSERIES
select FORCE_SMP
select SWIOTLB
select ARCH_SUPPORTS_PER_VMA_LOCK
+ select PPC_RADIX_BROADCAST_TLBIE
default y
config PARAVIRT
--
2.47.1
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH v2 5/5] powerpc/microwatt: Add SMP support
2025-01-31 6:26 [PATCH v2 0/5] Microwatt updates Paul Mackerras
` (3 preceding siblings ...)
2025-01-31 6:29 ` [PATCH v2 4/5] powerpc: Define config option for processors with broadcast TLBIE Paul Mackerras
@ 2025-01-31 6:30 ` Paul Mackerras
2025-03-02 4:40 ` [PATCH v2 0/5] Microwatt updates Madhavan Srinivasan
5 siblings, 0 replies; 7+ messages in thread
From: Paul Mackerras @ 2025-01-31 6:30 UTC (permalink / raw)
To: linuxppc-dev
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>
---
v2: Addressed review comments
- use IS_ENABLED()
- define and use SYSCON_LENGTH
- use PPC_RAW_MFSPR and PPC_RAW_BRANCH
arch/powerpc/boot/dts/microwatt.dts | 34 ++++++++-
arch/powerpc/platforms/microwatt/Kconfig | 2 +-
arch/powerpc/platforms/microwatt/Makefile | 1 +
arch/powerpc/platforms/microwatt/microwatt.h | 1 +
arch/powerpc/platforms/microwatt/setup.c | 9 +++
arch/powerpc/platforms/microwatt/smp.c | 80 ++++++++++++++++++++
6 files changed, 124 insertions(+), 3 deletions(-)
create mode 100644 arch/powerpc/platforms/microwatt/smp.c
diff --git a/arch/powerpc/boot/dts/microwatt.dts b/arch/powerpc/boot/dts/microwatt.dts
index 833d22822189..c4e4d2a9b460 100644
--- a/arch/powerpc/boot/dts/microwatt.dts
+++ b/arch/powerpc/boot/dts/microwatt.dts
@@ -142,6 +142,36 @@ PowerPC,Microwatt@0 {
ibm,mmu-lpid-bits = <12>;
ibm,mmu-pid-bits = <20>;
};
+
+ PowerPC,Microwatt@1 {
+ i-cache-sets = <2>;
+ ibm,dec-bits = <64>;
+ reservation-granule-size = <64>;
+ clock-frequency = <100000000>;
+ timebase-frequency = <100000000>;
+ i-tlb-sets = <1>;
+ ibm,ppc-interrupt-server#s = <1>;
+ i-cache-block-size = <64>;
+ d-cache-block-size = <64>;
+ d-cache-sets = <2>;
+ i-tlb-size = <64>;
+ cpu-version = <0x990000>;
+ status = "okay";
+ i-cache-size = <0x1000>;
+ ibm,processor-radix-AP-encodings = <0x0c 0xa0000010 0x20000015 0x4000001e>;
+ tlb-size = <0>;
+ tlb-sets = <0>;
+ device_type = "cpu";
+ d-tlb-size = <128>;
+ d-tlb-sets = <2>;
+ reg = <1>;
+ general-purpose;
+ 64-bit;
+ d-cache-size = <0x1000>;
+ ibm,chip-id = <0>;
+ ibm,mmu-lpid-bits = <12>;
+ ibm,mmu-pid-bits = <20>;
+ };
};
soc@c0000000 {
@@ -154,8 +184,8 @@ soc@c0000000 {
interrupt-controller@4000 {
compatible = "openpower,xics-presentation", "ibm,ppc-xicp";
- ibm,interrupt-server-ranges = <0x0 0x1>;
- reg = <0x4000 0x100>;
+ ibm,interrupt-server-ranges = <0x0 0x2>;
+ reg = <0x4000 0x10 0x4010 0x10>;
};
ICS: interrupt-controller@5000 {
diff --git a/arch/powerpc/platforms/microwatt/Kconfig b/arch/powerpc/platforms/microwatt/Kconfig
index 5e41adadac1f..cb2aff635bb0 100644
--- a/arch/powerpc/platforms/microwatt/Kconfig
+++ b/arch/powerpc/platforms/microwatt/Kconfig
@@ -1,6 +1,6 @@
# SPDX-License-Identifier: GPL-2.0
config PPC_MICROWATT
- depends on PPC_BOOK3S_64 && !SMP
+ depends on PPC_BOOK3S_64
bool "Microwatt SoC platform"
select PPC_XICS
select PPC_ICS_NATIVE
diff --git a/arch/powerpc/platforms/microwatt/Makefile b/arch/powerpc/platforms/microwatt/Makefile
index 116d6d3ad3f0..d973b2ab4042 100644
--- a/arch/powerpc/platforms/microwatt/Makefile
+++ b/arch/powerpc/platforms/microwatt/Makefile
@@ -1 +1,2 @@
obj-y += setup.o rng.o
+obj-$(CONFIG_SMP) += smp.o
diff --git a/arch/powerpc/platforms/microwatt/microwatt.h b/arch/powerpc/platforms/microwatt/microwatt.h
index 335417e95e66..891aa2800768 100644
--- a/arch/powerpc/platforms/microwatt/microwatt.h
+++ b/arch/powerpc/platforms/microwatt/microwatt.h
@@ -3,5 +3,6 @@
#define _MICROWATT_H
void microwatt_rng_init(void);
+void microwatt_init_smp(void);
#endif /* _MICROWATT_H */
diff --git a/arch/powerpc/platforms/microwatt/setup.c b/arch/powerpc/platforms/microwatt/setup.c
index a942c446aeab..6af2ccef736c 100644
--- a/arch/powerpc/platforms/microwatt/setup.c
+++ b/arch/powerpc/platforms/microwatt/setup.c
@@ -29,6 +29,14 @@ static int __init microwatt_populate(void)
}
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();
@@ -45,6 +53,7 @@ static void microwatt_idle(void)
define_machine(microwatt) {
.name = "microwatt",
.compatible = "microwatt-soc",
+ .probe = microwatt_probe,
.init_IRQ = microwatt_init_IRQ,
.setup_arch = microwatt_setup_arch,
.progress = udbg_progress,
diff --git a/arch/powerpc/platforms/microwatt/smp.c b/arch/powerpc/platforms/microwatt/smp.c
new file mode 100644
index 000000000000..7dbf2ca73d47
--- /dev/null
+++ b/arch/powerpc/platforms/microwatt/smp.c
@@ -0,0 +1,80 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
+
+/*
+ * SMP support functions for Microwatt
+ * Copyright 2025 Paul Mackerras <paulus@ozlabs.org>
+ */
+
+#include <linux/kernel.h>
+#include <linux/smp.h>
+#include <linux/io.h>
+#include <asm/early_ioremap.h>
+#include <asm/ppc-opcode.h>
+#include <asm/reg.h>
+#include <asm/smp.h>
+#include <asm/xics.h>
+
+#include "microwatt.h"
+
+static void __init microwatt_smp_probe(void)
+{
+ xics_smp_probe();
+}
+
+static void microwatt_smp_setup_cpu(int cpu)
+{
+ if (cpu != 0)
+ xics_setup_cpu();
+}
+
+static struct smp_ops_t microwatt_smp_ops = {
+ .probe = microwatt_smp_probe,
+ .message_pass = NULL, /* Use smp_muxed_ipi_message_pass */
+ .kick_cpu = smp_generic_kick_cpu,
+ .setup_cpu = microwatt_smp_setup_cpu,
+};
+
+/* XXX get from device tree */
+#define SYSCON_BASE 0xc0000000
+#define SYSCON_LENGTH 0x100
+
+#define SYSCON_CPU_CTRL 0x58
+
+void __init microwatt_init_smp(void)
+{
+ volatile unsigned char __iomem *syscon;
+ int ncpus;
+ int timeout;
+
+ syscon = early_ioremap(SYSCON_BASE, SYSCON_LENGTH);
+ if (syscon == NULL) {
+ pr_err("Failed to map SYSCON\n");
+ return;
+ }
+ ncpus = (readl(syscon + SYSCON_CPU_CTRL) >> 8) & 0xff;
+ if (ncpus < 2)
+ goto out;
+
+ smp_ops = µwatt_smp_ops;
+
+ /*
+ * Write two instructions at location 0:
+ * mfspr r3, PIR
+ * b __secondary_hold
+ */
+ *(unsigned int *)KERNELBASE = PPC_RAW_MFSPR(3, SPRN_PIR);
+ *(unsigned int *)(KERNELBASE+4) = PPC_RAW_BRANCH(&__secondary_hold - (char *)(KERNELBASE+4));
+
+ /* enable the other CPUs, they start at location 0 */
+ writel((1ul << ncpus) - 1, syscon + SYSCON_CPU_CTRL);
+
+ timeout = 10000;
+ while (!__secondary_hold_acknowledge) {
+ if (--timeout == 0)
+ break;
+ barrier();
+ }
+
+ out:
+ early_iounmap((void *)syscon, SYSCON_LENGTH);
+}
--
2.47.1
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH v2 0/5] Microwatt updates
2025-01-31 6:26 [PATCH v2 0/5] Microwatt updates Paul Mackerras
` (4 preceding siblings ...)
2025-01-31 6:30 ` [PATCH v2 5/5] powerpc/microwatt: Add SMP support Paul Mackerras
@ 2025-03-02 4:40 ` Madhavan Srinivasan
5 siblings, 0 replies; 7+ messages in thread
From: Madhavan Srinivasan @ 2025-03-02 4:40 UTC (permalink / raw)
To: linuxppc-dev, Paul Mackerras
On Fri, 31 Jan 2025 17:26:41 +1100, Paul Mackerras wrote:
> This patch series updates the kernel support for the Microwatt
> soft-core and its implementation on FPGA systems, particularly the
> Digilent Arty A7-100 FPGA development board.
>
> Microwatt now supports almost all of the features of the SFFS (Scalar
> Fixed-point and Floating-point Subset) compliancy subset of Power ISA
> version 3.1C, including prefixed instructions and the fixed-point hash
> (ROP mitigation) instructions. It is also now SMP-capable, and a
> dual-core system will fit on the Arty A7-100 board.
>
> [...]
Applied to powerpc/next.
[1/5] powerpc/microwatt: Select COMMON_CLK in order to get the clock framework
https://git.kernel.org/powerpc/c/81bb6490b78aab8cbfc2d0670f177233d2fa15f5
[2/5] powerpc/microwatt: Device-tree updates
https://git.kernel.org/powerpc/c/78099fe1e3b5b72d4627f360b59a3470b1547bad
[3/5] powerpc/microwatt: Define an idle power-save function
https://git.kernel.org/powerpc/c/2b0a438d5380c32817e1b2c883bd0494461e9f4f
[4/5] powerpc: Define config option for processors with broadcast TLBIE
https://git.kernel.org/powerpc/c/3d45a3d0d2e6b5cf47c6f0ab890f6ce762d9fd23
[5/5] powerpc/microwatt: Add SMP support
https://git.kernel.org/powerpc/c/aca95fb6bb572a77f39d42d83ab72a965026577d
Thanks
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2025-03-02 4:41 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-01-31 6:26 [PATCH v2 0/5] Microwatt updates Paul Mackerras
2025-01-31 6:27 ` [PATCH v2 1/5] powerpc/microwatt: Select COMMON_CLK in order to get the clock framework Paul Mackerras
2025-01-31 6:28 ` [PATCH v2 2/5] powerpc/microwatt: Device-tree updates Paul Mackerras
2025-01-31 6:28 ` [PATCH v2 3/5] powerpc/microwatt: Define an idle power-save function Paul Mackerras
2025-01-31 6:29 ` [PATCH v2 4/5] powerpc: Define config option for processors with broadcast TLBIE Paul Mackerras
2025-01-31 6:30 ` [PATCH v2 5/5] powerpc/microwatt: Add SMP support Paul Mackerras
2025-03-02 4:40 ` [PATCH v2 0/5] Microwatt updates Madhavan Srinivasan
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).