aboutsummaryrefslogtreecommitdiffstats
path: root/arch/mips/cavium-octeon/octeon-irq.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/mips/cavium-octeon/octeon-irq.c')
-rw-r--r--arch/mips/cavium-octeon/octeon-irq.c61
1 files changed, 60 insertions, 1 deletions
diff --git a/arch/mips/cavium-octeon/octeon-irq.c b/arch/mips/cavium-octeon/octeon-irq.c
index 8dfa009e0070..384f1842bfb1 100644
--- a/arch/mips/cavium-octeon/octeon-irq.c
+++ b/arch/mips/cavium-octeon/octeon-irq.c
@@ -7,7 +7,7 @@
7 */ 7 */
8#include <linux/irq.h> 8#include <linux/irq.h>
9#include <linux/interrupt.h> 9#include <linux/interrupt.h>
10#include <linux/hardirq.h> 10#include <linux/smp.h>
11 11
12#include <asm/octeon/octeon.h> 12#include <asm/octeon/octeon.h>
13#include <asm/octeon/cvmx-pexp-defs.h> 13#include <asm/octeon/cvmx-pexp-defs.h>
@@ -501,3 +501,62 @@ asmlinkage void plat_irq_dispatch(void)
501 } 501 }
502 } 502 }
503} 503}
504
505#ifdef CONFIG_HOTPLUG_CPU
506static int is_irq_enabled_on_cpu(unsigned int irq, unsigned int cpu)
507{
508 unsigned int isset;
509#ifdef CONFIG_SMP
510 int coreid = cpu_logical_map(cpu);
511#else
512 int coreid = cvmx_get_core_num();
513#endif
514 int bit = (irq < OCTEON_IRQ_WDOG0) ?
515 irq - OCTEON_IRQ_WORKQ0 : irq - OCTEON_IRQ_WDOG0;
516 if (irq < 64) {
517 isset = (cvmx_read_csr(CVMX_CIU_INTX_EN0(coreid * 2)) &
518 (1ull << bit)) >> bit;
519 } else {
520 isset = (cvmx_read_csr(CVMX_CIU_INTX_EN1(coreid * 2 + 1)) &
521 (1ull << bit)) >> bit;
522 }
523 return isset;
524}
525
526void fixup_irqs(void)
527{
528 int irq;
529
530 for (irq = OCTEON_IRQ_SW0; irq <= OCTEON_IRQ_TIMER; irq++)
531 octeon_irq_core_disable_local(irq);
532
533 for (irq = OCTEON_IRQ_WORKQ0; irq <= OCTEON_IRQ_GPIO15; irq++) {
534 if (is_irq_enabled_on_cpu(irq, smp_processor_id())) {
535 /* ciu irq migrates to next cpu */
536 octeon_irq_chip_ciu0.disable(irq);
537 octeon_irq_ciu0_set_affinity(irq, &cpu_online_map);
538 }
539 }
540
541#if 0
542 for (irq = OCTEON_IRQ_MBOX0; irq <= OCTEON_IRQ_MBOX1; irq++)
543 octeon_irq_mailbox_mask(irq);
544#endif
545 for (irq = OCTEON_IRQ_UART0; irq <= OCTEON_IRQ_BOOTDMA; irq++) {
546 if (is_irq_enabled_on_cpu(irq, smp_processor_id())) {
547 /* ciu irq migrates to next cpu */
548 octeon_irq_chip_ciu0.disable(irq);
549 octeon_irq_ciu0_set_affinity(irq, &cpu_online_map);
550 }
551 }
552
553 for (irq = OCTEON_IRQ_UART2; irq <= OCTEON_IRQ_RESERVED135; irq++) {
554 if (is_irq_enabled_on_cpu(irq, smp_processor_id())) {
555 /* ciu irq migrates to next cpu */
556 octeon_irq_chip_ciu1.disable(irq);
557 octeon_irq_ciu1_set_affinity(irq, &cpu_online_map);
558 }
559 }
560}
561
562#endif /* CONFIG_HOTPLUG_CPU */