.. | .. |
---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-only |
---|
1 | 2 | /* |
---|
2 | 3 | * Based on arch/arm/kernel/irq.c |
---|
3 | 4 | * |
---|
.. | .. |
---|
7 | 8 | * Dynamic Tick Timer written by Tony Lindgren <tony@atomide.com> and |
---|
8 | 9 | * Tuukka Tikkanen <tuukka.tikkanen@elektrobit.com>. |
---|
9 | 10 | * Copyright (C) 2012 ARM Ltd. |
---|
10 | | - * |
---|
11 | | - * This program is free software; you can redistribute it and/or modify |
---|
12 | | - * it under the terms of the GNU General Public License version 2 as |
---|
13 | | - * published by the Free Software Foundation. |
---|
14 | | - * |
---|
15 | | - * This program is distributed in the hope that it will be useful, |
---|
16 | | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
17 | | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
18 | | - * GNU General Public License for more details. |
---|
19 | | - * |
---|
20 | | - * You should have received a copy of the GNU General Public License |
---|
21 | | - * along with this program. If not, see <http://www.gnu.org/licenses/>. |
---|
22 | 11 | */ |
---|
23 | 12 | |
---|
24 | | -#include <linux/kernel_stat.h> |
---|
25 | 13 | #include <linux/irq.h> |
---|
26 | 14 | #include <linux/memory.h> |
---|
27 | 15 | #include <linux/smp.h> |
---|
| 16 | +#include <linux/hardirq.h> |
---|
28 | 17 | #include <linux/init.h> |
---|
29 | 18 | #include <linux/irqchip.h> |
---|
| 19 | +#include <linux/kprobes.h> |
---|
| 20 | +#include <linux/scs.h> |
---|
30 | 21 | #include <linux/seq_file.h> |
---|
31 | 22 | #include <linux/vmalloc.h> |
---|
| 23 | +#include <asm/daifflags.h> |
---|
32 | 24 | #include <asm/vmap_stack.h> |
---|
33 | | -#include <asm/scs.h> |
---|
34 | | - |
---|
35 | | -unsigned long irq_err_count; |
---|
36 | 25 | |
---|
37 | 26 | /* Only access this in an NMI enter/exit */ |
---|
38 | 27 | DEFINE_PER_CPU(struct nmi_ctx, nmi_contexts); |
---|
39 | 28 | |
---|
40 | 29 | DEFINE_PER_CPU(unsigned long *, irq_stack_ptr); |
---|
41 | | -EXPORT_PER_CPU_SYMBOL_GPL(irq_stack_ptr); |
---|
42 | 30 | |
---|
43 | | -int arch_show_interrupts(struct seq_file *p, int prec) |
---|
| 31 | + |
---|
| 32 | +DECLARE_PER_CPU(unsigned long *, irq_shadow_call_stack_ptr); |
---|
| 33 | + |
---|
| 34 | +#ifdef CONFIG_SHADOW_CALL_STACK |
---|
| 35 | +DEFINE_PER_CPU(unsigned long *, irq_shadow_call_stack_ptr); |
---|
| 36 | +#endif |
---|
| 37 | + |
---|
| 38 | +static void init_irq_scs(void) |
---|
44 | 39 | { |
---|
45 | | - show_ipi_list(p, prec); |
---|
46 | | - seq_printf(p, "%*s: %10lu\n", prec, "Err", irq_err_count); |
---|
47 | | - return 0; |
---|
| 40 | + int cpu; |
---|
| 41 | + |
---|
| 42 | + if (!IS_ENABLED(CONFIG_SHADOW_CALL_STACK)) |
---|
| 43 | + return; |
---|
| 44 | + |
---|
| 45 | + for_each_possible_cpu(cpu) |
---|
| 46 | + per_cpu(irq_shadow_call_stack_ptr, cpu) = |
---|
| 47 | + scs_alloc(cpu_to_node(cpu)); |
---|
48 | 48 | } |
---|
49 | 49 | |
---|
50 | 50 | #ifdef CONFIG_VMAP_STACK |
---|
.. | .. |
---|
74 | 74 | void __init init_IRQ(void) |
---|
75 | 75 | { |
---|
76 | 76 | init_irq_stacks(); |
---|
77 | | - scs_init_irq(); |
---|
| 77 | + init_irq_scs(); |
---|
78 | 78 | irqchip_init(); |
---|
79 | 79 | if (!handle_arch_irq) |
---|
80 | 80 | panic("No interrupt controller found."); |
---|
| 81 | + |
---|
| 82 | + if (system_uses_irq_prio_masking()) { |
---|
| 83 | + /* |
---|
| 84 | + * Now that we have a stack for our IRQ handler, set |
---|
| 85 | + * the PMR/PSR pair to a consistent state. |
---|
| 86 | + */ |
---|
| 87 | + WARN_ON(read_sysreg(daif) & PSR_A_BIT); |
---|
| 88 | + local_daif_restore(DAIF_PROCCTX_NOIRQ); |
---|
| 89 | + } |
---|
81 | 90 | } |
---|