2 * Copyright (C) 2012 ARM Ltd.
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.
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.
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/>.
16 #ifndef __ASM_HARDIRQ_H
17 #define __ASM_HARDIRQ_H
19 #include <linux/cache.h>
20 #include <linux/percpu.h>
21 #include <linux/threads.h>
22 #include <asm/barrier.h>
24 #include <asm/kvm_arm.h>
25 #include <asm/sysreg.h>
30 unsigned int __softirq_pending;
31 unsigned int ipi_irqs[NR_IPI];
32 } ____cacheline_aligned irq_cpustat_t;
34 #include <linux/irq_cpustat.h> /* Standard mappings for irq_cpustat_t above */
36 #define __inc_irq_stat(cpu, member) __IRQ_STAT(cpu, member)++
37 #define __get_irq_stat(cpu, member) __IRQ_STAT(cpu, member)
39 u64 smp_irq_stat_cpu(unsigned int cpu);
40 #define arch_irq_stat_cpu smp_irq_stat_cpu
42 #define __ARCH_IRQ_EXIT_IRQS_DISABLED 1
48 DECLARE_PER_CPU(struct nmi_ctx, nmi_contexts);
50 #define arch_nmi_enter() \
52 if (is_kernel_in_hyp_mode()) { \
53 struct nmi_ctx *nmi_ctx = this_cpu_ptr(&nmi_contexts); \
54 nmi_ctx->hcr = read_sysreg(hcr_el2); \
55 if (!(nmi_ctx->hcr & HCR_TGE)) { \
56 write_sysreg(nmi_ctx->hcr | HCR_TGE, hcr_el2); \
62 #define arch_nmi_exit() \
64 if (is_kernel_in_hyp_mode()) { \
65 struct nmi_ctx *nmi_ctx = this_cpu_ptr(&nmi_contexts); \
66 if (!(nmi_ctx->hcr & HCR_TGE)) \
67 write_sysreg(nmi_ctx->hcr, hcr_el2); \
71 static inline void ack_bad_irq(unsigned int irq)
73 extern unsigned long irq_err_count;
77 #endif /* __ASM_HARDIRQ_H */