Skip to contentSkip to conversation

SPARC32: Implemented SMP IPIs for LEON CPU

PATCH Superseded Daniel Hellstrom 1 participant 1 message Jan 26, 2011 SPARC + UltraSPARC (sparc/sparc64)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 2/2 SPARC32: Implemented SMP IPIs for LEON CPU

This patch implements SMP IPIs on LEON using software generated IRQs to signal between CPUs.

---
 arch/sparc/include/asm/leon.h   |    6 +++-
 arch/sparc/kernel/entry.S       |   16 ++++++++
 arch/sparc/kernel/leon_kernel.c |    5 +++
 arch/sparc/kernel/leon_smp.c    |   77 ++++++++++++++++++++++++++++++++++++++-
 arch/sparc/kernel/smp_32.c      |    9 +++++
 5 files changed, 110 insertions(+), 3 deletions(-)
arch/sparc/include/asm/leon.h +5 -1
index 8580d17..93833f1 100644
@@ -239,7 +239,7 @@ static inline int sparc_leon3_cpuid(void)
 #endif /*!__ASSEMBLY__*/
 
 #ifdef CONFIG_SMP
-# define LEON3_IRQ_RESCHEDULE		13
+# define LEON3_IRQ_IPI			13
 # define LEON3_IRQ_TICKER		(leon_percpu_timer_dev[0].irq)
 # define LEON3_IRQ_CROSS_CALL		15
 #endif
@@ -366,6 +366,9 @@ extern void leon_smp_done(void);
 extern void leon_boot_cpus(void);
 extern int leon_boot_one_cpu(int i);
 void leon_init_smp(void);
+extern void leon_send_call_function_ipi_mask(const struct cpumask *mask);
+extern void leon_send_call_function_single_ipi(int cpu);
+extern void leon_send_resched(int cpu);
 extern void cpu_probe(void);
 extern void cpu_idle(void);
 extern void init_IRQ(void);
@@ -374,6 +377,7 @@ extern int __leon_processor_id(void);
 void leon_enable_irq_cpu(unsigned int irq_nr, unsigned int cpu);
 
 extern unsigned int real_irq_entry[], smpleon_ticker[];
+extern unsigned int smpleon_ipi[];
 extern unsigned int patchme_maybe_smp_msg[];
 extern unsigned long trapbase_cpu1[];
 extern unsigned long trapbase_cpu2[];
arch/sparc/kernel/entry.S +16 -0
index 1504df8..666344d 100644
@@ -417,6 +417,22 @@ smpleon_ticker:
 	WRITE_PAUSE
 	RESTORE_ALL
 
+	.globl	smpleon_ipi
+	.extern leon_ipi_interrupt
+	/* SMP per-cpu IPI interrupts are handled specially. */
+smpleon_ipi:
+        SAVE_ALL
+	or	%l0, PSR_PIL, %g2
+	wr	%g2, 0x0, %psr
+	WRITE_PAUSE
+	wr	%g2, PSR_ET, %psr
+	WRITE_PAUSE
+	call	leonsmp_ipi_interrupt
+	 add	%sp, STACKFRAME_SZ, %o1 ! pt_regs
+	wr	%l0, PSR_ET, %psr
+	WRITE_PAUSE
+	RESTORE_ALL
+
 	.align	4
 	.globl	linux_trap_ipi15_leon
 linux_trap_ipi15_leon:
arch/sparc/kernel/leon_kernel.c +5 -0
index ef5edbb..87812dd 100644
@@ -245,6 +245,11 @@ void __init leon_init_timers(irq_handler_t counter_fn)
 		/* Adjust so that we jump directly to smpleon_ticker */
 		trap_table->inst_three += smpleon_ticker - real_irq_entry;
 
+		/* Adjust so that we jump directly to smpleon_ipi */
+		trap_table = &sparc_ttable[SP_TRAP_IRQ1 +
+						(LEON3_IRQ_IPI - 1)];
+		trap_table->inst_three += smpleon_ipi - real_irq_entry;
+
 		local_flush_cache_all();
 		local_irq_restore(flags);
 	}
arch/sparc/kernel/leon_smp.c +75 -2

95 lines not on this page · raw message

arch/sparc/kernel/smp_32.c +9 -0
index a1bb3a8..bd9da00 100644
@@ -131,6 +131,9 @@ void smp_send_reschedule(int cpu)
 	 * to call schedule.
 	 */
 	switch (sparc_cpu_model) {
+	case sparc_leon:
+		leon_send_resched(cpu);
+		break;
 	default:
 		BUG();
 	}
@@ -147,6 +150,9 @@ void arch_send_call_function_single_ipi(int cpu)
 	 * a single CPU
 	 */
 	switch (sparc_cpu_model) {
+	case sparc_leon:
+		leon_send_call_function_single_ipi(cpu);
+		break;
 	default:
 		BUG();
 	}
@@ -159,6 +165,9 @@ void arch_send_call_function_ipi_mask(const struct cpumask *mask)
 	 * a set of CPUs
 	 */
 	switch (sparc_cpu_model) {
+	case sparc_leon:
+		leon_send_call_function_ipi_mask(mask);
+		break;
 	default:
 		BUG();
 	}
Signature · 1 line
1.5.4