arch/powerpc/mm/init_64.c
Source file repositories/reference/linux-study-clean/arch/powerpc/mm/init_64.c
File Facts
- System
- Linux kernel
- Corpus path
arch/powerpc/mm/init_64.c- Extension
.c- Size
- 18874 bytes
- Lines
- 673
- 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.
- 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/signal.hlinux/sched.hlinux/kernel.hlinux/errno.hlinux/string.hlinux/types.hlinux/mman.hlinux/mm.hlinux/swap.hlinux/stddef.hlinux/vmalloc.hlinux/init.hlinux/delay.hlinux/highmem.hlinux/idr.hlinux/nodemask.hlinux/module.hlinux/poison.hlinux/memblock.hlinux/hugetlb.hlinux/slab.hlinux/of_fdt.hlinux/libfdt.hlinux/memremap.hlinux/memory.hasm/pgalloc.hasm/page.hasm/prom.hasm/rtas.hasm/io.hasm/mmu_context.hasm/mmu.h
Detected Declarations
function Copyrightfunction subsectionsfunction vmemmap_list_allocfunction vmemmap_list_populatefunction altmap_cross_boundaryfunction __vmemmap_populatefunction vmemmap_populatefunction vmemmap_list_freefunction __vmemmap_freefunction vmemmap_freefunction parse_disable_radixfunction early_check_vec5function dt_scan_mmu_pid_widthfunction update_memory_block_sizefunction probe_memory_block_sizefunction early_init_memory_block_sizefunction mmu_early_init_devtreeexport mmu_lpid_bits
Annotated Snippet
if (unlikely(!next)) {
WARN_ON(1);
return NULL;
}
num_left = PAGE_SIZE / sizeof(struct vmemmap_backing);
}
num_left--;
return next++;
}
static __meminit int vmemmap_list_populate(unsigned long phys,
unsigned long start,
int node)
{
struct vmemmap_backing *vmem_back;
vmem_back = vmemmap_list_alloc(node);
if (unlikely(!vmem_back)) {
pr_debug("vmemap list allocation failed\n");
return -ENOMEM;
}
vmem_back->phys = phys;
vmem_back->virt_addr = start;
vmem_back->list = vmemmap_list;
vmemmap_list = vmem_back;
return 0;
}
bool altmap_cross_boundary(struct vmem_altmap *altmap, unsigned long start,
unsigned long page_size)
{
unsigned long nr_pfn = page_size / sizeof(struct page);
unsigned long start_pfn = page_to_pfn((struct page *)start);
if ((start_pfn + nr_pfn - 1) > altmap->end_pfn)
return true;
if (start_pfn < altmap->base_pfn)
return true;
return false;
}
static int __meminit __vmemmap_populate(unsigned long start, unsigned long end, int node,
struct vmem_altmap *altmap)
{
bool altmap_alloc;
unsigned long page_size = 1 << mmu_psize_defs[mmu_vmemmap_psize].shift;
/* Align to the page size of the linear mapping. */
start = ALIGN_DOWN(start, page_size);
pr_debug("vmemmap_populate %lx..%lx, node %d\n", start, end, node);
for (; start < end; start += page_size) {
void *p = NULL;
int rc;
/*
* This vmemmap range is backing different subsections. If any
* of that subsection is marked valid, that means we already
* have initialized a page table covering this range and hence
* the vmemmap range is populated.
*/
if (vmemmap_populated(start, page_size))
continue;
/*
* Allocate from the altmap first if we have one. This may
* fail due to alignment issues when using 16MB hugepages, so
* fall back to system memory if the altmap allocation fail.
*/
if (altmap && !altmap_cross_boundary(altmap, start, page_size)) {
p = vmemmap_alloc_block_buf(page_size, node, altmap);
if (!p)
pr_debug("altmap block allocation failed, falling back to system memory");
else
altmap_alloc = true;
}
if (!p) {
p = vmemmap_alloc_block_buf(page_size, node, NULL);
altmap_alloc = false;
}
if (!p)
return -ENOMEM;
Annotation
- Immediate include surface: `linux/signal.h`, `linux/sched.h`, `linux/kernel.h`, `linux/errno.h`, `linux/string.h`, `linux/types.h`, `linux/mman.h`, `linux/mm.h`.
- Detected declarations: `function Copyright`, `function subsections`, `function vmemmap_list_alloc`, `function vmemmap_list_populate`, `function altmap_cross_boundary`, `function __vmemmap_populate`, `function vmemmap_populate`, `function vmemmap_list_free`, `function __vmemmap_free`, `function vmemmap_free`.
- Atlas domain: Architecture Layer / arch/powerpc.
- 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.