powerpc/fadump: pass additional parameters when fadump is active
Append the additional parameters passed/set in the dedicated parameter area (RTAS_FADUMP_PARAM_AREA) to bootargs in fadump capture kernel. Signed-off-by: Hari Bathini <hbathini@linux.ibm.com> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au> Link: https://msgid.link/20240509115755.519982-4-hbathini@linux.ibm.com
This commit is contained in:
parent
683eab94da
commit
3416c9daa6
@ -19,12 +19,14 @@ extern int is_fadump_active(void);
|
|||||||
extern int should_fadump_crash(void);
|
extern int should_fadump_crash(void);
|
||||||
extern void crash_fadump(struct pt_regs *, const char *);
|
extern void crash_fadump(struct pt_regs *, const char *);
|
||||||
extern void fadump_cleanup(void);
|
extern void fadump_cleanup(void);
|
||||||
|
extern void fadump_append_bootargs(void);
|
||||||
|
|
||||||
#else /* CONFIG_FA_DUMP */
|
#else /* CONFIG_FA_DUMP */
|
||||||
static inline int is_fadump_active(void) { return 0; }
|
static inline int is_fadump_active(void) { return 0; }
|
||||||
static inline int should_fadump_crash(void) { return 0; }
|
static inline int should_fadump_crash(void) { return 0; }
|
||||||
static inline void crash_fadump(struct pt_regs *regs, const char *str) { }
|
static inline void crash_fadump(struct pt_regs *regs, const char *str) { }
|
||||||
static inline void fadump_cleanup(void) { }
|
static inline void fadump_cleanup(void) { }
|
||||||
|
static inline void fadump_append_bootargs(void) { }
|
||||||
#endif /* !CONFIG_FA_DUMP */
|
#endif /* !CONFIG_FA_DUMP */
|
||||||
|
|
||||||
#if defined(CONFIG_FA_DUMP) || defined(CONFIG_PRESERVE_FA_DUMP)
|
#if defined(CONFIG_FA_DUMP) || defined(CONFIG_PRESERVE_FA_DUMP)
|
||||||
|
@ -131,6 +131,41 @@ static int __init fadump_cma_init(void)
|
|||||||
static int __init fadump_cma_init(void) { return 1; }
|
static int __init fadump_cma_init(void) { return 1; }
|
||||||
#endif /* CONFIG_CMA */
|
#endif /* CONFIG_CMA */
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Additional parameters meant for capture kernel are placed in a dedicated area.
|
||||||
|
* If this is capture kernel boot, append these parameters to bootargs.
|
||||||
|
*/
|
||||||
|
void __init fadump_append_bootargs(void)
|
||||||
|
{
|
||||||
|
char *append_args;
|
||||||
|
size_t len;
|
||||||
|
|
||||||
|
if (!fw_dump.dump_active || !fw_dump.param_area_supported || !fw_dump.param_area)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (fw_dump.param_area >= fw_dump.boot_mem_top) {
|
||||||
|
if (memblock_reserve(fw_dump.param_area, COMMAND_LINE_SIZE)) {
|
||||||
|
pr_warn("WARNING: Can't use additional parameters area!\n");
|
||||||
|
fw_dump.param_area = 0;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
append_args = (char *)fw_dump.param_area;
|
||||||
|
len = strlen(boot_command_line);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Too late to fail even if cmdline size exceeds. Truncate additional parameters
|
||||||
|
* to cmdline size and proceed anyway.
|
||||||
|
*/
|
||||||
|
if (len + strlen(append_args) >= COMMAND_LINE_SIZE - 1)
|
||||||
|
pr_warn("WARNING: Appending parameters exceeds cmdline size. Truncating!\n");
|
||||||
|
|
||||||
|
pr_debug("Cmdline: %s\n", boot_command_line);
|
||||||
|
snprintf(boot_command_line + len, COMMAND_LINE_SIZE - len, " %s", append_args);
|
||||||
|
pr_info("Updated cmdline: %s\n", boot_command_line);
|
||||||
|
}
|
||||||
|
|
||||||
/* Scan the Firmware Assisted dump configuration details. */
|
/* Scan the Firmware Assisted dump configuration details. */
|
||||||
int __init early_init_dt_scan_fw_dump(unsigned long node, const char *uname,
|
int __init early_init_dt_scan_fw_dump(unsigned long node, const char *uname,
|
||||||
int depth, void *data)
|
int depth, void *data)
|
||||||
|
@ -813,6 +813,9 @@ void __init early_init_devtree(void *params)
|
|||||||
*/
|
*/
|
||||||
of_scan_flat_dt(early_init_dt_scan_chosen_ppc, boot_command_line);
|
of_scan_flat_dt(early_init_dt_scan_chosen_ppc, boot_command_line);
|
||||||
|
|
||||||
|
/* Append additional parameters passed for fadump capture kernel */
|
||||||
|
fadump_append_bootargs();
|
||||||
|
|
||||||
/* Scan memory nodes and rebuild MEMBLOCKs */
|
/* Scan memory nodes and rebuild MEMBLOCKs */
|
||||||
early_init_dt_scan_root();
|
early_init_dt_scan_root();
|
||||||
early_init_dt_scan_memory_ppc();
|
early_init_dt_scan_memory_ppc();
|
||||||
|
Loading…
Reference in New Issue
Block a user