[include] cmake.mk: fix passing of LDFLAGS
[openwrt.git] / target / linux / malta / patches-3.0 / 001-mips-malta-fix-crash-smp-kernel-on-non-cmp-systems.patch
1 From d9a056919c4fa46cd9e094f969032bd4e15bffef Mon Sep 17 00:00:00 2001
2 From: Ralf Baechle <ralf@linux-mips.org>
3 Date: Sat, 28 May 2011 15:27:59 +0100
4 Subject: [PATCH] MIPS: Malta: Fix crash SMP kernel on non-CMP systems.
5
6 Since 6be63bbbdab66b9185dc6f67c8b1bacb6f37f946 (lmo) rsp.
7 af3a1f6f4813907e143f87030cde67a9971db533 (kernel.org) the Malta code does
8 no longer probe for presence of GCMP if CMP is not configured. This means
9 that the variable gcmp_present well be left at its default value of -1
10 which normally is meant to indicate that GCMP has not yet been mmapped.
11 This non-zero value is now interpreted as GCMP being present resulting
12 in a write attempt to a GCMP register resulting in a crash.
13
14 Reported and a build fix on top of my fix by Rob Landley <rob@landley.net>.
15
16 Reported-by: Rob Landley <rob@landley.net>
17 Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
18 Patchwork: https://patchwork.linux-mips.org/patch/2413/
19 (cherry picked from commit c3ddf592134eaab38d051b2e7b23e81201ae423a)
20 ---
21 arch/mips/include/asm/smp-ops.h | 41 +++++++++++++++++++++++++++--
22 arch/mips/mipssim/sim_setup.c | 17 ++++++------
23 arch/mips/mti-malta/malta-init.c | 14 +++++-----
24 arch/mips/pmc-sierra/msp71xx/msp_setup.c | 8 ++---
25 4 files changed, 56 insertions(+), 24 deletions(-)
26
27 --- a/arch/mips/include/asm/smp-ops.h
28 +++ b/arch/mips/include/asm/smp-ops.h
29 @@ -56,8 +56,43 @@ static inline void register_smp_ops(stru
30
31 #endif /* !CONFIG_SMP */
32
33 -extern struct plat_smp_ops up_smp_ops;
34 -extern struct plat_smp_ops cmp_smp_ops;
35 -extern struct plat_smp_ops vsmp_smp_ops;
36 +static inline int register_up_smp_ops(void)
37 +{
38 +#ifdef CONFIG_SMP_UP
39 + extern struct plat_smp_ops up_smp_ops;
40 +
41 + register_smp_ops(&up_smp_ops);
42 +
43 + return 0;
44 +#else
45 + return -ENODEV;
46 +#endif
47 +}
48 +
49 +static inline int register_cmp_smp_ops(void)
50 +{
51 +#ifdef CONFIG_MIPS_CMP
52 + extern struct plat_smp_ops cmp_smp_ops;
53 +
54 + register_smp_ops(&cmp_smp_ops);
55 +
56 + return 0;
57 +#else
58 + return -ENODEV;
59 +#endif
60 +}
61 +
62 +static inline int register_vsmp_smp_ops(void)
63 +{
64 +#ifdef CONFIG_MIPS_MT_SMP
65 + extern struct plat_smp_ops vsmp_smp_ops;
66 +
67 + register_smp_ops(&vsmp_smp_ops);
68 +
69 + return 0;
70 +#else
71 + return -ENODEV;
72 +#endif
73 +}
74
75 #endif /* __ASM_SMP_OPS_H */
76 --- a/arch/mips/mipssim/sim_setup.c
77 +++ b/arch/mips/mipssim/sim_setup.c
78 @@ -59,18 +59,17 @@ void __init prom_init(void)
79
80 prom_meminit();
81
82 -#ifdef CONFIG_MIPS_MT_SMP
83 - if (cpu_has_mipsmt)
84 - register_smp_ops(&vsmp_smp_ops);
85 - else
86 - register_smp_ops(&up_smp_ops);
87 -#endif
88 + if (cpu_has_mipsmt) {
89 + if (!register_vsmp_smp_ops())
90 + return;
91 +
92 #ifdef CONFIG_MIPS_MT_SMTC
93 - if (cpu_has_mipsmt)
94 register_smp_ops(&ssmtc_smp_ops);
95 - else
96 - register_smp_ops(&up_smp_ops);
97 + return;
98 #endif
99 + }
100 +
101 + register_up_smp_ops();
102 }
103
104 static void __init serial_init(void)
105 --- a/arch/mips/mti-malta/malta-init.c
106 +++ b/arch/mips/mti-malta/malta-init.c
107 @@ -28,6 +28,7 @@
108 #include <asm/io.h>
109 #include <asm/system.h>
110 #include <asm/cacheflush.h>
111 +#include <asm/smp-ops.h>
112 #include <asm/traps.h>
113
114 #include <asm/gcmpregs.h>
115 @@ -358,15 +359,14 @@ void __init prom_init(void)
116 #ifdef CONFIG_SERIAL_8250_CONSOLE
117 console_config();
118 #endif
119 -#ifdef CONFIG_MIPS_CMP
120 /* Early detection of CMP support */
121 if (gcmp_probe(GCMP_BASE_ADDR, GCMP_ADDRSPACE_SZ))
122 - register_smp_ops(&cmp_smp_ops);
123 - else
124 -#endif
125 -#ifdef CONFIG_MIPS_MT_SMP
126 - register_smp_ops(&vsmp_smp_ops);
127 -#endif
128 + if (!register_cmp_smp_ops())
129 + return;
130 +
131 + if (!register_vsmp_smp_ops())
132 + return;
133 +
134 #ifdef CONFIG_MIPS_MT_SMTC
135 register_smp_ops(&msmtc_smp_ops);
136 #endif
137 --- a/arch/mips/pmc-sierra/msp71xx/msp_setup.c
138 +++ b/arch/mips/pmc-sierra/msp71xx/msp_setup.c
139 @@ -228,13 +228,11 @@ void __init prom_init(void)
140 */
141 msp_serial_setup();
142
143 -#ifdef CONFIG_MIPS_MT_SMP
144 - register_smp_ops(&vsmp_smp_ops);
145 -#endif
146 -
147 + if (register_vsmp_smp_ops()) {
148 #ifdef CONFIG_MIPS_MT_SMTC
149 - register_smp_ops(&msp_smtc_smp_ops);
150 + register_smp_ops(&msp_smtc_smp_ops);
151 #endif
152 + }
153
154 #ifdef CONFIG_PMCTWILED
155 /*
This page took 0.047272 seconds and 5 git commands to generate.