Merge branch 'fixes' of git://git.armlinux.org.uk/~rmk/linux-arm
[sfrench/cifs-2.6.git] / drivers / firmware / efi / libstub / arm-stub.c
index 1cb2d1c070c31ba1a80e8e9460d0d102e9dddd74..01a9d78ee4154702e89ab8534727dc1ab66998d4 100644 (file)
@@ -238,7 +238,8 @@ unsigned long efi_entry(void *handle, efi_system_table_t *sys_table,
 
        efi_random_get_seed(sys_table);
 
-       if (!nokaslr()) {
+       /* hibernation expects the runtime regions to stay in the same place */
+       if (!IS_ENABLED(CONFIG_HIBERNATION) && !nokaslr()) {
                /*
                 * Randomize the base of the UEFI runtime services region.
                 * Preserve the 2 MB alignment of the region by taking a
@@ -349,7 +350,9 @@ void efi_get_virtmap(efi_memory_desc_t *memory_map, unsigned long map_size,
         * The easiest way to find adjacent regions is to sort the memory map
         * before traversing it.
         */
-       sort(memory_map, map_size / desc_size, desc_size, cmp_mem_desc, NULL);
+       if (IS_ENABLED(CONFIG_ARM64))
+               sort(memory_map, map_size / desc_size, desc_size, cmp_mem_desc,
+                    NULL);
 
        for (l = 0; l < map_size; l += desc_size, prev = in) {
                u64 paddr, size;
@@ -366,7 +369,8 @@ void efi_get_virtmap(efi_memory_desc_t *memory_map, unsigned long map_size,
                 * a 4k page size kernel to kexec a 64k page size kernel and
                 * vice versa.
                 */
-               if (!regions_are_adjacent(prev, in) ||
+               if ((IS_ENABLED(CONFIG_ARM64) &&
+                    !regions_are_adjacent(prev, in)) ||
                    !regions_have_compatible_memory_type_attrs(prev, in)) {
 
                        paddr = round_down(in->phys_addr, SZ_64K);