diff options
author | Ralf Baechle <ralf@linux-mips.org> | 2011-05-28 10:27:59 -0400 |
---|---|---|
committer | Ralf Baechle <ralf@linux-mips.org> | 2011-07-20 18:12:10 -0400 |
commit | 852fe3105e94ca26d1b3df7e2cb6878ebdd67608 (patch) | |
tree | b38949922e762e4310b105eec24a9df5352804e4 /arch | |
parent | b12acf163f6e52ff7d41aca51382dde17c506068 (diff) |
MIPS: Malta: Fix crash in SMP kernel on non-CMP systems.
Since 6be63bbbdab66b9185dc6f67c8b1bacb6f37f946 (lmo) rsp.
af3a1f6f4813907e143f87030cde67a9971db533 (kernel.org) the Malta code does
no longer probe for presence of GCMP if CMP is not configured. This means
that the variable gcmp_present well be left at its default value of -1
which normally is meant to indicate that GCMP has not yet been mmapped.
This non-zero value is now interpreted as GCMP being present resulting
in a write attempt to a GCMP register resulting in a crash.
Reported and a build fix on top of my fix by Rob Landley <rob@landley.net>.
Reported-by: Rob Landley <rob@landley.net>
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
Patchwork: https://patchwork.linux-mips.org/patch/2413/
Diffstat (limited to 'arch')
-rw-r--r-- | arch/mips/include/asm/smp-ops.h | 41 | ||||
-rw-r--r-- | arch/mips/mipssim/sim_setup.c | 17 | ||||
-rw-r--r-- | arch/mips/mti-malta/malta-init.c | 14 | ||||
-rw-r--r-- | arch/mips/pmc-sierra/msp71xx/msp_setup.c | 8 |
4 files changed, 56 insertions, 24 deletions
diff --git a/arch/mips/include/asm/smp-ops.h b/arch/mips/include/asm/smp-ops.h index 9e09af34c8a8..48b03fff31e5 100644 --- a/arch/mips/include/asm/smp-ops.h +++ b/arch/mips/include/asm/smp-ops.h | |||
@@ -56,8 +56,43 @@ static inline void register_smp_ops(struct plat_smp_ops *ops) | |||
56 | 56 | ||
57 | #endif /* !CONFIG_SMP */ | 57 | #endif /* !CONFIG_SMP */ |
58 | 58 | ||
59 | extern struct plat_smp_ops up_smp_ops; | 59 | static inline int register_up_smp_ops(void) |
60 | extern struct plat_smp_ops cmp_smp_ops; | 60 | { |
61 | extern struct plat_smp_ops vsmp_smp_ops; | 61 | #ifdef CONFIG_SMP_UP |
62 | extern struct plat_smp_ops up_smp_ops; | ||
63 | |||
64 | register_smp_ops(&up_smp_ops); | ||
65 | |||
66 | return 0; | ||
67 | #else | ||
68 | return -ENODEV; | ||
69 | #endif | ||
70 | } | ||
71 | |||
72 | static inline int register_cmp_smp_ops(void) | ||
73 | { | ||
74 | #ifdef CONFIG_MIPS_CMP | ||
75 | extern struct plat_smp_ops cmp_smp_ops; | ||
76 | |||
77 | register_smp_ops(&cmp_smp_ops); | ||
78 | |||
79 | return 0; | ||
80 | #else | ||
81 | return -ENODEV; | ||
82 | #endif | ||
83 | } | ||
84 | |||
85 | static inline int register_vsmp_smp_ops(void) | ||
86 | { | ||
87 | #ifdef CONFIG_MIPS_MT_SMP | ||
88 | extern struct plat_smp_ops vsmp_smp_ops; | ||
89 | |||
90 | register_smp_ops(&vsmp_smp_ops); | ||
91 | |||
92 | return 0; | ||
93 | #else | ||
94 | return -ENODEV; | ||
95 | #endif | ||
96 | } | ||
62 | 97 | ||
63 | #endif /* __ASM_SMP_OPS_H */ | 98 | #endif /* __ASM_SMP_OPS_H */ |
diff --git a/arch/mips/mipssim/sim_setup.c b/arch/mips/mipssim/sim_setup.c index 55f22a3afe61..19700696a847 100644 --- a/arch/mips/mipssim/sim_setup.c +++ b/arch/mips/mipssim/sim_setup.c | |||
@@ -59,18 +59,17 @@ void __init prom_init(void) | |||
59 | 59 | ||
60 | prom_meminit(); | 60 | prom_meminit(); |
61 | 61 | ||
62 | #ifdef CONFIG_MIPS_MT_SMP | 62 | if (cpu_has_mipsmt) { |
63 | if (cpu_has_mipsmt) | 63 | if (!register_vsmp_smp_ops()) |
64 | register_smp_ops(&vsmp_smp_ops); | 64 | return; |
65 | else | 65 | |
66 | register_smp_ops(&up_smp_ops); | ||
67 | #endif | ||
68 | #ifdef CONFIG_MIPS_MT_SMTC | 66 | #ifdef CONFIG_MIPS_MT_SMTC |
69 | if (cpu_has_mipsmt) | ||
70 | register_smp_ops(&ssmtc_smp_ops); | 67 | register_smp_ops(&ssmtc_smp_ops); |
71 | else | 68 | return; |
72 | register_smp_ops(&up_smp_ops); | ||
73 | #endif | 69 | #endif |
70 | } | ||
71 | |||
72 | register_up_smp_ops(); | ||
74 | } | 73 | } |
75 | 74 | ||
76 | static void __init serial_init(void) | 75 | static void __init serial_init(void) |
diff --git a/arch/mips/mti-malta/malta-init.c b/arch/mips/mti-malta/malta-init.c index 31180c321a1a..4b988b9a30d5 100644 --- a/arch/mips/mti-malta/malta-init.c +++ b/arch/mips/mti-malta/malta-init.c | |||
@@ -28,6 +28,7 @@ | |||
28 | #include <asm/io.h> | 28 | #include <asm/io.h> |
29 | #include <asm/system.h> | 29 | #include <asm/system.h> |
30 | #include <asm/cacheflush.h> | 30 | #include <asm/cacheflush.h> |
31 | #include <asm/smp-ops.h> | ||
31 | #include <asm/traps.h> | 32 | #include <asm/traps.h> |
32 | 33 | ||
33 | #include <asm/gcmpregs.h> | 34 | #include <asm/gcmpregs.h> |
@@ -358,15 +359,14 @@ void __init prom_init(void) | |||
358 | #ifdef CONFIG_SERIAL_8250_CONSOLE | 359 | #ifdef CONFIG_SERIAL_8250_CONSOLE |
359 | console_config(); | 360 | console_config(); |
360 | #endif | 361 | #endif |
361 | #ifdef CONFIG_MIPS_CMP | ||
362 | /* Early detection of CMP support */ | 362 | /* Early detection of CMP support */ |
363 | if (gcmp_probe(GCMP_BASE_ADDR, GCMP_ADDRSPACE_SZ)) | 363 | if (gcmp_probe(GCMP_BASE_ADDR, GCMP_ADDRSPACE_SZ)) |
364 | register_smp_ops(&cmp_smp_ops); | 364 | if (!register_cmp_smp_ops()) |
365 | else | 365 | return; |
366 | #endif | 366 | |
367 | #ifdef CONFIG_MIPS_MT_SMP | 367 | if (!register_vsmp_smp_ops()) |
368 | register_smp_ops(&vsmp_smp_ops); | 368 | return; |
369 | #endif | 369 | |
370 | #ifdef CONFIG_MIPS_MT_SMTC | 370 | #ifdef CONFIG_MIPS_MT_SMTC |
371 | register_smp_ops(&msmtc_smp_ops); | 371 | register_smp_ops(&msmtc_smp_ops); |
372 | #endif | 372 | #endif |
diff --git a/arch/mips/pmc-sierra/msp71xx/msp_setup.c b/arch/mips/pmc-sierra/msp71xx/msp_setup.c index 2413ea67877e..0abfbe04ffc9 100644 --- a/arch/mips/pmc-sierra/msp71xx/msp_setup.c +++ b/arch/mips/pmc-sierra/msp71xx/msp_setup.c | |||
@@ -228,13 +228,11 @@ void __init prom_init(void) | |||
228 | */ | 228 | */ |
229 | msp_serial_setup(); | 229 | msp_serial_setup(); |
230 | 230 | ||
231 | #ifdef CONFIG_MIPS_MT_SMP | 231 | if (register_vsmp_smp_ops()) { |
232 | register_smp_ops(&vsmp_smp_ops); | ||
233 | #endif | ||
234 | |||
235 | #ifdef CONFIG_MIPS_MT_SMTC | 232 | #ifdef CONFIG_MIPS_MT_SMTC |
236 | register_smp_ops(&msp_smtc_smp_ops); | 233 | register_smp_ops(&msp_smtc_smp_ops); |
237 | #endif | 234 | #endif |
235 | } | ||
238 | 236 | ||
239 | #ifdef CONFIG_PMCTWILED | 237 | #ifdef CONFIG_PMCTWILED |
240 | /* | 238 | /* |