kexec: Respect memory limit while building crash memory ranges on ppc32.

So far powerpc kernel never exported memory limit information which is
reflected by mem= kernel cmdline option. Hence, kexec-tools always used
to build ELF header for entire system RAM generating a dump bigger than
the actual memory used by the first kernel.

This patch now reads the memory limit information from device-tree file and
limits the crash memory ranges accordingly.

Suzuki tested this patch on ppc32(ppc440) with a kernel patch by Suzuki.

The following are the upstream kernel commits that exports memory limit
information through /proc/device-tree file:
  4bc77a5ed - powerpc: Export memory limit via device tree
  a84fcd468 - powerpc: Change memory_limit from phys_addr_t to unsigned
	      long long

Signed-off-by: Mahesh Salgaonkar <mahesh@linux.vnet.ibm.com>
Tested-by: Suzuki K. Poulose <suzuki@in.ibm.com>
Signed-off-by: Simon Horman <horms@verge.net.au>
3 files changed