Skip to content

Commit e60a1fe

Browse files
Ard Biesheuvelwildea01
authored andcommitted
ARM: kvm: implement replacement for ld's LOG2CEIL()
Commit 06f75a1 ("ARM, arm64: kvm: get rid of the bounce page") uses ld's builtin function LOG2CEIL() to align the KVM init code to a log2 upper bound of its size. However, this function turns out to be a fairly recent addition to binutils, which breaks the build for older toolchains. So instead, implement a replacement LOG2_ROUNDUP() using the C preprocessor. Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org> Signed-off-by: Will Deacon <will.deacon@arm.com>
1 parent 06f75a1 commit e60a1fe

File tree

1 file changed

+22
-2
lines changed

1 file changed

+22
-2
lines changed

arch/arm/kernel/vmlinux.lds.S

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,27 @@
1111
#ifdef CONFIG_ARM_KERNMEM_PERMS
1212
#include <asm/pgtable.h>
1313
#endif
14-
14+
15+
/*
16+
* Poor man's version of LOG2CEIL(), which is
17+
* not available in binutils before v2.24.
18+
*/
19+
#define LOG2_ROUNDUP(size) ( \
20+
__LOG2_ROUNDUP(size, 2) \
21+
__LOG2_ROUNDUP(size, 3) \
22+
__LOG2_ROUNDUP(size, 4) \
23+
__LOG2_ROUNDUP(size, 5) \
24+
__LOG2_ROUNDUP(size, 6) \
25+
__LOG2_ROUNDUP(size, 7) \
26+
__LOG2_ROUNDUP(size, 8) \
27+
__LOG2_ROUNDUP(size, 9) \
28+
__LOG2_ROUNDUP(size, 10) \
29+
__LOG2_ROUNDUP(size, 11) \
30+
12)
31+
32+
#define __LOG2_ROUNDUP(size, order) \
33+
(size) <= (1 << order) ? order :
34+
1535
#define PROC_INFO \
1636
. = ALIGN(4); \
1737
VMLINUX_SYMBOL(__proc_info_begin) = .; \
@@ -23,7 +43,7 @@
2343
VMLINUX_SYMBOL(__idmap_text_start) = .; \
2444
*(.idmap.text) \
2545
VMLINUX_SYMBOL(__idmap_text_end) = .; \
26-
. = ALIGN(1 << LOG2CEIL(__hyp_idmap_size)); \
46+
. = ALIGN(1 << LOG2_ROUNDUP(__hyp_idmap_size)); \
2747
VMLINUX_SYMBOL(__hyp_idmap_text_start) = .; \
2848
*(.hyp.idmap.text) \
2949
VMLINUX_SYMBOL(__hyp_idmap_text_end) = .;

0 commit comments

Comments
 (0)