1660662f8SThomas Gleixner/* SPDX-License-Identifier: GPL-2.0-or-later */ 21da177e4SLinus Torvalds/* 31da177e4SLinus Torvalds * PARISC TLB and cache flushing support 41da177e4SLinus Torvalds * Copyright (C) 2000-2001 Hewlett-Packard (John Marvin) 51da177e4SLinus Torvalds * Copyright (C) 2001 Matthew Wilcox (willy at parisc-linux.org) 61da177e4SLinus Torvalds * Copyright (C) 2002 Richard Hirst (rhirst with parisc-linux.org) 71da177e4SLinus Torvalds */ 81da177e4SLinus Torvalds 91da177e4SLinus Torvalds/* 101da177e4SLinus Torvalds * NOTE: fdc,fic, and pdc instructions that use base register modification 111da177e4SLinus Torvalds * should only use index and base registers that are not shadowed, 121da177e4SLinus Torvalds * so that the fast path emulation in the non access miss handler 131da177e4SLinus Torvalds * can be used. 141da177e4SLinus Torvalds */ 151da177e4SLinus Torvalds 16413059f2SGrant Grundler#ifdef CONFIG_64BIT 171da177e4SLinus Torvalds .level 2.0w 181da177e4SLinus Torvalds#else 191da177e4SLinus Torvalds .level 2.0 201da177e4SLinus Torvalds#endif 211da177e4SLinus Torvalds 221da177e4SLinus Torvalds#include <asm/psw.h> 23896a3756SGrant Grundler#include <asm/assembly.h> 241da177e4SLinus Torvalds#include <asm/cache.h> 2588776c0eSHelge Deller#include <asm/ldcw.h> 263847dab7SHelge Deller#include <asm/alternative.h> 278e9e9844SHelge Deller#include <linux/linkage.h> 282a03bb9eSHelge Deller#include <linux/init.h> 2965fddcfcSMike Rapoport#include <linux/pgtable.h> 301da177e4SLinus Torvalds 312a03bb9eSHelge Deller .section .text.hot 322a03bb9eSHelge Deller .align 16 331da177e4SLinus Torvalds 34f39cce65SHelge DellerENTRY_CFI(flush_tlb_all_local) 351da177e4SLinus Torvalds /* 361da177e4SLinus Torvalds * The pitlbe and pdtlbe instructions should only be used to 371da177e4SLinus Torvalds * flush the entire tlb. Also, there needs to be no intervening 381da177e4SLinus Torvalds * tlb operations, e.g. tlb misses, so the operation needs 391da177e4SLinus Torvalds * to happen in real mode with all interruptions disabled. 401da177e4SLinus Torvalds */ 411da177e4SLinus Torvalds 42896a3756SGrant Grundler /* pcxt_ssm_bug - relied upon translation! PA 2.0 Arch. F-4 and F-5 */ 43896a3756SGrant Grundler rsm PSW_SM_I, %r19 /* save I-bit state */ 44896a3756SGrant Grundler load32 PA(1f), %r1 451da177e4SLinus Torvalds nop 461da177e4SLinus Torvalds nop 471da177e4SLinus Torvalds nop 481da177e4SLinus Torvalds nop 491da177e4SLinus Torvalds nop 501da177e4SLinus Torvalds 51896a3756SGrant Grundler rsm PSW_SM_Q, %r0 /* prep to load iia queue */ 521da177e4SLinus Torvalds mtctl %r0, %cr17 /* Clear IIASQ tail */ 531da177e4SLinus Torvalds mtctl %r0, %cr17 /* Clear IIASQ head */ 541da177e4SLinus Torvalds mtctl %r1, %cr18 /* IIAOQ head */ 551da177e4SLinus Torvalds ldo 4(%r1), %r1 561da177e4SLinus Torvalds mtctl %r1, %cr18 /* IIAOQ tail */ 57896a3756SGrant Grundler load32 REAL_MODE_PSW, %r1 58896a3756SGrant Grundler mtctl %r1, %ipsw 591da177e4SLinus Torvalds rfi 601da177e4SLinus Torvalds nop 611da177e4SLinus Torvalds 622fd83038SHelge Deller1: load32 PA(cache_info), %r1 631da177e4SLinus Torvalds 641da177e4SLinus Torvalds /* Flush Instruction Tlb */ 651da177e4SLinus Torvalds 6669245c97SHelge Deller88: LDREG ITLB_SID_BASE(%r1), %r20 671da177e4SLinus Torvalds LDREG ITLB_SID_STRIDE(%r1), %r21 681da177e4SLinus Torvalds LDREG ITLB_SID_COUNT(%r1), %r22 691da177e4SLinus Torvalds LDREG ITLB_OFF_BASE(%r1), %arg0 701da177e4SLinus Torvalds LDREG ITLB_OFF_STRIDE(%r1), %arg1 711da177e4SLinus Torvalds LDREG ITLB_OFF_COUNT(%r1), %arg2 721da177e4SLinus Torvalds LDREG ITLB_LOOP(%r1), %arg3 731da177e4SLinus Torvalds 74872f6debSKyle McMartin addib,COND(=) -1, %arg3, fitoneloop /* Preadjust and test */ 751da177e4SLinus Torvalds movb,<,n %arg3, %r31, fitdone /* If loop < 0, skip */ 761da177e4SLinus Torvalds copy %arg0, %r28 /* Init base addr */ 771da177e4SLinus Torvalds 781da177e4SLinus Torvaldsfitmanyloop: /* Loop if LOOP >= 2 */ 791da177e4SLinus Torvalds mtsp %r20, %sr1 801da177e4SLinus Torvalds add %r21, %r20, %r20 /* increment space */ 811da177e4SLinus Torvalds copy %arg2, %r29 /* Init middle loop count */ 821da177e4SLinus Torvalds 831da177e4SLinus Torvaldsfitmanymiddle: /* Loop if LOOP >= 2 */ 84872f6debSKyle McMartin addib,COND(>) -1, %r31, fitmanymiddle /* Adjusted inner loop decr */ 855035b230SJohn David Anglin pitlbe %r0(%sr1, %r28) 861da177e4SLinus Torvalds pitlbe,m %arg1(%sr1, %r28) /* Last pitlbe and addr adjust */ 87872f6debSKyle McMartin addib,COND(>) -1, %r29, fitmanymiddle /* Middle loop decr */ 881da177e4SLinus Torvalds copy %arg3, %r31 /* Re-init inner loop count */ 891da177e4SLinus Torvalds 901da177e4SLinus Torvalds movb,tr %arg0, %r28, fitmanyloop /* Re-init base addr */ 91872f6debSKyle McMartin addib,COND(<=),n -1, %r22, fitdone /* Outer loop count decr */ 921da177e4SLinus Torvalds 931da177e4SLinus Torvaldsfitoneloop: /* Loop if LOOP = 1 */ 941da177e4SLinus Torvalds mtsp %r20, %sr1 951da177e4SLinus Torvalds copy %arg0, %r28 /* init base addr */ 961da177e4SLinus Torvalds copy %arg2, %r29 /* init middle loop count */ 971da177e4SLinus Torvalds 981da177e4SLinus Torvaldsfitonemiddle: /* Loop if LOOP = 1 */ 99872f6debSKyle McMartin addib,COND(>) -1, %r29, fitonemiddle /* Middle loop count decr */ 1001da177e4SLinus Torvalds pitlbe,m %arg1(%sr1, %r28) /* pitlbe for one loop */ 1011da177e4SLinus Torvalds 102872f6debSKyle McMartin addib,COND(>) -1, %r22, fitoneloop /* Outer loop count decr */ 1031da177e4SLinus Torvalds add %r21, %r20, %r20 /* increment space */ 1041da177e4SLinus Torvalds 1051da177e4SLinus Torvaldsfitdone: 10669245c97SHelge Deller ALTERNATIVE(88b, fitdone, ALT_COND_NO_SPLIT_TLB, INSN_NOP) 1071da177e4SLinus Torvalds 1081da177e4SLinus Torvalds /* Flush Data Tlb */ 1091da177e4SLinus Torvalds 1101da177e4SLinus Torvalds LDREG DTLB_SID_BASE(%r1), %r20 1111da177e4SLinus Torvalds LDREG DTLB_SID_STRIDE(%r1), %r21 1121da177e4SLinus Torvalds LDREG DTLB_SID_COUNT(%r1), %r22 1131da177e4SLinus Torvalds LDREG DTLB_OFF_BASE(%r1), %arg0 1141da177e4SLinus Torvalds LDREG DTLB_OFF_STRIDE(%r1), %arg1 1151da177e4SLinus Torvalds LDREG DTLB_OFF_COUNT(%r1), %arg2 1161da177e4SLinus Torvalds LDREG DTLB_LOOP(%r1), %arg3 1171da177e4SLinus Torvalds 118872f6debSKyle McMartin addib,COND(=) -1, %arg3, fdtoneloop /* Preadjust and test */ 1191da177e4SLinus Torvalds movb,<,n %arg3, %r31, fdtdone /* If loop < 0, skip */ 1201da177e4SLinus Torvalds copy %arg0, %r28 /* Init base addr */ 1211da177e4SLinus Torvalds 1221da177e4SLinus Torvaldsfdtmanyloop: /* Loop if LOOP >= 2 */ 1231da177e4SLinus Torvalds mtsp %r20, %sr1 1241da177e4SLinus Torvalds add %r21, %r20, %r20 /* increment space */ 1251da177e4SLinus Torvalds copy %arg2, %r29 /* Init middle loop count */ 1261da177e4SLinus Torvalds 1271da177e4SLinus Torvaldsfdtmanymiddle: /* Loop if LOOP >= 2 */ 128872f6debSKyle McMartin addib,COND(>) -1, %r31, fdtmanymiddle /* Adjusted inner loop decr */ 1295035b230SJohn David Anglin pdtlbe %r0(%sr1, %r28) 1301da177e4SLinus Torvalds pdtlbe,m %arg1(%sr1, %r28) /* Last pdtlbe and addr adjust */ 131872f6debSKyle McMartin addib,COND(>) -1, %r29, fdtmanymiddle /* Middle loop decr */ 1321da177e4SLinus Torvalds copy %arg3, %r31 /* Re-init inner loop count */ 1331da177e4SLinus Torvalds 1341da177e4SLinus Torvalds movb,tr %arg0, %r28, fdtmanyloop /* Re-init base addr */ 135872f6debSKyle McMartin addib,COND(<=),n -1, %r22,fdtdone /* Outer loop count decr */ 1361da177e4SLinus Torvalds 1371da177e4SLinus Torvaldsfdtoneloop: /* Loop if LOOP = 1 */ 1381da177e4SLinus Torvalds mtsp %r20, %sr1 1391da177e4SLinus Torvalds copy %arg0, %r28 /* init base addr */ 1401da177e4SLinus Torvalds copy %arg2, %r29 /* init middle loop count */ 1411da177e4SLinus Torvalds 1421da177e4SLinus Torvaldsfdtonemiddle: /* Loop if LOOP = 1 */ 143872f6debSKyle McMartin addib,COND(>) -1, %r29, fdtonemiddle /* Middle loop count decr */ 1441da177e4SLinus Torvalds pdtlbe,m %arg1(%sr1, %r28) /* pdtlbe for one loop */ 1451da177e4SLinus Torvalds 146872f6debSKyle McMartin addib,COND(>) -1, %r22, fdtoneloop /* Outer loop count decr */ 1471da177e4SLinus Torvalds add %r21, %r20, %r20 /* increment space */ 1481da177e4SLinus Torvalds 149896a3756SGrant Grundler 1501da177e4SLinus Torvaldsfdtdone: 151896a3756SGrant Grundler /* 152896a3756SGrant Grundler * Switch back to virtual mode 153896a3756SGrant Grundler */ 154896a3756SGrant Grundler /* pcxt_ssm_bug */ 155896a3756SGrant Grundler rsm PSW_SM_I, %r0 156896a3756SGrant Grundler load32 2f, %r1 157896a3756SGrant Grundler nop 158896a3756SGrant Grundler nop 159896a3756SGrant Grundler nop 160896a3756SGrant Grundler nop 161896a3756SGrant Grundler nop 1621da177e4SLinus Torvalds 163896a3756SGrant Grundler rsm PSW_SM_Q, %r0 /* prep to load iia queue */ 1641da177e4SLinus Torvalds mtctl %r0, %cr17 /* Clear IIASQ tail */ 1651da177e4SLinus Torvalds mtctl %r0, %cr17 /* Clear IIASQ head */ 1661da177e4SLinus Torvalds mtctl %r1, %cr18 /* IIAOQ head */ 1671da177e4SLinus Torvalds ldo 4(%r1), %r1 1681da177e4SLinus Torvalds mtctl %r1, %cr18 /* IIAOQ tail */ 169896a3756SGrant Grundler load32 KERNEL_PSW, %r1 170896a3756SGrant Grundler or %r1, %r19, %r1 /* I-bit to state on entry */ 171896a3756SGrant Grundler mtctl %r1, %ipsw /* restore I-bit (entire PSW) */ 1721da177e4SLinus Torvalds rfi 1731da177e4SLinus Torvalds nop 1741da177e4SLinus Torvalds 1751da177e4SLinus Torvalds2: bv %r0(%r2) 1761da177e4SLinus Torvalds nop 177a5ff2130SHelge Deller 178a5ff2130SHelge Deller /* 179a5ff2130SHelge Deller * When running in qemu, drop whole flush_tlb_all_local function and 180a5ff2130SHelge Deller * replace by one pdtlbe instruction, for which QEMU will drop all 181a5ff2130SHelge Deller * local TLB entries. 182a5ff2130SHelge Deller */ 183a5ff2130SHelge Deller3: pdtlbe %r0(%sr1,%r0) 184a5ff2130SHelge Deller bv,n %r0(%r2) 185a5ff2130SHelge Deller ALTERNATIVE_CODE(flush_tlb_all_local, 2, ALT_COND_RUN_ON_QEMU, 3b) 186f39cce65SHelge DellerENDPROC_CFI(flush_tlb_all_local) 1871da177e4SLinus Torvalds 1881da177e4SLinus Torvalds .import cache_info,data 1891da177e4SLinus Torvalds 190f39cce65SHelge DellerENTRY_CFI(flush_instruction_cache_local) 1913847dab7SHelge Deller88: load32 cache_info, %r1 1921da177e4SLinus Torvalds 1931da177e4SLinus Torvalds /* Flush Instruction Cache */ 1941da177e4SLinus Torvalds 1951da177e4SLinus Torvalds LDREG ICACHE_BASE(%r1), %arg0 1961da177e4SLinus Torvalds LDREG ICACHE_STRIDE(%r1), %arg1 1971da177e4SLinus Torvalds LDREG ICACHE_COUNT(%r1), %arg2 1981da177e4SLinus Torvalds LDREG ICACHE_LOOP(%r1), %arg3 1991da177e4SLinus Torvalds rsm PSW_SM_I, %r22 /* No mmgt ops during loop*/ 2006d2ddc2fSJohn David Anglin mtsp %r0, %sr1 201872f6debSKyle McMartin addib,COND(=) -1, %arg3, fioneloop /* Preadjust and test */ 2021da177e4SLinus Torvalds movb,<,n %arg3, %r31, fisync /* If loop < 0, do sync */ 2031da177e4SLinus Torvalds 2041da177e4SLinus Torvaldsfimanyloop: /* Loop if LOOP >= 2 */ 205872f6debSKyle McMartin addib,COND(>) -1, %r31, fimanyloop /* Adjusted inner loop decr */ 2069b3b331dSGrant Grundler fice %r0(%sr1, %arg0) 2071da177e4SLinus Torvalds fice,m %arg1(%sr1, %arg0) /* Last fice and addr adjust */ 2081da177e4SLinus Torvalds movb,tr %arg3, %r31, fimanyloop /* Re-init inner loop count */ 209872f6debSKyle McMartin addib,COND(<=),n -1, %arg2, fisync /* Outer loop decr */ 2101da177e4SLinus Torvalds 2111da177e4SLinus Torvaldsfioneloop: /* Loop if LOOP = 1 */ 2126d2ddc2fSJohn David Anglin /* Some implementations may flush with a single fice instruction */ 2136d2ddc2fSJohn David Anglin cmpib,COND(>>=),n 15, %arg2, fioneloop2 2146d2ddc2fSJohn David Anglin 2156d2ddc2fSJohn David Anglinfioneloop1: 2166d2ddc2fSJohn David Anglin fice,m %arg1(%sr1, %arg0) 2176d2ddc2fSJohn David Anglin fice,m %arg1(%sr1, %arg0) 2186d2ddc2fSJohn David Anglin fice,m %arg1(%sr1, %arg0) 2196d2ddc2fSJohn David Anglin fice,m %arg1(%sr1, %arg0) 2206d2ddc2fSJohn David Anglin fice,m %arg1(%sr1, %arg0) 2216d2ddc2fSJohn David Anglin fice,m %arg1(%sr1, %arg0) 2226d2ddc2fSJohn David Anglin fice,m %arg1(%sr1, %arg0) 2236d2ddc2fSJohn David Anglin fice,m %arg1(%sr1, %arg0) 2246d2ddc2fSJohn David Anglin fice,m %arg1(%sr1, %arg0) 2256d2ddc2fSJohn David Anglin fice,m %arg1(%sr1, %arg0) 2266d2ddc2fSJohn David Anglin fice,m %arg1(%sr1, %arg0) 2276d2ddc2fSJohn David Anglin fice,m %arg1(%sr1, %arg0) 2286d2ddc2fSJohn David Anglin fice,m %arg1(%sr1, %arg0) 2296d2ddc2fSJohn David Anglin fice,m %arg1(%sr1, %arg0) 2306d2ddc2fSJohn David Anglin fice,m %arg1(%sr1, %arg0) 2316d2ddc2fSJohn David Anglin addib,COND(>) -16, %arg2, fioneloop1 2326d2ddc2fSJohn David Anglin fice,m %arg1(%sr1, %arg0) 2336d2ddc2fSJohn David Anglin 2346d2ddc2fSJohn David Anglin /* Check if done */ 2356d2ddc2fSJohn David Anglin cmpb,COND(=),n %arg2, %r0, fisync /* Predict branch taken */ 2366d2ddc2fSJohn David Anglin 2376d2ddc2fSJohn David Anglinfioneloop2: 2386d2ddc2fSJohn David Anglin addib,COND(>) -1, %arg2, fioneloop2 /* Outer loop count decr */ 2391da177e4SLinus Torvalds fice,m %arg1(%sr1, %arg0) /* Fice for one loop */ 2401da177e4SLinus Torvalds 2411da177e4SLinus Torvaldsfisync: 2421da177e4SLinus Torvalds sync 243896a3756SGrant Grundler mtsm %r22 /* restore I-bit */ 2443847dab7SHelge Deller89: ALTERNATIVE(88b, 89b, ALT_COND_NO_ICACHE, INSN_NOP) 2451da177e4SLinus Torvalds bv %r0(%r2) 2461da177e4SLinus Torvalds nop 247f39cce65SHelge DellerENDPROC_CFI(flush_instruction_cache_local) 2481da177e4SLinus Torvalds 2498e9e9844SHelge Deller 2501da177e4SLinus Torvalds .import cache_info, data 251f39cce65SHelge DellerENTRY_CFI(flush_data_cache_local) 2523847dab7SHelge Deller88: load32 cache_info, %r1 2531da177e4SLinus Torvalds 2541da177e4SLinus Torvalds /* Flush Data Cache */ 2551da177e4SLinus Torvalds 2561da177e4SLinus Torvalds LDREG DCACHE_BASE(%r1), %arg0 2571da177e4SLinus Torvalds LDREG DCACHE_STRIDE(%r1), %arg1 2581da177e4SLinus Torvalds LDREG DCACHE_COUNT(%r1), %arg2 2591da177e4SLinus Torvalds LDREG DCACHE_LOOP(%r1), %arg3 2606d2ddc2fSJohn David Anglin rsm PSW_SM_I, %r22 /* No mmgt ops during loop*/ 2616d2ddc2fSJohn David Anglin mtsp %r0, %sr1 262872f6debSKyle McMartin addib,COND(=) -1, %arg3, fdoneloop /* Preadjust and test */ 2631da177e4SLinus Torvalds movb,<,n %arg3, %r31, fdsync /* If loop < 0, do sync */ 2641da177e4SLinus Torvalds 2651da177e4SLinus Torvaldsfdmanyloop: /* Loop if LOOP >= 2 */ 266872f6debSKyle McMartin addib,COND(>) -1, %r31, fdmanyloop /* Adjusted inner loop decr */ 2679b3b331dSGrant Grundler fdce %r0(%sr1, %arg0) 2681da177e4SLinus Torvalds fdce,m %arg1(%sr1, %arg0) /* Last fdce and addr adjust */ 2691da177e4SLinus Torvalds movb,tr %arg3, %r31, fdmanyloop /* Re-init inner loop count */ 270872f6debSKyle McMartin addib,COND(<=),n -1, %arg2, fdsync /* Outer loop decr */ 2711da177e4SLinus Torvalds 2721da177e4SLinus Torvaldsfdoneloop: /* Loop if LOOP = 1 */ 2736d2ddc2fSJohn David Anglin /* Some implementations may flush with a single fdce instruction */ 2746d2ddc2fSJohn David Anglin cmpib,COND(>>=),n 15, %arg2, fdoneloop2 2756d2ddc2fSJohn David Anglin 2766d2ddc2fSJohn David Anglinfdoneloop1: 2776d2ddc2fSJohn David Anglin fdce,m %arg1(%sr1, %arg0) 2786d2ddc2fSJohn David Anglin fdce,m %arg1(%sr1, %arg0) 2796d2ddc2fSJohn David Anglin fdce,m %arg1(%sr1, %arg0) 2806d2ddc2fSJohn David Anglin fdce,m %arg1(%sr1, %arg0) 2816d2ddc2fSJohn David Anglin fdce,m %arg1(%sr1, %arg0) 2826d2ddc2fSJohn David Anglin fdce,m %arg1(%sr1, %arg0) 2836d2ddc2fSJohn David Anglin fdce,m %arg1(%sr1, %arg0) 2846d2ddc2fSJohn David Anglin fdce,m %arg1(%sr1, %arg0) 2856d2ddc2fSJohn David Anglin fdce,m %arg1(%sr1, %arg0) 2866d2ddc2fSJohn David Anglin fdce,m %arg1(%sr1, %arg0) 2876d2ddc2fSJohn David Anglin fdce,m %arg1(%sr1, %arg0) 2886d2ddc2fSJohn David Anglin fdce,m %arg1(%sr1, %arg0) 2896d2ddc2fSJohn David Anglin fdce,m %arg1(%sr1, %arg0) 2906d2ddc2fSJohn David Anglin fdce,m %arg1(%sr1, %arg0) 2916d2ddc2fSJohn David Anglin fdce,m %arg1(%sr1, %arg0) 2926d2ddc2fSJohn David Anglin addib,COND(>) -16, %arg2, fdoneloop1 2936d2ddc2fSJohn David Anglin fdce,m %arg1(%sr1, %arg0) 2946d2ddc2fSJohn David Anglin 2956d2ddc2fSJohn David Anglin /* Check if done */ 2966d2ddc2fSJohn David Anglin cmpb,COND(=),n %arg2, %r0, fdsync /* Predict branch taken */ 2976d2ddc2fSJohn David Anglin 2986d2ddc2fSJohn David Anglinfdoneloop2: 2996d2ddc2fSJohn David Anglin addib,COND(>) -1, %arg2, fdoneloop2 /* Outer loop count decr */ 3001da177e4SLinus Torvalds fdce,m %arg1(%sr1, %arg0) /* Fdce for one loop */ 3011da177e4SLinus Torvalds 3021da177e4SLinus Torvaldsfdsync: 3031da177e4SLinus Torvalds sync 304896a3756SGrant Grundler mtsm %r22 /* restore I-bit */ 3053847dab7SHelge Deller89: ALTERNATIVE(88b, 89b, ALT_COND_NO_DCACHE, INSN_NOP) 3061da177e4SLinus Torvalds bv %r0(%r2) 3071da177e4SLinus Torvalds nop 308f39cce65SHelge DellerENDPROC_CFI(flush_data_cache_local) 3091da177e4SLinus Torvalds 3106d2ddc2fSJohn David Anglin/* Clear page using kernel mapping. */ 3116d2ddc2fSJohn David Anglin 312f39cce65SHelge DellerENTRY_CFI(clear_page_asm) 3136d2ddc2fSJohn David Anglin#ifdef CONFIG_64BIT 3146d2ddc2fSJohn David Anglin 3156d2ddc2fSJohn David Anglin /* Unroll the loop. */ 3166d2ddc2fSJohn David Anglin ldi (PAGE_SIZE / 128), %r1 3176d2ddc2fSJohn David Anglin 3186d2ddc2fSJohn David Anglin1: 3196d2ddc2fSJohn David Anglin std %r0, 0(%r26) 3206d2ddc2fSJohn David Anglin std %r0, 8(%r26) 3216d2ddc2fSJohn David Anglin std %r0, 16(%r26) 3226d2ddc2fSJohn David Anglin std %r0, 24(%r26) 3236d2ddc2fSJohn David Anglin std %r0, 32(%r26) 3246d2ddc2fSJohn David Anglin std %r0, 40(%r26) 3256d2ddc2fSJohn David Anglin std %r0, 48(%r26) 3266d2ddc2fSJohn David Anglin std %r0, 56(%r26) 3276d2ddc2fSJohn David Anglin std %r0, 64(%r26) 3286d2ddc2fSJohn David Anglin std %r0, 72(%r26) 3296d2ddc2fSJohn David Anglin std %r0, 80(%r26) 3306d2ddc2fSJohn David Anglin std %r0, 88(%r26) 3316d2ddc2fSJohn David Anglin std %r0, 96(%r26) 3326d2ddc2fSJohn David Anglin std %r0, 104(%r26) 3336d2ddc2fSJohn David Anglin std %r0, 112(%r26) 3346d2ddc2fSJohn David Anglin std %r0, 120(%r26) 3356d2ddc2fSJohn David Anglin 3366d2ddc2fSJohn David Anglin /* Note reverse branch hint for addib is taken. */ 3376d2ddc2fSJohn David Anglin addib,COND(>),n -1, %r1, 1b 3386d2ddc2fSJohn David Anglin ldo 128(%r26), %r26 3396d2ddc2fSJohn David Anglin 3406d2ddc2fSJohn David Anglin#else 3416d2ddc2fSJohn David Anglin 3426d2ddc2fSJohn David Anglin /* 3436d2ddc2fSJohn David Anglin * Note that until (if) we start saving the full 64-bit register 3446d2ddc2fSJohn David Anglin * values on interrupt, we can't use std on a 32 bit kernel. 3456d2ddc2fSJohn David Anglin */ 3466d2ddc2fSJohn David Anglin ldi (PAGE_SIZE / 64), %r1 3476d2ddc2fSJohn David Anglin 3486d2ddc2fSJohn David Anglin1: 3496d2ddc2fSJohn David Anglin stw %r0, 0(%r26) 3506d2ddc2fSJohn David Anglin stw %r0, 4(%r26) 3516d2ddc2fSJohn David Anglin stw %r0, 8(%r26) 3526d2ddc2fSJohn David Anglin stw %r0, 12(%r26) 3536d2ddc2fSJohn David Anglin stw %r0, 16(%r26) 3546d2ddc2fSJohn David Anglin stw %r0, 20(%r26) 3556d2ddc2fSJohn David Anglin stw %r0, 24(%r26) 3566d2ddc2fSJohn David Anglin stw %r0, 28(%r26) 3576d2ddc2fSJohn David Anglin stw %r0, 32(%r26) 3586d2ddc2fSJohn David Anglin stw %r0, 36(%r26) 3596d2ddc2fSJohn David Anglin stw %r0, 40(%r26) 3606d2ddc2fSJohn David Anglin stw %r0, 44(%r26) 3616d2ddc2fSJohn David Anglin stw %r0, 48(%r26) 3626d2ddc2fSJohn David Anglin stw %r0, 52(%r26) 3636d2ddc2fSJohn David Anglin stw %r0, 56(%r26) 3646d2ddc2fSJohn David Anglin stw %r0, 60(%r26) 3656d2ddc2fSJohn David Anglin 3666d2ddc2fSJohn David Anglin addib,COND(>),n -1, %r1, 1b 3676d2ddc2fSJohn David Anglin ldo 64(%r26), %r26 3686d2ddc2fSJohn David Anglin#endif 3696d2ddc2fSJohn David Anglin bv %r0(%r2) 3706d2ddc2fSJohn David Anglin nop 371f39cce65SHelge DellerENDPROC_CFI(clear_page_asm) 3726d2ddc2fSJohn David Anglin 3736d2ddc2fSJohn David Anglin/* Copy page using kernel mapping. */ 3746d2ddc2fSJohn David Anglin 375f39cce65SHelge DellerENTRY_CFI(copy_page_asm) 376413059f2SGrant Grundler#ifdef CONFIG_64BIT 3771da177e4SLinus Torvalds /* PA8x00 CPUs can consume 2 loads or 1 store per cycle. 3781da177e4SLinus Torvalds * Unroll the loop by hand and arrange insn appropriately. 3796d2ddc2fSJohn David Anglin * Prefetch doesn't improve performance on rp3440. 3806d2ddc2fSJohn David Anglin * GCC probably can do this just as well... 3811da177e4SLinus Torvalds */ 3821da177e4SLinus Torvalds 3836ebeafffSKyle McMartin ldi (PAGE_SIZE / 128), %r1 3842fd83038SHelge Deller 3856d2ddc2fSJohn David Anglin1: ldd 0(%r25), %r19 3866d2ddc2fSJohn David Anglin ldd 8(%r25), %r20 3871da177e4SLinus Torvalds 3881da177e4SLinus Torvalds ldd 16(%r25), %r21 3891da177e4SLinus Torvalds ldd 24(%r25), %r22 3901da177e4SLinus Torvalds std %r19, 0(%r26) 3911da177e4SLinus Torvalds std %r20, 8(%r26) 3921da177e4SLinus Torvalds 3931da177e4SLinus Torvalds ldd 32(%r25), %r19 3941da177e4SLinus Torvalds ldd 40(%r25), %r20 3951da177e4SLinus Torvalds std %r21, 16(%r26) 3961da177e4SLinus Torvalds std %r22, 24(%r26) 3971da177e4SLinus Torvalds 3981da177e4SLinus Torvalds ldd 48(%r25), %r21 3991da177e4SLinus Torvalds ldd 56(%r25), %r22 4001da177e4SLinus Torvalds std %r19, 32(%r26) 4011da177e4SLinus Torvalds std %r20, 40(%r26) 4021da177e4SLinus Torvalds 4031da177e4SLinus Torvalds ldd 64(%r25), %r19 4041da177e4SLinus Torvalds ldd 72(%r25), %r20 4051da177e4SLinus Torvalds std %r21, 48(%r26) 4061da177e4SLinus Torvalds std %r22, 56(%r26) 4071da177e4SLinus Torvalds 4081da177e4SLinus Torvalds ldd 80(%r25), %r21 4091da177e4SLinus Torvalds ldd 88(%r25), %r22 4101da177e4SLinus Torvalds std %r19, 64(%r26) 4111da177e4SLinus Torvalds std %r20, 72(%r26) 4121da177e4SLinus Torvalds 4131da177e4SLinus Torvalds ldd 96(%r25), %r19 4141da177e4SLinus Torvalds ldd 104(%r25), %r20 4151da177e4SLinus Torvalds std %r21, 80(%r26) 4161da177e4SLinus Torvalds std %r22, 88(%r26) 4171da177e4SLinus Torvalds 4181da177e4SLinus Torvalds ldd 112(%r25), %r21 4191da177e4SLinus Torvalds ldd 120(%r25), %r22 4206d2ddc2fSJohn David Anglin ldo 128(%r25), %r25 4211da177e4SLinus Torvalds std %r19, 96(%r26) 4221da177e4SLinus Torvalds std %r20, 104(%r26) 4231da177e4SLinus Torvalds 4241da177e4SLinus Torvalds std %r21, 112(%r26) 4251da177e4SLinus Torvalds std %r22, 120(%r26) 4261da177e4SLinus Torvalds 4276d2ddc2fSJohn David Anglin /* Note reverse branch hint for addib is taken. */ 4286d2ddc2fSJohn David Anglin addib,COND(>),n -1, %r1, 1b 4296d2ddc2fSJohn David Anglin ldo 128(%r26), %r26 4301da177e4SLinus Torvalds 4311da177e4SLinus Torvalds#else 4321da177e4SLinus Torvalds 4331da177e4SLinus Torvalds /* 4341da177e4SLinus Torvalds * This loop is optimized for PCXL/PCXL2 ldw/ldw and stw/stw 4351da177e4SLinus Torvalds * bundles (very restricted rules for bundling). 4361da177e4SLinus Torvalds * Note that until (if) we start saving 4371da177e4SLinus Torvalds * the full 64 bit register values on interrupt, we can't 4381da177e4SLinus Torvalds * use ldd/std on a 32 bit kernel. 4391da177e4SLinus Torvalds */ 44037318a3cSGrant Grundler ldw 0(%r25), %r19 4416ebeafffSKyle McMartin ldi (PAGE_SIZE / 64), %r1 4421da177e4SLinus Torvalds 4431da177e4SLinus Torvalds1: 4441da177e4SLinus Torvalds ldw 4(%r25), %r20 4451da177e4SLinus Torvalds ldw 8(%r25), %r21 4461da177e4SLinus Torvalds ldw 12(%r25), %r22 4471da177e4SLinus Torvalds stw %r19, 0(%r26) 4481da177e4SLinus Torvalds stw %r20, 4(%r26) 4491da177e4SLinus Torvalds stw %r21, 8(%r26) 4501da177e4SLinus Torvalds stw %r22, 12(%r26) 4511da177e4SLinus Torvalds ldw 16(%r25), %r19 4521da177e4SLinus Torvalds ldw 20(%r25), %r20 4531da177e4SLinus Torvalds ldw 24(%r25), %r21 4541da177e4SLinus Torvalds ldw 28(%r25), %r22 4551da177e4SLinus Torvalds stw %r19, 16(%r26) 4561da177e4SLinus Torvalds stw %r20, 20(%r26) 4571da177e4SLinus Torvalds stw %r21, 24(%r26) 4581da177e4SLinus Torvalds stw %r22, 28(%r26) 4591da177e4SLinus Torvalds ldw 32(%r25), %r19 4601da177e4SLinus Torvalds ldw 36(%r25), %r20 4611da177e4SLinus Torvalds ldw 40(%r25), %r21 4621da177e4SLinus Torvalds ldw 44(%r25), %r22 4631da177e4SLinus Torvalds stw %r19, 32(%r26) 4641da177e4SLinus Torvalds stw %r20, 36(%r26) 4651da177e4SLinus Torvalds stw %r21, 40(%r26) 4661da177e4SLinus Torvalds stw %r22, 44(%r26) 4671da177e4SLinus Torvalds ldw 48(%r25), %r19 4681da177e4SLinus Torvalds ldw 52(%r25), %r20 4691da177e4SLinus Torvalds ldw 56(%r25), %r21 4701da177e4SLinus Torvalds ldw 60(%r25), %r22 4711da177e4SLinus Torvalds stw %r19, 48(%r26) 4721da177e4SLinus Torvalds stw %r20, 52(%r26) 47337318a3cSGrant Grundler ldo 64(%r25), %r25 4741da177e4SLinus Torvalds stw %r21, 56(%r26) 4751da177e4SLinus Torvalds stw %r22, 60(%r26) 4761da177e4SLinus Torvalds ldo 64(%r26), %r26 477872f6debSKyle McMartin addib,COND(>),n -1, %r1, 1b 47837318a3cSGrant Grundler ldw 0(%r25), %r19 4791da177e4SLinus Torvalds#endif 4801da177e4SLinus Torvalds bv %r0(%r2) 4811da177e4SLinus Torvalds nop 482f39cce65SHelge DellerENDPROC_CFI(copy_page_asm) 4831da177e4SLinus Torvalds 4841da177e4SLinus Torvalds/* 4851da177e4SLinus Torvalds * NOTE: Code in clear_user_page has a hard coded dependency on the 4861da177e4SLinus Torvalds * maximum alias boundary being 4 Mb. We've been assured by the 4871da177e4SLinus Torvalds * parisc chip designers that there will not ever be a parisc 4881da177e4SLinus Torvalds * chip with a larger alias boundary (Never say never :-) ). 4891da177e4SLinus Torvalds * 490c64c782eSJohn David Anglin * Yah, what about the PA8800 and PA8900 processors? 491c64c782eSJohn David Anglin * 4921da177e4SLinus Torvalds * Subtle: the dtlb miss handlers support the temp alias region by 4931da177e4SLinus Torvalds * "knowing" that if a dtlb miss happens within the temp alias 4941da177e4SLinus Torvalds * region it must have occurred while in clear_user_page. Since 4951da177e4SLinus Torvalds * this routine makes use of processor local translations, we 4961da177e4SLinus Torvalds * don't want to insert them into the kernel page table. Instead, 4971da177e4SLinus Torvalds * we load up some general registers (they need to be registers 4981da177e4SLinus Torvalds * which aren't shadowed) with the physical page numbers (preshifted 4991da177e4SLinus Torvalds * for tlb insertion) needed to insert the translations. When we 5001da177e4SLinus Torvalds * miss on the translation, the dtlb miss handler inserts the 5011da177e4SLinus Torvalds * translation into the tlb using these values: 5021da177e4SLinus Torvalds * 503c1770918SHelge Deller * %r26 physical address of "to" translation 504c1770918SHelge Deller * %r23 physical address of "from" translation 5051da177e4SLinus Torvalds */ 5061da177e4SLinus Torvalds 5071da177e4SLinus Torvalds /* 508910a8643SJohn David Anglin * copy_user_page_asm() performs a page copy using mappings 509910a8643SJohn David Anglin * equivalent to the user page mappings. It can be used to 510910a8643SJohn David Anglin * implement copy_user_page() but unfortunately both the `from' 511910a8643SJohn David Anglin * and `to' pages need to be flushed through mappings equivalent 512910a8643SJohn David Anglin * to the user mappings after the copy because the kernel accesses 513910a8643SJohn David Anglin * the `from' page through the kmap kernel mapping and the `to' 514910a8643SJohn David Anglin * page needs to be flushed since code can be copied. As a 515910a8643SJohn David Anglin * result, this implementation is less efficient than the simpler 516910a8643SJohn David Anglin * copy using the kernel mapping. It only needs the `from' page 517910a8643SJohn David Anglin * to flushed via the user mapping. The kunmap routines handle 518910a8643SJohn David Anglin * the flushes needed for the kernel mapping. 5191da177e4SLinus Torvalds * 5201da177e4SLinus Torvalds * I'm still keeping this around because it may be possible to 5211da177e4SLinus Torvalds * use it if more information is passed into copy_user_page(). 5221da177e4SLinus Torvalds * Have to do some measurements to see if it is worthwhile to 5231da177e4SLinus Torvalds * lobby for such a change. 5246d2ddc2fSJohn David Anglin * 5251da177e4SLinus Torvalds */ 5261da177e4SLinus Torvalds 527f39cce65SHelge DellerENTRY_CFI(copy_user_page_asm) 5286d2ddc2fSJohn David Anglin /* Convert virtual `to' and `from' addresses to physical addresses. 5296d2ddc2fSJohn David Anglin Move `from' physical address to non shadowed register. */ 5301da177e4SLinus Torvalds ldil L%(__PAGE_OFFSET), %r1 5311da177e4SLinus Torvalds sub %r26, %r1, %r26 5326d2ddc2fSJohn David Anglin sub %r25, %r1, %r23 5331da177e4SLinus Torvalds 5341da177e4SLinus Torvalds ldil L%(TMPALIAS_MAP_START), %r28 535c1770918SHelge Deller dep_safe %r24, 31,TMPALIAS_SIZE_BITS, %r28 /* Form aliased virtual address 'to' */ 536c1770918SHelge Deller depi_safe 0, 31,PAGE_SHIFT, %r28 /* Clear any offset bits */ 5371da177e4SLinus Torvalds copy %r28, %r29 538c1770918SHelge Deller depi_safe 1, 31-TMPALIAS_SIZE_BITS,1, %r29 /* Form aliased virtual address 'from' */ 5391da177e4SLinus Torvalds 5401da177e4SLinus Torvalds /* Purge any old translations */ 5411da177e4SLinus Torvalds 5426d2ddc2fSJohn David Anglin#ifdef CONFIG_PA20 5435035b230SJohn David Anglin pdtlb,l %r0(%r28) 5445035b230SJohn David Anglin pdtlb,l %r0(%r29) 5456d2ddc2fSJohn David Anglin#else 5463847dab7SHelge Deller0: pdtlb %r0(%r28) 5473847dab7SHelge Deller1: pdtlb %r0(%r29) 5483847dab7SHelge Deller ALTERNATIVE(0b, 0b+4, ALT_COND_NO_SMP, INSN_PxTLB) 5493847dab7SHelge Deller ALTERNATIVE(1b, 1b+4, ALT_COND_NO_SMP, INSN_PxTLB) 5506d2ddc2fSJohn David Anglin#endif 5511da177e4SLinus Torvalds 5526d2ddc2fSJohn David Anglin#ifdef CONFIG_64BIT 5536d2ddc2fSJohn David Anglin /* PA8x00 CPUs can consume 2 loads or 1 store per cycle. 5546d2ddc2fSJohn David Anglin * Unroll the loop by hand and arrange insn appropriately. 5556d2ddc2fSJohn David Anglin * GCC probably can do this just as well. 5566d2ddc2fSJohn David Anglin */ 5576d2ddc2fSJohn David Anglin 5586d2ddc2fSJohn David Anglin ldd 0(%r29), %r19 5596d2ddc2fSJohn David Anglin ldi (PAGE_SIZE / 128), %r1 5606d2ddc2fSJohn David Anglin 5616d2ddc2fSJohn David Anglin1: ldd 8(%r29), %r20 5626d2ddc2fSJohn David Anglin 5636d2ddc2fSJohn David Anglin ldd 16(%r29), %r21 5646d2ddc2fSJohn David Anglin ldd 24(%r29), %r22 5656d2ddc2fSJohn David Anglin std %r19, 0(%r28) 5666d2ddc2fSJohn David Anglin std %r20, 8(%r28) 5676d2ddc2fSJohn David Anglin 5686d2ddc2fSJohn David Anglin ldd 32(%r29), %r19 5696d2ddc2fSJohn David Anglin ldd 40(%r29), %r20 5706d2ddc2fSJohn David Anglin std %r21, 16(%r28) 5716d2ddc2fSJohn David Anglin std %r22, 24(%r28) 5726d2ddc2fSJohn David Anglin 5736d2ddc2fSJohn David Anglin ldd 48(%r29), %r21 5746d2ddc2fSJohn David Anglin ldd 56(%r29), %r22 5756d2ddc2fSJohn David Anglin std %r19, 32(%r28) 5766d2ddc2fSJohn David Anglin std %r20, 40(%r28) 5776d2ddc2fSJohn David Anglin 5786d2ddc2fSJohn David Anglin ldd 64(%r29), %r19 5796d2ddc2fSJohn David Anglin ldd 72(%r29), %r20 5806d2ddc2fSJohn David Anglin std %r21, 48(%r28) 5816d2ddc2fSJohn David Anglin std %r22, 56(%r28) 5826d2ddc2fSJohn David Anglin 5836d2ddc2fSJohn David Anglin ldd 80(%r29), %r21 5846d2ddc2fSJohn David Anglin ldd 88(%r29), %r22 5856d2ddc2fSJohn David Anglin std %r19, 64(%r28) 5866d2ddc2fSJohn David Anglin std %r20, 72(%r28) 5876d2ddc2fSJohn David Anglin 5886d2ddc2fSJohn David Anglin ldd 96(%r29), %r19 5896d2ddc2fSJohn David Anglin ldd 104(%r29), %r20 5906d2ddc2fSJohn David Anglin std %r21, 80(%r28) 5916d2ddc2fSJohn David Anglin std %r22, 88(%r28) 5926d2ddc2fSJohn David Anglin 5936d2ddc2fSJohn David Anglin ldd 112(%r29), %r21 5946d2ddc2fSJohn David Anglin ldd 120(%r29), %r22 5956d2ddc2fSJohn David Anglin std %r19, 96(%r28) 5966d2ddc2fSJohn David Anglin std %r20, 104(%r28) 5976d2ddc2fSJohn David Anglin 5986d2ddc2fSJohn David Anglin ldo 128(%r29), %r29 5996d2ddc2fSJohn David Anglin std %r21, 112(%r28) 6006d2ddc2fSJohn David Anglin std %r22, 120(%r28) 6016d2ddc2fSJohn David Anglin ldo 128(%r28), %r28 6026d2ddc2fSJohn David Anglin 6036d2ddc2fSJohn David Anglin /* conditional branches nullify on forward taken branch, and on 6046d2ddc2fSJohn David Anglin * non-taken backward branch. Note that .+4 is a backwards branch. 6056d2ddc2fSJohn David Anglin * The ldd should only get executed if the branch is taken. 6066d2ddc2fSJohn David Anglin */ 6076d2ddc2fSJohn David Anglin addib,COND(>),n -1, %r1, 1b /* bundle 10 */ 6086d2ddc2fSJohn David Anglin ldd 0(%r29), %r19 /* start next loads */ 6096d2ddc2fSJohn David Anglin 6106d2ddc2fSJohn David Anglin#else 6116d2ddc2fSJohn David Anglin ldi (PAGE_SIZE / 64), %r1 6121da177e4SLinus Torvalds 6131da177e4SLinus Torvalds /* 6141da177e4SLinus Torvalds * This loop is optimized for PCXL/PCXL2 ldw/ldw and stw/stw 6151da177e4SLinus Torvalds * bundles (very restricted rules for bundling). It probably 6161da177e4SLinus Torvalds * does OK on PCXU and better, but we could do better with 6171da177e4SLinus Torvalds * ldd/std instructions. Note that until (if) we start saving 6181da177e4SLinus Torvalds * the full 64 bit register values on interrupt, we can't 6191da177e4SLinus Torvalds * use ldd/std on a 32 bit kernel. 6201da177e4SLinus Torvalds */ 6211da177e4SLinus Torvalds 6226d2ddc2fSJohn David Anglin1: ldw 0(%r29), %r19 6231da177e4SLinus Torvalds ldw 4(%r29), %r20 6241da177e4SLinus Torvalds ldw 8(%r29), %r21 6251da177e4SLinus Torvalds ldw 12(%r29), %r22 6261da177e4SLinus Torvalds stw %r19, 0(%r28) 6271da177e4SLinus Torvalds stw %r20, 4(%r28) 6281da177e4SLinus Torvalds stw %r21, 8(%r28) 6291da177e4SLinus Torvalds stw %r22, 12(%r28) 6301da177e4SLinus Torvalds ldw 16(%r29), %r19 6311da177e4SLinus Torvalds ldw 20(%r29), %r20 6321da177e4SLinus Torvalds ldw 24(%r29), %r21 6331da177e4SLinus Torvalds ldw 28(%r29), %r22 6341da177e4SLinus Torvalds stw %r19, 16(%r28) 6351da177e4SLinus Torvalds stw %r20, 20(%r28) 6361da177e4SLinus Torvalds stw %r21, 24(%r28) 6371da177e4SLinus Torvalds stw %r22, 28(%r28) 6381da177e4SLinus Torvalds ldw 32(%r29), %r19 6391da177e4SLinus Torvalds ldw 36(%r29), %r20 6401da177e4SLinus Torvalds ldw 40(%r29), %r21 6411da177e4SLinus Torvalds ldw 44(%r29), %r22 6421da177e4SLinus Torvalds stw %r19, 32(%r28) 6431da177e4SLinus Torvalds stw %r20, 36(%r28) 6441da177e4SLinus Torvalds stw %r21, 40(%r28) 6451da177e4SLinus Torvalds stw %r22, 44(%r28) 6461da177e4SLinus Torvalds ldw 48(%r29), %r19 6471da177e4SLinus Torvalds ldw 52(%r29), %r20 6481da177e4SLinus Torvalds ldw 56(%r29), %r21 6491da177e4SLinus Torvalds ldw 60(%r29), %r22 6501da177e4SLinus Torvalds stw %r19, 48(%r28) 6511da177e4SLinus Torvalds stw %r20, 52(%r28) 6521da177e4SLinus Torvalds stw %r21, 56(%r28) 6531da177e4SLinus Torvalds stw %r22, 60(%r28) 6541da177e4SLinus Torvalds ldo 64(%r28), %r28 6556d2ddc2fSJohn David Anglin 656872f6debSKyle McMartin addib,COND(>) -1, %r1,1b 6571da177e4SLinus Torvalds ldo 64(%r29), %r29 6586d2ddc2fSJohn David Anglin#endif 6591da177e4SLinus Torvalds 6601da177e4SLinus Torvalds bv %r0(%r2) 6611da177e4SLinus Torvalds nop 662f39cce65SHelge DellerENDPROC_CFI(copy_user_page_asm) 6631da177e4SLinus Torvalds 664f39cce65SHelge DellerENTRY_CFI(clear_user_page_asm) 6651da177e4SLinus Torvalds tophys_r1 %r26 6661da177e4SLinus Torvalds 6671da177e4SLinus Torvalds ldil L%(TMPALIAS_MAP_START), %r28 668c1770918SHelge Deller dep_safe %r25, 31,TMPALIAS_SIZE_BITS, %r28 /* Form aliased virtual address 'to' */ 669c1770918SHelge Deller depi_safe 0, 31,PAGE_SHIFT, %r28 /* Clear any offset bits */ 6701da177e4SLinus Torvalds 6711da177e4SLinus Torvalds /* Purge any old translation */ 6721da177e4SLinus Torvalds 6736d2ddc2fSJohn David Anglin#ifdef CONFIG_PA20 6745035b230SJohn David Anglin pdtlb,l %r0(%r28) 6756d2ddc2fSJohn David Anglin#else 6763847dab7SHelge Deller0: pdtlb %r0(%r28) 6773847dab7SHelge Deller ALTERNATIVE(0b, 0b+4, ALT_COND_NO_SMP, INSN_PxTLB) 6786d2ddc2fSJohn David Anglin#endif 6791da177e4SLinus Torvalds 680413059f2SGrant Grundler#ifdef CONFIG_64BIT 6816ebeafffSKyle McMartin ldi (PAGE_SIZE / 128), %r1 6821da177e4SLinus Torvalds 6831da177e4SLinus Torvalds /* PREFETCH (Write) has not (yet) been proven to help here */ 6841da177e4SLinus Torvalds /* #define PREFETCHW_OP ldd 256(%0), %r0 */ 6851da177e4SLinus Torvalds 6861da177e4SLinus Torvalds1: std %r0, 0(%r28) 6871da177e4SLinus Torvalds std %r0, 8(%r28) 6881da177e4SLinus Torvalds std %r0, 16(%r28) 6891da177e4SLinus Torvalds std %r0, 24(%r28) 6901da177e4SLinus Torvalds std %r0, 32(%r28) 6911da177e4SLinus Torvalds std %r0, 40(%r28) 6921da177e4SLinus Torvalds std %r0, 48(%r28) 6931da177e4SLinus Torvalds std %r0, 56(%r28) 6941da177e4SLinus Torvalds std %r0, 64(%r28) 6951da177e4SLinus Torvalds std %r0, 72(%r28) 6961da177e4SLinus Torvalds std %r0, 80(%r28) 6971da177e4SLinus Torvalds std %r0, 88(%r28) 6981da177e4SLinus Torvalds std %r0, 96(%r28) 6991da177e4SLinus Torvalds std %r0, 104(%r28) 7001da177e4SLinus Torvalds std %r0, 112(%r28) 7011da177e4SLinus Torvalds std %r0, 120(%r28) 702872f6debSKyle McMartin addib,COND(>) -1, %r1, 1b 7031da177e4SLinus Torvalds ldo 128(%r28), %r28 7041da177e4SLinus Torvalds 705413059f2SGrant Grundler#else /* ! CONFIG_64BIT */ 7066ebeafffSKyle McMartin ldi (PAGE_SIZE / 64), %r1 7071da177e4SLinus Torvalds 7086d2ddc2fSJohn David Anglin1: stw %r0, 0(%r28) 7091da177e4SLinus Torvalds stw %r0, 4(%r28) 7101da177e4SLinus Torvalds stw %r0, 8(%r28) 7111da177e4SLinus Torvalds stw %r0, 12(%r28) 7121da177e4SLinus Torvalds stw %r0, 16(%r28) 7131da177e4SLinus Torvalds stw %r0, 20(%r28) 7141da177e4SLinus Torvalds stw %r0, 24(%r28) 7151da177e4SLinus Torvalds stw %r0, 28(%r28) 7161da177e4SLinus Torvalds stw %r0, 32(%r28) 7171da177e4SLinus Torvalds stw %r0, 36(%r28) 7181da177e4SLinus Torvalds stw %r0, 40(%r28) 7191da177e4SLinus Torvalds stw %r0, 44(%r28) 7201da177e4SLinus Torvalds stw %r0, 48(%r28) 7211da177e4SLinus Torvalds stw %r0, 52(%r28) 7221da177e4SLinus Torvalds stw %r0, 56(%r28) 7231da177e4SLinus Torvalds stw %r0, 60(%r28) 724872f6debSKyle McMartin addib,COND(>) -1, %r1, 1b 7251da177e4SLinus Torvalds ldo 64(%r28), %r28 726413059f2SGrant Grundler#endif /* CONFIG_64BIT */ 7271da177e4SLinus Torvalds 7281da177e4SLinus Torvalds bv %r0(%r2) 7291da177e4SLinus Torvalds nop 730f39cce65SHelge DellerENDPROC_CFI(clear_user_page_asm) 7311da177e4SLinus Torvalds 732f39cce65SHelge DellerENTRY_CFI(flush_dcache_page_asm) 733f311847cSJames Bottomley ldil L%(TMPALIAS_MAP_START), %r28 734c1770918SHelge Deller dep_safe %r25, 31,TMPALIAS_SIZE_BITS, %r28 /* Form aliased virtual address 'to' */ 735c1770918SHelge Deller depi_safe 0, 31,PAGE_SHIFT, %r28 /* Clear any offset bits */ 736f311847cSJames Bottomley 737f311847cSJames Bottomley /* Purge any old translation */ 738f311847cSJames Bottomley 7396d2ddc2fSJohn David Anglin#ifdef CONFIG_PA20 7405035b230SJohn David Anglin pdtlb,l %r0(%r28) 7416d2ddc2fSJohn David Anglin#else 7423847dab7SHelge Deller0: pdtlb %r0(%r28) 7433847dab7SHelge Deller ALTERNATIVE(0b, 0b+4, ALT_COND_NO_SMP, INSN_PxTLB) 7446d2ddc2fSJohn David Anglin#endif 745f311847cSJames Bottomley 7463847dab7SHelge Deller88: ldil L%dcache_stride, %r1 747d65ea48dSJohn David Anglin ldw R%dcache_stride(%r1), r31 748f311847cSJames Bottomley 749f311847cSJames Bottomley#ifdef CONFIG_64BIT 750f311847cSJames Bottomley depdi,z 1, 63-PAGE_SHIFT,1, %r25 751f311847cSJames Bottomley#else 752f311847cSJames Bottomley depwi,z 1, 31-PAGE_SHIFT,1, %r25 753f311847cSJames Bottomley#endif 754f311847cSJames Bottomley add %r28, %r25, %r25 755d65ea48dSJohn David Anglin sub %r25, r31, %r25 756f311847cSJames Bottomley 757d65ea48dSJohn David Anglin1: fdc,m r31(%r28) 758d65ea48dSJohn David Anglin fdc,m r31(%r28) 759d65ea48dSJohn David Anglin fdc,m r31(%r28) 760d65ea48dSJohn David Anglin fdc,m r31(%r28) 761d65ea48dSJohn David Anglin fdc,m r31(%r28) 762d65ea48dSJohn David Anglin fdc,m r31(%r28) 763d65ea48dSJohn David Anglin fdc,m r31(%r28) 764d65ea48dSJohn David Anglin fdc,m r31(%r28) 765d65ea48dSJohn David Anglin fdc,m r31(%r28) 766d65ea48dSJohn David Anglin fdc,m r31(%r28) 767d65ea48dSJohn David Anglin fdc,m r31(%r28) 768d65ea48dSJohn David Anglin fdc,m r31(%r28) 769d65ea48dSJohn David Anglin fdc,m r31(%r28) 770d65ea48dSJohn David Anglin fdc,m r31(%r28) 771d65ea48dSJohn David Anglin fdc,m r31(%r28) 7724c5fe5dbSJohn David Anglin cmpb,COND(>>) %r25, %r28, 1b /* predict taken */ 773d65ea48dSJohn David Anglin fdc,m r31(%r28) 774f311847cSJames Bottomley 7753847dab7SHelge Deller89: ALTERNATIVE(88b, 89b, ALT_COND_NO_DCACHE, INSN_NOP) 776f311847cSJames Bottomley sync 777f311847cSJames Bottomley bv %r0(%r2) 7786d2ddc2fSJohn David Anglin nop 779f39cce65SHelge DellerENDPROC_CFI(flush_dcache_page_asm) 780f311847cSJames Bottomley 7814c5fe5dbSJohn David AnglinENTRY_CFI(purge_dcache_page_asm) 7824c5fe5dbSJohn David Anglin ldil L%(TMPALIAS_MAP_START), %r28 783c1770918SHelge Deller dep_safe %r25, 31,TMPALIAS_SIZE_BITS, %r28 /* Form aliased virtual address 'to' */ 784c1770918SHelge Deller depi_safe 0, 31,PAGE_SHIFT, %r28 /* Clear any offset bits */ 7854c5fe5dbSJohn David Anglin 7864c5fe5dbSJohn David Anglin /* Purge any old translation */ 7874c5fe5dbSJohn David Anglin 7884c5fe5dbSJohn David Anglin#ifdef CONFIG_PA20 7894c5fe5dbSJohn David Anglin pdtlb,l %r0(%r28) 7904c5fe5dbSJohn David Anglin#else 7914c5fe5dbSJohn David Anglin0: pdtlb %r0(%r28) 7924c5fe5dbSJohn David Anglin ALTERNATIVE(0b, 0b+4, ALT_COND_NO_SMP, INSN_PxTLB) 7934c5fe5dbSJohn David Anglin#endif 7944c5fe5dbSJohn David Anglin 7954c5fe5dbSJohn David Anglin88: ldil L%dcache_stride, %r1 7964c5fe5dbSJohn David Anglin ldw R%dcache_stride(%r1), r31 7974c5fe5dbSJohn David Anglin 7984c5fe5dbSJohn David Anglin#ifdef CONFIG_64BIT 7994c5fe5dbSJohn David Anglin depdi,z 1, 63-PAGE_SHIFT,1, %r25 8004c5fe5dbSJohn David Anglin#else 8014c5fe5dbSJohn David Anglin depwi,z 1, 31-PAGE_SHIFT,1, %r25 8024c5fe5dbSJohn David Anglin#endif 8034c5fe5dbSJohn David Anglin add %r28, %r25, %r25 8044c5fe5dbSJohn David Anglin sub %r25, r31, %r25 8054c5fe5dbSJohn David Anglin 8064c5fe5dbSJohn David Anglin1: pdc,m r31(%r28) 8074c5fe5dbSJohn David Anglin pdc,m r31(%r28) 8084c5fe5dbSJohn David Anglin pdc,m r31(%r28) 8094c5fe5dbSJohn David Anglin pdc,m r31(%r28) 8104c5fe5dbSJohn David Anglin pdc,m r31(%r28) 8114c5fe5dbSJohn David Anglin pdc,m r31(%r28) 8124c5fe5dbSJohn David Anglin pdc,m r31(%r28) 8134c5fe5dbSJohn David Anglin pdc,m r31(%r28) 8144c5fe5dbSJohn David Anglin pdc,m r31(%r28) 8154c5fe5dbSJohn David Anglin pdc,m r31(%r28) 8164c5fe5dbSJohn David Anglin pdc,m r31(%r28) 8174c5fe5dbSJohn David Anglin pdc,m r31(%r28) 8184c5fe5dbSJohn David Anglin pdc,m r31(%r28) 8194c5fe5dbSJohn David Anglin pdc,m r31(%r28) 8204c5fe5dbSJohn David Anglin pdc,m r31(%r28) 8214c5fe5dbSJohn David Anglin cmpb,COND(>>) %r25, %r28, 1b /* predict taken */ 8224c5fe5dbSJohn David Anglin pdc,m r31(%r28) 8234c5fe5dbSJohn David Anglin 8244c5fe5dbSJohn David Anglin89: ALTERNATIVE(88b, 89b, ALT_COND_NO_DCACHE, INSN_NOP) 8254c5fe5dbSJohn David Anglin sync 8264c5fe5dbSJohn David Anglin bv %r0(%r2) 8274c5fe5dbSJohn David Anglin nop 8284c5fe5dbSJohn David AnglinENDPROC_CFI(purge_dcache_page_asm) 8294c5fe5dbSJohn David Anglin 830f39cce65SHelge DellerENTRY_CFI(flush_icache_page_asm) 831f311847cSJames Bottomley ldil L%(TMPALIAS_MAP_START), %r28 832c1770918SHelge Deller dep_safe %r25, 31,TMPALIAS_SIZE_BITS, %r28 /* Form aliased virtual address 'to' */ 833c1770918SHelge Deller depi_safe 0, 31,PAGE_SHIFT, %r28 /* Clear any offset bits */ 834f311847cSJames Bottomley 8355035b230SJohn David Anglin /* Purge any old translation. Note that the FIC instruction 8365035b230SJohn David Anglin * may use either the instruction or data TLB. Given that we 8375035b230SJohn David Anglin * have a flat address space, it's not clear which TLB will be 8385035b230SJohn David Anglin * used. So, we purge both entries. */ 839f311847cSJames Bottomley 8406d2ddc2fSJohn David Anglin#ifdef CONFIG_PA20 8415035b230SJohn David Anglin pdtlb,l %r0(%r28) 8423847dab7SHelge Deller1: pitlb,l %r0(%sr4,%r28) 8433847dab7SHelge Deller ALTERNATIVE(1b, 1b+4, ALT_COND_NO_SPLIT_TLB, INSN_NOP) 8446d2ddc2fSJohn David Anglin#else 8453847dab7SHelge Deller0: pdtlb %r0(%r28) 8463847dab7SHelge Deller1: pitlb %r0(%sr4,%r28) 8473847dab7SHelge Deller ALTERNATIVE(0b, 0b+4, ALT_COND_NO_SMP, INSN_PxTLB) 8483847dab7SHelge Deller ALTERNATIVE(1b, 1b+4, ALT_COND_NO_SMP, INSN_PxTLB) 8493847dab7SHelge Deller ALTERNATIVE(1b, 1b+4, ALT_COND_NO_SPLIT_TLB, INSN_NOP) 8506d2ddc2fSJohn David Anglin#endif 851f311847cSJames Bottomley 8523847dab7SHelge Deller88: ldil L%icache_stride, %r1 853d65ea48dSJohn David Anglin ldw R%icache_stride(%r1), %r31 854f311847cSJames Bottomley 855f311847cSJames Bottomley#ifdef CONFIG_64BIT 856f311847cSJames Bottomley depdi,z 1, 63-PAGE_SHIFT,1, %r25 857f311847cSJames Bottomley#else 858f311847cSJames Bottomley depwi,z 1, 31-PAGE_SHIFT,1, %r25 859f311847cSJames Bottomley#endif 860f311847cSJames Bottomley add %r28, %r25, %r25 861d65ea48dSJohn David Anglin sub %r25, %r31, %r25 862f311847cSJames Bottomley 863207f583dSJohn David Anglin /* fic only has the type 26 form on PA1.1, requiring an 864207f583dSJohn David Anglin * explicit space specification, so use %sr4 */ 865d65ea48dSJohn David Anglin1: fic,m %r31(%sr4,%r28) 866d65ea48dSJohn David Anglin fic,m %r31(%sr4,%r28) 867d65ea48dSJohn David Anglin fic,m %r31(%sr4,%r28) 868d65ea48dSJohn David Anglin fic,m %r31(%sr4,%r28) 869d65ea48dSJohn David Anglin fic,m %r31(%sr4,%r28) 870d65ea48dSJohn David Anglin fic,m %r31(%sr4,%r28) 871d65ea48dSJohn David Anglin fic,m %r31(%sr4,%r28) 872d65ea48dSJohn David Anglin fic,m %r31(%sr4,%r28) 873d65ea48dSJohn David Anglin fic,m %r31(%sr4,%r28) 874d65ea48dSJohn David Anglin fic,m %r31(%sr4,%r28) 875d65ea48dSJohn David Anglin fic,m %r31(%sr4,%r28) 876d65ea48dSJohn David Anglin fic,m %r31(%sr4,%r28) 877d65ea48dSJohn David Anglin fic,m %r31(%sr4,%r28) 878d65ea48dSJohn David Anglin fic,m %r31(%sr4,%r28) 879d65ea48dSJohn David Anglin fic,m %r31(%sr4,%r28) 8804c5fe5dbSJohn David Anglin cmpb,COND(>>) %r25, %r28, 1b /* predict taken */ 881d65ea48dSJohn David Anglin fic,m %r31(%sr4,%r28) 882f311847cSJames Bottomley 8833847dab7SHelge Deller89: ALTERNATIVE(88b, 89b, ALT_COND_NO_ICACHE, INSN_NOP) 884f311847cSJames Bottomley sync 8856d2ddc2fSJohn David Anglin bv %r0(%r2) 8866d2ddc2fSJohn David Anglin nop 887f39cce65SHelge DellerENDPROC_CFI(flush_icache_page_asm) 888f311847cSJames Bottomley 889f39cce65SHelge DellerENTRY_CFI(flush_kernel_dcache_page_asm) 8903847dab7SHelge Deller88: ldil L%dcache_stride, %r1 8911da177e4SLinus Torvalds ldw R%dcache_stride(%r1), %r23 892*d755bd2cSHelge Deller depi_safe 0, 31,PAGE_SHIFT, %r26 /* Clear any offset bits */ 8931da177e4SLinus Torvalds 894413059f2SGrant Grundler#ifdef CONFIG_64BIT 8951da177e4SLinus Torvalds depdi,z 1, 63-PAGE_SHIFT,1, %r25 8961da177e4SLinus Torvalds#else 8971da177e4SLinus Torvalds depwi,z 1, 31-PAGE_SHIFT,1, %r25 8981da177e4SLinus Torvalds#endif 8991da177e4SLinus Torvalds add %r26, %r25, %r25 9001da177e4SLinus Torvalds sub %r25, %r23, %r25 9011da177e4SLinus Torvalds 9021da177e4SLinus Torvalds1: fdc,m %r23(%r26) 9031da177e4SLinus Torvalds fdc,m %r23(%r26) 9041da177e4SLinus Torvalds fdc,m %r23(%r26) 9051da177e4SLinus Torvalds fdc,m %r23(%r26) 9061da177e4SLinus Torvalds fdc,m %r23(%r26) 9071da177e4SLinus Torvalds fdc,m %r23(%r26) 9081da177e4SLinus Torvalds fdc,m %r23(%r26) 9091da177e4SLinus Torvalds fdc,m %r23(%r26) 9101da177e4SLinus Torvalds fdc,m %r23(%r26) 9111da177e4SLinus Torvalds fdc,m %r23(%r26) 9121da177e4SLinus Torvalds fdc,m %r23(%r26) 9131da177e4SLinus Torvalds fdc,m %r23(%r26) 9141da177e4SLinus Torvalds fdc,m %r23(%r26) 9151da177e4SLinus Torvalds fdc,m %r23(%r26) 9161da177e4SLinus Torvalds fdc,m %r23(%r26) 9174c5fe5dbSJohn David Anglin cmpb,COND(>>) %r25, %r26, 1b /* predict taken */ 9181da177e4SLinus Torvalds fdc,m %r23(%r26) 9191da177e4SLinus Torvalds 9203847dab7SHelge Deller89: ALTERNATIVE(88b, 89b, ALT_COND_NO_DCACHE, INSN_NOP) 9211da177e4SLinus Torvalds sync 9221da177e4SLinus Torvalds bv %r0(%r2) 9231da177e4SLinus Torvalds nop 924f39cce65SHelge DellerENDPROC_CFI(flush_kernel_dcache_page_asm) 9251da177e4SLinus Torvalds 926f39cce65SHelge DellerENTRY_CFI(purge_kernel_dcache_page_asm) 9273847dab7SHelge Deller88: ldil L%dcache_stride, %r1 9281da177e4SLinus Torvalds ldw R%dcache_stride(%r1), %r23 929*d755bd2cSHelge Deller depi_safe 0, 31,PAGE_SHIFT, %r26 /* Clear any offset bits */ 9301da177e4SLinus Torvalds 931413059f2SGrant Grundler#ifdef CONFIG_64BIT 9321da177e4SLinus Torvalds depdi,z 1, 63-PAGE_SHIFT,1, %r25 9331da177e4SLinus Torvalds#else 9341da177e4SLinus Torvalds depwi,z 1, 31-PAGE_SHIFT,1, %r25 9351da177e4SLinus Torvalds#endif 9361da177e4SLinus Torvalds add %r26, %r25, %r25 9371da177e4SLinus Torvalds sub %r25, %r23, %r25 9381da177e4SLinus Torvalds 9391da177e4SLinus Torvalds1: pdc,m %r23(%r26) 9401da177e4SLinus Torvalds pdc,m %r23(%r26) 9411da177e4SLinus Torvalds pdc,m %r23(%r26) 9421da177e4SLinus Torvalds pdc,m %r23(%r26) 9431da177e4SLinus Torvalds pdc,m %r23(%r26) 9441da177e4SLinus Torvalds pdc,m %r23(%r26) 9451da177e4SLinus Torvalds pdc,m %r23(%r26) 9461da177e4SLinus Torvalds pdc,m %r23(%r26) 9471da177e4SLinus Torvalds pdc,m %r23(%r26) 9481da177e4SLinus Torvalds pdc,m %r23(%r26) 9491da177e4SLinus Torvalds pdc,m %r23(%r26) 9501da177e4SLinus Torvalds pdc,m %r23(%r26) 9511da177e4SLinus Torvalds pdc,m %r23(%r26) 9521da177e4SLinus Torvalds pdc,m %r23(%r26) 9531da177e4SLinus Torvalds pdc,m %r23(%r26) 9544c5fe5dbSJohn David Anglin cmpb,COND(>>) %r25, %r26, 1b /* predict taken */ 9551da177e4SLinus Torvalds pdc,m %r23(%r26) 9561da177e4SLinus Torvalds 9573847dab7SHelge Deller89: ALTERNATIVE(88b, 89b, ALT_COND_NO_DCACHE, INSN_NOP) 9581da177e4SLinus Torvalds sync 9591da177e4SLinus Torvalds bv %r0(%r2) 9601da177e4SLinus Torvalds nop 961f39cce65SHelge DellerENDPROC_CFI(purge_kernel_dcache_page_asm) 9621da177e4SLinus Torvalds 963f39cce65SHelge DellerENTRY_CFI(flush_user_dcache_range_asm) 9643847dab7SHelge Deller88: ldil L%dcache_stride, %r1 9651da177e4SLinus Torvalds ldw R%dcache_stride(%r1), %r23 9661da177e4SLinus Torvalds ldo -1(%r23), %r21 9671da177e4SLinus Torvalds ANDCM %r26, %r21, %r26 9681da177e4SLinus Torvalds 9694c5fe5dbSJohn David Anglin#ifdef CONFIG_64BIT 9704c5fe5dbSJohn David Anglin depd,z %r23, 59, 60, %r21 9714c5fe5dbSJohn David Anglin#else 9724c5fe5dbSJohn David Anglin depw,z %r23, 27, 28, %r21 9734c5fe5dbSJohn David Anglin#endif 9744c5fe5dbSJohn David Anglin add %r26, %r21, %r22 9754c5fe5dbSJohn David Anglin cmpb,COND(>>),n %r22, %r25, 2f /* predict not taken */ 9764c5fe5dbSJohn David Anglin1: add %r22, %r21, %r22 9774c5fe5dbSJohn David Anglin fdc,m %r23(%sr3, %r26) 9784c5fe5dbSJohn David Anglin fdc,m %r23(%sr3, %r26) 9794c5fe5dbSJohn David Anglin fdc,m %r23(%sr3, %r26) 9804c5fe5dbSJohn David Anglin fdc,m %r23(%sr3, %r26) 9814c5fe5dbSJohn David Anglin fdc,m %r23(%sr3, %r26) 9824c5fe5dbSJohn David Anglin fdc,m %r23(%sr3, %r26) 9834c5fe5dbSJohn David Anglin fdc,m %r23(%sr3, %r26) 9844c5fe5dbSJohn David Anglin fdc,m %r23(%sr3, %r26) 9854c5fe5dbSJohn David Anglin fdc,m %r23(%sr3, %r26) 9864c5fe5dbSJohn David Anglin fdc,m %r23(%sr3, %r26) 9874c5fe5dbSJohn David Anglin fdc,m %r23(%sr3, %r26) 9884c5fe5dbSJohn David Anglin fdc,m %r23(%sr3, %r26) 9894c5fe5dbSJohn David Anglin fdc,m %r23(%sr3, %r26) 9904c5fe5dbSJohn David Anglin fdc,m %r23(%sr3, %r26) 9914c5fe5dbSJohn David Anglin fdc,m %r23(%sr3, %r26) 9924c5fe5dbSJohn David Anglin cmpb,COND(<<=) %r22, %r25, 1b /* predict taken */ 9934c5fe5dbSJohn David Anglin fdc,m %r23(%sr3, %r26) 9944c5fe5dbSJohn David Anglin 9954c5fe5dbSJohn David Anglin2: cmpb,COND(>>),n %r25, %r26, 2b 9961da177e4SLinus Torvalds fdc,m %r23(%sr3, %r26) 9971da177e4SLinus Torvalds 9983847dab7SHelge Deller89: ALTERNATIVE(88b, 89b, ALT_COND_NO_DCACHE, INSN_NOP) 9991da177e4SLinus Torvalds sync 10001da177e4SLinus Torvalds bv %r0(%r2) 10011da177e4SLinus Torvalds nop 1002f39cce65SHelge DellerENDPROC_CFI(flush_user_dcache_range_asm) 10031da177e4SLinus Torvalds 1004f39cce65SHelge DellerENTRY_CFI(flush_kernel_dcache_range_asm) 10053847dab7SHelge Deller88: ldil L%dcache_stride, %r1 10061da177e4SLinus Torvalds ldw R%dcache_stride(%r1), %r23 10071da177e4SLinus Torvalds ldo -1(%r23), %r21 10081da177e4SLinus Torvalds ANDCM %r26, %r21, %r26 10091da177e4SLinus Torvalds 10104c5fe5dbSJohn David Anglin#ifdef CONFIG_64BIT 10114c5fe5dbSJohn David Anglin depd,z %r23, 59, 60, %r21 10124c5fe5dbSJohn David Anglin#else 10134c5fe5dbSJohn David Anglin depw,z %r23, 27, 28, %r21 10144c5fe5dbSJohn David Anglin#endif 10154c5fe5dbSJohn David Anglin add %r26, %r21, %r22 10164c5fe5dbSJohn David Anglin cmpb,COND(>>),n %r22, %r25, 2f /* predict not taken */ 10174c5fe5dbSJohn David Anglin1: add %r22, %r21, %r22 10184c5fe5dbSJohn David Anglin fdc,m %r23(%r26) 10194c5fe5dbSJohn David Anglin fdc,m %r23(%r26) 10204c5fe5dbSJohn David Anglin fdc,m %r23(%r26) 10214c5fe5dbSJohn David Anglin fdc,m %r23(%r26) 10224c5fe5dbSJohn David Anglin fdc,m %r23(%r26) 10234c5fe5dbSJohn David Anglin fdc,m %r23(%r26) 10244c5fe5dbSJohn David Anglin fdc,m %r23(%r26) 10254c5fe5dbSJohn David Anglin fdc,m %r23(%r26) 10264c5fe5dbSJohn David Anglin fdc,m %r23(%r26) 10274c5fe5dbSJohn David Anglin fdc,m %r23(%r26) 10284c5fe5dbSJohn David Anglin fdc,m %r23(%r26) 10294c5fe5dbSJohn David Anglin fdc,m %r23(%r26) 10304c5fe5dbSJohn David Anglin fdc,m %r23(%r26) 10314c5fe5dbSJohn David Anglin fdc,m %r23(%r26) 10324c5fe5dbSJohn David Anglin fdc,m %r23(%r26) 10334c5fe5dbSJohn David Anglin cmpb,COND(<<=) %r22, %r25, 1b /* predict taken */ 10344c5fe5dbSJohn David Anglin fdc,m %r23(%r26) 10354c5fe5dbSJohn David Anglin 10364c5fe5dbSJohn David Anglin2: cmpb,COND(>>),n %r25, %r26, 2b /* predict taken */ 10371da177e4SLinus Torvalds fdc,m %r23(%r26) 10381da177e4SLinus Torvalds 10391da177e4SLinus Torvalds sync 10403847dab7SHelge Deller89: ALTERNATIVE(88b, 89b, ALT_COND_NO_DCACHE, INSN_NOP) 10411da177e4SLinus Torvalds bv %r0(%r2) 10421da177e4SLinus Torvalds nop 1043f39cce65SHelge DellerENDPROC_CFI(flush_kernel_dcache_range_asm) 10441da177e4SLinus Torvalds 10450adb24e0SJohn David AnglinENTRY_CFI(purge_kernel_dcache_range_asm) 10463847dab7SHelge Deller88: ldil L%dcache_stride, %r1 10470adb24e0SJohn David Anglin ldw R%dcache_stride(%r1), %r23 10480adb24e0SJohn David Anglin ldo -1(%r23), %r21 10490adb24e0SJohn David Anglin ANDCM %r26, %r21, %r26 10500adb24e0SJohn David Anglin 10514c5fe5dbSJohn David Anglin#ifdef CONFIG_64BIT 10524c5fe5dbSJohn David Anglin depd,z %r23, 59, 60, %r21 10534c5fe5dbSJohn David Anglin#else 10544c5fe5dbSJohn David Anglin depw,z %r23, 27, 28, %r21 10554c5fe5dbSJohn David Anglin#endif 10564c5fe5dbSJohn David Anglin add %r26, %r21, %r22 10574c5fe5dbSJohn David Anglin cmpb,COND(>>),n %r22, %r25, 2f /* predict not taken */ 10584c5fe5dbSJohn David Anglin1: add %r22, %r21, %r22 10594c5fe5dbSJohn David Anglin pdc,m %r23(%r26) 10604c5fe5dbSJohn David Anglin pdc,m %r23(%r26) 10614c5fe5dbSJohn David Anglin pdc,m %r23(%r26) 10624c5fe5dbSJohn David Anglin pdc,m %r23(%r26) 10634c5fe5dbSJohn David Anglin pdc,m %r23(%r26) 10644c5fe5dbSJohn David Anglin pdc,m %r23(%r26) 10654c5fe5dbSJohn David Anglin pdc,m %r23(%r26) 10664c5fe5dbSJohn David Anglin pdc,m %r23(%r26) 10674c5fe5dbSJohn David Anglin pdc,m %r23(%r26) 10684c5fe5dbSJohn David Anglin pdc,m %r23(%r26) 10694c5fe5dbSJohn David Anglin pdc,m %r23(%r26) 10704c5fe5dbSJohn David Anglin pdc,m %r23(%r26) 10714c5fe5dbSJohn David Anglin pdc,m %r23(%r26) 10724c5fe5dbSJohn David Anglin pdc,m %r23(%r26) 10734c5fe5dbSJohn David Anglin pdc,m %r23(%r26) 10744c5fe5dbSJohn David Anglin cmpb,COND(<<=) %r22, %r25, 1b /* predict taken */ 10754c5fe5dbSJohn David Anglin pdc,m %r23(%r26) 10764c5fe5dbSJohn David Anglin 10774c5fe5dbSJohn David Anglin2: cmpb,COND(>>),n %r25, %r26, 2b /* predict taken */ 10780adb24e0SJohn David Anglin pdc,m %r23(%r26) 10790adb24e0SJohn David Anglin 10800adb24e0SJohn David Anglin sync 10813847dab7SHelge Deller89: ALTERNATIVE(88b, 89b, ALT_COND_NO_DCACHE, INSN_NOP) 10820adb24e0SJohn David Anglin bv %r0(%r2) 10830adb24e0SJohn David Anglin nop 10840adb24e0SJohn David AnglinENDPROC_CFI(purge_kernel_dcache_range_asm) 10850adb24e0SJohn David Anglin 1086f39cce65SHelge DellerENTRY_CFI(flush_user_icache_range_asm) 10873847dab7SHelge Deller88: ldil L%icache_stride, %r1 10881da177e4SLinus Torvalds ldw R%icache_stride(%r1), %r23 10891da177e4SLinus Torvalds ldo -1(%r23), %r21 10901da177e4SLinus Torvalds ANDCM %r26, %r21, %r26 10911da177e4SLinus Torvalds 10924c5fe5dbSJohn David Anglin#ifdef CONFIG_64BIT 10934c5fe5dbSJohn David Anglin depd,z %r23, 59, 60, %r21 10944c5fe5dbSJohn David Anglin#else 10954c5fe5dbSJohn David Anglin depw,z %r23, 27, 28, %r21 10964c5fe5dbSJohn David Anglin#endif 10974c5fe5dbSJohn David Anglin add %r26, %r21, %r22 10984c5fe5dbSJohn David Anglin cmpb,COND(>>),n %r22, %r25, 2f /* predict not taken */ 10994c5fe5dbSJohn David Anglin1: add %r22, %r21, %r22 11004c5fe5dbSJohn David Anglin fic,m %r23(%sr3, %r26) 11014c5fe5dbSJohn David Anglin fic,m %r23(%sr3, %r26) 11024c5fe5dbSJohn David Anglin fic,m %r23(%sr3, %r26) 11034c5fe5dbSJohn David Anglin fic,m %r23(%sr3, %r26) 11044c5fe5dbSJohn David Anglin fic,m %r23(%sr3, %r26) 11054c5fe5dbSJohn David Anglin fic,m %r23(%sr3, %r26) 11064c5fe5dbSJohn David Anglin fic,m %r23(%sr3, %r26) 11074c5fe5dbSJohn David Anglin fic,m %r23(%sr3, %r26) 11084c5fe5dbSJohn David Anglin fic,m %r23(%sr3, %r26) 11094c5fe5dbSJohn David Anglin fic,m %r23(%sr3, %r26) 11104c5fe5dbSJohn David Anglin fic,m %r23(%sr3, %r26) 11114c5fe5dbSJohn David Anglin fic,m %r23(%sr3, %r26) 11124c5fe5dbSJohn David Anglin fic,m %r23(%sr3, %r26) 11134c5fe5dbSJohn David Anglin fic,m %r23(%sr3, %r26) 11144c5fe5dbSJohn David Anglin fic,m %r23(%sr3, %r26) 11154c5fe5dbSJohn David Anglin cmpb,COND(<<=) %r22, %r25, 1b /* predict taken */ 11164c5fe5dbSJohn David Anglin fic,m %r23(%sr3, %r26) 11174c5fe5dbSJohn David Anglin 11184c5fe5dbSJohn David Anglin2: cmpb,COND(>>),n %r25, %r26, 2b 11191da177e4SLinus Torvalds fic,m %r23(%sr3, %r26) 11201da177e4SLinus Torvalds 11213847dab7SHelge Deller89: ALTERNATIVE(88b, 89b, ALT_COND_NO_ICACHE, INSN_NOP) 11221da177e4SLinus Torvalds sync 11231da177e4SLinus Torvalds bv %r0(%r2) 11241da177e4SLinus Torvalds nop 1125f39cce65SHelge DellerENDPROC_CFI(flush_user_icache_range_asm) 11261da177e4SLinus Torvalds 1127f39cce65SHelge DellerENTRY_CFI(flush_kernel_icache_page) 11283847dab7SHelge Deller88: ldil L%icache_stride, %r1 11291da177e4SLinus Torvalds ldw R%icache_stride(%r1), %r23 11301da177e4SLinus Torvalds 1131413059f2SGrant Grundler#ifdef CONFIG_64BIT 11321da177e4SLinus Torvalds depdi,z 1, 63-PAGE_SHIFT,1, %r25 11331da177e4SLinus Torvalds#else 11341da177e4SLinus Torvalds depwi,z 1, 31-PAGE_SHIFT,1, %r25 11351da177e4SLinus Torvalds#endif 11361da177e4SLinus Torvalds add %r26, %r25, %r25 11371da177e4SLinus Torvalds sub %r25, %r23, %r25 11381da177e4SLinus Torvalds 11391da177e4SLinus Torvalds 1140e635c96eSMatthew Wilcox1: fic,m %r23(%sr4, %r26) 1141e635c96eSMatthew Wilcox fic,m %r23(%sr4, %r26) 1142e635c96eSMatthew Wilcox fic,m %r23(%sr4, %r26) 1143e635c96eSMatthew Wilcox fic,m %r23(%sr4, %r26) 1144e635c96eSMatthew Wilcox fic,m %r23(%sr4, %r26) 1145e635c96eSMatthew Wilcox fic,m %r23(%sr4, %r26) 1146e635c96eSMatthew Wilcox fic,m %r23(%sr4, %r26) 1147e635c96eSMatthew Wilcox fic,m %r23(%sr4, %r26) 1148e635c96eSMatthew Wilcox fic,m %r23(%sr4, %r26) 1149e635c96eSMatthew Wilcox fic,m %r23(%sr4, %r26) 1150e635c96eSMatthew Wilcox fic,m %r23(%sr4, %r26) 1151e635c96eSMatthew Wilcox fic,m %r23(%sr4, %r26) 1152e635c96eSMatthew Wilcox fic,m %r23(%sr4, %r26) 1153e635c96eSMatthew Wilcox fic,m %r23(%sr4, %r26) 1154e635c96eSMatthew Wilcox fic,m %r23(%sr4, %r26) 11554c5fe5dbSJohn David Anglin cmpb,COND(>>) %r25, %r26, 1b /* predict taken */ 1156e635c96eSMatthew Wilcox fic,m %r23(%sr4, %r26) 11571da177e4SLinus Torvalds 11583847dab7SHelge Deller89: ALTERNATIVE(88b, 89b, ALT_COND_NO_ICACHE, INSN_NOP) 11591da177e4SLinus Torvalds sync 11601da177e4SLinus Torvalds bv %r0(%r2) 11611da177e4SLinus Torvalds nop 1162f39cce65SHelge DellerENDPROC_CFI(flush_kernel_icache_page) 11631da177e4SLinus Torvalds 1164f39cce65SHelge DellerENTRY_CFI(flush_kernel_icache_range_asm) 11653847dab7SHelge Deller88: ldil L%icache_stride, %r1 11661da177e4SLinus Torvalds ldw R%icache_stride(%r1), %r23 11671da177e4SLinus Torvalds ldo -1(%r23), %r21 11681da177e4SLinus Torvalds ANDCM %r26, %r21, %r26 11691da177e4SLinus Torvalds 11704c5fe5dbSJohn David Anglin#ifdef CONFIG_64BIT 11714c5fe5dbSJohn David Anglin depd,z %r23, 59, 60, %r21 11724c5fe5dbSJohn David Anglin#else 11734c5fe5dbSJohn David Anglin depw,z %r23, 27, 28, %r21 11744c5fe5dbSJohn David Anglin#endif 11754c5fe5dbSJohn David Anglin add %r26, %r21, %r22 11764c5fe5dbSJohn David Anglin cmpb,COND(>>),n %r22, %r25, 2f /* predict not taken */ 11774c5fe5dbSJohn David Anglin1: add %r22, %r21, %r22 11784c5fe5dbSJohn David Anglin fic,m %r23(%sr4, %r26) 11794c5fe5dbSJohn David Anglin fic,m %r23(%sr4, %r26) 11804c5fe5dbSJohn David Anglin fic,m %r23(%sr4, %r26) 11814c5fe5dbSJohn David Anglin fic,m %r23(%sr4, %r26) 11824c5fe5dbSJohn David Anglin fic,m %r23(%sr4, %r26) 11834c5fe5dbSJohn David Anglin fic,m %r23(%sr4, %r26) 11844c5fe5dbSJohn David Anglin fic,m %r23(%sr4, %r26) 11854c5fe5dbSJohn David Anglin fic,m %r23(%sr4, %r26) 11864c5fe5dbSJohn David Anglin fic,m %r23(%sr4, %r26) 11874c5fe5dbSJohn David Anglin fic,m %r23(%sr4, %r26) 11884c5fe5dbSJohn David Anglin fic,m %r23(%sr4, %r26) 11894c5fe5dbSJohn David Anglin fic,m %r23(%sr4, %r26) 11904c5fe5dbSJohn David Anglin fic,m %r23(%sr4, %r26) 11914c5fe5dbSJohn David Anglin fic,m %r23(%sr4, %r26) 11924c5fe5dbSJohn David Anglin fic,m %r23(%sr4, %r26) 11934c5fe5dbSJohn David Anglin cmpb,COND(<<=) %r22, %r25, 1b /* predict taken */ 11944c5fe5dbSJohn David Anglin fic,m %r23(%sr4, %r26) 11954c5fe5dbSJohn David Anglin 11964c5fe5dbSJohn David Anglin2: cmpb,COND(>>),n %r25, %r26, 2b /* predict taken */ 1197e635c96eSMatthew Wilcox fic,m %r23(%sr4, %r26) 11981da177e4SLinus Torvalds 11993847dab7SHelge Deller89: ALTERNATIVE(88b, 89b, ALT_COND_NO_ICACHE, INSN_NOP) 12001da177e4SLinus Torvalds sync 12011da177e4SLinus Torvalds bv %r0(%r2) 12021da177e4SLinus Torvalds nop 1203f39cce65SHelge DellerENDPROC_CFI(flush_kernel_icache_range_asm) 12041da177e4SLinus Torvalds 12054d7d4c3fSHelge Deller .text 12062a03bb9eSHelge Deller 1207896a3756SGrant Grundler /* align should cover use of rfi in disable_sr_hashing_asm and 1208896a3756SGrant Grundler * srdis_done. 1209896a3756SGrant Grundler */ 1210896a3756SGrant Grundler .align 256 1211f39cce65SHelge DellerENTRY_CFI(disable_sr_hashing_asm) 1212896a3756SGrant Grundler /* 1213896a3756SGrant Grundler * Switch to real mode 1214896a3756SGrant Grundler */ 1215896a3756SGrant Grundler /* pcxt_ssm_bug */ 1216896a3756SGrant Grundler rsm PSW_SM_I, %r0 1217896a3756SGrant Grundler load32 PA(1f), %r1 12181da177e4SLinus Torvalds nop 12191da177e4SLinus Torvalds nop 12201da177e4SLinus Torvalds nop 12211da177e4SLinus Torvalds nop 12221da177e4SLinus Torvalds nop 12231da177e4SLinus Torvalds 1224896a3756SGrant Grundler rsm PSW_SM_Q, %r0 /* prep to load iia queue */ 12251da177e4SLinus Torvalds mtctl %r0, %cr17 /* Clear IIASQ tail */ 12261da177e4SLinus Torvalds mtctl %r0, %cr17 /* Clear IIASQ head */ 12271da177e4SLinus Torvalds mtctl %r1, %cr18 /* IIAOQ head */ 12281da177e4SLinus Torvalds ldo 4(%r1), %r1 12291da177e4SLinus Torvalds mtctl %r1, %cr18 /* IIAOQ tail */ 1230896a3756SGrant Grundler load32 REAL_MODE_PSW, %r1 1231896a3756SGrant Grundler mtctl %r1, %ipsw 12321da177e4SLinus Torvalds rfi 12331da177e4SLinus Torvalds nop 12341da177e4SLinus Torvalds 12351da177e4SLinus Torvalds1: cmpib,=,n SRHASH_PCXST, %r26,srdis_pcxs 12361da177e4SLinus Torvalds cmpib,=,n SRHASH_PCXL, %r26,srdis_pcxl 12371da177e4SLinus Torvalds cmpib,=,n SRHASH_PA20, %r26,srdis_pa20 12381da177e4SLinus Torvalds b,n srdis_done 12391da177e4SLinus Torvalds 12401da177e4SLinus Torvaldssrdis_pcxs: 12411da177e4SLinus Torvalds 12421da177e4SLinus Torvalds /* Disable Space Register Hashing for PCXS,PCXT,PCXT' */ 12431da177e4SLinus Torvalds 12441da177e4SLinus Torvalds .word 0x141c1a00 /* mfdiag %dr0, %r28 */ 12451da177e4SLinus Torvalds .word 0x141c1a00 /* must issue twice */ 12461da177e4SLinus Torvalds depwi 0,18,1, %r28 /* Clear DHE (dcache hash enable) */ 12471da177e4SLinus Torvalds depwi 0,20,1, %r28 /* Clear IHE (icache hash enable) */ 12481da177e4SLinus Torvalds .word 0x141c1600 /* mtdiag %r28, %dr0 */ 12491da177e4SLinus Torvalds .word 0x141c1600 /* must issue twice */ 12501da177e4SLinus Torvalds b,n srdis_done 12511da177e4SLinus Torvalds 12521da177e4SLinus Torvaldssrdis_pcxl: 12531da177e4SLinus Torvalds 12541da177e4SLinus Torvalds /* Disable Space Register Hashing for PCXL */ 12551da177e4SLinus Torvalds 12561da177e4SLinus Torvalds .word 0x141c0600 /* mfdiag %dr0, %r28 */ 12571da177e4SLinus Torvalds depwi 0,28,2, %r28 /* Clear DHASH_EN & IHASH_EN */ 12581da177e4SLinus Torvalds .word 0x141c0240 /* mtdiag %r28, %dr0 */ 12591da177e4SLinus Torvalds b,n srdis_done 12601da177e4SLinus Torvalds 12611da177e4SLinus Torvaldssrdis_pa20: 12621da177e4SLinus Torvalds 1263896a3756SGrant Grundler /* Disable Space Register Hashing for PCXU,PCXU+,PCXW,PCXW+,PCXW2 */ 12641da177e4SLinus Torvalds 12651da177e4SLinus Torvalds .word 0x144008bc /* mfdiag %dr2, %r28 */ 12661da177e4SLinus Torvalds depdi 0, 54,1, %r28 /* clear DIAG_SPHASH_ENAB (bit 54) */ 12671da177e4SLinus Torvalds .word 0x145c1840 /* mtdiag %r28, %dr2 */ 12681da177e4SLinus Torvalds 1269896a3756SGrant Grundler 12701da177e4SLinus Torvaldssrdis_done: 12711da177e4SLinus Torvalds /* Switch back to virtual mode */ 1272896a3756SGrant Grundler rsm PSW_SM_I, %r0 /* prep to load iia queue */ 1273896a3756SGrant Grundler load32 2f, %r1 1274896a3756SGrant Grundler nop 1275896a3756SGrant Grundler nop 1276896a3756SGrant Grundler nop 1277896a3756SGrant Grundler nop 1278896a3756SGrant Grundler nop 12791da177e4SLinus Torvalds 1280896a3756SGrant Grundler rsm PSW_SM_Q, %r0 /* prep to load iia queue */ 12811da177e4SLinus Torvalds mtctl %r0, %cr17 /* Clear IIASQ tail */ 12821da177e4SLinus Torvalds mtctl %r0, %cr17 /* Clear IIASQ head */ 12831da177e4SLinus Torvalds mtctl %r1, %cr18 /* IIAOQ head */ 12841da177e4SLinus Torvalds ldo 4(%r1), %r1 12851da177e4SLinus Torvalds mtctl %r1, %cr18 /* IIAOQ tail */ 1286896a3756SGrant Grundler load32 KERNEL_PSW, %r1 1287896a3756SGrant Grundler mtctl %r1, %ipsw 12881da177e4SLinus Torvalds rfi 12891da177e4SLinus Torvalds nop 12901da177e4SLinus Torvalds 12911da177e4SLinus Torvalds2: bv %r0(%r2) 12921da177e4SLinus Torvalds nop 1293f39cce65SHelge DellerENDPROC_CFI(disable_sr_hashing_asm) 12941da177e4SLinus Torvalds 12951da177e4SLinus Torvalds .end 1296