ar71xx: add a workaround for ar8316 not always driving the TA bit to low
[openwrt.git] / target / linux / malta / patches-2.6.39 / 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 diff --git a/arch/mips/include/asm/smp-ops.h b/arch/mips/include/asm/smp-ops.h
28 index 9e09af3..48b03ff 100644
29 --- a/arch/mips/include/asm/smp-ops.h
30 +++ b/arch/mips/include/asm/smp-ops.h
31 @@ -56,8 +56,43 @@ static inline void register_smp_ops(struct plat_smp_ops *ops)
32
33 #endif /* !CONFIG_SMP */
34
35 -extern struct plat_smp_ops up_smp_ops;
36 -extern struct plat_smp_ops cmp_smp_ops;
37 -extern struct plat_smp_ops vsmp_smp_ops;
38 +static inline int register_up_smp_ops(void)
39 +{
40 +#ifdef CONFIG_SMP_UP
41 + extern struct plat_smp_ops up_smp_ops;
42 +
43 + register_smp_ops(&up_smp_ops);
44 +
45 + return 0;
46 +#else
47 + return -ENODEV;
48 +#endif
49 +}
50 +
51 +static inline int register_cmp_smp_ops(void)
52 +{
53 +#ifdef CONFIG_MIPS_CMP
54 + extern struct plat_smp_ops cmp_smp_ops;
55 +
56 + register_smp_ops(&cmp_smp_ops);
57 +
58 + return 0;
59 +#else
60 + return -ENODEV;
61 +#endif
62 +}
63 +
64 +static inline int register_vsmp_smp_ops(void)
65 +{
66 +#ifdef CONFIG_MIPS_MT_SMP
67 + extern struct plat_smp_ops vsmp_smp_ops;
68 +
69 + register_smp_ops(&vsmp_smp_ops);
70 +
71 + return 0;
72 +#else
73 + return -ENODEV;
74 +#endif
75 +}
76
77 #endif /* __ASM_SMP_OPS_H */
78 diff --git a/arch/mips/mipssim/sim_setup.c b/arch/mips/mipssim/sim_setup.c
79 index 55f22a3..1970069 100644
80 --- a/arch/mips/mipssim/sim_setup.c
81 +++ b/arch/mips/mipssim/sim_setup.c
82 @@ -59,18 +59,17 @@ void __init prom_init(void)
83
84 prom_meminit();
85
86 -#ifdef CONFIG_MIPS_MT_SMP
87 - if (cpu_has_mipsmt)
88 - register_smp_ops(&vsmp_smp_ops);
89 - else
90 - register_smp_ops(&up_smp_ops);
91 -#endif
92 + if (cpu_has_mipsmt) {
93 + if (!register_vsmp_smp_ops())
94 + return;
95 +
96 #ifdef CONFIG_MIPS_MT_SMTC
97 - if (cpu_has_mipsmt)
98 register_smp_ops(&ssmtc_smp_ops);
99 - else
100 - register_smp_ops(&up_smp_ops);
101 + return;
102 #endif
103 + }
104 +
105 + register_up_smp_ops();
106 }
107
108 static void __init serial_init(void)
109 diff --git a/arch/mips/mti-malta/malta-init.c b/arch/mips/mti-malta/malta-init.c
110 index 31180c3..4b988b9 100644
111 --- a/arch/mips/mti-malta/malta-init.c
112 +++ b/arch/mips/mti-malta/malta-init.c
113 @@ -28,6 +28,7 @@
114 #include <asm/io.h>
115 #include <asm/system.h>
116 #include <asm/cacheflush.h>
117 +#include <asm/smp-ops.h>
118 #include <asm/traps.h>
119
120 #include <asm/gcmpregs.h>
121 @@ -358,15 +359,14 @@ void __init prom_init(void)
122 #ifdef CONFIG_SERIAL_8250_CONSOLE
123 console_config();
124 #endif
125 -#ifdef CONFIG_MIPS_CMP
126 /* Early detection of CMP support */
127 if (gcmp_probe(GCMP_BASE_ADDR, GCMP_ADDRSPACE_SZ))
128 - register_smp_ops(&cmp_smp_ops);
129 - else
130 -#endif
131 -#ifdef CONFIG_MIPS_MT_SMP
132 - register_smp_ops(&vsmp_smp_ops);
133 -#endif
134 + if (!register_cmp_smp_ops())
135 + return;
136 +
137 + if (!register_vsmp_smp_ops())
138 + return;
139 +
140 #ifdef CONFIG_MIPS_MT_SMTC
141 register_smp_ops(&msmtc_smp_ops);
142 #endif
143 diff --git a/arch/mips/pmc-sierra/msp71xx/msp_setup.c b/arch/mips/pmc-sierra/msp71xx/msp_setup.c
144 index 2413ea6..0abfbe0 100644
145 --- a/arch/mips/pmc-sierra/msp71xx/msp_setup.c
146 +++ b/arch/mips/pmc-sierra/msp71xx/msp_setup.c
147 @@ -228,13 +228,11 @@ void __init prom_init(void)
148 */
149 msp_serial_setup();
150
151 -#ifdef CONFIG_MIPS_MT_SMP
152 - register_smp_ops(&vsmp_smp_ops);
153 -#endif
154 -
155 + if (register_vsmp_smp_ops()) {
156 #ifdef CONFIG_MIPS_MT_SMTC
157 - register_smp_ops(&msp_smtc_smp_ops);
158 + register_smp_ops(&msp_smtc_smp_ops);
159 #endif
160 + }
161
162 #ifdef CONFIG_PMCTWILED
163 /*
164 --
165 1.7.3.4
166
This page took 0.051057 seconds and 5 git commands to generate.