OSDN Git Service

powerpc/drmem: Make LMB walk a bit more flexible
authorHari Bathini <hbathini@linux.ibm.com>
Wed, 29 Jul 2020 11:40:32 +0000 (17:10 +0530)
committerMichael Ellerman <mpe@ellerman.id.au>
Wed, 29 Jul 2020 13:47:54 +0000 (23:47 +1000)
commitadfefc609e55edc5dce18a68d1526af6d70aaf86
treee5acaa02a080feb636819e949bf1c00d0fa0244a
parentb8e55a3e5c208862eacded5aad822184f89f85d9
powerpc/drmem: Make LMB walk a bit more flexible

Currently, numa & prom are the only users of drmem LMB walk code.
Loading kdump with kexec_file also needs to walk the drmem LMBs to
setup the usable memory ranges for kdump kernel. But there are couple
of issues in using the code as is. One, walk_drmem_lmb() code is built
into the .init section currently, while kexec_file needs it later.
Two, there is no scope to pass data to the callback function for
processing and/or erroring out on certain conditions.

Fix that by, moving drmem LMB walk code out of .init section, adding
scope to pass data to the callback function and bailing out when an
error is encountered in the callback function.

Signed-off-by: Hari Bathini <hbathini@linux.ibm.com>
Tested-by: Pingfan Liu <piliu@redhat.com>
Reviewed-by: Thiago Jung Bauermann <bauerman@linux.ibm.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/159602282727.575379.3979857013827701828.stgit@hbathini
arch/powerpc/include/asm/drmem.h
arch/powerpc/kernel/prom.c
arch/powerpc/mm/drmem.c
arch/powerpc/mm/numa.c