diff options
author | Ralf Baechle <ralf@linux-mips.org> | 2007-11-19 07:23:51 -0500 |
---|---|---|
committer | Ralf Baechle <ralf@linux-mips.org> | 2008-01-29 05:14:57 -0500 |
commit | 87353d8ac39c52784da605ecbe965ecdfad609ad (patch) | |
tree | c95ce7cbe9b099c21cab71a195621801b04bc05a /arch/mips/mipssim | |
parent | 19388fb092d89e179575bd0b44f51b57e175edf5 (diff) |
[MIPS] SMP: Call platform methods via ops structure.
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
Diffstat (limited to 'arch/mips/mipssim')
-rw-r--r-- | arch/mips/mipssim/Makefile | 2 | ||||
-rw-r--r-- | arch/mips/mipssim/sim_setup.c | 16 | ||||
-rw-r--r-- | arch/mips/mipssim/sim_smtc.c (renamed from arch/mips/mipssim/sim_smp.c) | 92 |
3 files changed, 59 insertions, 51 deletions
diff --git a/arch/mips/mipssim/Makefile b/arch/mips/mipssim/Makefile index 75568b584df4..57f43c1c7882 100644 --- a/arch/mips/mipssim/Makefile +++ b/arch/mips/mipssim/Makefile | |||
@@ -21,6 +21,6 @@ obj-y := sim_platform.o sim_setup.o sim_mem.o sim_time.o sim_int.o \ | |||
21 | sim_cmdline.o | 21 | sim_cmdline.o |
22 | 22 | ||
23 | obj-$(CONFIG_EARLY_PRINTK) += sim_console.o | 23 | obj-$(CONFIG_EARLY_PRINTK) += sim_console.o |
24 | obj-$(CONFIG_SMP) += sim_smp.o | 24 | obj-$(CONFIG_MIPS_MT_SMTC) += sim_smtc.o |
25 | 25 | ||
26 | EXTRA_CFLAGS += -Werror | 26 | EXTRA_CFLAGS += -Werror |
diff --git a/arch/mips/mipssim/sim_setup.c b/arch/mips/mipssim/sim_setup.c index 452c129d02c1..d49fe73426b7 100644 --- a/arch/mips/mipssim/sim_setup.c +++ b/arch/mips/mipssim/sim_setup.c | |||
@@ -60,6 +60,8 @@ void __init plat_mem_setup(void) | |||
60 | #endif | 60 | #endif |
61 | } | 61 | } |
62 | 62 | ||
63 | extern struct plat_smp_ops ssmtc_smp_ops; | ||
64 | |||
63 | void __init prom_init(void) | 65 | void __init prom_init(void) |
64 | { | 66 | { |
65 | set_io_port_base(0xbfd00000); | 67 | set_io_port_base(0xbfd00000); |
@@ -67,8 +69,20 @@ void __init prom_init(void) | |||
67 | pr_info("\nLINUX started...\n"); | 69 | pr_info("\nLINUX started...\n"); |
68 | prom_init_cmdline(); | 70 | prom_init_cmdline(); |
69 | prom_meminit(); | 71 | prom_meminit(); |
70 | } | ||
71 | 72 | ||
73 | #ifdef CONFIG_MIPS_MT_SMP | ||
74 | if (cpu_has_mipsmt) | ||
75 | register_smp_ops(&vsmp_smp_ops); | ||
76 | else | ||
77 | register_smp_ops(&up_smp_ops); | ||
78 | #endif | ||
79 | #ifdef CONFIG_MIPS_MT_SMTC | ||
80 | if (cpu_has_mipsmt) | ||
81 | register_smp_ops(&ssmtc_smp_ops); | ||
82 | else | ||
83 | register_smp_ops(&up_smp_ops); | ||
84 | #endif | ||
85 | } | ||
72 | 86 | ||
73 | static void __init serial_init(void) | 87 | static void __init serial_init(void) |
74 | { | 88 | { |
diff --git a/arch/mips/mipssim/sim_smp.c b/arch/mips/mipssim/sim_smtc.c index ccbbccac23ef..d6e4f656ad14 100644 --- a/arch/mips/mipssim/sim_smp.c +++ b/arch/mips/mipssim/sim_smtc.c | |||
@@ -16,7 +16,7 @@ | |||
16 | * | 16 | * |
17 | */ | 17 | */ |
18 | /* | 18 | /* |
19 | * Simulator Platform-specific hooks for SMP operation | 19 | * Simulator Platform-specific hooks for SMTC operation |
20 | */ | 20 | */ |
21 | #include <linux/kernel.h> | 21 | #include <linux/kernel.h> |
22 | #include <linux/sched.h> | 22 | #include <linux/sched.h> |
@@ -29,65 +29,72 @@ | |||
29 | #include <asm/processor.h> | 29 | #include <asm/processor.h> |
30 | #include <asm/system.h> | 30 | #include <asm/system.h> |
31 | #include <asm/mmu_context.h> | 31 | #include <asm/mmu_context.h> |
32 | #ifdef CONFIG_MIPS_MT_SMTC | ||
33 | #include <asm/smtc_ipi.h> | 32 | #include <asm/smtc_ipi.h> |
34 | #endif /* CONFIG_MIPS_MT_SMTC */ | ||
35 | 33 | ||
36 | /* VPE/SMP Prototype implements platform interfaces directly */ | 34 | /* VPE/SMP Prototype implements platform interfaces directly */ |
37 | #if !defined(CONFIG_MIPS_MT_SMP) | ||
38 | 35 | ||
39 | /* | 36 | /* |
40 | * Cause the specified action to be performed on a targeted "CPU" | 37 | * Cause the specified action to be performed on a targeted "CPU" |
41 | */ | 38 | */ |
42 | 39 | ||
43 | void core_send_ipi(int cpu, unsigned int action) | 40 | static void ssmtc_send_ipi_single(int cpu, unsigned int action) |
44 | { | 41 | { |
45 | #ifdef CONFIG_MIPS_MT_SMTC | ||
46 | smtc_send_ipi(cpu, LINUX_SMP_IPI, action); | 42 | smtc_send_ipi(cpu, LINUX_SMP_IPI, action); |
47 | #endif /* CONFIG_MIPS_MT_SMTC */ | 43 | /* "CPU" may be TC of same VPE, VPE of same CPU, or different CPU */ |
48 | /* "CPU" may be TC of same VPE, VPE of same CPU, or different CPU */ | 44 | } |
45 | |||
46 | static inline void ssmtc_send_ipi_mask(cpumask_t mask, unsigned int action) | ||
47 | { | ||
48 | unsigned int i; | ||
49 | 49 | ||
50 | for_each_cpu_mask(i, mask) | ||
51 | ssmtc_send_ipi_single(i, action); | ||
50 | } | 52 | } |
51 | 53 | ||
52 | /* | 54 | /* |
53 | * Platform "CPU" startup hook | 55 | * Post-config but pre-boot cleanup entry point |
54 | */ | 56 | */ |
55 | 57 | static void __cpuinit ssmtc_init_secondary(void) | |
56 | void __cpuinit prom_boot_secondary(int cpu, struct task_struct *idle) | ||
57 | { | 58 | { |
58 | #ifdef CONFIG_MIPS_MT_SMTC | 59 | void smtc_init_secondary(void); |
59 | smtc_boot_secondary(cpu, idle); | 60 | |
60 | #endif /* CONFIG_MIPS_MT_SMTC */ | 61 | smtc_init_secondary(); |
61 | } | 62 | } |
62 | 63 | ||
63 | /* | 64 | /* |
64 | * Post-config but pre-boot cleanup entry point | 65 | * SMP initialization finalization entry point |
65 | */ | 66 | */ |
67 | static void __cpuinit ssmtc_smp_finish(void) | ||
68 | { | ||
69 | smtc_smp_finish(); | ||
70 | } | ||
66 | 71 | ||
67 | void __cpuinit prom_init_secondary(void) | 72 | /* |
73 | * Hook for after all CPUs are online | ||
74 | */ | ||
75 | static void ssmtc_cpus_done(void) | ||
68 | { | 76 | { |
69 | #ifdef CONFIG_MIPS_MT_SMTC | 77 | } |
70 | void smtc_init_secondary(void); | ||
71 | 78 | ||
72 | smtc_init_secondary(); | 79 | /* |
73 | #endif /* CONFIG_MIPS_MT_SMTC */ | 80 | * Platform "CPU" startup hook |
81 | */ | ||
82 | static void __cpuinit ssmtc_boot_secondary(int cpu, struct task_struct *idle) | ||
83 | { | ||
84 | smtc_boot_secondary(cpu, idle); | ||
74 | } | 85 | } |
75 | 86 | ||
76 | void plat_smp_setup(void) | 87 | static void __init ssmtc_smp_setup(void) |
77 | { | 88 | { |
78 | #ifdef CONFIG_MIPS_MT_SMTC | ||
79 | if (read_c0_config3() & (1 << 2)) | 89 | if (read_c0_config3() & (1 << 2)) |
80 | mipsmt_build_cpu_map(0); | 90 | mipsmt_build_cpu_map(0); |
81 | #endif /* CONFIG_MIPS_MT_SMTC */ | ||
82 | } | 91 | } |
83 | 92 | ||
84 | /* | 93 | /* |
85 | * Platform SMP pre-initialization | 94 | * Platform SMP pre-initialization |
86 | */ | 95 | */ |
87 | 96 | static void ssmtc_prepare_cpus(unsigned int max_cpus) | |
88 | void plat_prepare_cpus(unsigned int max_cpus) | ||
89 | { | 97 | { |
90 | #ifdef CONFIG_MIPS_MT_SMTC | ||
91 | /* | 98 | /* |
92 | * As noted above, we can assume a single CPU for now | 99 | * As noted above, we can assume a single CPU for now |
93 | * but it may be multithreaded. | 100 | * but it may be multithreaded. |
@@ -96,28 +103,15 @@ void plat_prepare_cpus(unsigned int max_cpus) | |||
96 | if (read_c0_config3() & (1 << 2)) { | 103 | if (read_c0_config3() & (1 << 2)) { |
97 | mipsmt_prepare_cpus(); | 104 | mipsmt_prepare_cpus(); |
98 | } | 105 | } |
99 | #endif /* CONFIG_MIPS_MT_SMTC */ | ||
100 | } | 106 | } |
101 | 107 | ||
102 | /* | 108 | struct plat_smp_ops ssmtc_smp_ops = { |
103 | * SMP initialization finalization entry point | 109 | .send_ipi_single = ssmtc_send_ipi_single, |
104 | */ | 110 | .send_ipi_mask = ssmtc_send_ipi_mask, |
105 | 111 | .init_secondary = ssmtc_init_secondary, | |
106 | void __cpuinit prom_smp_finish(void) | 112 | .smp_finish = ssmtc_smp_finish, |
107 | { | 113 | .cpus_done = ssmtc_cpus_done, |
108 | #ifdef CONFIG_MIPS_MT_SMTC | 114 | .boot_secondary = ssmtc_boot_secondary, |
109 | smtc_smp_finish(); | 115 | .smp_setup = ssmtc_smp_setup, |
110 | #endif /* CONFIG_MIPS_MT_SMTC */ | 116 | .prepare_cpus = ssmtc_prepare_cpus, |
111 | } | 117 | }; |
112 | |||
113 | /* | ||
114 | * Hook for after all CPUs are online | ||
115 | */ | ||
116 | |||
117 | void prom_cpus_done(void) | ||
118 | { | ||
119 | #ifdef CONFIG_MIPS_MT_SMTC | ||
120 | |||
121 | #endif /* CONFIG_MIPS_MT_SMTC */ | ||
122 | } | ||
123 | #endif /* CONFIG_MIPS32R2_MT_SMP */ | ||