GNU Linux-libre 4.19.286-gnu1
[releases.git] / arch / riscv / include / asm / smp.h
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 setup_smp(void);
29
30 /* Hook for the generic smp_call_function_many() routine. */
31 void arch_send_call_function_ipi_mask(struct cpumask *mask);
32
33 /* Hook for the generic smp_call_function_single() routine. */
34 void arch_send_call_function_single_ipi(int cpu);
35
36 /*
37  * This is particularly ugly: it appears we can't actually get the definition
38  * of task_struct here, but we need access to the CPU this task is running on.
39  * Instead of using C we're using asm-offsets.h to get the current processor
40  * ID.
41  */
42 #define raw_smp_processor_id() (*((int*)((char*)get_current() + TASK_TI_CPU)))
43
44 #endif /* CONFIG_SMP */
45
46 #endif /* _ASM_RISCV_SMP_H */