Skip to content

Commit c2b0fc8

Browse files
committed
Merge tag 'for-linus' of git://git.armlinux.org.uk/~rmk/linux-arm
Pull ARM updates from Russell King: - remove a now unnecessary usage of the KERNEL_DS for sys_oabi_epoll_ctl() - update my email address in a number of drivers - decompressor EFI updates from Ard Biesheuvel - module unwind section handling updates - sparsemem Kconfig cleanups - make act_mm macro respect THREAD_SIZE * tag 'for-linus' of git://git.armlinux.org.uk/~rmk/linux-arm: ARM: 8980/1: Allow either FLATMEM or SPARSEMEM on the multiplatform build ARM: 8979/1: Remove redundant ARCH_SPARSEMEM_DEFAULT setting ARM: 8978/1: mm: make act_mm() respect THREAD_SIZE ARM: decompressor: run decompressor in place if loaded via UEFI ARM: decompressor: move GOT into .data for EFI enabled builds ARM: decompressor: defer loading of the contents of the LC0 structure ARM: decompressor: split off _edata and stack base into separate object ARM: decompressor: move headroom variable out of LC0 ARM: 8976/1: module: allow arch overrides for .init section names ARM: 8975/1: module: fix handling of unwind init sections ARM: 8974/1: use SPARSMEM_STATIC when SPARSEMEM is enabled ARM: 8971/1: replace the sole use of a symbol with its definition ARM: 8969/1: decompressor: simplify libfdt builds Update rmk's email address in various drivers ARM: compat: remove KERNEL_DS usage in sys_oabi_epoll_ctl()
2 parents 533b220 + fb597f2 commit c2b0fc8

File tree

24 files changed

+122
-170
lines changed

24 files changed

+122
-170
lines changed

arch/arm/Kconfig

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -313,6 +313,9 @@ choice
313313
config ARCH_MULTIPLATFORM
314314
bool "Allow multiple platforms to be selected"
315315
depends on MMU
316+
select ARCH_FLATMEM_ENABLE
317+
select ARCH_SPARSEMEM_ENABLE
318+
select ARCH_SELECT_MEMORY_MODEL
316319
select ARM_HAS_SG_CHAIN
317320
select ARM_PATCH_PHYS_VIRT
318321
select AUTO_ZRELADDR
@@ -1516,11 +1519,15 @@ config OABI_COMPAT
15161519
config ARCH_HAS_HOLES_MEMORYMODEL
15171520
bool
15181521

1519-
config ARCH_SPARSEMEM_ENABLE
1522+
config ARCH_SELECT_MEMORY_MODEL
1523+
bool
1524+
1525+
config ARCH_FLATMEM_ENABLE
15201526
bool
15211527

1522-
config ARCH_SPARSEMEM_DEFAULT
1523-
def_bool ARCH_SPARSEMEM_ENABLE
1528+
config ARCH_SPARSEMEM_ENABLE
1529+
bool
1530+
select SPARSEMEM_STATIC if SPARSEMEM
15241531

15251532
config HAVE_ARCH_PFN_VALID
15261533
def_bool ARCH_HAS_HOLES_MEMORYMODEL || !SPARSEMEM

arch/arm/boot/compressed/.gitignore

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,3 @@ hyp-stub.S
77
piggy_data
88
vmlinux
99
vmlinux.lds
10-
11-
# borrowed libfdt files
12-
fdt.c
13-
fdt.h
14-
fdt_ro.c
15-
fdt_rw.c
16-
fdt_wip.c
17-
libfdt.h
18-
libfdt_internal.h

arch/arm/boot/compressed/Makefile

Lines changed: 15 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -76,29 +76,30 @@ compress-$(CONFIG_KERNEL_LZMA) = lzma
7676
compress-$(CONFIG_KERNEL_XZ) = xzkern
7777
compress-$(CONFIG_KERNEL_LZ4) = lz4
7878

79-
# Borrowed libfdt files for the ATAG compatibility mode
80-
81-
libfdt := fdt_rw.c fdt_ro.c fdt_wip.c fdt.c
82-
libfdt_hdrs := fdt.h libfdt.h libfdt_internal.h
83-
84-
libfdt_objs := $(addsuffix .o, $(basename $(libfdt)))
85-
86-
$(addprefix $(obj)/,$(libfdt) $(libfdt_hdrs)): $(obj)/%: $(srctree)/scripts/dtc/libfdt/%
87-
$(call cmd,shipped)
88-
89-
$(addprefix $(obj)/,$(libfdt_objs) atags_to_fdt.o): \
90-
$(addprefix $(obj)/,$(libfdt_hdrs))
79+
libfdt_objs := fdt_rw.o fdt_ro.o fdt_wip.o fdt.o
9180

9281
ifeq ($(CONFIG_ARM_ATAG_DTB_COMPAT),y)
9382
OBJS += $(libfdt_objs) atags_to_fdt.o
9483
endif
9584

85+
# -fstack-protector-strong triggers protection checks in this code,
86+
# but it is being used too early to link to meaningful stack_chk logic.
87+
nossp-flags-$(CONFIG_CC_HAS_STACKPROTECTOR_NONE) := -fno-stack-protector
88+
$(foreach o, $(libfdt_objs) atags_to_fdt.o, \
89+
$(eval CFLAGS_$(o) := -I $(srctree)/scripts/dtc/libfdt $(nossp-flags-y)))
90+
91+
# These were previously generated C files. When you are building the kernel
92+
# with O=, make sure to remove the stale files in the output tree. Otherwise,
93+
# the build system wrongly compiles the stale ones.
94+
ifdef building_out_of_srctree
95+
$(shell rm -f $(addprefix $(obj)/, fdt_rw.c fdt_ro.c fdt_wip.c fdt.c))
96+
endif
97+
9698
targets := vmlinux vmlinux.lds piggy_data piggy.o \
9799
lib1funcs.o ashldi3.o bswapsdi2.o \
98100
head.o $(OBJS)
99101

100-
clean-files += piggy_data lib1funcs.S ashldi3.S bswapsdi2.S \
101-
$(libfdt) $(libfdt_hdrs) hyp-stub.S
102+
clean-files += piggy_data lib1funcs.S ashldi3.S bswapsdi2.S hyp-stub.S
102103

103104
KBUILD_CFLAGS += -DDISABLE_BRANCH_PROFILING
104105

@@ -107,15 +108,6 @@ ORIG_CFLAGS := $(KBUILD_CFLAGS)
107108
KBUILD_CFLAGS = $(subst -pg, , $(ORIG_CFLAGS))
108109
endif
109110

110-
# -fstack-protector-strong triggers protection checks in this code,
111-
# but it is being used too early to link to meaningful stack_chk logic.
112-
nossp-flags-$(CONFIG_CC_HAS_STACKPROTECTOR_NONE) := -fno-stack-protector
113-
CFLAGS_atags_to_fdt.o := $(nossp-flags-y)
114-
CFLAGS_fdt.o := $(nossp-flags-y)
115-
CFLAGS_fdt_ro.o := $(nossp-flags-y)
116-
CFLAGS_fdt_rw.o := $(nossp-flags-y)
117-
CFLAGS_fdt_wip.o := $(nossp-flags-y)
118-
119111
ccflags-y := -fpic $(call cc-option,-mno-single-pic-base,) -fno-builtin \
120112
-I$(obj) $(DISABLE_ARM_SSP_PER_TASK_PLUGIN)
121113
asflags-y := -DZIMAGE

arch/arm/boot/compressed/atags_to_fdt.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
// SPDX-License-Identifier: GPL-2.0
2+
#include <linux/libfdt_env.h>
23
#include <asm/setup.h>
34
#include <libfdt.h>
45

arch/arm/boot/compressed/fdt.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
// SPDX-License-Identifier: GPL-2.0-only
2+
#include "../../../../lib/fdt.c"

arch/arm/boot/compressed/fdt_ro.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
// SPDX-License-Identifier: GPL-2.0-only
2+
#include "../../../../lib/fdt_ro.c"

arch/arm/boot/compressed/fdt_rw.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
// SPDX-License-Identifier: GPL-2.0-only
2+
#include "../../../../lib/fdt_rw.c"

arch/arm/boot/compressed/fdt_wip.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
// SPDX-License-Identifier: GPL-2.0-only
2+
#include "../../../../lib/fdt_wip.c"

arch/arm/boot/compressed/head.S

Lines changed: 32 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -287,28 +287,22 @@ not_angel:
287287
*/
288288
mov r0, pc
289289
cmp r0, r4
290-
ldrcc r0, LC0+28
290+
ldrcc r0, .Lheadroom
291291
addcc r0, r0, pc
292292
cmpcc r4, r0
293293
orrcc r4, r4, #1 @ remember we skipped cache_on
294294
blcs cache_on
295295

296-
restart: adr r0, LC0
297-
ldmia r0, {r1, r2, r3, r6, r11, r12}
298-
ldr sp, [r0, #24]
299-
300-
/*
301-
* We might be running at a different address. We need
302-
* to fix up various pointers.
303-
*/
304-
sub r0, r0, r1 @ calculate the delta offset
305-
add r6, r6, r0 @ _edata
296+
restart: adr r0, LC1
297+
ldr sp, [r0]
298+
ldr r6, [r0, #4]
299+
add sp, sp, r0
300+
add r6, r6, r0
306301

307302
get_inflated_image_size r9, r10, lr
308303

309304
#ifndef CONFIG_ZBOOT_ROM
310305
/* malloc space is above the relocated stack (64k max) */
311-
add sp, sp, r0
312306
add r10, sp, #0x10000
313307
#else
314308
/*
@@ -322,18 +316,13 @@ restart: adr r0, LC0
322316
mov r5, #0 @ init dtb size to 0
323317
#ifdef CONFIG_ARM_APPENDED_DTB
324318
/*
325-
* r0 = delta
326-
* r2 = BSS start
327-
* r3 = BSS end
328319
* r4 = final kernel address (possibly with LSB set)
329320
* r5 = appended dtb size (still unknown)
330321
* r6 = _edata
331322
* r7 = architecture ID
332323
* r8 = atags/device tree pointer
333324
* r9 = size of decompressed image
334325
* r10 = end of this image, including bss/stack/malloc space if non XIP
335-
* r11 = GOT start
336-
* r12 = GOT end
337326
* sp = stack pointer
338327
*
339328
* if there are device trees (dtb) appended to zImage, advance r10 so that the
@@ -381,7 +370,6 @@ restart: adr r0, LC0
381370
/* temporarily relocate the stack past the DTB work space */
382371
add sp, sp, r5
383372

384-
stmfd sp!, {r0-r3, ip, lr}
385373
mov r0, r8
386374
mov r1, r6
387375
mov r2, r5
@@ -400,7 +388,6 @@ restart: adr r0, LC0
400388
mov r2, r5
401389
bleq atags_to_fdt
402390

403-
ldmfd sp!, {r0-r3, ip, lr}
404391
sub sp, sp, r5
405392
#endif
406393

@@ -537,6 +524,10 @@ dtb_check_done:
537524
mov pc, r0
538525

539526
wont_overwrite:
527+
adr r0, LC0
528+
ldmia r0, {r1, r2, r3, r11, r12}
529+
sub r0, r0, r1 @ calculate the delta offset
530+
540531
/*
541532
* If delta is zero, we are running at the address we were linked at.
542533
* r0 = delta
@@ -660,13 +651,18 @@ not_relocated: mov r0, #0
660651
LC0: .word LC0 @ r1
661652
.word __bss_start @ r2
662653
.word _end @ r3
663-
.word _edata @ r6
664654
.word _got_start @ r11
665655
.word _got_end @ ip
666-
.word .L_user_stack_end @ sp
667-
.word _end - restart + 16384 + 1024*1024
668656
.size LC0, . - LC0
669657

658+
.type LC1, #object
659+
LC1: .word .L_user_stack_end - LC1 @ sp
660+
.word _edata - LC1 @ r6
661+
.size LC1, . - LC1
662+
663+
.Lheadroom:
664+
.word _end - restart + 16384 + 1024*1024
665+
670666
.Linflated_image_size_offset:
671667
.long (input_data_end - 4) - .
672668

@@ -1434,38 +1430,26 @@ reloc_code_end:
14341430

14351431
#ifdef CONFIG_EFI_STUB
14361432
ENTRY(efi_enter_kernel)
1437-
mov r7, r0 @ preserve image base
1438-
mov r4, r1 @ preserve DT pointer
1433+
mov r4, r0 @ preserve image base
1434+
mov r8, r1 @ preserve DT pointer
14391435

1440-
mov r0, r4 @ DT start
1441-
add r1, r4, r2 @ DT end
1442-
bl cache_clean_flush
1436+
mrc p15, 0, r0, c1, c0, 0 @ read SCTLR
1437+
tst r0, #0x1 @ MMU enabled?
1438+
orreq r4, r4, #1 @ set LSB if not
14431439

1444-
mov r0, r7 @ relocated zImage
1445-
ldr r1, =_edata @ size of zImage
1446-
add r1, r1, r0 @ end of zImage
1440+
mov r0, r8 @ DT start
1441+
add r1, r8, r2 @ DT end
14471442
bl cache_clean_flush
14481443

1449-
@ The PE/COFF loader might not have cleaned the code we are
1450-
@ running beyond the PoU, and so calling cache_off below from
1451-
@ inside the PE/COFF loader allocated region is unsafe unless
1452-
@ we explicitly clean it to the PoC.
1453-
ARM( adrl r0, call_cache_fn )
1454-
THUMB( adr r0, call_cache_fn ) @ region of code we will
1455-
adr r1, 0f @ run with MMU off
1456-
bl cache_clean_flush
1457-
bl cache_off
1444+
adr r0, 0f @ switch to our stack
1445+
ldr sp, [r0]
1446+
add sp, sp, r0
14581447

1459-
@ Set parameters for booting zImage according to boot protocol
1460-
@ put FDT address in r2, it was returned by efi_entry()
1461-
@ r1 is the machine type, and r0 needs to be 0
1462-
mov r0, #0
1463-
mov r1, #0xFFFFFFFF
1464-
mov r2, r4
1465-
add r7, r7, #(__efi_start - start)
1466-
mov pc, r7 @ no mode switch
1448+
mov r5, #0 @ appended DTB size
1449+
mov r7, #0xFFFFFFFF @ machine ID
1450+
b wont_overwrite
14671451
ENDPROC(efi_enter_kernel)
1468-
0:
1452+
0: .long .L_user_stack_end - .
14691453
#endif
14701454

14711455
.align

arch/arm/boot/compressed/libfdt_env.h

Lines changed: 0 additions & 24 deletions
This file was deleted.

0 commit comments

Comments
 (0)