| .. | .. |
|---|
| 1 | +/* SPDX-License-Identifier: GPL-2.0-only */ |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * Copyright (C) 2012 ARM Ltd. |
|---|
| 3 | | - * |
|---|
| 4 | | - * This program is free software; you can redistribute it and/or modify |
|---|
| 5 | | - * it under the terms of the GNU General Public License version 2 as |
|---|
| 6 | | - * published by the Free Software Foundation. |
|---|
| 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 | | - * You should have received a copy of the GNU General Public License |
|---|
| 14 | | - * along with this program. If not, see <http://www.gnu.org/licenses/>. |
|---|
| 15 | 4 | */ |
|---|
| 16 | 5 | #ifndef __ASM_SMP_H |
|---|
| 17 | 6 | #define __ASM_SMP_H |
|---|
| 18 | 7 | |
|---|
| 19 | | -/* Values for secondary_data.status */ |
|---|
| 8 | +#include <linux/const.h> |
|---|
| 20 | 9 | |
|---|
| 21 | | -#define CPU_MMU_OFF (-1) |
|---|
| 22 | | -#define CPU_BOOT_SUCCESS (0) |
|---|
| 10 | +/* Values for secondary_data.status */ |
|---|
| 11 | +#define CPU_STUCK_REASON_SHIFT (8) |
|---|
| 12 | +#define CPU_BOOT_STATUS_MASK ((UL(1) << CPU_STUCK_REASON_SHIFT) - 1) |
|---|
| 13 | + |
|---|
| 14 | +#define CPU_MMU_OFF (-1) |
|---|
| 15 | +#define CPU_BOOT_SUCCESS (0) |
|---|
| 23 | 16 | /* The cpu invoked ops->cpu_die, synchronise it with cpu_kill */ |
|---|
| 24 | | -#define CPU_KILL_ME (1) |
|---|
| 17 | +#define CPU_KILL_ME (1) |
|---|
| 25 | 18 | /* The cpu couldn't die gracefully and is looping in the kernel */ |
|---|
| 26 | | -#define CPU_STUCK_IN_KERNEL (2) |
|---|
| 19 | +#define CPU_STUCK_IN_KERNEL (2) |
|---|
| 27 | 20 | /* Fatal system error detected by secondary CPU, crash the system */ |
|---|
| 28 | | -#define CPU_PANIC_KERNEL (3) |
|---|
| 21 | +#define CPU_PANIC_KERNEL (3) |
|---|
| 22 | + |
|---|
| 23 | +#define CPU_STUCK_REASON_52_BIT_VA (UL(1) << CPU_STUCK_REASON_SHIFT) |
|---|
| 24 | +#define CPU_STUCK_REASON_NO_GRAN (UL(2) << CPU_STUCK_REASON_SHIFT) |
|---|
| 29 | 25 | |
|---|
| 30 | 26 | #ifndef __ASSEMBLY__ |
|---|
| 31 | 27 | |
|---|
| .. | .. |
|---|
| 46 | 42 | */ |
|---|
| 47 | 43 | #define raw_smp_processor_id() (*raw_cpu_ptr(&cpu_number)) |
|---|
| 48 | 44 | |
|---|
| 45 | +/* |
|---|
| 46 | + * Logical CPU mapping. |
|---|
| 47 | + */ |
|---|
| 48 | +extern u64 __cpu_logical_map[NR_CPUS]; |
|---|
| 49 | +extern u64 cpu_logical_map(unsigned int cpu); |
|---|
| 50 | + |
|---|
| 51 | +static inline void set_cpu_logical_map(unsigned int cpu, u64 hwid) |
|---|
| 52 | +{ |
|---|
| 53 | + __cpu_logical_map[cpu] = hwid; |
|---|
| 54 | +} |
|---|
| 55 | + |
|---|
| 49 | 56 | struct seq_file; |
|---|
| 50 | | - |
|---|
| 51 | | -/* |
|---|
| 52 | | - * generate IPI list text |
|---|
| 53 | | - */ |
|---|
| 54 | | -extern void show_ipi_list(struct seq_file *p, int prec); |
|---|
| 55 | | - |
|---|
| 56 | | -/* |
|---|
| 57 | | - * Called from C code, this handles an IPI. |
|---|
| 58 | | - */ |
|---|
| 59 | | -extern void handle_IPI(int ipinr, struct pt_regs *regs); |
|---|
| 60 | 57 | |
|---|
| 61 | 58 | /* |
|---|
| 62 | 59 | * Discover the set of possible CPUs and determine their |
|---|
| .. | .. |
|---|
| 65 | 62 | extern void smp_init_cpus(void); |
|---|
| 66 | 63 | |
|---|
| 67 | 64 | /* |
|---|
| 68 | | - * Provide a function to raise an IPI cross call on CPUs in callmap. |
|---|
| 65 | + * Register IPI interrupts with the arch SMP code |
|---|
| 69 | 66 | */ |
|---|
| 70 | | -extern void set_smp_cross_call(void (*)(const struct cpumask *, unsigned int)); |
|---|
| 71 | | - |
|---|
| 72 | | -extern void (*__smp_cross_call)(const struct cpumask *, unsigned int); |
|---|
| 73 | | - |
|---|
| 74 | | -/* |
|---|
| 75 | | - * Provide a function to set a callback function pointer for updating the ipi |
|---|
| 76 | | - * history. |
|---|
| 77 | | - */ |
|---|
| 78 | | -extern void set_update_ipi_history_callback(void (*fn)(int)); |
|---|
| 67 | +extern void set_smp_ipi_range(int ipi_base, int nr_ipi); |
|---|
| 79 | 68 | |
|---|
| 80 | 69 | /* |
|---|
| 81 | 70 | * Called from the secondary holding pen, this is the secondary CPU entry point. |
|---|
| .. | .. |
|---|
| 100 | 89 | |
|---|
| 101 | 90 | extern void arch_send_call_function_single_ipi(int cpu); |
|---|
| 102 | 91 | extern void arch_send_call_function_ipi_mask(const struct cpumask *mask); |
|---|
| 92 | +extern int nr_ipi_get(void); |
|---|
| 93 | +extern struct irq_desc **ipi_desc_get(void); |
|---|
| 103 | 94 | |
|---|
| 104 | 95 | #ifdef CONFIG_ARM64_ACPI_PARKING_PROTOCOL |
|---|
| 105 | 96 | extern void arch_send_wakeup_ipi_mask(const struct cpumask *mask); |
|---|