Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

powerpc/book3e-64: Enable kexec

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>

authored by

Tiejun Chen and committed by
Scott Wood
96eea642 ae73e4cc

+25 -1
+1 -1
arch/powerpc/Kconfig
··· 419 419 420 420 config KEXEC 421 421 bool "kexec system call" 422 - depends on (PPC_BOOK3S || FSL_BOOKE || (44x && !SMP)) 422 + depends on (PPC_BOOK3S || FSL_BOOKE || (44x && !SMP)) || PPC_BOOK3E 423 423 select KEXEC_CORE 424 424 help 425 425 kexec is a system call that implements the ability to shutdown your
+18
arch/powerpc/kernel/machine_kexec_64.c
··· 30 30 #include <asm/smp.h> 31 31 #include <asm/hw_breakpoint.h> 32 32 33 + #ifdef CONFIG_PPC_BOOK3E 34 + int default_machine_kexec_prepare(struct kimage *image) 35 + { 36 + int i; 37 + /* 38 + * Since we use the kernel fault handlers and paging code to 39 + * handle the virtual mode, we must make sure no destination 40 + * overlaps kernel static data or bss. 41 + */ 42 + for (i = 0; i < image->nr_segments; i++) 43 + if (image->segment[i].mem < __pa(_end)) 44 + return -ETXTBSY; 45 + return 0; 46 + } 47 + #else 33 48 int default_machine_kexec_prepare(struct kimage *image) 34 49 { 35 50 int i; ··· 110 95 111 96 return 0; 112 97 } 98 + #endif /* !CONFIG_PPC_BOOK3E */ 113 99 114 100 static void copy_segments(unsigned long ind) 115 101 { ··· 381 365 /* NOTREACHED */ 382 366 } 383 367 368 + #ifndef CONFIG_PPC_BOOK3E 384 369 /* Values we need to export to the second kernel via the device tree. */ 385 370 static unsigned long htab_base; 386 371 static unsigned long htab_size; ··· 428 411 return 0; 429 412 } 430 413 late_initcall(export_htab_values); 414 + #endif /* !CONFIG_PPC_BOOK3E */
+6
arch/powerpc/kernel/misc_64.S
··· 631 631 lhz r25,PACAHWCPUID(r13) /* get our phys cpu from paca */ 632 632 633 633 /* disable interrupts, we are overwriting kernel data next */ 634 + #ifdef CONFIG_PPC_BOOK3E 635 + wrteei 0 636 + #else 634 637 mfmsr r3 635 638 rlwinm r3,r3,0,17,15 636 639 mtmsrd r3,1 640 + #endif 637 641 638 642 /* copy dest pages, flush whole dest image */ 639 643 mr r3,r29 ··· 659 655 li r6,1 660 656 stw r6,kexec_flag-1b(5) 661 657 658 + #ifndef CONFIG_PPC_BOOK3E 662 659 /* clear out hardware hash page table and tlb */ 663 660 #if !defined(_CALL_ELF) || _CALL_ELF != 2 664 661 ld r12,0(r27) /* deref function descriptor */ ··· 668 663 #endif 669 664 mtctr r12 670 665 bctrl /* ppc_md.hpte_clear_all(void); */ 666 + #endif /* !CONFIG_PPC_BOOK3E */ 671 667 672 668 /* 673 669 * kexec image calling is: