linux-mips.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 00/10] MIPS: Cleanup EXPORT_SYMBOL usage
@ 2016-11-07 11:14 Paul Burton
  2016-11-07 11:14 ` Paul Burton
                   ` (10 more replies)
  0 siblings, 11 replies; 33+ messages in thread
From: Paul Burton @ 2016-11-07 11:14 UTC (permalink / raw)
  To: linux-mips; +Cc: Ralf Baechle, Paul Burton

This series takes advantage of the recent support for using
EXPORT_SYMBOL from assembly source to move symbols exports for functions
written in assembly to be performed close to the definition of the
function itself. The result is that mips_ksyms.c can be removed
entirely.

Along the way we make the handling of functions written (or at least
stubbed) in assembly a little more consistent for microMIPS kernels.

Applies atop v4.9-rc4.


Paul Burton (10):
  MIPS: Use generic asm/export.h
  MIPS: tlbex: Clear ISA bit when writing to handle_tlb{l,m,s}
  MIPS: End asm function prologue macros with .insn
  MIPS: Export _save_fp & _save_msa alongside their definitions
  MIPS: Export _mcount alongside its definition
  MIPS: Export invalid_pte_table alongside its definition
  MIPS: Export csum functions alongside their definitions
  MIPS: Export string functions alongside their definitions
  MIPS: Export memcpy & memset functions alongside their definitions
  MIPS: Export {copy,clear}_page functions alongside their definitions

 arch/mips/cavium-octeon/octeon-memcpy.S |  5 ++
 arch/mips/include/asm/Kbuild            |  1 +
 arch/mips/include/asm/asm.h             | 10 ++--
 arch/mips/kernel/Makefile               |  2 +-
 arch/mips/kernel/mcount.S               |  2 +
 arch/mips/kernel/mips_ksyms.c           | 94 ---------------------------------
 arch/mips/kernel/r2300_switch.S         |  2 +
 arch/mips/kernel/r4k_switch.S           |  3 ++
 arch/mips/lib/csum_partial.S            |  6 +++
 arch/mips/lib/memcpy.S                  |  9 ++++
 arch/mips/lib/memset.S                  |  5 ++
 arch/mips/lib/strlen_user.S             |  2 +
 arch/mips/lib/strncpy_user.S            |  5 ++
 arch/mips/lib/strnlen_user.S            |  3 ++
 arch/mips/mm/init.c                     |  2 +
 arch/mips/mm/page-funcs.S               |  3 ++
 arch/mips/mm/page.c                     |  2 +
 arch/mips/mm/tlbex.c                    |  6 +--
 18 files changed, 60 insertions(+), 102 deletions(-)
 delete mode 100644 arch/mips/kernel/mips_ksyms.c

-- 
2.10.2

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

* [PATCH 00/10] MIPS: Cleanup EXPORT_SYMBOL usage
  2016-11-07 11:14 [PATCH 00/10] MIPS: Cleanup EXPORT_SYMBOL usage Paul Burton
@ 2016-11-07 11:14 ` Paul Burton
  2016-11-07 11:14 ` [PATCH 01/10] MIPS: Use generic asm/export.h Paul Burton
                   ` (9 subsequent siblings)
  10 siblings, 0 replies; 33+ messages in thread
From: Paul Burton @ 2016-11-07 11:14 UTC (permalink / raw)
  To: linux-mips; +Cc: Ralf Baechle, Paul Burton

This series takes advantage of the recent support for using
EXPORT_SYMBOL from assembly source to move symbols exports for functions
written in assembly to be performed close to the definition of the
function itself. The result is that mips_ksyms.c can be removed
entirely.

Along the way we make the handling of functions written (or at least
stubbed) in assembly a little more consistent for microMIPS kernels.

Applies atop v4.9-rc4.


Paul Burton (10):
  MIPS: Use generic asm/export.h
  MIPS: tlbex: Clear ISA bit when writing to handle_tlb{l,m,s}
  MIPS: End asm function prologue macros with .insn
  MIPS: Export _save_fp & _save_msa alongside their definitions
  MIPS: Export _mcount alongside its definition
  MIPS: Export invalid_pte_table alongside its definition
  MIPS: Export csum functions alongside their definitions
  MIPS: Export string functions alongside their definitions
  MIPS: Export memcpy & memset functions alongside their definitions
  MIPS: Export {copy,clear}_page functions alongside their definitions

 arch/mips/cavium-octeon/octeon-memcpy.S |  5 ++
 arch/mips/include/asm/Kbuild            |  1 +
 arch/mips/include/asm/asm.h             | 10 ++--
 arch/mips/kernel/Makefile               |  2 +-
 arch/mips/kernel/mcount.S               |  2 +
 arch/mips/kernel/mips_ksyms.c           | 94 ---------------------------------
 arch/mips/kernel/r2300_switch.S         |  2 +
 arch/mips/kernel/r4k_switch.S           |  3 ++
 arch/mips/lib/csum_partial.S            |  6 +++
 arch/mips/lib/memcpy.S                  |  9 ++++
 arch/mips/lib/memset.S                  |  5 ++
 arch/mips/lib/strlen_user.S             |  2 +
 arch/mips/lib/strncpy_user.S            |  5 ++
 arch/mips/lib/strnlen_user.S            |  3 ++
 arch/mips/mm/init.c                     |  2 +
 arch/mips/mm/page-funcs.S               |  3 ++
 arch/mips/mm/page.c                     |  2 +
 arch/mips/mm/tlbex.c                    |  6 +--
 18 files changed, 60 insertions(+), 102 deletions(-)
 delete mode 100644 arch/mips/kernel/mips_ksyms.c

-- 
2.10.2

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

* [PATCH 01/10] MIPS: Use generic asm/export.h
  2016-11-07 11:14 [PATCH 00/10] MIPS: Cleanup EXPORT_SYMBOL usage Paul Burton
  2016-11-07 11:14 ` Paul Burton
@ 2016-11-07 11:14 ` Paul Burton
  2016-11-07 11:14   ` Paul Burton
  2016-11-07 11:14 ` [PATCH 02/10] MIPS: tlbex: Clear ISA bit when writing to handle_tlb{l,m,s} Paul Burton
                   ` (8 subsequent siblings)
  10 siblings, 1 reply; 33+ messages in thread
From: Paul Burton @ 2016-11-07 11:14 UTC (permalink / raw)
  To: linux-mips; +Cc: Ralf Baechle, Paul Burton

Include export.h in the list of generic headers used by the MIPS
architecture for use by later patches.

Signed-off-by: Paul Burton <paul.burton@imgtec.com>
---

 arch/mips/include/asm/Kbuild | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/mips/include/asm/Kbuild b/arch/mips/include/asm/Kbuild
index 9740066..bcfb360 100644
--- a/arch/mips/include/asm/Kbuild
+++ b/arch/mips/include/asm/Kbuild
@@ -5,6 +5,7 @@ generic-y += cputime.h
 generic-y += current.h
 generic-y += dma-contiguous.h
 generic-y += emergency-restart.h
+generic-y += export.h
 generic-y += irq_work.h
 generic-y += local64.h
 generic-y += mcs_spinlock.h
-- 
2.10.2

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

* [PATCH 01/10] MIPS: Use generic asm/export.h
  2016-11-07 11:14 ` [PATCH 01/10] MIPS: Use generic asm/export.h Paul Burton
@ 2016-11-07 11:14   ` Paul Burton
  0 siblings, 0 replies; 33+ messages in thread
From: Paul Burton @ 2016-11-07 11:14 UTC (permalink / raw)
  To: linux-mips; +Cc: Ralf Baechle, Paul Burton

Include export.h in the list of generic headers used by the MIPS
architecture for use by later patches.

Signed-off-by: Paul Burton <paul.burton@imgtec.com>
---

 arch/mips/include/asm/Kbuild | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/mips/include/asm/Kbuild b/arch/mips/include/asm/Kbuild
index 9740066..bcfb360 100644
--- a/arch/mips/include/asm/Kbuild
+++ b/arch/mips/include/asm/Kbuild
@@ -5,6 +5,7 @@ generic-y += cputime.h
 generic-y += current.h
 generic-y += dma-contiguous.h
 generic-y += emergency-restart.h
+generic-y += export.h
 generic-y += irq_work.h
 generic-y += local64.h
 generic-y += mcs_spinlock.h
-- 
2.10.2

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

* [PATCH 02/10] MIPS: tlbex: Clear ISA bit when writing to handle_tlb{l,m,s}
  2016-11-07 11:14 [PATCH 00/10] MIPS: Cleanup EXPORT_SYMBOL usage Paul Burton
  2016-11-07 11:14 ` Paul Burton
  2016-11-07 11:14 ` [PATCH 01/10] MIPS: Use generic asm/export.h Paul Burton
@ 2016-11-07 11:14 ` Paul Burton
  2016-11-07 11:14   ` Paul Burton
  2016-11-07 12:04   ` Maciej W. Rozycki
  2016-11-07 11:14 ` [PATCH 03/10] MIPS: End asm function prologue macros with .insn Paul Burton
                   ` (7 subsequent siblings)
  10 siblings, 2 replies; 33+ messages in thread
From: Paul Burton @ 2016-11-07 11:14 UTC (permalink / raw)
  To: linux-mips; +Cc: Ralf Baechle, Paul Burton

When generating TLB exception handling code we write to memory reserved
at the handle_tlbl, handle_tlbm & handle_tlbs symbols. Up until now the
ISA bit has always been clear simply because the assembly code reserving
the space for those functions places no instructions in them. In
preparation for marking all LEAF functions as containing code,
explicitly clear the ISA bit when calculating the addresses at which to
write TLB exception handling code.

Signed-off-by: Paul Burton <paul.burton@imgtec.com>
---

 arch/mips/mm/tlbex.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/arch/mips/mm/tlbex.c b/arch/mips/mm/tlbex.c
index 55ce396..87eed65 100644
--- a/arch/mips/mm/tlbex.c
+++ b/arch/mips/mm/tlbex.c
@@ -2041,7 +2041,7 @@ build_r4000_tlbchange_handler_tail(u32 **p, struct uasm_label **l,
 
 static void build_r4000_tlb_load_handler(void)
 {
-	u32 *p = handle_tlbl;
+	u32 *p = (u32 *)msk_isa16_mode((ulong)handle_tlbl);
 	const int handle_tlbl_size = handle_tlbl_end - handle_tlbl;
 	struct uasm_label *l = labels;
 	struct uasm_reloc *r = relocs;
@@ -2224,7 +2224,7 @@ static void build_r4000_tlb_load_handler(void)
 
 static void build_r4000_tlb_store_handler(void)
 {
-	u32 *p = handle_tlbs;
+	u32 *p = (u32 *)msk_isa16_mode((ulong)handle_tlbs);
 	const int handle_tlbs_size = handle_tlbs_end - handle_tlbs;
 	struct uasm_label *l = labels;
 	struct uasm_reloc *r = relocs;
@@ -2279,7 +2279,7 @@ static void build_r4000_tlb_store_handler(void)
 
 static void build_r4000_tlb_modify_handler(void)
 {
-	u32 *p = handle_tlbm;
+	u32 *p = (u32 *)msk_isa16_mode((ulong)handle_tlbm);
 	const int handle_tlbm_size = handle_tlbm_end - handle_tlbm;
 	struct uasm_label *l = labels;
 	struct uasm_reloc *r = relocs;
-- 
2.10.2

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

* [PATCH 02/10] MIPS: tlbex: Clear ISA bit when writing to handle_tlb{l,m,s}
  2016-11-07 11:14 ` [PATCH 02/10] MIPS: tlbex: Clear ISA bit when writing to handle_tlb{l,m,s} Paul Burton
@ 2016-11-07 11:14   ` Paul Burton
  2016-11-07 12:04   ` Maciej W. Rozycki
  1 sibling, 0 replies; 33+ messages in thread
From: Paul Burton @ 2016-11-07 11:14 UTC (permalink / raw)
  To: linux-mips; +Cc: Ralf Baechle, Paul Burton

When generating TLB exception handling code we write to memory reserved
at the handle_tlbl, handle_tlbm & handle_tlbs symbols. Up until now the
ISA bit has always been clear simply because the assembly code reserving
the space for those functions places no instructions in them. In
preparation for marking all LEAF functions as containing code,
explicitly clear the ISA bit when calculating the addresses at which to
write TLB exception handling code.

Signed-off-by: Paul Burton <paul.burton@imgtec.com>
---

 arch/mips/mm/tlbex.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/arch/mips/mm/tlbex.c b/arch/mips/mm/tlbex.c
index 55ce396..87eed65 100644
--- a/arch/mips/mm/tlbex.c
+++ b/arch/mips/mm/tlbex.c
@@ -2041,7 +2041,7 @@ build_r4000_tlbchange_handler_tail(u32 **p, struct uasm_label **l,
 
 static void build_r4000_tlb_load_handler(void)
 {
-	u32 *p = handle_tlbl;
+	u32 *p = (u32 *)msk_isa16_mode((ulong)handle_tlbl);
 	const int handle_tlbl_size = handle_tlbl_end - handle_tlbl;
 	struct uasm_label *l = labels;
 	struct uasm_reloc *r = relocs;
@@ -2224,7 +2224,7 @@ static void build_r4000_tlb_load_handler(void)
 
 static void build_r4000_tlb_store_handler(void)
 {
-	u32 *p = handle_tlbs;
+	u32 *p = (u32 *)msk_isa16_mode((ulong)handle_tlbs);
 	const int handle_tlbs_size = handle_tlbs_end - handle_tlbs;
 	struct uasm_label *l = labels;
 	struct uasm_reloc *r = relocs;
@@ -2279,7 +2279,7 @@ static void build_r4000_tlb_store_handler(void)
 
 static void build_r4000_tlb_modify_handler(void)
 {
-	u32 *p = handle_tlbm;
+	u32 *p = (u32 *)msk_isa16_mode((ulong)handle_tlbm);
 	const int handle_tlbm_size = handle_tlbm_end - handle_tlbm;
 	struct uasm_label *l = labels;
 	struct uasm_reloc *r = relocs;
-- 
2.10.2

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

* [PATCH 03/10] MIPS: End asm function prologue macros with .insn
  2016-11-07 11:14 [PATCH 00/10] MIPS: Cleanup EXPORT_SYMBOL usage Paul Burton
                   ` (2 preceding siblings ...)
  2016-11-07 11:14 ` [PATCH 02/10] MIPS: tlbex: Clear ISA bit when writing to handle_tlb{l,m,s} Paul Burton
@ 2016-11-07 11:14 ` Paul Burton
  2016-11-07 11:14   ` Paul Burton
  2016-11-07 14:33   ` Maciej W. Rozycki
  2016-11-07 11:14 ` [PATCH 04/10] MIPS: Export _save_fp & _save_msa alongside their definitions Paul Burton
                   ` (6 subsequent siblings)
  10 siblings, 2 replies; 33+ messages in thread
From: Paul Burton @ 2016-11-07 11:14 UTC (permalink / raw)
  To: linux-mips; +Cc: Ralf Baechle, Paul Burton

When building a kernel targeting a microMIPS ISA, recent GNU linkers
will fail the link if they cannot determine that the target of a branch
or jump is microMIPS code, with errors such as the following:

    mips-img-linux-gnu-ld: arch/mips/built-in.o: .text+0x542c:
    Unsupported jump between ISA modes; consider recompiling with
    interlinking enabled.
    mips-img-linux-gnu-ld: final link failed: Bad value

or:

    ./arch/mips/include/asm/uaccess.h:1017: warning: JALX to a
    non-word-aligned address

Placing anything other than an instruction at the start of a function
written in assembly appears to trigger such errors. In order to prepare
for allowing us to follow function prologue macros with an EXPORT_SYMBOL
invocation, end the prologue macros (LEAD, NESTED & FEXPORT) with a
.insn directive. This ensures that the start of the function is marked
as code, which always makes sense for functions & safely prevents us
from hitting the link errors described above.

Signed-off-by: Paul Burton <paul.burton@imgtec.com>
---

 arch/mips/include/asm/asm.h | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/arch/mips/include/asm/asm.h b/arch/mips/include/asm/asm.h
index 7c26b28..859cf70 100644
--- a/arch/mips/include/asm/asm.h
+++ b/arch/mips/include/asm/asm.h
@@ -54,7 +54,8 @@
 		.align	2;				\
 		.type	symbol, @function;		\
 		.ent	symbol, 0;			\
-symbol:		.frame	sp, 0, ra
+symbol:		.frame	sp, 0, ra;			\
+		.insn
 
 /*
  * NESTED - declare nested routine entry point
@@ -63,8 +64,9 @@ symbol:		.frame	sp, 0, ra
 		.globl	symbol;				\
 		.align	2;				\
 		.type	symbol, @function;		\
-		.ent	symbol, 0;			 \
-symbol:		.frame	sp, framesize, rpc
+		.ent	symbol, 0;			\
+symbol:		.frame	sp, framesize, rpc;		\
+		.insn
 
 /*
  * END - mark end of function
@@ -86,7 +88,7 @@ symbol:		.frame	sp, framesize, rpc
 #define FEXPORT(symbol)					\
 		.globl	symbol;				\
 		.type	symbol, @function;		\
-symbol:
+symbol:		.insn
 
 /*
  * ABS - export absolute symbol
-- 
2.10.2

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

* [PATCH 03/10] MIPS: End asm function prologue macros with .insn
  2016-11-07 11:14 ` [PATCH 03/10] MIPS: End asm function prologue macros with .insn Paul Burton
@ 2016-11-07 11:14   ` Paul Burton
  2016-11-07 14:33   ` Maciej W. Rozycki
  1 sibling, 0 replies; 33+ messages in thread
From: Paul Burton @ 2016-11-07 11:14 UTC (permalink / raw)
  To: linux-mips; +Cc: Ralf Baechle, Paul Burton

When building a kernel targeting a microMIPS ISA, recent GNU linkers
will fail the link if they cannot determine that the target of a branch
or jump is microMIPS code, with errors such as the following:

    mips-img-linux-gnu-ld: arch/mips/built-in.o: .text+0x542c:
    Unsupported jump between ISA modes; consider recompiling with
    interlinking enabled.
    mips-img-linux-gnu-ld: final link failed: Bad value

or:

    ./arch/mips/include/asm/uaccess.h:1017: warning: JALX to a
    non-word-aligned address

Placing anything other than an instruction at the start of a function
written in assembly appears to trigger such errors. In order to prepare
for allowing us to follow function prologue macros with an EXPORT_SYMBOL
invocation, end the prologue macros (LEAD, NESTED & FEXPORT) with a
.insn directive. This ensures that the start of the function is marked
as code, which always makes sense for functions & safely prevents us
from hitting the link errors described above.

Signed-off-by: Paul Burton <paul.burton@imgtec.com>
---

 arch/mips/include/asm/asm.h | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/arch/mips/include/asm/asm.h b/arch/mips/include/asm/asm.h
index 7c26b28..859cf70 100644
--- a/arch/mips/include/asm/asm.h
+++ b/arch/mips/include/asm/asm.h
@@ -54,7 +54,8 @@
 		.align	2;				\
 		.type	symbol, @function;		\
 		.ent	symbol, 0;			\
-symbol:		.frame	sp, 0, ra
+symbol:		.frame	sp, 0, ra;			\
+		.insn
 
 /*
  * NESTED - declare nested routine entry point
@@ -63,8 +64,9 @@ symbol:		.frame	sp, 0, ra
 		.globl	symbol;				\
 		.align	2;				\
 		.type	symbol, @function;		\
-		.ent	symbol, 0;			 \
-symbol:		.frame	sp, framesize, rpc
+		.ent	symbol, 0;			\
+symbol:		.frame	sp, framesize, rpc;		\
+		.insn
 
 /*
  * END - mark end of function
@@ -86,7 +88,7 @@ symbol:		.frame	sp, framesize, rpc
 #define FEXPORT(symbol)					\
 		.globl	symbol;				\
 		.type	symbol, @function;		\
-symbol:
+symbol:		.insn
 
 /*
  * ABS - export absolute symbol
-- 
2.10.2

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

* [PATCH 04/10] MIPS: Export _save_fp & _save_msa alongside their definitions
  2016-11-07 11:14 [PATCH 00/10] MIPS: Cleanup EXPORT_SYMBOL usage Paul Burton
                   ` (3 preceding siblings ...)
  2016-11-07 11:14 ` [PATCH 03/10] MIPS: End asm function prologue macros with .insn Paul Burton
@ 2016-11-07 11:14 ` Paul Burton
  2016-11-07 11:14   ` Paul Burton
  2016-11-07 11:14 ` [PATCH 05/10] MIPS: Export _mcount alongside its definition Paul Burton
                   ` (5 subsequent siblings)
  10 siblings, 1 reply; 33+ messages in thread
From: Paul Burton @ 2016-11-07 11:14 UTC (permalink / raw)
  To: linux-mips; +Cc: Ralf Baechle, Paul Burton

Now that EXPORT_SYMBOL can be used from assembly source, move the
EXPORT_SYMBOL invocations for _save_fp & _save_msa to be alongside their
definitions.

Signed-off-by: Paul Burton <paul.burton@imgtec.com>
---

 arch/mips/kernel/mips_ksyms.c   | 8 --------
 arch/mips/kernel/r2300_switch.S | 2 ++
 arch/mips/kernel/r4k_switch.S   | 3 +++
 3 files changed, 5 insertions(+), 8 deletions(-)

diff --git a/arch/mips/kernel/mips_ksyms.c b/arch/mips/kernel/mips_ksyms.c
index e2b6ab7..84f169b 100644
--- a/arch/mips/kernel/mips_ksyms.c
+++ b/arch/mips/kernel/mips_ksyms.c
@@ -35,14 +35,6 @@ extern long __strnlen_user_nocheck_asm(const char *s);
 extern long __strnlen_user_asm(const char *s);
 
 /*
- * Core architecture code
- */
-EXPORT_SYMBOL_GPL(_save_fp);
-#ifdef CONFIG_CPU_HAS_MSA
-EXPORT_SYMBOL_GPL(_save_msa);
-#endif
-
-/*
  * String functions
  */
 EXPORT_SYMBOL(memset);
diff --git a/arch/mips/kernel/r2300_switch.S b/arch/mips/kernel/r2300_switch.S
index ac27ef7..1049eea 100644
--- a/arch/mips/kernel/r2300_switch.S
+++ b/arch/mips/kernel/r2300_switch.S
@@ -12,6 +12,7 @@
  */
 #include <asm/asm.h>
 #include <asm/cachectl.h>
+#include <asm/export.h>
 #include <asm/fpregdef.h>
 #include <asm/mipsregs.h>
 #include <asm/asm-offsets.h>
@@ -72,6 +73,7 @@ LEAF(resume)
  * Save a thread's fp context.
  */
 LEAF(_save_fp)
+EXPORT_SYMBOL(_save_fp)
 	fpu_save_single a0, t1			# clobbers t1
 	jr	ra
 	END(_save_fp)
diff --git a/arch/mips/kernel/r4k_switch.S b/arch/mips/kernel/r4k_switch.S
index 2f0a3b2..7585778 100644
--- a/arch/mips/kernel/r4k_switch.S
+++ b/arch/mips/kernel/r4k_switch.S
@@ -12,6 +12,7 @@
  */
 #include <asm/asm.h>
 #include <asm/cachectl.h>
+#include <asm/export.h>
 #include <asm/fpregdef.h>
 #include <asm/mipsregs.h>
 #include <asm/asm-offsets.h>
@@ -75,6 +76,7 @@
  * Save a thread's fp context.
  */
 LEAF(_save_fp)
+EXPORT_SYMBOL(_save_fp)
 #if defined(CONFIG_64BIT) || defined(CONFIG_CPU_MIPS32_R2) || \
 		defined(CONFIG_CPU_MIPS32_R6)
 	mfc0	t0, CP0_STATUS
@@ -101,6 +103,7 @@ LEAF(_restore_fp)
  * Save a thread's MSA vector context.
  */
 LEAF(_save_msa)
+EXPORT_SYMBOL(_save_msa)
 	msa_save_all	a0
 	jr	ra
 	END(_save_msa)
-- 
2.10.2

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

* [PATCH 04/10] MIPS: Export _save_fp & _save_msa alongside their definitions
  2016-11-07 11:14 ` [PATCH 04/10] MIPS: Export _save_fp & _save_msa alongside their definitions Paul Burton
@ 2016-11-07 11:14   ` Paul Burton
  0 siblings, 0 replies; 33+ messages in thread
From: Paul Burton @ 2016-11-07 11:14 UTC (permalink / raw)
  To: linux-mips; +Cc: Ralf Baechle, Paul Burton

Now that EXPORT_SYMBOL can be used from assembly source, move the
EXPORT_SYMBOL invocations for _save_fp & _save_msa to be alongside their
definitions.

Signed-off-by: Paul Burton <paul.burton@imgtec.com>
---

 arch/mips/kernel/mips_ksyms.c   | 8 --------
 arch/mips/kernel/r2300_switch.S | 2 ++
 arch/mips/kernel/r4k_switch.S   | 3 +++
 3 files changed, 5 insertions(+), 8 deletions(-)

diff --git a/arch/mips/kernel/mips_ksyms.c b/arch/mips/kernel/mips_ksyms.c
index e2b6ab7..84f169b 100644
--- a/arch/mips/kernel/mips_ksyms.c
+++ b/arch/mips/kernel/mips_ksyms.c
@@ -35,14 +35,6 @@ extern long __strnlen_user_nocheck_asm(const char *s);
 extern long __strnlen_user_asm(const char *s);
 
 /*
- * Core architecture code
- */
-EXPORT_SYMBOL_GPL(_save_fp);
-#ifdef CONFIG_CPU_HAS_MSA
-EXPORT_SYMBOL_GPL(_save_msa);
-#endif
-
-/*
  * String functions
  */
 EXPORT_SYMBOL(memset);
diff --git a/arch/mips/kernel/r2300_switch.S b/arch/mips/kernel/r2300_switch.S
index ac27ef7..1049eea 100644
--- a/arch/mips/kernel/r2300_switch.S
+++ b/arch/mips/kernel/r2300_switch.S
@@ -12,6 +12,7 @@
  */
 #include <asm/asm.h>
 #include <asm/cachectl.h>
+#include <asm/export.h>
 #include <asm/fpregdef.h>
 #include <asm/mipsregs.h>
 #include <asm/asm-offsets.h>
@@ -72,6 +73,7 @@ LEAF(resume)
  * Save a thread's fp context.
  */
 LEAF(_save_fp)
+EXPORT_SYMBOL(_save_fp)
 	fpu_save_single a0, t1			# clobbers t1
 	jr	ra
 	END(_save_fp)
diff --git a/arch/mips/kernel/r4k_switch.S b/arch/mips/kernel/r4k_switch.S
index 2f0a3b2..7585778 100644
--- a/arch/mips/kernel/r4k_switch.S
+++ b/arch/mips/kernel/r4k_switch.S
@@ -12,6 +12,7 @@
  */
 #include <asm/asm.h>
 #include <asm/cachectl.h>
+#include <asm/export.h>
 #include <asm/fpregdef.h>
 #include <asm/mipsregs.h>
 #include <asm/asm-offsets.h>
@@ -75,6 +76,7 @@
  * Save a thread's fp context.
  */
 LEAF(_save_fp)
+EXPORT_SYMBOL(_save_fp)
 #if defined(CONFIG_64BIT) || defined(CONFIG_CPU_MIPS32_R2) || \
 		defined(CONFIG_CPU_MIPS32_R6)
 	mfc0	t0, CP0_STATUS
@@ -101,6 +103,7 @@ LEAF(_restore_fp)
  * Save a thread's MSA vector context.
  */
 LEAF(_save_msa)
+EXPORT_SYMBOL(_save_msa)
 	msa_save_all	a0
 	jr	ra
 	END(_save_msa)
-- 
2.10.2

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

* [PATCH 05/10] MIPS: Export _mcount alongside its definition
  2016-11-07 11:14 [PATCH 00/10] MIPS: Cleanup EXPORT_SYMBOL usage Paul Burton
                   ` (4 preceding siblings ...)
  2016-11-07 11:14 ` [PATCH 04/10] MIPS: Export _save_fp & _save_msa alongside their definitions Paul Burton
@ 2016-11-07 11:14 ` Paul Burton
  2016-11-07 11:14   ` Paul Burton
  2016-11-07 11:48   ` [PATCH v2 " Paul Burton
  2016-11-07 11:14 ` [PATCH 06/10] MIPS: Export invalid_pte_table " Paul Burton
                   ` (4 subsequent siblings)
  10 siblings, 2 replies; 33+ messages in thread
From: Paul Burton @ 2016-11-07 11:14 UTC (permalink / raw)
  To: linux-mips; +Cc: Ralf Baechle, Paul Burton

Now that EXPORT_SYMBOL can be used from assembly source, move the
EXPORT_SYMBOL invocation for _mcount to be alongside its definition.

Signed-off-by: Paul Burton <paul.burton@imgtec.com>
---

 arch/mips/kernel/mcount.S     | 2 ++
 arch/mips/kernel/mips_ksyms.c | 4 ----
 2 files changed, 2 insertions(+), 4 deletions(-)

diff --git a/arch/mips/kernel/mcount.S b/arch/mips/kernel/mcount.S
index 2f7c734..a8209ac 100644
--- a/arch/mips/kernel/mcount.S
+++ b/arch/mips/kernel/mcount.S
@@ -66,6 +66,7 @@
 NESTED(ftrace_caller, PT_SIZE, ra)
 	.globl _mcount
 _mcount:
+EXPORT_SYMBOL(_mcount)
 	b	ftrace_stub
 #ifdef CONFIG_32BIT
 	 addiu sp,sp,8
@@ -114,6 +115,7 @@ ftrace_stub:
 #else	/* ! CONFIG_DYNAMIC_FTRACE */
 
 NESTED(_mcount, PT_SIZE, ra)
+EXPORT_SYMBOL(_mcount)
 	PTR_LA	t1, ftrace_stub
 	PTR_L	t2, ftrace_trace_function /* Prepare t2 for (1) */
 	bne	t1, t2, static_trace
diff --git a/arch/mips/kernel/mips_ksyms.c b/arch/mips/kernel/mips_ksyms.c
index 84f169b..d12d243 100644
--- a/arch/mips/kernel/mips_ksyms.c
+++ b/arch/mips/kernel/mips_ksyms.c
@@ -80,7 +80,3 @@ EXPORT_SYMBOL(__csum_partial_copy_from_user);
 #endif
 
 EXPORT_SYMBOL(invalid_pte_table);
-#ifdef CONFIG_FUNCTION_TRACER
-/* _mcount is defined in arch/mips/kernel/mcount.S */
-EXPORT_SYMBOL(_mcount);
-#endif
-- 
2.10.2

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

* [PATCH 05/10] MIPS: Export _mcount alongside its definition
  2016-11-07 11:14 ` [PATCH 05/10] MIPS: Export _mcount alongside its definition Paul Burton
@ 2016-11-07 11:14   ` Paul Burton
  2016-11-07 11:48   ` [PATCH v2 " Paul Burton
  1 sibling, 0 replies; 33+ messages in thread
From: Paul Burton @ 2016-11-07 11:14 UTC (permalink / raw)
  To: linux-mips; +Cc: Ralf Baechle, Paul Burton

Now that EXPORT_SYMBOL can be used from assembly source, move the
EXPORT_SYMBOL invocation for _mcount to be alongside its definition.

Signed-off-by: Paul Burton <paul.burton@imgtec.com>
---

 arch/mips/kernel/mcount.S     | 2 ++
 arch/mips/kernel/mips_ksyms.c | 4 ----
 2 files changed, 2 insertions(+), 4 deletions(-)

diff --git a/arch/mips/kernel/mcount.S b/arch/mips/kernel/mcount.S
index 2f7c734..a8209ac 100644
--- a/arch/mips/kernel/mcount.S
+++ b/arch/mips/kernel/mcount.S
@@ -66,6 +66,7 @@
 NESTED(ftrace_caller, PT_SIZE, ra)
 	.globl _mcount
 _mcount:
+EXPORT_SYMBOL(_mcount)
 	b	ftrace_stub
 #ifdef CONFIG_32BIT
 	 addiu sp,sp,8
@@ -114,6 +115,7 @@ ftrace_stub:
 #else	/* ! CONFIG_DYNAMIC_FTRACE */
 
 NESTED(_mcount, PT_SIZE, ra)
+EXPORT_SYMBOL(_mcount)
 	PTR_LA	t1, ftrace_stub
 	PTR_L	t2, ftrace_trace_function /* Prepare t2 for (1) */
 	bne	t1, t2, static_trace
diff --git a/arch/mips/kernel/mips_ksyms.c b/arch/mips/kernel/mips_ksyms.c
index 84f169b..d12d243 100644
--- a/arch/mips/kernel/mips_ksyms.c
+++ b/arch/mips/kernel/mips_ksyms.c
@@ -80,7 +80,3 @@ EXPORT_SYMBOL(__csum_partial_copy_from_user);
 #endif
 
 EXPORT_SYMBOL(invalid_pte_table);
-#ifdef CONFIG_FUNCTION_TRACER
-/* _mcount is defined in arch/mips/kernel/mcount.S */
-EXPORT_SYMBOL(_mcount);
-#endif
-- 
2.10.2

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

* [PATCH 06/10] MIPS: Export invalid_pte_table alongside its definition
  2016-11-07 11:14 [PATCH 00/10] MIPS: Cleanup EXPORT_SYMBOL usage Paul Burton
                   ` (5 preceding siblings ...)
  2016-11-07 11:14 ` [PATCH 05/10] MIPS: Export _mcount alongside its definition Paul Burton
@ 2016-11-07 11:14 ` Paul Burton
  2016-11-07 11:14   ` Paul Burton
  2016-12-21 21:47   ` Ralf Baechle
  2016-11-07 11:14 ` [PATCH 07/10] MIPS: Export csum functions alongside their definitions Paul Burton
                   ` (3 subsequent siblings)
  10 siblings, 2 replies; 33+ messages in thread
From: Paul Burton @ 2016-11-07 11:14 UTC (permalink / raw)
  To: linux-mips; +Cc: Ralf Baechle, Paul Burton

It's unclear to me why this wasn't always the case, but move the
EXPORT_SYMBOL invocation for invalid_pte_table to be alongside its
definition.

Signed-off-by: Paul Burton <paul.burton@imgtec.com>
---

 arch/mips/kernel/mips_ksyms.c | 2 --
 arch/mips/mm/init.c           | 2 ++
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/mips/kernel/mips_ksyms.c b/arch/mips/kernel/mips_ksyms.c
index d12d243..ed571bc 100644
--- a/arch/mips/kernel/mips_ksyms.c
+++ b/arch/mips/kernel/mips_ksyms.c
@@ -78,5 +78,3 @@ EXPORT_SYMBOL(__csum_partial_copy_kernel);
 EXPORT_SYMBOL(__csum_partial_copy_to_user);
 EXPORT_SYMBOL(__csum_partial_copy_from_user);
 #endif
-
-EXPORT_SYMBOL(invalid_pte_table);
diff --git a/arch/mips/mm/init.c b/arch/mips/mm/init.c
index 3a6edec..e827521 100644
--- a/arch/mips/mm/init.c
+++ b/arch/mips/mm/init.c
@@ -30,6 +30,7 @@
 #include <linux/hardirq.h>
 #include <linux/gfp.h>
 #include <linux/kcore.h>
+#include <linux/export.h>
 
 #include <asm/asm-offsets.h>
 #include <asm/bootinfo.h>
@@ -540,3 +541,4 @@ pgd_t swapper_pg_dir[_PTRS_PER_PGD] __section(.bss..swapper_pg_dir);
 pmd_t invalid_pmd_table[PTRS_PER_PMD] __page_aligned_bss;
 #endif
 pte_t invalid_pte_table[PTRS_PER_PTE] __page_aligned_bss;
+EXPORT_SYMBOL(invalid_pte_table);
-- 
2.10.2

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

* [PATCH 06/10] MIPS: Export invalid_pte_table alongside its definition
  2016-11-07 11:14 ` [PATCH 06/10] MIPS: Export invalid_pte_table " Paul Burton
@ 2016-11-07 11:14   ` Paul Burton
  2016-12-21 21:47   ` Ralf Baechle
  1 sibling, 0 replies; 33+ messages in thread
From: Paul Burton @ 2016-11-07 11:14 UTC (permalink / raw)
  To: linux-mips; +Cc: Ralf Baechle, Paul Burton

It's unclear to me why this wasn't always the case, but move the
EXPORT_SYMBOL invocation for invalid_pte_table to be alongside its
definition.

Signed-off-by: Paul Burton <paul.burton@imgtec.com>
---

 arch/mips/kernel/mips_ksyms.c | 2 --
 arch/mips/mm/init.c           | 2 ++
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/mips/kernel/mips_ksyms.c b/arch/mips/kernel/mips_ksyms.c
index d12d243..ed571bc 100644
--- a/arch/mips/kernel/mips_ksyms.c
+++ b/arch/mips/kernel/mips_ksyms.c
@@ -78,5 +78,3 @@ EXPORT_SYMBOL(__csum_partial_copy_kernel);
 EXPORT_SYMBOL(__csum_partial_copy_to_user);
 EXPORT_SYMBOL(__csum_partial_copy_from_user);
 #endif
-
-EXPORT_SYMBOL(invalid_pte_table);
diff --git a/arch/mips/mm/init.c b/arch/mips/mm/init.c
index 3a6edec..e827521 100644
--- a/arch/mips/mm/init.c
+++ b/arch/mips/mm/init.c
@@ -30,6 +30,7 @@
 #include <linux/hardirq.h>
 #include <linux/gfp.h>
 #include <linux/kcore.h>
+#include <linux/export.h>
 
 #include <asm/asm-offsets.h>
 #include <asm/bootinfo.h>
@@ -540,3 +541,4 @@ pgd_t swapper_pg_dir[_PTRS_PER_PGD] __section(.bss..swapper_pg_dir);
 pmd_t invalid_pmd_table[PTRS_PER_PMD] __page_aligned_bss;
 #endif
 pte_t invalid_pte_table[PTRS_PER_PTE] __page_aligned_bss;
+EXPORT_SYMBOL(invalid_pte_table);
-- 
2.10.2

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

* [PATCH 07/10] MIPS: Export csum functions alongside their definitions
  2016-11-07 11:14 [PATCH 00/10] MIPS: Cleanup EXPORT_SYMBOL usage Paul Burton
                   ` (6 preceding siblings ...)
  2016-11-07 11:14 ` [PATCH 06/10] MIPS: Export invalid_pte_table " Paul Burton
@ 2016-11-07 11:14 ` Paul Burton
  2016-11-07 11:14   ` Paul Burton
  2016-11-07 11:14 ` [PATCH 08/10] MIPS: Export string " Paul Burton
                   ` (2 subsequent siblings)
  10 siblings, 1 reply; 33+ messages in thread
From: Paul Burton @ 2016-11-07 11:14 UTC (permalink / raw)
  To: linux-mips; +Cc: Ralf Baechle, Paul Burton

Now that EXPORT_SYMBOL can be used from assembly source, move the
EXPORT_SYMBOL invocations for the csum_partial_* functions to be
alongside their definitions.

Signed-off-by: Paul Burton <paul.burton@imgtec.com>
---

 arch/mips/kernel/mips_ksyms.c | 8 --------
 arch/mips/lib/csum_partial.S  | 6 ++++++
 2 files changed, 6 insertions(+), 8 deletions(-)

diff --git a/arch/mips/kernel/mips_ksyms.c b/arch/mips/kernel/mips_ksyms.c
index ed571bc..3ba65d7 100644
--- a/arch/mips/kernel/mips_ksyms.c
+++ b/arch/mips/kernel/mips_ksyms.c
@@ -70,11 +70,3 @@ EXPORT_SYMBOL(__strnlen_kernel_nocheck_asm);
 EXPORT_SYMBOL(__strnlen_kernel_asm);
 EXPORT_SYMBOL(__strnlen_user_nocheck_asm);
 EXPORT_SYMBOL(__strnlen_user_asm);
-
-#ifndef CONFIG_CPU_MIPSR6
-EXPORT_SYMBOL(csum_partial);
-EXPORT_SYMBOL(csum_partial_copy_nocheck);
-EXPORT_SYMBOL(__csum_partial_copy_kernel);
-EXPORT_SYMBOL(__csum_partial_copy_to_user);
-EXPORT_SYMBOL(__csum_partial_copy_from_user);
-#endif
diff --git a/arch/mips/lib/csum_partial.S b/arch/mips/lib/csum_partial.S
index ed88647..2ff84f4 100644
--- a/arch/mips/lib/csum_partial.S
+++ b/arch/mips/lib/csum_partial.S
@@ -13,6 +13,7 @@
 #include <linux/errno.h>
 #include <asm/asm.h>
 #include <asm/asm-offsets.h>
+#include <asm/export.h>
 #include <asm/regdef.h>
 
 #ifdef CONFIG_64BIT
@@ -103,6 +104,7 @@
 	.set	noreorder
 	.align	5
 LEAF(csum_partial)
+EXPORT_SYMBOL(csum_partial)
 	move	sum, zero
 	move	t7, zero
 
@@ -460,6 +462,7 @@ LEAF(csum_partial)
 #endif
 	.if \__nocheck == 1
 	FEXPORT(csum_partial_copy_nocheck)
+	EXPORT_SYMBOL(csum_partial_copy_nocheck)
 	.endif
 	move	sum, zero
 	move	odd, zero
@@ -823,9 +826,12 @@ LEAF(csum_partial)
 	.endm
 
 LEAF(__csum_partial_copy_kernel)
+EXPORT_SYMBOL(__csum_partial_copy_kernel)
 #ifndef CONFIG_EVA
 FEXPORT(__csum_partial_copy_to_user)
+EXPORT_SYMBOL(__csum_partial_copy_to_user)
 FEXPORT(__csum_partial_copy_from_user)
+EXPORT_SYMBOL(__csum_partial_copy_from_user)
 #endif
 __BUILD_CSUM_PARTIAL_COPY_USER LEGACY_MODE USEROP USEROP 1
 END(__csum_partial_copy_kernel)
-- 
2.10.2

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

* [PATCH 07/10] MIPS: Export csum functions alongside their definitions
  2016-11-07 11:14 ` [PATCH 07/10] MIPS: Export csum functions alongside their definitions Paul Burton
@ 2016-11-07 11:14   ` Paul Burton
  0 siblings, 0 replies; 33+ messages in thread
From: Paul Burton @ 2016-11-07 11:14 UTC (permalink / raw)
  To: linux-mips; +Cc: Ralf Baechle, Paul Burton

Now that EXPORT_SYMBOL can be used from assembly source, move the
EXPORT_SYMBOL invocations for the csum_partial_* functions to be
alongside their definitions.

Signed-off-by: Paul Burton <paul.burton@imgtec.com>
---

 arch/mips/kernel/mips_ksyms.c | 8 --------
 arch/mips/lib/csum_partial.S  | 6 ++++++
 2 files changed, 6 insertions(+), 8 deletions(-)

diff --git a/arch/mips/kernel/mips_ksyms.c b/arch/mips/kernel/mips_ksyms.c
index ed571bc..3ba65d7 100644
--- a/arch/mips/kernel/mips_ksyms.c
+++ b/arch/mips/kernel/mips_ksyms.c
@@ -70,11 +70,3 @@ EXPORT_SYMBOL(__strnlen_kernel_nocheck_asm);
 EXPORT_SYMBOL(__strnlen_kernel_asm);
 EXPORT_SYMBOL(__strnlen_user_nocheck_asm);
 EXPORT_SYMBOL(__strnlen_user_asm);
-
-#ifndef CONFIG_CPU_MIPSR6
-EXPORT_SYMBOL(csum_partial);
-EXPORT_SYMBOL(csum_partial_copy_nocheck);
-EXPORT_SYMBOL(__csum_partial_copy_kernel);
-EXPORT_SYMBOL(__csum_partial_copy_to_user);
-EXPORT_SYMBOL(__csum_partial_copy_from_user);
-#endif
diff --git a/arch/mips/lib/csum_partial.S b/arch/mips/lib/csum_partial.S
index ed88647..2ff84f4 100644
--- a/arch/mips/lib/csum_partial.S
+++ b/arch/mips/lib/csum_partial.S
@@ -13,6 +13,7 @@
 #include <linux/errno.h>
 #include <asm/asm.h>
 #include <asm/asm-offsets.h>
+#include <asm/export.h>
 #include <asm/regdef.h>
 
 #ifdef CONFIG_64BIT
@@ -103,6 +104,7 @@
 	.set	noreorder
 	.align	5
 LEAF(csum_partial)
+EXPORT_SYMBOL(csum_partial)
 	move	sum, zero
 	move	t7, zero
 
@@ -460,6 +462,7 @@ LEAF(csum_partial)
 #endif
 	.if \__nocheck == 1
 	FEXPORT(csum_partial_copy_nocheck)
+	EXPORT_SYMBOL(csum_partial_copy_nocheck)
 	.endif
 	move	sum, zero
 	move	odd, zero
@@ -823,9 +826,12 @@ LEAF(csum_partial)
 	.endm
 
 LEAF(__csum_partial_copy_kernel)
+EXPORT_SYMBOL(__csum_partial_copy_kernel)
 #ifndef CONFIG_EVA
 FEXPORT(__csum_partial_copy_to_user)
+EXPORT_SYMBOL(__csum_partial_copy_to_user)
 FEXPORT(__csum_partial_copy_from_user)
+EXPORT_SYMBOL(__csum_partial_copy_from_user)
 #endif
 __BUILD_CSUM_PARTIAL_COPY_USER LEGACY_MODE USEROP USEROP 1
 END(__csum_partial_copy_kernel)
-- 
2.10.2

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

* [PATCH 08/10] MIPS: Export string functions alongside their definitions
  2016-11-07 11:14 [PATCH 00/10] MIPS: Cleanup EXPORT_SYMBOL usage Paul Burton
                   ` (7 preceding siblings ...)
  2016-11-07 11:14 ` [PATCH 07/10] MIPS: Export csum functions alongside their definitions Paul Burton
@ 2016-11-07 11:14 ` Paul Burton
  2016-11-07 11:14   ` Paul Burton
  2016-11-07 11:14 ` [PATCH 09/10] MIPS: Export memcpy & memset " Paul Burton
  2016-11-07 11:14 ` [PATCH 10/10] MIPS: Export {copy,clear}_page " Paul Burton
  10 siblings, 1 reply; 33+ messages in thread
From: Paul Burton @ 2016-11-07 11:14 UTC (permalink / raw)
  To: linux-mips; +Cc: Ralf Baechle, Paul Burton

Now that EXPORT_SYMBOL can be used from assembly source, move the
EXPORT_SYMBOL invocations for the strlen*, strnlen* & strncpy* functions
to be alongside their definitions.

Signed-off-by: Paul Burton <paul.burton@imgtec.com>
---

 arch/mips/kernel/mips_ksyms.c | 24 ------------------------
 arch/mips/lib/strlen_user.S   |  2 ++
 arch/mips/lib/strncpy_user.S  |  5 +++++
 arch/mips/lib/strnlen_user.S  |  3 +++
 4 files changed, 10 insertions(+), 24 deletions(-)

diff --git a/arch/mips/kernel/mips_ksyms.c b/arch/mips/kernel/mips_ksyms.c
index 3ba65d7..dd65676 100644
--- a/arch/mips/kernel/mips_ksyms.c
+++ b/arch/mips/kernel/mips_ksyms.c
@@ -19,20 +19,6 @@
 
 extern void *__bzero_kernel(void *__s, size_t __count);
 extern void *__bzero(void *__s, size_t __count);
-extern long __strncpy_from_kernel_nocheck_asm(char *__to,
-					      const char *__from, long __len);
-extern long __strncpy_from_kernel_asm(char *__to, const char *__from,
-				      long __len);
-extern long __strncpy_from_user_nocheck_asm(char *__to,
-					    const char *__from, long __len);
-extern long __strncpy_from_user_asm(char *__to, const char *__from,
-				    long __len);
-extern long __strlen_kernel_asm(const char *s);
-extern long __strlen_user_asm(const char *s);
-extern long __strnlen_kernel_nocheck_asm(const char *s);
-extern long __strnlen_kernel_asm(const char *s);
-extern long __strnlen_user_nocheck_asm(const char *s);
-extern long __strnlen_user_asm(const char *s);
 
 /*
  * String functions
@@ -60,13 +46,3 @@ EXPORT_SYMBOL(__copy_user_inatomic_eva);
 EXPORT_SYMBOL(__bzero_kernel);
 #endif
 EXPORT_SYMBOL(__bzero);
-EXPORT_SYMBOL(__strncpy_from_kernel_nocheck_asm);
-EXPORT_SYMBOL(__strncpy_from_kernel_asm);
-EXPORT_SYMBOL(__strncpy_from_user_nocheck_asm);
-EXPORT_SYMBOL(__strncpy_from_user_asm);
-EXPORT_SYMBOL(__strlen_kernel_asm);
-EXPORT_SYMBOL(__strlen_user_asm);
-EXPORT_SYMBOL(__strnlen_kernel_nocheck_asm);
-EXPORT_SYMBOL(__strnlen_kernel_asm);
-EXPORT_SYMBOL(__strnlen_user_nocheck_asm);
-EXPORT_SYMBOL(__strnlen_user_asm);
diff --git a/arch/mips/lib/strlen_user.S b/arch/mips/lib/strlen_user.S
index 929bbac..c9cb7e6 100644
--- a/arch/mips/lib/strlen_user.S
+++ b/arch/mips/lib/strlen_user.S
@@ -9,6 +9,7 @@
  */
 #include <asm/asm.h>
 #include <asm/asm-offsets.h>
+#include <asm/export.h>
 #include <asm/regdef.h>
 
 #define EX(insn,reg,addr,handler)			\
@@ -24,6 +25,7 @@
  */
 	.macro __BUILD_STRLEN_ASM func
 LEAF(__strlen_\func\()_asm)
+EXPORT_SYMBOL(__strlen_\func\()_asm)
 	LONG_L		v0, TI_ADDR_LIMIT($28)	# pointer ok?
 	and		v0, a0
 	bnez		v0, .Lfault\@
diff --git a/arch/mips/lib/strncpy_user.S b/arch/mips/lib/strncpy_user.S
index 3c32baf..af745b1 100644
--- a/arch/mips/lib/strncpy_user.S
+++ b/arch/mips/lib/strncpy_user.S
@@ -9,6 +9,7 @@
 #include <linux/errno.h>
 #include <asm/asm.h>
 #include <asm/asm-offsets.h>
+#include <asm/export.h>
 #include <asm/regdef.h>
 
 #define EX(insn,reg,addr,handler)			\
@@ -30,11 +31,13 @@
 
 	.macro __BUILD_STRNCPY_ASM func
 LEAF(__strncpy_from_\func\()_asm)
+EXPORT_SYMBOL(__strncpy_from_\func\()_asm)
 	LONG_L		v0, TI_ADDR_LIMIT($28)	# pointer ok?
 	and		v0, a1
 	bnez		v0, .Lfault\@
 
 FEXPORT(__strncpy_from_\func\()_nocheck_asm)
+EXPORT_SYMBOL(__strncpy_from_\func\()_nocheck_asm)
 	move		t0, zero
 	move		v1, a1
 .ifeqs "\func","kernel"
@@ -72,6 +75,8 @@ FEXPORT(__strncpy_from_\func\()_nocheck_asm)
 	.global __strncpy_from_user_nocheck_asm
 	.set __strncpy_from_user_asm, __strncpy_from_kernel_asm
 	.set __strncpy_from_user_nocheck_asm, __strncpy_from_kernel_nocheck_asm
+	EXPORT_SYMBOL(__strncpy_from_user_asm)
+	EXPORT_SYMBOL(__strncpy_from_user_nocheck_asm)
 #endif
 
 __BUILD_STRNCPY_ASM kernel
diff --git a/arch/mips/lib/strnlen_user.S b/arch/mips/lib/strnlen_user.S
index 77e6494..3ac3816 100644
--- a/arch/mips/lib/strnlen_user.S
+++ b/arch/mips/lib/strnlen_user.S
@@ -8,6 +8,7 @@
  */
 #include <asm/asm.h>
 #include <asm/asm-offsets.h>
+#include <asm/export.h>
 #include <asm/regdef.h>
 
 #define EX(insn,reg,addr,handler)			\
@@ -27,11 +28,13 @@
  */
 	.macro __BUILD_STRNLEN_ASM func
 LEAF(__strnlen_\func\()_asm)
+EXPORT_SYMBOL(__strnlen_\func\()_asm)
 	LONG_L		v0, TI_ADDR_LIMIT($28)	# pointer ok?
 	and		v0, a0
 	bnez		v0, .Lfault\@
 
 FEXPORT(__strnlen_\func\()_nocheck_asm)
+EXPORT_SYMBOL(__strnlen_\func\()_nocheck_asm)
 	move		v0, a0
 	PTR_ADDU	a1, a0			# stop pointer
 1:
-- 
2.10.2

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

* [PATCH 08/10] MIPS: Export string functions alongside their definitions
  2016-11-07 11:14 ` [PATCH 08/10] MIPS: Export string " Paul Burton
@ 2016-11-07 11:14   ` Paul Burton
  0 siblings, 0 replies; 33+ messages in thread
From: Paul Burton @ 2016-11-07 11:14 UTC (permalink / raw)
  To: linux-mips; +Cc: Ralf Baechle, Paul Burton

Now that EXPORT_SYMBOL can be used from assembly source, move the
EXPORT_SYMBOL invocations for the strlen*, strnlen* & strncpy* functions
to be alongside their definitions.

Signed-off-by: Paul Burton <paul.burton@imgtec.com>
---

 arch/mips/kernel/mips_ksyms.c | 24 ------------------------
 arch/mips/lib/strlen_user.S   |  2 ++
 arch/mips/lib/strncpy_user.S  |  5 +++++
 arch/mips/lib/strnlen_user.S  |  3 +++
 4 files changed, 10 insertions(+), 24 deletions(-)

diff --git a/arch/mips/kernel/mips_ksyms.c b/arch/mips/kernel/mips_ksyms.c
index 3ba65d7..dd65676 100644
--- a/arch/mips/kernel/mips_ksyms.c
+++ b/arch/mips/kernel/mips_ksyms.c
@@ -19,20 +19,6 @@
 
 extern void *__bzero_kernel(void *__s, size_t __count);
 extern void *__bzero(void *__s, size_t __count);
-extern long __strncpy_from_kernel_nocheck_asm(char *__to,
-					      const char *__from, long __len);
-extern long __strncpy_from_kernel_asm(char *__to, const char *__from,
-				      long __len);
-extern long __strncpy_from_user_nocheck_asm(char *__to,
-					    const char *__from, long __len);
-extern long __strncpy_from_user_asm(char *__to, const char *__from,
-				    long __len);
-extern long __strlen_kernel_asm(const char *s);
-extern long __strlen_user_asm(const char *s);
-extern long __strnlen_kernel_nocheck_asm(const char *s);
-extern long __strnlen_kernel_asm(const char *s);
-extern long __strnlen_user_nocheck_asm(const char *s);
-extern long __strnlen_user_asm(const char *s);
 
 /*
  * String functions
@@ -60,13 +46,3 @@ EXPORT_SYMBOL(__copy_user_inatomic_eva);
 EXPORT_SYMBOL(__bzero_kernel);
 #endif
 EXPORT_SYMBOL(__bzero);
-EXPORT_SYMBOL(__strncpy_from_kernel_nocheck_asm);
-EXPORT_SYMBOL(__strncpy_from_kernel_asm);
-EXPORT_SYMBOL(__strncpy_from_user_nocheck_asm);
-EXPORT_SYMBOL(__strncpy_from_user_asm);
-EXPORT_SYMBOL(__strlen_kernel_asm);
-EXPORT_SYMBOL(__strlen_user_asm);
-EXPORT_SYMBOL(__strnlen_kernel_nocheck_asm);
-EXPORT_SYMBOL(__strnlen_kernel_asm);
-EXPORT_SYMBOL(__strnlen_user_nocheck_asm);
-EXPORT_SYMBOL(__strnlen_user_asm);
diff --git a/arch/mips/lib/strlen_user.S b/arch/mips/lib/strlen_user.S
index 929bbac..c9cb7e6 100644
--- a/arch/mips/lib/strlen_user.S
+++ b/arch/mips/lib/strlen_user.S
@@ -9,6 +9,7 @@
  */
 #include <asm/asm.h>
 #include <asm/asm-offsets.h>
+#include <asm/export.h>
 #include <asm/regdef.h>
 
 #define EX(insn,reg,addr,handler)			\
@@ -24,6 +25,7 @@
  */
 	.macro __BUILD_STRLEN_ASM func
 LEAF(__strlen_\func\()_asm)
+EXPORT_SYMBOL(__strlen_\func\()_asm)
 	LONG_L		v0, TI_ADDR_LIMIT($28)	# pointer ok?
 	and		v0, a0
 	bnez		v0, .Lfault\@
diff --git a/arch/mips/lib/strncpy_user.S b/arch/mips/lib/strncpy_user.S
index 3c32baf..af745b1 100644
--- a/arch/mips/lib/strncpy_user.S
+++ b/arch/mips/lib/strncpy_user.S
@@ -9,6 +9,7 @@
 #include <linux/errno.h>
 #include <asm/asm.h>
 #include <asm/asm-offsets.h>
+#include <asm/export.h>
 #include <asm/regdef.h>
 
 #define EX(insn,reg,addr,handler)			\
@@ -30,11 +31,13 @@
 
 	.macro __BUILD_STRNCPY_ASM func
 LEAF(__strncpy_from_\func\()_asm)
+EXPORT_SYMBOL(__strncpy_from_\func\()_asm)
 	LONG_L		v0, TI_ADDR_LIMIT($28)	# pointer ok?
 	and		v0, a1
 	bnez		v0, .Lfault\@
 
 FEXPORT(__strncpy_from_\func\()_nocheck_asm)
+EXPORT_SYMBOL(__strncpy_from_\func\()_nocheck_asm)
 	move		t0, zero
 	move		v1, a1
 .ifeqs "\func","kernel"
@@ -72,6 +75,8 @@ FEXPORT(__strncpy_from_\func\()_nocheck_asm)
 	.global __strncpy_from_user_nocheck_asm
 	.set __strncpy_from_user_asm, __strncpy_from_kernel_asm
 	.set __strncpy_from_user_nocheck_asm, __strncpy_from_kernel_nocheck_asm
+	EXPORT_SYMBOL(__strncpy_from_user_asm)
+	EXPORT_SYMBOL(__strncpy_from_user_nocheck_asm)
 #endif
 
 __BUILD_STRNCPY_ASM kernel
diff --git a/arch/mips/lib/strnlen_user.S b/arch/mips/lib/strnlen_user.S
index 77e6494..3ac3816 100644
--- a/arch/mips/lib/strnlen_user.S
+++ b/arch/mips/lib/strnlen_user.S
@@ -8,6 +8,7 @@
  */
 #include <asm/asm.h>
 #include <asm/asm-offsets.h>
+#include <asm/export.h>
 #include <asm/regdef.h>
 
 #define EX(insn,reg,addr,handler)			\
@@ -27,11 +28,13 @@
  */
 	.macro __BUILD_STRNLEN_ASM func
 LEAF(__strnlen_\func\()_asm)
+EXPORT_SYMBOL(__strnlen_\func\()_asm)
 	LONG_L		v0, TI_ADDR_LIMIT($28)	# pointer ok?
 	and		v0, a0
 	bnez		v0, .Lfault\@
 
 FEXPORT(__strnlen_\func\()_nocheck_asm)
+EXPORT_SYMBOL(__strnlen_\func\()_nocheck_asm)
 	move		v0, a0
 	PTR_ADDU	a1, a0			# stop pointer
 1:
-- 
2.10.2

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

* [PATCH 09/10] MIPS: Export memcpy & memset functions alongside their definitions
  2016-11-07 11:14 [PATCH 00/10] MIPS: Cleanup EXPORT_SYMBOL usage Paul Burton
                   ` (8 preceding siblings ...)
  2016-11-07 11:14 ` [PATCH 08/10] MIPS: Export string " Paul Burton
@ 2016-11-07 11:14 ` Paul Burton
  2016-11-07 11:14   ` Paul Burton
  2016-11-07 11:14 ` [PATCH 10/10] MIPS: Export {copy,clear}_page " Paul Burton
  10 siblings, 1 reply; 33+ messages in thread
From: Paul Burton @ 2016-11-07 11:14 UTC (permalink / raw)
  To: linux-mips; +Cc: Ralf Baechle, Paul Burton

Now that EXPORT_SYMBOL can be used from assembly source, move the
EXPORT_SYMBOL invocations for the memcpy & memset functions & variants
thereof to be alongside their definitions.

Signed-off-by: Paul Burton <paul.burton@imgtec.com>
---

 arch/mips/cavium-octeon/octeon-memcpy.S |  5 +++++
 arch/mips/kernel/mips_ksyms.c           | 24 ------------------------
 arch/mips/lib/memcpy.S                  |  9 +++++++++
 arch/mips/lib/memset.S                  |  5 +++++
 4 files changed, 19 insertions(+), 24 deletions(-)

diff --git a/arch/mips/cavium-octeon/octeon-memcpy.S b/arch/mips/cavium-octeon/octeon-memcpy.S
index 64e08df..7d96d9c 100644
--- a/arch/mips/cavium-octeon/octeon-memcpy.S
+++ b/arch/mips/cavium-octeon/octeon-memcpy.S
@@ -15,6 +15,7 @@
 
 #include <asm/asm.h>
 #include <asm/asm-offsets.h>
+#include <asm/export.h>
 #include <asm/regdef.h>
 
 #define dst a0
@@ -142,6 +143,7 @@
  * t7 is used as a flag to note inatomic mode.
  */
 LEAF(__copy_user_inatomic)
+EXPORT_SYMBOL(__copy_user_inatomic)
 	b	__copy_user_common
 	 li	t7, 1
 	END(__copy_user_inatomic)
@@ -154,9 +156,11 @@ LEAF(__copy_user_inatomic)
  */
 	.align	5
 LEAF(memcpy)					/* a0=dst a1=src a2=len */
+EXPORT_SYMBOL(memcpy)
 	move	v0, dst				/* return value */
 __memcpy:
 FEXPORT(__copy_user)
+EXPORT_SYMBOL(__copy_user)
 	li	t7, 0				/* not inatomic */
 __copy_user_common:
 	/*
@@ -459,6 +463,7 @@ s_exc:
 
 	.align	5
 LEAF(memmove)
+EXPORT_SYMBOL(memmove)
 	ADD	t0, a0, a2
 	ADD	t1, a1, a2
 	sltu	t0, a1, t0			# dst + len <= src -> memcpy
diff --git a/arch/mips/kernel/mips_ksyms.c b/arch/mips/kernel/mips_ksyms.c
index dd65676..c641fd0 100644
--- a/arch/mips/kernel/mips_ksyms.c
+++ b/arch/mips/kernel/mips_ksyms.c
@@ -17,32 +17,8 @@
 #include <asm/fpu.h>
 #include <asm/msa.h>
 
-extern void *__bzero_kernel(void *__s, size_t __count);
-extern void *__bzero(void *__s, size_t __count);
-
-/*
- * String functions
- */
-EXPORT_SYMBOL(memset);
-EXPORT_SYMBOL(memcpy);
-EXPORT_SYMBOL(memmove);
-
 /*
  * Functions that operate on entire pages.  Mostly used by memory management.
  */
 EXPORT_SYMBOL(clear_page);
 EXPORT_SYMBOL(copy_page);
-
-/*
- * Userspace access stuff.
- */
-EXPORT_SYMBOL(__copy_user);
-EXPORT_SYMBOL(__copy_user_inatomic);
-#ifdef CONFIG_EVA
-EXPORT_SYMBOL(__copy_from_user_eva);
-EXPORT_SYMBOL(__copy_in_user_eva);
-EXPORT_SYMBOL(__copy_to_user_eva);
-EXPORT_SYMBOL(__copy_user_inatomic_eva);
-EXPORT_SYMBOL(__bzero_kernel);
-#endif
-EXPORT_SYMBOL(__bzero);
diff --git a/arch/mips/lib/memcpy.S b/arch/mips/lib/memcpy.S
index 6c303a9..c3031f1 100644
--- a/arch/mips/lib/memcpy.S
+++ b/arch/mips/lib/memcpy.S
@@ -31,6 +31,7 @@
 
 #include <asm/asm.h>
 #include <asm/asm-offsets.h>
+#include <asm/export.h>
 #include <asm/regdef.h>
 
 #define dst a0
@@ -622,6 +623,7 @@ SEXC(1)
 
 	.align	5
 LEAF(memmove)
+EXPORT_SYMBOL(memmove)
 	ADD	t0, a0, a2
 	ADD	t1, a1, a2
 	sltu	t0, a1, t0			# dst + len <= src -> memcpy
@@ -674,6 +676,7 @@ LEAF(__rmemcpy)					/* a0=dst a1=src a2=len */
  * t6 is used as a flag to note inatomic mode.
  */
 LEAF(__copy_user_inatomic)
+EXPORT_SYMBOL(__copy_user_inatomic)
 	b	__copy_user_common
 	li	t6, 1
 	END(__copy_user_inatomic)
@@ -686,9 +689,11 @@ LEAF(__copy_user_inatomic)
  */
 	.align	5
 LEAF(memcpy)					/* a0=dst a1=src a2=len */
+EXPORT_SYMBOL(memcpy)
 	move	v0, dst				/* return value */
 .L__memcpy:
 FEXPORT(__copy_user)
+EXPORT_SYMBOL(__copy_user)
 	li	t6, 0	/* not inatomic */
 __copy_user_common:
 	/* Legacy Mode, user <-> user */
@@ -704,6 +709,7 @@ __copy_user_common:
  */
 
 LEAF(__copy_user_inatomic_eva)
+EXPORT_SYMBOL(__copy_user_inatomic_eva)
 	b       __copy_from_user_common
 	li	t6, 1
 	END(__copy_user_inatomic_eva)
@@ -713,6 +719,7 @@ LEAF(__copy_user_inatomic_eva)
  */
 
 LEAF(__copy_from_user_eva)
+EXPORT_SYMBOL(__copy_from_user_eva)
 	li	t6, 0	/* not inatomic */
 __copy_from_user_common:
 	__BUILD_COPY_USER EVA_MODE USEROP KERNELOP
@@ -725,6 +732,7 @@ END(__copy_from_user_eva)
  */
 
 LEAF(__copy_to_user_eva)
+EXPORT_SYMBOL(__copy_to_user_eva)
 __BUILD_COPY_USER EVA_MODE KERNELOP USEROP
 END(__copy_to_user_eva)
 
@@ -733,6 +741,7 @@ END(__copy_to_user_eva)
  */
 
 LEAF(__copy_in_user_eva)
+EXPORT_SYMBOL(__copy_in_user_eva)
 __BUILD_COPY_USER EVA_MODE USEROP USEROP
 END(__copy_in_user_eva)
 
diff --git a/arch/mips/lib/memset.S b/arch/mips/lib/memset.S
index 18a1ccd..a145666 100644
--- a/arch/mips/lib/memset.S
+++ b/arch/mips/lib/memset.S
@@ -10,6 +10,7 @@
  */
 #include <asm/asm.h>
 #include <asm/asm-offsets.h>
+#include <asm/export.h>
 #include <asm/regdef.h>
 
 #if LONGSIZE == 4
@@ -270,6 +271,7 @@
  */
 
 LEAF(memset)
+EXPORT_SYMBOL(memset)
 	beqz		a1, 1f
 	move		v0, a0			/* result */
 
@@ -285,13 +287,16 @@ LEAF(memset)
 1:
 #ifndef CONFIG_EVA
 FEXPORT(__bzero)
+EXPORT_SYMBOL(__bzero)
 #else
 FEXPORT(__bzero_kernel)
+EXPORT_SYMBOL(__bzero_kernel)
 #endif
 	__BUILD_BZERO LEGACY_MODE
 
 #ifdef CONFIG_EVA
 LEAF(__bzero)
+EXPORT_SYMBOL(__bzero)
 	__BUILD_BZERO EVA_MODE
 END(__bzero)
 #endif
-- 
2.10.2

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

* [PATCH 09/10] MIPS: Export memcpy & memset functions alongside their definitions
  2016-11-07 11:14 ` [PATCH 09/10] MIPS: Export memcpy & memset " Paul Burton
@ 2016-11-07 11:14   ` Paul Burton
  0 siblings, 0 replies; 33+ messages in thread
From: Paul Burton @ 2016-11-07 11:14 UTC (permalink / raw)
  To: linux-mips; +Cc: Ralf Baechle, Paul Burton

Now that EXPORT_SYMBOL can be used from assembly source, move the
EXPORT_SYMBOL invocations for the memcpy & memset functions & variants
thereof to be alongside their definitions.

Signed-off-by: Paul Burton <paul.burton@imgtec.com>
---

 arch/mips/cavium-octeon/octeon-memcpy.S |  5 +++++
 arch/mips/kernel/mips_ksyms.c           | 24 ------------------------
 arch/mips/lib/memcpy.S                  |  9 +++++++++
 arch/mips/lib/memset.S                  |  5 +++++
 4 files changed, 19 insertions(+), 24 deletions(-)

diff --git a/arch/mips/cavium-octeon/octeon-memcpy.S b/arch/mips/cavium-octeon/octeon-memcpy.S
index 64e08df..7d96d9c 100644
--- a/arch/mips/cavium-octeon/octeon-memcpy.S
+++ b/arch/mips/cavium-octeon/octeon-memcpy.S
@@ -15,6 +15,7 @@
 
 #include <asm/asm.h>
 #include <asm/asm-offsets.h>
+#include <asm/export.h>
 #include <asm/regdef.h>
 
 #define dst a0
@@ -142,6 +143,7 @@
  * t7 is used as a flag to note inatomic mode.
  */
 LEAF(__copy_user_inatomic)
+EXPORT_SYMBOL(__copy_user_inatomic)
 	b	__copy_user_common
 	 li	t7, 1
 	END(__copy_user_inatomic)
@@ -154,9 +156,11 @@ LEAF(__copy_user_inatomic)
  */
 	.align	5
 LEAF(memcpy)					/* a0=dst a1=src a2=len */
+EXPORT_SYMBOL(memcpy)
 	move	v0, dst				/* return value */
 __memcpy:
 FEXPORT(__copy_user)
+EXPORT_SYMBOL(__copy_user)
 	li	t7, 0				/* not inatomic */
 __copy_user_common:
 	/*
@@ -459,6 +463,7 @@ s_exc:
 
 	.align	5
 LEAF(memmove)
+EXPORT_SYMBOL(memmove)
 	ADD	t0, a0, a2
 	ADD	t1, a1, a2
 	sltu	t0, a1, t0			# dst + len <= src -> memcpy
diff --git a/arch/mips/kernel/mips_ksyms.c b/arch/mips/kernel/mips_ksyms.c
index dd65676..c641fd0 100644
--- a/arch/mips/kernel/mips_ksyms.c
+++ b/arch/mips/kernel/mips_ksyms.c
@@ -17,32 +17,8 @@
 #include <asm/fpu.h>
 #include <asm/msa.h>
 
-extern void *__bzero_kernel(void *__s, size_t __count);
-extern void *__bzero(void *__s, size_t __count);
-
-/*
- * String functions
- */
-EXPORT_SYMBOL(memset);
-EXPORT_SYMBOL(memcpy);
-EXPORT_SYMBOL(memmove);
-
 /*
  * Functions that operate on entire pages.  Mostly used by memory management.
  */
 EXPORT_SYMBOL(clear_page);
 EXPORT_SYMBOL(copy_page);
-
-/*
- * Userspace access stuff.
- */
-EXPORT_SYMBOL(__copy_user);
-EXPORT_SYMBOL(__copy_user_inatomic);
-#ifdef CONFIG_EVA
-EXPORT_SYMBOL(__copy_from_user_eva);
-EXPORT_SYMBOL(__copy_in_user_eva);
-EXPORT_SYMBOL(__copy_to_user_eva);
-EXPORT_SYMBOL(__copy_user_inatomic_eva);
-EXPORT_SYMBOL(__bzero_kernel);
-#endif
-EXPORT_SYMBOL(__bzero);
diff --git a/arch/mips/lib/memcpy.S b/arch/mips/lib/memcpy.S
index 6c303a9..c3031f1 100644
--- a/arch/mips/lib/memcpy.S
+++ b/arch/mips/lib/memcpy.S
@@ -31,6 +31,7 @@
 
 #include <asm/asm.h>
 #include <asm/asm-offsets.h>
+#include <asm/export.h>
 #include <asm/regdef.h>
 
 #define dst a0
@@ -622,6 +623,7 @@ SEXC(1)
 
 	.align	5
 LEAF(memmove)
+EXPORT_SYMBOL(memmove)
 	ADD	t0, a0, a2
 	ADD	t1, a1, a2
 	sltu	t0, a1, t0			# dst + len <= src -> memcpy
@@ -674,6 +676,7 @@ LEAF(__rmemcpy)					/* a0=dst a1=src a2=len */
  * t6 is used as a flag to note inatomic mode.
  */
 LEAF(__copy_user_inatomic)
+EXPORT_SYMBOL(__copy_user_inatomic)
 	b	__copy_user_common
 	li	t6, 1
 	END(__copy_user_inatomic)
@@ -686,9 +689,11 @@ LEAF(__copy_user_inatomic)
  */
 	.align	5
 LEAF(memcpy)					/* a0=dst a1=src a2=len */
+EXPORT_SYMBOL(memcpy)
 	move	v0, dst				/* return value */
 .L__memcpy:
 FEXPORT(__copy_user)
+EXPORT_SYMBOL(__copy_user)
 	li	t6, 0	/* not inatomic */
 __copy_user_common:
 	/* Legacy Mode, user <-> user */
@@ -704,6 +709,7 @@ __copy_user_common:
  */
 
 LEAF(__copy_user_inatomic_eva)
+EXPORT_SYMBOL(__copy_user_inatomic_eva)
 	b       __copy_from_user_common
 	li	t6, 1
 	END(__copy_user_inatomic_eva)
@@ -713,6 +719,7 @@ LEAF(__copy_user_inatomic_eva)
  */
 
 LEAF(__copy_from_user_eva)
+EXPORT_SYMBOL(__copy_from_user_eva)
 	li	t6, 0	/* not inatomic */
 __copy_from_user_common:
 	__BUILD_COPY_USER EVA_MODE USEROP KERNELOP
@@ -725,6 +732,7 @@ END(__copy_from_user_eva)
  */
 
 LEAF(__copy_to_user_eva)
+EXPORT_SYMBOL(__copy_to_user_eva)
 __BUILD_COPY_USER EVA_MODE KERNELOP USEROP
 END(__copy_to_user_eva)
 
@@ -733,6 +741,7 @@ END(__copy_to_user_eva)
  */
 
 LEAF(__copy_in_user_eva)
+EXPORT_SYMBOL(__copy_in_user_eva)
 __BUILD_COPY_USER EVA_MODE USEROP USEROP
 END(__copy_in_user_eva)
 
diff --git a/arch/mips/lib/memset.S b/arch/mips/lib/memset.S
index 18a1ccd..a145666 100644
--- a/arch/mips/lib/memset.S
+++ b/arch/mips/lib/memset.S
@@ -10,6 +10,7 @@
  */
 #include <asm/asm.h>
 #include <asm/asm-offsets.h>
+#include <asm/export.h>
 #include <asm/regdef.h>
 
 #if LONGSIZE == 4
@@ -270,6 +271,7 @@
  */
 
 LEAF(memset)
+EXPORT_SYMBOL(memset)
 	beqz		a1, 1f
 	move		v0, a0			/* result */
 
@@ -285,13 +287,16 @@ LEAF(memset)
 1:
 #ifndef CONFIG_EVA
 FEXPORT(__bzero)
+EXPORT_SYMBOL(__bzero)
 #else
 FEXPORT(__bzero_kernel)
+EXPORT_SYMBOL(__bzero_kernel)
 #endif
 	__BUILD_BZERO LEGACY_MODE
 
 #ifdef CONFIG_EVA
 LEAF(__bzero)
+EXPORT_SYMBOL(__bzero)
 	__BUILD_BZERO EVA_MODE
 END(__bzero)
 #endif
-- 
2.10.2

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

* [PATCH 10/10] MIPS: Export {copy,clear}_page functions alongside their definitions
  2016-11-07 11:14 [PATCH 00/10] MIPS: Cleanup EXPORT_SYMBOL usage Paul Burton
                   ` (9 preceding siblings ...)
  2016-11-07 11:14 ` [PATCH 09/10] MIPS: Export memcpy & memset " Paul Burton
@ 2016-11-07 11:14 ` Paul Burton
  2016-11-07 11:14   ` Paul Burton
  10 siblings, 1 reply; 33+ messages in thread
From: Paul Burton @ 2016-11-07 11:14 UTC (permalink / raw)
  To: linux-mips; +Cc: Ralf Baechle, Paul Burton

Now that EXPORT_SYMBOL can be used from assembly source, move the
EXPORT_SYMBOL invocations for the copy_page & clear_page functions to be
alongside their definitions.

With this change there are no longer any symbols exported from
mips_ksyms.c so remove the file.

Signed-off-by: Paul Burton <paul.burton@imgtec.com>

---

 arch/mips/kernel/Makefile     |  2 +-
 arch/mips/kernel/mips_ksyms.c | 24 ------------------------
 arch/mips/mm/page-funcs.S     |  3 +++
 arch/mips/mm/page.c           |  2 ++
 4 files changed, 6 insertions(+), 25 deletions(-)
 delete mode 100644 arch/mips/kernel/mips_ksyms.c

diff --git a/arch/mips/kernel/Makefile b/arch/mips/kernel/Makefile
index 4a603a3..09fca54 100644
--- a/arch/mips/kernel/Makefile
+++ b/arch/mips/kernel/Makefile
@@ -30,7 +30,7 @@ obj-$(CONFIG_SYNC_R4K)		+= sync-r4k.o
 
 obj-$(CONFIG_DEBUG_FS)		+= segment.o
 obj-$(CONFIG_STACKTRACE)	+= stacktrace.o
-obj-$(CONFIG_MODULES)		+= mips_ksyms.o module.o
+obj-$(CONFIG_MODULES)		+= module.o
 obj-$(CONFIG_MODULES_USE_ELF_RELA) += module-rela.o
 
 obj-$(CONFIG_FTRACE_SYSCALLS)	+= ftrace.o
diff --git a/arch/mips/kernel/mips_ksyms.c b/arch/mips/kernel/mips_ksyms.c
deleted file mode 100644
index c641fd0..0000000
--- a/arch/mips/kernel/mips_ksyms.c
+++ /dev/null
@@ -1,24 +0,0 @@
-/*
- * Export MIPS-specific functions needed for loadable modules.
- *
- * This file is subject to the terms and conditions of the GNU General Public
- * License.  See the file "COPYING" in the main directory of this archive
- * for more details.
- *
- * Copyright (C) 1996, 97, 98, 99, 2000, 01, 03, 04, 05, 12 by Ralf Baechle
- * Copyright (C) 1999, 2000, 01 Silicon Graphics, Inc.
- */
-#include <linux/interrupt.h>
-#include <linux/export.h>
-#include <asm/checksum.h>
-#include <linux/mm.h>
-#include <asm/uaccess.h>
-#include <asm/ftrace.h>
-#include <asm/fpu.h>
-#include <asm/msa.h>
-
-/*
- * Functions that operate on entire pages.  Mostly used by memory management.
- */
-EXPORT_SYMBOL(clear_page);
-EXPORT_SYMBOL(copy_page);
diff --git a/arch/mips/mm/page-funcs.S b/arch/mips/mm/page-funcs.S
index 48a6b38..43181ac 100644
--- a/arch/mips/mm/page-funcs.S
+++ b/arch/mips/mm/page-funcs.S
@@ -9,6 +9,7 @@
  * Copyright (C) 2012  Ralf Baechle <ralf@linux-mips.org>
  */
 #include <asm/asm.h>
+#include <asm/export.h>
 #include <asm/regdef.h>
 
 #ifdef CONFIG_SIBYTE_DMA_PAGEOPS
@@ -29,6 +30,7 @@
  */
 EXPORT(__clear_page_start)
 LEAF(cpu_clear_page_function_name)
+EXPORT_SYMBOL(cpu_clear_page_function_name)
 1:	j	1b		/* Dummy, will be replaced. */
 	.space 288
 END(cpu_clear_page_function_name)
@@ -44,6 +46,7 @@ EXPORT(__clear_page_end)
  */
 EXPORT(__copy_page_start)
 LEAF(cpu_copy_page_function_name)
+EXPORT_SYMBOL(cpu_copy_page_function_name)
 1:	j	1b		/* Dummy, will be replaced. */
 	.space 1344
 END(cpu_copy_page_function_name)
diff --git a/arch/mips/mm/page.c b/arch/mips/mm/page.c
index 6f804f5..d5d0299 100644
--- a/arch/mips/mm/page.c
+++ b/arch/mips/mm/page.c
@@ -661,6 +661,7 @@ void clear_page(void *page)
 		;
 	__raw_readq(IOADDR(A_DM_REGISTER(cpu, R_DM_DSCR_BASE)));
 }
+EXPORT_SYMBOL(clear_page);
 
 void copy_page(void *to, void *from)
 {
@@ -687,5 +688,6 @@ void copy_page(void *to, void *from)
 		;
 	__raw_readq(IOADDR(A_DM_REGISTER(cpu, R_DM_DSCR_BASE)));
 }
+EXPORT_SYMBOL(copy_page);
 
 #endif /* CONFIG_SIBYTE_DMA_PAGEOPS */
-- 
2.10.2

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

* [PATCH 10/10] MIPS: Export {copy,clear}_page functions alongside their definitions
  2016-11-07 11:14 ` [PATCH 10/10] MIPS: Export {copy,clear}_page " Paul Burton
@ 2016-11-07 11:14   ` Paul Burton
  0 siblings, 0 replies; 33+ messages in thread
From: Paul Burton @ 2016-11-07 11:14 UTC (permalink / raw)
  To: linux-mips; +Cc: Ralf Baechle, Paul Burton

Now that EXPORT_SYMBOL can be used from assembly source, move the
EXPORT_SYMBOL invocations for the copy_page & clear_page functions to be
alongside their definitions.

With this change there are no longer any symbols exported from
mips_ksyms.c so remove the file.

Signed-off-by: Paul Burton <paul.burton@imgtec.com>

---

 arch/mips/kernel/Makefile     |  2 +-
 arch/mips/kernel/mips_ksyms.c | 24 ------------------------
 arch/mips/mm/page-funcs.S     |  3 +++
 arch/mips/mm/page.c           |  2 ++
 4 files changed, 6 insertions(+), 25 deletions(-)
 delete mode 100644 arch/mips/kernel/mips_ksyms.c

diff --git a/arch/mips/kernel/Makefile b/arch/mips/kernel/Makefile
index 4a603a3..09fca54 100644
--- a/arch/mips/kernel/Makefile
+++ b/arch/mips/kernel/Makefile
@@ -30,7 +30,7 @@ obj-$(CONFIG_SYNC_R4K)		+= sync-r4k.o
 
 obj-$(CONFIG_DEBUG_FS)		+= segment.o
 obj-$(CONFIG_STACKTRACE)	+= stacktrace.o
-obj-$(CONFIG_MODULES)		+= mips_ksyms.o module.o
+obj-$(CONFIG_MODULES)		+= module.o
 obj-$(CONFIG_MODULES_USE_ELF_RELA) += module-rela.o
 
 obj-$(CONFIG_FTRACE_SYSCALLS)	+= ftrace.o
diff --git a/arch/mips/kernel/mips_ksyms.c b/arch/mips/kernel/mips_ksyms.c
deleted file mode 100644
index c641fd0..0000000
--- a/arch/mips/kernel/mips_ksyms.c
+++ /dev/null
@@ -1,24 +0,0 @@
-/*
- * Export MIPS-specific functions needed for loadable modules.
- *
- * This file is subject to the terms and conditions of the GNU General Public
- * License.  See the file "COPYING" in the main directory of this archive
- * for more details.
- *
- * Copyright (C) 1996, 97, 98, 99, 2000, 01, 03, 04, 05, 12 by Ralf Baechle
- * Copyright (C) 1999, 2000, 01 Silicon Graphics, Inc.
- */
-#include <linux/interrupt.h>
-#include <linux/export.h>
-#include <asm/checksum.h>
-#include <linux/mm.h>
-#include <asm/uaccess.h>
-#include <asm/ftrace.h>
-#include <asm/fpu.h>
-#include <asm/msa.h>
-
-/*
- * Functions that operate on entire pages.  Mostly used by memory management.
- */
-EXPORT_SYMBOL(clear_page);
-EXPORT_SYMBOL(copy_page);
diff --git a/arch/mips/mm/page-funcs.S b/arch/mips/mm/page-funcs.S
index 48a6b38..43181ac 100644
--- a/arch/mips/mm/page-funcs.S
+++ b/arch/mips/mm/page-funcs.S
@@ -9,6 +9,7 @@
  * Copyright (C) 2012  Ralf Baechle <ralf@linux-mips.org>
  */
 #include <asm/asm.h>
+#include <asm/export.h>
 #include <asm/regdef.h>
 
 #ifdef CONFIG_SIBYTE_DMA_PAGEOPS
@@ -29,6 +30,7 @@
  */
 EXPORT(__clear_page_start)
 LEAF(cpu_clear_page_function_name)
+EXPORT_SYMBOL(cpu_clear_page_function_name)
 1:	j	1b		/* Dummy, will be replaced. */
 	.space 288
 END(cpu_clear_page_function_name)
@@ -44,6 +46,7 @@ EXPORT(__clear_page_end)
  */
 EXPORT(__copy_page_start)
 LEAF(cpu_copy_page_function_name)
+EXPORT_SYMBOL(cpu_copy_page_function_name)
 1:	j	1b		/* Dummy, will be replaced. */
 	.space 1344
 END(cpu_copy_page_function_name)
diff --git a/arch/mips/mm/page.c b/arch/mips/mm/page.c
index 6f804f5..d5d0299 100644
--- a/arch/mips/mm/page.c
+++ b/arch/mips/mm/page.c
@@ -661,6 +661,7 @@ void clear_page(void *page)
 		;
 	__raw_readq(IOADDR(A_DM_REGISTER(cpu, R_DM_DSCR_BASE)));
 }
+EXPORT_SYMBOL(clear_page);
 
 void copy_page(void *to, void *from)
 {
@@ -687,5 +688,6 @@ void copy_page(void *to, void *from)
 		;
 	__raw_readq(IOADDR(A_DM_REGISTER(cpu, R_DM_DSCR_BASE)));
 }
+EXPORT_SYMBOL(copy_page);
 
 #endif /* CONFIG_SIBYTE_DMA_PAGEOPS */
-- 
2.10.2

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

* [PATCH v2 05/10] MIPS: Export _mcount alongside its definition
  2016-11-07 11:14 ` [PATCH 05/10] MIPS: Export _mcount alongside its definition Paul Burton
  2016-11-07 11:14   ` Paul Burton
@ 2016-11-07 11:48   ` Paul Burton
  2016-11-07 11:48     ` Paul Burton
  1 sibling, 1 reply; 33+ messages in thread
From: Paul Burton @ 2016-11-07 11:48 UTC (permalink / raw)
  To: linux-mips; +Cc: Ralf Baechle, Paul Burton

Now that EXPORT_SYMBOL can be used from assembly source, move the
EXPORT_SYMBOL invocation for _mcount to be alongside its definition.

Signed-off-by: Paul Burton <paul.burton@imgtec.com>

---

Changes in v2:
- Inlcude asm/export.h

 arch/mips/kernel/mcount.S     | 3 +++
 arch/mips/kernel/mips_ksyms.c | 4 ----
 2 files changed, 3 insertions(+), 4 deletions(-)

diff --git a/arch/mips/kernel/mcount.S b/arch/mips/kernel/mcount.S
index 2f7c734..f2ee7e1 100644
--- a/arch/mips/kernel/mcount.S
+++ b/arch/mips/kernel/mcount.S
@@ -10,6 +10,7 @@
  * Author: Wu Zhangjin <wuzhangjin@gmail.com>
  */
 
+#include <asm/export.h>
 #include <asm/regdef.h>
 #include <asm/stackframe.h>
 #include <asm/ftrace.h>
@@ -66,6 +67,7 @@
 NESTED(ftrace_caller, PT_SIZE, ra)
 	.globl _mcount
 _mcount:
+EXPORT_SYMBOL(_mcount)
 	b	ftrace_stub
 #ifdef CONFIG_32BIT
 	 addiu sp,sp,8
@@ -114,6 +116,7 @@ ftrace_stub:
 #else	/* ! CONFIG_DYNAMIC_FTRACE */
 
 NESTED(_mcount, PT_SIZE, ra)
+EXPORT_SYMBOL(_mcount)
 	PTR_LA	t1, ftrace_stub
 	PTR_L	t2, ftrace_trace_function /* Prepare t2 for (1) */
 	bne	t1, t2, static_trace
diff --git a/arch/mips/kernel/mips_ksyms.c b/arch/mips/kernel/mips_ksyms.c
index 84f169b..d12d243 100644
--- a/arch/mips/kernel/mips_ksyms.c
+++ b/arch/mips/kernel/mips_ksyms.c
@@ -80,7 +80,3 @@ EXPORT_SYMBOL(__csum_partial_copy_from_user);
 #endif
 
 EXPORT_SYMBOL(invalid_pte_table);
-#ifdef CONFIG_FUNCTION_TRACER
-/* _mcount is defined in arch/mips/kernel/mcount.S */
-EXPORT_SYMBOL(_mcount);
-#endif
-- 
2.10.2

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

* [PATCH v2 05/10] MIPS: Export _mcount alongside its definition
  2016-11-07 11:48   ` [PATCH v2 " Paul Burton
@ 2016-11-07 11:48     ` Paul Burton
  0 siblings, 0 replies; 33+ messages in thread
From: Paul Burton @ 2016-11-07 11:48 UTC (permalink / raw)
  To: linux-mips; +Cc: Ralf Baechle, Paul Burton

Now that EXPORT_SYMBOL can be used from assembly source, move the
EXPORT_SYMBOL invocation for _mcount to be alongside its definition.

Signed-off-by: Paul Burton <paul.burton@imgtec.com>

---

Changes in v2:
- Inlcude asm/export.h

 arch/mips/kernel/mcount.S     | 3 +++
 arch/mips/kernel/mips_ksyms.c | 4 ----
 2 files changed, 3 insertions(+), 4 deletions(-)

diff --git a/arch/mips/kernel/mcount.S b/arch/mips/kernel/mcount.S
index 2f7c734..f2ee7e1 100644
--- a/arch/mips/kernel/mcount.S
+++ b/arch/mips/kernel/mcount.S
@@ -10,6 +10,7 @@
  * Author: Wu Zhangjin <wuzhangjin@gmail.com>
  */
 
+#include <asm/export.h>
 #include <asm/regdef.h>
 #include <asm/stackframe.h>
 #include <asm/ftrace.h>
@@ -66,6 +67,7 @@
 NESTED(ftrace_caller, PT_SIZE, ra)
 	.globl _mcount
 _mcount:
+EXPORT_SYMBOL(_mcount)
 	b	ftrace_stub
 #ifdef CONFIG_32BIT
 	 addiu sp,sp,8
@@ -114,6 +116,7 @@ ftrace_stub:
 #else	/* ! CONFIG_DYNAMIC_FTRACE */
 
 NESTED(_mcount, PT_SIZE, ra)
+EXPORT_SYMBOL(_mcount)
 	PTR_LA	t1, ftrace_stub
 	PTR_L	t2, ftrace_trace_function /* Prepare t2 for (1) */
 	bne	t1, t2, static_trace
diff --git a/arch/mips/kernel/mips_ksyms.c b/arch/mips/kernel/mips_ksyms.c
index 84f169b..d12d243 100644
--- a/arch/mips/kernel/mips_ksyms.c
+++ b/arch/mips/kernel/mips_ksyms.c
@@ -80,7 +80,3 @@ EXPORT_SYMBOL(__csum_partial_copy_from_user);
 #endif
 
 EXPORT_SYMBOL(invalid_pte_table);
-#ifdef CONFIG_FUNCTION_TRACER
-/* _mcount is defined in arch/mips/kernel/mcount.S */
-EXPORT_SYMBOL(_mcount);
-#endif
-- 
2.10.2

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

* Re: [PATCH 02/10] MIPS: tlbex: Clear ISA bit when writing to handle_tlb{l,m,s}
  2016-11-07 11:14 ` [PATCH 02/10] MIPS: tlbex: Clear ISA bit when writing to handle_tlb{l,m,s} Paul Burton
  2016-11-07 11:14   ` Paul Burton
@ 2016-11-07 12:04   ` Maciej W. Rozycki
  2016-11-07 12:04     ` Maciej W. Rozycki
  1 sibling, 1 reply; 33+ messages in thread
From: Maciej W. Rozycki @ 2016-11-07 12:04 UTC (permalink / raw)
  To: Paul Burton; +Cc: linux-mips, Ralf Baechle

On Mon, 7 Nov 2016, Paul Burton wrote:

> When generating TLB exception handling code we write to memory reserved
> at the handle_tlbl, handle_tlbm & handle_tlbs symbols. Up until now the
> ISA bit has always been clear simply because the assembly code reserving
> the space for those functions places no instructions in them. In
> preparation for marking all LEAF functions as containing code,
> explicitly clear the ISA bit when calculating the addresses at which to
> write TLB exception handling code.
> 
> Signed-off-by: Paul Burton <paul.burton@imgtec.com>
> ---

 You can avoid this extra code and unnecessary run-time calculation by 
defining a data alias and using that instead.  E.g. (expanding LEAF):

		.globl	handle_tlbl
		.globl	handle_tlbl_data
		.align	2
		.type	handle_tlbl, @function
		.ent	handle_tlbl, 0
handle_tlbl:
handle_tlbl_data = .
		.frame  sp, 0, ra

will make `handle_tlbl' and `handle_tlbl_data' both refer to the same 
location, hovewer the latter not being a (code) label will have the ISA 
bit clear, so you'll be able to use it in `build_r4000_tlb_load_handler' 
without a need to clear the ISA bit explicitly as it won't have been set 
in the first place.  See how this comes out in `objdump'.

 You might want to wrap the above piece in a macro, I suppose, maybe even 
do it implicitly in LEAF, etc, or maybe just follow the path of least 
resistance and use:

LEAF(handle_tlbl)
ABS(handle_tlbl_data, .)

etc. in arch/mips/mm/tlb-funcs.S, relying on both macros' internals -- 
being a pseudo `.frame' should not affect the value of `handle_tlbl_data' 
whether it precedes or follows the assignment operation.

 You could use `.set' or `.equ' in place of `=' too; there's also `.equiv' 
with a slightly different semantics as it bails out on an attempt of 
symbol redefinition while the other three ways do not.

 HTH,

  Maciej

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

* Re: [PATCH 02/10] MIPS: tlbex: Clear ISA bit when writing to handle_tlb{l,m,s}
  2016-11-07 12:04   ` Maciej W. Rozycki
@ 2016-11-07 12:04     ` Maciej W. Rozycki
  0 siblings, 0 replies; 33+ messages in thread
From: Maciej W. Rozycki @ 2016-11-07 12:04 UTC (permalink / raw)
  To: Paul Burton; +Cc: linux-mips, Ralf Baechle

On Mon, 7 Nov 2016, Paul Burton wrote:

> When generating TLB exception handling code we write to memory reserved
> at the handle_tlbl, handle_tlbm & handle_tlbs symbols. Up until now the
> ISA bit has always been clear simply because the assembly code reserving
> the space for those functions places no instructions in them. In
> preparation for marking all LEAF functions as containing code,
> explicitly clear the ISA bit when calculating the addresses at which to
> write TLB exception handling code.
> 
> Signed-off-by: Paul Burton <paul.burton@imgtec.com>
> ---

 You can avoid this extra code and unnecessary run-time calculation by 
defining a data alias and using that instead.  E.g. (expanding LEAF):

		.globl	handle_tlbl
		.globl	handle_tlbl_data
		.align	2
		.type	handle_tlbl, @function
		.ent	handle_tlbl, 0
handle_tlbl:
handle_tlbl_data = .
		.frame  sp, 0, ra

will make `handle_tlbl' and `handle_tlbl_data' both refer to the same 
location, hovewer the latter not being a (code) label will have the ISA 
bit clear, so you'll be able to use it in `build_r4000_tlb_load_handler' 
without a need to clear the ISA bit explicitly as it won't have been set 
in the first place.  See how this comes out in `objdump'.

 You might want to wrap the above piece in a macro, I suppose, maybe even 
do it implicitly in LEAF, etc, or maybe just follow the path of least 
resistance and use:

LEAF(handle_tlbl)
ABS(handle_tlbl_data, .)

etc. in arch/mips/mm/tlb-funcs.S, relying on both macros' internals -- 
being a pseudo `.frame' should not affect the value of `handle_tlbl_data' 
whether it precedes or follows the assignment operation.

 You could use `.set' or `.equ' in place of `=' too; there's also `.equiv' 
with a slightly different semantics as it bails out on an attempt of 
symbol redefinition while the other three ways do not.

 HTH,

  Maciej

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

* Re: [PATCH 03/10] MIPS: End asm function prologue macros with .insn
  2016-11-07 11:14 ` [PATCH 03/10] MIPS: End asm function prologue macros with .insn Paul Burton
  2016-11-07 11:14   ` Paul Burton
@ 2016-11-07 14:33   ` Maciej W. Rozycki
  2016-11-07 14:33     ` Maciej W. Rozycki
  2016-11-07 15:18     ` Paul Burton
  1 sibling, 2 replies; 33+ messages in thread
From: Maciej W. Rozycki @ 2016-11-07 14:33 UTC (permalink / raw)
  To: Paul Burton; +Cc: linux-mips, Ralf Baechle

On Mon, 7 Nov 2016, Paul Burton wrote:

> When building a kernel targeting a microMIPS ISA, recent GNU linkers
> will fail the link if they cannot determine that the target of a branch
> or jump is microMIPS code, with errors such as the following:
> 
>     mips-img-linux-gnu-ld: arch/mips/built-in.o: .text+0x542c:
>     Unsupported jump between ISA modes; consider recompiling with
>     interlinking enabled.
>     mips-img-linux-gnu-ld: final link failed: Bad value
> 
> or:
> 
>     ./arch/mips/include/asm/uaccess.h:1017: warning: JALX to a
>     non-word-aligned address

 For the record: branch checks have been tightened as we plan to make use 
of branches to external symbols in generated code, making them more common 
than they have been so far.  The checks ensure an accidental attempt to 
assemble or link (as applicable) a branch between a function compiled for 
the regular ISA and one built for a compressed ISA will trigger at the 
build time rather than making the program go astray at the run time, which 
would be harder, perhaps much harder to debug.

> Placing anything other than an instruction at the start of a function
> written in assembly appears to trigger such errors. In order to prepare
> for allowing us to follow function prologue macros with an EXPORT_SYMBOL
> invocation, end the prologue macros (LEAD, NESTED & FEXPORT) with a
> .insn directive. This ensures that the start of the function is marked
> as code, which always makes sense for functions & safely prevents us
> from hitting the link errors described above.

 GAS has a known and accepted deficiency of being unable to see through a 
section switch.  So even though there is indeed a real instruction that 
follows a given code label once the section has been restored, the switch 
makes the assembler lose it from the view and the symbol produced by the 
label does not get the expected function type and consequently the ISA 
mode annotation.  Using an explicit `.insn' annotation sets the symbol 
type correctly along with the ISA mode.

 The `.insn' pseudo-op itself has been there since the beginning of
MIPS16 support in the toolchain, and has also been noted in the microMIPS 
architecture specification as required for code labels placed at 
non-instructions.

 As these macros can be used at such places too I think it makes sense to 
imply `.insn' with the macro itself so that it's semantically consistent 
rather than requiring people to explicitly place the pseudo-op at macro 
expansion sites as required.  I'm not sure if I indeed like the idea of 
placing EXPORT_SYMBOL in the middle of a code block, as I find it 
inconsistent with C usage where, by convention, it only comes at the end 
of a function's body.  That is a separate matter though, so for this 
change only:

Reviewed-by: Maciej W. Rozycki <macro@imgtec.com>

 Thank you for your work in this area!

  Maciej

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

* Re: [PATCH 03/10] MIPS: End asm function prologue macros with .insn
  2016-11-07 14:33   ` Maciej W. Rozycki
@ 2016-11-07 14:33     ` Maciej W. Rozycki
  2016-11-07 15:18     ` Paul Burton
  1 sibling, 0 replies; 33+ messages in thread
From: Maciej W. Rozycki @ 2016-11-07 14:33 UTC (permalink / raw)
  To: Paul Burton; +Cc: linux-mips, Ralf Baechle

On Mon, 7 Nov 2016, Paul Burton wrote:

> When building a kernel targeting a microMIPS ISA, recent GNU linkers
> will fail the link if they cannot determine that the target of a branch
> or jump is microMIPS code, with errors such as the following:
> 
>     mips-img-linux-gnu-ld: arch/mips/built-in.o: .text+0x542c:
>     Unsupported jump between ISA modes; consider recompiling with
>     interlinking enabled.
>     mips-img-linux-gnu-ld: final link failed: Bad value
> 
> or:
> 
>     ./arch/mips/include/asm/uaccess.h:1017: warning: JALX to a
>     non-word-aligned address

 For the record: branch checks have been tightened as we plan to make use 
of branches to external symbols in generated code, making them more common 
than they have been so far.  The checks ensure an accidental attempt to 
assemble or link (as applicable) a branch between a function compiled for 
the regular ISA and one built for a compressed ISA will trigger at the 
build time rather than making the program go astray at the run time, which 
would be harder, perhaps much harder to debug.

> Placing anything other than an instruction at the start of a function
> written in assembly appears to trigger such errors. In order to prepare
> for allowing us to follow function prologue macros with an EXPORT_SYMBOL
> invocation, end the prologue macros (LEAD, NESTED & FEXPORT) with a
> .insn directive. This ensures that the start of the function is marked
> as code, which always makes sense for functions & safely prevents us
> from hitting the link errors described above.

 GAS has a known and accepted deficiency of being unable to see through a 
section switch.  So even though there is indeed a real instruction that 
follows a given code label once the section has been restored, the switch 
makes the assembler lose it from the view and the symbol produced by the 
label does not get the expected function type and consequently the ISA 
mode annotation.  Using an explicit `.insn' annotation sets the symbol 
type correctly along with the ISA mode.

 The `.insn' pseudo-op itself has been there since the beginning of
MIPS16 support in the toolchain, and has also been noted in the microMIPS 
architecture specification as required for code labels placed at 
non-instructions.

 As these macros can be used at such places too I think it makes sense to 
imply `.insn' with the macro itself so that it's semantically consistent 
rather than requiring people to explicitly place the pseudo-op at macro 
expansion sites as required.  I'm not sure if I indeed like the idea of 
placing EXPORT_SYMBOL in the middle of a code block, as I find it 
inconsistent with C usage where, by convention, it only comes at the end 
of a function's body.  That is a separate matter though, so for this 
change only:

Reviewed-by: Maciej W. Rozycki <macro@imgtec.com>

 Thank you for your work in this area!

  Maciej

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

* Re: [PATCH 03/10] MIPS: End asm function prologue macros with .insn
  2016-11-07 14:33   ` Maciej W. Rozycki
  2016-11-07 14:33     ` Maciej W. Rozycki
@ 2016-11-07 15:18     ` Paul Burton
  2016-11-07 15:18       ` Paul Burton
  2016-11-08 11:20       ` Maciej W. Rozycki
  1 sibling, 2 replies; 33+ messages in thread
From: Paul Burton @ 2016-11-07 15:18 UTC (permalink / raw)
  To: Maciej W. Rozycki; +Cc: linux-mips, Ralf Baechle

[-- Attachment #1: Type: text/plain, Size: 1634 bytes --]

Hi Maciej,

On Monday, 7 November 2016 14:33:03 GMT Maciej W. Rozycki wrote:
>  As these macros can be used at such places too I think it makes sense to
> imply `.insn' with the macro itself so that it's semantically consistent
> rather than requiring people to explicitly place the pseudo-op at macro
> expansion sites as required.  I'm not sure if I indeed like the idea of
> placing EXPORT_SYMBOL in the middle of a code block, as I find it
> inconsistent with C usage where, by convention, it only comes at the end
> of a function's body.  That is a separate matter though, so for this
> change only:
> 
> Reviewed-by: Maciej W. Rozycki <macro@imgtec.com>
> 
>  Thank you for your work in this area!

And thanks for your review :)

For the record, the reason I went with placing the EXPORT_SYMBOL invocations 
at the start of the functions rather than the end is that the end isn't always 
the end of the code in question. For example (until another patch of mine) 
memcpy ends part way through user_copy, with code continuing afterwards. We 
would then need to place a .insn after the use of EXPORT_SYMBOL if any code 
may branch there. Containing the need for .insn to the start of the function 
seems neater since a function should always begin with an instruction, which 
after this patch will be marked as such, and users of the macros will just get 
behaviour that seems natural & expected.

Of course another alternative would be to place EXPORT_SYMBOL before LEAF/
NESTED/FEXPORT, but I don't think that would really make any difference  
presuming people agree that this patch is a good idea regardless.

Thanks,
    Paul

[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 801 bytes --]

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

* Re: [PATCH 03/10] MIPS: End asm function prologue macros with .insn
  2016-11-07 15:18     ` Paul Burton
@ 2016-11-07 15:18       ` Paul Burton
  2016-11-08 11:20       ` Maciej W. Rozycki
  1 sibling, 0 replies; 33+ messages in thread
From: Paul Burton @ 2016-11-07 15:18 UTC (permalink / raw)
  To: Maciej W. Rozycki; +Cc: linux-mips, Ralf Baechle

[-- Attachment #1: Type: text/plain, Size: 1634 bytes --]

Hi Maciej,

On Monday, 7 November 2016 14:33:03 GMT Maciej W. Rozycki wrote:
>  As these macros can be used at such places too I think it makes sense to
> imply `.insn' with the macro itself so that it's semantically consistent
> rather than requiring people to explicitly place the pseudo-op at macro
> expansion sites as required.  I'm not sure if I indeed like the idea of
> placing EXPORT_SYMBOL in the middle of a code block, as I find it
> inconsistent with C usage where, by convention, it only comes at the end
> of a function's body.  That is a separate matter though, so for this
> change only:
> 
> Reviewed-by: Maciej W. Rozycki <macro@imgtec.com>
> 
>  Thank you for your work in this area!

And thanks for your review :)

For the record, the reason I went with placing the EXPORT_SYMBOL invocations 
at the start of the functions rather than the end is that the end isn't always 
the end of the code in question. For example (until another patch of mine) 
memcpy ends part way through user_copy, with code continuing afterwards. We 
would then need to place a .insn after the use of EXPORT_SYMBOL if any code 
may branch there. Containing the need for .insn to the start of the function 
seems neater since a function should always begin with an instruction, which 
after this patch will be marked as such, and users of the macros will just get 
behaviour that seems natural & expected.

Of course another alternative would be to place EXPORT_SYMBOL before LEAF/
NESTED/FEXPORT, but I don't think that would really make any difference  
presuming people agree that this patch is a good idea regardless.

Thanks,
    Paul

[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 801 bytes --]

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

* Re: [PATCH 03/10] MIPS: End asm function prologue macros with .insn
  2016-11-07 15:18     ` Paul Burton
  2016-11-07 15:18       ` Paul Burton
@ 2016-11-08 11:20       ` Maciej W. Rozycki
  2016-11-08 11:20         ` Maciej W. Rozycki
  1 sibling, 1 reply; 33+ messages in thread
From: Maciej W. Rozycki @ 2016-11-08 11:20 UTC (permalink / raw)
  To: Paul Burton; +Cc: linux-mips, Ralf Baechle

Hi Paul,

> And thanks for your review :)

 You're welcome!

> For the record, the reason I went with placing the EXPORT_SYMBOL invocations 
> at the start of the functions rather than the end is that the end isn't always 
> the end of the code in question. For example (until another patch of mine) 
> memcpy ends part way through user_copy, with code continuing afterwards. We 
> would then need to place a .insn after the use of EXPORT_SYMBOL if any code 
> may branch there. Containing the need for .insn to the start of the function 
> seems neater since a function should always begin with an instruction, which 
> after this patch will be marked as such, and users of the macros will just get 
> behaviour that seems natural & expected.

 Well, the real end is where END (`.end') is, and I think placing `.end' 
midway-through a code block is really bad style, partly because it affects 
frame annotation (all the stuff from `.frame', `.mask', etc.) recorded 
in the object assembled.  A LEAF/NESTED (`.ent') and END (`.end') pair 
should really only mark the physical beginning and ending of a whole 
single function.

 If a function has alternative entry points, then FEXPORT should be used 
for those, which on the MIPS target should include a `.aent' pseudo-op as 
a part of the symbol definition and I can't really tell why why we don't 
(trivial patch now in the works).

 NB in the MIPS assembly dialect `.type symbol, @function' is redundant in 
the presence of either `.ent symbol' or `.aent symbol', as is `.size 
symbol, . - symbol' where `.end symbol' is also present.  There's no harm 
either though.

> Of course another alternative would be to place EXPORT_SYMBOL before LEAF/
> NESTED/FEXPORT, but I don't think that would really make any difference  
> presuming people agree that this patch is a good idea regardless.

 TBH I do maintain keeping all the EXPORT_SYMBOL stuff outside function 
bodies would be the cleanest approach, grouping the handling for all given 
function's intended entry points after its final END, arranged as I 
described above.  Do you find this proposal problematic for some reason?

  Maciej

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

* Re: [PATCH 03/10] MIPS: End asm function prologue macros with .insn
  2016-11-08 11:20       ` Maciej W. Rozycki
@ 2016-11-08 11:20         ` Maciej W. Rozycki
  0 siblings, 0 replies; 33+ messages in thread
From: Maciej W. Rozycki @ 2016-11-08 11:20 UTC (permalink / raw)
  To: Paul Burton; +Cc: linux-mips, Ralf Baechle

Hi Paul,

> And thanks for your review :)

 You're welcome!

> For the record, the reason I went with placing the EXPORT_SYMBOL invocations 
> at the start of the functions rather than the end is that the end isn't always 
> the end of the code in question. For example (until another patch of mine) 
> memcpy ends part way through user_copy, with code continuing afterwards. We 
> would then need to place a .insn after the use of EXPORT_SYMBOL if any code 
> may branch there. Containing the need for .insn to the start of the function 
> seems neater since a function should always begin with an instruction, which 
> after this patch will be marked as such, and users of the macros will just get 
> behaviour that seems natural & expected.

 Well, the real end is where END (`.end') is, and I think placing `.end' 
midway-through a code block is really bad style, partly because it affects 
frame annotation (all the stuff from `.frame', `.mask', etc.) recorded 
in the object assembled.  A LEAF/NESTED (`.ent') and END (`.end') pair 
should really only mark the physical beginning and ending of a whole 
single function.

 If a function has alternative entry points, then FEXPORT should be used 
for those, which on the MIPS target should include a `.aent' pseudo-op as 
a part of the symbol definition and I can't really tell why why we don't 
(trivial patch now in the works).

 NB in the MIPS assembly dialect `.type symbol, @function' is redundant in 
the presence of either `.ent symbol' or `.aent symbol', as is `.size 
symbol, . - symbol' where `.end symbol' is also present.  There's no harm 
either though.

> Of course another alternative would be to place EXPORT_SYMBOL before LEAF/
> NESTED/FEXPORT, but I don't think that would really make any difference  
> presuming people agree that this patch is a good idea regardless.

 TBH I do maintain keeping all the EXPORT_SYMBOL stuff outside function 
bodies would be the cleanest approach, grouping the handling for all given 
function's intended entry points after its final END, arranged as I 
described above.  Do you find this proposal problematic for some reason?

  Maciej

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

* Re: [PATCH 06/10] MIPS: Export invalid_pte_table alongside its definition
  2016-11-07 11:14 ` [PATCH 06/10] MIPS: Export invalid_pte_table " Paul Burton
  2016-11-07 11:14   ` Paul Burton
@ 2016-12-21 21:47   ` Ralf Baechle
  1 sibling, 0 replies; 33+ messages in thread
From: Ralf Baechle @ 2016-12-21 21:47 UTC (permalink / raw)
  To: Paul Burton; +Cc: linux-mips

On Mon, Nov 07, 2016 at 11:14:12AM +0000, Paul Burton wrote:

> It's unclear to me why this wasn't always the case, but move the
> EXPORT_SYMBOL invocation for invalid_pte_table to be alongside its
> definition.

It used to be defined in assembler, in head.S.

  Ralf

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

end of thread, other threads:[~2016-12-21 21:48 UTC | newest]

Thread overview: 33+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-11-07 11:14 [PATCH 00/10] MIPS: Cleanup EXPORT_SYMBOL usage Paul Burton
2016-11-07 11:14 ` Paul Burton
2016-11-07 11:14 ` [PATCH 01/10] MIPS: Use generic asm/export.h Paul Burton
2016-11-07 11:14   ` Paul Burton
2016-11-07 11:14 ` [PATCH 02/10] MIPS: tlbex: Clear ISA bit when writing to handle_tlb{l,m,s} Paul Burton
2016-11-07 11:14   ` Paul Burton
2016-11-07 12:04   ` Maciej W. Rozycki
2016-11-07 12:04     ` Maciej W. Rozycki
2016-11-07 11:14 ` [PATCH 03/10] MIPS: End asm function prologue macros with .insn Paul Burton
2016-11-07 11:14   ` Paul Burton
2016-11-07 14:33   ` Maciej W. Rozycki
2016-11-07 14:33     ` Maciej W. Rozycki
2016-11-07 15:18     ` Paul Burton
2016-11-07 15:18       ` Paul Burton
2016-11-08 11:20       ` Maciej W. Rozycki
2016-11-08 11:20         ` Maciej W. Rozycki
2016-11-07 11:14 ` [PATCH 04/10] MIPS: Export _save_fp & _save_msa alongside their definitions Paul Burton
2016-11-07 11:14   ` Paul Burton
2016-11-07 11:14 ` [PATCH 05/10] MIPS: Export _mcount alongside its definition Paul Burton
2016-11-07 11:14   ` Paul Burton
2016-11-07 11:48   ` [PATCH v2 " Paul Burton
2016-11-07 11:48     ` Paul Burton
2016-11-07 11:14 ` [PATCH 06/10] MIPS: Export invalid_pte_table " Paul Burton
2016-11-07 11:14   ` Paul Burton
2016-12-21 21:47   ` Ralf Baechle
2016-11-07 11:14 ` [PATCH 07/10] MIPS: Export csum functions alongside their definitions Paul Burton
2016-11-07 11:14   ` Paul Burton
2016-11-07 11:14 ` [PATCH 08/10] MIPS: Export string " Paul Burton
2016-11-07 11:14   ` Paul Burton
2016-11-07 11:14 ` [PATCH 09/10] MIPS: Export memcpy & memset " Paul Burton
2016-11-07 11:14   ` Paul Burton
2016-11-07 11:14 ` [PATCH 10/10] MIPS: Export {copy,clear}_page " Paul Burton
2016-11-07 11:14   ` Paul Burton

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).