1 // SPDX-License-Identifier: GPL-2.0
3 * Copyright (C) 2012 Regents of the University of California
4 * Copyright (C) 2017 SiFive
5 * Copyright (C) 2018 Christoph Hellwig
8 #include <linux/interrupt.h>
9 #include <linux/irqchip.h>
10 #include <linux/irqdomain.h>
11 #include <linux/seq_file.h>
15 * Possible interrupt causes:
17 #define INTERRUPT_CAUSE_SOFTWARE IRQ_S_SOFT
18 #define INTERRUPT_CAUSE_TIMER IRQ_S_TIMER
19 #define INTERRUPT_CAUSE_EXTERNAL IRQ_S_EXT
21 int arch_show_interrupts(struct seq_file *p, int prec)
23 show_ipi_stats(p, prec);
27 asmlinkage __visible void __irq_entry do_IRQ(struct pt_regs *regs)
29 struct pt_regs *old_regs = set_irq_regs(regs);
32 switch (regs->scause & ~SCAUSE_IRQ_FLAG) {
33 case INTERRUPT_CAUSE_TIMER:
34 riscv_timer_interrupt();
37 case INTERRUPT_CAUSE_SOFTWARE:
39 * We only use software interrupts to pass IPIs, so if a non-SMP
40 * system gets one, then we don't know what to do.
42 riscv_software_interrupt();
45 case INTERRUPT_CAUSE_EXTERNAL:
46 handle_arch_irq(regs);
49 pr_alert("unexpected interrupt cause 0x%lx", regs->scause);
54 set_irq_regs(old_regs);
57 void __init init_IRQ(void)