cacheflush_32.h 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. #ifndef _SPARC_CACHEFLUSH_H
  2. #define _SPARC_CACHEFLUSH_H
  3. #include <linux/mm.h> /* Common for other includes */
  4. // #include <linux/kernel.h> from pgalloc.h
  5. // #include <linux/sched.h> from pgalloc.h
  6. // #include <asm/page.h>
  7. #include <asm/btfixup.h>
  8. /*
  9. * Fine grained cache flushing.
  10. */
  11. #ifdef CONFIG_SMP
  12. BTFIXUPDEF_CALL(void, local_flush_cache_all, void)
  13. BTFIXUPDEF_CALL(void, local_flush_cache_mm, struct mm_struct *)
  14. BTFIXUPDEF_CALL(void, local_flush_cache_range, struct vm_area_struct *, unsigned long, unsigned long)
  15. BTFIXUPDEF_CALL(void, local_flush_cache_page, struct vm_area_struct *, unsigned long)
  16. #define local_flush_cache_all() BTFIXUP_CALL(local_flush_cache_all)()
  17. #define local_flush_cache_mm(mm) BTFIXUP_CALL(local_flush_cache_mm)(mm)
  18. #define local_flush_cache_range(vma,start,end) BTFIXUP_CALL(local_flush_cache_range)(vma,start,end)
  19. #define local_flush_cache_page(vma,addr) BTFIXUP_CALL(local_flush_cache_page)(vma,addr)
  20. BTFIXUPDEF_CALL(void, local_flush_page_to_ram, unsigned long)
  21. BTFIXUPDEF_CALL(void, local_flush_sig_insns, struct mm_struct *, unsigned long)
  22. #define local_flush_page_to_ram(addr) BTFIXUP_CALL(local_flush_page_to_ram)(addr)
  23. #define local_flush_sig_insns(mm,insn_addr) BTFIXUP_CALL(local_flush_sig_insns)(mm,insn_addr)
  24. extern void smp_flush_cache_all(void);
  25. extern void smp_flush_cache_mm(struct mm_struct *mm);
  26. extern void smp_flush_cache_range(struct vm_area_struct *vma,
  27. unsigned long start,
  28. unsigned long end);
  29. extern void smp_flush_cache_page(struct vm_area_struct *vma, unsigned long page);
  30. extern void smp_flush_page_to_ram(unsigned long page);
  31. extern void smp_flush_sig_insns(struct mm_struct *mm, unsigned long insn_addr);
  32. #endif /* CONFIG_SMP */
  33. BTFIXUPDEF_CALL(void, flush_cache_all, void)
  34. BTFIXUPDEF_CALL(void, flush_cache_mm, struct mm_struct *)
  35. BTFIXUPDEF_CALL(void, flush_cache_range, struct vm_area_struct *, unsigned long, unsigned long)
  36. BTFIXUPDEF_CALL(void, flush_cache_page, struct vm_area_struct *, unsigned long)
  37. #define flush_cache_all() BTFIXUP_CALL(flush_cache_all)()
  38. #define flush_cache_mm(mm) BTFIXUP_CALL(flush_cache_mm)(mm)
  39. #define flush_cache_dup_mm(mm) BTFIXUP_CALL(flush_cache_mm)(mm)
  40. #define flush_cache_range(vma,start,end) BTFIXUP_CALL(flush_cache_range)(vma,start,end)
  41. #define flush_cache_page(vma,addr,pfn) BTFIXUP_CALL(flush_cache_page)(vma,addr)
  42. #define flush_icache_range(start, end) do { } while (0)
  43. #define flush_icache_page(vma, pg) do { } while (0)
  44. #define flush_icache_user_range(vma,pg,adr,len) do { } while (0)
  45. #define copy_to_user_page(vma, page, vaddr, dst, src, len) \
  46. do { \
  47. flush_cache_page(vma, vaddr, page_to_pfn(page));\
  48. memcpy(dst, src, len); \
  49. } while (0)
  50. #define copy_from_user_page(vma, page, vaddr, dst, src, len) \
  51. do { \
  52. flush_cache_page(vma, vaddr, page_to_pfn(page));\
  53. memcpy(dst, src, len); \
  54. } while (0)
  55. BTFIXUPDEF_CALL(void, __flush_page_to_ram, unsigned long)
  56. BTFIXUPDEF_CALL(void, flush_sig_insns, struct mm_struct *, unsigned long)
  57. #define __flush_page_to_ram(addr) BTFIXUP_CALL(__flush_page_to_ram)(addr)
  58. #define flush_sig_insns(mm,insn_addr) BTFIXUP_CALL(flush_sig_insns)(mm,insn_addr)
  59. extern void sparc_flush_page_to_ram(struct page *page);
  60. #define ARCH_IMPLEMENTS_FLUSH_DCACHE_PAGE 1
  61. #define flush_dcache_page(page) sparc_flush_page_to_ram(page)
  62. #define flush_dcache_mmap_lock(mapping) do { } while (0)
  63. #define flush_dcache_mmap_unlock(mapping) do { } while (0)
  64. #define flush_cache_vmap(start, end) flush_cache_all()
  65. #define flush_cache_vunmap(start, end) flush_cache_all()
  66. /* When a context switch happens we must flush all user windows so that
  67. * the windows of the current process are flushed onto its stack. This
  68. * way the windows are all clean for the next process and the stack
  69. * frames are up to date.
  70. */
  71. extern void flush_user_windows(void);
  72. extern void kill_user_windows(void);
  73. extern void flushw_all(void);
  74. #endif /* _SPARC_CACHEFLUSH_H */