--- v8
+++ v1
@@ -1,94 +1,184 @@
-Some stack pointers used to also be thread_info pointers
-and were called tp. Now that they are only stack pointers,
-rename them sp.
+CURRENT_THREAD_INFO() now uses the PACA to retrieve 'current' pointer,
+it doesn't use 'sp' anymore.
Signed-off-by: Christophe Leroy <christophe.leroy@c-s.fr>
---
- arch/powerpc/kernel/irq.c | 17 +++++++----------
- arch/powerpc/kernel/setup_64.c | 20 ++++++++++----------
- 2 files changed, 17 insertions(+), 20 deletions(-)
+ arch/powerpc/include/asm/exception-64s.h | 4 ++--
+ arch/powerpc/include/asm/thread_info.h | 2 +-
+ arch/powerpc/kernel/entry_64.S | 10 +++++-----
+ arch/powerpc/kernel/exceptions-64e.S | 2 +-
+ arch/powerpc/kernel/exceptions-64s.S | 2 +-
+ arch/powerpc/kernel/idle_book3e.S | 2 +-
+ arch/powerpc/kernel/idle_power4.S | 2 +-
+ arch/powerpc/kernel/trace/ftrace_64_mprofile.S | 6 +++---
+ 8 files changed, 15 insertions(+), 15 deletions(-)
-diff --git a/arch/powerpc/kernel/irq.c b/arch/powerpc/kernel/irq.c
-index 62cfccf4af89..754f0efc507b 100644
---- a/arch/powerpc/kernel/irq.c
-+++ b/arch/powerpc/kernel/irq.c
-@@ -659,21 +659,21 @@ void __do_irq(struct pt_regs *regs)
- void do_IRQ(struct pt_regs *regs)
- {
- struct pt_regs *old_regs = set_irq_regs(regs);
-- void *curtp, *irqtp, *sirqtp;
-+ void *cursp, *irqsp, *sirqsp;
+diff --git a/arch/powerpc/include/asm/exception-64s.h b/arch/powerpc/include/asm/exception-64s.h
+index 47578b79f0fb..e38d84c267b8 100644
+--- a/arch/powerpc/include/asm/exception-64s.h
++++ b/arch/powerpc/include/asm/exception-64s.h
+@@ -672,7 +672,7 @@ END_FTR_SECTION_NESTED(ftr,ftr,943)
- /* Switch to the irq stack to handle this */
-- curtp = (void *)(current_stack_pointer() & ~(THREAD_SIZE - 1));
-- irqtp = hardirq_ctx[raw_smp_processor_id()];
-- sirqtp = softirq_ctx[raw_smp_processor_id()];
-+ cursp = (void *)(current_stack_pointer() & ~(THREAD_SIZE - 1));
-+ irqsp = hardirq_ctx[raw_smp_processor_id()];
-+ sirqsp = softirq_ctx[raw_smp_processor_id()];
+ #define RUNLATCH_ON \
+ BEGIN_FTR_SECTION \
+- CURRENT_THREAD_INFO(r3, r1); \
++ CURRENT_THREAD_INFO(r3); \
+ ld r4,TI_LOCAL_FLAGS(r3); \
+ andi. r0,r4,_TLF_RUNLATCH; \
+ beql ppc64_runlatch_on_trampoline; \
+@@ -722,7 +722,7 @@ END_FTR_SECTION_IFSET(CPU_FTR_CTRL)
+ #ifdef CONFIG_PPC_970_NAP
+ #define FINISH_NAP \
+ BEGIN_FTR_SECTION \
+- CURRENT_THREAD_INFO(r11, r1); \
++ CURRENT_THREAD_INFO(r11); \
+ ld r9,TI_LOCAL_FLAGS(r11); \
+ andi. r10,r9,_TLF_NAPPING; \
+ bnel power4_fixup_nap; \
+diff --git a/arch/powerpc/include/asm/thread_info.h b/arch/powerpc/include/asm/thread_info.h
+index 1c42df627bf3..a339de87806b 100644
+--- a/arch/powerpc/include/asm/thread_info.h
++++ b/arch/powerpc/include/asm/thread_info.h
+@@ -18,7 +18,7 @@
+ #define THREAD_SIZE (1 << THREAD_SHIFT)
- /* Already there ? */
-- if (unlikely(curtp == irqtp || curtp == sirqtp)) {
-+ if (unlikely(cursp == irqsp || cursp == sirqsp)) {
- __do_irq(regs);
- set_irq_regs(old_regs);
- return;
- }
- /* Switch stack and call */
-- call_do_irq(regs, irqtp);
-+ call_do_irq(regs, irqsp);
+ #ifdef CONFIG_PPC64
+-#define CURRENT_THREAD_INFO(dest, sp) stringify_in_c(ld dest, PACACURRENT(r13))
++#define CURRENT_THREAD_INFO(dest) stringify_in_c(ld dest, PACACURRENT(r13))
+ #endif
- set_irq_regs(old_regs);
- }
-@@ -732,10 +732,7 @@ void irq_ctx_init(void)
+ #ifndef __ASSEMBLY__
+diff --git a/arch/powerpc/kernel/entry_64.S b/arch/powerpc/kernel/entry_64.S
+index 697406572592..331b9e9b6d78 100644
+--- a/arch/powerpc/kernel/entry_64.S
++++ b/arch/powerpc/kernel/entry_64.S
+@@ -158,7 +158,7 @@ system_call: /* label this so stack traces look sane */
+ li r10,IRQS_ENABLED
+ std r10,SOFTE(r1)
- void do_softirq_own_stack(void)
- {
-- void *irqtp;
--
-- irqtp = softirq_ctx[smp_processor_id()];
-- call_do_softirq(irqtp);
-+ call_do_softirq(softirq_ctx[smp_processor_id()]);
- }
+- CURRENT_THREAD_INFO(r11, r1)
++ CURRENT_THREAD_INFO(r11)
+ ld r10,TI_FLAGS(r11)
+ andi. r11,r10,_TIF_SYSCALL_DOTRACE
+ bne .Lsyscall_dotrace /* does not return */
+@@ -205,7 +205,7 @@ system_call: /* label this so stack traces look sane */
+ ld r3,RESULT(r1)
+ #endif
- irq_hw_number_t virq_to_hw(unsigned int virq)
-diff --git a/arch/powerpc/kernel/setup_64.c b/arch/powerpc/kernel/setup_64.c
-index 6792e9c90689..4912ec0320b8 100644
---- a/arch/powerpc/kernel/setup_64.c
-+++ b/arch/powerpc/kernel/setup_64.c
-@@ -717,22 +717,22 @@ void __init emergency_stack_init(void)
- limit = min(ppc64_bolted_size(), ppc64_rma_size);
+- CURRENT_THREAD_INFO(r12, r1)
++ CURRENT_THREAD_INFO(r12)
- for_each_possible_cpu(i) {
-- void *ti;
-+ void *sp;
+ ld r8,_MSR(r1)
+ #ifdef CONFIG_PPC_BOOK3S
+@@ -336,7 +336,7 @@ END_FTR_SECTION_IFSET(CPU_FTR_HAS_PPR)
-- ti = alloc_stack(limit, i);
-- memset(ti, 0, THREAD_SIZE);
-- paca_ptrs[i]->emergency_sp = ti + THREAD_SIZE;
-+ sp = alloc_stack(limit, i);
-+ memset(sp, 0, THREAD_SIZE);
-+ paca_ptrs[i]->emergency_sp = sp + THREAD_SIZE;
+ /* Repopulate r9 and r10 for the syscall path */
+ addi r9,r1,STACK_FRAME_OVERHEAD
+- CURRENT_THREAD_INFO(r10, r1)
++ CURRENT_THREAD_INFO(r10)
+ ld r10,TI_FLAGS(r10)
- #ifdef CONFIG_PPC_BOOK3S_64
- /* emergency stack for NMI exception handling. */
-- ti = alloc_stack(limit, i);
-- memset(ti, 0, THREAD_SIZE);
-- paca_ptrs[i]->nmi_emergency_sp = ti + THREAD_SIZE;
-+ sp = alloc_stack(limit, i);
-+ memset(sp, 0, THREAD_SIZE);
-+ paca_ptrs[i]->nmi_emergency_sp = sp + THREAD_SIZE;
+ cmpldi r0,NR_syscalls
+@@ -731,7 +731,7 @@ _GLOBAL(ret_from_except_lite)
+ mtmsrd r10,1 /* Update machine state */
+ #endif /* CONFIG_PPC_BOOK3E */
- /* emergency stack for machine check exception handling. */
-- ti = alloc_stack(limit, i);
-- memset(ti, 0, THREAD_SIZE);
-- paca_ptrs[i]->mc_emergency_sp = ti + THREAD_SIZE;
-+ sp = alloc_stack(limit, i);
-+ memset(sp, 0, THREAD_SIZE);
-+ paca_ptrs[i]->mc_emergency_sp = sp + THREAD_SIZE;
- #endif
- }
- }
+- CURRENT_THREAD_INFO(r9, r1)
++ CURRENT_THREAD_INFO(r9)
+ ld r3,_MSR(r1)
+ #ifdef CONFIG_PPC_BOOK3E
+ ld r10,PACACURRENT(r13)
+@@ -845,7 +845,7 @@ resume_kernel:
+ 1: bl preempt_schedule_irq
+
+ /* Re-test flags and eventually loop */
+- CURRENT_THREAD_INFO(r9, r1)
++ CURRENT_THREAD_INFO(r9)
+ ld r4,TI_FLAGS(r9)
+ andi. r0,r4,_TIF_NEED_RESCHED
+ bne 1b
+diff --git a/arch/powerpc/kernel/exceptions-64e.S b/arch/powerpc/kernel/exceptions-64e.S
+index 231d066b4a3d..f48d9aa07a73 100644
+--- a/arch/powerpc/kernel/exceptions-64e.S
++++ b/arch/powerpc/kernel/exceptions-64e.S
+@@ -469,7 +469,7 @@ exc_##n##_bad_stack: \
+ * interrupts happen before the wait instruction.
+ */
+ #define CHECK_NAPPING() \
+- CURRENT_THREAD_INFO(r11, r1); \
++ CURRENT_THREAD_INFO(r11); \
+ ld r10,TI_LOCAL_FLAGS(r11); \
+ andi. r9,r10,_TLF_NAPPING; \
+ beq+ 1f; \
+diff --git a/arch/powerpc/kernel/exceptions-64s.S b/arch/powerpc/kernel/exceptions-64s.S
+index 89d32bb79d5e..07701063d36e 100644
+--- a/arch/powerpc/kernel/exceptions-64s.S
++++ b/arch/powerpc/kernel/exceptions-64s.S
+@@ -1620,7 +1620,7 @@ do_hash_page:
+ ori r0,r0,DSISR_BAD_FAULT_64S@l
+ and. r0,r4,r0 /* weird error? */
+ bne- handle_page_fault /* if not, try to insert a HPTE */
+- CURRENT_THREAD_INFO(r11, r1)
++ CURRENT_THREAD_INFO(r11)
+ lwz r0,TI_PREEMPT(r11) /* If we're in an "NMI" */
+ andis. r0,r0,NMI_MASK@h /* (i.e. an irq when soft-disabled) */
+ bne 77f /* then don't call hash_page now */
+diff --git a/arch/powerpc/kernel/idle_book3e.S b/arch/powerpc/kernel/idle_book3e.S
+index 4e0d94d02030..23f3d927ea4f 100644
+--- a/arch/powerpc/kernel/idle_book3e.S
++++ b/arch/powerpc/kernel/idle_book3e.S
+@@ -63,7 +63,7 @@ _GLOBAL(\name)
+ 1: /* Let's set the _TLF_NAPPING flag so interrupts make us return
+ * to the right spot
+ */
+- CURRENT_THREAD_INFO(r11, r1)
++ CURRENT_THREAD_INFO(r11)
+ ld r10,TI_LOCAL_FLAGS(r11)
+ ori r10,r10,_TLF_NAPPING
+ std r10,TI_LOCAL_FLAGS(r11)
+diff --git a/arch/powerpc/kernel/idle_power4.S b/arch/powerpc/kernel/idle_power4.S
+index a09b3c7ca176..80e09f4ec056 100644
+--- a/arch/powerpc/kernel/idle_power4.S
++++ b/arch/powerpc/kernel/idle_power4.S
+@@ -68,7 +68,7 @@ BEGIN_FTR_SECTION
+ DSSALL
+ sync
+ END_FTR_SECTION_IFSET(CPU_FTR_ALTIVEC)
+- CURRENT_THREAD_INFO(r9, r1)
++ CURRENT_THREAD_INFO(r9)
+ ld r8,TI_LOCAL_FLAGS(r9) /* set napping bit */
+ ori r8,r8,_TLF_NAPPING /* so when we take an exception */
+ std r8,TI_LOCAL_FLAGS(r9) /* it will return to our caller */
+diff --git a/arch/powerpc/kernel/trace/ftrace_64_mprofile.S b/arch/powerpc/kernel/trace/ftrace_64_mprofile.S
+index 32476a6e4e9c..5ba39ec48cdd 100644
+--- a/arch/powerpc/kernel/trace/ftrace_64_mprofile.S
++++ b/arch/powerpc/kernel/trace/ftrace_64_mprofile.S
+@@ -229,7 +229,7 @@ ftrace_call:
+ * - r0, r11 & r12 are free
+ */
+ livepatch_handler:
+- CURRENT_THREAD_INFO(r12, r1)
++ CURRENT_THREAD_INFO(r12)
+
+ /* Allocate 3 x 8 bytes */
+ ld r11, TI_livepatch_sp(r12)
+@@ -256,7 +256,7 @@ livepatch_handler:
+ * restore it.
+ */
+
+- CURRENT_THREAD_INFO(r12, r1)
++ CURRENT_THREAD_INFO(r12)
+
+ ld r11, TI_livepatch_sp(r12)
+
+@@ -273,7 +273,7 @@ livepatch_handler:
+ ld r2, -24(r11)
+
+ /* Pop livepatch stack frame */
+- CURRENT_THREAD_INFO(r12, r1)
++ CURRENT_THREAD_INFO(r12)
+ subi r11, r11, 24
+ std r11, TI_livepatch_sp(r12)
+
--
2.13.3
-