Merge branch 'x86-kdump-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git...
[sfrench/cifs-2.6.git] / arch / x86 / kernel / setup.c
index 3d872a527cd966facecec3bd8440677ae1d99204..905dae880563889db4e7bbabfd0abcf37d5d5995 100644 (file)
@@ -71,6 +71,7 @@
 #include <linux/tboot.h>
 #include <linux/jiffies.h>
 #include <linux/mem_encrypt.h>
+#include <linux/sizes.h>
 
 #include <linux/usb/xhci-dbgp.h>
 #include <video/edid.h>
@@ -448,18 +449,17 @@ static void __init memblock_x86_reserve_range_setup_data(void)
 #ifdef CONFIG_KEXEC_CORE
 
 /* 16M alignment for crash kernel regions */
-#define CRASH_ALIGN            (16 << 20)
+#define CRASH_ALIGN            SZ_16M
 
 /*
  * Keep the crash kernel below this limit.  On 32 bits earlier kernels
  * would limit the kernel to the low 512 MiB due to mapping restrictions.
- * On 64bit, old kexec-tools need to under 896MiB.
  */
 #ifdef CONFIG_X86_32
-# define CRASH_ADDR_LOW_MAX    (512 << 20)
-# define CRASH_ADDR_HIGH_MAX   (512 << 20)
+# define CRASH_ADDR_LOW_MAX    SZ_512M
+# define CRASH_ADDR_HIGH_MAX   SZ_512M
 #else
-# define CRASH_ADDR_LOW_MAX    (896UL << 20)
+# define CRASH_ADDR_LOW_MAX    SZ_4G
 # define CRASH_ADDR_HIGH_MAX   MAXMEM
 #endif
 
@@ -541,21 +541,27 @@ static void __init reserve_crashkernel(void)
        }
 
        /* 0 means: find the address automatically */
-       if (crash_base <= 0) {
+       if (!crash_base) {
                /*
                 * Set CRASH_ADDR_LOW_MAX upper bound for crash memory,
-                * as old kexec-tools loads bzImage below that, unless
-                * "crashkernel=size[KMG],high" is specified.
+                * crashkernel=x,high reserves memory over 4G, also allocates
+                * 256M extra low memory for DMA buffers and swiotlb.
+                * But the extra memory is not required for all machines.
+                * So try low memory first and fall back to high memory
+                * unless "crashkernel=size[KMG],high" is specified.
                 */
-               crash_base = memblock_find_in_range(CRASH_ALIGN,
-                                                   high ? CRASH_ADDR_HIGH_MAX
-                                                        : CRASH_ADDR_LOW_MAX,
-                                                   crash_size, CRASH_ALIGN);
+               if (!high)
+                       crash_base = memblock_find_in_range(CRASH_ALIGN,
+                                               CRASH_ADDR_LOW_MAX,
+                                               crash_size, CRASH_ALIGN);
+               if (!crash_base)
+                       crash_base = memblock_find_in_range(CRASH_ALIGN,
+                                               CRASH_ADDR_HIGH_MAX,
+                                               crash_size, CRASH_ALIGN);
                if (!crash_base) {
                        pr_info("crashkernel reservation failed - No suitable area found.\n");
                        return;
                }
-
        } else {
                unsigned long long start;
 
@@ -1005,13 +1011,11 @@ void __init setup_arch(char **cmdline_p)
        if (efi_enabled(EFI_BOOT))
                efi_init();
 
-       dmi_scan_machine();
-       dmi_memdev_walk();
-       dmi_set_dump_stack_arch_desc();
+       dmi_setup();
 
        /*
         * VMware detection requires dmi to be available, so this
-        * needs to be done after dmi_scan_machine(), for the boot CPU.
+        * needs to be done after dmi_setup(), for the boot CPU.
         */
        init_hypervisor_platform();