~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/arch/frv/include/asm/cacheflush.h

Version: ~ [ linux-5.9-rc6 ] ~ [ linux-5.8.10 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.66 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.146 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.198 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.236 ] ~ [ linux-4.8.17 ] ~ [ linux-4.7.10 ] ~ [ linux-4.6.7 ] ~ [ linux-4.5.7 ] ~ [ linux-4.4.236 ] ~ [ linux-4.3.6 ] ~ [ linux-4.2.8 ] ~ [ linux-4.1.52 ] ~ [ linux-4.0.9 ] ~ [ linux-3.19.8 ] ~ [ linux-3.18.140 ] ~ [ linux-3.17.8 ] ~ [ linux-3.16.85 ] ~ [ linux-3.15.10 ] ~ [ linux-3.14.79 ] ~ [ linux-3.13.11 ] ~ [ linux-3.12.74 ] ~ [ linux-3.11.10 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.5 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 /* cacheflush.h: FRV cache flushing routines
  2  *
  3  * Copyright (C) 2004 Red Hat, Inc. All Rights Reserved.
  4  * Written by David Howells (dhowells@redhat.com)
  5  *
  6  * This program is free software; you can redistribute it and/or
  7  * modify it under the terms of the GNU General Public License
  8  * as published by the Free Software Foundation; either version
  9  * 2 of the License, or (at your option) any later version.
 10  */
 11 
 12 #ifndef _ASM_CACHEFLUSH_H
 13 #define _ASM_CACHEFLUSH_H
 14 
 15 /* Keep includes the same across arches.  */
 16 #include <linux/mm.h>
 17 
 18 /*
 19  * virtually-indexed cache management (our cache is physically indexed)
 20  */
 21 #define flush_cache_all()                       do {} while(0)
 22 #define flush_cache_mm(mm)                      do {} while(0)
 23 #define flush_cache_dup_mm(mm)                  do {} while(0)
 24 #define flush_cache_range(mm, start, end)       do {} while(0)
 25 #define flush_cache_page(vma, vmaddr, pfn)      do {} while(0)
 26 #define flush_cache_vmap(start, end)            do {} while(0)
 27 #define flush_cache_vunmap(start, end)          do {} while(0)
 28 #define flush_dcache_mmap_lock(mapping)         do {} while(0)
 29 #define flush_dcache_mmap_unlock(mapping)       do {} while(0)
 30 
 31 /*
 32  * physically-indexed cache management
 33  * - see arch/frv/lib/cache.S
 34  */
 35 extern void frv_dcache_writeback(unsigned long start, unsigned long size);
 36 extern void frv_cache_invalidate(unsigned long start, unsigned long size);
 37 extern void frv_icache_invalidate(unsigned long start, unsigned long size);
 38 extern void frv_cache_wback_inv(unsigned long start, unsigned long size);
 39 
 40 static inline void __flush_cache_all(void)
 41 {
 42         asm volatile("  dcef    @(gr0,gr0),#1   \n"
 43                      "  icei    @(gr0,gr0),#1   \n"
 44                      "  membar                  \n"
 45                      : : : "memory"
 46                      );
 47 }
 48 
 49 /* dcache/icache coherency... */
 50 #define ARCH_IMPLEMENTS_FLUSH_DCACHE_PAGE 1
 51 #ifdef CONFIG_MMU
 52 extern void flush_dcache_page(struct page *page);
 53 #else
 54 static inline void flush_dcache_page(struct page *page)
 55 {
 56         unsigned long addr = page_to_phys(page);
 57         frv_dcache_writeback(addr, addr + PAGE_SIZE);
 58 }
 59 #endif
 60 
 61 static inline void flush_page_to_ram(struct page *page)
 62 {
 63         flush_dcache_page(page);
 64 }
 65 
 66 static inline void flush_icache(void)
 67 {
 68         __flush_cache_all();
 69 }
 70 
 71 static inline void flush_icache_range(unsigned long start, unsigned long end)
 72 {
 73         frv_cache_wback_inv(start, end);
 74 }
 75 
 76 #ifdef CONFIG_MMU
 77 extern void flush_icache_user_range(struct vm_area_struct *vma, struct page *page,
 78                                     unsigned long start, unsigned long len);
 79 #else
 80 static inline void flush_icache_user_range(struct vm_area_struct *vma, struct page *page,
 81                                            unsigned long start, unsigned long len)
 82 {
 83         frv_cache_wback_inv(start, start + len);
 84 }
 85 #endif
 86 
 87 static inline void flush_icache_page(struct vm_area_struct *vma, struct page *page)
 88 {
 89         flush_icache_user_range(vma, page, page_to_phys(page), PAGE_SIZE);
 90 }
 91 
 92 /*
 93  * permit ptrace to access another process's address space through the icache
 94  * and the dcache
 95  */
 96 #define copy_to_user_page(vma, page, vaddr, dst, src, len)      \
 97 do {                                                            \
 98         memcpy((dst), (src), (len));                            \
 99         flush_icache_user_range((vma), (page), (vaddr), (len)); \
100 } while(0)
101 
102 #define copy_from_user_page(vma, page, vaddr, dst, src, len)    \
103         memcpy((dst), (src), (len))
104 
105 #endif /* _ASM_CACHEFLUSH_H */
106 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | Wiki (Japanese) | Wiki (English) | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

osdn.jp