powerpc/fadump: consider f/w load area

OPAL loads kernel & initrd at 512MB offset (256MB size), also exported
as ibm,opal/dump/fw-load-area. So, if boot memory size of FADump is
less than 768MB, kernel memory to be exported as '/proc/vmcore' would
be overwritten by f/w while loading kernel & initrd. To avoid such a
scenario, enforce a minimum boot memory size of 768MB on OPAL platform
and skip using FADump if a newer F/W version loads kernel & initrd
above 768MB.

Also, irrespective of RMA size, set the minimum boot memory size
expected on pseries platform at 320MB. This is to avoid inflating the
minimum memory requirements on systems with 512M/1024M RMA size.

Signed-off-by: Hari Bathini <hbathini@linux.ibm.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/156821381414.5656.1592867278535469652.stgit@hbathini.in.ibm.com
このコミットが含まれているのは:
Hari Bathini
2019-09-11 20:26:59 +05:30
committed by Michael Ellerman
コミット 7b1b3b4825
6個のファイルの変更64行の追加15行の削除

ファイルの表示

@@ -9,6 +9,7 @@
#include <linux/string.h>
#include <linux/seq_file.h>
#include <linux/of.h>
#include <linux/of_fdt.h>
#include <linux/libfdt.h>
#include <linux/mm.h>
@@ -262,6 +263,11 @@ static int opal_fadump_setup_metadata(struct fw_dump *fadump_conf)
return err;
}
static u64 opal_fadump_get_bootmem_min(void)
{
return OPAL_FADUMP_MIN_BOOT_MEM;
}
static int opal_fadump_register(struct fw_dump *fadump_conf)
{
s64 rc = OPAL_PARAMETER;
@@ -606,6 +612,7 @@ static struct fadump_ops opal_fadump_ops = {
.fadump_init_mem_struct = opal_fadump_init_mem_struct,
.fadump_get_metadata_size = opal_fadump_get_metadata_size,
.fadump_setup_metadata = opal_fadump_setup_metadata,
.fadump_get_bootmem_min = opal_fadump_get_bootmem_min,
.fadump_register = opal_fadump_register,
.fadump_unregister = opal_fadump_unregister,
.fadump_invalidate = opal_fadump_invalidate,
@@ -620,9 +627,9 @@ void __init opal_fadump_dt_scan(struct fw_dump *fadump_conf, u64 node)
const __be32 *prop;
unsigned long dn;
u64 addr = 0;
int i, len;
s64 ret;
/*
* Check if Firmware-Assisted Dump is supported. if yes, check
* if dump has been initiated on last reboot.
@@ -638,6 +645,27 @@ void __init opal_fadump_dt_scan(struct fw_dump *fadump_conf, u64 node)
return;
}
prop = of_get_flat_dt_prop(dn, "fw-load-area", &len);
if (prop) {
/*
* Each f/w load area is an (address,size) pair,
* 2 cells each, totalling 4 cells per range.
*/
for (i = 0; i < len / (sizeof(*prop) * 4); i++) {
u64 base, end;
base = of_read_number(prop + (i * 4) + 0, 2);
end = base;
end += of_read_number(prop + (i * 4) + 2, 2);
if (end > OPAL_FADUMP_MIN_BOOT_MEM) {
pr_err("F/W load area: 0x%llx-0x%llx\n",
base, end);
pr_err("F/W version not supported!\n");
return;
}
}
}
fadump_conf->ops = &opal_fadump_ops;
fadump_conf->fadump_supported = 1;