aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2018-04-09 12:19:30 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2018-04-09 12:19:30 -0400
commit4a1e00524cbdd38567e36f9c54a0444deebd864a (patch)
tree51f1b33826bfa8fb37d031d0fbfcfb528b465d0b
parent2025fef0ca0c8c7fa730a3e0399243721a4925f1 (diff)
parent9178caf9649d97e976adbfca1f56477befde28f8 (diff)
Merge branch 'for-linus' of git://git.armlinux.org.uk/~rmk/linux-arm
Pull ARM updates from Russell King: "A number of core ARM changes: - Refactoring linker script by Nicolas Pitre - Enable source fortification - Add support for Cortex R8" * 'for-linus' of git://git.armlinux.org.uk/~rmk/linux-arm: ARM: decompressor: fix warning introduced in fortify patch ARM: 8751/1: Add support for Cortex-R8 processor ARM: 8749/1: Kconfig: Add ARCH_HAS_FORTIFY_SOURCE ARM: simplify and fix linker script for TCM ARM: linker script: factor out TCM bits ARM: linker script: factor out vectors and stubs ARM: linker script: factor out unwinding table sections ARM: linker script: factor out stuff for the .text section ARM: linker script: factor out stuff for the DISCARD section ARM: linker script: factor out some common definitions between XIP and non-XIP
-rw-r--r--arch/arm/Kconfig1
-rw-r--r--arch/arm/boot/compressed/decompress.c5
-rw-r--r--arch/arm/boot/compressed/misc.c7
-rw-r--r--arch/arm/boot/compressed/misc.h10
-rw-r--r--arch/arm/kernel/vmlinux-xip.lds.S166
-rw-r--r--arch/arm/kernel/vmlinux.lds.S172
-rw-r--r--arch/arm/kernel/vmlinux.lds.h135
-rw-r--r--arch/arm/mm/init.c11
-rw-r--r--arch/arm/mm/proc-v7.S11
9 files changed, 185 insertions, 333 deletions
diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index 1878083771af..a7f8e7f4b88f 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -7,6 +7,7 @@ config ARM
7 select ARCH_HAS_DEBUG_VIRTUAL if MMU 7 select ARCH_HAS_DEBUG_VIRTUAL if MMU
8 select ARCH_HAS_DEVMEM_IS_ALLOWED 8 select ARCH_HAS_DEVMEM_IS_ALLOWED
9 select ARCH_HAS_ELF_RANDOMIZE 9 select ARCH_HAS_ELF_RANDOMIZE
10 select ARCH_HAS_FORTIFY_SOURCE
10 select ARCH_HAS_SET_MEMORY 11 select ARCH_HAS_SET_MEMORY
11 select ARCH_HAS_PHYS_TO_DMA 12 select ARCH_HAS_PHYS_TO_DMA
12 select ARCH_HAS_STRICT_KERNEL_RWX if MMU && !XIP_KERNEL 13 select ARCH_HAS_STRICT_KERNEL_RWX if MMU && !XIP_KERNEL
diff --git a/arch/arm/boot/compressed/decompress.c b/arch/arm/boot/compressed/decompress.c
index a2ac3fe7dbf8..c16c1829a5e4 100644
--- a/arch/arm/boot/compressed/decompress.c
+++ b/arch/arm/boot/compressed/decompress.c
@@ -6,10 +6,7 @@
6#include <linux/stddef.h> /* for NULL */ 6#include <linux/stddef.h> /* for NULL */
7#include <linux/linkage.h> 7#include <linux/linkage.h>
8#include <asm/string.h> 8#include <asm/string.h>
9 9#include "misc.h"
10extern unsigned long free_mem_ptr;
11extern unsigned long free_mem_end_ptr;
12extern void error(char *);
13 10
14#define STATIC static 11#define STATIC static
15#define STATIC_RW_DATA /* non-static please */ 12#define STATIC_RW_DATA /* non-static please */
diff --git a/arch/arm/boot/compressed/misc.c b/arch/arm/boot/compressed/misc.c
index e8fe51f4e97a..e1e9a5dde853 100644
--- a/arch/arm/boot/compressed/misc.c
+++ b/arch/arm/boot/compressed/misc.c
@@ -22,9 +22,9 @@ unsigned int __machine_arch_type;
22#include <linux/compiler.h> /* for inline */ 22#include <linux/compiler.h> /* for inline */
23#include <linux/types.h> 23#include <linux/types.h>
24#include <linux/linkage.h> 24#include <linux/linkage.h>
25#include "misc.h"
25 26
26static void putstr(const char *ptr); 27static void putstr(const char *ptr);
27extern void error(char *x);
28 28
29#include CONFIG_UNCOMPRESS_INCLUDE 29#include CONFIG_UNCOMPRESS_INCLUDE
30 30
@@ -160,3 +160,8 @@ decompress_kernel(unsigned long output_start, unsigned long free_mem_ptr_p,
160 else 160 else
161 putstr(" done, booting the kernel.\n"); 161 putstr(" done, booting the kernel.\n");
162} 162}
163
164void fortify_panic(const char *name)
165{
166 error("detected buffer overflow");
167}
diff --git a/arch/arm/boot/compressed/misc.h b/arch/arm/boot/compressed/misc.h
new file mode 100644
index 000000000000..c958dccd1d97
--- /dev/null
+++ b/arch/arm/boot/compressed/misc.h
@@ -0,0 +1,10 @@
1#ifndef MISC_H
2#define MISC_H
3
4#include <linux/compiler.h>
5
6void error(char *x) __noreturn;
7extern unsigned long free_mem_ptr;
8extern unsigned long free_mem_end_ptr;
9
10#endif
diff --git a/arch/arm/kernel/vmlinux-xip.lds.S b/arch/arm/kernel/vmlinux-xip.lds.S
index 12b87591eb7c..d32f5d35f602 100644
--- a/arch/arm/kernel/vmlinux-xip.lds.S
+++ b/arch/arm/kernel/vmlinux-xip.lds.S
@@ -15,38 +15,7 @@
15#include <asm/memory.h> 15#include <asm/memory.h>
16#include <asm/page.h> 16#include <asm/page.h>
17 17
18#define PROC_INFO \ 18#include "vmlinux.lds.h"
19 . = ALIGN(4); \
20 VMLINUX_SYMBOL(__proc_info_begin) = .; \
21 *(.proc.info.init) \
22 VMLINUX_SYMBOL(__proc_info_end) = .;
23
24#define IDMAP_TEXT \
25 ALIGN_FUNCTION(); \
26 VMLINUX_SYMBOL(__idmap_text_start) = .; \
27 *(.idmap.text) \
28 VMLINUX_SYMBOL(__idmap_text_end) = .; \
29 . = ALIGN(PAGE_SIZE); \
30 VMLINUX_SYMBOL(__hyp_idmap_text_start) = .; \
31 *(.hyp.idmap.text) \
32 VMLINUX_SYMBOL(__hyp_idmap_text_end) = .;
33
34#ifdef CONFIG_HOTPLUG_CPU
35#define ARM_CPU_DISCARD(x)
36#define ARM_CPU_KEEP(x) x
37#else
38#define ARM_CPU_DISCARD(x) x
39#define ARM_CPU_KEEP(x)
40#endif
41
42#if (defined(CONFIG_SMP_ON_UP) && !defined(CONFIG_DEBUG_SPINLOCK)) || \
43 defined(CONFIG_GENERIC_BUG)
44#define ARM_EXIT_KEEP(x) x
45#define ARM_EXIT_DISCARD(x)
46#else
47#define ARM_EXIT_KEEP(x)
48#define ARM_EXIT_DISCARD(x) x
49#endif
50 19
51OUTPUT_ARCH(arm) 20OUTPUT_ARCH(arm)
52ENTRY(stext) 21ENTRY(stext)
@@ -69,20 +38,9 @@ SECTIONS
69 * unwind sections get included. 38 * unwind sections get included.
70 */ 39 */
71 /DISCARD/ : { 40 /DISCARD/ : {
72 *(.ARM.exidx.exit.text) 41 ARM_DISCARD
73 *(.ARM.extab.exit.text)
74 ARM_CPU_DISCARD(*(.ARM.exidx.cpuexit.text))
75 ARM_CPU_DISCARD(*(.ARM.extab.cpuexit.text))
76 ARM_EXIT_DISCARD(EXIT_TEXT)
77 ARM_EXIT_DISCARD(EXIT_DATA)
78 EXIT_CALL
79#ifndef CONFIG_MMU
80 *(.text.fixup)
81 *(__ex_table)
82#endif
83 *(.alt.smp.init) 42 *(.alt.smp.init)
84 *(.discard) 43 *(.pv_table)
85 *(.discard.*)
86 } 44 }
87 45
88 . = XIP_VIRT_ADDR(CONFIG_XIP_PHYS_ADDR); 46 . = XIP_VIRT_ADDR(CONFIG_XIP_PHYS_ADDR);
@@ -95,22 +53,7 @@ SECTIONS
95 53
96 .text : { /* Real text segment */ 54 .text : { /* Real text segment */
97 _stext = .; /* Text and read-only data */ 55 _stext = .; /* Text and read-only data */
98 IDMAP_TEXT 56 ARM_TEXT
99 __entry_text_start = .;
100 *(.entry.text)
101 __entry_text_end = .;
102 IRQENTRY_TEXT
103 TEXT_TEXT
104 SCHED_TEXT
105 CPUIDLE_TEXT
106 LOCK_TEXT
107 KPROBES_TEXT
108 *(.gnu.warning)
109 *(.glue_7)
110 *(.glue_7t)
111 . = ALIGN(4);
112 *(.got) /* Global offset table */
113 ARM_CPU_KEEP(PROC_INFO)
114 } 57 }
115 58
116 RO_DATA(PAGE_SIZE) 59 RO_DATA(PAGE_SIZE)
@@ -118,53 +61,19 @@ SECTIONS
118 . = ALIGN(4); 61 . = ALIGN(4);
119 __ex_table : AT(ADDR(__ex_table) - LOAD_OFFSET) { 62 __ex_table : AT(ADDR(__ex_table) - LOAD_OFFSET) {
120 __start___ex_table = .; 63 __start___ex_table = .;
121#ifdef CONFIG_MMU 64 ARM_MMU_KEEP(*(__ex_table))
122 *(__ex_table)
123#endif
124 __stop___ex_table = .; 65 __stop___ex_table = .;
125 } 66 }
126 67
127#ifdef CONFIG_ARM_UNWIND 68#ifdef CONFIG_ARM_UNWIND
128 /* 69 ARM_UNWIND_SECTIONS
129 * Stack unwinding tables
130 */
131 . = ALIGN(8);
132 .ARM.unwind_idx : {
133 __start_unwind_idx = .;
134 *(.ARM.exidx*)
135 __stop_unwind_idx = .;
136 }
137 .ARM.unwind_tab : {
138 __start_unwind_tab = .;
139 *(.ARM.extab*)
140 __stop_unwind_tab = .;
141 }
142#endif 70#endif
143 71
144 NOTES 72 NOTES
145 73
146 _etext = .; /* End of text and rodata section */ 74 _etext = .; /* End of text and rodata section */
147 75
148 /* 76 ARM_VECTORS
149 * The vectors and stubs are relocatable code, and the
150 * only thing that matters is their relative offsets
151 */
152 __vectors_start = .;
153 .vectors 0xffff0000 : AT(__vectors_start) {
154 *(.vectors)
155 }
156 . = __vectors_start + SIZEOF(.vectors);
157 __vectors_end = .;
158
159 __stubs_start = .;
160 .stubs ADDR(.vectors) + 0x1000 : AT(__stubs_start) {
161 *(.stubs)
162 }
163 . = __stubs_start + SIZEOF(.stubs);
164 __stubs_end = .;
165
166 PROVIDE(vector_fiq_offset = vector_fiq - ADDR(.vectors));
167
168 INIT_TEXT_SECTION(8) 77 INIT_TEXT_SECTION(8)
169 .exit.text : { 78 .exit.text : {
170 ARM_EXIT_KEEP(EXIT_TEXT) 79 ARM_EXIT_KEEP(EXIT_TEXT)
@@ -223,6 +132,10 @@ SECTIONS
223 PERCPU_SECTION(L1_CACHE_BYTES) 132 PERCPU_SECTION(L1_CACHE_BYTES)
224#endif 133#endif
225 134
135#ifdef CONFIG_HAVE_TCM
136 ARM_TCM
137#endif
138
226 /* 139 /*
227 * End of copied data. We need a dummy section to get its LMA. 140 * End of copied data. We need a dummy section to get its LMA.
228 * Also located before final ALIGN() as trailing padding is not stored 141 * Also located before final ALIGN() as trailing padding is not stored
@@ -234,63 +147,6 @@ SECTIONS
234 . = ALIGN(PAGE_SIZE); 147 . = ALIGN(PAGE_SIZE);
235 __init_end = .; 148 __init_end = .;
236 149
237#ifdef CONFIG_HAVE_TCM
238 /*
239 * We align everything to a page boundary so we can
240 * free it after init has commenced and TCM contents have
241 * been copied to its destination.
242 */
243 .tcm_start : {
244 . = ALIGN(PAGE_SIZE);
245 __tcm_start = .;
246 __itcm_start = .;
247 }
248
249 /*
250 * Link these to the ITCM RAM
251 * Put VMA to the TCM address and LMA to the common RAM
252 * and we'll upload the contents from RAM to TCM and free
253 * the used RAM after that.
254 */
255 .text_itcm ITCM_OFFSET : AT(__itcm_start)
256 {
257 __sitcm_text = .;
258 *(.tcm.text)
259 *(.tcm.rodata)
260 . = ALIGN(4);
261 __eitcm_text = .;
262 }
263
264 /*
265 * Reset the dot pointer, this is needed to create the
266 * relative __dtcm_start below (to be used as extern in code).
267 */
268 . = ADDR(.tcm_start) + SIZEOF(.tcm_start) + SIZEOF(.text_itcm);
269
270 .dtcm_start : {
271 __dtcm_start = .;
272 }
273
274 /* TODO: add remainder of ITCM as well, that can be used for data! */
275 .data_dtcm DTCM_OFFSET : AT(__dtcm_start)
276 {
277 . = ALIGN(4);
278 __sdtcm_data = .;
279 *(.tcm.data)
280 . = ALIGN(4);
281 __edtcm_data = .;
282 }
283
284 /* Reset the dot pointer or the linker gets confused */
285 . = ADDR(.dtcm_start) + SIZEOF(.data_dtcm);
286
287 /* End marker for freeing TCM copy in linked object */
288 .tcm_end : AT(ADDR(.dtcm_start) + SIZEOF(.data_dtcm)){
289 . = ALIGN(PAGE_SIZE);
290 __tcm_end = .;
291 }
292#endif
293
294 BSS_SECTION(0, 0, 8) 150 BSS_SECTION(0, 0, 8)
295 _end = .; 151 _end = .;
296 152
diff --git a/arch/arm/kernel/vmlinux.lds.S b/arch/arm/kernel/vmlinux.lds.S
index 84a1ae3ce46e..b77dc675ae55 100644
--- a/arch/arm/kernel/vmlinux.lds.S
+++ b/arch/arm/kernel/vmlinux.lds.S
@@ -15,43 +15,7 @@
15#include <asm/page.h> 15#include <asm/page.h>
16#include <asm/pgtable.h> 16#include <asm/pgtable.h>
17 17
18#define PROC_INFO \ 18#include "vmlinux.lds.h"
19 . = ALIGN(4); \
20 VMLINUX_SYMBOL(__proc_info_begin) = .; \
21 *(.proc.info.init) \
22 VMLINUX_SYMBOL(__proc_info_end) = .;
23
24#define HYPERVISOR_TEXT \
25 VMLINUX_SYMBOL(__hyp_text_start) = .; \
26 *(.hyp.text) \
27 VMLINUX_SYMBOL(__hyp_text_end) = .;
28
29#define IDMAP_TEXT \
30 ALIGN_FUNCTION(); \
31 VMLINUX_SYMBOL(__idmap_text_start) = .; \
32 *(.idmap.text) \
33 VMLINUX_SYMBOL(__idmap_text_end) = .; \
34 . = ALIGN(PAGE_SIZE); \
35 VMLINUX_SYMBOL(__hyp_idmap_text_start) = .; \
36 *(.hyp.idmap.text) \
37 VMLINUX_SYMBOL(__hyp_idmap_text_end) = .;
38
39#ifdef CONFIG_HOTPLUG_CPU
40#define ARM_CPU_DISCARD(x)
41#define ARM_CPU_KEEP(x) x
42#else
43#define ARM_CPU_DISCARD(x) x
44#define ARM_CPU_KEEP(x)
45#endif
46
47#if (defined(CONFIG_SMP_ON_UP) && !defined(CONFIG_DEBUG_SPINLOCK)) || \
48 defined(CONFIG_GENERIC_BUG) || defined(CONFIG_JUMP_LABEL)
49#define ARM_EXIT_KEEP(x) x
50#define ARM_EXIT_DISCARD(x)
51#else
52#define ARM_EXIT_KEEP(x)
53#define ARM_EXIT_DISCARD(x) x
54#endif
55 19
56OUTPUT_ARCH(arm) 20OUTPUT_ARCH(arm)
57ENTRY(stext) 21ENTRY(stext)
@@ -74,22 +38,10 @@ SECTIONS
74 * unwind sections get included. 38 * unwind sections get included.
75 */ 39 */
76 /DISCARD/ : { 40 /DISCARD/ : {
77 *(.ARM.exidx.exit.text) 41 ARM_DISCARD
78 *(.ARM.extab.exit.text)
79 ARM_CPU_DISCARD(*(.ARM.exidx.cpuexit.text))
80 ARM_CPU_DISCARD(*(.ARM.extab.cpuexit.text))
81 ARM_EXIT_DISCARD(EXIT_TEXT)
82 ARM_EXIT_DISCARD(EXIT_DATA)
83 EXIT_CALL
84#ifndef CONFIG_MMU
85 *(.text.fixup)
86 *(__ex_table)
87#endif
88#ifndef CONFIG_SMP_ON_UP 42#ifndef CONFIG_SMP_ON_UP
89 *(.alt.smp.init) 43 *(.alt.smp.init)
90#endif 44#endif
91 *(.discard)
92 *(.discard.*)
93 } 45 }
94 46
95 . = PAGE_OFFSET + TEXT_OFFSET; 47 . = PAGE_OFFSET + TEXT_OFFSET;
@@ -104,24 +56,7 @@ SECTIONS
104 56
105 .text : { /* Real text segment */ 57 .text : { /* Real text segment */
106 _stext = .; /* Text and read-only data */ 58 _stext = .; /* Text and read-only data */
107 IDMAP_TEXT 59 ARM_TEXT
108 __entry_text_start = .;
109 *(.entry.text)
110 __entry_text_end = .;
111 IRQENTRY_TEXT
112 SOFTIRQENTRY_TEXT
113 TEXT_TEXT
114 SCHED_TEXT
115 CPUIDLE_TEXT
116 LOCK_TEXT
117 HYPERVISOR_TEXT
118 KPROBES_TEXT
119 *(.gnu.warning)
120 *(.glue_7)
121 *(.glue_7t)
122 . = ALIGN(4);
123 *(.got) /* Global offset table */
124 ARM_CPU_KEEP(PROC_INFO)
125 } 60 }
126 61
127#ifdef CONFIG_DEBUG_ALIGN_RODATA 62#ifdef CONFIG_DEBUG_ALIGN_RODATA
@@ -134,27 +69,12 @@ SECTIONS
134 . = ALIGN(4); 69 . = ALIGN(4);
135 __ex_table : AT(ADDR(__ex_table) - LOAD_OFFSET) { 70 __ex_table : AT(ADDR(__ex_table) - LOAD_OFFSET) {
136 __start___ex_table = .; 71 __start___ex_table = .;
137#ifdef CONFIG_MMU 72 ARM_MMU_KEEP(*(__ex_table))
138 *(__ex_table)
139#endif
140 __stop___ex_table = .; 73 __stop___ex_table = .;
141 } 74 }
142 75
143#ifdef CONFIG_ARM_UNWIND 76#ifdef CONFIG_ARM_UNWIND
144 /* 77 ARM_UNWIND_SECTIONS
145 * Stack unwinding tables
146 */
147 . = ALIGN(8);
148 .ARM.unwind_idx : {
149 __start_unwind_idx = .;
150 *(.ARM.exidx*)
151 __stop_unwind_idx = .;
152 }
153 .ARM.unwind_tab : {
154 __start_unwind_tab = .;
155 *(.ARM.extab*)
156 __stop_unwind_tab = .;
157 }
158#endif 78#endif
159 79
160 NOTES 80 NOTES
@@ -166,26 +86,7 @@ SECTIONS
166#endif 86#endif
167 __init_begin = .; 87 __init_begin = .;
168 88
169 /* 89 ARM_VECTORS
170 * The vectors and stubs are relocatable code, and the
171 * only thing that matters is their relative offsets
172 */
173 __vectors_start = .;
174 .vectors 0xffff0000 : AT(__vectors_start) {
175 *(.vectors)
176 }
177 . = __vectors_start + SIZEOF(.vectors);
178 __vectors_end = .;
179
180 __stubs_start = .;
181 .stubs ADDR(.vectors) + 0x1000 : AT(__stubs_start) {
182 *(.stubs)
183 }
184 . = __stubs_start + SIZEOF(.stubs);
185 __stubs_end = .;
186
187 PROVIDE(vector_fiq_offset = vector_fiq - ADDR(.vectors));
188
189 INIT_TEXT_SECTION(8) 90 INIT_TEXT_SECTION(8)
190 .exit.text : { 91 .exit.text : {
191 ARM_EXIT_KEEP(EXIT_TEXT) 92 ARM_EXIT_KEEP(EXIT_TEXT)
@@ -226,6 +127,10 @@ SECTIONS
226 PERCPU_SECTION(L1_CACHE_BYTES) 127 PERCPU_SECTION(L1_CACHE_BYTES)
227#endif 128#endif
228 129
130#ifdef CONFIG_HAVE_TCM
131 ARM_TCM
132#endif
133
229#ifdef CONFIG_STRICT_KERNEL_RWX 134#ifdef CONFIG_STRICT_KERNEL_RWX
230 . = ALIGN(1<<SECTION_SHIFT); 135 . = ALIGN(1<<SECTION_SHIFT);
231#else 136#else
@@ -237,63 +142,6 @@ SECTIONS
237 RW_DATA_SECTION(L1_CACHE_BYTES, PAGE_SIZE, THREAD_SIZE) 142 RW_DATA_SECTION(L1_CACHE_BYTES, PAGE_SIZE, THREAD_SIZE)
238 _edata = .; 143 _edata = .;
239 144
240#ifdef CONFIG_HAVE_TCM
241 /*
242 * We align everything to a page boundary so we can
243 * free it after init has commenced and TCM contents have
244 * been copied to its destination.
245 */
246 .tcm_start : {
247 . = ALIGN(PAGE_SIZE);
248 __tcm_start = .;
249 __itcm_start = .;
250 }
251
252 /*
253 * Link these to the ITCM RAM
254 * Put VMA to the TCM address and LMA to the common RAM
255 * and we'll upload the contents from RAM to TCM and free
256 * the used RAM after that.
257 */
258 .text_itcm ITCM_OFFSET : AT(__itcm_start)
259 {
260 __sitcm_text = .;
261 *(.tcm.text)
262 *(.tcm.rodata)
263 . = ALIGN(4);
264 __eitcm_text = .;
265 }
266
267 /*
268 * Reset the dot pointer, this is needed to create the
269 * relative __dtcm_start below (to be used as extern in code).
270 */
271 . = ADDR(.tcm_start) + SIZEOF(.tcm_start) + SIZEOF(.text_itcm);
272
273 .dtcm_start : {
274 __dtcm_start = .;
275 }
276
277 /* TODO: add remainder of ITCM as well, that can be used for data! */
278 .data_dtcm DTCM_OFFSET : AT(__dtcm_start)
279 {
280 . = ALIGN(4);
281 __sdtcm_data = .;
282 *(.tcm.data)
283 . = ALIGN(4);
284 __edtcm_data = .;
285 }
286
287 /* Reset the dot pointer or the linker gets confused */
288 . = ADDR(.dtcm_start) + SIZEOF(.data_dtcm);
289
290 /* End marker for freeing TCM copy in linked object */
291 .tcm_end : AT(ADDR(.dtcm_start) + SIZEOF(.data_dtcm)){
292 . = ALIGN(PAGE_SIZE);
293 __tcm_end = .;
294 }
295#endif
296
297 BSS_SECTION(0, 0, 0) 145 BSS_SECTION(0, 0, 0)
298 _end = .; 146 _end = .;
299 147
diff --git a/arch/arm/kernel/vmlinux.lds.h b/arch/arm/kernel/vmlinux.lds.h
new file mode 100644
index 000000000000..71281e08e1d4
--- /dev/null
+++ b/arch/arm/kernel/vmlinux.lds.h
@@ -0,0 +1,135 @@
1/* SPDX-License-Identifier: GPL-2.0 */
2
3#ifdef CONFIG_HOTPLUG_CPU
4#define ARM_CPU_DISCARD(x)
5#define ARM_CPU_KEEP(x) x
6#else
7#define ARM_CPU_DISCARD(x) x
8#define ARM_CPU_KEEP(x)
9#endif
10
11#if (defined(CONFIG_SMP_ON_UP) && !defined(CONFIG_DEBUG_SPINLOCK)) || \
12 defined(CONFIG_GENERIC_BUG) || defined(CONFIG_JUMP_LABEL)
13#define ARM_EXIT_KEEP(x) x
14#define ARM_EXIT_DISCARD(x)
15#else
16#define ARM_EXIT_KEEP(x)
17#define ARM_EXIT_DISCARD(x) x
18#endif
19
20#ifdef CONFIG_MMU
21#define ARM_MMU_KEEP(x) x
22#define ARM_MMU_DISCARD(x)
23#else
24#define ARM_MMU_KEEP(x)
25#define ARM_MMU_DISCARD(x) x
26#endif
27
28#define PROC_INFO \
29 . = ALIGN(4); \
30 VMLINUX_SYMBOL(__proc_info_begin) = .; \
31 *(.proc.info.init) \
32 VMLINUX_SYMBOL(__proc_info_end) = .;
33
34#define HYPERVISOR_TEXT \
35 VMLINUX_SYMBOL(__hyp_text_start) = .; \
36 *(.hyp.text) \
37 VMLINUX_SYMBOL(__hyp_text_end) = .;
38
39#define IDMAP_TEXT \
40 ALIGN_FUNCTION(); \
41 VMLINUX_SYMBOL(__idmap_text_start) = .; \
42 *(.idmap.text) \
43 VMLINUX_SYMBOL(__idmap_text_end) = .; \
44 . = ALIGN(PAGE_SIZE); \
45 VMLINUX_SYMBOL(__hyp_idmap_text_start) = .; \
46 *(.hyp.idmap.text) \
47 VMLINUX_SYMBOL(__hyp_idmap_text_end) = .;
48
49#define ARM_DISCARD \
50 *(.ARM.exidx.exit.text) \
51 *(.ARM.extab.exit.text) \
52 ARM_CPU_DISCARD(*(.ARM.exidx.cpuexit.text)) \
53 ARM_CPU_DISCARD(*(.ARM.extab.cpuexit.text)) \
54 ARM_EXIT_DISCARD(EXIT_TEXT) \
55 ARM_EXIT_DISCARD(EXIT_DATA) \
56 EXIT_CALL \
57 ARM_MMU_DISCARD(*(.text.fixup)) \
58 ARM_MMU_DISCARD(*(__ex_table)) \
59 *(.discard) \
60 *(.discard.*)
61
62#define ARM_TEXT \
63 IDMAP_TEXT \
64 __entry_text_start = .; \
65 *(.entry.text) \
66 __entry_text_end = .; \
67 IRQENTRY_TEXT \
68 SOFTIRQENTRY_TEXT \
69 TEXT_TEXT \
70 SCHED_TEXT \
71 CPUIDLE_TEXT \
72 LOCK_TEXT \
73 HYPERVISOR_TEXT \
74 KPROBES_TEXT \
75 *(.gnu.warning) \
76 *(.glue_7) \
77 *(.glue_7t) \
78 . = ALIGN(4); \
79 *(.got) /* Global offset table */ \
80 ARM_CPU_KEEP(PROC_INFO)
81
82/* Stack unwinding tables */
83#define ARM_UNWIND_SECTIONS \
84 . = ALIGN(8); \
85 .ARM.unwind_idx : { \
86 __start_unwind_idx = .; \
87 *(.ARM.exidx*) \
88 __stop_unwind_idx = .; \
89 } \
90 .ARM.unwind_tab : { \
91 __start_unwind_tab = .; \
92 *(.ARM.extab*) \
93 __stop_unwind_tab = .; \
94 }
95
96/*
97 * The vectors and stubs are relocatable code, and the
98 * only thing that matters is their relative offsets
99 */
100#define ARM_VECTORS \
101 __vectors_start = .; \
102 .vectors 0xffff0000 : AT(__vectors_start) { \
103 *(.vectors) \
104 } \
105 . = __vectors_start + SIZEOF(.vectors); \
106 __vectors_end = .; \
107 \
108 __stubs_start = .; \
109 .stubs ADDR(.vectors) + 0x1000 : AT(__stubs_start) { \
110 *(.stubs) \
111 } \
112 . = __stubs_start + SIZEOF(.stubs); \
113 __stubs_end = .; \
114 \
115 PROVIDE(vector_fiq_offset = vector_fiq - ADDR(.vectors));
116
117#define ARM_TCM \
118 __itcm_start = ALIGN(4); \
119 .text_itcm ITCM_OFFSET : AT(__itcm_start - LOAD_OFFSET) { \
120 __sitcm_text = .; \
121 *(.tcm.text) \
122 *(.tcm.rodata) \
123 . = ALIGN(4); \
124 __eitcm_text = .; \
125 } \
126 . = __itcm_start + SIZEOF(.text_itcm); \
127 \
128 __dtcm_start = .; \
129 .data_dtcm DTCM_OFFSET : AT(__dtcm_start - LOAD_OFFSET) { \
130 __sdtcm_data = .; \
131 *(.tcm.data) \
132 . = ALIGN(4); \
133 __edtcm_data = .; \
134 } \
135 . = __dtcm_start + SIZEOF(.data_dtcm);
diff --git a/arch/arm/mm/init.c b/arch/arm/mm/init.c
index bd6f4513539a..c186474422f3 100644
--- a/arch/arm/mm/init.c
+++ b/arch/arm/mm/init.c
@@ -758,20 +758,9 @@ void set_kernel_text_ro(void)
758static inline void fix_kernmem_perms(void) { } 758static inline void fix_kernmem_perms(void) { }
759#endif /* CONFIG_STRICT_KERNEL_RWX */ 759#endif /* CONFIG_STRICT_KERNEL_RWX */
760 760
761void free_tcmmem(void)
762{
763#ifdef CONFIG_HAVE_TCM
764 extern char __tcm_start, __tcm_end;
765
766 poison_init_mem(&__tcm_start, &__tcm_end - &__tcm_start);
767 free_reserved_area(&__tcm_start, &__tcm_end, -1, "TCM link");
768#endif
769}
770
771void free_initmem(void) 761void free_initmem(void)
772{ 762{
773 fix_kernmem_perms(); 763 fix_kernmem_perms();
774 free_tcmmem();
775 764
776 poison_init_mem(__init_begin, __init_end - __init_begin); 765 poison_init_mem(__init_begin, __init_end - __init_begin);
777 if (!machine_is_integrator() && !machine_is_cintegrator()) 766 if (!machine_is_integrator() && !machine_is_cintegrator())
diff --git a/arch/arm/mm/proc-v7.S b/arch/arm/mm/proc-v7.S
index d55d493f9a1e..b528a15f460d 100644
--- a/arch/arm/mm/proc-v7.S
+++ b/arch/arm/mm/proc-v7.S
@@ -272,6 +272,7 @@ ENDPROC(cpu_pj4b_do_resume)
272__v7_ca5mp_setup: 272__v7_ca5mp_setup:
273__v7_ca9mp_setup: 273__v7_ca9mp_setup:
274__v7_cr7mp_setup: 274__v7_cr7mp_setup:
275__v7_cr8mp_setup:
275 mov r10, #(1 << 0) @ Cache/TLB ops broadcasting 276 mov r10, #(1 << 0) @ Cache/TLB ops broadcasting
276 b 1f 277 b 1f
277__v7_ca7mp_setup: 278__v7_ca7mp_setup:
@@ -642,6 +643,16 @@ __v7_cr7mp_proc_info:
642 .size __v7_cr7mp_proc_info, . - __v7_cr7mp_proc_info 643 .size __v7_cr7mp_proc_info, . - __v7_cr7mp_proc_info
643 644
644 /* 645 /*
646 * ARM Ltd. Cortex R8 processor.
647 */
648 .type __v7_cr8mp_proc_info, #object
649__v7_cr8mp_proc_info:
650 .long 0x410fc180
651 .long 0xff0ffff0
652 __v7_proc __v7_cr8mp_proc_info, __v7_cr8mp_setup
653 .size __v7_cr8mp_proc_info, . - __v7_cr8mp_proc_info
654
655 /*
645 * ARM Ltd. Cortex A7 processor. 656 * ARM Ltd. Cortex A7 processor.
646 */ 657 */
647 .type __v7_ca7mp_proc_info, #object 658 .type __v7_ca7mp_proc_info, #object