arch/openrisc/mm/cache.c

Source file repositories/reference/linux-study-clean/arch/openrisc/mm/cache.c

File Facts

System
Linux kernel
Corpus path
arch/openrisc/mm/cache.c
Extension
.c
Size
2972 bytes
Lines
116
Domain
Architecture Layer
Bucket
arch/openrisc
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.

Dependency Surface

Detected Declarations

Annotated Snippet

while (paddr < end) {
			mtspr(SPR_ICBIR, paddr);
			paddr += block_size;
		}
	}
}

void local_dcache_range_flush(unsigned long start, unsigned long end)
{
	cache_loop(start, end, SPR_DCBFR, SPR_UPR_DCP);
}

void local_dcache_range_inv(unsigned long start, unsigned long end)
{
	cache_loop(start, end, SPR_DCBIR, SPR_UPR_DCP);
}

void local_icache_range_inv(unsigned long start, unsigned long end)
{
	cache_loop(start, end, SPR_ICBIR, SPR_UPR_ICP);
}

void update_cache(struct vm_area_struct *vma, unsigned long address,
	pte_t *pte)
{
	unsigned long pfn = pte_val(*pte) >> PAGE_SHIFT;
	struct folio *folio = page_folio(pfn_to_page(pfn));
	int dirty = !test_and_set_bit(PG_dc_clean, &folio->flags.f);

	/*
	 * Since icaches do not snoop for updated data on OpenRISC, we
	 * must write back and invalidate any dirty pages manually. We
	 * can skip data pages, since they will not end up in icaches.
	 */
	if ((vma->vm_flags & VM_EXEC) && dirty) {
		unsigned int nr = folio_nr_pages(folio);

		while (nr--)
			sync_icache_dcache(folio_page(folio, nr));
	}
}

Annotation

Implementation Notes