arch/sh/mm/cache-sh7705.c
Source file repositories/reference/linux-study-clean/arch/sh/mm/cache-sh7705.c
File Facts
- System
- Linux kernel
- Corpus path
arch/sh/mm/cache-sh7705.c- Extension
.c- Size
- 5114 bytes
- Lines
- 201
- Domain
- Architecture Layer
- Bucket
- arch/sh
- 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.
- 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/init.hlinux/mman.hlinux/mm.hlinux/fs.hlinux/pagemap.hlinux/threads.hasm/addrspace.hasm/page.hasm/processor.hasm/cache.hasm/io.hlinux/uaccess.hasm/mmu_context.hasm/cacheflush.h
Detected Declarations
function Copyrightfunction sh7705_flush_icache_rangefunction __flush_dcache_pagefunction sh7705_flush_dcache_foliofunction sh7705_flush_cache_allfunction sh7705_flush_cache_pagefunction sh7705_flush_icache_foliofunction sh7705_cache_init
Annotated Snippet
if (data == phys) {
data &= ~(SH_CACHE_VALID | SH_CACHE_UPDATED);
__raw_writel(data, addr);
}
}
addrstart += current_cpu_data.dcache.way_incr;
} while (--ways);
back_to_cached();
local_irq_restore(flags);
}
/*
* Write back & invalidate the D-cache of the page.
* (To avoid "alias" issues)
*/
static void sh7705_flush_dcache_folio(void *arg)
{
struct folio *folio = arg;
struct address_space *mapping = folio_flush_mapping(folio);
if (mapping && !mapping_mapped(mapping))
clear_bit(PG_dcache_clean, &folio->flags.f);
else {
unsigned long pfn = folio_pfn(folio);
unsigned int i, nr = folio_nr_pages(folio);
for (i = 0; i < nr; i++)
__flush_dcache_page((pfn + i) * PAGE_SIZE);
}
}
static void sh7705_flush_cache_all(void *args)
{
unsigned long flags;
local_irq_save(flags);
jump_to_uncached();
cache_wback_all();
back_to_cached();
local_irq_restore(flags);
}
/*
* Write back and invalidate I/D-caches for the page.
*
* ADDRESS: Virtual Address (U0 address)
*/
static void sh7705_flush_cache_page(void *args)
{
struct flusher_data *data = args;
unsigned long pfn = data->addr2;
__flush_dcache_page(pfn << PAGE_SHIFT);
}
/*
* This is called when a page-cache page is about to be mapped into a
* user process' address space. It offers an opportunity for a
* port to ensure d-cache/i-cache coherency if necessary.
*
* Not entirely sure why this is necessary on SH3 with 32K cache but
* without it we get occasional "Memory fault" when loading a program.
*/
static void sh7705_flush_icache_folio(void *arg)
{
struct folio *folio = arg;
__flush_purge_region(folio_address(folio), folio_size(folio));
}
void __init sh7705_cache_init(void)
{
local_flush_icache_range = sh7705_flush_icache_range;
local_flush_dcache_folio = sh7705_flush_dcache_folio;
local_flush_cache_all = sh7705_flush_cache_all;
local_flush_cache_mm = sh7705_flush_cache_all;
local_flush_cache_dup_mm = sh7705_flush_cache_all;
local_flush_cache_range = sh7705_flush_cache_all;
local_flush_cache_page = sh7705_flush_cache_page;
local_flush_icache_folio = sh7705_flush_icache_folio;
}
Annotation
- Immediate include surface: `linux/init.h`, `linux/mman.h`, `linux/mm.h`, `linux/fs.h`, `linux/pagemap.h`, `linux/threads.h`, `asm/addrspace.h`, `asm/page.h`.
- Detected declarations: `function Copyright`, `function sh7705_flush_icache_range`, `function __flush_dcache_page`, `function sh7705_flush_dcache_folio`, `function sh7705_flush_cache_all`, `function sh7705_flush_cache_page`, `function sh7705_flush_icache_folio`, `function sh7705_cache_init`.
- Atlas domain: Architecture Layer / arch/sh.
- Implementation status: source 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.