arch/arm/mm/mmu.c
Source file repositories/reference/linux-study-clean/arch/arm/mm/mmu.c
File Facts
- System
- Linux kernel
- Corpus path
arch/arm/mm/mmu.c- Extension
.c- Size
- 51231 bytes
- Lines
- 1803
- Domain
- Architecture Layer
- Bucket
- arch/arm
- 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/module.hlinux/kernel.hlinux/errno.hlinux/init.hlinux/mman.hlinux/nodemask.hlinux/memblock.hlinux/fs.hlinux/vmalloc.hlinux/sizes.hasm/cp15.hasm/cputype.hasm/cachetype.hasm/sections.hasm/setup.hasm/smp_plat.hasm/tcm.hasm/tlb.hasm/highmem.hasm/system_info.hasm/traps.hasm/procinfo.hasm/page.hasm/pgalloc.hasm/kasan_def.hasm/mach/arch.hasm/mach/map.hasm/mach/pci.hasm/fixmap.hfault.hmm.h
Detected Declarations
struct cachepolicyfunction init_default_cache_policyfunction early_cachepolicyfunction attributesfunction early_nocachefunction early_nowritefunction early_eccfunction early_cachepolicyfunction noalign_setupfunction pte_offset_early_fixmapfunction fixmap_pmdfunction early_fixmap_initfunction stop_machinefunction build_mem_type_tablefunction early_cachepolicyfunction phys_mem_access_protfunction late_allocfunction arm_pte_allocfunction early_pte_allocfunction alloc_init_ptefunction __map_init_sectionfunction alloc_init_pmdfunction alloc_init_pudfunction alloc_init_p4dfunction create_36bit_mappingfunction __create_mappingfunction create_mappingfunction create_mapping_latefunction iotable_initfunction vm_reserve_area_earlyfunction create_mappingfunction fill_pmd_gapsfunction list_for_each_entryfunction pci_reserve_iofunction debug_ll_io_initfunction early_vmallocfunction adjust_lowmem_boundsfunction for_each_mem_rangefunction prepare_page_tablefunction devicemaps_initfunction kmap_initfunction map_lowmemfunction map_kernelfunction early_paging_initfunction early_paging_initfunction early_fixmap_shutdownfunction paging_initfunction early_mm_init
Annotated Snippet
struct cachepolicy {
const char policy[16];
unsigned int cr_mask;
pmdval_t pmd;
pteval_t pte;
};
static struct cachepolicy cache_policies[] __initdata = {
{
.policy = "uncached",
.cr_mask = CR_W|CR_C,
.pmd = PMD_SECT_UNCACHED,
.pte = L_PTE_MT_UNCACHED,
}, {
.policy = "buffered",
.cr_mask = CR_C,
.pmd = PMD_SECT_BUFFERED,
.pte = L_PTE_MT_BUFFERABLE,
}, {
.policy = "writethrough",
.cr_mask = 0,
.pmd = PMD_SECT_WT,
.pte = L_PTE_MT_WRITETHROUGH,
}, {
.policy = "writeback",
.cr_mask = 0,
.pmd = PMD_SECT_WB,
.pte = L_PTE_MT_WRITEBACK,
}, {
.policy = "writealloc",
.cr_mask = 0,
.pmd = PMD_SECT_WBWA,
.pte = L_PTE_MT_WRITEALLOC,
}
};
#ifdef CONFIG_CPU_CP15
static unsigned long initial_pmd_value __initdata = 0;
/*
* Initialise the cache_policy variable with the initial state specified
* via the "pmd" value. This is used to ensure that on ARMv6 and later,
* the C code sets the page tables up with the same policy as the head
* assembly code, which avoids an illegal state where the TLBs can get
* confused. See comments in early_cachepolicy() for more information.
*/
void __init init_default_cache_policy(unsigned long pmd)
{
int i;
initial_pmd_value = pmd;
pmd &= PMD_SECT_CACHE_MASK;
for (i = 0; i < ARRAY_SIZE(cache_policies); i++)
if (cache_policies[i].pmd == pmd) {
cachepolicy = i;
break;
}
if (i == ARRAY_SIZE(cache_policies))
pr_err("ERROR: could not find cache policy\n");
}
/*
* These are useful for identifying cache coherency problems by allowing
* the cache or the cache and writebuffer to be turned off. (Note: the
* write buffer should not be on and the cache off).
*/
static int __init early_cachepolicy(char *p)
{
int i, selected = -1;
for (i = 0; i < ARRAY_SIZE(cache_policies); i++) {
int len = strlen(cache_policies[i].policy);
if (memcmp(p, cache_policies[i].policy, len) == 0) {
selected = i;
break;
}
}
if (selected == -1)
pr_err("ERROR: unknown or unsupported cache policy\n");
/*
* This restriction is partly to do with the way we boot; it is
* unpredictable to have memory mapped using two different sets of
* memory attributes (shared, type, and cache attribs). We can not
* change these attributes once the initial assembly has setup the
Annotation
- Immediate include surface: `linux/module.h`, `linux/kernel.h`, `linux/errno.h`, `linux/init.h`, `linux/mman.h`, `linux/nodemask.h`, `linux/memblock.h`, `linux/fs.h`.
- Detected declarations: `struct cachepolicy`, `function init_default_cache_policy`, `function early_cachepolicy`, `function attributes`, `function early_nocache`, `function early_nowrite`, `function early_ecc`, `function early_cachepolicy`, `function noalign_setup`, `function pte_offset_early_fixmap`.
- Atlas domain: Architecture Layer / arch/arm.
- 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.