Path: blob/master/arch/mips/include/asm/cacheflush.h
17281 views
/*1* This file is subject to the terms and conditions of the GNU General Public2* License. See the file "COPYING" in the main directory of this archive3* for more details.4*5* Copyright (C) 1994, 95, 96, 97, 98, 99, 2000, 01, 02, 03 by Ralf Baechle6* Copyright (C) 1999, 2000, 2001 Silicon Graphics, Inc.7*/8#ifndef _ASM_CACHEFLUSH_H9#define _ASM_CACHEFLUSH_H1011/* Keep includes the same across arches. */12#include <linux/mm.h>13#include <asm/cpu-features.h>1415/* Cache flushing:16*17* - flush_cache_all() flushes entire cache18* - flush_cache_mm(mm) flushes the specified mm context's cache lines19* - flush_cache_dup mm(mm) handles cache flushing when forking20* - flush_cache_page(mm, vmaddr, pfn) flushes a single page21* - flush_cache_range(vma, start, end) flushes a range of pages22* - flush_icache_range(start, end) flush a range of instructions23* - flush_dcache_page(pg) flushes(wback&invalidates) a page for dcache24*25* MIPS specific flush operations:26*27* - flush_cache_sigtramp() flush signal trampoline28* - flush_icache_all() flush the entire instruction cache29* - flush_data_cache_page() flushes a page from the data cache30*/31extern void (*flush_cache_all)(void);32extern void (*__flush_cache_all)(void);33extern void (*flush_cache_mm)(struct mm_struct *mm);34#define flush_cache_dup_mm(mm) do { (void) (mm); } while (0)35extern void (*flush_cache_range)(struct vm_area_struct *vma,36unsigned long start, unsigned long end);37extern void (*flush_cache_page)(struct vm_area_struct *vma, unsigned long page, unsigned long pfn);38extern void __flush_dcache_page(struct page *page);3940#define ARCH_IMPLEMENTS_FLUSH_DCACHE_PAGE 141static inline void flush_dcache_page(struct page *page)42{43if (cpu_has_dc_aliases || !cpu_has_ic_fills_f_dc)44__flush_dcache_page(page);4546}4748#define flush_dcache_mmap_lock(mapping) do { } while (0)49#define flush_dcache_mmap_unlock(mapping) do { } while (0)5051#define ARCH_HAS_FLUSH_ANON_PAGE52extern void __flush_anon_page(struct page *, unsigned long);53static inline void flush_anon_page(struct vm_area_struct *vma,54struct page *page, unsigned long vmaddr)55{56if (cpu_has_dc_aliases && PageAnon(page))57__flush_anon_page(page, vmaddr);58}5960static inline void flush_icache_page(struct vm_area_struct *vma,61struct page *page)62{63}6465extern void (*flush_icache_range)(unsigned long start, unsigned long end);66extern void (*local_flush_icache_range)(unsigned long start, unsigned long end);6768extern void (*__flush_cache_vmap)(void);6970static inline void flush_cache_vmap(unsigned long start, unsigned long end)71{72if (cpu_has_dc_aliases)73__flush_cache_vmap();74}7576extern void (*__flush_cache_vunmap)(void);7778static inline void flush_cache_vunmap(unsigned long start, unsigned long end)79{80if (cpu_has_dc_aliases)81__flush_cache_vunmap();82}8384extern void copy_to_user_page(struct vm_area_struct *vma,85struct page *page, unsigned long vaddr, void *dst, const void *src,86unsigned long len);8788extern void copy_from_user_page(struct vm_area_struct *vma,89struct page *page, unsigned long vaddr, void *dst, const void *src,90unsigned long len);9192extern void (*flush_cache_sigtramp)(unsigned long addr);93extern void (*flush_icache_all)(void);94extern void (*local_flush_data_cache_page)(void * addr);95extern void (*flush_data_cache_page)(unsigned long addr);9697/*98* This flag is used to indicate that the page pointed to by a pte99* is dirty and requires cleaning before returning it to the user.100*/101#define PG_dcache_dirty PG_arch_1102103#define Page_dcache_dirty(page) \104test_bit(PG_dcache_dirty, &(page)->flags)105#define SetPageDcacheDirty(page) \106set_bit(PG_dcache_dirty, &(page)->flags)107#define ClearPageDcacheDirty(page) \108clear_bit(PG_dcache_dirty, &(page)->flags)109110/* Run kernel code uncached, useful for cache probing functions. */111unsigned long run_uncached(void *func);112113extern void *kmap_coherent(struct page *page, unsigned long addr);114extern void kunmap_coherent(void);115116#endif /* _ASM_CACHEFLUSH_H */117118119