arch/powerpc/mm/book3s64/radix_pgtable.c
Source file repositories/reference/linux-study-clean/arch/powerpc/mm/book3s64/radix_pgtable.c
File Facts
- System
- Linux kernel
- Corpus path
arch/powerpc/mm/book3s64/radix_pgtable.c- Extension
.c- Size
- 42118 bytes
- Lines
- 1698
- Domain
- Architecture Layer
- Bucket
- arch/powerpc
- Inferred role
- Architecture Layer: implementation source
- Status
- source 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.
- 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/io.hlinux/kernel.hlinux/sched/mm.hlinux/memblock.hlinux/of.hlinux/of_fdt.hlinux/mm.hlinux/page_table_check.hlinux/hugetlb.hlinux/string_helpers.hlinux/memory.hlinux/kfence.hasm/pgalloc.hasm/mmu_context.hasm/dma.hasm/machdep.hasm/mmu.hasm/firmware.hasm/powernv.hasm/sections.hasm/smp.hasm/trace.hasm/uaccess.hasm/ultravisor.hasm/set_memory.hasm/kfence.htrace/events/thp.hmm/mmu_decl.h
Detected Declarations
function early_map_kernel_pagefunction __map_kernel_pagefunction radix__map_kernel_pagefunction radix__change_memory_rangefunction radix__mark_rodata_rofunction radix__mark_initmem_nxfunction print_mappingfunction next_boundaryfunction create_physical_mappingfunction alloc_kfence_poolfunction map_kfence_poolfunction alloc_kfence_poolfunction map_kfence_poolfunction nodefunction radix_init_partition_tablefunction get_idx_from_shiftfunction radix_dt_scan_page_sizesfunction radix__early_init_devtreefunction radix__early_init_mmufunction radix__early_init_mmu_secondaryfunction radix__mmu_cleanup_allfunction free_pte_tablefunction free_pmd_tablefunction free_pud_tablefunction vmemmap_pmd_is_unusedfunction vmemmap_page_is_unusedfunction free_vmemmap_pagesfunction remove_pte_tablefunction remove_pmd_tablefunction remove_pud_tablefunction remove_pagetablefunction radix__create_section_mappingfunction radix__remove_section_mappingfunction __map_kernel_page_nidfunction radix__vmemmap_create_mappingfunction vmemmap_can_optimizefunction vmemmap_check_pmdfunction vmemmap_set_pmdfunction radix__vmemmap_pte_populatefunction radix__vmemmap_populatefunction radix__vmemmap_populate_addressfunction vmemmap_compound_tail_pagefunction vmemmap_populate_compound_pagesfunction radix__vmemmap_remove_mappingfunction radix__vmemmap_freefunction radix__pmd_hugepage_updatefunction radix__pud_hugepage_updatefunction radix__pmdp_collapse_flush
Annotated Snippet
if (pud_leaf(*pudp)) {
ptep = (pte_t *)pudp;
goto update_the_pte;
}
pmdp = pmd_alloc(&init_mm, pudp, idx);
if (!pmdp)
continue;
if (pmd_leaf(*pmdp)) {
ptep = pmdp_ptep(pmdp);
goto update_the_pte;
}
ptep = pte_alloc_kernel(pmdp, idx);
if (!ptep)
continue;
update_the_pte:
radix__pte_update(&init_mm, idx, ptep, clear, 0, 0);
}
radix__flush_tlb_kernel_range(start, end);
}
void radix__mark_rodata_ro(void)
{
unsigned long start, end;
start = (unsigned long)_stext;
end = (unsigned long)__end_rodata;
radix__change_memory_range(start, end, _PAGE_WRITE);
for (start = PAGE_OFFSET; start < (unsigned long)_stext; start += PAGE_SIZE) {
end = start + PAGE_SIZE;
if (overlaps_interrupt_vector_text(start, end))
radix__change_memory_range(start, end, _PAGE_WRITE);
else
break;
}
}
void radix__mark_initmem_nx(void)
{
unsigned long start = (unsigned long)__init_begin;
unsigned long end = (unsigned long)__init_end;
radix__change_memory_range(start, end, _PAGE_EXEC);
}
#endif /* CONFIG_STRICT_KERNEL_RWX */
static inline void __meminit
print_mapping(unsigned long start, unsigned long end, unsigned long size, bool exec)
{
char buf[10];
if (end <= start)
return;
string_get_size(size, 1, STRING_UNITS_2, buf, sizeof(buf));
pr_info("Mapped 0x%016lx-0x%016lx with %s pages%s\n", start, end, buf,
exec ? " (exec)" : "");
}
static unsigned long next_boundary(unsigned long addr, unsigned long end)
{
#ifdef CONFIG_STRICT_KERNEL_RWX
unsigned long stext_phys;
stext_phys = __pa_symbol(_stext);
// Relocatable kernel running at non-zero real address
if (stext_phys != 0) {
// The end of interrupts code at zero is a rodata boundary
unsigned long end_intr = __pa_symbol(__end_interrupts) - stext_phys;
if (addr < end_intr)
return end_intr;
// Start of relocated kernel text is a rodata boundary
if (addr < stext_phys)
return stext_phys;
}
if (addr < __pa_symbol(__srwx_boundary))
return __pa_symbol(__srwx_boundary);
#endif
return end;
}
static int __meminit create_physical_mapping(unsigned long start,
unsigned long end,
int nid, pgprot_t _prot,
Annotation
- Immediate include surface: `linux/io.h`, `linux/kernel.h`, `linux/sched/mm.h`, `linux/memblock.h`, `linux/of.h`, `linux/of_fdt.h`, `linux/mm.h`, `linux/page_table_check.h`.
- Detected declarations: `function early_map_kernel_page`, `function __map_kernel_page`, `function radix__map_kernel_page`, `function radix__change_memory_range`, `function radix__mark_rodata_ro`, `function radix__mark_initmem_nx`, `function print_mapping`, `function next_boundary`, `function create_physical_mapping`, `function alloc_kfence_pool`.
- Atlas domain: Architecture Layer / arch/powerpc.
- Implementation status: source 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.