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

powerpc: Move bad_stack() below the fwnmi_data_area

At the moment the allmodconfig build is failing because we run out of
space between altivec_assist() at 0x5700 and the fwnmi_data_area at
0x7000.

Fixing it permanently will take some more work, but a quick fix is to
move bad_stack() below the fwnmi_data_area. That gives us just enough
room with everything enabled.

bad_stack() is called from the common exception handlers, but it's a
non-conditional branch, so we have plenty of scope to move it further
way.

Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>

authored by

Michael Ellerman and committed by
Benjamin Herrenschmidt
4e2bf01b 1e07a0a0

+60 -60
+60 -60
arch/powerpc/kernel/exceptions-64s.S
··· 953 953 b __ppc64_runlatch_on 954 954 955 955 /* 956 - * Here we have detected that the kernel stack pointer is bad. 957 - * R9 contains the saved CR, r13 points to the paca, 958 - * r10 contains the (bad) kernel stack pointer, 959 - * r11 and r12 contain the saved SRR0 and SRR1. 960 - * We switch to using an emergency stack, save the registers there, 961 - * and call kernel_bad_stack(), which panics. 962 - */ 963 - bad_stack: 964 - ld r1,PACAEMERGSP(r13) 965 - subi r1,r1,64+INT_FRAME_SIZE 966 - std r9,_CCR(r1) 967 - std r10,GPR1(r1) 968 - std r11,_NIP(r1) 969 - std r12,_MSR(r1) 970 - mfspr r11,SPRN_DAR 971 - mfspr r12,SPRN_DSISR 972 - std r11,_DAR(r1) 973 - std r12,_DSISR(r1) 974 - mflr r10 975 - mfctr r11 976 - mfxer r12 977 - std r10,_LINK(r1) 978 - std r11,_CTR(r1) 979 - std r12,_XER(r1) 980 - SAVE_GPR(0,r1) 981 - SAVE_GPR(2,r1) 982 - ld r10,EX_R3(r3) 983 - std r10,GPR3(r1) 984 - SAVE_GPR(4,r1) 985 - SAVE_4GPRS(5,r1) 986 - ld r9,EX_R9(r3) 987 - ld r10,EX_R10(r3) 988 - SAVE_2GPRS(9,r1) 989 - ld r9,EX_R11(r3) 990 - ld r10,EX_R12(r3) 991 - ld r11,EX_R13(r3) 992 - std r9,GPR11(r1) 993 - std r10,GPR12(r1) 994 - std r11,GPR13(r1) 995 - BEGIN_FTR_SECTION 996 - ld r10,EX_CFAR(r3) 997 - std r10,ORIG_GPR3(r1) 998 - END_FTR_SECTION_IFSET(CPU_FTR_CFAR) 999 - SAVE_8GPRS(14,r1) 1000 - SAVE_10GPRS(22,r1) 1001 - lhz r12,PACA_TRAP_SAVE(r13) 1002 - std r12,_TRAP(r1) 1003 - addi r11,r1,INT_FRAME_SIZE 1004 - std r11,0(r1) 1005 - li r12,0 1006 - std r12,0(r11) 1007 - ld r2,PACATOC(r13) 1008 - ld r11,exception_marker@toc(r2) 1009 - std r12,RESULT(r1) 1010 - std r11,STACK_FRAME_OVERHEAD-16(r1) 1011 - 1: addi r3,r1,STACK_FRAME_OVERHEAD 1012 - bl kernel_bad_stack 1013 - b 1b 1014 - 1015 - /* 1016 956 * Here r13 points to the paca, r9 contains the saved CR, 1017 957 * SRR0 and SRR1 are saved in r11 and r12, 1018 958 * r9 - r13 are saved in paca->exgen. ··· 1576 1636 li r5,SIGSEGV 1577 1637 bl bad_page_fault 1578 1638 b ret_from_except 1639 + 1640 + /* 1641 + * Here we have detected that the kernel stack pointer is bad. 1642 + * R9 contains the saved CR, r13 points to the paca, 1643 + * r10 contains the (bad) kernel stack pointer, 1644 + * r11 and r12 contain the saved SRR0 and SRR1. 1645 + * We switch to using an emergency stack, save the registers there, 1646 + * and call kernel_bad_stack(), which panics. 1647 + */ 1648 + bad_stack: 1649 + ld r1,PACAEMERGSP(r13) 1650 + subi r1,r1,64+INT_FRAME_SIZE 1651 + std r9,_CCR(r1) 1652 + std r10,GPR1(r1) 1653 + std r11,_NIP(r1) 1654 + std r12,_MSR(r1) 1655 + mfspr r11,SPRN_DAR 1656 + mfspr r12,SPRN_DSISR 1657 + std r11,_DAR(r1) 1658 + std r12,_DSISR(r1) 1659 + mflr r10 1660 + mfctr r11 1661 + mfxer r12 1662 + std r10,_LINK(r1) 1663 + std r11,_CTR(r1) 1664 + std r12,_XER(r1) 1665 + SAVE_GPR(0,r1) 1666 + SAVE_GPR(2,r1) 1667 + ld r10,EX_R3(r3) 1668 + std r10,GPR3(r1) 1669 + SAVE_GPR(4,r1) 1670 + SAVE_4GPRS(5,r1) 1671 + ld r9,EX_R9(r3) 1672 + ld r10,EX_R10(r3) 1673 + SAVE_2GPRS(9,r1) 1674 + ld r9,EX_R11(r3) 1675 + ld r10,EX_R12(r3) 1676 + ld r11,EX_R13(r3) 1677 + std r9,GPR11(r1) 1678 + std r10,GPR12(r1) 1679 + std r11,GPR13(r1) 1680 + BEGIN_FTR_SECTION 1681 + ld r10,EX_CFAR(r3) 1682 + std r10,ORIG_GPR3(r1) 1683 + END_FTR_SECTION_IFSET(CPU_FTR_CFAR) 1684 + SAVE_8GPRS(14,r1) 1685 + SAVE_10GPRS(22,r1) 1686 + lhz r12,PACA_TRAP_SAVE(r13) 1687 + std r12,_TRAP(r1) 1688 + addi r11,r1,INT_FRAME_SIZE 1689 + std r11,0(r1) 1690 + li r12,0 1691 + std r12,0(r11) 1692 + ld r2,PACATOC(r13) 1693 + ld r11,exception_marker@toc(r2) 1694 + std r12,RESULT(r1) 1695 + std r11,STACK_FRAME_OVERHEAD-16(r1) 1696 + 1: addi r3,r1,STACK_FRAME_OVERHEAD 1697 + bl kernel_bad_stack 1698 + b 1b