Commit 852fe310 authored by Ralf Baechle's avatar Ralf Baechle

MIPS: Malta: Fix crash in SMP kernel on non-CMP systems.

Since 6be63bbb (lmo) rsp.
af3a1f6f (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: default avatarRob Landley <rob@landley.net>
Signed-off-by: default avatarRalf Baechle <ralf@linux-mips.org>
Patchwork: https://patchwork.linux-mips.org/patch/2413/
parent b12acf16
...@@ -56,8 +56,43 @@ static inline void register_smp_ops(struct plat_smp_ops *ops) ...@@ -56,8 +56,43 @@ static inline void register_smp_ops(struct plat_smp_ops *ops)
#endif /* !CONFIG_SMP */ #endif /* !CONFIG_SMP */
extern struct plat_smp_ops up_smp_ops; static inline int register_up_smp_ops(void)
extern struct plat_smp_ops cmp_smp_ops; {
extern struct plat_smp_ops vsmp_smp_ops; #ifdef CONFIG_SMP_UP
extern struct plat_smp_ops up_smp_ops;
register_smp_ops(&up_smp_ops);
return 0;
#else
return -ENODEV;
#endif
}
static inline int register_cmp_smp_ops(void)
{
#ifdef CONFIG_MIPS_CMP
extern struct plat_smp_ops cmp_smp_ops;
register_smp_ops(&cmp_smp_ops);
return 0;
#else
return -ENODEV;
#endif
}
static inline int register_vsmp_smp_ops(void)
{
#ifdef CONFIG_MIPS_MT_SMP
extern struct plat_smp_ops vsmp_smp_ops;
register_smp_ops(&vsmp_smp_ops);
return 0;
#else
return -ENODEV;
#endif
}
#endif /* __ASM_SMP_OPS_H */ #endif /* __ASM_SMP_OPS_H */
...@@ -59,18 +59,17 @@ void __init prom_init(void) ...@@ -59,18 +59,17 @@ void __init prom_init(void)
prom_meminit(); prom_meminit();
#ifdef CONFIG_MIPS_MT_SMP if (cpu_has_mipsmt) {
if (cpu_has_mipsmt) if (!register_vsmp_smp_ops())
register_smp_ops(&vsmp_smp_ops); return;
else
register_smp_ops(&up_smp_ops);
#endif
#ifdef CONFIG_MIPS_MT_SMTC #ifdef CONFIG_MIPS_MT_SMTC
if (cpu_has_mipsmt)
register_smp_ops(&ssmtc_smp_ops); register_smp_ops(&ssmtc_smp_ops);
else return;
register_smp_ops(&up_smp_ops);
#endif #endif
}
register_up_smp_ops();
} }
static void __init serial_init(void) static void __init serial_init(void)
......
...@@ -28,6 +28,7 @@ ...@@ -28,6 +28,7 @@
#include <asm/io.h> #include <asm/io.h>
#include <asm/system.h> #include <asm/system.h>
#include <asm/cacheflush.h> #include <asm/cacheflush.h>
#include <asm/smp-ops.h>
#include <asm/traps.h> #include <asm/traps.h>
#include <asm/gcmpregs.h> #include <asm/gcmpregs.h>
...@@ -358,15 +359,14 @@ void __init prom_init(void) ...@@ -358,15 +359,14 @@ void __init prom_init(void)
#ifdef CONFIG_SERIAL_8250_CONSOLE #ifdef CONFIG_SERIAL_8250_CONSOLE
console_config(); console_config();
#endif #endif
#ifdef CONFIG_MIPS_CMP
/* Early detection of CMP support */ /* Early detection of CMP support */
if (gcmp_probe(GCMP_BASE_ADDR, GCMP_ADDRSPACE_SZ)) if (gcmp_probe(GCMP_BASE_ADDR, GCMP_ADDRSPACE_SZ))
register_smp_ops(&cmp_smp_ops); if (!register_cmp_smp_ops())
else return;
#endif
#ifdef CONFIG_MIPS_MT_SMP if (!register_vsmp_smp_ops())
register_smp_ops(&vsmp_smp_ops); return;
#endif
#ifdef CONFIG_MIPS_MT_SMTC #ifdef CONFIG_MIPS_MT_SMTC
register_smp_ops(&msmtc_smp_ops); register_smp_ops(&msmtc_smp_ops);
#endif #endif
......
...@@ -228,13 +228,11 @@ void __init prom_init(void) ...@@ -228,13 +228,11 @@ void __init prom_init(void)
*/ */
msp_serial_setup(); msp_serial_setup();
#ifdef CONFIG_MIPS_MT_SMP if (register_vsmp_smp_ops()) {
register_smp_ops(&vsmp_smp_ops);
#endif
#ifdef CONFIG_MIPS_MT_SMTC #ifdef CONFIG_MIPS_MT_SMTC
register_smp_ops(&msp_smtc_smp_ops); register_smp_ops(&msp_smtc_smp_ops);
#endif #endif
}
#ifdef CONFIG_PMCTWILED #ifdef CONFIG_PMCTWILED
/* /*
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment