Skip to content

Commit 72e2014

Browse files
paulburtonralfbaechle
authored andcommitted
MIPS: Move GIC IPI functions out of smp-cmp.c
The GIC IPI functions aren't necessarily specific to the "CMP framework" SMP implementation, and will be used elsewhere in a subsequent commit. This patch adds cleaned up GIC IPI functions to a separate file which is compiled when a new CONFIG_MIPS_GIC_IPI Kconfig symbol is selected, and selects that symbol for CONFIG_MIPS_CMP. Signed-off-by: Paul Burton <paul.burton@imgtec.com> Cc: linux-mips@linux-mips.org Patchwork: https://patchwork.linux-mips.org/patch/6359/ Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
1 parent 1d68808 commit 72e2014

File tree

5 files changed

+63
-50
lines changed

5 files changed

+63
-50
lines changed

arch/mips/Kconfig

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1996,12 +1996,16 @@ config MIPS_VPE_APSP_API_MT
19961996
config MIPS_CMP
19971997
bool "MIPS CMP support"
19981998
depends on SYS_SUPPORTS_MIPS_CMP && MIPS_MT_SMP
1999+
select MIPS_GIC_IPI
19992000
select SYNC_R4K
20002001
select WEAK_ORDERING
20012002
default n
20022003
help
20032004
Enable Coherency Manager processor (CMP) support.
20042005

2006+
config MIPS_GIC_IPI
2007+
bool
2008+
20052009
config SB1_PASS_1_WORKAROUNDS
20062010
bool
20072011
depends on CPU_SB1_PASS_1

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,9 @@ static inline void register_smp_ops(struct plat_smp_ops *ops)
5858

5959
#endif /* !CONFIG_SMP */
6060

61+
extern void gic_send_ipi_single(int cpu, unsigned int action);
62+
extern void gic_send_ipi_mask(const struct cpumask *mask, unsigned int action);
63+
6164
static inline int register_up_smp_ops(void)
6265
{
6366
#ifdef CONFIG_SMP_UP

arch/mips/kernel/Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ obj-$(CONFIG_MIPS_MT_FPAFF) += mips-mt-fpaff.o
5353
obj-$(CONFIG_MIPS_MT_SMTC) += smtc.o smtc-asm.o smtc-proc.o
5454
obj-$(CONFIG_MIPS_MT_SMP) += smp-mt.o
5555
obj-$(CONFIG_MIPS_CMP) += smp-cmp.o
56+
obj-$(CONFIG_MIPS_GIC_IPI) += smp-gic.o
5657
obj-$(CONFIG_CPU_MIPSR2) += spram.o
5758

5859
obj-$(CONFIG_MIPS_VPE_LOADER) += vpe.o

arch/mips/kernel/smp-cmp.c

Lines changed: 2 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -39,54 +39,6 @@
3939
#include <asm/amon.h>
4040
#include <asm/gic.h>
4141

42-
static void ipi_call_function(unsigned int cpu)
43-
{
44-
pr_debug("CPU%d: %s cpu %d status %08x\n",
45-
smp_processor_id(), __func__, cpu, read_c0_status());
46-
47-
gic_send_ipi(plat_ipi_call_int_xlate(cpu));
48-
}
49-
50-
51-
static void ipi_resched(unsigned int cpu)
52-
{
53-
pr_debug("CPU%d: %s cpu %d status %08x\n",
54-
smp_processor_id(), __func__, cpu, read_c0_status());
55-
56-
gic_send_ipi(plat_ipi_resched_int_xlate(cpu));
57-
}
58-
59-
/*
60-
* FIXME: This isn't restricted to CMP
61-
* The SMVP kernel could use GIC interrupts if available
62-
*/
63-
void cmp_send_ipi_single(int cpu, unsigned int action)
64-
{
65-
unsigned long flags;
66-
67-
local_irq_save(flags);
68-
69-
switch (action) {
70-
case SMP_CALL_FUNCTION:
71-
ipi_call_function(cpu);
72-
break;
73-
74-
case SMP_RESCHEDULE_YOURSELF:
75-
ipi_resched(cpu);
76-
break;
77-
}
78-
79-
local_irq_restore(flags);
80-
}
81-
82-
static void cmp_send_ipi_mask(const struct cpumask *mask, unsigned int action)
83-
{
84-
unsigned int i;
85-
86-
for_each_cpu(i, mask)
87-
cmp_send_ipi_single(i, action);
88-
}
89-
9042
static void cmp_init_secondary(void)
9143
{
9244
struct cpuinfo_mips *c = &current_cpu_data;
@@ -210,8 +162,8 @@ void __init cmp_prepare_cpus(unsigned int max_cpus)
210162
}
211163

212164
struct plat_smp_ops cmp_smp_ops = {
213-
.send_ipi_single = cmp_send_ipi_single,
214-
.send_ipi_mask = cmp_send_ipi_mask,
165+
.send_ipi_single = gic_send_ipi_single,
166+
.send_ipi_mask = gic_send_ipi_mask,
215167
.init_secondary = cmp_init_secondary,
216168
.smp_finish = cmp_smp_finish,
217169
.cpus_done = cmp_cpus_done,

arch/mips/kernel/smp-gic.c

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
/*
2+
* Copyright (C) 2013 Imagination Technologies
3+
* Author: Paul Burton <paul.burton@imgtec.com>
4+
*
5+
* Based on smp-cmp.c:
6+
* Copyright (C) 2007 MIPS Technologies, Inc.
7+
* Author: Chris Dearman (chris@mips.com)
8+
*
9+
* This program is free software; you can redistribute it and/or modify it
10+
* under the terms of the GNU General Public License as published by the
11+
* Free Software Foundation; either version 2 of the License, or (at your
12+
* option) any later version.
13+
*/
14+
15+
#include <linux/printk.h>
16+
17+
#include <asm/gic.h>
18+
#include <asm/smp-ops.h>
19+
20+
void gic_send_ipi_single(int cpu, unsigned int action)
21+
{
22+
unsigned long flags;
23+
unsigned int intr;
24+
25+
pr_debug("CPU%d: %s cpu %d action %u status %08x\n",
26+
smp_processor_id(), __func__, cpu, action, read_c0_status());
27+
28+
local_irq_save(flags);
29+
30+
switch (action) {
31+
case SMP_CALL_FUNCTION:
32+
intr = plat_ipi_call_int_xlate(cpu);
33+
break;
34+
35+
case SMP_RESCHEDULE_YOURSELF:
36+
intr = plat_ipi_resched_int_xlate(cpu);
37+
break;
38+
39+
default:
40+
BUG();
41+
}
42+
43+
gic_send_ipi(intr);
44+
local_irq_restore(flags);
45+
}
46+
47+
void gic_send_ipi_mask(const struct cpumask *mask, unsigned int action)
48+
{
49+
unsigned int i;
50+
51+
for_each_cpu(i, mask)
52+
gic_send_ipi_single(i, action);
53+
}

0 commit comments

Comments
 (0)