2 * PARISC TLB and cache flushing support
3 * Copyright (C) 2000-2001 Hewlett-Packard (John Marvin)
4 * Copyright (C) 2001 Matthew Wilcox (willy at parisc-linux.org)
5 * Copyright (C) 2002 Richard Hirst (rhirst with parisc-linux.org)
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2, or (at your option)
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
23 * NOTE: fdc,fic, and pdc instructions that use base register modification
24 * should only use index and base registers that are not shadowed,
25 * so that the fast path emulation in the non access miss handler
36 #include <asm/assembly.h>
37 #include <asm/pgtable.h>
38 #include <asm/cache.h>
39 #include <linux/linkage.h>
44 ENTRY_CFI(flush_tlb_all_local)
50 * The pitlbe and pdtlbe instructions should only be used to
51 * flush the entire tlb. Also, there needs to be no intervening
52 * tlb operations, e.g. tlb misses, so the operation needs
53 * to happen in real mode with all interruptions disabled.
56 /* pcxt_ssm_bug - relied upon translation! PA 2.0 Arch. F-4 and F-5 */
57 rsm PSW_SM_I, %r19 /* save I-bit state */
65 rsm PSW_SM_Q, %r0 /* prep to load iia queue */
66 mtctl %r0, %cr17 /* Clear IIASQ tail */
67 mtctl %r0, %cr17 /* Clear IIASQ head */
68 mtctl %r1, %cr18 /* IIAOQ head */
70 mtctl %r1, %cr18 /* IIAOQ tail */
71 load32 REAL_MODE_PSW, %r1
76 1: load32 PA(cache_info), %r1
78 /* Flush Instruction Tlb */
80 LDREG ITLB_SID_BASE(%r1), %r20
81 LDREG ITLB_SID_STRIDE(%r1), %r21
82 LDREG ITLB_SID_COUNT(%r1), %r22
83 LDREG ITLB_OFF_BASE(%r1), %arg0
84 LDREG ITLB_OFF_STRIDE(%r1), %arg1
85 LDREG ITLB_OFF_COUNT(%r1), %arg2
86 LDREG ITLB_LOOP(%r1), %arg3
88 addib,COND(=) -1, %arg3, fitoneloop /* Preadjust and test */
89 movb,<,n %arg3, %r31, fitdone /* If loop < 0, skip */
90 copy %arg0, %r28 /* Init base addr */
92 fitmanyloop: /* Loop if LOOP >= 2 */
94 add %r21, %r20, %r20 /* increment space */
95 copy %arg2, %r29 /* Init middle loop count */
97 fitmanymiddle: /* Loop if LOOP >= 2 */
98 addib,COND(>) -1, %r31, fitmanymiddle /* Adjusted inner loop decr */
99 pitlbe %r0(%sr1, %r28)
100 pitlbe,m %arg1(%sr1, %r28) /* Last pitlbe and addr adjust */
101 addib,COND(>) -1, %r29, fitmanymiddle /* Middle loop decr */
102 copy %arg3, %r31 /* Re-init inner loop count */
104 movb,tr %arg0, %r28, fitmanyloop /* Re-init base addr */
105 addib,COND(<=),n -1, %r22, fitdone /* Outer loop count decr */
107 fitoneloop: /* Loop if LOOP = 1 */
109 copy %arg0, %r28 /* init base addr */
110 copy %arg2, %r29 /* init middle loop count */
112 fitonemiddle: /* Loop if LOOP = 1 */
113 addib,COND(>) -1, %r29, fitonemiddle /* Middle loop count decr */
114 pitlbe,m %arg1(%sr1, %r28) /* pitlbe for one loop */
116 addib,COND(>) -1, %r22, fitoneloop /* Outer loop count decr */
117 add %r21, %r20, %r20 /* increment space */
123 LDREG DTLB_SID_BASE(%r1), %r20
124 LDREG DTLB_SID_STRIDE(%r1), %r21
125 LDREG DTLB_SID_COUNT(%r1), %r22
126 LDREG DTLB_OFF_BASE(%r1), %arg0
127 LDREG DTLB_OFF_STRIDE(%r1), %arg1
128 LDREG DTLB_OFF_COUNT(%r1), %arg2
129 LDREG DTLB_LOOP(%r1), %arg3
131 addib,COND(=) -1, %arg3, fdtoneloop /* Preadjust and test */
132 movb,<,n %arg3, %r31, fdtdone /* If loop < 0, skip */
133 copy %arg0, %r28 /* Init base addr */
135 fdtmanyloop: /* Loop if LOOP >= 2 */
137 add %r21, %r20, %r20 /* increment space */
138 copy %arg2, %r29 /* Init middle loop count */
140 fdtmanymiddle: /* Loop if LOOP >= 2 */
141 addib,COND(>) -1, %r31, fdtmanymiddle /* Adjusted inner loop decr */
142 pdtlbe %r0(%sr1, %r28)
143 pdtlbe,m %arg1(%sr1, %r28) /* Last pdtlbe and addr adjust */
144 addib,COND(>) -1, %r29, fdtmanymiddle /* Middle loop decr */
145 copy %arg3, %r31 /* Re-init inner loop count */
147 movb,tr %arg0, %r28, fdtmanyloop /* Re-init base addr */
148 addib,COND(<=),n -1, %r22,fdtdone /* Outer loop count decr */
150 fdtoneloop: /* Loop if LOOP = 1 */
152 copy %arg0, %r28 /* init base addr */
153 copy %arg2, %r29 /* init middle loop count */
155 fdtonemiddle: /* Loop if LOOP = 1 */
156 addib,COND(>) -1, %r29, fdtonemiddle /* Middle loop count decr */
157 pdtlbe,m %arg1(%sr1, %r28) /* pdtlbe for one loop */
159 addib,COND(>) -1, %r22, fdtoneloop /* Outer loop count decr */
160 add %r21, %r20, %r20 /* increment space */
165 * Switch back to virtual mode
176 rsm PSW_SM_Q, %r0 /* prep to load iia queue */
177 mtctl %r0, %cr17 /* Clear IIASQ tail */
178 mtctl %r0, %cr17 /* Clear IIASQ head */
179 mtctl %r1, %cr18 /* IIAOQ head */
181 mtctl %r1, %cr18 /* IIAOQ tail */
182 load32 KERNEL_PSW, %r1
183 or %r1, %r19, %r1 /* I-bit to state on entry */
184 mtctl %r1, %ipsw /* restore I-bit (entire PSW) */
193 ENDPROC_CFI(flush_tlb_all_local)
195 .import cache_info,data
197 ENTRY_CFI(flush_instruction_cache_local)
202 load32 cache_info, %r1
204 /* Flush Instruction Cache */
206 LDREG ICACHE_BASE(%r1), %arg0
207 LDREG ICACHE_STRIDE(%r1), %arg1
208 LDREG ICACHE_COUNT(%r1), %arg2
209 LDREG ICACHE_LOOP(%r1), %arg3
210 rsm PSW_SM_I, %r22 /* No mmgt ops during loop*/
212 addib,COND(=) -1, %arg3, fioneloop /* Preadjust and test */
213 movb,<,n %arg3, %r31, fisync /* If loop < 0, do sync */
215 fimanyloop: /* Loop if LOOP >= 2 */
216 addib,COND(>) -1, %r31, fimanyloop /* Adjusted inner loop decr */
217 fice %r0(%sr1, %arg0)
218 fice,m %arg1(%sr1, %arg0) /* Last fice and addr adjust */
219 movb,tr %arg3, %r31, fimanyloop /* Re-init inner loop count */
220 addib,COND(<=),n -1, %arg2, fisync /* Outer loop decr */
222 fioneloop: /* Loop if LOOP = 1 */
223 /* Some implementations may flush with a single fice instruction */
224 cmpib,COND(>>=),n 15, %arg2, fioneloop2
227 fice,m %arg1(%sr1, %arg0)
228 fice,m %arg1(%sr1, %arg0)
229 fice,m %arg1(%sr1, %arg0)
230 fice,m %arg1(%sr1, %arg0)
231 fice,m %arg1(%sr1, %arg0)
232 fice,m %arg1(%sr1, %arg0)
233 fice,m %arg1(%sr1, %arg0)
234 fice,m %arg1(%sr1, %arg0)
235 fice,m %arg1(%sr1, %arg0)
236 fice,m %arg1(%sr1, %arg0)
237 fice,m %arg1(%sr1, %arg0)
238 fice,m %arg1(%sr1, %arg0)
239 fice,m %arg1(%sr1, %arg0)
240 fice,m %arg1(%sr1, %arg0)
241 fice,m %arg1(%sr1, %arg0)
242 addib,COND(>) -16, %arg2, fioneloop1
243 fice,m %arg1(%sr1, %arg0)
246 cmpb,COND(=),n %arg2, %r0, fisync /* Predict branch taken */
249 addib,COND(>) -1, %arg2, fioneloop2 /* Outer loop count decr */
250 fice,m %arg1(%sr1, %arg0) /* Fice for one loop */
254 mtsm %r22 /* restore I-bit */
260 ENDPROC_CFI(flush_instruction_cache_local)
263 .import cache_info, data
264 ENTRY_CFI(flush_data_cache_local)
269 load32 cache_info, %r1
271 /* Flush Data Cache */
273 LDREG DCACHE_BASE(%r1), %arg0
274 LDREG DCACHE_STRIDE(%r1), %arg1
275 LDREG DCACHE_COUNT(%r1), %arg2
276 LDREG DCACHE_LOOP(%r1), %arg3
277 rsm PSW_SM_I, %r22 /* No mmgt ops during loop*/
279 addib,COND(=) -1, %arg3, fdoneloop /* Preadjust and test */
280 movb,<,n %arg3, %r31, fdsync /* If loop < 0, do sync */
282 fdmanyloop: /* Loop if LOOP >= 2 */
283 addib,COND(>) -1, %r31, fdmanyloop /* Adjusted inner loop decr */
284 fdce %r0(%sr1, %arg0)
285 fdce,m %arg1(%sr1, %arg0) /* Last fdce and addr adjust */
286 movb,tr %arg3, %r31, fdmanyloop /* Re-init inner loop count */
287 addib,COND(<=),n -1, %arg2, fdsync /* Outer loop decr */
289 fdoneloop: /* Loop if LOOP = 1 */
290 /* Some implementations may flush with a single fdce instruction */
291 cmpib,COND(>>=),n 15, %arg2, fdoneloop2
294 fdce,m %arg1(%sr1, %arg0)
295 fdce,m %arg1(%sr1, %arg0)
296 fdce,m %arg1(%sr1, %arg0)
297 fdce,m %arg1(%sr1, %arg0)
298 fdce,m %arg1(%sr1, %arg0)
299 fdce,m %arg1(%sr1, %arg0)
300 fdce,m %arg1(%sr1, %arg0)
301 fdce,m %arg1(%sr1, %arg0)
302 fdce,m %arg1(%sr1, %arg0)
303 fdce,m %arg1(%sr1, %arg0)
304 fdce,m %arg1(%sr1, %arg0)
305 fdce,m %arg1(%sr1, %arg0)
306 fdce,m %arg1(%sr1, %arg0)
307 fdce,m %arg1(%sr1, %arg0)
308 fdce,m %arg1(%sr1, %arg0)
309 addib,COND(>) -16, %arg2, fdoneloop1
310 fdce,m %arg1(%sr1, %arg0)
313 cmpb,COND(=),n %arg2, %r0, fdsync /* Predict branch taken */
316 addib,COND(>) -1, %arg2, fdoneloop2 /* Outer loop count decr */
317 fdce,m %arg1(%sr1, %arg0) /* Fdce for one loop */
322 mtsm %r22 /* restore I-bit */
328 ENDPROC_CFI(flush_data_cache_local)
332 /* Macros to serialize TLB purge operations on SMP. */
334 .macro tlb_lock la,flags,tmp
336 ldil L%pa_tlb_lock,%r1
337 ldo R%pa_tlb_lock(%r1),\la
349 .macro tlb_unlock la,flags,tmp
357 /* Clear page using kernel mapping. */
359 ENTRY_CFI(clear_page_asm)
366 /* Unroll the loop. */
367 ldi (PAGE_SIZE / 128), %r1
387 /* Note reverse branch hint for addib is taken. */
388 addib,COND(>),n -1, %r1, 1b
394 * Note that until (if) we start saving the full 64-bit register
395 * values on interrupt, we can't use std on a 32 bit kernel.
397 ldi (PAGE_SIZE / 64), %r1
417 addib,COND(>),n -1, %r1, 1b
425 ENDPROC_CFI(clear_page_asm)
427 /* Copy page using kernel mapping. */
429 ENTRY_CFI(copy_page_asm)
435 /* PA8x00 CPUs can consume 2 loads or 1 store per cycle.
436 * Unroll the loop by hand and arrange insn appropriately.
437 * Prefetch doesn't improve performance on rp3440.
438 * GCC probably can do this just as well...
441 ldi (PAGE_SIZE / 128), %r1
485 /* Note reverse branch hint for addib is taken. */
486 addib,COND(>),n -1, %r1, 1b
492 * This loop is optimized for PCXL/PCXL2 ldw/ldw and stw/stw
493 * bundles (very restricted rules for bundling).
494 * Note that until (if) we start saving
495 * the full 64 bit register values on interrupt, we can't
496 * use ldd/std on a 32 bit kernel.
499 ldi (PAGE_SIZE / 64), %r1
535 addib,COND(>),n -1, %r1, 1b
543 ENDPROC_CFI(copy_page_asm)
546 * NOTE: Code in clear_user_page has a hard coded dependency on the
547 * maximum alias boundary being 4 Mb. We've been assured by the
548 * parisc chip designers that there will not ever be a parisc
549 * chip with a larger alias boundary (Never say never :-) ).
551 * Subtle: the dtlb miss handlers support the temp alias region by
552 * "knowing" that if a dtlb miss happens within the temp alias
553 * region it must have occurred while in clear_user_page. Since
554 * this routine makes use of processor local translations, we
555 * don't want to insert them into the kernel page table. Instead,
556 * we load up some general registers (they need to be registers
557 * which aren't shadowed) with the physical page numbers (preshifted
558 * for tlb insertion) needed to insert the translations. When we
559 * miss on the translation, the dtlb miss handler inserts the
560 * translation into the tlb using these values:
562 * %r26 physical page (shifted for tlb insert) of "to" translation
563 * %r23 physical page (shifted for tlb insert) of "from" translation
566 /* Drop prot bits and convert to page addr for iitlbt and idtlbt */
567 #define PAGE_ADD_SHIFT (PAGE_SHIFT-12)
568 .macro convert_phys_for_tlb_insert20 phys
569 extrd,u \phys, 56-PAGE_ADD_SHIFT, 32-PAGE_ADD_SHIFT, \phys
570 #if _PAGE_SIZE_ENCODING_DEFAULT
571 depdi _PAGE_SIZE_ENCODING_DEFAULT, 63, (63-58), \phys
576 * copy_user_page_asm() performs a page copy using mappings
577 * equivalent to the user page mappings. It can be used to
578 * implement copy_user_page() but unfortunately both the `from'
579 * and `to' pages need to be flushed through mappings equivalent
580 * to the user mappings after the copy because the kernel accesses
581 * the `from' page through the kmap kernel mapping and the `to'
582 * page needs to be flushed since code can be copied. As a
583 * result, this implementation is less efficient than the simpler
584 * copy using the kernel mapping. It only needs the `from' page
585 * to flushed via the user mapping. The kunmap routines handle
586 * the flushes needed for the kernel mapping.
588 * I'm still keeping this around because it may be possible to
589 * use it if more information is passed into copy_user_page().
590 * Have to do some measurements to see if it is worthwhile to
591 * lobby for such a change.
595 ENTRY_CFI(copy_user_page_asm)
600 /* Convert virtual `to' and `from' addresses to physical addresses.
601 Move `from' physical address to non shadowed register. */
602 ldil L%(__PAGE_OFFSET), %r1
606 ldil L%(TMPALIAS_MAP_START), %r28
608 #if (TMPALIAS_MAP_START >= 0x80000000)
609 depdi 0, 31,32, %r28 /* clear any sign extension */
611 convert_phys_for_tlb_insert20 %r26 /* convert phys addr to tlb insert format */
612 convert_phys_for_tlb_insert20 %r23 /* convert phys addr to tlb insert format */
613 depd %r24,63,22, %r28 /* Form aliased virtual address 'to' */
614 depdi 0, 63,PAGE_SHIFT, %r28 /* Clear any offset bits */
616 depdi 1, 41,1, %r29 /* Form aliased virtual address 'from' */
618 extrw,u %r26, 24,25, %r26 /* convert phys addr to tlb insert format */
619 extrw,u %r23, 24,25, %r23 /* convert phys addr to tlb insert format */
620 depw %r24, 31,22, %r28 /* Form aliased virtual address 'to' */
621 depwi 0, 31,PAGE_SHIFT, %r28 /* Clear any offset bits */
623 depwi 1, 9,1, %r29 /* Form aliased virtual address 'from' */
626 /* Purge any old translations */
632 tlb_lock %r20,%r21,%r22
635 tlb_unlock %r20,%r21,%r22
639 /* PA8x00 CPUs can consume 2 loads or 1 store per cycle.
640 * Unroll the loop by hand and arrange insn appropriately.
641 * GCC probably can do this just as well.
645 ldi (PAGE_SIZE / 128), %r1
689 /* conditional branches nullify on forward taken branch, and on
690 * non-taken backward branch. Note that .+4 is a backwards branch.
691 * The ldd should only get executed if the branch is taken.
693 addib,COND(>),n -1, %r1, 1b /* bundle 10 */
694 ldd 0(%r29), %r19 /* start next loads */
697 ldi (PAGE_SIZE / 64), %r1
700 * This loop is optimized for PCXL/PCXL2 ldw/ldw and stw/stw
701 * bundles (very restricted rules for bundling). It probably
702 * does OK on PCXU and better, but we could do better with
703 * ldd/std instructions. Note that until (if) we start saving
704 * the full 64 bit register values on interrupt, we can't
705 * use ldd/std on a 32 bit kernel.
742 addib,COND(>) -1, %r1,1b
751 ENDPROC_CFI(copy_user_page_asm)
753 ENTRY_CFI(clear_user_page_asm)
760 ldil L%(TMPALIAS_MAP_START), %r28
762 #if (TMPALIAS_MAP_START >= 0x80000000)
763 depdi 0, 31,32, %r28 /* clear any sign extension */
765 convert_phys_for_tlb_insert20 %r26 /* convert phys addr to tlb insert format */
766 depd %r25, 63,22, %r28 /* Form aliased virtual address 'to' */
767 depdi 0, 63,PAGE_SHIFT, %r28 /* Clear any offset bits */
769 extrw,u %r26, 24,25, %r26 /* convert phys addr to tlb insert format */
770 depw %r25, 31,22, %r28 /* Form aliased virtual address 'to' */
771 depwi 0, 31,PAGE_SHIFT, %r28 /* Clear any offset bits */
774 /* Purge any old translation */
779 tlb_lock %r20,%r21,%r22
781 tlb_unlock %r20,%r21,%r22
785 ldi (PAGE_SIZE / 128), %r1
787 /* PREFETCH (Write) has not (yet) been proven to help here */
788 /* #define PREFETCHW_OP ldd 256(%0), %r0 */
806 addib,COND(>) -1, %r1, 1b
809 #else /* ! CONFIG_64BIT */
810 ldi (PAGE_SIZE / 64), %r1
828 addib,COND(>) -1, %r1, 1b
830 #endif /* CONFIG_64BIT */
837 ENDPROC_CFI(clear_user_page_asm)
839 ENTRY_CFI(flush_dcache_page_asm)
844 ldil L%(TMPALIAS_MAP_START), %r28
846 #if (TMPALIAS_MAP_START >= 0x80000000)
847 depdi 0, 31,32, %r28 /* clear any sign extension */
849 convert_phys_for_tlb_insert20 %r26 /* convert phys addr to tlb insert format */
850 depd %r25, 63,22, %r28 /* Form aliased virtual address 'to' */
851 depdi 0, 63,PAGE_SHIFT, %r28 /* Clear any offset bits */
853 extrw,u %r26, 24,25, %r26 /* convert phys addr to tlb insert format */
854 depw %r25, 31,22, %r28 /* Form aliased virtual address 'to' */
855 depwi 0, 31,PAGE_SHIFT, %r28 /* Clear any offset bits */
858 /* Purge any old translation */
863 tlb_lock %r20,%r21,%r22
865 tlb_unlock %r20,%r21,%r22
868 ldil L%dcache_stride, %r1
869 ldw R%dcache_stride(%r1), r31
872 depdi,z 1, 63-PAGE_SHIFT,1, %r25
874 depwi,z 1, 31-PAGE_SHIFT,1, %r25
895 cmpb,COND(<<) %r28, %r25,1b
904 ENDPROC_CFI(flush_dcache_page_asm)
906 ENTRY_CFI(flush_icache_page_asm)
911 ldil L%(TMPALIAS_MAP_START), %r28
913 #if (TMPALIAS_MAP_START >= 0x80000000)
914 depdi 0, 31,32, %r28 /* clear any sign extension */
916 convert_phys_for_tlb_insert20 %r26 /* convert phys addr to tlb insert format */
917 depd %r25, 63,22, %r28 /* Form aliased virtual address 'to' */
918 depdi 0, 63,PAGE_SHIFT, %r28 /* Clear any offset bits */
920 extrw,u %r26, 24,25, %r26 /* convert phys addr to tlb insert format */
921 depw %r25, 31,22, %r28 /* Form aliased virtual address 'to' */
922 depwi 0, 31,PAGE_SHIFT, %r28 /* Clear any offset bits */
925 /* Purge any old translation. Note that the FIC instruction
926 * may use either the instruction or data TLB. Given that we
927 * have a flat address space, it's not clear which TLB will be
928 * used. So, we purge both entries. */
932 pitlb,l %r0(%sr4,%r28)
934 tlb_lock %r20,%r21,%r22
937 tlb_unlock %r20,%r21,%r22
940 ldil L%icache_stride, %r1
941 ldw R%icache_stride(%r1), %r31
944 depdi,z 1, 63-PAGE_SHIFT,1, %r25
946 depwi,z 1, 31-PAGE_SHIFT,1, %r25
952 /* fic only has the type 26 form on PA1.1, requiring an
953 * explicit space specification, so use %sr4 */
954 1: fic,m %r31(%sr4,%r28)
955 fic,m %r31(%sr4,%r28)
956 fic,m %r31(%sr4,%r28)
957 fic,m %r31(%sr4,%r28)
958 fic,m %r31(%sr4,%r28)
959 fic,m %r31(%sr4,%r28)
960 fic,m %r31(%sr4,%r28)
961 fic,m %r31(%sr4,%r28)
962 fic,m %r31(%sr4,%r28)
963 fic,m %r31(%sr4,%r28)
964 fic,m %r31(%sr4,%r28)
965 fic,m %r31(%sr4,%r28)
966 fic,m %r31(%sr4,%r28)
967 fic,m %r31(%sr4,%r28)
968 fic,m %r31(%sr4,%r28)
969 cmpb,COND(<<) %r28, %r25,1b
970 fic,m %r31(%sr4,%r28)
978 ENDPROC_CFI(flush_icache_page_asm)
980 ENTRY_CFI(flush_kernel_dcache_page_asm)
985 ldil L%dcache_stride, %r1
986 ldw R%dcache_stride(%r1), %r23
989 depdi,z 1, 63-PAGE_SHIFT,1, %r25
991 depwi,z 1, 31-PAGE_SHIFT,1, %r25
1012 cmpb,COND(<<) %r26, %r25,1b
1021 ENDPROC_CFI(flush_kernel_dcache_page_asm)
1023 ENTRY_CFI(purge_kernel_dcache_page_asm)
1028 ldil L%dcache_stride, %r1
1029 ldw R%dcache_stride(%r1), %r23
1032 depdi,z 1, 63-PAGE_SHIFT,1, %r25
1034 depwi,z 1, 31-PAGE_SHIFT,1, %r25
1036 add %r26, %r25, %r25
1037 sub %r25, %r23, %r25
1054 cmpb,COND(<<) %r26, %r25, 1b
1063 ENDPROC_CFI(purge_kernel_dcache_page_asm)
1065 ENTRY_CFI(flush_user_dcache_range_asm)
1070 ldil L%dcache_stride, %r1
1071 ldw R%dcache_stride(%r1), %r23
1073 ANDCM %r26, %r21, %r26
1075 1: cmpb,COND(<<),n %r26, %r25, 1b
1076 fdc,m %r23(%sr3, %r26)
1084 ENDPROC_CFI(flush_user_dcache_range_asm)
1086 ENTRY_CFI(flush_kernel_dcache_range_asm)
1091 ldil L%dcache_stride, %r1
1092 ldw R%dcache_stride(%r1), %r23
1094 ANDCM %r26, %r21, %r26
1096 1: cmpb,COND(<<),n %r26, %r25,1b
1106 ENDPROC_CFI(flush_kernel_dcache_range_asm)
1108 ENTRY_CFI(flush_user_icache_range_asm)
1113 ldil L%icache_stride, %r1
1114 ldw R%icache_stride(%r1), %r23
1116 ANDCM %r26, %r21, %r26
1118 1: cmpb,COND(<<),n %r26, %r25,1b
1119 fic,m %r23(%sr3, %r26)
1127 ENDPROC_CFI(flush_user_icache_range_asm)
1129 ENTRY_CFI(flush_kernel_icache_page)
1134 ldil L%icache_stride, %r1
1135 ldw R%icache_stride(%r1), %r23
1138 depdi,z 1, 63-PAGE_SHIFT,1, %r25
1140 depwi,z 1, 31-PAGE_SHIFT,1, %r25
1142 add %r26, %r25, %r25
1143 sub %r25, %r23, %r25
1146 1: fic,m %r23(%sr4, %r26)
1147 fic,m %r23(%sr4, %r26)
1148 fic,m %r23(%sr4, %r26)
1149 fic,m %r23(%sr4, %r26)
1150 fic,m %r23(%sr4, %r26)
1151 fic,m %r23(%sr4, %r26)
1152 fic,m %r23(%sr4, %r26)
1153 fic,m %r23(%sr4, %r26)
1154 fic,m %r23(%sr4, %r26)
1155 fic,m %r23(%sr4, %r26)
1156 fic,m %r23(%sr4, %r26)
1157 fic,m %r23(%sr4, %r26)
1158 fic,m %r23(%sr4, %r26)
1159 fic,m %r23(%sr4, %r26)
1160 fic,m %r23(%sr4, %r26)
1161 cmpb,COND(<<) %r26, %r25, 1b
1162 fic,m %r23(%sr4, %r26)
1170 ENDPROC_CFI(flush_kernel_icache_page)
1172 ENTRY_CFI(flush_kernel_icache_range_asm)
1177 ldil L%icache_stride, %r1
1178 ldw R%icache_stride(%r1), %r23
1180 ANDCM %r26, %r21, %r26
1182 1: cmpb,COND(<<),n %r26, %r25, 1b
1183 fic,m %r23(%sr4, %r26)
1190 ENDPROC_CFI(flush_kernel_icache_range_asm)
1192 /* align should cover use of rfi in disable_sr_hashing_asm and
1196 ENTRY_CFI(disable_sr_hashing_asm)
1202 * Switch to real mode
1213 rsm PSW_SM_Q, %r0 /* prep to load iia queue */
1214 mtctl %r0, %cr17 /* Clear IIASQ tail */
1215 mtctl %r0, %cr17 /* Clear IIASQ head */
1216 mtctl %r1, %cr18 /* IIAOQ head */
1218 mtctl %r1, %cr18 /* IIAOQ tail */
1219 load32 REAL_MODE_PSW, %r1
1224 1: cmpib,=,n SRHASH_PCXST, %r26,srdis_pcxs
1225 cmpib,=,n SRHASH_PCXL, %r26,srdis_pcxl
1226 cmpib,=,n SRHASH_PA20, %r26,srdis_pa20
1231 /* Disable Space Register Hashing for PCXS,PCXT,PCXT' */
1233 .word 0x141c1a00 /* mfdiag %dr0, %r28 */
1234 .word 0x141c1a00 /* must issue twice */
1235 depwi 0,18,1, %r28 /* Clear DHE (dcache hash enable) */
1236 depwi 0,20,1, %r28 /* Clear IHE (icache hash enable) */
1237 .word 0x141c1600 /* mtdiag %r28, %dr0 */
1238 .word 0x141c1600 /* must issue twice */
1243 /* Disable Space Register Hashing for PCXL */
1245 .word 0x141c0600 /* mfdiag %dr0, %r28 */
1246 depwi 0,28,2, %r28 /* Clear DHASH_EN & IHASH_EN */
1247 .word 0x141c0240 /* mtdiag %r28, %dr0 */
1252 /* Disable Space Register Hashing for PCXU,PCXU+,PCXW,PCXW+,PCXW2 */
1254 .word 0x144008bc /* mfdiag %dr2, %r28 */
1255 depdi 0, 54,1, %r28 /* clear DIAG_SPHASH_ENAB (bit 54) */
1256 .word 0x145c1840 /* mtdiag %r28, %dr2 */
1260 /* Switch back to virtual mode */
1261 rsm PSW_SM_I, %r0 /* prep to load iia queue */
1269 rsm PSW_SM_Q, %r0 /* prep to load iia queue */
1270 mtctl %r0, %cr17 /* Clear IIASQ tail */
1271 mtctl %r0, %cr17 /* Clear IIASQ head */
1272 mtctl %r1, %cr18 /* IIAOQ head */
1274 mtctl %r1, %cr18 /* IIAOQ tail */
1275 load32 KERNEL_PSW, %r1
1285 ENDPROC_CFI(disable_sr_hashing_asm)