xref: /linux/arch/powerpc/platforms/chrp/smp.c (revision 8e07e0e3964ca4e23ce7b68e2096fe660a888942)
1 // SPDX-License-Identifier: GPL-2.0
2 /*
3  * Smp support for CHRP machines.
4  *
5  * Written by Cort Dougan (cort@cs.nmt.edu) borrowing a great
6  * deal of code from the sparc and intel versions.
7  *
8  * Copyright (C) 1999 Cort Dougan <cort@cs.nmt.edu>
9  *
10  */
11 
12 #include <linux/kernel.h>
13 #include <linux/sched.h>
14 #include <linux/smp.h>
15 #include <linux/interrupt.h>
16 #include <linux/kernel_stat.h>
17 #include <linux/delay.h>
18 #include <linux/spinlock.h>
19 #include <linux/pgtable.h>
20 
21 #include <asm/ptrace.h>
22 #include <linux/atomic.h>
23 #include <asm/irq.h>
24 #include <asm/page.h>
25 #include <asm/sections.h>
26 #include <asm/io.h>
27 #include <asm/smp.h>
28 #include <asm/machdep.h>
29 #include <asm/mpic.h>
30 #include <asm/rtas.h>
31 
32 static int smp_chrp_kick_cpu(int nr)
33 {
34 	*(unsigned long *)KERNELBASE = nr;
35 	asm volatile("dcbf 0,%0"::"r"(KERNELBASE):"memory");
36 
37 	return 0;
38 }
39 
40 static void smp_chrp_setup_cpu(int cpu_nr)
41 {
42 	mpic_setup_this_cpu();
43 }
44 
45 /* CHRP with openpic */
46 struct smp_ops_t chrp_smp_ops = {
47 	.cause_nmi_ipi = NULL,
48 	.message_pass = smp_mpic_message_pass,
49 	.probe = smp_mpic_probe,
50 	.kick_cpu = smp_chrp_kick_cpu,
51 	.setup_cpu = smp_chrp_setup_cpu,
52 	.give_timebase = rtas_give_timebase,
53 	.take_timebase = rtas_take_timebase,
54 };
55