• Philipp Rudo's avatar
    kernel/kexec_file.c: allow archs to set purgatory load address · 3be3f61d
    Philipp Rudo authored
    For s390 new kernels are loaded to fixed addresses in memory before they
    are booted.  With the current code this is a problem as it assumes the
    kernel will be loaded to an 'arbitrary' address.  In particular,
    kexec_locate_mem_hole searches for a large enough memory region and sets
    the load address (kexec_bufer->mem) to it.
    
    Luckily there is a simple workaround for this problem.  By returning 1
    in arch_kexec_walk_mem, kexec_locate_mem_hole is turned off.  This
    allows the architecture to set kbuf->mem by hand.  While the trick works
    fine for the kernel it does not for the purgatory as here the
    architectures don't have access to its kexec_buffer.
    
    Give architectures access to the purgatories kexec_buffer by changing
    kexec_load_purgatory to take a pointer to it.  With this change
    architectures have access to the buffer and can edit it as they need.
    
    A nice side effect of this change is that we can get rid of the
    purgatory_info->purgatory_load_address field.  As now the information
    stored there can directly be accessed from kbuf->mem.
    
    Link: http://lkml.kernel.org/r/20180321112751.22196-11-prudo@linux.vnet.ibm.comSigned-off-by: default avatarPhilipp Rudo <prudo@linux.vnet.ibm.com>
    Reviewed-by: default avatarMartin Schwidefsky <schwidefsky@de.ibm.com>
    Acked-by: default avatarDave Young <dyoung@redhat.com>
    Cc: AKASHI Takahiro <takahiro.akashi@linaro.org>
    Cc: Eric Biederman <ebiederm@xmission.com>
    Cc: Heiko Carstens <heiko.carstens@de.ibm.com>
    Cc: Ingo Molnar <mingo@kernel.org>
    Cc: Michael Ellerman <mpe@ellerman.id.au>
    Cc: Thiago Jung Bauermann <bauerman@linux.vnet.ibm.com>
    Cc: Vivek Goyal <vgoyal@redhat.com>
    Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
    Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
    3be3f61d
kexec_file.c 30.6 KB