linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 1/8] powerpc: Create a helper for getting the kernel toc value
@ 2016-02-29  9:26 Michael Ellerman
  2016-02-29  9:26 ` [PATCH v2 2/8] powerpc/module: Only try to generate the ftrace_caller() stub once Michael Ellerman
                   ` (8 more replies)
  0 siblings, 9 replies; 15+ messages in thread
From: Michael Ellerman @ 2016-02-29  9:26 UTC (permalink / raw)
  To: linuxppc-dev
  Cc: bsingharora, duwe, linux-kernel, rostedt, kamalesh, pmladek, jeyu,
	jkosina, live-patching, mbenes

Move the logic to work out the kernel toc pointer into a header. This is
a good cleanup, and also means we can use it elsewhere in future.

Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
---
 arch/powerpc/include/asm/sections.h | 12 ++++++++++++
 arch/powerpc/kernel/paca.c          | 11 +----------
 2 files changed, 13 insertions(+), 10 deletions(-)

v2: New.

diff --git a/arch/powerpc/include/asm/sections.h b/arch/powerpc/include/asm/sections.h
index a5e930aca804..abf5866e08c6 100644
--- a/arch/powerpc/include/asm/sections.h
+++ b/arch/powerpc/include/asm/sections.h
@@ -22,6 +22,18 @@ static inline int in_kernel_text(unsigned long addr)
 	return 0;
 }
 
+static inline unsigned long kernel_toc_addr(void)
+{
+	/* Defined by the linker, see vmlinux.lds.S */
+	extern unsigned long __toc_start;
+
+	/*
+	 * The TOC register (r2) points 32kB into the TOC, so that 64kB of
+	 * the TOC can be addressed using a single machine instruction.
+	 */
+	return (unsigned long)(&__toc_start) + 0x8000UL;
+}
+
 static inline int overlaps_interrupt_vector_text(unsigned long start,
 							unsigned long end)
 {
diff --git a/arch/powerpc/kernel/paca.c b/arch/powerpc/kernel/paca.c
index 01ea0edf0579..93dae296b6be 100644
--- a/arch/powerpc/kernel/paca.c
+++ b/arch/powerpc/kernel/paca.c
@@ -17,10 +17,6 @@
 #include <asm/pgtable.h>
 #include <asm/kexec.h>
 
-/* This symbol is provided by the linker - let it fill in the paca
- * field correctly */
-extern unsigned long __toc_start;
-
 #ifdef CONFIG_PPC_BOOK3S
 
 /*
@@ -149,11 +145,6 @@ EXPORT_SYMBOL(paca);
 
 void __init initialise_paca(struct paca_struct *new_paca, int cpu)
 {
-       /* The TOC register (GPR2) points 32kB into the TOC, so that 64kB
-	* of the TOC can be addressed using a single machine instruction.
-	*/
-	unsigned long kernel_toc = (unsigned long)(&__toc_start) + 0x8000UL;
-
 #ifdef CONFIG_PPC_BOOK3S
 	new_paca->lppaca_ptr = new_lppaca(cpu);
 #else
@@ -161,7 +152,7 @@ void __init initialise_paca(struct paca_struct *new_paca, int cpu)
 #endif
 	new_paca->lock_token = 0x8000;
 	new_paca->paca_index = cpu;
-	new_paca->kernel_toc = kernel_toc;
+	new_paca->kernel_toc = kernel_toc_addr();
 	new_paca->kernelbase = (unsigned long) _stext;
 	/* Only set MSR:IR/DR when MMU is initialized */
 	new_paca->kernel_msr = MSR_KERNEL & ~(MSR_IR | MSR_DR);
-- 
2.5.0

^ permalink raw reply related	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2016-03-02  1:52 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-02-29  9:26 [PATCH v2 1/8] powerpc: Create a helper for getting the kernel toc value Michael Ellerman
2016-02-29  9:26 ` [PATCH v2 2/8] powerpc/module: Only try to generate the ftrace_caller() stub once Michael Ellerman
2016-03-01  1:40   ` kbuild test robot
2016-03-01 10:07   ` Kamalesh Babulal
2016-03-01 12:00   ` Torsten Duwe
2016-03-02  1:52     ` Michael Ellerman
2016-02-29  9:26 ` [PATCH v2 3/8] powerpc/module: Mark module stubs with a magic value Michael Ellerman
2016-02-29  9:26 ` [PATCH v2 4/8] powerpc/module: Create a special stub for ftrace_caller() Michael Ellerman
2016-02-29  9:26 ` [PATCH v2 5/8] powerpc/ftrace: Use generic ftrace_modify_all_code() Michael Ellerman
2016-03-01 10:08   ` Kamalesh Babulal
2016-02-29  9:26 ` [PATCH v2 6/8] powerpc/ftrace: Use $(CC_FLAGS_FTRACE) when disabling ftrace Michael Ellerman
2016-02-29  9:26 ` [PATCH v2 7/8] powerpc/ftrace: Add support for -mprofile-kernel ftrace ABI Michael Ellerman
2016-02-29  9:26 ` [PATCH v2 8/8] powerpc/ftrace: Add Kconfig & Make glue for mprofile-kernel Michael Ellerman
2016-03-01  9:56 ` [PATCH v2 1/8] powerpc: Create a helper for getting the kernel toc value Kamalesh Babulal
2016-03-01 11:58 ` Torsten Duwe

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).