Skip to content

Commit bb11cff

Browse files
Qais YousefKAGA-KOKO
authored andcommitted
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>
1 parent fbde2d7 commit bb11cff

7 files changed

Lines changed: 14 additions & 91 deletions

File tree

‎arch/mips/include/asm/smp-ops.h‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,9 @@ static inline void plat_smp_setup(void)
4444
mp_ops->smp_setup();
4545
}
4646

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);
4950

5051
#else /* !CONFIG_SMP */
5152

‎arch/mips/kernel/smp-cmp.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -149,8 +149,8 @@ void __init cmp_prepare_cpus(unsigned int max_cpus)
149149
}
150150

151151
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,
154154
.init_secondary = cmp_init_secondary,
155155
.smp_finish = cmp_smp_finish,
156156
.boot_secondary = cmp_boot_secondary,

‎arch/mips/kernel/smp-cps.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -472,8 +472,8 @@ static struct plat_smp_ops cps_smp_ops = {
472472
.boot_secondary = cps_boot_secondary,
473473
.init_secondary = cps_init_secondary,
474474
.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,
477477
#ifdef CONFIG_HOTPLUG_CPU
478478
.cpu_disable = cps_cpu_disable,
479479
.cpu_die = cps_cpu_die,

‎arch/mips/kernel/smp-mt.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ static void vsmp_send_ipi_single(int cpu, unsigned int action)
121121

122122
#ifdef CONFIG_MIPS_GIC
123123
if (gic_present) {
124-
gic_send_ipi_single(cpu, action);
124+
mips_smp_send_ipi_single(cpu, action);
125125
return;
126126
}
127127
#endif

‎drivers/irqchip/Kconfig‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -209,6 +209,7 @@ config KEYSTONE_IRQ
209209

210210
config MIPS_GIC
211211
bool
212+
select GENERIC_IRQ_IPI
212213
select IRQ_DOMAIN_HIERARCHY
213214
select MIPS_CM
214215

‎drivers/irqchip/irq-mips-gic.c‎

Lines changed: 5 additions & 81 deletions
Original file line numberDiff line numberDiff line change
@@ -280,9 +280,11 @@ static void gic_bind_eic_interrupt(int irq, int set)
280280
GIC_VPE_EIC_SS(irq), set);
281281
}
282282

283-
void gic_send_ipi(unsigned int intr)
283+
static void gic_send_ipi(struct irq_data *d, unsigned int cpu)
284284
{
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));
286288
}
287289

288290
int gic_get_c0_compare_int(void)
@@ -495,6 +497,7 @@ static struct irq_chip gic_edge_irq_controller = {
495497
#ifdef CONFIG_SMP
496498
.irq_set_affinity = gic_set_affinity,
497499
#endif
500+
.ipi_send_single = gic_send_ipi,
498501
};
499502

500503
static void gic_handle_local_int(bool chained)
@@ -588,83 +591,6 @@ static void gic_irq_dispatch(struct irq_desc *desc)
588591
gic_handle_shared_int(true);
589592
}
590593

591-
#ifdef CONFIG_MIPS_GIC_IPI
592-
static int gic_resched_int_base;
593-
static int gic_call_int_base;
594-
595-
unsigned int plat_ipi_resched_int_xlate(unsigned int cpu)
596-
{
597-
return gic_resched_int_base + cpu;
598-
}
599-
600-
unsigned int plat_ipi_call_int_xlate(unsigned int cpu)
601-
{
602-
return gic_call_int_base + cpu;
603-
}
604-
605-
static irqreturn_t ipi_resched_interrupt(int irq, void *dev_id)
606-
{
607-
scheduler_ipi();
608-
609-
return IRQ_HANDLED;
610-
}
611-
612-
static irqreturn_t ipi_call_interrupt(int irq, void *dev_id)
613-
{
614-
generic_smp_call_function_interrupt();
615-
616-
return IRQ_HANDLED;
617-
}
618-
619-
static struct irqaction irq_resched = {
620-
.handler = ipi_resched_interrupt,
621-
.flags = IRQF_PERCPU,
622-
.name = "IPI resched"
623-
};
624-
625-
static struct irqaction irq_call = {
626-
.handler = ipi_call_interrupt,
627-
.flags = IRQF_PERCPU,
628-
.name = "IPI call"
629-
};
630-
631-
static __init void gic_ipi_init_one(unsigned int intr, int cpu,
632-
struct irqaction *action)
633-
{
634-
int virq = irq_create_mapping(gic_irq_domain,
635-
GIC_SHARED_TO_HWIRQ(intr));
636-
int i;
637-
638-
gic_map_to_vpe(intr, mips_cm_vp_id(cpu));
639-
for (i = 0; i < NR_CPUS; i++)
640-
clear_bit(intr, pcpu_masks[i].pcpu_mask);
641-
set_bit(intr, pcpu_masks[cpu].pcpu_mask);
642-
643-
irq_set_irq_type(virq, IRQ_TYPE_EDGE_RISING);
644-
645-
irq_set_handler(virq, handle_percpu_irq);
646-
setup_irq(virq, action);
647-
}
648-
649-
static __init void gic_ipi_init(void)
650-
{
651-
int i;
652-
653-
/* Use last 2 * NR_CPUS interrupts as IPIs */
654-
gic_resched_int_base = gic_shared_intrs - nr_cpu_ids;
655-
gic_call_int_base = gic_resched_int_base - nr_cpu_ids;
656-
657-
for (i = 0; i < nr_cpu_ids; i++) {
658-
gic_ipi_init_one(gic_call_int_base + i, i, &irq_call);
659-
gic_ipi_init_one(gic_resched_int_base + i, i, &irq_resched);
660-
}
661-
}
662-
#else
663-
static inline void gic_ipi_init(void)
664-
{
665-
}
666-
#endif
667-
668594
static void __init gic_basic_init(void)
669595
{
670596
unsigned int i;
@@ -1105,8 +1031,6 @@ static void __init __gic_init(unsigned long gic_base_addr,
11051031
bitmap_set(ipi_resrv, gic_shared_intrs - 2 * gic_vpes, 2 * gic_vpes);
11061032

11071033
gic_basic_init();
1108-
1109-
gic_ipi_init();
11101034
}
11111035

11121036
void __init gic_init(unsigned long gic_base_addr,

‎include/linux/irqchip/mips-gic.h‎

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -261,9 +261,6 @@ extern void gic_write_compare(cycle_t cnt);
261261
extern void gic_write_cpu_compare(cycle_t cnt, int cpu);
262262
extern void gic_start_count(void);
263263
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);
267264
extern int gic_get_c0_compare_int(void);
268265
extern int gic_get_c0_perfcount_int(void);
269266
extern int gic_get_c0_fdc_int(void);

0 commit comments

Comments
 (0)