aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc/platforms/powernv/opal.c
diff options
context:
space:
mode:
authorVasant Hegde <hegdevasant@linux.vnet.ibm.com>2014-01-15 01:02:04 -0500
committerBenjamin Herrenschmidt <benh@kernel.crashing.org>2014-01-15 01:21:18 -0500
commitf7d98d18a01ece2863984d4fb5ae949b18b02715 (patch)
tree062fe89b801c7c017da5fc6403cab2f473492cb4 /arch/powerpc/platforms/powernv/opal.c
parentcb5b242c8c14a4b1dcd358400da28208fde78947 (diff)
powerpc/powernv: Call OPAL sync before kexec'ing
Its possible that OPAL may be writing to host memory during kexec (like dump retrieve scenario). In this situation we might end up corrupting host memory. This patch makes OPAL sync call to make sure OPAL stops writing to host memory before kexec'ing. Signed-off-by: Vasant Hegde <hegdevasant@linux.vnet.ibm.com> Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Diffstat (limited to 'arch/powerpc/platforms/powernv/opal.c')
-rw-r--r--arch/powerpc/platforms/powernv/opal.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/arch/powerpc/platforms/powernv/opal.c b/arch/powerpc/platforms/powernv/opal.c
index 7a184a0ff183..65499adaecff 100644
--- a/arch/powerpc/platforms/powernv/opal.c
+++ b/arch/powerpc/platforms/powernv/opal.c
@@ -20,6 +20,7 @@
20#include <linux/slab.h> 20#include <linux/slab.h>
21#include <linux/sched.h> 21#include <linux/sched.h>
22#include <linux/kobject.h> 22#include <linux/kobject.h>
23#include <linux/delay.h>
23#include <asm/opal.h> 24#include <asm/opal.h>
24#include <asm/firmware.h> 25#include <asm/firmware.h>
25#include <asm/mce.h> 26#include <asm/mce.h>
@@ -482,10 +483,25 @@ subsys_initcall(opal_init);
482void opal_shutdown(void) 483void opal_shutdown(void)
483{ 484{
484 unsigned int i; 485 unsigned int i;
486 long rc = OPAL_BUSY;
485 487
488 /* First free interrupts, which will also mask them */
486 for (i = 0; i < opal_irq_count; i++) { 489 for (i = 0; i < opal_irq_count; i++) {
487 if (opal_irqs[i]) 490 if (opal_irqs[i])
488 free_irq(opal_irqs[i], NULL); 491 free_irq(opal_irqs[i], NULL);
489 opal_irqs[i] = 0; 492 opal_irqs[i] = 0;
490 } 493 }
494
495 /*
496 * Then sync with OPAL which ensure anything that can
497 * potentially write to our memory has completed such
498 * as an ongoing dump retrieval
499 */
500 while (rc == OPAL_BUSY || rc == OPAL_BUSY_EVENT) {
501 rc = opal_sync_host_reboot();
502 if (rc == OPAL_BUSY)
503 opal_poll_events(NULL);
504 else
505 mdelay(10);
506 }
491} 507}