Merge tag 'cxl-for-5.15' of git://git.kernel.org/pub/scm/linux/kernel/git/cxl/cxl
[linux-2.6-microblaze.git] / arch / arm / kernel / setup.c
index 73ca779..284a80c 100644 (file)
@@ -1012,31 +1012,25 @@ static void __init reserve_crashkernel(void)
                unsigned long long lowmem_max = __pa(high_memory - 1) + 1;
                if (crash_max > lowmem_max)
                        crash_max = lowmem_max;
-               crash_base = memblock_find_in_range(CRASH_ALIGN, crash_max,
-                                                   crash_size, CRASH_ALIGN);
+
+               crash_base = memblock_phys_alloc_range(crash_size, CRASH_ALIGN,
+                                                      CRASH_ALIGN, crash_max);
                if (!crash_base) {
                        pr_err("crashkernel reservation failed - No suitable area found.\n");
                        return;
                }
        } else {
+               unsigned long long crash_max = crash_base + crash_size;
                unsigned long long start;
 
-               start = memblock_find_in_range(crash_base,
-                                              crash_base + crash_size,
-                                              crash_size, SECTION_SIZE);
-               if (start != crash_base) {
+               start = memblock_phys_alloc_range(crash_size, SECTION_SIZE,
+                                                 crash_base, crash_max);
+               if (!start) {
                        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",
-                       (unsigned long)crash_base);
-               return;
-       }
-
        pr_info("Reserving %ldMB of memory at %ldMB for crashkernel (System RAM: %ldMB)\n",
                (unsigned long)(crash_size >> 20),
                (unsigned long)(crash_base >> 20),
@@ -1083,6 +1077,20 @@ void __init hyp_mode_check(void)
 #endif
 }
 
+static void (*__arm_pm_restart)(enum reboot_mode reboot_mode, const char *cmd);
+
+static int arm_restart(struct notifier_block *nb, unsigned long action,
+                      void *data)
+{
+       __arm_pm_restart(action, data);
+       return NOTIFY_DONE;
+}
+
+static struct notifier_block arm_restart_nb = {
+       .notifier_call = arm_restart,
+       .priority = 128,
+};
+
 void __init setup_arch(char **cmdline_p)
 {
        const struct machine_desc *mdesc = NULL;
@@ -1116,10 +1124,7 @@ void __init setup_arch(char **cmdline_p)
        if (mdesc->reboot_mode != REBOOT_HARD)
                reboot_mode = mdesc->reboot_mode;
 
-       init_mm.start_code = (unsigned long) _text;
-       init_mm.end_code   = (unsigned long) _etext;
-       init_mm.end_data   = (unsigned long) _edata;
-       init_mm.brk        = (unsigned long) _end;
+       setup_initial_init_mm(_text, _etext, _edata, _end);
 
        /* populate cmd_line too for later use, preserving boot_command_line */
        strlcpy(cmd_line, boot_command_line, COMMAND_LINE_SIZE);
@@ -1151,8 +1156,10 @@ void __init setup_arch(char **cmdline_p)
        kasan_init();
        request_standard_resources(mdesc);
 
-       if (mdesc->restart)
-               arm_pm_restart = mdesc->restart;
+       if (mdesc->restart) {
+               __arm_pm_restart = mdesc->restart;
+               register_restart_handler(&arm_restart_nb);
+       }
 
        unflatten_device_tree();