arch/arm/mm/cache-feroceon-l2.c
Source file repositories/reference/linux-study-clean/arch/arm/mm/cache-feroceon-l2.c
File Facts
- System
- Linux kernel
- Corpus path
arch/arm/mm/cache-feroceon-l2.c- Extension
.c- Size
- 9089 bytes
- Lines
- 390
- Domain
- Architecture Layer
- Bucket
- arch/arm
- 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.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/init.hlinux/of.hlinux/of_address.hlinux/highmem.hlinux/io.hasm/cacheflush.hasm/cp15.hasm/hardware/cache-feroceon-l2.h
Detected Declarations
function Copyrightfunction l2_put_vafunction l2_clean_pafunction l2_clean_pa_rangefunction l2_clean_inv_pafunction l2_inv_pafunction l2_inv_pa_rangefunction l2_inv_allfunction calc_range_endfunction feroceon_l2_inv_rangefunction feroceon_l2_clean_rangefunction feroceon_l2_flush_rangefunction flush_and_disable_dcachefunction enable_dcachefunction __invalidate_icachefunction invalidate_and_disable_icachefunction enable_icachefunction read_extra_featuresfunction write_extra_featuresfunction disable_l2_prefetchfunction enable_l2function feroceon_l2_initfunction feroceon_of_init
Annotated Snippet
while (start != end) {
unsigned long range_end = calc_range_end(start, end);
l2_clean_pa_range(start, range_end - CACHE_LINE_SIZE);
start = range_end;
}
}
dsb();
}
static void feroceon_l2_flush_range(unsigned long start, unsigned long end)
{
start &= ~(CACHE_LINE_SIZE - 1);
end = (end + CACHE_LINE_SIZE - 1) & ~(CACHE_LINE_SIZE - 1);
while (start != end) {
unsigned long range_end = calc_range_end(start, end);
if (!l2_wt_override)
l2_clean_pa_range(start, range_end - CACHE_LINE_SIZE);
l2_inv_pa_range(start, range_end - CACHE_LINE_SIZE);
start = range_end;
}
dsb();
}
/*
* Routines to disable and re-enable the D-cache and I-cache at run
* time. These are necessary because the L2 cache can only be enabled
* or disabled while the L1 Dcache and Icache are both disabled.
*/
static int __init flush_and_disable_dcache(void)
{
u32 cr;
cr = get_cr();
if (cr & CR_C) {
unsigned long flags;
raw_local_irq_save(flags);
flush_cache_all();
set_cr(cr & ~CR_C);
raw_local_irq_restore(flags);
return 1;
}
return 0;
}
static void __init enable_dcache(void)
{
u32 cr;
cr = get_cr();
set_cr(cr | CR_C);
}
static void __init __invalidate_icache(void)
{
__asm__("mcr p15, 0, %0, c7, c5, 0" : : "r" (0));
}
static int __init invalidate_and_disable_icache(void)
{
u32 cr;
cr = get_cr();
if (cr & CR_I) {
set_cr(cr & ~CR_I);
__invalidate_icache();
return 1;
}
return 0;
}
static void __init enable_icache(void)
{
u32 cr;
cr = get_cr();
set_cr(cr | CR_I);
}
static inline u32 read_extra_features(void)
{
u32 u;
__asm__("mrc p15, 1, %0, c15, c1, 0" : "=r" (u));
return u;
}
Annotation
- Immediate include surface: `linux/init.h`, `linux/of.h`, `linux/of_address.h`, `linux/highmem.h`, `linux/io.h`, `asm/cacheflush.h`, `asm/cp15.h`, `asm/hardware/cache-feroceon-l2.h`.
- Detected declarations: `function Copyright`, `function l2_put_va`, `function l2_clean_pa`, `function l2_clean_pa_range`, `function l2_clean_inv_pa`, `function l2_inv_pa`, `function l2_inv_pa_range`, `function l2_inv_all`, `function calc_range_end`, `function feroceon_l2_inv_range`.
- Atlas domain: Architecture Layer / arch/arm.
- 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.