From: Matthew Leach <hidden> Date: 2012-09-07 08:40:58
Currently the value of r2 that is passed to the new kernel when
performing a kexec() is hard coded to an address that is 16Kb before
the kernel image. A dtb file may be much larger and thus get corrupted
by the decompressor's page tables.
These patches, along with a set of kexec-tools patches, move the dtb
to a more sane location. The kernel will scan each segment for the dtb
magic within the first four bytes of each segment to identify the
physical address to pass through to the new kernel in r2.
Matthew Leach (2):
ARM: kexec: scan for dtb magic in segments
ARM: kexec: Check segment memory addresses
arch/arm/kernel/machine_kexec.c | 28 +++++++++++++++++++++++++++-
1 file changed, 27 insertions(+), 1 deletion(-)
--
1.7.12
From: Matthew Leach <hidden> Date: 2012-09-07 08:40:59
This patch allows a dtb to be passed to a new kernel using the kexec
mechinism.
When loading segments from userspace, scan each segment's first four
bytes for the dtb magic. If this is found set the kexec_boot_atags
parameter to the relocate_kernel code to the phyical address of this
segment.
Reviewed-by: Simon Horman <horms@verge.net.au>
Reviewed-by: Will Deacon <redacted>
Signed-off-by: Matthew Leach <redacted>
---
arch/arm/kernel/machine_kexec.c | 21 ++++++++++++++++++++-
1 file changed, 20 insertions(+), 1 deletion(-)
From: Matthew Leach <hidden> Date: 2012-09-07 08:41:00
Ensure that the memory regions that are set within the segments
correspond to physical contiguous memory regions.
Reviewed-by: Simon Horman <horms@verge.net.au>
Reviewed-by: Will Deacon <redacted>
Signed-off-by: Matthew Leach <redacted>
---
arch/arm/kernel/machine_kexec.c | 7 +++++++
1 file changed, 7 insertions(+)
From: Russell King - ARM Linux <hidden> Date: 2012-09-07 08:49:38
On Fri, Sep 07, 2012 at 09:41:00AM +0100, Matthew Leach wrote:
Ensure that the memory regions that are set within the segments
correspond to physical contiguous memory regions.
Reviewed-by: Simon Horman <horms@verge.net.au>
Reviewed-by: Will Deacon <redacted>
Signed-off-by: Matthew Leach <redacted>
What about platforms which pull out bits of physical RAM from memblock
via arm_memblock_steal() ? Doesn't this mean such platforms will reduce
their available memory on each subsequent kexec?
From: Will Deacon <hidden> Date: 2012-09-07 10:04:22
On Fri, Sep 07, 2012 at 09:49:38AM +0100, Russell King - ARM Linux wrote:
On Fri, Sep 07, 2012 at 09:41:00AM +0100, Matthew Leach wrote:
quoted
Ensure that the memory regions that are set within the segments
correspond to physical contiguous memory regions.
Reviewed-by: Simon Horman <horms@verge.net.au>
Reviewed-by: Will Deacon <redacted>
Signed-off-by: Matthew Leach <redacted>
What about platforms which pull out bits of physical RAM from memblock
via arm_memblock_steal() ? Doesn't this mean such platforms will reduce
their available memory on each subsequent kexec?
I don't think that will happen. All that kexec does is check that the
location where it wants to load the new kernel is physically contiguous -- the
memblock configuration is not inherited by the target kernel.
What *might* happen is that a memblock_steal on the host kernel could cause
the kexec to fail with -EINVAL if the area removed corresponds to the area
where the target kernel wants to be loaded. I think this is correct
behaviour, because we have no idea what the stolen region is being used for.
Will