diff options
author | Hari Bathini <hbathini@linux.ibm.com> | 2019-09-11 20:20:57 +0530 |
---|---|---|
committer | Michael Ellerman <mpe@ellerman.id.au> | 2019-09-14 00:04:43 +1000 |
commit | 742a265accd3e3afcc8e7b17f409c93c1de8be85 (patch) | |
tree | 134a9dce27087f15d67dd637a7cb0175709ca457 /arch/powerpc/kernel/fadump.c | |
parent | 6abec12c65e8870d8cafe154a86240fe0bcdd4f7 (diff) | |
download | linux-742a265accd3e3afcc8e7b17f409c93c1de8be85.tar.bz2 |
powerpc/fadump: register kernel metadata address with opal
OPAL allows registering address with it in the first kernel and
retrieving it after MPIPL. Setup kernel metadata and register its
address with OPAL to use it for processing the crash dump.
Signed-off-by: Hari Bathini <hbathini@linux.ibm.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/156821345011.5656.13567765019032928471.stgit@hbathini.in.ibm.com
Diffstat (limited to 'arch/powerpc/kernel/fadump.c')
-rw-r--r-- | arch/powerpc/kernel/fadump.c | 23 |
1 files changed, 20 insertions, 3 deletions
diff --git a/arch/powerpc/kernel/fadump.c b/arch/powerpc/kernel/fadump.c index 7d47d4bb7d6e..7e7056382d98 100644 --- a/arch/powerpc/kernel/fadump.c +++ b/arch/powerpc/kernel/fadump.c @@ -313,6 +313,10 @@ static unsigned long get_fadump_area_size(void) size += sizeof(struct elf_phdr) * (memblock_num_regions(memory) + 2); size = PAGE_ALIGN(size); + + /* This is to hold kernel metadata on platforms that support it */ + size += (fw_dump.ops->fadump_get_metadata_size ? + fw_dump.ops->fadump_get_metadata_size() : 0); return size; } @@ -348,6 +352,7 @@ int __init fadump_reserve_mem(void) pr_info("Firmware-Assisted Dump is not supported on this hardware\n"); goto error_out; } + /* * Initialize boot memory size * If dump is active then we have already calculated the size during @@ -426,8 +431,21 @@ int __init fadump_reserve_mem(void) base += size; } - if ((base > (mem_boundary - size)) || - memblock_reserve(base, size)) { + if (base > (mem_boundary - size)) { + pr_err("Failed to find memory chunk for reservation!\n"); + goto error_out; + } + fw_dump.reserve_dump_area_start = base; + + /* + * Calculate the kernel metadata address and register it with + * f/w if the platform supports. + */ + if (fw_dump.ops->fadump_setup_metadata && + (fw_dump.ops->fadump_setup_metadata(&fw_dump) < 0)) + goto error_out; + + if (memblock_reserve(base, size)) { pr_err("Failed to reserve memory!\n"); goto error_out; } @@ -435,7 +453,6 @@ int __init fadump_reserve_mem(void) pr_info("Reserved %lldMB of memory at %#016llx (System RAM: %lldMB)\n", (size >> 20), base, (memblock_phys_mem_size() >> 20)); - fw_dump.reserve_dump_area_start = base; ret = fadump_cma_init(); } |