Skip to content

Commit 2d63499

Browse files
committed
Merge branch 'fixes' of git://git.armlinux.org.uk/~rmk/linux-arm
Pull ARM fixes from Russell King: - omit EFI memory map sorting, which was recently introduced, but caused problems with the decompressor due to additional sections being emitted. - avoid unaligned load fault-generating instructions in the decompressor by switching to a private unaligned implementation. - add a symbol into the decompressor to further debug non-boot situations (ld's documentation is extremely poor for how "." works, ld doesn't seem to follow its own documentation!) - parse endian information to sparse * 'fixes' of git://git.armlinux.org.uk/~rmk/linux-arm: ARM: add debug ".edata_real" symbol ARM: 8716/1: pass endianness info to sparse efi/libstub: arm: omit sorting of the UEFI memory map ARM: 8715/1: add a private asm/unaligned.h
2 parents f0a32ee + dad4675 commit 2d63499

File tree

6 files changed

+46
-6
lines changed

6 files changed

+46
-6
lines changed

arch/arm/Makefile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,10 +44,12 @@ endif
4444

4545
ifeq ($(CONFIG_CPU_BIG_ENDIAN),y)
4646
KBUILD_CPPFLAGS += -mbig-endian
47+
CHECKFLAGS += -D__ARMEB__
4748
AS += -EB
4849
LD += -EB
4950
else
5051
KBUILD_CPPFLAGS += -mlittle-endian
52+
CHECKFLAGS += -D__ARMEL__
5153
AS += -EL
5254
LD += -EL
5355
endif

arch/arm/boot/compressed/vmlinux.lds.S

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,15 @@ SECTIONS
8585

8686
_edata = .;
8787

88+
/*
89+
* The image_end section appears after any additional loadable sections
90+
* that the linker may decide to insert in the binary image. Having
91+
* this symbol allows further debug in the near future.
92+
*/
93+
.image_end (NOLOAD) : {
94+
_edata_real = .;
95+
}
96+
8897
_magic_sig = ZIMAGE_MAGIC(0x016f2818);
8998
_magic_start = ZIMAGE_MAGIC(_start);
9099
_magic_end = ZIMAGE_MAGIC(_edata);

arch/arm/include/asm/Kbuild

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ generic-y += simd.h
2020
generic-y += sizes.h
2121
generic-y += timex.h
2222
generic-y += trace_clock.h
23-
generic-y += unaligned.h
2423

2524
generated-y += mach-types.h
2625
generated-y += unistd-nr.h

arch/arm/include/asm/unaligned.h

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
#ifndef __ASM_ARM_UNALIGNED_H
2+
#define __ASM_ARM_UNALIGNED_H
3+
4+
/*
5+
* We generally want to set CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS on ARMv6+,
6+
* but we don't want to use linux/unaligned/access_ok.h since that can lead
7+
* to traps on unaligned stm/ldm or strd/ldrd.
8+
*/
9+
#include <asm/byteorder.h>
10+
11+
#if defined(__LITTLE_ENDIAN)
12+
# include <linux/unaligned/le_struct.h>
13+
# include <linux/unaligned/be_byteshift.h>
14+
# include <linux/unaligned/generic.h>
15+
# define get_unaligned __get_unaligned_le
16+
# define put_unaligned __put_unaligned_le
17+
#elif defined(__BIG_ENDIAN)
18+
# include <linux/unaligned/be_struct.h>
19+
# include <linux/unaligned/le_byteshift.h>
20+
# include <linux/unaligned/generic.h>
21+
# define get_unaligned __get_unaligned_be
22+
# define put_unaligned __put_unaligned_be
23+
#else
24+
# error need to define endianess
25+
#endif
26+
27+
#endif /* __ASM_ARM_UNALIGNED_H */

drivers/firmware/efi/libstub/Makefile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,13 +34,14 @@ lib-y := efi-stub-helper.o gop.o secureboot.o
3434
lib-$(CONFIG_RESET_ATTACK_MITIGATION) += tpm.o
3535

3636
# include the stub's generic dependencies from lib/ when building for ARM/arm64
37-
arm-deps := fdt_rw.c fdt_ro.c fdt_wip.c fdt.c fdt_empty_tree.c fdt_sw.c sort.c
37+
arm-deps-y := fdt_rw.c fdt_ro.c fdt_wip.c fdt.c fdt_empty_tree.c fdt_sw.c
38+
arm-deps-$(CONFIG_ARM64) += sort.c
3839

3940
$(obj)/lib-%.o: $(srctree)/lib/%.c FORCE
4041
$(call if_changed_rule,cc_o_c)
4142

4243
lib-$(CONFIG_EFI_ARMSTUB) += arm-stub.o fdt.o string.o random.o \
43-
$(patsubst %.c,lib-%.o,$(arm-deps))
44+
$(patsubst %.c,lib-%.o,$(arm-deps-y))
4445

4546
lib-$(CONFIG_ARM) += arm32-stub.o
4647
lib-$(CONFIG_ARM64) += arm64-stub.o
@@ -91,5 +92,4 @@ quiet_cmd_stubcopy = STUBCPY $@
9192
# explicitly by the decompressor linker script.
9293
#
9394
STUBCOPY_FLAGS-$(CONFIG_ARM) += --rename-section .data=.data.efistub
94-
STUBCOPY_RM-$(CONFIG_ARM) += -R ___ksymtab+sort -R ___kcrctab+sort
9595
STUBCOPY_RELOC-$(CONFIG_ARM) := R_ARM_ABS

drivers/firmware/efi/libstub/arm-stub.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -350,7 +350,9 @@ void efi_get_virtmap(efi_memory_desc_t *memory_map, unsigned long map_size,
350350
* The easiest way to find adjacent regions is to sort the memory map
351351
* before traversing it.
352352
*/
353-
sort(memory_map, map_size / desc_size, desc_size, cmp_mem_desc, NULL);
353+
if (IS_ENABLED(CONFIG_ARM64))
354+
sort(memory_map, map_size / desc_size, desc_size, cmp_mem_desc,
355+
NULL);
354356

355357
for (l = 0; l < map_size; l += desc_size, prev = in) {
356358
u64 paddr, size;
@@ -367,7 +369,8 @@ void efi_get_virtmap(efi_memory_desc_t *memory_map, unsigned long map_size,
367369
* a 4k page size kernel to kexec a 64k page size kernel and
368370
* vice versa.
369371
*/
370-
if (!regions_are_adjacent(prev, in) ||
372+
if ((IS_ENABLED(CONFIG_ARM64) &&
373+
!regions_are_adjacent(prev, in)) ||
371374
!regions_have_compatible_memory_type_attrs(prev, in)) {
372375

373376
paddr = round_down(in->phys_addr, SZ_64K);

0 commit comments

Comments
 (0)