arch/powerpc/kernel/fadump.c
Source file repositories/reference/linux-study-clean/arch/powerpc/kernel/fadump.c
File Facts
- System
- Linux kernel
- Corpus path
arch/powerpc/kernel/fadump.c- Extension
.c- Size
- 49873 bytes
- Lines
- 1879
- Domain
- Architecture Layer
- Bucket
- arch/powerpc
- Inferred role
- Architecture Layer: exported/initcall integration point
- Status
- integration implementation candidate
Why This File Exists
CPU and platform-specific kernel glue: boot entry, traps, syscall entry, interrupts, page tables, context switch, and low-level barriers.
- CPU and platform-specific kernel glue: boot entry, traps, syscall entry, interrupts, page tables, context switch, and low-level barriers.
- Exports symbols or registers init work; inspect boot/module ordering and who consumes the exported contract.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- Allocates kernel memory; connect allocation flags and lifetime to context constraints.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/string.hlinux/memblock.hlinux/delay.hlinux/seq_file.hlinux/crash_dump.hlinux/kobject.hlinux/sysfs.hlinux/slab.hlinux/cma.hlinux/hugetlb.hlinux/debugfs.hlinux/of.hlinux/of_fdt.hasm/page.hasm/fadump.hasm/fadump-internal.hasm/setup.hasm/interrupt.hasm/prom.h
Detected Declarations
function fadump_cma_initfunction fadump_append_bootargsfunction early_init_dt_scan_fw_dumpfunction is_fadump_memory_areafunction should_fadump_crashfunction is_fadump_activefunction is_fadump_mem_area_contiguousfunction for_each_mem_rangefunction is_fadump_reserved_mem_contiguousfunction fadump_show_configfunction fadump_calculate_reserve_sizefunction get_fadump_area_sizefunction add_boot_mem_regionfunction add_boot_mem_regionsfunction fadump_get_boot_mem_regionsfunction overlaps_reserved_rangesfunction fadump_locate_reserve_memfunction fadump_reserve_memfunction early_fadump_paramfunction early_fadump_reserve_memfunction crash_fadumpfunction fadump_regs_to_elf_notesfunction fadump_update_elfcore_headerfunction fadump_alloc_bufferfunction fadump_free_bufferfunction fadump_setup_cpu_notes_buffunction fadump_free_cpu_notes_buffunction fadump_free_mem_rangesfunction fadump_alloc_mem_rangesfunction fadump_add_mem_rangefunction fadump_init_elfcore_headerfunction fadump_relocatefunction populate_elf_pt_loadfunction fadump_populate_elfcorehdrfunction init_fadump_headerfunction register_fadumpfunction fadump_cleanupfunction fadump_free_reserved_memoryfunction fadump_release_reserved_areafunction for_each_mem_pfn_rangefunction sort_and_merge_mem_rangesfunction early_init_dt_scan_reserved_rangesfunction fadump_release_memoryfunction fadump_free_elfcorehdr_buffunction fadump_invalidate_release_memfunction release_mem_storefunction unregister_fadumpfunction enabled_show
Annotated Snippet
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. */
int __init early_init_dt_scan_fw_dump(unsigned long node, const char *uname,
int depth, void *data)
{
if (depth == 0) {
early_init_dt_scan_reserved_ranges(node);
return 0;
}
if (depth != 1)
return 0;
if (strcmp(uname, "rtas") == 0) {
rtas_fadump_dt_scan(&fw_dump, node);
return 1;
}
if (strcmp(uname, "ibm,opal") == 0) {
opal_fadump_dt_scan(&fw_dump, node);
return 1;
}
return 0;
}
/*
* If fadump is registered, check if the memory provided
* falls within boot memory area and reserved memory area.
*/
int is_fadump_memory_area(u64 addr, unsigned long size)
{
u64 d_start, d_end;
if (!fw_dump.dump_registered)
return 0;
if (!size)
return 0;
d_start = fw_dump.reserve_dump_area_start;
d_end = d_start + fw_dump.reserve_dump_area_size;
if (((addr + size) > d_start) && (addr <= d_end))
return 1;
return (addr <= fw_dump.boot_mem_top);
}
int should_fadump_crash(void)
{
if (!fw_dump.dump_registered || !fw_dump.fadumphdr_addr)
return 0;
return 1;
}
int is_fadump_active(void)
{
return fw_dump.dump_active;
}
/*
* Returns true, if there are no holes in memory area between d_start to d_end,
* false otherwise.
*/
static bool is_fadump_mem_area_contiguous(u64 d_start, u64 d_end)
{
phys_addr_t reg_start, reg_end;
bool ret = false;
u64 i, start, end;
Annotation
- Immediate include surface: `linux/string.h`, `linux/memblock.h`, `linux/delay.h`, `linux/seq_file.h`, `linux/crash_dump.h`, `linux/kobject.h`, `linux/sysfs.h`, `linux/slab.h`.
- Detected declarations: `function fadump_cma_init`, `function fadump_append_bootargs`, `function early_init_dt_scan_fw_dump`, `function is_fadump_memory_area`, `function should_fadump_crash`, `function is_fadump_active`, `function is_fadump_mem_area_contiguous`, `function for_each_mem_range`, `function is_fadump_reserved_mem_contiguous`, `function fadump_show_config`.
- Atlas domain: Architecture Layer / arch/powerpc.
- Implementation status: integration implementation candidate.
- Synchronization appears in or near this file; preserve lock ordering, sleepability, and interrupt-context constraints.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.