Merge branches 'amba', 'devel-stable', 'kexec-for-next' and 'misc' into for-linus
authorRussell King <rmk+kernel@armlinux.org.uk>
Thu, 19 May 2016 09:31:35 +0000 (10:31 +0100)
committerRussell King <rmk+kernel@armlinux.org.uk>
Thu, 19 May 2016 09:31:35 +0000 (10:31 +0100)
1  2  3  4 
arch/arm/kernel/setup.c

diff --combined arch/arm/kernel/setup.c
index 139791ed473d5264682c004ea2ea7af8ddd28f5d,a28fce0bdbbe11b7a950a3a0943f8362d7124b87,d9317eec1ebaabed869b06c84e67251c5ee017c2,139791ed473d5264682c004ea2ea7af8ddd28f5d..9cd27dff5d10ae22f862faa23e87aa6ea8b131bf
@@@@@ -430,11 -430,13 -430,11 -430,11 +430,13 @@@@@ static void __init patch_aeabi_idiv(voi
        pr_info("CPU: div instructions available: patching division code\n");
    
        fn_addr = ((uintptr_t)&__aeabi_uidiv) & ~1;
+ ++    asm ("" : "+g" (fn_addr));
        ((u32 *)fn_addr)[0] = udiv_instruction();
        ((u32 *)fn_addr)[1] = bx_lr_instruction();
        flush_icache_range(fn_addr, fn_addr + 8);
    
        fn_addr = ((uintptr_t)&__aeabi_idiv) & ~1;
+ ++    asm ("" : "+g" (fn_addr));
        ((u32 *)fn_addr)[0] = sdiv_instruction();
        ((u32 *)fn_addr)[1] = bx_lr_instruction();
        flush_icache_range(fn_addr, fn_addr + 8);
@@@@@ -938,6 -940,6 -938,12 -938,6 +940,12 @@@@@ static int __init init_machine_late(voi
    late_initcall(init_machine_late);
    
    #ifdef CONFIG_KEXEC
++ +/*
++ + * The crash region must be aligned to 128MB to avoid
++ + * zImage relocating below the reserved region.
++ + */
++ +#define CRASH_ALIGN (128 << 20)
++ +
    static inline unsigned long long get_total_mem(void)
    {
        unsigned long total;
@@@@@ -965,6 -967,6 -971,26 -965,6 +973,26 @@@@@ static void __init reserve_crashkernel(
        if (ret)
                return;
    
++ +    if (crash_base <= 0) {
++ +            unsigned long long crash_max = idmap_to_phys((u32)~0);
++ +            crash_base = memblock_find_in_range(CRASH_ALIGN, crash_max,
++ +                                                crash_size, CRASH_ALIGN);
++ +            if (!crash_base) {
++ +                    pr_err("crashkernel reservation failed - No suitable area found.\n");
++ +                    return;
++ +            }
++ +    } else {
++ +            unsigned long long start;
++ +
++ +            start = memblock_find_in_range(crash_base,
++ +                                           crash_base + crash_size,
++ +                                           crash_size, SECTION_SIZE);
++ +            if (start != crash_base) {
++ +                    pr_err("crashkernel reservation failed - memory is in use.\n");
++ +                    return;
++ +            }
++ +    }
++ +
        ret = memblock_reserve(crash_base, crash_size);
        if (ret < 0) {
                pr_warn("crashkernel reservation failed - memory is in use (0x%lx)\n",