Merge tag 'sunxi-drm-fixes-for-4.7-2' of https://git.kernel.org/pub/scm/linux/kernel...
[deliverable/linux.git] / arch / arm / kernel / setup.c
index 2c4bea39cf224f8368cca2b4dba61a5b807a3dde..7b5350060612786c566d6f96cbffa2f444a91453 100644 (file)
@@ -883,7 +883,8 @@ static void __init request_standard_resources(const struct machine_desc *mdesc)
                request_resource(&ioport_resource, &lp2);
 }
 
-#if defined(CONFIG_VGA_CONSOLE) || defined(CONFIG_DUMMY_CONSOLE)
+#if defined(CONFIG_VGA_CONSOLE) || defined(CONFIG_DUMMY_CONSOLE) || \
+    defined(CONFIG_EFI)
 struct screen_info screen_info = {
  .orig_video_lines     = 30,
  .orig_video_cols      = 80,
@@ -940,6 +941,12 @@ static int __init init_machine_late(void)
 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;
@@ -967,6 +974,26 @@ static void __init reserve_crashkernel(void)
        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",
This page took 0.027714 seconds and 5 git commands to generate.