cache-sh5.c 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622
  1. /*
  2. * arch/sh/mm/cache-sh5.c
  3. *
  4. * Copyright (C) 2000, 2001 Paolo Alberelli
  5. * Copyright (C) 2002 Benedict Gaster
  6. * Copyright (C) 2003 Richard Curnow
  7. * Copyright (C) 2003 - 2008 Paul Mundt
  8. *
  9. * This file is subject to the terms and conditions of the GNU General Public
  10. * License. See the file "COPYING" in the main directory of this archive
  11. * for more details.
  12. */
  13. #include <linux/init.h>
  14. #include <linux/mman.h>
  15. #include <linux/mm.h>
  16. #include <asm/tlb.h>
  17. #include <asm/processor.h>
  18. #include <asm/cache.h>
  19. #include <asm/pgalloc.h>
  20. #include <asm/uaccess.h>
  21. #include <asm/mmu_context.h>
  22. extern void __weak sh4__flush_region_init(void);
  23. /* Wired TLB entry for the D-cache */
  24. static unsigned long long dtlb_cache_slot;
  25. /*
  26. * The following group of functions deal with mapping and unmapping a
  27. * temporary page into a DTLB slot that has been set aside for exclusive
  28. * use.
  29. */
  30. static inline void
  31. sh64_setup_dtlb_cache_slot(unsigned long eaddr, unsigned long asid,
  32. unsigned long paddr)
  33. {
  34. local_irq_disable();
  35. sh64_setup_tlb_slot(dtlb_cache_slot, eaddr, asid, paddr);
  36. }
  37. static inline void sh64_teardown_dtlb_cache_slot(void)
  38. {
  39. sh64_teardown_tlb_slot(dtlb_cache_slot);
  40. local_irq_enable();
  41. }
  42. static inline void sh64_icache_inv_all(void)
  43. {
  44. unsigned long long addr, flag, data;
  45. unsigned long flags;
  46. addr = ICCR0;
  47. flag = ICCR0_ICI;
  48. data = 0;
  49. /* Make this a critical section for safety (probably not strictly necessary.) */
  50. local_irq_save(flags);
  51. /* Without %1 it gets unexplicably wrong */
  52. __asm__ __volatile__ (
  53. "getcfg %3, 0, %0\n\t"
  54. "or %0, %2, %0\n\t"
  55. "putcfg %3, 0, %0\n\t"
  56. "synci"
  57. : "=&r" (data)
  58. : "0" (data), "r" (flag), "r" (addr));
  59. local_irq_restore(flags);
  60. }
  61. static void sh64_icache_inv_kernel_range(unsigned long start, unsigned long end)
  62. {
  63. /* Invalidate range of addresses [start,end] from the I-cache, where
  64. * the addresses lie in the kernel superpage. */
  65. unsigned long long ullend, addr, aligned_start;
  66. aligned_start = (unsigned long long)(signed long long)(signed long) start;
  67. addr = L1_CACHE_ALIGN(aligned_start);
  68. ullend = (unsigned long long) (signed long long) (signed long) end;
  69. while (addr <= ullend) {
  70. __asm__ __volatile__ ("icbi %0, 0" : : "r" (addr));
  71. addr += L1_CACHE_BYTES;
  72. }
  73. }
  74. static void sh64_icache_inv_user_page(struct vm_area_struct *vma, unsigned long eaddr)
  75. {
  76. /* If we get called, we know that vma->vm_flags contains VM_EXEC.
  77. Also, eaddr is page-aligned. */
  78. unsigned int cpu = smp_processor_id();
  79. unsigned long long addr, end_addr;
  80. unsigned long flags = 0;
  81. unsigned long running_asid, vma_asid;
  82. addr = eaddr;
  83. end_addr = addr + PAGE_SIZE;
  84. /* Check whether we can use the current ASID for the I-cache
  85. invalidation. For example, if we're called via
  86. access_process_vm->flush_cache_page->here, (e.g. when reading from
  87. /proc), 'running_asid' will be that of the reader, not of the
  88. victim.
  89. Also, note the risk that we might get pre-empted between the ASID
  90. compare and blocking IRQs, and before we regain control, the
  91. pid->ASID mapping changes. However, the whole cache will get
  92. invalidated when the mapping is renewed, so the worst that can
  93. happen is that the loop below ends up invalidating somebody else's
  94. cache entries.
  95. */
  96. running_asid = get_asid();
  97. vma_asid = cpu_asid(cpu, vma->vm_mm);
  98. if (running_asid != vma_asid) {
  99. local_irq_save(flags);
  100. switch_and_save_asid(vma_asid);
  101. }
  102. while (addr < end_addr) {
  103. /* Worth unrolling a little */
  104. __asm__ __volatile__("icbi %0, 0" : : "r" (addr));
  105. __asm__ __volatile__("icbi %0, 32" : : "r" (addr));
  106. __asm__ __volatile__("icbi %0, 64" : : "r" (addr));
  107. __asm__ __volatile__("icbi %0, 96" : : "r" (addr));
  108. addr += 128;
  109. }
  110. if (running_asid != vma_asid) {
  111. switch_and_save_asid(running_asid);
  112. local_irq_restore(flags);
  113. }
  114. }
  115. static void sh64_icache_inv_user_page_range(struct mm_struct *mm,
  116. unsigned long start, unsigned long end)
  117. {
  118. /* Used for invalidating big chunks of I-cache, i.e. assume the range
  119. is whole pages. If 'start' or 'end' is not page aligned, the code
  120. is conservative and invalidates to the ends of the enclosing pages.
  121. This is functionally OK, just a performance loss. */
  122. /* See the comments below in sh64_dcache_purge_user_range() regarding
  123. the choice of algorithm. However, for the I-cache option (2) isn't
  124. available because there are no physical tags so aliases can't be
  125. resolved. The icbi instruction has to be used through the user
  126. mapping. Because icbi is cheaper than ocbp on a cache hit, it
  127. would be cheaper to use the selective code for a large range than is
  128. possible with the D-cache. Just assume 64 for now as a working
  129. figure.
  130. */
  131. int n_pages;
  132. if (!mm)
  133. return;
  134. n_pages = ((end - start) >> PAGE_SHIFT);
  135. if (n_pages >= 64) {
  136. sh64_icache_inv_all();
  137. } else {
  138. unsigned long aligned_start;
  139. unsigned long eaddr;
  140. unsigned long after_last_page_start;
  141. unsigned long mm_asid, current_asid;
  142. unsigned long flags = 0;
  143. mm_asid = cpu_asid(smp_processor_id(), mm);
  144. current_asid = get_asid();
  145. if (mm_asid != current_asid) {
  146. /* Switch ASID and run the invalidate loop under cli */
  147. local_irq_save(flags);
  148. switch_and_save_asid(mm_asid);
  149. }
  150. aligned_start = start & PAGE_MASK;
  151. after_last_page_start = PAGE_SIZE + ((end - 1) & PAGE_MASK);
  152. while (aligned_start < after_last_page_start) {
  153. struct vm_area_struct *vma;
  154. unsigned long vma_end;
  155. vma = find_vma(mm, aligned_start);
  156. if (!vma || (aligned_start <= vma->vm_end)) {
  157. /* Avoid getting stuck in an error condition */
  158. aligned_start += PAGE_SIZE;
  159. continue;
  160. }
  161. vma_end = vma->vm_end;
  162. if (vma->vm_flags & VM_EXEC) {
  163. /* Executable */
  164. eaddr = aligned_start;
  165. while (eaddr < vma_end) {
  166. sh64_icache_inv_user_page(vma, eaddr);
  167. eaddr += PAGE_SIZE;
  168. }
  169. }
  170. aligned_start = vma->vm_end; /* Skip to start of next region */
  171. }
  172. if (mm_asid != current_asid) {
  173. switch_and_save_asid(current_asid);
  174. local_irq_restore(flags);
  175. }
  176. }
  177. }
  178. static void sh64_icache_inv_current_user_range(unsigned long start, unsigned long end)
  179. {
  180. /* The icbi instruction never raises ITLBMISS. i.e. if there's not a
  181. cache hit on the virtual tag the instruction ends there, without a
  182. TLB lookup. */
  183. unsigned long long aligned_start;
  184. unsigned long long ull_end;
  185. unsigned long long addr;
  186. ull_end = end;
  187. /* Just invalidate over the range using the natural addresses. TLB
  188. miss handling will be OK (TBC). Since it's for the current process,
  189. either we're already in the right ASID context, or the ASIDs have
  190. been recycled since we were last active in which case we might just
  191. invalidate another processes I-cache entries : no worries, just a
  192. performance drop for him. */
  193. aligned_start = L1_CACHE_ALIGN(start);
  194. addr = aligned_start;
  195. while (addr < ull_end) {
  196. __asm__ __volatile__ ("icbi %0, 0" : : "r" (addr));
  197. __asm__ __volatile__ ("nop");
  198. __asm__ __volatile__ ("nop");
  199. addr += L1_CACHE_BYTES;
  200. }
  201. }
  202. /* Buffer used as the target of alloco instructions to purge data from cache
  203. sets by natural eviction. -- RPC */
  204. #define DUMMY_ALLOCO_AREA_SIZE ((L1_CACHE_BYTES << 10) + (1024 * 4))
  205. static unsigned char dummy_alloco_area[DUMMY_ALLOCO_AREA_SIZE] __cacheline_aligned = { 0, };
  206. static void inline sh64_dcache_purge_sets(int sets_to_purge_base, int n_sets)
  207. {
  208. /* Purge all ways in a particular block of sets, specified by the base
  209. set number and number of sets. Can handle wrap-around, if that's
  210. needed. */
  211. int dummy_buffer_base_set;
  212. unsigned long long eaddr, eaddr0, eaddr1;
  213. int j;
  214. int set_offset;
  215. dummy_buffer_base_set = ((int)&dummy_alloco_area &
  216. cpu_data->dcache.entry_mask) >>
  217. cpu_data->dcache.entry_shift;
  218. set_offset = sets_to_purge_base - dummy_buffer_base_set;
  219. for (j = 0; j < n_sets; j++, set_offset++) {
  220. set_offset &= (cpu_data->dcache.sets - 1);
  221. eaddr0 = (unsigned long long)dummy_alloco_area +
  222. (set_offset << cpu_data->dcache.entry_shift);
  223. /*
  224. * Do one alloco which hits the required set per cache
  225. * way. For write-back mode, this will purge the #ways
  226. * resident lines. There's little point unrolling this
  227. * loop because the allocos stall more if they're too
  228. * close together.
  229. */
  230. eaddr1 = eaddr0 + cpu_data->dcache.way_size *
  231. cpu_data->dcache.ways;
  232. for (eaddr = eaddr0; eaddr < eaddr1;
  233. eaddr += cpu_data->dcache.way_size) {
  234. __asm__ __volatile__ ("alloco %0, 0" : : "r" (eaddr));
  235. __asm__ __volatile__ ("synco"); /* TAKum03020 */
  236. }
  237. eaddr1 = eaddr0 + cpu_data->dcache.way_size *
  238. cpu_data->dcache.ways;
  239. for (eaddr = eaddr0; eaddr < eaddr1;
  240. eaddr += cpu_data->dcache.way_size) {
  241. /*
  242. * Load from each address. Required because
  243. * alloco is a NOP if the cache is write-through.
  244. */
  245. if (test_bit(SH_CACHE_MODE_WT, &(cpu_data->dcache.flags)))
  246. __raw_readb((unsigned long)eaddr);
  247. }
  248. }
  249. /*
  250. * Don't use OCBI to invalidate the lines. That costs cycles
  251. * directly. If the dummy block is just left resident, it will
  252. * naturally get evicted as required.
  253. */
  254. }
  255. /*
  256. * Purge the entire contents of the dcache. The most efficient way to
  257. * achieve this is to use alloco instructions on a region of unused
  258. * memory equal in size to the cache, thereby causing the current
  259. * contents to be discarded by natural eviction. The alternative, namely
  260. * reading every tag, setting up a mapping for the corresponding page and
  261. * doing an OCBP for the line, would be much more expensive.
  262. */
  263. static void sh64_dcache_purge_all(void)
  264. {
  265. sh64_dcache_purge_sets(0, cpu_data->dcache.sets);
  266. }
  267. /* Assumes this address (+ (2**n_synbits) pages up from it) aren't used for
  268. anything else in the kernel */
  269. #define MAGIC_PAGE0_START 0xffffffffec000000ULL
  270. /* Purge the physical page 'paddr' from the cache. It's known that any
  271. * cache lines requiring attention have the same page colour as the the
  272. * address 'eaddr'.
  273. *
  274. * This relies on the fact that the D-cache matches on physical tags when
  275. * no virtual tag matches. So we create an alias for the original page
  276. * and purge through that. (Alternatively, we could have done this by
  277. * switching ASID to match the original mapping and purged through that,
  278. * but that involves ASID switching cost + probably a TLBMISS + refill
  279. * anyway.)
  280. */
  281. static void sh64_dcache_purge_coloured_phy_page(unsigned long paddr,
  282. unsigned long eaddr)
  283. {
  284. unsigned long long magic_page_start;
  285. unsigned long long magic_eaddr, magic_eaddr_end;
  286. magic_page_start = MAGIC_PAGE0_START + (eaddr & CACHE_OC_SYN_MASK);
  287. /* As long as the kernel is not pre-emptible, this doesn't need to be
  288. under cli/sti. */
  289. sh64_setup_dtlb_cache_slot(magic_page_start, get_asid(), paddr);
  290. magic_eaddr = magic_page_start;
  291. magic_eaddr_end = magic_eaddr + PAGE_SIZE;
  292. while (magic_eaddr < magic_eaddr_end) {
  293. /* Little point in unrolling this loop - the OCBPs are blocking
  294. and won't go any quicker (i.e. the loop overhead is parallel
  295. to part of the OCBP execution.) */
  296. __asm__ __volatile__ ("ocbp %0, 0" : : "r" (magic_eaddr));
  297. magic_eaddr += L1_CACHE_BYTES;
  298. }
  299. sh64_teardown_dtlb_cache_slot();
  300. }
  301. /*
  302. * Purge a page given its physical start address, by creating a temporary
  303. * 1 page mapping and purging across that. Even if we know the virtual
  304. * address (& vma or mm) of the page, the method here is more elegant
  305. * because it avoids issues of coping with page faults on the purge
  306. * instructions (i.e. no special-case code required in the critical path
  307. * in the TLB miss handling).
  308. */
  309. static void sh64_dcache_purge_phy_page(unsigned long paddr)
  310. {
  311. unsigned long long eaddr_start, eaddr, eaddr_end;
  312. int i;
  313. /* As long as the kernel is not pre-emptible, this doesn't need to be
  314. under cli/sti. */
  315. eaddr_start = MAGIC_PAGE0_START;
  316. for (i = 0; i < (1 << CACHE_OC_N_SYNBITS); i++) {
  317. sh64_setup_dtlb_cache_slot(eaddr_start, get_asid(), paddr);
  318. eaddr = eaddr_start;
  319. eaddr_end = eaddr + PAGE_SIZE;
  320. while (eaddr < eaddr_end) {
  321. __asm__ __volatile__ ("ocbp %0, 0" : : "r" (eaddr));
  322. eaddr += L1_CACHE_BYTES;
  323. }
  324. sh64_teardown_dtlb_cache_slot();
  325. eaddr_start += PAGE_SIZE;
  326. }
  327. }
  328. static void sh64_dcache_purge_user_pages(struct mm_struct *mm,
  329. unsigned long addr, unsigned long end)
  330. {
  331. pgd_t *pgd;
  332. pud_t *pud;
  333. pmd_t *pmd;
  334. pte_t *pte;
  335. pte_t entry;
  336. spinlock_t *ptl;
  337. unsigned long paddr;
  338. if (!mm)
  339. return; /* No way to find physical address of page */
  340. pgd = pgd_offset(mm, addr);
  341. if (pgd_bad(*pgd))
  342. return;
  343. pud = pud_offset(pgd, addr);
  344. if (pud_none(*pud) || pud_bad(*pud))
  345. return;
  346. pmd = pmd_offset(pud, addr);
  347. if (pmd_none(*pmd) || pmd_bad(*pmd))
  348. return;
  349. pte = pte_offset_map_lock(mm, pmd, addr, &ptl);
  350. do {
  351. entry = *pte;
  352. if (pte_none(entry) || !pte_present(entry))
  353. continue;
  354. paddr = pte_val(entry) & PAGE_MASK;
  355. sh64_dcache_purge_coloured_phy_page(paddr, addr);
  356. } while (pte++, addr += PAGE_SIZE, addr != end);
  357. pte_unmap_unlock(pte - 1, ptl);
  358. }
  359. /*
  360. * There are at least 5 choices for the implementation of this, with
  361. * pros (+), cons(-), comments(*):
  362. *
  363. * 1. ocbp each line in the range through the original user's ASID
  364. * + no lines spuriously evicted
  365. * - tlbmiss handling (must either handle faults on demand => extra
  366. * special-case code in tlbmiss critical path), or map the page in
  367. * advance (=> flush_tlb_range in advance to avoid multiple hits)
  368. * - ASID switching
  369. * - expensive for large ranges
  370. *
  371. * 2. temporarily map each page in the range to a special effective
  372. * address and ocbp through the temporary mapping; relies on the
  373. * fact that SH-5 OCB* always do TLB lookup and match on ptags (they
  374. * never look at the etags)
  375. * + no spurious evictions
  376. * - expensive for large ranges
  377. * * surely cheaper than (1)
  378. *
  379. * 3. walk all the lines in the cache, check the tags, if a match
  380. * occurs create a page mapping to ocbp the line through
  381. * + no spurious evictions
  382. * - tag inspection overhead
  383. * - (especially for small ranges)
  384. * - potential cost of setting up/tearing down page mapping for
  385. * every line that matches the range
  386. * * cost partly independent of range size
  387. *
  388. * 4. walk all the lines in the cache, check the tags, if a match
  389. * occurs use 4 * alloco to purge the line (+3 other probably
  390. * innocent victims) by natural eviction
  391. * + no tlb mapping overheads
  392. * - spurious evictions
  393. * - tag inspection overhead
  394. *
  395. * 5. implement like flush_cache_all
  396. * + no tag inspection overhead
  397. * - spurious evictions
  398. * - bad for small ranges
  399. *
  400. * (1) can be ruled out as more expensive than (2). (2) appears best
  401. * for small ranges. The choice between (3), (4) and (5) for large
  402. * ranges and the range size for the large/small boundary need
  403. * benchmarking to determine.
  404. *
  405. * For now use approach (2) for small ranges and (5) for large ones.
  406. */
  407. static void sh64_dcache_purge_user_range(struct mm_struct *mm,
  408. unsigned long start, unsigned long end)
  409. {
  410. int n_pages = ((end - start) >> PAGE_SHIFT);
  411. if (n_pages >= 64 || ((start ^ (end - 1)) & PMD_MASK)) {
  412. sh64_dcache_purge_all();
  413. } else {
  414. /* Small range, covered by a single page table page */
  415. start &= PAGE_MASK; /* should already be so */
  416. end = PAGE_ALIGN(end); /* should already be so */
  417. sh64_dcache_purge_user_pages(mm, start, end);
  418. }
  419. }
  420. /*
  421. * Invalidate the entire contents of both caches, after writing back to
  422. * memory any dirty data from the D-cache.
  423. */
  424. static void sh5_flush_cache_all(void *unused)
  425. {
  426. sh64_dcache_purge_all();
  427. sh64_icache_inv_all();
  428. }
  429. /*
  430. * Invalidate an entire user-address space from both caches, after
  431. * writing back dirty data (e.g. for shared mmap etc).
  432. *
  433. * This could be coded selectively by inspecting all the tags then
  434. * doing 4*alloco on any set containing a match (as for
  435. * flush_cache_range), but fork/exit/execve (where this is called from)
  436. * are expensive anyway.
  437. *
  438. * Have to do a purge here, despite the comments re I-cache below.
  439. * There could be odd-coloured dirty data associated with the mm still
  440. * in the cache - if this gets written out through natural eviction
  441. * after the kernel has reused the page there will be chaos.
  442. *
  443. * The mm being torn down won't ever be active again, so any Icache
  444. * lines tagged with its ASID won't be visible for the rest of the
  445. * lifetime of this ASID cycle. Before the ASID gets reused, there
  446. * will be a flush_cache_all. Hence we don't need to touch the
  447. * I-cache. This is similar to the lack of action needed in
  448. * flush_tlb_mm - see fault.c.
  449. */
  450. static void sh5_flush_cache_mm(void *unused)
  451. {
  452. sh64_dcache_purge_all();
  453. }
  454. /*
  455. * Invalidate (from both caches) the range [start,end) of virtual
  456. * addresses from the user address space specified by mm, after writing
  457. * back any dirty data.
  458. *
  459. * Note, 'end' is 1 byte beyond the end of the range to flush.
  460. */
  461. static void sh5_flush_cache_range(void *args)
  462. {
  463. struct flusher_data *data = args;
  464. struct vm_area_struct *vma;
  465. unsigned long start, end;
  466. vma = data->vma;
  467. start = data->addr1;
  468. end = data->addr2;
  469. sh64_dcache_purge_user_range(vma->vm_mm, start, end);
  470. sh64_icache_inv_user_page_range(vma->vm_mm, start, end);
  471. }
  472. /*
  473. * Invalidate any entries in either cache for the vma within the user
  474. * address space vma->vm_mm for the page starting at virtual address
  475. * 'eaddr'. This seems to be used primarily in breaking COW. Note,
  476. * the I-cache must be searched too in case the page in question is
  477. * both writable and being executed from (e.g. stack trampolines.)
  478. *
  479. * Note, this is called with pte lock held.
  480. */
  481. static void sh5_flush_cache_page(void *args)
  482. {
  483. struct flusher_data *data = args;
  484. struct vm_area_struct *vma;
  485. unsigned long eaddr, pfn;
  486. vma = data->vma;
  487. eaddr = data->addr1;
  488. pfn = data->addr2;
  489. sh64_dcache_purge_phy_page(pfn << PAGE_SHIFT);
  490. if (vma->vm_flags & VM_EXEC)
  491. sh64_icache_inv_user_page(vma, eaddr);
  492. }
  493. static void sh5_flush_dcache_page(void *page)
  494. {
  495. sh64_dcache_purge_phy_page(page_to_phys((struct page *)page));
  496. wmb();
  497. }
  498. /*
  499. * Flush the range [start,end] of kernel virtual address space from
  500. * the I-cache. The corresponding range must be purged from the
  501. * D-cache also because the SH-5 doesn't have cache snooping between
  502. * the caches. The addresses will be visible through the superpage
  503. * mapping, therefore it's guaranteed that there no cache entries for
  504. * the range in cache sets of the wrong colour.
  505. */
  506. static void sh5_flush_icache_range(void *args)
  507. {
  508. struct flusher_data *data = args;
  509. unsigned long start, end;
  510. start = data->addr1;
  511. end = data->addr2;
  512. __flush_purge_region((void *)start, end);
  513. wmb();
  514. sh64_icache_inv_kernel_range(start, end);
  515. }
  516. /*
  517. * For the address range [start,end), write back the data from the
  518. * D-cache and invalidate the corresponding region of the I-cache for the
  519. * current process. Used to flush signal trampolines on the stack to
  520. * make them executable.
  521. */
  522. static void sh5_flush_cache_sigtramp(void *vaddr)
  523. {
  524. unsigned long end = (unsigned long)vaddr + L1_CACHE_BYTES;
  525. __flush_wback_region(vaddr, L1_CACHE_BYTES);
  526. wmb();
  527. sh64_icache_inv_current_user_range((unsigned long)vaddr, end);
  528. }
  529. void __init sh5_cache_init(void)
  530. {
  531. local_flush_cache_all = sh5_flush_cache_all;
  532. local_flush_cache_mm = sh5_flush_cache_mm;
  533. local_flush_cache_dup_mm = sh5_flush_cache_mm;
  534. local_flush_cache_page = sh5_flush_cache_page;
  535. local_flush_cache_range = sh5_flush_cache_range;
  536. local_flush_dcache_page = sh5_flush_dcache_page;
  537. local_flush_icache_range = sh5_flush_icache_range;
  538. local_flush_cache_sigtramp = sh5_flush_cache_sigtramp;
  539. /* Reserve a slot for dcache colouring in the DTLB */
  540. dtlb_cache_slot = sh64_get_wired_dtlb_entry();
  541. sh4__flush_region_init();
  542. }