Skip to content

Commit 78d5cc1

Browse files
hbathinimpe
authored andcommitted
powerpc/pseries/fadump: add support for multiple boot memory regions
Currently, fadump on pseries assumes a single boot memory region even though f/w supports more than one boot memory region. Add support for more boot memory regions to make the implementation flexible for any enhancements that introduce other region types. For this, rtas memory structure for fadump is updated to have multiple boot memory regions instead of just one. Additionally, methods responsible for creating the fadump memory structure during both the first and second kernel boot have been modified to take these multiple boot memory regions into account. Also, a new callback has been added to the fadump_ops structure to get the maximum boot memory regions supported by the platform. Signed-off-by: Sourabh Jain <[email protected]> Signed-off-by: Hari Bathini <[email protected]> Signed-off-by: Michael Ellerman <[email protected]> Link: https://msgid.link/[email protected]
1 parent 98ec6d3 commit 78d5cc1

File tree

5 files changed

+197
-120
lines changed

5 files changed

+197
-120
lines changed

arch/powerpc/include/asm/fadump-internal.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,14 +156,14 @@ struct fadump_ops {
156156
struct seq_file *m);
157157
void (*fadump_trigger)(struct fadump_crash_info_header *fdh,
158158
const char *msg);
159+
int (*fadump_max_boot_mem_rgns)(void);
159160
};
160161

161162
/* Helper functions */
162163
s32 __init fadump_setup_cpu_notes_buf(u32 num_cpus);
163164
void fadump_free_cpu_notes_buf(void);
164165
u32 *__init fadump_regs_to_elf_notes(u32 *buf, struct pt_regs *regs);
165166
void __init fadump_update_elfcore_header(char *bufp);
166-
bool is_fadump_boot_mem_contiguous(void);
167167
bool is_fadump_reserved_mem_contiguous(void);
168168

169169
#else /* !CONFIG_PRESERVE_FA_DUMP */

arch/powerpc/kernel/fadump.c

Lines changed: 3 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -220,28 +220,6 @@ static bool is_fadump_mem_area_contiguous(u64 d_start, u64 d_end)
220220
return ret;
221221
}
222222

223-
/*
224-
* Returns true, if there are no holes in boot memory area,
225-
* false otherwise.
226-
*/
227-
bool is_fadump_boot_mem_contiguous(void)
228-
{
229-
unsigned long d_start, d_end;
230-
bool ret = false;
231-
int i;
232-
233-
for (i = 0; i < fw_dump.boot_mem_regs_cnt; i++) {
234-
d_start = fw_dump.boot_mem_addr[i];
235-
d_end = d_start + fw_dump.boot_mem_sz[i];
236-
237-
ret = is_fadump_mem_area_contiguous(d_start, d_end);
238-
if (!ret)
239-
break;
240-
}
241-
242-
return ret;
243-
}
244-
245223
/*
246224
* Returns true, if there are no holes in reserved memory area,
247225
* false otherwise.
@@ -381,10 +359,11 @@ static unsigned long __init get_fadump_area_size(void)
381359
static int __init add_boot_mem_region(unsigned long rstart,
382360
unsigned long rsize)
383361
{
362+
int max_boot_mem_rgns = fw_dump.ops->fadump_max_boot_mem_rgns();
384363
int i = fw_dump.boot_mem_regs_cnt++;
385364

386-
if (fw_dump.boot_mem_regs_cnt > FADUMP_MAX_MEM_REGS) {
387-
fw_dump.boot_mem_regs_cnt = FADUMP_MAX_MEM_REGS;
365+
if (fw_dump.boot_mem_regs_cnt > max_boot_mem_rgns) {
366+
fw_dump.boot_mem_regs_cnt = max_boot_mem_rgns;
388367
return 0;
389368
}
390369

arch/powerpc/platforms/powernv/opal-fadump.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -599,6 +599,12 @@ static void opal_fadump_trigger(struct fadump_crash_info_header *fdh,
599599
pr_emerg("No backend support for MPIPL!\n");
600600
}
601601

602+
/* FADUMP_MAX_MEM_REGS or lower */
603+
static int opal_fadump_max_boot_mem_rgns(void)
604+
{
605+
return FADUMP_MAX_MEM_REGS;
606+
}
607+
602608
static struct fadump_ops opal_fadump_ops = {
603609
.fadump_init_mem_struct = opal_fadump_init_mem_struct,
604610
.fadump_get_metadata_size = opal_fadump_get_metadata_size,
@@ -611,6 +617,7 @@ static struct fadump_ops opal_fadump_ops = {
611617
.fadump_process = opal_fadump_process,
612618
.fadump_region_show = opal_fadump_region_show,
613619
.fadump_trigger = opal_fadump_trigger,
620+
.fadump_max_boot_mem_rgns = opal_fadump_max_boot_mem_rgns,
614621
};
615622

616623
void __init opal_fadump_dt_scan(struct fw_dump *fadump_conf, u64 node)

0 commit comments

Comments
 (0)