aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc/platforms/pseries
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2011-01-21 16:23:52 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2011-01-21 16:23:52 -0500
commitd41ad6df44fbd01837211cee3273ce2f9445be6e (patch)
tree2c67f9202b0db775a9b38fc121f4190433e1aef0 /arch/powerpc/platforms/pseries
parent3dece370ecc7c6152b3fdd21c6de28179f6e643d (diff)
parent8bfc5e36619e8464bf529137f834f55bd75de381 (diff)
Merge branch 'merge' of git://git.kernel.org/pub/scm/linux/kernel/git/benh/powerpc
* 'merge' of git://git.kernel.org/pub/scm/linux/kernel/git/benh/powerpc: (34 commits) powerpc/mpic: Fix mask/unmask timeout message powerpc/pseries: Add BNX2=m to defconfig powerpc: Enable 64kB pages and 1024 threads in pseries config powerpc: Disable mcount tracers in pseries defconfig powerpc/boot/dts: Install dts from the right directory powerpc: machine_check_generic is wrong on 64bit powerpc: Check RTAS extended log flag before checking length powerpc: Fix corruption when grabbing FWNMI data powerpc: Rework pseries machine check handler powerpc: Don't silently handle machine checks from userspace powerpc: Remove duplicate debugger hook in machine_check_exception powerpc: Never halt RTAS error logging after receiving an unrecoverable machine check powerpc: Don't force MSR_RI in machine_check_exception powerpc: Print 32 bits of DSISR in show_regs powerpc/kdump: Disable ftrace during kexec powerpc/kdump: Move crash_kexec_stop_spus to kdump crash handler powerpc/kexec: Remove empty ppc_md.machine_kexec_prepare powerpc/kexec: Don't initialise kexec hooks to default handlers powerpc/kdump: Remove ppc_md.machine_crash_shutdown powerpc/kexec: Remove ppc_md.machine_kexec ...
Diffstat (limited to 'arch/powerpc/platforms/pseries')
-rw-r--r--arch/powerpc/platforms/pseries/kexec.c10
-rw-r--r--arch/powerpc/platforms/pseries/ras.c102
2 files changed, 69 insertions, 43 deletions
diff --git a/arch/powerpc/platforms/pseries/kexec.c b/arch/powerpc/platforms/pseries/kexec.c
index 53cbd53d874..77d38a5e2ff 100644
--- a/arch/powerpc/platforms/pseries/kexec.c
+++ b/arch/powerpc/platforms/pseries/kexec.c
@@ -61,13 +61,3 @@ void __init setup_kexec_cpu_down_xics(void)
61{ 61{
62 ppc_md.kexec_cpu_down = pseries_kexec_cpu_down_xics; 62 ppc_md.kexec_cpu_down = pseries_kexec_cpu_down_xics;
63} 63}
64
65static int __init pseries_kexec_setup(void)
66{
67 ppc_md.machine_kexec = default_machine_kexec;
68 ppc_md.machine_kexec_prepare = default_machine_kexec_prepare;
69 ppc_md.machine_crash_shutdown = default_machine_crash_shutdown;
70
71 return 0;
72}
73machine_device_initcall(pseries, pseries_kexec_setup);
diff --git a/arch/powerpc/platforms/pseries/ras.c b/arch/powerpc/platforms/pseries/ras.c
index a4fc6da87c2..c55d7ad9c64 100644
--- a/arch/powerpc/platforms/pseries/ras.c
+++ b/arch/powerpc/platforms/pseries/ras.c
@@ -54,7 +54,8 @@
54static unsigned char ras_log_buf[RTAS_ERROR_LOG_MAX]; 54static unsigned char ras_log_buf[RTAS_ERROR_LOG_MAX];
55static DEFINE_SPINLOCK(ras_log_buf_lock); 55static DEFINE_SPINLOCK(ras_log_buf_lock);
56 56
57static char mce_data_buf[RTAS_ERROR_LOG_MAX]; 57static char global_mce_data_buf[RTAS_ERROR_LOG_MAX];
58static DEFINE_PER_CPU(__u64, mce_data_buf);
58 59
59static int ras_get_sensor_state_token; 60static int ras_get_sensor_state_token;
60static int ras_check_exception_token; 61static int ras_check_exception_token;
@@ -196,12 +197,24 @@ static irqreturn_t ras_error_interrupt(int irq, void *dev_id)
196 return IRQ_HANDLED; 197 return IRQ_HANDLED;
197} 198}
198 199
199/* Get the error information for errors coming through the 200/*
201 * Some versions of FWNMI place the buffer inside the 4kB page starting at
202 * 0x7000. Other versions place it inside the rtas buffer. We check both.
203 */
204#define VALID_FWNMI_BUFFER(A) \
205 ((((A) >= 0x7000) && ((A) < 0x7ff0)) || \
206 (((A) >= rtas.base) && ((A) < (rtas.base + rtas.size - 16))))
207
208/*
209 * Get the error information for errors coming through the
200 * FWNMI vectors. The pt_regs' r3 will be updated to reflect 210 * FWNMI vectors. The pt_regs' r3 will be updated to reflect
201 * the actual r3 if possible, and a ptr to the error log entry 211 * the actual r3 if possible, and a ptr to the error log entry
202 * will be returned if found. 212 * will be returned if found.
203 * 213 *
204 * The mce_data_buf does not have any locks or protection around it, 214 * If the RTAS error is not of the extended type, then we put it in a per
215 * cpu 64bit buffer. If it is the extended type we use global_mce_data_buf.
216 *
217 * The global_mce_data_buf does not have any locks or protection around it,
205 * if a second machine check comes in, or a system reset is done 218 * if a second machine check comes in, or a system reset is done
206 * before we have logged the error, then we will get corruption in the 219 * before we have logged the error, then we will get corruption in the
207 * error log. This is preferable over holding off on calling 220 * error log. This is preferable over holding off on calling
@@ -210,20 +223,31 @@ static irqreturn_t ras_error_interrupt(int irq, void *dev_id)
210 */ 223 */
211static struct rtas_error_log *fwnmi_get_errinfo(struct pt_regs *regs) 224static struct rtas_error_log *fwnmi_get_errinfo(struct pt_regs *regs)
212{ 225{
213 unsigned long errdata = regs->gpr[3];
214 struct rtas_error_log *errhdr = NULL;
215 unsigned long *savep; 226 unsigned long *savep;
227 struct rtas_error_log *h, *errhdr = NULL;
228
229 if (!VALID_FWNMI_BUFFER(regs->gpr[3])) {
230 printk(KERN_ERR "FWNMI: corrupt r3\n");
231 return NULL;
232 }
216 233
217 if ((errdata >= 0x7000 && errdata < 0x7fff0) || 234 savep = __va(regs->gpr[3]);
218 (errdata >= rtas.base && errdata < rtas.base + rtas.size - 16)) { 235 regs->gpr[3] = savep[0]; /* restore original r3 */
219 savep = __va(errdata); 236
220 regs->gpr[3] = savep[0]; /* restore original r3 */ 237 /* If it isn't an extended log we can use the per cpu 64bit buffer */
221 memset(mce_data_buf, 0, RTAS_ERROR_LOG_MAX); 238 h = (struct rtas_error_log *)&savep[1];
222 memcpy(mce_data_buf, (char *)(savep + 1), RTAS_ERROR_LOG_MAX); 239 if (!h->extended) {
223 errhdr = (struct rtas_error_log *)mce_data_buf; 240 memcpy(&__get_cpu_var(mce_data_buf), h, sizeof(__u64));
241 errhdr = (struct rtas_error_log *)&__get_cpu_var(mce_data_buf);
224 } else { 242 } else {
225 printk("FWNMI: corrupt r3\n"); 243 int len;
244
245 len = max_t(int, 8+h->extended_log_length, RTAS_ERROR_LOG_MAX);
246 memset(global_mce_data_buf, 0, RTAS_ERROR_LOG_MAX);
247 memcpy(global_mce_data_buf, h, len);
248 errhdr = (struct rtas_error_log *)global_mce_data_buf;
226 } 249 }
250
227 return errhdr; 251 return errhdr;
228} 252}
229 253
@@ -235,7 +259,7 @@ static void fwnmi_release_errinfo(void)
235{ 259{
236 int ret = rtas_call(rtas_token("ibm,nmi-interlock"), 0, 1, NULL); 260 int ret = rtas_call(rtas_token("ibm,nmi-interlock"), 0, 1, NULL);
237 if (ret != 0) 261 if (ret != 0)
238 printk("FWNMI: nmi-interlock failed: %d\n", ret); 262 printk(KERN_ERR "FWNMI: nmi-interlock failed: %d\n", ret);
239} 263}
240 264
241int pSeries_system_reset_exception(struct pt_regs *regs) 265int pSeries_system_reset_exception(struct pt_regs *regs)
@@ -259,31 +283,43 @@ int pSeries_system_reset_exception(struct pt_regs *regs)
259 * Return 1 if corrected (or delivered a signal). 283 * Return 1 if corrected (or delivered a signal).
260 * Return 0 if there is nothing we can do. 284 * Return 0 if there is nothing we can do.
261 */ 285 */
262static int recover_mce(struct pt_regs *regs, struct rtas_error_log * err) 286static int recover_mce(struct pt_regs *regs, struct rtas_error_log *err)
263{ 287{
264 int nonfatal = 0; 288 int recovered = 0;
265 289
266 if (err->disposition == RTAS_DISP_FULLY_RECOVERED) { 290 if (!(regs->msr & MSR_RI)) {
291 /* If MSR_RI isn't set, we cannot recover */
292 recovered = 0;
293
294 } else if (err->disposition == RTAS_DISP_FULLY_RECOVERED) {
267 /* Platform corrected itself */ 295 /* Platform corrected itself */
268 nonfatal = 1; 296 recovered = 1;
269 } else if ((regs->msr & MSR_RI) && 297
270 user_mode(regs) && 298 } else if (err->disposition == RTAS_DISP_LIMITED_RECOVERY) {
271 err->severity == RTAS_SEVERITY_ERROR_SYNC && 299 /* Platform corrected itself but could be degraded */
272 err->disposition == RTAS_DISP_NOT_RECOVERED && 300 printk(KERN_ERR "MCE: limited recovery, system may "
273 err->target == RTAS_TARGET_MEMORY && 301 "be degraded\n");
274 err->type == RTAS_TYPE_ECC_UNCORR && 302 recovered = 1;
275 !(current->pid == 0 || is_global_init(current))) { 303
276 /* Kill off a user process with an ECC error */ 304 } else if (user_mode(regs) && !is_global_init(current) &&
277 printk(KERN_ERR "MCE: uncorrectable ecc error for pid %d\n", 305 err->severity == RTAS_SEVERITY_ERROR_SYNC) {
278 current->pid); 306
279 /* XXX something better for ECC error? */ 307 /*
280 _exception(SIGBUS, regs, BUS_ADRERR, regs->nip); 308 * If we received a synchronous error when in userspace
281 nonfatal = 1; 309 * kill the task. Firmware may report details of the fail
310 * asynchronously, so we can't rely on the target and type
311 * fields being valid here.
312 */
313 printk(KERN_ERR "MCE: uncorrectable error, killing task "
314 "%s:%d\n", current->comm, current->pid);
315
316 _exception(SIGBUS, regs, BUS_MCEERR_AR, regs->nip);
317 recovered = 1;
282 } 318 }
283 319
284 log_error((char *)err, ERR_TYPE_RTAS_LOG, !nonfatal); 320 log_error((char *)err, ERR_TYPE_RTAS_LOG, 0);
285 321
286 return nonfatal; 322 return recovered;
287} 323}
288 324
289/* 325/*