]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
powerpc/book3e-64: Enable kexec
authorTiejun Chen <tiejun.chen@windriver.com>
Wed, 7 Oct 2015 03:48:22 +0000 (22:48 -0500)
committerScott Wood <scottwood@freescale.com>
Tue, 27 Oct 2015 23:13:30 +0000 (18:13 -0500)
Allow KEXEC for book3e, and bypass or convert non-book3e stuff
in kexec code.

Signed-off-by: Tiejun Chen <tiejun.chen@windriver.com>
[scottwood@freescale.com: move code to minimize diff, and cleanup]
Signed-off-by: Scott Wood <scottwood@freescale.com>
arch/powerpc/Kconfig
arch/powerpc/kernel/machine_kexec_64.c
arch/powerpc/kernel/misc_64.S

index 9a7057ec21541a09af3cedc4e49350852cba1791..db49e0d796b1bf50642365aa92d63c5a83a07320 100644 (file)
@@ -419,7 +419,7 @@ config PPC64_SUPPORTS_MEMORY_FAILURE
 
 config KEXEC
        bool "kexec system call"
-       depends on (PPC_BOOK3S || FSL_BOOKE || (44x && !SMP))
+       depends on (PPC_BOOK3S || FSL_BOOKE || (44x && !SMP)) || PPC_BOOK3E
        select KEXEC_CORE
        help
          kexec is a system call that implements the ability to shutdown your
index 1a74446fd9e5a38c0535e8ec77b057fe8e80fbd5..0fbd75d185d7e5dd315341bfaecaef9f01dc794f 100644 (file)
 #include <asm/smp.h>
 #include <asm/hw_breakpoint.h>
 
+#ifdef CONFIG_PPC_BOOK3E
+int default_machine_kexec_prepare(struct kimage *image)
+{
+       int i;
+       /*
+        * Since we use the kernel fault handlers and paging code to
+        * handle the virtual mode, we must make sure no destination
+        * overlaps kernel static data or bss.
+        */
+       for (i = 0; i < image->nr_segments; i++)
+               if (image->segment[i].mem < __pa(_end))
+                       return -ETXTBSY;
+       return 0;
+}
+#else
 int default_machine_kexec_prepare(struct kimage *image)
 {
        int i;
@@ -95,6 +110,7 @@ int default_machine_kexec_prepare(struct kimage *image)
 
        return 0;
 }
+#endif /* !CONFIG_PPC_BOOK3E */
 
 static void copy_segments(unsigned long ind)
 {
@@ -365,6 +381,7 @@ void default_machine_kexec(struct kimage *image)
        /* NOTREACHED */
 }
 
+#ifndef CONFIG_PPC_BOOK3E
 /* Values we need to export to the second kernel via the device tree. */
 static unsigned long htab_base;
 static unsigned long htab_size;
@@ -411,3 +428,4 @@ static int __init export_htab_values(void)
        return 0;
 }
 late_initcall(export_htab_values);
+#endif /* !CONFIG_PPC_BOOK3E */
index ddbc535a6d0f4792141f1f0466802060b7492224..db475d41b57a5d4b5313d11f4494792c6070dc67 100644 (file)
@@ -631,9 +631,13 @@ _GLOBAL(kexec_sequence)
        lhz     r25,PACAHWCPUID(r13)    /* get our phys cpu from paca */
 
        /* disable interrupts, we are overwriting kernel data next */
+#ifdef CONFIG_PPC_BOOK3E
+       wrteei  0
+#else
        mfmsr   r3
        rlwinm  r3,r3,0,17,15
        mtmsrd  r3,1
+#endif
 
        /* copy dest pages, flush whole dest image */
        mr      r3,r29
@@ -655,6 +659,7 @@ _GLOBAL(kexec_sequence)
        li      r6,1
        stw     r6,kexec_flag-1b(5)
 
+#ifndef CONFIG_PPC_BOOK3E
        /* clear out hardware hash page table and tlb */
 #if !defined(_CALL_ELF) || _CALL_ELF != 2
        ld      r12,0(r27)              /* deref function descriptor */
@@ -663,6 +668,7 @@ _GLOBAL(kexec_sequence)
 #endif
        mtctr   r12
        bctrl                           /* ppc_md.hpte_clear_all(void); */
+#endif /* !CONFIG_PPC_BOOK3E */
 
 /*
  *   kexec image calling is: