Linux 5.6.13
[linux/fpc-iii.git] / arch / riscv / kernel / irq.c
blob345c4f2eba13f41a58cdf2f2193f08371863a68f
1 // SPDX-License-Identifier: GPL-2.0
2 /*
3 * Copyright (C) 2012 Regents of the University of California
4 * Copyright (C) 2017 SiFive
5 * Copyright (C) 2018 Christoph Hellwig
6 */
8 #include <linux/interrupt.h>
9 #include <linux/irqchip.h>
10 #include <linux/irqdomain.h>
11 #include <linux/seq_file.h>
12 #include <asm/smp.h>
14 int arch_show_interrupts(struct seq_file *p, int prec)
16 show_ipi_stats(p, prec);
17 return 0;
20 asmlinkage __visible void __irq_entry do_IRQ(struct pt_regs *regs)
22 struct pt_regs *old_regs = set_irq_regs(regs);
24 irq_enter();
25 switch (regs->cause & ~CAUSE_IRQ_FLAG) {
26 case RV_IRQ_TIMER:
27 riscv_timer_interrupt();
28 break;
29 #ifdef CONFIG_SMP
30 case RV_IRQ_SOFT:
32 * We only use software interrupts to pass IPIs, so if a non-SMP
33 * system gets one, then we don't know what to do.
35 riscv_software_interrupt();
36 break;
37 #endif
38 case RV_IRQ_EXT:
39 handle_arch_irq(regs);
40 break;
41 default:
42 pr_alert("unexpected interrupt cause 0x%lx", regs->cause);
43 BUG();
45 irq_exit();
47 set_irq_regs(old_regs);
50 void __init init_IRQ(void)
52 irqchip_init();