1b2441318SGreg Kroah-Hartman // SPDX-License-Identifier: GPL-2.0 2bbd0abdaSPaul Mackerras /* 3bbd0abdaSPaul Mackerras * Smp support for CHRP machines. 4bbd0abdaSPaul Mackerras * 5bbd0abdaSPaul Mackerras * Written by Cort Dougan (cort@cs.nmt.edu) borrowing a great 6bbd0abdaSPaul Mackerras * deal of code from the sparc and intel versions. 7bbd0abdaSPaul Mackerras * 8bbd0abdaSPaul Mackerras * Copyright (C) 1999 Cort Dougan <cort@cs.nmt.edu> 9bbd0abdaSPaul Mackerras * 10bbd0abdaSPaul Mackerras */ 11bbd0abdaSPaul Mackerras 12bbd0abdaSPaul Mackerras #include <linux/kernel.h> 13bbd0abdaSPaul Mackerras #include <linux/sched.h> 14bbd0abdaSPaul Mackerras #include <linux/smp.h> 15bbd0abdaSPaul Mackerras #include <linux/interrupt.h> 16bbd0abdaSPaul Mackerras #include <linux/kernel_stat.h> 17bbd0abdaSPaul Mackerras #include <linux/delay.h> 18bbd0abdaSPaul Mackerras #include <linux/spinlock.h> 19*65fddcfcSMike Rapoport #include <linux/pgtable.h> 20bbd0abdaSPaul Mackerras 21bbd0abdaSPaul Mackerras #include <asm/ptrace.h> 2260063497SArun Sharma #include <linux/atomic.h> 23bbd0abdaSPaul Mackerras #include <asm/irq.h> 24bbd0abdaSPaul Mackerras #include <asm/page.h> 25bbd0abdaSPaul Mackerras #include <asm/sections.h> 26bbd0abdaSPaul Mackerras #include <asm/io.h> 27bbd0abdaSPaul Mackerras #include <asm/smp.h> 28bbd0abdaSPaul Mackerras #include <asm/machdep.h> 2980579e1fSPaul Mackerras #include <asm/mpic.h> 3044aedfe7SPaul Mackerras #include <asm/rtas.h> 31bbd0abdaSPaul Mackerras smp_chrp_kick_cpu(int nr)32cad5cef6SGreg Kroah-Hartmanstatic int smp_chrp_kick_cpu(int nr) 33bbd0abdaSPaul Mackerras { 34bbd0abdaSPaul Mackerras *(unsigned long *)KERNELBASE = nr; 35bbd0abdaSPaul Mackerras asm volatile("dcbf 0,%0"::"r"(KERNELBASE):"memory"); 36de300974SMichael Ellerman 37de300974SMichael Ellerman return 0; 38bbd0abdaSPaul Mackerras } 39bbd0abdaSPaul Mackerras smp_chrp_setup_cpu(int cpu_nr)40cad5cef6SGreg Kroah-Hartmanstatic void smp_chrp_setup_cpu(int cpu_nr) 41bbd0abdaSPaul Mackerras { 4280579e1fSPaul Mackerras mpic_setup_this_cpu(); 43bbd0abdaSPaul Mackerras } 44bbd0abdaSPaul Mackerras 45bbd0abdaSPaul Mackerras /* CHRP with openpic */ 46bbd0abdaSPaul Mackerras struct smp_ops_t chrp_smp_ops = { 47c64af645SNicholas Piggin .cause_nmi_ipi = NULL, 4880579e1fSPaul Mackerras .message_pass = smp_mpic_message_pass, 495ad57078SPaul Mackerras .probe = smp_mpic_probe, 50bbd0abdaSPaul Mackerras .kick_cpu = smp_chrp_kick_cpu, 51bbd0abdaSPaul Mackerras .setup_cpu = smp_chrp_setup_cpu, 52c4007a2fSBenjamin Herrenschmidt .give_timebase = rtas_give_timebase, 53c4007a2fSBenjamin Herrenschmidt .take_timebase = rtas_take_timebase, 54bbd0abdaSPaul Mackerras }; 55