hc
2024-02-20 102a0743326a03cd1a1202ceda21e175b7d3575c
kernel/arch/arm64/kernel/irq.c
....@@ -1,3 +1,4 @@
1
+// SPDX-License-Identifier: GPL-2.0-only
12 /*
23 * Based on arch/arm/kernel/irq.c
34 *
....@@ -7,44 +8,43 @@
78 * Dynamic Tick Timer written by Tony Lindgren <tony@atomide.com> and
89 * Tuukka Tikkanen <tuukka.tikkanen@elektrobit.com>.
910 * 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/>.
2211 */
2312
24
-#include <linux/kernel_stat.h>
2513 #include <linux/irq.h>
2614 #include <linux/memory.h>
2715 #include <linux/smp.h>
16
+#include <linux/hardirq.h>
2817 #include <linux/init.h>
2918 #include <linux/irqchip.h>
19
+#include <linux/kprobes.h>
20
+#include <linux/scs.h>
3021 #include <linux/seq_file.h>
3122 #include <linux/vmalloc.h>
23
+#include <asm/daifflags.h>
3224 #include <asm/vmap_stack.h>
33
-#include <asm/scs.h>
34
-
35
-unsigned long irq_err_count;
3625
3726 /* Only access this in an NMI enter/exit */
3827 DEFINE_PER_CPU(struct nmi_ctx, nmi_contexts);
3928
4029 DEFINE_PER_CPU(unsigned long *, irq_stack_ptr);
41
-EXPORT_PER_CPU_SYMBOL_GPL(irq_stack_ptr);
4230
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)
4439 {
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));
4848 }
4949
5050 #ifdef CONFIG_VMAP_STACK
....@@ -74,8 +74,17 @@
7474 void __init init_IRQ(void)
7575 {
7676 init_irq_stacks();
77
- scs_init_irq();
77
+ init_irq_scs();
7878 irqchip_init();
7979 if (!handle_arch_irq)
8080 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
+ }
8190 }