riscv: abstract out CSR names for supervisor vs machine mode
Many of the privileged CSRs exist in a supervisor and machine version that are used very similarly. Provide versions of the CSR names and fields that map to either the S-mode or M-mode variant depending on a new CONFIG_RISCV_M_MODE kconfig symbol. Contains contributions from Damien Le Moal <Damien.LeMoal@wdc.com> and Paul Walmsley <paul.walmsley@sifive.com>. Signed-off-by: Christoph Hellwig <hch@lst.de> Acked-by: Thomas Gleixner <tglx@linutronix.de> # for drivers/clocksource, drivers/irqchip [paul.walmsley@sifive.com: updated to apply] Signed-off-by: Paul Walmsley <paul.walmsley@sifive.com>
This commit is contained in:

committed by
Paul Walmsley

parent
0c3ac28931
commit
a4c3733d32
@@ -11,13 +11,6 @@
|
||||
#include <linux/seq_file.h>
|
||||
#include <asm/smp.h>
|
||||
|
||||
/*
|
||||
* Possible interrupt causes:
|
||||
*/
|
||||
#define INTERRUPT_CAUSE_SOFTWARE IRQ_S_SOFT
|
||||
#define INTERRUPT_CAUSE_TIMER IRQ_S_TIMER
|
||||
#define INTERRUPT_CAUSE_EXTERNAL IRQ_S_EXT
|
||||
|
||||
int arch_show_interrupts(struct seq_file *p, int prec)
|
||||
{
|
||||
show_ipi_stats(p, prec);
|
||||
@@ -29,12 +22,12 @@ asmlinkage __visible void __irq_entry do_IRQ(struct pt_regs *regs)
|
||||
struct pt_regs *old_regs = set_irq_regs(regs);
|
||||
|
||||
irq_enter();
|
||||
switch (regs->scause & ~SCAUSE_IRQ_FLAG) {
|
||||
case INTERRUPT_CAUSE_TIMER:
|
||||
switch (regs->cause & ~CAUSE_IRQ_FLAG) {
|
||||
case IRQ_TIMER:
|
||||
riscv_timer_interrupt();
|
||||
break;
|
||||
#ifdef CONFIG_SMP
|
||||
case INTERRUPT_CAUSE_SOFTWARE:
|
||||
case IRQ_SOFT:
|
||||
/*
|
||||
* We only use software interrupts to pass IPIs, so if a non-SMP
|
||||
* system gets one, then we don't know what to do.
|
||||
@@ -42,11 +35,11 @@ asmlinkage __visible void __irq_entry do_IRQ(struct pt_regs *regs)
|
||||
riscv_software_interrupt();
|
||||
break;
|
||||
#endif
|
||||
case INTERRUPT_CAUSE_EXTERNAL:
|
||||
case IRQ_EXT:
|
||||
handle_arch_irq(regs);
|
||||
break;
|
||||
default:
|
||||
pr_alert("unexpected interrupt cause 0x%lx", regs->scause);
|
||||
pr_alert("unexpected interrupt cause 0x%lx", regs->cause);
|
||||
BUG();
|
||||
}
|
||||
irq_exit();
|
||||
|
Reference in New Issue
Block a user