diff options
author | Maciej W. Rozycki <macro@linux-mips.org> | 2015-04-03 18:32:08 -0400 |
---|---|---|
committer | Ralf Baechle <ralf@linux-mips.org> | 2015-04-07 19:10:45 -0400 |
commit | f02cf4691e19ab61d4415b2fbfeb64aa8a93757e (patch) | |
tree | 0fcde09a376f7fe5984aed2d9908592471156eea | |
parent | 7aecd5ca80d1c08f882a5357ddae8c677c7fd1af (diff) |
MIPS: DEC: Implement FPU interrupt counter
Implement a cheap way to count FPU interrupts for R2k/R3k DECstation
systems. Do this manually in handcoded assembly, rather than calling
`kstat_incr_irq_this_cpu' that would require setting up a stack frame
and a lot of redirection. This is not going to be a problem because the
FPU interrupt is local to the CPU and also there is one CPU only anyway.
So at bootstrap determine the address of the correct location within
`struct irq_desc', and then only refer to it directly in the interrupt
handler.
Signed-off-by: Maciej W. Rozycki <macro@linux-mips.org>
Cc: linux-mips@linux-mips.org
Patchwork: https://patchwork.linux-mips.org/patch/9713/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
-rw-r--r-- | arch/mips/dec/int-handler.S | 7 | ||||
-rw-r--r-- | arch/mips/dec/setup.c | 16 |
2 files changed, 19 insertions, 4 deletions
diff --git a/arch/mips/dec/int-handler.S b/arch/mips/dec/int-handler.S index 41a2fa1fa12e..8c6f508e59de 100644 --- a/arch/mips/dec/int-handler.S +++ b/arch/mips/dec/int-handler.S | |||
@@ -267,8 +267,13 @@ handle_it: | |||
267 | 267 | ||
268 | #ifdef CONFIG_32BIT | 268 | #ifdef CONFIG_32BIT |
269 | fpu: | 269 | fpu: |
270 | lw t0,fpu_kstat_irq | ||
271 | nop | ||
272 | lw t1,(t0) | ||
273 | nop | ||
274 | addu t1,1 | ||
270 | j handle_fpe_int | 275 | j handle_fpe_int |
271 | nop | 276 | sw t1,(t0) |
272 | #endif | 277 | #endif |
273 | 278 | ||
274 | spurious: | 279 | spurious: |
diff --git a/arch/mips/dec/setup.c b/arch/mips/dec/setup.c index 41bbffd9cc0e..b4f83dd22db6 100644 --- a/arch/mips/dec/setup.c +++ b/arch/mips/dec/setup.c | |||
@@ -12,13 +12,15 @@ | |||
12 | #include <linux/init.h> | 12 | #include <linux/init.h> |
13 | #include <linux/interrupt.h> | 13 | #include <linux/interrupt.h> |
14 | #include <linux/ioport.h> | 14 | #include <linux/ioport.h> |
15 | #include <linux/irq.h> | ||
16 | #include <linux/irqnr.h> | ||
15 | #include <linux/module.h> | 17 | #include <linux/module.h> |
16 | #include <linux/param.h> | 18 | #include <linux/param.h> |
19 | #include <linux/percpu-defs.h> | ||
17 | #include <linux/sched.h> | 20 | #include <linux/sched.h> |
18 | #include <linux/spinlock.h> | 21 | #include <linux/spinlock.h> |
19 | #include <linux/types.h> | 22 | #include <linux/types.h> |
20 | #include <linux/pm.h> | 23 | #include <linux/pm.h> |
21 | #include <linux/irq.h> | ||
22 | 24 | ||
23 | #include <asm/bootinfo.h> | 25 | #include <asm/bootinfo.h> |
24 | #include <asm/cpu.h> | 26 | #include <asm/cpu.h> |
@@ -98,6 +100,7 @@ int_ptr asic_mask_nr_tbl[DEC_MAX_ASIC_INTS][2] = { | |||
98 | { { .i = ~0 }, { .p = asic_intr_unimplemented } }, | 100 | { { .i = ~0 }, { .p = asic_intr_unimplemented } }, |
99 | }; | 101 | }; |
100 | int cpu_fpu_mask = DEC_CPU_IRQ_MASK(DEC_CPU_INR_FPU); | 102 | int cpu_fpu_mask = DEC_CPU_IRQ_MASK(DEC_CPU_INR_FPU); |
103 | int *fpu_kstat_irq; | ||
101 | 104 | ||
102 | static struct irqaction ioirq = { | 105 | static struct irqaction ioirq = { |
103 | .handler = no_action, | 106 | .handler = no_action, |
@@ -755,8 +758,15 @@ void __init arch_init_irq(void) | |||
755 | dec_interrupt[DEC_IRQ_HALT] = -1; | 758 | dec_interrupt[DEC_IRQ_HALT] = -1; |
756 | 759 | ||
757 | /* Register board interrupts: FPU and cascade. */ | 760 | /* Register board interrupts: FPU and cascade. */ |
758 | if (dec_interrupt[DEC_IRQ_FPU] >= 0) | 761 | if (dec_interrupt[DEC_IRQ_FPU] >= 0) { |
759 | setup_irq(dec_interrupt[DEC_IRQ_FPU], &fpuirq); | 762 | struct irq_desc *desc_fpu; |
763 | int irq_fpu; | ||
764 | |||
765 | irq_fpu = dec_interrupt[DEC_IRQ_FPU]; | ||
766 | setup_irq(irq_fpu, &fpuirq); | ||
767 | desc_fpu = irq_to_desc(irq_fpu); | ||
768 | fpu_kstat_irq = this_cpu_ptr(desc_fpu->kstat_irqs); | ||
769 | } | ||
760 | if (dec_interrupt[DEC_IRQ_CASCADE] >= 0) | 770 | if (dec_interrupt[DEC_IRQ_CASCADE] >= 0) |
761 | setup_irq(dec_interrupt[DEC_IRQ_CASCADE], &ioirq); | 771 | setup_irq(dec_interrupt[DEC_IRQ_CASCADE], &ioirq); |
762 | 772 | ||