Home Home > GIT Browse
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichal Suchanek <msuchanek@suse.de>2018-07-10 19:15:57 +0200
committerMichal Suchanek <msuchanek@suse.de>2018-07-10 19:15:57 +0200
commit19dda0e4a99487f7360980746a39ffd01fb0b297 (patch)
tree0125f35c198e7710a5dadc9a5c0306344e62dca8
parent14329282dcddbf7c4473b86a82cfc12ba7b57643 (diff)
powerpc/64s: Exception macro for stack frame and initial
register save (bsc#1094244).
-rw-r--r--patches.arch/powerpc-64s-Exception-macro-for-stack-frame-and-init.patch96
-rw-r--r--series.conf1
2 files changed, 97 insertions, 0 deletions
diff --git a/patches.arch/powerpc-64s-Exception-macro-for-stack-frame-and-init.patch b/patches.arch/powerpc-64s-Exception-macro-for-stack-frame-and-init.patch
new file mode 100644
index 0000000000..9b8e7a1588
--- /dev/null
+++ b/patches.arch/powerpc-64s-Exception-macro-for-stack-frame-and-init.patch
@@ -0,0 +1,96 @@
+From 0f6383e822f6242cca10a115f89249cc2df18a77 Mon Sep 17 00:00:00 2001
+From: Nicholas Piggin <npiggin@gmail.com>
+Date: Tue, 20 Dec 2016 04:30:03 +1000
+Subject: [PATCH] powerpc/64s: Exception macro for stack frame and initial
+ register save
+
+References: bsc#1094244
+Patch-mainline: v4.12-rc1
+Git-commit: a4087a4d38981bef3de7dd814493df202919cd2e
+
+This code is common to a few exceptions, and another user will be added.
+This causes a trivial change to generated code:
+
+- 604: std r9,416(r1)
+- 608: mfspr r11,314
+- 60c: std r11,368(r1)
+- 610: mfspr r12,315
++ 604: mfspr r11,314
++ 608: mfspr r12,315
++ 60c: std r9,416(r1)
++ 610: std r11,368(r1)
+
+machine_check_powernv_early could also use this, but that requires non
+trivial changes to generated code, so that's for another patch.
+
+Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
+Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
+Acked-by: Michal Suchanek <msuchanek@suse.de>
+---
+ arch/powerpc/include/asm/exception-64s.h | 16 ++++++++++------
+ arch/powerpc/kernel/exceptions-64s.S | 13 ++++---------
+ 2 files changed, 14 insertions(+), 15 deletions(-)
+
+diff --git a/arch/powerpc/include/asm/exception-64s.h b/arch/powerpc/include/asm/exception-64s.h
+index 9969643a3a0d..5bbc43c0200d 100644
+--- a/arch/powerpc/include/asm/exception-64s.h
++++ b/arch/powerpc/include/asm/exception-64s.h
+@@ -358,6 +358,15 @@ do_kvm_##n: \
+
+ #define NOTEST(n)
+
++#define EXCEPTION_PROLOG_COMMON_1() \
++ std r9,_CCR(r1); /* save CR in stackframe */ \
++ std r11,_NIP(r1); /* save SRR0 in stackframe */ \
++ std r12,_MSR(r1); /* save SRR1 in stackframe */ \
++ std r10,0(r1); /* make stack chain pointer */ \
++ std r0,GPR0(r1); /* save r0 in stackframe */ \
++ std r10,GPR1(r1); /* save r1 in stackframe */ \
++
++
+ /*
+ * The common exception prolog is used for all except a few exceptions
+ * such as a segment miss on a kernel address. We have to be prepared
+@@ -382,12 +391,7 @@ do_kvm_##n: \
+ addi r3,r13,area; /* r3 -> where regs are saved*/ \
+ RESTORE_CTR(r1, area); \
+ b bad_stack; \
+-3: std r9,_CCR(r1); /* save CR in stackframe */ \
+- std r11,_NIP(r1); /* save SRR0 in stackframe */ \
+- std r12,_MSR(r1); /* save SRR1 in stackframe */ \
+- std r10,0(r1); /* make stack chain pointer */ \
+- std r0,GPR0(r1); /* save r0 in stackframe */ \
+- std r10,GPR1(r1); /* save r1 in stackframe */ \
++3: EXCEPTION_PROLOG_COMMON_1(); \
+ beq 4f; /* if from kernel mode */ \
+ ACCOUNT_CPU_USER_ENTRY(r9, r10); \
+ SAVE_PPR(area, r9, r10); \
+diff --git a/arch/powerpc/kernel/exceptions-64s.S b/arch/powerpc/kernel/exceptions-64s.S
+index 7d3d6eb4975b..d36e9f798de2 100644
+--- a/arch/powerpc/kernel/exceptions-64s.S
++++ b/arch/powerpc/kernel/exceptions-64s.S
+@@ -1283,17 +1283,12 @@ fwnmi_data_area:
+ .globl hmi_exception_early
+ hmi_exception_early:
+ EXCEPTION_PROLOG_1(PACA_EXGEN, NOTEST, 0xe60)
+- mr r10,r1 /* Save r1 */
+- ld r1,PACAEMERGSP(r13) /* Use emergency stack */
++ mr r10,r1 /* Save r1 */
++ ld r1,PACAEMERGSP(r13) /* Use emergency stack for realmode */
+ subi r1,r1,INT_FRAME_SIZE /* alloc stack frame */
+- std r9,_CCR(r1) /* save CR in stackframe */
+ mfspr r11,SPRN_HSRR0 /* Save HSRR0 */
+- std r11,_NIP(r1) /* save HSRR0 in stackframe */
+- mfspr r12,SPRN_HSRR1 /* Save SRR1 */
+- std r12,_MSR(r1) /* save SRR1 in stackframe */
+- std r10,0(r1) /* make stack chain pointer */
+- std r0,GPR0(r1) /* save r0 in stackframe */
+- std r10,GPR1(r1) /* save r1 in stackframe */
++ mfspr r12,SPRN_HSRR1 /* Save HSRR1 */
++ EXCEPTION_PROLOG_COMMON_1()
+ EXCEPTION_PROLOG_COMMON_2(PACA_EXGEN)
+ EXCEPTION_PROLOG_COMMON_3(0xe60)
+ addi r3,r1,STACK_FRAME_OVERHEAD
+--
+2.13.7
+
diff --git a/series.conf b/series.conf
index 527ea4ebbb..bbfb1d8984 100644
--- a/series.conf
+++ b/series.conf
@@ -4612,6 +4612,7 @@
patches.arch/powerpc-signals-Discard-transaction-state-from-signa.patch
# bsc#1094244
+ patches.arch/powerpc-64s-Exception-macro-for-stack-frame-and-init.patch
patches.arch/powerpc-64s-Fix-mce-accounting-for-powernv.patch
patches.arch/powerpc-Machine-check-interrupt-is-a-non-maskable-in.patch