···353353354354config KEXEC355355 bool "kexec system call (EXPERIMENTAL)"356356- depends on (PPC_BOOK3S || FSL_BOOKE || (44x && !SMP && !PPC_47x)) && EXPERIMENTAL356356+ depends on (PPC_BOOK3S || FSL_BOOKE || (44x && !SMP)) && EXPERIMENTAL357357 help358358 kexec is a system call that implements the ability to shutdown your359359 current kernel, and to start another kernel. It is like a reboot···370370371371config CRASH_DUMP372372 bool "Build a kdump crash kernel"373373- depends on PPC64 || 6xx || FSL_BOOKE || (44x && !SMP && !PPC_47x)373373+ depends on PPC64 || 6xx || FSL_BOOKE || (44x && !SMP)374374 select RELOCATABLE if PPC64 || 44x375375 select DYNAMIC_MEMSTART if FSL_BOOKE376376 help
···738738 mr r5, r31739739740740 li r0, 0741741-#elif defined(CONFIG_44x) && !defined(CONFIG_PPC_47x)741741+#elif defined(CONFIG_44x)742742743743+ /* Save our parameters */744744+ mr r29, r3745745+ mr r30, r4746746+ mr r31, r5747747+748748+#ifdef CONFIG_PPC_47x749749+ /* Check for 47x cores */750750+ mfspr r3,SPRN_PVR751751+ srwi r3,r3,16752752+ cmplwi cr0,r3,PVR_476@h753753+ beq setup_map_47x754754+ cmplwi cr0,r3,PVR_476_ISS@h755755+ beq setup_map_47x756756+#endif /* CONFIG_PPC_47x */757757+743758/*744759 * Code for setting up 1:1 mapping for PPC440x for KEXEC745760 *···768753 * 5) Invalidate the tmp mapping.769754 *770755 * - Based on the kexec support code for FSL BookE771771- * - Doesn't support 47x yet.772756 *773757 */774774- /* Save our parameters */775775- mr r29, r3776776- mr r30, r4777777- mr r31, r5778758779779- /* Load our MSR_IS and TID to MMUCR for TLB search */780780- mfspr r3,SPRN_PID759759+ /* 760760+ * Load the PID with kernel PID (0).761761+ * Also load our MSR_IS and TID to MMUCR for TLB search.762762+ */763763+ li r3, 0764764+ mtspr SPRN_PID, r3781765 mfmsr r4782766 andi. r4,r4,MSR_IS@l783767 beq wmmucr···914900 li r3, 0915901 tlbwe r3, r24, PPC44x_TLB_PAGEID916902 sync903903+ b ppc44x_map_done904904+905905+#ifdef CONFIG_PPC_47x906906+907907+ /* 1:1 mapping for 47x */908908+909909+setup_map_47x:910910+911911+ /*912912+ * Load the kernel pid (0) to PID and also to MMUCR[TID].913913+ * Also set the MSR IS->MMUCR STS914914+ */915915+ li r3, 0916916+ mtspr SPRN_PID, r3 /* Set PID */917917+ mfmsr r4 /* Get MSR */918918+ andi. r4, r4, MSR_IS@l /* TS=1? */919919+ beq 1f /* If not, leave STS=0 */920920+ oris r3, r3, PPC47x_MMUCR_STS@h /* Set STS=1 */921921+1: mtspr SPRN_MMUCR, r3 /* Put MMUCR */922922+ sync923923+924924+ /* Find the entry we are running from */925925+ bl 2f926926+2: mflr r23927927+ tlbsx r23, 0, r23928928+ tlbre r24, r23, 0 /* TLB Word 0 */929929+ tlbre r25, r23, 1 /* TLB Word 1 */930930+ tlbre r26, r23, 2 /* TLB Word 2 */931931+932932+933933+ /*934934+ * Invalidates all the tlb entries by writing to 256 RPNs(r4)935935+ * of 4k page size in all 4 ways (0-3 in r3).936936+ * This would invalidate the entire UTLB including the one we are937937+ * running from. However the shadow TLB entries would help us 938938+ * to continue the execution, until we flush them (rfi/isync).939939+ */940940+ addis r3, 0, 0x8000 /* specify the way */941941+ addi r4, 0, 0 /* TLB Word0 = (EPN=0, VALID = 0) */942942+ addi r5, 0, 0943943+ b clear_utlb_entry944944+945945+ /* Align the loop to speed things up. from head_44x.S */946946+ .align 6947947+948948+clear_utlb_entry:949949+950950+ tlbwe r4, r3, 0951951+ tlbwe r5, r3, 1952952+ tlbwe r5, r3, 2953953+ addis r3, r3, 0x2000 /* Increment the way */954954+ cmpwi r3, 0955955+ bne clear_utlb_entry956956+ addis r3, 0, 0x8000957957+ addis r4, r4, 0x100 /* Increment the EPN */958958+ cmpwi r4, 0959959+ bne clear_utlb_entry960960+961961+ /* Create the entries in the other address space */962962+ mfmsr r5963963+ rlwinm r7, r5, 27, 31, 31 /* Get the TS (Bit 26) from MSR */964964+ xori r7, r7, 1 /* r7 = !TS */965965+966966+ insrwi r24, r7, 1, 21 /* Change the TS in the saved TLB word 0 */967967+968968+ /* 969969+ * write out the TLB entries for the tmp mapping970970+ * Use way '0' so that we could easily invalidate it later.971971+ */972972+ lis r3, 0x8000 /* Way '0' */ 973973+974974+ tlbwe r24, r3, 0975975+ tlbwe r25, r3, 1976976+ tlbwe r26, r3, 2977977+978978+ /* Update the msr to the new TS */979979+ insrwi r5, r7, 1, 26980980+981981+ bl 1f982982+1: mflr r6983983+ addi r6, r6, (2f-1b)984984+985985+ mtspr SPRN_SRR0, r6986986+ mtspr SPRN_SRR1, r5987987+ rfi988988+989989+ /* 990990+ * Now we are in the tmp address space.991991+ * Create a 1:1 mapping for 0-2GiB in the original TS.992992+ */993993+2:994994+ li r3, 0995995+ li r4, 0 /* TLB Word 0 */996996+ li r5, 0 /* TLB Word 1 */997997+ li r6, 0998998+ ori r6, r6, PPC47x_TLB2_S_RWX /* TLB word 2 */999999+10001000+ li r8, 0 /* PageIndex */10011001+10021002+ xori r7, r7, 1 /* revert back to original TS */10031003+10041004+write_utlb:10051005+ rotlwi r5, r8, 28 /* RPN = PageIndex * 256M */10061006+ /* ERPN = 0 as we don't use memory above 2G */10071007+10081008+ mr r4, r5 /* EPN = RPN */10091009+ ori r4, r4, (PPC47x_TLB0_VALID | PPC47x_TLB0_256M)10101010+ insrwi r4, r7, 1, 21 /* Insert the TS to Word 0 */10111011+10121012+ tlbwe r4, r3, 0 /* Write out the entries */10131013+ tlbwe r5, r3, 110141014+ tlbwe r6, r3, 210151015+ addi r8, r8, 110161016+ cmpwi r8, 8 /* Have we completed ? */10171017+ bne write_utlb10181018+10191019+ /* make sure we complete the TLB write up */10201020+ isync10211021+10221022+ /* 10231023+ * Prepare to jump to the 1:1 mapping.10241024+ * 1) Extract page size of the tmp mapping10251025+ * DSIZ = TLB_Word0[22:27]10261026+ * 2) Calculate the physical address of the address10271027+ * to jump to.10281028+ */10291029+ rlwinm r10, r24, 0, 22, 2710301030+10311031+ cmpwi r10, PPC47x_TLB0_4K10321032+ bne 0f10331033+ li r10, 0x1000 /* r10 = 4k */10341034+ bl 1f10351035+10361036+0:10371037+ /* Defaults to 256M */10381038+ lis r10, 0x100010391039+10401040+ bl 1f10411041+1: mflr r410421042+ addi r4, r4, (2f-1b) /* virtual address of 2f */10431043+10441044+ subi r11, r10, 1 /* offsetmask = Pagesize - 1 */10451045+ not r10, r11 /* Pagemask = ~(offsetmask) */10461046+10471047+ and r5, r25, r10 /* Physical page */10481048+ and r6, r4, r11 /* offset within the current page */10491049+10501050+ or r5, r5, r6 /* Physical address for 2f */10511051+10521052+ /* Switch the TS in MSR to the original one */10531053+ mfmsr r810541054+ insrwi r8, r7, 1, 2610551055+10561056+ mtspr SPRN_SRR1, r810571057+ mtspr SPRN_SRR0, r510581058+ rfi10591059+10601060+2:10611061+ /* Invalidate the tmp mapping */10621062+ lis r3, 0x8000 /* Way '0' */10631063+10641064+ clrrwi r24, r24, 12 /* Clear the valid bit */10651065+ tlbwe r24, r3, 010661066+ tlbwe r25, r3, 110671067+ tlbwe r26, r3, 210681068+10691069+ /* Make sure we complete the TLB write and flush the shadow TLB */10701070+ isync10711071+10721072+#endif10731073+10741074+ppc44x_map_done:10751075+91710769181077 /* Restore the parameters */9191078 mr r3, r29