1 /* SPDX-License-Identifier: GPL-2.0-or-later */
3 * PARISC TLB and cache flushing support
4 * Copyright (C) 2000-2001 Hewlett-Packard (John Marvin)
5 * Copyright (C) 2001 Matthew Wilcox (willy at parisc-linux.org)
6 * Copyright (C) 2002 Richard Hirst (rhirst with parisc-linux.org)
10 * NOTE: fdc,fic, and pdc instructions that use base register modification
11 * should only use index and base registers that are not shadowed,
12 * so that the fast path emulation in the non access miss handler
23 #include <asm/assembly.h>
24 #include <asm/cache.h>
26 #include <asm/alternative.h>
27 #include <linux/linkage.h>
28 #include <linux/init.h>
29 #include <linux/pgtable.h>
34 ENTRY_CFI(flush_tlb_all_local)
36 * The pitlbe and pdtlbe instructions should only be used to
37 * flush the entire tlb. Also, there needs to be no intervening
38 * tlb operations, e.g. tlb misses, so the operation needs
39 * to happen in real mode with all interruptions disabled.
42 /* pcxt_ssm_bug - relied upon translation! PA 2.0 Arch. F-4 and F-5 */
43 rsm PSW_SM_I, %r19 /* save I-bit state */
51 rsm PSW_SM_Q, %r0 /* prep to load iia queue */
52 mtctl %r0, %cr17 /* Clear IIASQ tail */
53 mtctl %r0, %cr17 /* Clear IIASQ head */
54 mtctl %r1, %cr18 /* IIAOQ head */
56 mtctl %r1, %cr18 /* IIAOQ tail */
57 load32 REAL_MODE_PSW, %r1
62 1: load32 PA(cache_info), %r1
64 /* Flush Instruction Tlb */
66 88: LDREG ITLB_SID_BASE(%r1), %r20
67 LDREG ITLB_SID_STRIDE(%r1), %r21
68 LDREG ITLB_SID_COUNT(%r1), %r22
69 LDREG ITLB_OFF_BASE(%r1), %arg0
70 LDREG ITLB_OFF_STRIDE(%r1), %arg1
71 LDREG ITLB_OFF_COUNT(%r1), %arg2
72 LDREG ITLB_LOOP(%r1), %arg3
74 addib,COND(=) -1, %arg3, fitoneloop /* Preadjust and test */
75 movb,<,n %arg3, %r31, fitdone /* If loop < 0, skip */
76 copy %arg0, %r28 /* Init base addr */
78 fitmanyloop: /* Loop if LOOP >= 2 */
80 add %r21, %r20, %r20 /* increment space */
81 copy %arg2, %r29 /* Init middle loop count */
83 fitmanymiddle: /* Loop if LOOP >= 2 */
84 addib,COND(>) -1, %r31, fitmanymiddle /* Adjusted inner loop decr */
85 pitlbe %r0(%sr1, %r28)
86 pitlbe,m %arg1(%sr1, %r28) /* Last pitlbe and addr adjust */
87 addib,COND(>) -1, %r29, fitmanymiddle /* Middle loop decr */
88 copy %arg3, %r31 /* Re-init inner loop count */
90 movb,tr %arg0, %r28, fitmanyloop /* Re-init base addr */
91 addib,COND(<=),n -1, %r22, fitdone /* Outer loop count decr */
93 fitoneloop: /* Loop if LOOP = 1 */
95 copy %arg0, %r28 /* init base addr */
96 copy %arg2, %r29 /* init middle loop count */
98 fitonemiddle: /* Loop if LOOP = 1 */
99 addib,COND(>) -1, %r29, fitonemiddle /* Middle loop count decr */
100 pitlbe,m %arg1(%sr1, %r28) /* pitlbe for one loop */
102 addib,COND(>) -1, %r22, fitoneloop /* Outer loop count decr */
103 add %r21, %r20, %r20 /* increment space */
106 ALTERNATIVE(88b, fitdone, ALT_COND_NO_SPLIT_TLB, INSN_NOP)
110 LDREG DTLB_SID_BASE(%r1), %r20
111 LDREG DTLB_SID_STRIDE(%r1), %r21
112 LDREG DTLB_SID_COUNT(%r1), %r22
113 LDREG DTLB_OFF_BASE(%r1), %arg0
114 LDREG DTLB_OFF_STRIDE(%r1), %arg1
115 LDREG DTLB_OFF_COUNT(%r1), %arg2
116 LDREG DTLB_LOOP(%r1), %arg3
118 addib,COND(=) -1, %arg3, fdtoneloop /* Preadjust and test */
119 movb,<,n %arg3, %r31, fdtdone /* If loop < 0, skip */
120 copy %arg0, %r28 /* Init base addr */
122 fdtmanyloop: /* Loop if LOOP >= 2 */
124 add %r21, %r20, %r20 /* increment space */
125 copy %arg2, %r29 /* Init middle loop count */
127 fdtmanymiddle: /* Loop if LOOP >= 2 */
128 addib,COND(>) -1, %r31, fdtmanymiddle /* Adjusted inner loop decr */
129 pdtlbe %r0(%sr1, %r28)
130 pdtlbe,m %arg1(%sr1, %r28) /* Last pdtlbe and addr adjust */
131 addib,COND(>) -1, %r29, fdtmanymiddle /* Middle loop decr */
132 copy %arg3, %r31 /* Re-init inner loop count */
134 movb,tr %arg0, %r28, fdtmanyloop /* Re-init base addr */
135 addib,COND(<=),n -1, %r22,fdtdone /* Outer loop count decr */
137 fdtoneloop: /* Loop if LOOP = 1 */
139 copy %arg0, %r28 /* init base addr */
140 copy %arg2, %r29 /* init middle loop count */
142 fdtonemiddle: /* Loop if LOOP = 1 */
143 addib,COND(>) -1, %r29, fdtonemiddle /* Middle loop count decr */
144 pdtlbe,m %arg1(%sr1, %r28) /* pdtlbe for one loop */
146 addib,COND(>) -1, %r22, fdtoneloop /* Outer loop count decr */
147 add %r21, %r20, %r20 /* increment space */
152 * Switch back to virtual mode
163 rsm PSW_SM_Q, %r0 /* prep to load iia queue */
164 mtctl %r0, %cr17 /* Clear IIASQ tail */
165 mtctl %r0, %cr17 /* Clear IIASQ head */
166 mtctl %r1, %cr18 /* IIAOQ head */
168 mtctl %r1, %cr18 /* IIAOQ tail */
169 load32 KERNEL_PSW, %r1
170 or %r1, %r19, %r1 /* I-bit to state on entry */
171 mtctl %r1, %ipsw /* restore I-bit (entire PSW) */
179 * When running in qemu, drop whole flush_tlb_all_local function and
180 * replace by one pdtlbe instruction, for which QEMU will drop all
183 3: pdtlbe %r0(%sr1,%r0)
185 ALTERNATIVE_CODE(flush_tlb_all_local, 2, ALT_COND_RUN_ON_QEMU, 3b)
186 ENDPROC_CFI(flush_tlb_all_local)
188 .import cache_info,data
190 ENTRY_CFI(flush_instruction_cache_local)
191 88: load32 cache_info, %r1
193 /* Flush Instruction Cache */
195 LDREG ICACHE_BASE(%r1), %arg0
196 LDREG ICACHE_STRIDE(%r1), %arg1
197 LDREG ICACHE_COUNT(%r1), %arg2
198 LDREG ICACHE_LOOP(%r1), %arg3
199 rsm PSW_SM_I, %r22 /* No mmgt ops during loop*/
201 addib,COND(=) -1, %arg3, fioneloop /* Preadjust and test */
202 movb,<,n %arg3, %r31, fisync /* If loop < 0, do sync */
204 fimanyloop: /* Loop if LOOP >= 2 */
205 addib,COND(>) -1, %r31, fimanyloop /* Adjusted inner loop decr */
206 fice %r0(%sr1, %arg0)
207 fice,m %arg1(%sr1, %arg0) /* Last fice and addr adjust */
208 movb,tr %arg3, %r31, fimanyloop /* Re-init inner loop count */
209 addib,COND(<=),n -1, %arg2, fisync /* Outer loop decr */
211 fioneloop: /* Loop if LOOP = 1 */
212 /* Some implementations may flush with a single fice instruction */
213 cmpib,COND(>>=),n 15, %arg2, fioneloop2
216 fice,m %arg1(%sr1, %arg0)
217 fice,m %arg1(%sr1, %arg0)
218 fice,m %arg1(%sr1, %arg0)
219 fice,m %arg1(%sr1, %arg0)
220 fice,m %arg1(%sr1, %arg0)
221 fice,m %arg1(%sr1, %arg0)
222 fice,m %arg1(%sr1, %arg0)
223 fice,m %arg1(%sr1, %arg0)
224 fice,m %arg1(%sr1, %arg0)
225 fice,m %arg1(%sr1, %arg0)
226 fice,m %arg1(%sr1, %arg0)
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 addib,COND(>) -16, %arg2, fioneloop1
232 fice,m %arg1(%sr1, %arg0)
235 cmpb,COND(=),n %arg2, %r0, fisync /* Predict branch taken */
238 addib,COND(>) -1, %arg2, fioneloop2 /* Outer loop count decr */
239 fice,m %arg1(%sr1, %arg0) /* Fice for one loop */
243 mtsm %r22 /* restore I-bit */
244 89: ALTERNATIVE(88b, 89b, ALT_COND_NO_ICACHE, INSN_NOP)
247 ENDPROC_CFI(flush_instruction_cache_local)
250 .import cache_info, data
251 ENTRY_CFI(flush_data_cache_local)
252 88: load32 cache_info, %r1
254 /* Flush Data Cache */
256 LDREG DCACHE_BASE(%r1), %arg0
257 LDREG DCACHE_STRIDE(%r1), %arg1
258 LDREG DCACHE_COUNT(%r1), %arg2
259 LDREG DCACHE_LOOP(%r1), %arg3
260 rsm PSW_SM_I, %r22 /* No mmgt ops during loop*/
262 addib,COND(=) -1, %arg3, fdoneloop /* Preadjust and test */
263 movb,<,n %arg3, %r31, fdsync /* If loop < 0, do sync */
265 fdmanyloop: /* Loop if LOOP >= 2 */
266 addib,COND(>) -1, %r31, fdmanyloop /* Adjusted inner loop decr */
267 fdce %r0(%sr1, %arg0)
268 fdce,m %arg1(%sr1, %arg0) /* Last fdce and addr adjust */
269 movb,tr %arg3, %r31, fdmanyloop /* Re-init inner loop count */
270 addib,COND(<=),n -1, %arg2, fdsync /* Outer loop decr */
272 fdoneloop: /* Loop if LOOP = 1 */
273 /* Some implementations may flush with a single fdce instruction */
274 cmpib,COND(>>=),n 15, %arg2, fdoneloop2
277 fdce,m %arg1(%sr1, %arg0)
278 fdce,m %arg1(%sr1, %arg0)
279 fdce,m %arg1(%sr1, %arg0)
280 fdce,m %arg1(%sr1, %arg0)
281 fdce,m %arg1(%sr1, %arg0)
282 fdce,m %arg1(%sr1, %arg0)
283 fdce,m %arg1(%sr1, %arg0)
284 fdce,m %arg1(%sr1, %arg0)
285 fdce,m %arg1(%sr1, %arg0)
286 fdce,m %arg1(%sr1, %arg0)
287 fdce,m %arg1(%sr1, %arg0)
288 fdce,m %arg1(%sr1, %arg0)
289 fdce,m %arg1(%sr1, %arg0)
290 fdce,m %arg1(%sr1, %arg0)
291 fdce,m %arg1(%sr1, %arg0)
292 addib,COND(>) -16, %arg2, fdoneloop1
293 fdce,m %arg1(%sr1, %arg0)
296 cmpb,COND(=),n %arg2, %r0, fdsync /* Predict branch taken */
299 addib,COND(>) -1, %arg2, fdoneloop2 /* Outer loop count decr */
300 fdce,m %arg1(%sr1, %arg0) /* Fdce for one loop */
305 mtsm %r22 /* restore I-bit */
306 89: ALTERNATIVE(88b, 89b, ALT_COND_NO_DCACHE, INSN_NOP)
309 ENDPROC_CFI(flush_data_cache_local)
311 /* Clear page using kernel mapping. */
313 ENTRY_CFI(clear_page_asm)
316 /* Unroll the loop. */
317 ldi (PAGE_SIZE / 128), %r1
337 /* Note reverse branch hint for addib is taken. */
338 addib,COND(>),n -1, %r1, 1b
344 * Note that until (if) we start saving the full 64-bit register
345 * values on interrupt, we can't use std on a 32 bit kernel.
347 ldi (PAGE_SIZE / 64), %r1
367 addib,COND(>),n -1, %r1, 1b
372 ENDPROC_CFI(clear_page_asm)
374 /* Copy page using kernel mapping. */
376 ENTRY_CFI(copy_page_asm)
378 /* PA8x00 CPUs can consume 2 loads or 1 store per cycle.
379 * Unroll the loop by hand and arrange insn appropriately.
380 * Prefetch doesn't improve performance on rp3440.
381 * GCC probably can do this just as well...
384 ldi (PAGE_SIZE / 128), %r1
428 /* Note reverse branch hint for addib is taken. */
429 addib,COND(>),n -1, %r1, 1b
435 * This loop is optimized for PCXL/PCXL2 ldw/ldw and stw/stw
436 * bundles (very restricted rules for bundling).
437 * Note that until (if) we start saving
438 * the full 64 bit register values on interrupt, we can't
439 * use ldd/std on a 32 bit kernel.
442 ldi (PAGE_SIZE / 64), %r1
478 addib,COND(>),n -1, %r1, 1b
483 ENDPROC_CFI(copy_page_asm)
486 * NOTE: Code in clear_user_page has a hard coded dependency on the
487 * maximum alias boundary being 4 Mb. We've been assured by the
488 * parisc chip designers that there will not ever be a parisc
489 * chip with a larger alias boundary (Never say never :-) ).
491 * Subtle: the dtlb miss handlers support the temp alias region by
492 * "knowing" that if a dtlb miss happens within the temp alias
493 * region it must have occurred while in clear_user_page. Since
494 * this routine makes use of processor local translations, we
495 * don't want to insert them into the kernel page table. Instead,
496 * we load up some general registers (they need to be registers
497 * which aren't shadowed) with the physical page numbers (preshifted
498 * for tlb insertion) needed to insert the translations. When we
499 * miss on the translation, the dtlb miss handler inserts the
500 * translation into the tlb using these values:
502 * %r26 physical page (shifted for tlb insert) of "to" translation
503 * %r23 physical page (shifted for tlb insert) of "from" translation
506 /* Drop prot bits and convert to page addr for iitlbt and idtlbt */
507 #define PAGE_ADD_SHIFT (PAGE_SHIFT-12)
508 .macro convert_phys_for_tlb_insert20 phys
509 extrd,u \phys, 56-PAGE_ADD_SHIFT, 32-PAGE_ADD_SHIFT, \phys
510 #if _PAGE_SIZE_ENCODING_DEFAULT
511 depdi _PAGE_SIZE_ENCODING_DEFAULT, 63, (63-58), \phys
516 * copy_user_page_asm() performs a page copy using mappings
517 * equivalent to the user page mappings. It can be used to
518 * implement copy_user_page() but unfortunately both the `from'
519 * and `to' pages need to be flushed through mappings equivalent
520 * to the user mappings after the copy because the kernel accesses
521 * the `from' page through the kmap kernel mapping and the `to'
522 * page needs to be flushed since code can be copied. As a
523 * result, this implementation is less efficient than the simpler
524 * copy using the kernel mapping. It only needs the `from' page
525 * to flushed via the user mapping. The kunmap routines handle
526 * the flushes needed for the kernel mapping.
528 * I'm still keeping this around because it may be possible to
529 * use it if more information is passed into copy_user_page().
530 * Have to do some measurements to see if it is worthwhile to
531 * lobby for such a change.
535 ENTRY_CFI(copy_user_page_asm)
536 /* Convert virtual `to' and `from' addresses to physical addresses.
537 Move `from' physical address to non shadowed register. */
538 ldil L%(__PAGE_OFFSET), %r1
542 ldil L%(TMPALIAS_MAP_START), %r28
544 #if (TMPALIAS_MAP_START >= 0x80000000)
545 depdi 0, 31,32, %r28 /* clear any sign extension */
547 convert_phys_for_tlb_insert20 %r26 /* convert phys addr to tlb insert format */
548 convert_phys_for_tlb_insert20 %r23 /* convert phys addr to tlb insert format */
549 depd %r24,63,22, %r28 /* Form aliased virtual address 'to' */
550 depdi 0, 63,PAGE_SHIFT, %r28 /* Clear any offset bits */
552 depdi 1, 41,1, %r29 /* Form aliased virtual address 'from' */
554 extrw,u %r26, 24,25, %r26 /* convert phys addr to tlb insert format */
555 extrw,u %r23, 24,25, %r23 /* convert phys addr to tlb insert format */
556 depw %r24, 31,22, %r28 /* Form aliased virtual address 'to' */
557 depwi 0, 31,PAGE_SHIFT, %r28 /* Clear any offset bits */
559 depwi 1, 9,1, %r29 /* Form aliased virtual address 'from' */
562 /* Purge any old translations */
570 ALTERNATIVE(0b, 0b+4, ALT_COND_NO_SMP, INSN_PxTLB)
571 ALTERNATIVE(1b, 1b+4, ALT_COND_NO_SMP, INSN_PxTLB)
575 /* PA8x00 CPUs can consume 2 loads or 1 store per cycle.
576 * Unroll the loop by hand and arrange insn appropriately.
577 * GCC probably can do this just as well.
581 ldi (PAGE_SIZE / 128), %r1
625 /* conditional branches nullify on forward taken branch, and on
626 * non-taken backward branch. Note that .+4 is a backwards branch.
627 * The ldd should only get executed if the branch is taken.
629 addib,COND(>),n -1, %r1, 1b /* bundle 10 */
630 ldd 0(%r29), %r19 /* start next loads */
633 ldi (PAGE_SIZE / 64), %r1
636 * This loop is optimized for PCXL/PCXL2 ldw/ldw and stw/stw
637 * bundles (very restricted rules for bundling). It probably
638 * does OK on PCXU and better, but we could do better with
639 * ldd/std instructions. Note that until (if) we start saving
640 * the full 64 bit register values on interrupt, we can't
641 * use ldd/std on a 32 bit kernel.
678 addib,COND(>) -1, %r1,1b
684 ENDPROC_CFI(copy_user_page_asm)
686 ENTRY_CFI(clear_user_page_asm)
689 ldil L%(TMPALIAS_MAP_START), %r28
691 #if (TMPALIAS_MAP_START >= 0x80000000)
692 depdi 0, 31,32, %r28 /* clear any sign extension */
694 convert_phys_for_tlb_insert20 %r26 /* convert phys addr to tlb insert format */
695 depd %r25, 63,22, %r28 /* Form aliased virtual address 'to' */
696 depdi 0, 63,PAGE_SHIFT, %r28 /* Clear any offset bits */
698 extrw,u %r26, 24,25, %r26 /* convert phys addr to tlb insert format */
699 depw %r25, 31,22, %r28 /* Form aliased virtual address 'to' */
700 depwi 0, 31,PAGE_SHIFT, %r28 /* Clear any offset bits */
703 /* Purge any old translation */
709 ALTERNATIVE(0b, 0b+4, ALT_COND_NO_SMP, INSN_PxTLB)
713 ldi (PAGE_SIZE / 128), %r1
715 /* PREFETCH (Write) has not (yet) been proven to help here */
716 /* #define PREFETCHW_OP ldd 256(%0), %r0 */
734 addib,COND(>) -1, %r1, 1b
737 #else /* ! CONFIG_64BIT */
738 ldi (PAGE_SIZE / 64), %r1
756 addib,COND(>) -1, %r1, 1b
758 #endif /* CONFIG_64BIT */
762 ENDPROC_CFI(clear_user_page_asm)
764 ENTRY_CFI(flush_dcache_page_asm)
765 ldil L%(TMPALIAS_MAP_START), %r28
767 #if (TMPALIAS_MAP_START >= 0x80000000)
768 depdi 0, 31,32, %r28 /* clear any sign extension */
770 convert_phys_for_tlb_insert20 %r26 /* convert phys addr to tlb insert format */
771 depd %r25, 63,22, %r28 /* Form aliased virtual address 'to' */
772 depdi 0, 63,PAGE_SHIFT, %r28 /* Clear any offset bits */
774 extrw,u %r26, 24,25, %r26 /* convert phys addr to tlb insert format */
775 depw %r25, 31,22, %r28 /* Form aliased virtual address 'to' */
776 depwi 0, 31,PAGE_SHIFT, %r28 /* Clear any offset bits */
779 /* Purge any old translation */
785 ALTERNATIVE(0b, 0b+4, ALT_COND_NO_SMP, INSN_PxTLB)
788 88: ldil L%dcache_stride, %r1
789 ldw R%dcache_stride(%r1), r31
792 depdi,z 1, 63-PAGE_SHIFT,1, %r25
794 depwi,z 1, 31-PAGE_SHIFT,1, %r25
814 cmpb,COND(>>) %r25, %r28, 1b /* predict taken */
817 89: ALTERNATIVE(88b, 89b, ALT_COND_NO_DCACHE, INSN_NOP)
821 ENDPROC_CFI(flush_dcache_page_asm)
823 ENTRY_CFI(purge_dcache_page_asm)
824 ldil L%(TMPALIAS_MAP_START), %r28
826 #if (TMPALIAS_MAP_START >= 0x80000000)
827 depdi 0, 31,32, %r28 /* clear any sign extension */
829 convert_phys_for_tlb_insert20 %r26 /* convert phys addr to tlb insert format */
830 depd %r25, 63,22, %r28 /* Form aliased virtual address 'to' */
831 depdi 0, 63,PAGE_SHIFT, %r28 /* Clear any offset bits */
833 extrw,u %r26, 24,25, %r26 /* convert phys addr to tlb insert format */
834 depw %r25, 31,22, %r28 /* Form aliased virtual address 'to' */
835 depwi 0, 31,PAGE_SHIFT, %r28 /* Clear any offset bits */
838 /* Purge any old translation */
844 ALTERNATIVE(0b, 0b+4, ALT_COND_NO_SMP, INSN_PxTLB)
847 88: ldil L%dcache_stride, %r1
848 ldw R%dcache_stride(%r1), r31
851 depdi,z 1, 63-PAGE_SHIFT,1, %r25
853 depwi,z 1, 31-PAGE_SHIFT,1, %r25
873 cmpb,COND(>>) %r25, %r28, 1b /* predict taken */
876 89: ALTERNATIVE(88b, 89b, ALT_COND_NO_DCACHE, INSN_NOP)
880 ENDPROC_CFI(purge_dcache_page_asm)
882 ENTRY_CFI(flush_icache_page_asm)
883 ldil L%(TMPALIAS_MAP_START), %r28
885 #if (TMPALIAS_MAP_START >= 0x80000000)
886 depdi 0, 31,32, %r28 /* clear any sign extension */
888 convert_phys_for_tlb_insert20 %r26 /* convert phys addr to tlb insert format */
889 depd %r25, 63,22, %r28 /* Form aliased virtual address 'to' */
890 depdi 0, 63,PAGE_SHIFT, %r28 /* Clear any offset bits */
892 extrw,u %r26, 24,25, %r26 /* convert phys addr to tlb insert format */
893 depw %r25, 31,22, %r28 /* Form aliased virtual address 'to' */
894 depwi 0, 31,PAGE_SHIFT, %r28 /* Clear any offset bits */
897 /* Purge any old translation. Note that the FIC instruction
898 * may use either the instruction or data TLB. Given that we
899 * have a flat address space, it's not clear which TLB will be
900 * used. So, we purge both entries. */
904 1: pitlb,l %r0(%sr4,%r28)
905 ALTERNATIVE(1b, 1b+4, ALT_COND_NO_SPLIT_TLB, INSN_NOP)
908 1: pitlb %r0(%sr4,%r28)
909 ALTERNATIVE(0b, 0b+4, ALT_COND_NO_SMP, INSN_PxTLB)
910 ALTERNATIVE(1b, 1b+4, ALT_COND_NO_SMP, INSN_PxTLB)
911 ALTERNATIVE(1b, 1b+4, ALT_COND_NO_SPLIT_TLB, INSN_NOP)
914 88: ldil L%icache_stride, %r1
915 ldw R%icache_stride(%r1), %r31
918 depdi,z 1, 63-PAGE_SHIFT,1, %r25
920 depwi,z 1, 31-PAGE_SHIFT,1, %r25
925 /* fic only has the type 26 form on PA1.1, requiring an
926 * explicit space specification, so use %sr4 */
927 1: fic,m %r31(%sr4,%r28)
928 fic,m %r31(%sr4,%r28)
929 fic,m %r31(%sr4,%r28)
930 fic,m %r31(%sr4,%r28)
931 fic,m %r31(%sr4,%r28)
932 fic,m %r31(%sr4,%r28)
933 fic,m %r31(%sr4,%r28)
934 fic,m %r31(%sr4,%r28)
935 fic,m %r31(%sr4,%r28)
936 fic,m %r31(%sr4,%r28)
937 fic,m %r31(%sr4,%r28)
938 fic,m %r31(%sr4,%r28)
939 fic,m %r31(%sr4,%r28)
940 fic,m %r31(%sr4,%r28)
941 fic,m %r31(%sr4,%r28)
942 cmpb,COND(>>) %r25, %r28, 1b /* predict taken */
943 fic,m %r31(%sr4,%r28)
945 89: ALTERNATIVE(88b, 89b, ALT_COND_NO_ICACHE, INSN_NOP)
949 ENDPROC_CFI(flush_icache_page_asm)
951 ENTRY_CFI(flush_kernel_dcache_page_asm)
952 88: ldil L%dcache_stride, %r1
953 ldw R%dcache_stride(%r1), %r23
956 depdi,z 1, 63-PAGE_SHIFT,1, %r25
958 depwi,z 1, 31-PAGE_SHIFT,1, %r25
978 cmpb,COND(>>) %r25, %r26, 1b /* predict taken */
981 89: ALTERNATIVE(88b, 89b, ALT_COND_NO_DCACHE, INSN_NOP)
985 ENDPROC_CFI(flush_kernel_dcache_page_asm)
987 ENTRY_CFI(purge_kernel_dcache_page_asm)
988 88: ldil L%dcache_stride, %r1
989 ldw R%dcache_stride(%r1), %r23
992 depdi,z 1, 63-PAGE_SHIFT,1, %r25
994 depwi,z 1, 31-PAGE_SHIFT,1, %r25
1014 cmpb,COND(>>) %r25, %r26, 1b /* predict taken */
1017 89: ALTERNATIVE(88b, 89b, ALT_COND_NO_DCACHE, INSN_NOP)
1021 ENDPROC_CFI(purge_kernel_dcache_page_asm)
1023 ENTRY_CFI(flush_user_dcache_range_asm)
1024 88: ldil L%dcache_stride, %r1
1025 ldw R%dcache_stride(%r1), %r23
1027 ANDCM %r26, %r21, %r26
1030 depd,z %r23, 59, 60, %r21
1032 depw,z %r23, 27, 28, %r21
1034 add %r26, %r21, %r22
1035 cmpb,COND(>>),n %r22, %r25, 2f /* predict not taken */
1036 1: add %r22, %r21, %r22
1037 fdc,m %r23(%sr3, %r26)
1038 fdc,m %r23(%sr3, %r26)
1039 fdc,m %r23(%sr3, %r26)
1040 fdc,m %r23(%sr3, %r26)
1041 fdc,m %r23(%sr3, %r26)
1042 fdc,m %r23(%sr3, %r26)
1043 fdc,m %r23(%sr3, %r26)
1044 fdc,m %r23(%sr3, %r26)
1045 fdc,m %r23(%sr3, %r26)
1046 fdc,m %r23(%sr3, %r26)
1047 fdc,m %r23(%sr3, %r26)
1048 fdc,m %r23(%sr3, %r26)
1049 fdc,m %r23(%sr3, %r26)
1050 fdc,m %r23(%sr3, %r26)
1051 fdc,m %r23(%sr3, %r26)
1052 cmpb,COND(<<=) %r22, %r25, 1b /* predict taken */
1053 fdc,m %r23(%sr3, %r26)
1055 2: cmpb,COND(>>),n %r25, %r26, 2b
1056 fdc,m %r23(%sr3, %r26)
1058 89: ALTERNATIVE(88b, 89b, ALT_COND_NO_DCACHE, INSN_NOP)
1062 ENDPROC_CFI(flush_user_dcache_range_asm)
1064 ENTRY_CFI(flush_kernel_dcache_range_asm)
1065 88: ldil L%dcache_stride, %r1
1066 ldw R%dcache_stride(%r1), %r23
1068 ANDCM %r26, %r21, %r26
1071 depd,z %r23, 59, 60, %r21
1073 depw,z %r23, 27, 28, %r21
1075 add %r26, %r21, %r22
1076 cmpb,COND(>>),n %r22, %r25, 2f /* predict not taken */
1077 1: add %r22, %r21, %r22
1093 cmpb,COND(<<=) %r22, %r25, 1b /* predict taken */
1096 2: cmpb,COND(>>),n %r25, %r26, 2b /* predict taken */
1100 89: ALTERNATIVE(88b, 89b, ALT_COND_NO_DCACHE, INSN_NOP)
1104 ENDPROC_CFI(flush_kernel_dcache_range_asm)
1106 ENTRY_CFI(purge_kernel_dcache_range_asm)
1107 88: ldil L%dcache_stride, %r1
1108 ldw R%dcache_stride(%r1), %r23
1110 ANDCM %r26, %r21, %r26
1113 depd,z %r23, 59, 60, %r21
1115 depw,z %r23, 27, 28, %r21
1117 add %r26, %r21, %r22
1118 cmpb,COND(>>),n %r22, %r25, 2f /* predict not taken */
1119 1: add %r22, %r21, %r22
1135 cmpb,COND(<<=) %r22, %r25, 1b /* predict taken */
1138 2: cmpb,COND(>>),n %r25, %r26, 2b /* predict taken */
1142 89: ALTERNATIVE(88b, 89b, ALT_COND_NO_DCACHE, INSN_NOP)
1146 ENDPROC_CFI(purge_kernel_dcache_range_asm)
1148 ENTRY_CFI(flush_user_icache_range_asm)
1149 88: ldil L%icache_stride, %r1
1150 ldw R%icache_stride(%r1), %r23
1152 ANDCM %r26, %r21, %r26
1155 depd,z %r23, 59, 60, %r21
1157 depw,z %r23, 27, 28, %r21
1159 add %r26, %r21, %r22
1160 cmpb,COND(>>),n %r22, %r25, 2f /* predict not taken */
1161 1: add %r22, %r21, %r22
1162 fic,m %r23(%sr3, %r26)
1163 fic,m %r23(%sr3, %r26)
1164 fic,m %r23(%sr3, %r26)
1165 fic,m %r23(%sr3, %r26)
1166 fic,m %r23(%sr3, %r26)
1167 fic,m %r23(%sr3, %r26)
1168 fic,m %r23(%sr3, %r26)
1169 fic,m %r23(%sr3, %r26)
1170 fic,m %r23(%sr3, %r26)
1171 fic,m %r23(%sr3, %r26)
1172 fic,m %r23(%sr3, %r26)
1173 fic,m %r23(%sr3, %r26)
1174 fic,m %r23(%sr3, %r26)
1175 fic,m %r23(%sr3, %r26)
1176 fic,m %r23(%sr3, %r26)
1177 cmpb,COND(<<=) %r22, %r25, 1b /* predict taken */
1178 fic,m %r23(%sr3, %r26)
1180 2: cmpb,COND(>>),n %r25, %r26, 2b
1181 fic,m %r23(%sr3, %r26)
1183 89: ALTERNATIVE(88b, 89b, ALT_COND_NO_ICACHE, INSN_NOP)
1187 ENDPROC_CFI(flush_user_icache_range_asm)
1189 ENTRY_CFI(flush_kernel_icache_page)
1190 88: ldil L%icache_stride, %r1
1191 ldw R%icache_stride(%r1), %r23
1194 depdi,z 1, 63-PAGE_SHIFT,1, %r25
1196 depwi,z 1, 31-PAGE_SHIFT,1, %r25
1198 add %r26, %r25, %r25
1199 sub %r25, %r23, %r25
1202 1: fic,m %r23(%sr4, %r26)
1203 fic,m %r23(%sr4, %r26)
1204 fic,m %r23(%sr4, %r26)
1205 fic,m %r23(%sr4, %r26)
1206 fic,m %r23(%sr4, %r26)
1207 fic,m %r23(%sr4, %r26)
1208 fic,m %r23(%sr4, %r26)
1209 fic,m %r23(%sr4, %r26)
1210 fic,m %r23(%sr4, %r26)
1211 fic,m %r23(%sr4, %r26)
1212 fic,m %r23(%sr4, %r26)
1213 fic,m %r23(%sr4, %r26)
1214 fic,m %r23(%sr4, %r26)
1215 fic,m %r23(%sr4, %r26)
1216 fic,m %r23(%sr4, %r26)
1217 cmpb,COND(>>) %r25, %r26, 1b /* predict taken */
1218 fic,m %r23(%sr4, %r26)
1220 89: ALTERNATIVE(88b, 89b, ALT_COND_NO_ICACHE, INSN_NOP)
1224 ENDPROC_CFI(flush_kernel_icache_page)
1226 ENTRY_CFI(flush_kernel_icache_range_asm)
1227 88: ldil L%icache_stride, %r1
1228 ldw R%icache_stride(%r1), %r23
1230 ANDCM %r26, %r21, %r26
1233 depd,z %r23, 59, 60, %r21
1235 depw,z %r23, 27, 28, %r21
1237 add %r26, %r21, %r22
1238 cmpb,COND(>>),n %r22, %r25, 2f /* predict not taken */
1239 1: add %r22, %r21, %r22
1240 fic,m %r23(%sr4, %r26)
1241 fic,m %r23(%sr4, %r26)
1242 fic,m %r23(%sr4, %r26)
1243 fic,m %r23(%sr4, %r26)
1244 fic,m %r23(%sr4, %r26)
1245 fic,m %r23(%sr4, %r26)
1246 fic,m %r23(%sr4, %r26)
1247 fic,m %r23(%sr4, %r26)
1248 fic,m %r23(%sr4, %r26)
1249 fic,m %r23(%sr4, %r26)
1250 fic,m %r23(%sr4, %r26)
1251 fic,m %r23(%sr4, %r26)
1252 fic,m %r23(%sr4, %r26)
1253 fic,m %r23(%sr4, %r26)
1254 fic,m %r23(%sr4, %r26)
1255 cmpb,COND(<<=) %r22, %r25, 1b /* predict taken */
1256 fic,m %r23(%sr4, %r26)
1258 2: cmpb,COND(>>),n %r25, %r26, 2b /* predict taken */
1259 fic,m %r23(%sr4, %r26)
1261 89: ALTERNATIVE(88b, 89b, ALT_COND_NO_ICACHE, INSN_NOP)
1265 ENDPROC_CFI(flush_kernel_icache_range_asm)
1269 /* align should cover use of rfi in disable_sr_hashing_asm and
1273 ENTRY_CFI(disable_sr_hashing_asm)
1275 * Switch to real mode
1286 rsm PSW_SM_Q, %r0 /* prep to load iia queue */
1287 mtctl %r0, %cr17 /* Clear IIASQ tail */
1288 mtctl %r0, %cr17 /* Clear IIASQ head */
1289 mtctl %r1, %cr18 /* IIAOQ head */
1291 mtctl %r1, %cr18 /* IIAOQ tail */
1292 load32 REAL_MODE_PSW, %r1
1297 1: cmpib,=,n SRHASH_PCXST, %r26,srdis_pcxs
1298 cmpib,=,n SRHASH_PCXL, %r26,srdis_pcxl
1299 cmpib,=,n SRHASH_PA20, %r26,srdis_pa20
1304 /* Disable Space Register Hashing for PCXS,PCXT,PCXT' */
1306 .word 0x141c1a00 /* mfdiag %dr0, %r28 */
1307 .word 0x141c1a00 /* must issue twice */
1308 depwi 0,18,1, %r28 /* Clear DHE (dcache hash enable) */
1309 depwi 0,20,1, %r28 /* Clear IHE (icache hash enable) */
1310 .word 0x141c1600 /* mtdiag %r28, %dr0 */
1311 .word 0x141c1600 /* must issue twice */
1316 /* Disable Space Register Hashing for PCXL */
1318 .word 0x141c0600 /* mfdiag %dr0, %r28 */
1319 depwi 0,28,2, %r28 /* Clear DHASH_EN & IHASH_EN */
1320 .word 0x141c0240 /* mtdiag %r28, %dr0 */
1325 /* Disable Space Register Hashing for PCXU,PCXU+,PCXW,PCXW+,PCXW2 */
1327 .word 0x144008bc /* mfdiag %dr2, %r28 */
1328 depdi 0, 54,1, %r28 /* clear DIAG_SPHASH_ENAB (bit 54) */
1329 .word 0x145c1840 /* mtdiag %r28, %dr2 */
1333 /* Switch back to virtual mode */
1334 rsm PSW_SM_I, %r0 /* prep to load iia queue */
1342 rsm PSW_SM_Q, %r0 /* prep to load iia queue */
1343 mtctl %r0, %cr17 /* Clear IIASQ tail */
1344 mtctl %r0, %cr17 /* Clear IIASQ head */
1345 mtctl %r1, %cr18 /* IIAOQ head */
1347 mtctl %r1, %cr18 /* IIAOQ tail */
1348 load32 KERNEL_PSW, %r1
1355 ENDPROC_CFI(disable_sr_hashing_asm)