arch/csky/mm/cachev2.c
Source file repositories/reference/linux-study-clean/arch/csky/mm/cachev2.c
File Facts
- System
- Linux kernel
- Corpus path
arch/csky/mm/cachev2.c- Extension
.c- Size
- 2692 bytes
- Lines
- 121
- Domain
- Architecture Layer
- Bucket
- arch/csky
- 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.
- 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/spinlock.hlinux/smp.hlinux/mm.hasm/cache.hasm/barrier.h
Detected Declarations
struct cache_rangefunction local_icache_inv_allfunction icache_inv_rangefunction cache_op_linefunction local_icache_inv_rangefunction icache_inv_rangefunction dcache_wb_linefunction dcache_wb_rangefunction cache_wbinv_rangefunction dma_wbinv_rangefunction dma_inv_rangefunction dma_wb_rangeexport cache_wbinv_range
Annotated Snippet
struct cache_range {
unsigned long start;
unsigned long end;
};
static DEFINE_SPINLOCK(cache_lock);
static inline void cache_op_line(unsigned long i, unsigned int val)
{
mtcr("cr22", i);
mtcr("cr17", val);
}
void local_icache_inv_range(void *priv)
{
struct cache_range *param = priv;
unsigned long i = param->start & ~(L1_CACHE_BYTES - 1);
unsigned long flags;
spin_lock_irqsave(&cache_lock, flags);
for (; i < param->end; i += L1_CACHE_BYTES)
cache_op_line(i, INS_CACHE | CACHE_INV | CACHE_OMS);
spin_unlock_irqrestore(&cache_lock, flags);
sync_is();
}
void icache_inv_range(unsigned long start, unsigned long end)
{
struct cache_range param = { start, end };
if (irqs_disabled())
local_icache_inv_range(¶m);
else
on_each_cpu(local_icache_inv_range, ¶m, 1);
}
#endif
inline void dcache_wb_line(unsigned long start)
{
asm volatile("dcache.cval1 %0\n"::"r"(start):"memory");
sync_is();
}
void dcache_wb_range(unsigned long start, unsigned long end)
{
unsigned long i = start & ~(L1_CACHE_BYTES - 1);
for (; i < end; i += L1_CACHE_BYTES)
asm volatile("dcache.cval1 %0\n"::"r"(i):"memory");
sync_is();
}
void cache_wbinv_range(unsigned long start, unsigned long end)
{
dcache_wb_range(start, end);
icache_inv_range(start, end);
}
EXPORT_SYMBOL(cache_wbinv_range);
void dma_wbinv_range(unsigned long start, unsigned long end)
{
unsigned long i = start & ~(L1_CACHE_BYTES - 1);
for (; i < end; i += L1_CACHE_BYTES)
asm volatile("dcache.civa %0\n"::"r"(i):"memory");
sync_is();
}
void dma_inv_range(unsigned long start, unsigned long end)
{
unsigned long i = start & ~(L1_CACHE_BYTES - 1);
for (; i < end; i += L1_CACHE_BYTES)
asm volatile("dcache.iva %0\n"::"r"(i):"memory");
sync_is();
}
void dma_wb_range(unsigned long start, unsigned long end)
{
unsigned long i = start & ~(L1_CACHE_BYTES - 1);
for (; i < end; i += L1_CACHE_BYTES)
asm volatile("dcache.cva %0\n"::"r"(i):"memory");
sync_is();
}
Annotation
- Immediate include surface: `linux/spinlock.h`, `linux/smp.h`, `linux/mm.h`, `asm/cache.h`, `asm/barrier.h`.
- Detected declarations: `struct cache_range`, `function local_icache_inv_all`, `function icache_inv_range`, `function cache_op_line`, `function local_icache_inv_range`, `function icache_inv_range`, `function dcache_wb_line`, `function dcache_wb_range`, `function cache_wbinv_range`, `function dma_wbinv_range`.
- Atlas domain: Architecture Layer / arch/csky.
- Implementation status: integration 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.