/* * arch/xtensa/mm/cache.c * * This file is subject to the terms and conditions of the GNU General Public * License. See the file "COPYING" in the main directory of this archive * for more details. * * Copyright (C) 2001-2006 Tensilica Inc. * * Chris Zankel <chris@zankel.net> * Joe Taylor * Marc Gauthier *
*/
/* * Note: * The kernel provides one architecture bit PG_arch_1 in the page flags that * can be used for cache coherency. * * I$-D$ coherency. * * The Xtensa architecture doesn't keep the instruction cache coherent with * the data cache. We use the architecture bit to indicate if the caches * are coherent. The kernel clears this bit whenever a page is added to the * page cache. At that time, the caches might not be in sync. We, therefore, * define this flag as 'clean' if set. * * D-cache aliasing. * * With cache aliasing, we have to always flush the cache when pages are * unmapped (see tlb_start_vma(). So, we use this flag to indicate a dirty * page. * * *
*/
/* * If we have a mapping but the page is not mapped to user-space * yet, we simply mark this page dirty and defer flushing the * caches until update_mmu().
*/
if (mapping && !mapping_mapped(mapping)) { if (!test_bit(PG_arch_1, &folio->flags))
set_bit(PG_arch_1, &folio->flags); return;
} else { unsignedlong phys = folio_pfn(folio) * PAGE_SIZE; unsignedlong temp = folio_pos(folio); unsignedint i, nr = folio_nr_pages(folio); unsignedlong alias = !(DCACHE_ALIAS_EQ(temp, phys)); unsignedlong virt;
/* * Flush the page in kernel space and user space. * Note that we can omit that step if aliasing is not * an issue, but we do have to synchronize I$ and D$ * if we have a mapping.
*/
if (!alias && !mapping) return;
preempt_disable(); for (i = 0; i < nr; i++) {
virt = TLBTEMP_BASE_1 + (phys & DCACHE_ALIAS_MASK);
__flush_invalidate_dcache_page_alias(virt, phys);
/* * Remove any entry in the cache for this page. * * Note that this function is only called for user pages, so use the * alias versions of the cache flush functions.
*/
void local_flush_cache_page(struct vm_area_struct *vma, unsignedlong address, unsignedlong pfn)
{ /* Note that we have to use the 'alias' address to avoid multi-hit */
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.