1 /* 2 * Copyright (C) 2012 Regents of the University of California 3 * 4 * This program is free software; you can redistribute it and/or 5 * modify it under the terms of the GNU General Public License 6 * as published by the Free Software Foundation, version 2. 7 * 8 * This program is distributed in the hope that it will be useful, 9 * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 * GNU General Public License for more details. 12 */ 13 14 #ifndef _ASM_RISCV_SMP_H 15 #define _ASM_RISCV_SMP_H 16 17 /* This both needs asm-offsets.h and is used when generating it. */ 18 #ifndef GENERATING_ASM_OFFSETS 19 #include <asm/asm-offsets.h> 20 #endif 21 22 #include <linux/cpumask.h> 23 #include <linux/irqreturn.h> 24 25 #ifdef CONFIG_SMP 26 27 /* SMP initialization hook for setup_arch */ 28 void __init init_clockevent(void); 29 30 /* SMP initialization hook for setup_arch */ 31 void __init setup_smp(void); 32 33 /* Hook for the generic smp_call_function_many() routine. */ 34 void arch_send_call_function_ipi_mask(struct cpumask *mask); 35 36 /* Hook for the generic smp_call_function_single() routine. */ 37 void arch_send_call_function_single_ipi(int cpu); 38 39 /* 40 * This is particularly ugly: it appears we can't actually get the definition 41 * of task_struct here, but we need access to the CPU this task is running on. 42 * Instead of using C we're using asm-offsets.h to get the current processor 43 * ID. 44 */ 45 #define raw_smp_processor_id() (*((int*)((char*)get_current() + TASK_TI_CPU))) 46 47 /* Interprocessor interrupt handler */ 48 irqreturn_t handle_ipi(void); 49 50 #endif /* CONFIG_SMP */ 51 52 #endif /* _ASM_RISCV_SMP_H */ 53