]> git.proxmox.com Git - mirror_ubuntu-artful-kernel.git/commitdiff
ARM: kvm: implement replacement for ld's LOG2CEIL()
authorArd Biesheuvel <ard.biesheuvel@linaro.org>
Mon, 23 Mar 2015 10:52:57 +0000 (10:52 +0000)
committerWill Deacon <will.deacon@arm.com>
Mon, 23 Mar 2015 11:16:50 +0000 (11:16 +0000)
Commit 06f75a1f6200 ("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>
arch/arm/kernel/vmlinux.lds.S

index ba65f12173106b8e3343b05c9bb7d815dfc68f93..2d760df0d57d6fbcecd6be777305c3ccb9ae5522 100644 (file)
 #ifdef CONFIG_ARM_KERNMEM_PERMS
 #include <asm/pgtable.h>
 #endif
-       
+
+/*
+ * Poor man's version of LOG2CEIL(), which is
+ * not available in binutils before v2.24.
+ */
+#define LOG2_ROUNDUP(size) (           \
+       __LOG2_ROUNDUP(size,  2)        \
+       __LOG2_ROUNDUP(size,  3)        \
+       __LOG2_ROUNDUP(size,  4)        \
+       __LOG2_ROUNDUP(size,  5)        \
+       __LOG2_ROUNDUP(size,  6)        \
+       __LOG2_ROUNDUP(size,  7)        \
+       __LOG2_ROUNDUP(size,  8)        \
+       __LOG2_ROUNDUP(size,  9)        \
+       __LOG2_ROUNDUP(size, 10)        \
+       __LOG2_ROUNDUP(size, 11)        \
+       12)
+
+#define __LOG2_ROUNDUP(size, order)    \
+       (size) <= (1 << order) ? order :
+
 #define PROC_INFO                                                      \
        . = ALIGN(4);                                                   \
        VMLINUX_SYMBOL(__proc_info_begin) = .;                          \
@@ -23,7 +43,7 @@
        VMLINUX_SYMBOL(__idmap_text_start) = .;                         \
        *(.idmap.text)                                                  \
        VMLINUX_SYMBOL(__idmap_text_end) = .;                           \
-       . = ALIGN(1 << LOG2CEIL(__hyp_idmap_size));                     \
+       . = ALIGN(1 << LOG2_ROUNDUP(__hyp_idmap_size));                 \
        VMLINUX_SYMBOL(__hyp_idmap_text_start) = .;                     \
        *(.hyp.idmap.text)                                              \
        VMLINUX_SYMBOL(__hyp_idmap_text_end) = .;