]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blame - releases/2.6.35.8/powerpc-don-t-use-kernel-stack-with-translation-off.patch
4.9-stable patches
[thirdparty/kernel/stable-queue.git] / releases / 2.6.35.8 / powerpc-don-t-use-kernel-stack-with-translation-off.patch
CommitLineData
1b91d6c3
GKH
1From 54a834043314c257210db2a9d59f8cc605571639 Mon Sep 17 00:00:00 2001
2From: Michael Neuling <mikey@neuling.org>
3Date: Wed, 25 Aug 2010 21:04:25 +0000
4Subject: powerpc: Don't use kernel stack with translation off
5
6From: Michael Neuling <mikey@neuling.org>
7
8commit 54a834043314c257210db2a9d59f8cc605571639 upstream.
9
10In f761622e59433130bc33ad086ce219feee9eb961 we changed
11early_setup_secondary so it's called using the proper kernel stack
12rather than the emergency one.
13
14Unfortunately, this stack pointer can't be used when translation is off
15on PHYP as this stack pointer might be outside the RMO. This results in
16the following on all non zero cpus:
17 cpu 0x1: Vector: 300 (Data Access) at [c00000001639fd10]
18 pc: 000000000001c50c
19 lr: 000000000000821c
20 sp: c00000001639ff90
21 msr: 8000000000001000
22 dar: c00000001639ffa0
23 dsisr: 42000000
24 current = 0xc000000016393540
25 paca = 0xc000000006e00200
26 pid = 0, comm = swapper
27
28The original patch was only tested on bare metal system, so it never
29caught this problem.
30
31This changes __secondary_start so that we calculate the new stack
32pointer but only start using it after we've called early_setup_secondary.
33
34With this patch, the above problem goes away.
35
36Signed-off-by: Michael Neuling <mikey@neuling.org>
37Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
38Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
39
40---
41 arch/powerpc/kernel/head_64.S | 12 +++++++++---
42 1 file changed, 9 insertions(+), 3 deletions(-)
43
44--- a/arch/powerpc/kernel/head_64.S
45+++ b/arch/powerpc/kernel/head_64.S
46@@ -575,13 +575,19 @@ __secondary_start:
47 /* Initialize the kernel stack. Just a repeat for iSeries. */
48 LOAD_REG_ADDR(r3, current_set)
49 sldi r28,r24,3 /* get current_set[cpu#] */
50- ldx r1,r3,r28
51- addi r1,r1,THREAD_SIZE-STACK_FRAME_OVERHEAD
52- std r1,PACAKSAVE(r13)
53+ ldx r14,r3,r28
54+ addi r14,r14,THREAD_SIZE-STACK_FRAME_OVERHEAD
55+ std r14,PACAKSAVE(r13)
56
57 /* Do early setup for that CPU (stab, slb, hash table pointer) */
58 bl .early_setup_secondary
59
60+ /*
61+ * setup the new stack pointer, but *don't* use this until
62+ * translation is on.
63+ */
64+ mr r1, r14
65+
66 /* Clear backchain so we get nice backtraces */
67 li r7,0
68 mtlr r7