Skip to content

Commit d0c1db1

Browse files
committed
Merge tag 'nds32-for-linus-4.19-tag1' of git://git.kernel.org/pub/scm/linux/kernel/git/greentime/linux
Pull nds32 updates from Greentime Hu: "Contained in here are the bug fixes, building error fixes and ftrace support for nds32" * tag 'nds32-for-linus-4.19-tag1' of git://git.kernel.org/pub/scm/linux/kernel/git/greentime/linux: nds32: linker script: GCOV kernel may refers data in __exit nds32: fix build error because of wrong semicolon nds32: Fix a kernel panic issue because of wrong frame pointer access. nds32: Only print one page of stack when die to prevent printing too much information. nds32: Add macro definition for offset of lp register on stack nds32: Remove the deprecated ABI implementation nds32/stack: Get real return address by using ftrace_graph_ret_addr nds32/ftrace: Support dynamic function graph tracer nds32/ftrace: Support dynamic function tracer nds32/ftrace: Add RECORD_MCOUNT support nds32/ftrace: Support static function graph tracer nds32/ftrace: Support static function tracer nds32: Extract the checking and getting pointer to a macro nds32: Clean up the coding style nds32: Fix get_user/put_user macro expand pointer problem nds32: Fix empty call trace nds32: add NULL entry to the end of_device_id array nds32: fix logic for module
2 parents 0e9b103 + 3350139 commit d0c1db1

File tree

16 files changed

+527
-152
lines changed

16 files changed

+527
-152
lines changed

arch/nds32/Kconfig

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,10 @@ config NDS32
4040
select NO_IOPORT_MAP
4141
select RTC_LIB
4242
select THREAD_INFO_IN_TASK
43+
select HAVE_FUNCTION_TRACER
44+
select HAVE_FUNCTION_GRAPH_TRACER
45+
select HAVE_FTRACE_MCOUNT_RECORD
46+
select HAVE_DYNAMIC_FTRACE
4347
help
4448
Andes(nds32) Linux support.
4549

arch/nds32/Makefile

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@ KBUILD_DEFCONFIG := defconfig
55

66
comma = ,
77

8+
ifdef CONFIG_FUNCTION_TRACER
9+
arch-y += -malways-save-lp -mno-relax
10+
endif
11+
812
KBUILD_CFLAGS += $(call cc-option, -mno-sched-prolog-epilog)
913
KBUILD_CFLAGS += -mcmodel=large
1014

arch/nds32/include/asm/elf.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -121,9 +121,9 @@ struct elf32_hdr;
121121
*/
122122
#define ELF_CLASS ELFCLASS32
123123
#ifdef __NDS32_EB__
124-
#define ELF_DATA ELFDATA2MSB;
124+
#define ELF_DATA ELFDATA2MSB
125125
#else
126-
#define ELF_DATA ELFDATA2LSB;
126+
#define ELF_DATA ELFDATA2LSB
127127
#endif
128128
#define ELF_ARCH EM_NDS32
129129
#define USE_ELF_CORE_DUMP

arch/nds32/include/asm/ftrace.h

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
/* SPDX-License-Identifier: GPL-2.0 */
2+
3+
#ifndef __ASM_NDS32_FTRACE_H
4+
#define __ASM_NDS32_FTRACE_H
5+
6+
#ifdef CONFIG_FUNCTION_TRACER
7+
8+
#define HAVE_FUNCTION_GRAPH_FP_TEST
9+
10+
#define MCOUNT_ADDR ((unsigned long)(_mcount))
11+
/* mcount call is composed of three instructions:
12+
* sethi + ori + jral
13+
*/
14+
#define MCOUNT_INSN_SIZE 12
15+
16+
extern void _mcount(unsigned long parent_ip);
17+
18+
#ifdef CONFIG_DYNAMIC_FTRACE
19+
20+
#define FTRACE_ADDR ((unsigned long)_ftrace_caller)
21+
22+
#ifdef __NDS32_EL__
23+
#define INSN_NOP 0x09000040
24+
#define INSN_SIZE(insn) (((insn & 0x00000080) == 0) ? 4 : 2)
25+
#define IS_SETHI(insn) ((insn & 0x000000fe) == 0x00000046)
26+
#define ENDIAN_CONVERT(insn) be32_to_cpu(insn)
27+
#else /* __NDS32_EB__ */
28+
#define INSN_NOP 0x40000009
29+
#define INSN_SIZE(insn) (((insn & 0x80000000) == 0) ? 4 : 2)
30+
#define IS_SETHI(insn) ((insn & 0xfe000000) == 0x46000000)
31+
#define ENDIAN_CONVERT(insn) (insn)
32+
#endif
33+
34+
extern void _ftrace_caller(unsigned long parent_ip);
35+
static inline unsigned long ftrace_call_adjust(unsigned long addr)
36+
{
37+
return addr;
38+
}
39+
struct dyn_arch_ftrace {
40+
};
41+
42+
#endif /* CONFIG_DYNAMIC_FTRACE */
43+
44+
#endif /* CONFIG_FUNCTION_TRACER */
45+
46+
#endif /* __ASM_NDS32_FTRACE_H */

arch/nds32/include/asm/nds32.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
#else
1818
#define FP_OFFSET (-2)
1919
#endif
20+
#define LP_OFFSET (-1)
2021

2122
extern void __init early_trap_init(void);
2223
static inline void GIE_ENABLE(void)

0 commit comments

Comments
 (0)