drivers/remoteproc/remoteproc_coredump.c
Source file repositories/reference/linux-study-clean/drivers/remoteproc/remoteproc_coredump.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/remoteproc/remoteproc_coredump.c- Extension
.c- Size
- 13858 bytes
- Lines
- 472
- Domain
- Driver Families
- Bucket
- drivers/remoteproc
- Inferred role
- Driver Families: exported/initcall integration point
- Status
- integration implementation candidate
Why This File Exists
Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Exports symbols or registers init work; inspect boot/module ordering and who consumes the exported contract.
- 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/completion.hlinux/devcoredump.hlinux/device.hlinux/kernel.hlinux/remoteproc.hremoteproc_internal.hremoteproc_elf_helpers.h
Detected Declarations
struct rproc_coredump_statefunction rproc_coredump_cleanupfunction list_for_each_entry_safefunction rproc_coredump_add_segmentfunction rproc_coredump_add_custom_segmentfunction rproc_coredump_set_elf_infofunction rproc_coredump_freefunction list_for_each_entryfunction rproc_copy_segmentfunction rproc_coredump_readfunction rproc_coredumpfunction list_for_each_entryfunction rproc_coredump_using_sectionsfunction list_for_each_entryfunction list_for_each_entryexport rproc_coredump_cleanupexport rproc_coredump_add_segmentexport rproc_coredump_add_custom_segmentexport rproc_coredump_set_elf_infoexport rproc_coredumpexport rproc_coredump_using_sections
Annotated Snippet
struct rproc_coredump_state {
struct rproc *rproc;
void *header;
struct completion dump_done;
};
/**
* rproc_coredump_cleanup() - clean up dump_segments list
* @rproc: the remote processor handle
*/
void rproc_coredump_cleanup(struct rproc *rproc)
{
struct rproc_dump_segment *entry, *tmp;
list_for_each_entry_safe(entry, tmp, &rproc->dump_segments, node) {
list_del(&entry->node);
kfree(entry);
}
}
EXPORT_SYMBOL_GPL(rproc_coredump_cleanup);
/**
* rproc_coredump_add_segment() - add segment of device memory to coredump
* @rproc: handle of a remote processor
* @da: device address
* @size: size of segment
*
* Add device memory to the list of segments to be included in a coredump for
* the remoteproc.
*
* Return: 0 on success, negative errno on error.
*/
int rproc_coredump_add_segment(struct rproc *rproc, dma_addr_t da, size_t size)
{
struct rproc_dump_segment *segment;
segment = kzalloc_obj(*segment);
if (!segment)
return -ENOMEM;
segment->da = da;
segment->size = size;
list_add_tail(&segment->node, &rproc->dump_segments);
return 0;
}
EXPORT_SYMBOL(rproc_coredump_add_segment);
/**
* rproc_coredump_add_custom_segment() - add custom coredump segment
* @rproc: handle of a remote processor
* @da: device address
* @size: size of segment
* @dumpfn: custom dump function called for each segment during coredump
* @priv: private data
*
* Add device memory to the list of segments to be included in the coredump
* and associate the segment with the given custom dump function and private
* data.
*
* Return: 0 on success, negative errno on error.
*/
int rproc_coredump_add_custom_segment(struct rproc *rproc,
dma_addr_t da, size_t size,
void (*dumpfn)(struct rproc *rproc,
struct rproc_dump_segment *segment,
void *dest, size_t offset,
size_t size),
void *priv)
{
struct rproc_dump_segment *segment;
segment = kzalloc_obj(*segment);
if (!segment)
return -ENOMEM;
segment->da = da;
segment->size = size;
segment->priv = priv;
segment->dump = dumpfn;
list_add_tail(&segment->node, &rproc->dump_segments);
return 0;
}
EXPORT_SYMBOL(rproc_coredump_add_custom_segment);
/**
* rproc_coredump_set_elf_info() - set coredump elf information
Annotation
- Immediate include surface: `linux/completion.h`, `linux/devcoredump.h`, `linux/device.h`, `linux/kernel.h`, `linux/remoteproc.h`, `remoteproc_internal.h`, `remoteproc_elf_helpers.h`.
- Detected declarations: `struct rproc_coredump_state`, `function rproc_coredump_cleanup`, `function list_for_each_entry_safe`, `function rproc_coredump_add_segment`, `function rproc_coredump_add_custom_segment`, `function rproc_coredump_set_elf_info`, `function rproc_coredump_free`, `function list_for_each_entry`, `function rproc_copy_segment`, `function rproc_coredump_read`.
- Atlas domain: Driver Families / drivers/remoteproc.
- Implementation status: integration implementation candidate.
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.