Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

MIPS: Make smp CMP, CPS and MT use the new generic IPI functions

This commit does several things to avoid breaking bisectability.

1- Remove IPI init code from irqchip/mips-gic
2- Implement the new irqchip->send_ipi() in irqchip/mips-gic
3- Select GENERIC_IRQ_IPI Kconfig symbol for MIPS_GIC
4- Change MIPS SMP to use the generic IPI implementation

Only the SMP variants that use GIC were converted as it's the only irqchip that
will have the support for generic IPI for now.

Signed-off-by: Qais Yousef <qais.yousef@imgtec.com>
Acked-by: Ralf Baechle <ralf@linux-mips.org>
Cc: <jason@lakedaemon.net>
Cc: <marc.zyngier@arm.com>
Cc: <jiang.liu@linux.intel.com>
Cc: <linux-mips@linux-mips.org>
Cc: <lisa.parratt@imgtec.com>
Cc: Qais Yousef <qsyousef@gmail.com>
Link: http://lkml.kernel.org/r/1449580830-23652-18-git-send-email-qais.yousef@imgtec.com
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>

authored by

Qais Yousef and committed by
Thomas Gleixner
bb11cff3 fbde2d7d

+14 -91
+3 -2
arch/mips/include/asm/smp-ops.h
··· 44 44 mp_ops->smp_setup(); 45 45 } 46 46 47 - extern void gic_send_ipi_single(int cpu, unsigned int action); 48 - extern void gic_send_ipi_mask(const struct cpumask *mask, unsigned int action); 47 + extern void mips_smp_send_ipi_single(int cpu, unsigned int action); 48 + extern void mips_smp_send_ipi_mask(const struct cpumask *mask, 49 + unsigned int action); 49 50 50 51 #else /* !CONFIG_SMP */ 51 52
+2 -2
arch/mips/kernel/smp-cmp.c
··· 149 149 } 150 150 151 151 struct plat_smp_ops cmp_smp_ops = { 152 - .send_ipi_single = gic_send_ipi_single, 153 - .send_ipi_mask = gic_send_ipi_mask, 152 + .send_ipi_single = mips_smp_send_ipi_single, 153 + .send_ipi_mask = mips_smp_send_ipi_mask, 154 154 .init_secondary = cmp_init_secondary, 155 155 .smp_finish = cmp_smp_finish, 156 156 .boot_secondary = cmp_boot_secondary,
+2 -2
arch/mips/kernel/smp-cps.c
··· 472 472 .boot_secondary = cps_boot_secondary, 473 473 .init_secondary = cps_init_secondary, 474 474 .smp_finish = cps_smp_finish, 475 - .send_ipi_single = gic_send_ipi_single, 476 - .send_ipi_mask = gic_send_ipi_mask, 475 + .send_ipi_single = mips_smp_send_ipi_single, 476 + .send_ipi_mask = mips_smp_send_ipi_mask, 477 477 #ifdef CONFIG_HOTPLUG_CPU 478 478 .cpu_disable = cps_cpu_disable, 479 479 .cpu_die = cps_cpu_die,
+1 -1
arch/mips/kernel/smp-mt.c
··· 121 121 122 122 #ifdef CONFIG_MIPS_GIC 123 123 if (gic_present) { 124 - gic_send_ipi_single(cpu, action); 124 + mips_smp_send_ipi_single(cpu, action); 125 125 return; 126 126 } 127 127 #endif
+1
drivers/irqchip/Kconfig
··· 209 209 210 210 config MIPS_GIC 211 211 bool 212 + select GENERIC_IRQ_IPI 212 213 select IRQ_DOMAIN_HIERARCHY 213 214 select MIPS_CM 214 215
+5 -81
drivers/irqchip/irq-mips-gic.c
··· 280 280 GIC_VPE_EIC_SS(irq), set); 281 281 } 282 282 283 - void gic_send_ipi(unsigned int intr) 283 + static void gic_send_ipi(struct irq_data *d, unsigned int cpu) 284 284 { 285 - gic_write(GIC_REG(SHARED, GIC_SH_WEDGE), GIC_SH_WEDGE_SET(intr)); 285 + irq_hw_number_t hwirq = GIC_HWIRQ_TO_SHARED(irqd_to_hwirq(d)); 286 + 287 + gic_write(GIC_REG(SHARED, GIC_SH_WEDGE), GIC_SH_WEDGE_SET(hwirq)); 286 288 } 287 289 288 290 int gic_get_c0_compare_int(void) ··· 497 495 #ifdef CONFIG_SMP 498 496 .irq_set_affinity = gic_set_affinity, 499 497 #endif 498 + .ipi_send_single = gic_send_ipi, 500 499 }; 501 500 502 501 static void gic_handle_local_int(bool chained) ··· 590 587 gic_handle_local_int(true); 591 588 gic_handle_shared_int(true); 592 589 } 593 - 594 - #ifdef CONFIG_MIPS_GIC_IPI 595 - static int gic_resched_int_base; 596 - static int gic_call_int_base; 597 - 598 - unsigned int plat_ipi_resched_int_xlate(unsigned int cpu) 599 - { 600 - return gic_resched_int_base + cpu; 601 - } 602 - 603 - unsigned int plat_ipi_call_int_xlate(unsigned int cpu) 604 - { 605 - return gic_call_int_base + cpu; 606 - } 607 - 608 - static irqreturn_t ipi_resched_interrupt(int irq, void *dev_id) 609 - { 610 - scheduler_ipi(); 611 - 612 - return IRQ_HANDLED; 613 - } 614 - 615 - static irqreturn_t ipi_call_interrupt(int irq, void *dev_id) 616 - { 617 - generic_smp_call_function_interrupt(); 618 - 619 - return IRQ_HANDLED; 620 - } 621 - 622 - static struct irqaction irq_resched = { 623 - .handler = ipi_resched_interrupt, 624 - .flags = IRQF_PERCPU, 625 - .name = "IPI resched" 626 - }; 627 - 628 - static struct irqaction irq_call = { 629 - .handler = ipi_call_interrupt, 630 - .flags = IRQF_PERCPU, 631 - .name = "IPI call" 632 - }; 633 - 634 - static __init void gic_ipi_init_one(unsigned int intr, int cpu, 635 - struct irqaction *action) 636 - { 637 - int virq = irq_create_mapping(gic_irq_domain, 638 - GIC_SHARED_TO_HWIRQ(intr)); 639 - int i; 640 - 641 - gic_map_to_vpe(intr, mips_cm_vp_id(cpu)); 642 - for (i = 0; i < NR_CPUS; i++) 643 - clear_bit(intr, pcpu_masks[i].pcpu_mask); 644 - set_bit(intr, pcpu_masks[cpu].pcpu_mask); 645 - 646 - irq_set_irq_type(virq, IRQ_TYPE_EDGE_RISING); 647 - 648 - irq_set_handler(virq, handle_percpu_irq); 649 - setup_irq(virq, action); 650 - } 651 - 652 - static __init void gic_ipi_init(void) 653 - { 654 - int i; 655 - 656 - /* Use last 2 * NR_CPUS interrupts as IPIs */ 657 - gic_resched_int_base = gic_shared_intrs - nr_cpu_ids; 658 - gic_call_int_base = gic_resched_int_base - nr_cpu_ids; 659 - 660 - for (i = 0; i < nr_cpu_ids; i++) { 661 - gic_ipi_init_one(gic_call_int_base + i, i, &irq_call); 662 - gic_ipi_init_one(gic_resched_int_base + i, i, &irq_resched); 663 - } 664 - } 665 - #else 666 - static inline void gic_ipi_init(void) 667 - { 668 - } 669 - #endif 670 590 671 591 static void __init gic_basic_init(void) 672 592 { ··· 1031 1105 bitmap_set(ipi_resrv, gic_shared_intrs - 2 * gic_vpes, 2 * gic_vpes); 1032 1106 1033 1107 gic_basic_init(); 1034 - 1035 - gic_ipi_init(); 1036 1108 } 1037 1109 1038 1110 void __init gic_init(unsigned long gic_base_addr,
-3
include/linux/irqchip/mips-gic.h
··· 261 261 extern void gic_write_cpu_compare(cycle_t cnt, int cpu); 262 262 extern void gic_start_count(void); 263 263 extern void gic_stop_count(void); 264 - extern void gic_send_ipi(unsigned int intr); 265 - extern unsigned int plat_ipi_call_int_xlate(unsigned int); 266 - extern unsigned int plat_ipi_resched_int_xlate(unsigned int); 267 264 extern int gic_get_c0_compare_int(void); 268 265 extern int gic_get_c0_perfcount_int(void); 269 266 extern int gic_get_c0_fdc_int(void);