arm64: kdump: Provide default size when crashkernel=Y,low is not specified
[sfrench/cifs-2.6.git] / arch / arm64 / mm / init.c
index 4b4651ee47f271a76281055a8b542e2573711611..ba7227179822d10a9a2ab3aff2519ae10886d39e 100644 (file)
@@ -96,6 +96,8 @@ phys_addr_t __ro_after_init arm64_dma_phys_limit = PHYS_MASK + 1;
 #define CRASH_ADDR_LOW_MAX             arm64_dma_phys_limit
 #define CRASH_ADDR_HIGH_MAX            (PHYS_MASK + 1)
 
+#define DEFAULT_CRASH_KERNEL_LOW_SIZE  (128UL << 20)
+
 static int __init reserve_crashkernel_low(unsigned long long low_size)
 {
        unsigned long long low_base;
@@ -147,7 +149,9 @@ static void __init reserve_crashkernel(void)
                 * is not allowed.
                 */
                ret = parse_crashkernel_low(cmdline, 0, &crash_low_size, &crash_base);
-               if (ret && (ret != -ENOENT))
+               if (ret == -ENOENT)
+                       crash_low_size = DEFAULT_CRASH_KERNEL_LOW_SIZE;
+               else if (ret)
                        return;
 
                crash_max = CRASH_ADDR_HIGH_MAX;
@@ -170,7 +174,7 @@ static void __init reserve_crashkernel(void)
                return;
        }
 
-       if ((crash_base >= CRASH_ADDR_LOW_MAX) &&
+       if ((crash_base > CRASH_ADDR_LOW_MAX - crash_low_size) &&
             crash_low_size && reserve_crashkernel_low(crash_low_size)) {
                memblock_phys_free(crash_base, crash_size);
                return;