diff options
author | Ralf Baechle <ralf@linux-mips.org> | 2009-06-23 05:36:38 -0400 |
---|---|---|
committer | Ralf Baechle <ralf@linux-mips.org> | 2009-06-24 13:34:40 -0400 |
commit | 773cb77d0e32f0a3c36edf5aaeb9642c18038cd2 (patch) | |
tree | f604b52d75aaeffe4c432437f339f13c9e099265 /arch/mips/cavium-octeon/octeon-irq.c | |
parent | 9801b321ecdb6708365b6825bf728c8e433fca00 (diff) |
MIPS: Cavium: Add CPU hotplugging code.
Thanks to Cavium Inc. for the code contribution and help.
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
Diffstat (limited to 'arch/mips/cavium-octeon/octeon-irq.c')
-rw-r--r-- | arch/mips/cavium-octeon/octeon-irq.c | 59 |
1 files changed, 59 insertions, 0 deletions
diff --git a/arch/mips/cavium-octeon/octeon-irq.c b/arch/mips/cavium-octeon/octeon-irq.c index 3090ee37e109..384f1842bfb1 100644 --- a/arch/mips/cavium-octeon/octeon-irq.c +++ b/arch/mips/cavium-octeon/octeon-irq.c | |||
@@ -501,3 +501,62 @@ asmlinkage void plat_irq_dispatch(void) | |||
501 | } | 501 | } |
502 | } | 502 | } |
503 | } | 503 | } |
504 | |||
505 | #ifdef CONFIG_HOTPLUG_CPU | ||
506 | static 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 | |||
526 | void 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 */ | ||