1 /* SPDX-License-Identifier: GPL-2.0-or-later * 2 /* 3 * PARISC TLB and cache flushing support 4 * Copyright (C) 2000-2001 Hewlett-Packard (J 5 * Copyright (C) 2001 Matthew Wilcox (willy a 6 * Copyright (C) 2002 Richard Hirst (rhirst w 7 */ 8 9 /* 10 * NOTE: fdc,fic, and pdc instructions that us 11 * should only use index and base regist 12 * so that the fast path emulation in th 13 * can be used. 14 */ 15 16 #ifdef CONFIG_64BIT 17 .level 2.0w 18 #else 19 .level 2.0 20 #endif 21 22 #include <asm/psw.h> 23 #include <asm/assembly.h> 24 #include <asm/cache.h> 25 #include <asm/ldcw.h> 26 #include <asm/alternative.h> 27 #include <linux/linkage.h> 28 #include <linux/init.h> 29 #include <linux/pgtable.h> 30 31 .section .text.hot 32 .align 16 33 34 ENTRY_CFI(flush_tlb_all_local) 35 /* 36 * The pitlbe and pdtlbe instructions 37 * flush the entire tlb. Also, there n 38 * tlb operations, e.g. tlb misses, so 39 * to happen in real mode with all int 40 */ 41 42 /* pcxt_ssm_bug - relied upon translat 43 rsm PSW_SM_I, %r19 44 load32 PA(1f), %r1 45 nop 46 nop 47 nop 48 nop 49 nop 50 51 rsm PSW_SM_Q, %r0 52 mtctl %r0, %cr17 53 mtctl %r0, %cr17 54 mtctl %r1, %cr18 55 ldo 4(%r1), %r1 56 mtctl %r1, %cr18 57 load32 REAL_MODE_PSW, %r1 58 mtctl %r1, %ipsw 59 rfi 60 nop 61 62 1: load32 PA(cache_info), %r1 63 64 /* Flush Instruction Tlb */ 65 66 88: LDREG ITLB_SID_BASE(%r1), %r 67 LDREG ITLB_SID_STRIDE(%r1), 68 LDREG ITLB_SID_COUNT(%r1), % 69 LDREG ITLB_OFF_BASE(%r1), %a 70 LDREG ITLB_OFF_STRIDE(%r1), 71 LDREG ITLB_OFF_COUNT(%r1), % 72 LDREG ITLB_LOOP(%r1), %arg3 73 74 addib,COND(=) -1, %arg3, fit 75 movb,<,n %arg3, %r31, fitdone 76 copy %arg0, %r28 77 78 fitmanyloop: 79 mtsp %r20, %sr1 80 add %r21, %r20, %r20 81 copy %arg2, %r29 82 83 fitmanymiddle: 84 addib,COND(>) -1, %r31, fitm 85 pitlbe %r0(%sr1, %r28) 86 pitlbe,m %arg1(%sr1, %r28) 87 addib,COND(>) -1, %r29, fitm 88 copy %arg3, %r31 89 90 movb,tr %arg0, %r28, fitmanylo 91 addib,COND(<=),n -1, %r22, fitd 92 93 fitoneloop: 94 mtsp %r20, %sr1 95 copy %arg0, %r28 96 copy %arg2, %r29 97 98 fitonemiddle: 99 addib,COND(>) -1, %r29, fito 100 pitlbe,m %arg1(%sr1, %r28) 101 102 addib,COND(>) -1, %r22, fito 103 add %r21, %r20, %r20 104 105 fitdone: 106 ALTERNATIVE(88b, fitdone, ALT_COND_NO_ 107 108 /* Flush Data Tlb */ 109 110 LDREG DTLB_SID_BASE(%r1), %r 111 LDREG DTLB_SID_STRIDE(%r1), 112 LDREG DTLB_SID_COUNT(%r1), % 113 LDREG DTLB_OFF_BASE(%r1), %a 114 LDREG DTLB_OFF_STRIDE(%r1), 115 LDREG DTLB_OFF_COUNT(%r1), % 116 LDREG DTLB_LOOP(%r1), %arg3 117 118 addib,COND(=) -1, %arg3, fdt 119 movb,<,n %arg3, %r31, fdtdone 120 copy %arg0, %r28 121 122 fdtmanyloop: 123 mtsp %r20, %sr1 124 add %r21, %r20, %r20 125 copy %arg2, %r29 126 127 fdtmanymiddle: 128 addib,COND(>) -1, %r31, fdtm 129 pdtlbe %r0(%sr1, %r28) 130 pdtlbe,m %arg1(%sr1, %r28) 131 addib,COND(>) -1, %r29, fdtm 132 copy %arg3, %r31 133 134 movb,tr %arg0, %r28, fdtmanylo 135 addib,COND(<=),n -1, %r22,fdtdo 136 137 fdtoneloop: 138 mtsp %r20, %sr1 139 copy %arg0, %r28 140 copy %arg2, %r29 141 142 fdtonemiddle: 143 addib,COND(>) -1, %r29, fdto 144 pdtlbe,m %arg1(%sr1, %r28) 145 146 addib,COND(>) -1, %r22, fdto 147 add %r21, %r20, %r20 148 149 150 fdtdone: 151 /* 152 * Switch back to virtual mode 153 */ 154 /* pcxt_ssm_bug */ 155 rsm PSW_SM_I, %r0 156 load32 2f, %r1 157 nop 158 nop 159 nop 160 nop 161 nop 162 163 rsm PSW_SM_Q, %r0 164 mtctl %r0, %cr17 165 mtctl %r0, %cr17 166 mtctl %r1, %cr18 167 ldo 4(%r1), %r1 168 mtctl %r1, %cr18 169 load32 KERNEL_PSW, %r1 170 or %r1, %r19, %r1 /* I-b 171 mtctl %r1, %ipsw /* res 172 rfi 173 nop 174 175 2: bv %r0(%r2) 176 nop 177 178 /* 179 * When running in qemu, drop whole fl 180 * replace by one pdtlbe instruction, 181 * local TLB entries. 182 */ 183 3: pdtlbe %r0(%sr1,%r0) 184 bv,n %r0(%r2) 185 ALTERNATIVE_CODE(flush_tlb_all_local, 186 ENDPROC_CFI(flush_tlb_all_local) 187 188 .import cache_info,data 189 190 ENTRY_CFI(flush_instruction_cache_local) 191 88: load32 cache_info, %r1 192 193 /* Flush Instruction Cache */ 194 195 LDREG ICACHE_BASE(%r1), %arg 196 LDREG ICACHE_STRIDE(%r1), %a 197 LDREG ICACHE_COUNT(%r1), %ar 198 LDREG ICACHE_LOOP(%r1), %arg 199 rsm PSW_SM_I, %r22 200 mtsp %r0, %sr1 201 addib,COND(=) -1, %arg3, fio 202 movb,<,n %arg3, %r31, fisync 203 204 fimanyloop: 205 addib,COND(>) -1, %r31, fima 206 fice %r0(%sr1, %arg0) 207 fice,m %arg1(%sr1, %arg0) 208 movb,tr %arg3, %r31, fimanyloo 209 addib,COND(<=),n -1, %arg2, fis 210 211 fioneloop: 212 /* Some implementations may flush with 213 cmpib,COND(>>=),n 15, %arg2, fio 214 215 fioneloop1: 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) 233 234 /* Check if done */ 235 cmpb,COND(=),n %arg2, %r0, fisync 236 237 fioneloop2: 238 addib,COND(>) -1, %arg2, fioneloop2 239 fice,m %arg1(%sr1, %arg0) 240 241 fisync: 242 sync 243 mtsm %r22 244 89: ALTERNATIVE(88b, 89b, ALT_COND_NO_ICAC 245 bv %r0(%r2) 246 nop 247 ENDPROC_CFI(flush_instruction_cache_local) 248 249 250 .import cache_info, data 251 ENTRY_CFI(flush_data_cache_local) 252 88: load32 cache_info, %r1 253 254 /* Flush Data Cache */ 255 256 LDREG DCACHE_BASE(%r1), %arg 257 LDREG DCACHE_STRIDE(%r1), %a 258 LDREG DCACHE_COUNT(%r1), %ar 259 LDREG DCACHE_LOOP(%r1), %arg 260 rsm PSW_SM_I, %r22 261 mtsp %r0, %sr1 262 addib,COND(=) -1, %arg3, fdo 263 movb,<,n %arg3, %r31, fdsync 264 265 fdmanyloop: 266 addib,COND(>) -1, %r31, fdma 267 fdce %r0(%sr1, %arg0) 268 fdce,m %arg1(%sr1, %arg0) 269 movb,tr %arg3, %r31, fdmanyloo 270 addib,COND(<=),n -1, %arg2, fds 271 272 fdoneloop: 273 /* Some implementations may flush with 274 cmpib,COND(>>=),n 15, %arg2, fdo 275 276 fdoneloop1: 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) 294 295 /* Check if done */ 296 cmpb,COND(=),n %arg2, %r0, fdsync 297 298 fdoneloop2: 299 addib,COND(>) -1, %arg2, fdoneloop2 300 fdce,m %arg1(%sr1, %arg0) 301 302 fdsync: 303 sync 304 mtsm %r22 305 89: ALTERNATIVE(88b, 89b, ALT_COND_NO_DCAC 306 bv %r0(%r2) 307 nop 308 ENDPROC_CFI(flush_data_cache_local) 309 310 /* Clear page using kernel mapping. */ 311 312 ENTRY_CFI(clear_page_asm) 313 #ifdef CONFIG_64BIT 314 315 /* Unroll the loop. */ 316 ldi (PAGE_SIZE / 128), %r1 317 318 1: 319 std %r0, 0(%r26) 320 std %r0, 8(%r26) 321 std %r0, 16(%r26) 322 std %r0, 24(%r26) 323 std %r0, 32(%r26) 324 std %r0, 40(%r26) 325 std %r0, 48(%r26) 326 std %r0, 56(%r26) 327 std %r0, 64(%r26) 328 std %r0, 72(%r26) 329 std %r0, 80(%r26) 330 std %r0, 88(%r26) 331 std %r0, 96(%r26) 332 std %r0, 104(%r26) 333 std %r0, 112(%r26) 334 std %r0, 120(%r26) 335 336 /* Note reverse branch hint for addib 337 addib,COND(>),n -1, %r1, 1b 338 ldo 128(%r26), %r26 339 340 #else 341 342 /* 343 * Note that until (if) we start savin 344 * values on interrupt, we can't use s 345 */ 346 ldi (PAGE_SIZE / 64), %r1 347 348 1: 349 stw %r0, 0(%r26) 350 stw %r0, 4(%r26) 351 stw %r0, 8(%r26) 352 stw %r0, 12(%r26) 353 stw %r0, 16(%r26) 354 stw %r0, 20(%r26) 355 stw %r0, 24(%r26) 356 stw %r0, 28(%r26) 357 stw %r0, 32(%r26) 358 stw %r0, 36(%r26) 359 stw %r0, 40(%r26) 360 stw %r0, 44(%r26) 361 stw %r0, 48(%r26) 362 stw %r0, 52(%r26) 363 stw %r0, 56(%r26) 364 stw %r0, 60(%r26) 365 366 addib,COND(>),n -1, %r1, 1b 367 ldo 64(%r26), %r26 368 #endif 369 bv %r0(%r2) 370 nop 371 ENDPROC_CFI(clear_page_asm) 372 373 /* Copy page using kernel mapping. */ 374 375 ENTRY_CFI(copy_page_asm) 376 #ifdef CONFIG_64BIT 377 /* PA8x00 CPUs can consume 2 loads or 378 * Unroll the loop by hand and arrange 379 * Prefetch doesn't improve performanc 380 * GCC probably can do this just as we 381 */ 382 383 ldi (PAGE_SIZE / 128), %r1 384 385 1: ldd 0(%r25), %r19 386 ldd 8(%r25), %r20 387 388 ldd 16(%r25), %r21 389 ldd 24(%r25), %r22 390 std %r19, 0(%r26) 391 std %r20, 8(%r26) 392 393 ldd 32(%r25), %r19 394 ldd 40(%r25), %r20 395 std %r21, 16(%r26) 396 std %r22, 24(%r26) 397 398 ldd 48(%r25), %r21 399 ldd 56(%r25), %r22 400 std %r19, 32(%r26) 401 std %r20, 40(%r26) 402 403 ldd 64(%r25), %r19 404 ldd 72(%r25), %r20 405 std %r21, 48(%r26) 406 std %r22, 56(%r26) 407 408 ldd 80(%r25), %r21 409 ldd 88(%r25), %r22 410 std %r19, 64(%r26) 411 std %r20, 72(%r26) 412 413 ldd 96(%r25), %r19 414 ldd 104(%r25), %r20 415 std %r21, 80(%r26) 416 std %r22, 88(%r26) 417 418 ldd 112(%r25), %r21 419 ldd 120(%r25), %r22 420 ldo 128(%r25), %r25 421 std %r19, 96(%r26) 422 std %r20, 104(%r26) 423 424 std %r21, 112(%r26) 425 std %r22, 120(%r26) 426 427 /* Note reverse branch hint for addib 428 addib,COND(>),n -1, %r1, 1b 429 ldo 128(%r26), %r26 430 431 #else 432 433 /* 434 * This loop is optimized for PCXL/PCX 435 * bundles (very restricted rules for 436 * Note that until (if) we start savin 437 * the full 64 bit register values on 438 * use ldd/std on a 32 bit kernel. 439 */ 440 ldw 0(%r25), %r19 441 ldi (PAGE_SIZE / 64), %r1 442 443 1: 444 ldw 4(%r25), %r20 445 ldw 8(%r25), %r21 446 ldw 12(%r25), %r22 447 stw %r19, 0(%r26) 448 stw %r20, 4(%r26) 449 stw %r21, 8(%r26) 450 stw %r22, 12(%r26) 451 ldw 16(%r25), %r19 452 ldw 20(%r25), %r20 453 ldw 24(%r25), %r21 454 ldw 28(%r25), %r22 455 stw %r19, 16(%r26) 456 stw %r20, 20(%r26) 457 stw %r21, 24(%r26) 458 stw %r22, 28(%r26) 459 ldw 32(%r25), %r19 460 ldw 36(%r25), %r20 461 ldw 40(%r25), %r21 462 ldw 44(%r25), %r22 463 stw %r19, 32(%r26) 464 stw %r20, 36(%r26) 465 stw %r21, 40(%r26) 466 stw %r22, 44(%r26) 467 ldw 48(%r25), %r19 468 ldw 52(%r25), %r20 469 ldw 56(%r25), %r21 470 ldw 60(%r25), %r22 471 stw %r19, 48(%r26) 472 stw %r20, 52(%r26) 473 ldo 64(%r25), %r25 474 stw %r21, 56(%r26) 475 stw %r22, 60(%r26) 476 ldo 64(%r26), %r26 477 addib,COND(>),n -1, %r1, 1b 478 ldw 0(%r25), %r19 479 #endif 480 bv %r0(%r2) 481 nop 482 ENDPROC_CFI(copy_page_asm) 483 484 /* 485 * NOTE: Code in clear_user_page has a hard co 486 * maximum alias boundary being 4 Mb. We 487 * parisc chip designers that there will 488 * chip with a larger alias boundary (Ne 489 * 490 * Yah, what about the PA8800 and PA8900 491 * 492 * Subtle: the dtlb miss handlers suppor 493 * "knowing" that if a dtlb miss happens 494 * region it must have occurred while in 495 * this routine makes use of processor l 496 * don't want to insert them into the ke 497 * we load up some general registers (th 498 * which aren't shadowed) with the physi 499 * for tlb insertion) needed to insert t 500 * miss on the translation, the dtlb mis 501 * translation into the tlb using these 502 * 503 * %r26 physical address of "to" tran 504 * %r23 physical address of "from" tr 505 */ 506 507 /* 508 * copy_user_page_asm() performs a pag 509 * equivalent to the user page mapping 510 * implement copy_user_page() but unfo 511 * and `to' pages need to be flushed t 512 * to the user mappings after the copy 513 * the `from' page through the kmap ke 514 * page needs to be flushed since code 515 * result, this implementation is less 516 * copy using the kernel mapping. It 517 * to flushed via the user mapping. T 518 * the flushes needed for the kernel m 519 * 520 * I'm still keeping this around becau 521 * use it if more information is passe 522 * Have to do some measurements to see 523 * lobby for such a change. 524 * 525 */ 526 527 ENTRY_CFI(copy_user_page_asm) 528 /* Convert virtual `to' and `from' add 529 Move `from' physical address to non 530 ldil L%(__PAGE_OFFSET), %r1 531 sub %r26, %r1, %r26 532 sub %r25, %r1, %r23 533 534 ldil L%(TMPALIAS_MAP_START) 535 dep_safe %r24, 31,TMPALIAS_SIZE 536 depi_safe 0, 31,PAGE_SHIFT, %r28 537 copy %r28, %r29 538 depi_safe 1, 31-TMPALIAS_SIZE_BI 539 540 /* Purge any old translations */ 541 542 #ifdef CONFIG_PA20 543 pdtlb,l %r0(%r28) 544 pdtlb,l %r0(%r29) 545 #else 546 0: pdtlb %r0(%r28) 547 1: pdtlb %r0(%r29) 548 ALTERNATIVE(0b, 0b+4, ALT_COND_NO_SMP, 549 ALTERNATIVE(1b, 1b+4, ALT_COND_NO_SMP, 550 #endif 551 552 #ifdef CONFIG_64BIT 553 /* PA8x00 CPUs can consume 2 loads or 554 * Unroll the loop by hand and arrange 555 * GCC probably can do this just as we 556 */ 557 558 ldd 0(%r29), %r19 559 ldi (PAGE_SIZE / 128), %r1 560 561 1: ldd 8(%r29), %r20 562 563 ldd 16(%r29), %r21 564 ldd 24(%r29), %r22 565 std %r19, 0(%r28) 566 std %r20, 8(%r28) 567 568 ldd 32(%r29), %r19 569 ldd 40(%r29), %r20 570 std %r21, 16(%r28) 571 std %r22, 24(%r28) 572 573 ldd 48(%r29), %r21 574 ldd 56(%r29), %r22 575 std %r19, 32(%r28) 576 std %r20, 40(%r28) 577 578 ldd 64(%r29), %r19 579 ldd 72(%r29), %r20 580 std %r21, 48(%r28) 581 std %r22, 56(%r28) 582 583 ldd 80(%r29), %r21 584 ldd 88(%r29), %r22 585 std %r19, 64(%r28) 586 std %r20, 72(%r28) 587 588 ldd 96(%r29), %r19 589 ldd 104(%r29), %r20 590 std %r21, 80(%r28) 591 std %r22, 88(%r28) 592 593 ldd 112(%r29), %r21 594 ldd 120(%r29), %r22 595 std %r19, 96(%r28) 596 std %r20, 104(%r28) 597 598 ldo 128(%r29), %r29 599 std %r21, 112(%r28) 600 std %r22, 120(%r28) 601 ldo 128(%r28), %r28 602 603 /* conditional branches nullify on for 604 * non-taken backward branch. Note tha 605 * The ldd should only get executed if 606 */ 607 addib,COND(>),n -1, %r1, 1b 608 ldd 0(%r29), %r19 609 610 #else 611 ldi (PAGE_SIZE / 64), %r1 612 613 /* 614 * This loop is optimized for PCXL/PCX 615 * bundles (very restricted rules for 616 * does OK on PCXU and better, but we 617 * ldd/std instructions. Note that unt 618 * the full 64 bit register values on 619 * use ldd/std on a 32 bit kernel. 620 */ 621 622 1: ldw 0(%r29), %r19 623 ldw 4(%r29), %r20 624 ldw 8(%r29), %r21 625 ldw 12(%r29), %r22 626 stw %r19, 0(%r28) 627 stw %r20, 4(%r28) 628 stw %r21, 8(%r28) 629 stw %r22, 12(%r28) 630 ldw 16(%r29), %r19 631 ldw 20(%r29), %r20 632 ldw 24(%r29), %r21 633 ldw 28(%r29), %r22 634 stw %r19, 16(%r28) 635 stw %r20, 20(%r28) 636 stw %r21, 24(%r28) 637 stw %r22, 28(%r28) 638 ldw 32(%r29), %r19 639 ldw 36(%r29), %r20 640 ldw 40(%r29), %r21 641 ldw 44(%r29), %r22 642 stw %r19, 32(%r28) 643 stw %r20, 36(%r28) 644 stw %r21, 40(%r28) 645 stw %r22, 44(%r28) 646 ldw 48(%r29), %r19 647 ldw 52(%r29), %r20 648 ldw 56(%r29), %r21 649 ldw 60(%r29), %r22 650 stw %r19, 48(%r28) 651 stw %r20, 52(%r28) 652 stw %r21, 56(%r28) 653 stw %r22, 60(%r28) 654 ldo 64(%r28), %r28 655 656 addib,COND(>) -1, %r1,1b 657 ldo 64(%r29), %r29 658 #endif 659 660 bv %r0(%r2) 661 nop 662 ENDPROC_CFI(copy_user_page_asm) 663 664 ENTRY_CFI(clear_user_page_asm) 665 tophys_r1 %r26 666 667 ldil L%(TMPALIAS_MAP_START) 668 dep_safe %r25, 31,TMPALIAS_SIZE 669 depi_safe 0, 31,PAGE_SHIFT, %r28 670 671 /* Purge any old translation */ 672 673 #ifdef CONFIG_PA20 674 pdtlb,l %r0(%r28) 675 #else 676 0: pdtlb %r0(%r28) 677 ALTERNATIVE(0b, 0b+4, ALT_COND_NO_SMP, 678 #endif 679 680 #ifdef CONFIG_64BIT 681 ldi (PAGE_SIZE / 128), %r1 682 683 /* PREFETCH (Write) has not (yet) been 684 /* #define PREFETCHW_OP ldd 685 686 1: std %r0, 0(%r28) 687 std %r0, 8(%r28) 688 std %r0, 16(%r28) 689 std %r0, 24(%r28) 690 std %r0, 32(%r28) 691 std %r0, 40(%r28) 692 std %r0, 48(%r28) 693 std %r0, 56(%r28) 694 std %r0, 64(%r28) 695 std %r0, 72(%r28) 696 std %r0, 80(%r28) 697 std %r0, 88(%r28) 698 std %r0, 96(%r28) 699 std %r0, 104(%r28) 700 std %r0, 112(%r28) 701 std %r0, 120(%r28) 702 addib,COND(>) -1, %r1, 1b 703 ldo 128(%r28), %r28 704 705 #else /* ! CONFIG_64BIT */ 706 ldi (PAGE_SIZE / 64), %r1 707 708 1: stw %r0, 0(%r28) 709 stw %r0, 4(%r28) 710 stw %r0, 8(%r28) 711 stw %r0, 12(%r28) 712 stw %r0, 16(%r28) 713 stw %r0, 20(%r28) 714 stw %r0, 24(%r28) 715 stw %r0, 28(%r28) 716 stw %r0, 32(%r28) 717 stw %r0, 36(%r28) 718 stw %r0, 40(%r28) 719 stw %r0, 44(%r28) 720 stw %r0, 48(%r28) 721 stw %r0, 52(%r28) 722 stw %r0, 56(%r28) 723 stw %r0, 60(%r28) 724 addib,COND(>) -1, %r1, 1b 725 ldo 64(%r28), %r28 726 #endif /* CONFIG_64BIT */ 727 728 bv %r0(%r2) 729 nop 730 ENDPROC_CFI(clear_user_page_asm) 731 732 ENTRY_CFI(flush_dcache_page_asm) 733 ldil L%(TMPALIAS_MAP_START) 734 dep_safe %r25, 31,TMPALIAS_SIZE 735 depi_safe 0, 31,PAGE_SHIFT, %r28 736 737 /* Purge any old translation */ 738 739 #ifdef CONFIG_PA20 740 pdtlb,l %r0(%r28) 741 #else 742 0: pdtlb %r0(%r28) 743 ALTERNATIVE(0b, 0b+4, ALT_COND_NO_SMP, 744 #endif 745 746 88: ldil L%dcache_stride, %r1 747 ldw R%dcache_stride(%r1), 748 749 #ifdef CONFIG_64BIT 750 depdi,z 1, 63-PAGE_SHIFT,1, %r 751 #else 752 depwi,z 1, 31-PAGE_SHIFT,1, %r 753 #endif 754 add %r28, %r25, %r25 755 sub %r25, r31, %r25 756 757 1: fdc,m r31(%r28) 758 fdc,m r31(%r28) 759 fdc,m r31(%r28) 760 fdc,m r31(%r28) 761 fdc,m r31(%r28) 762 fdc,m r31(%r28) 763 fdc,m r31(%r28) 764 fdc,m r31(%r28) 765 fdc,m r31(%r28) 766 fdc,m r31(%r28) 767 fdc,m r31(%r28) 768 fdc,m r31(%r28) 769 fdc,m r31(%r28) 770 fdc,m r31(%r28) 771 fdc,m r31(%r28) 772 cmpb,COND(>>) %r25, %r28, 1b /* pred 773 fdc,m r31(%r28) 774 775 89: ALTERNATIVE(88b, 89b, ALT_COND_NO_DCAC 776 sync 777 bv %r0(%r2) 778 nop 779 ENDPROC_CFI(flush_dcache_page_asm) 780 781 ENTRY_CFI(purge_dcache_page_asm) 782 ldil L%(TMPALIAS_MAP_START) 783 dep_safe %r25, 31,TMPALIAS_SIZE 784 depi_safe 0, 31,PAGE_SHIFT, %r28 785 786 /* Purge any old translation */ 787 788 #ifdef CONFIG_PA20 789 pdtlb,l %r0(%r28) 790 #else 791 0: pdtlb %r0(%r28) 792 ALTERNATIVE(0b, 0b+4, ALT_COND_NO_SMP, 793 #endif 794 795 88: ldil L%dcache_stride, %r1 796 ldw R%dcache_stride(%r1), 797 798 #ifdef CONFIG_64BIT 799 depdi,z 1, 63-PAGE_SHIFT,1, %r 800 #else 801 depwi,z 1, 31-PAGE_SHIFT,1, %r 802 #endif 803 add %r28, %r25, %r25 804 sub %r25, r31, %r25 805 806 1: pdc,m r31(%r28) 807 pdc,m r31(%r28) 808 pdc,m r31(%r28) 809 pdc,m r31(%r28) 810 pdc,m r31(%r28) 811 pdc,m r31(%r28) 812 pdc,m r31(%r28) 813 pdc,m r31(%r28) 814 pdc,m r31(%r28) 815 pdc,m r31(%r28) 816 pdc,m r31(%r28) 817 pdc,m r31(%r28) 818 pdc,m r31(%r28) 819 pdc,m r31(%r28) 820 pdc,m r31(%r28) 821 cmpb,COND(>>) %r25, %r28, 1b /* pred 822 pdc,m r31(%r28) 823 824 89: ALTERNATIVE(88b, 89b, ALT_COND_NO_DCAC 825 sync 826 bv %r0(%r2) 827 nop 828 ENDPROC_CFI(purge_dcache_page_asm) 829 830 ENTRY_CFI(flush_icache_page_asm) 831 ldil L%(TMPALIAS_MAP_START) 832 dep_safe %r25, 31,TMPALIAS_SIZE 833 depi_safe 0, 31,PAGE_SHIFT, %r28 834 835 /* Purge any old translation. Note th 836 * may use either the instruction or d 837 * have a flat address space, it's not 838 * used. So, we purge both entries. 839 840 #ifdef CONFIG_PA20 841 pdtlb,l %r0(%r28) 842 1: pitlb,l %r0(%sr4,%r28) 843 ALTERNATIVE(1b, 1b+4, ALT_COND_NO_SPLI 844 #else 845 0: pdtlb %r0(%r28) 846 1: pitlb %r0(%sr4,%r28) 847 ALTERNATIVE(0b, 0b+4, ALT_COND_NO_SMP, 848 ALTERNATIVE(1b, 1b+4, ALT_COND_NO_SMP, 849 ALTERNATIVE(1b, 1b+4, ALT_COND_NO_SPLI 850 #endif 851 852 88: ldil L%icache_stride, %r1 853 ldw R%icache_stride(%r1), 854 855 #ifdef CONFIG_64BIT 856 depdi,z 1, 63-PAGE_SHIFT,1, %r 857 #else 858 depwi,z 1, 31-PAGE_SHIFT,1, %r 859 #endif 860 add %r28, %r25, %r25 861 sub %r25, %r31, %r25 862 863 /* fic only has the type 26 form on PA 864 * explicit space specification, so us 865 1: fic,m %r31(%sr4,%r28) 866 fic,m %r31(%sr4,%r28) 867 fic,m %r31(%sr4,%r28) 868 fic,m %r31(%sr4,%r28) 869 fic,m %r31(%sr4,%r28) 870 fic,m %r31(%sr4,%r28) 871 fic,m %r31(%sr4,%r28) 872 fic,m %r31(%sr4,%r28) 873 fic,m %r31(%sr4,%r28) 874 fic,m %r31(%sr4,%r28) 875 fic,m %r31(%sr4,%r28) 876 fic,m %r31(%sr4,%r28) 877 fic,m %r31(%sr4,%r28) 878 fic,m %r31(%sr4,%r28) 879 fic,m %r31(%sr4,%r28) 880 cmpb,COND(>>) %r25, %r28, 1b /* pred 881 fic,m %r31(%sr4,%r28) 882 883 89: ALTERNATIVE(88b, 89b, ALT_COND_NO_ICAC 884 sync 885 bv %r0(%r2) 886 nop 887 ENDPROC_CFI(flush_icache_page_asm) 888 889 ENTRY_CFI(flush_kernel_dcache_page_asm) 890 88: ldil L%dcache_stride, %r1 891 ldw R%dcache_stride(%r1), 892 depi_safe 0, 31,PAGE_SHIFT, %r26 893 894 #ifdef CONFIG_64BIT 895 depdi,z 1, 63-PAGE_SHIFT,1, %r 896 #else 897 depwi,z 1, 31-PAGE_SHIFT,1, %r 898 #endif 899 add %r26, %r25, %r25 900 sub %r25, %r23, %r25 901 902 1: fdc,m %r23(%r26) 903 fdc,m %r23(%r26) 904 fdc,m %r23(%r26) 905 fdc,m %r23(%r26) 906 fdc,m %r23(%r26) 907 fdc,m %r23(%r26) 908 fdc,m %r23(%r26) 909 fdc,m %r23(%r26) 910 fdc,m %r23(%r26) 911 fdc,m %r23(%r26) 912 fdc,m %r23(%r26) 913 fdc,m %r23(%r26) 914 fdc,m %r23(%r26) 915 fdc,m %r23(%r26) 916 fdc,m %r23(%r26) 917 cmpb,COND(>>) %r25, %r26, 1b /* pred 918 fdc,m %r23(%r26) 919 920 89: ALTERNATIVE(88b, 89b, ALT_COND_NO_DCAC 921 sync 922 bv %r0(%r2) 923 nop 924 ENDPROC_CFI(flush_kernel_dcache_page_asm) 925 926 ENTRY_CFI(purge_kernel_dcache_page_asm) 927 88: ldil L%dcache_stride, %r1 928 ldw R%dcache_stride(%r1), 929 depi_safe 0, 31,PAGE_SHIFT, %r26 930 931 #ifdef CONFIG_64BIT 932 depdi,z 1, 63-PAGE_SHIFT,1, %r 933 #else 934 depwi,z 1, 31-PAGE_SHIFT,1, %r 935 #endif 936 add %r26, %r25, %r25 937 sub %r25, %r23, %r25 938 939 1: pdc,m %r23(%r26) 940 pdc,m %r23(%r26) 941 pdc,m %r23(%r26) 942 pdc,m %r23(%r26) 943 pdc,m %r23(%r26) 944 pdc,m %r23(%r26) 945 pdc,m %r23(%r26) 946 pdc,m %r23(%r26) 947 pdc,m %r23(%r26) 948 pdc,m %r23(%r26) 949 pdc,m %r23(%r26) 950 pdc,m %r23(%r26) 951 pdc,m %r23(%r26) 952 pdc,m %r23(%r26) 953 pdc,m %r23(%r26) 954 cmpb,COND(>>) %r25, %r26, 1b /* pred 955 pdc,m %r23(%r26) 956 957 89: ALTERNATIVE(88b, 89b, ALT_COND_NO_DCAC 958 sync 959 bv %r0(%r2) 960 nop 961 ENDPROC_CFI(purge_kernel_dcache_page_asm) 962 963 ENTRY_CFI(flush_user_dcache_range_asm) 964 88: ldil L%dcache_stride, %r1 965 ldw R%dcache_stride(%r1), 966 ldo -1(%r23), %r21 967 ANDCM %r26, %r21, %r26 968 969 #ifdef CONFIG_64BIT 970 depd,z %r23, 59, 60, %r21 971 #else 972 depw,z %r23, 27, 28, %r21 973 #endif 974 add %r26, %r21, %r22 975 cmpb,COND(>>),n %r22, %r25, 2f /* pred 976 1: add %r22, %r21, %r22 977 fdc,m %r23(%sr3, %r26) 978 fdc,m %r23(%sr3, %r26) 979 fdc,m %r23(%sr3, %r26) 980 fdc,m %r23(%sr3, %r26) 981 fdc,m %r23(%sr3, %r26) 982 fdc,m %r23(%sr3, %r26) 983 fdc,m %r23(%sr3, %r26) 984 fdc,m %r23(%sr3, %r26) 985 fdc,m %r23(%sr3, %r26) 986 fdc,m %r23(%sr3, %r26) 987 fdc,m %r23(%sr3, %r26) 988 fdc,m %r23(%sr3, %r26) 989 fdc,m %r23(%sr3, %r26) 990 fdc,m %r23(%sr3, %r26) 991 fdc,m %r23(%sr3, %r26) 992 cmpb,COND(<<=) %r22, %r25, 1b /* pred 993 fdc,m %r23(%sr3, %r26) 994 995 2: cmpb,COND(>>),n %r25, %r26, 2b 996 fdc,m %r23(%sr3, %r26) 997 998 89: ALTERNATIVE(88b, 89b, ALT_COND_NO_DCAC 999 sync 1000 bv %r0(%r2) 1001 nop 1002 ENDPROC_CFI(flush_user_dcache_range_asm) 1003 1004 ENTRY_CFI(flush_kernel_dcache_range_asm) 1005 88: ldil L%dcache_stride, %r1 1006 ldw R%dcache_stride(%r1), 1007 ldo -1(%r23), %r21 1008 ANDCM %r26, %r21, %r26 1009 1010 #ifdef CONFIG_64BIT 1011 depd,z %r23, 59, 60, %r21 1012 #else 1013 depw,z %r23, 27, 28, %r21 1014 #endif 1015 add %r26, %r21, %r22 1016 cmpb,COND(>>),n %r22, %r25, 2f /* pre 1017 1: add %r22, %r21, %r22 1018 fdc,m %r23(%r26) 1019 fdc,m %r23(%r26) 1020 fdc,m %r23(%r26) 1021 fdc,m %r23(%r26) 1022 fdc,m %r23(%r26) 1023 fdc,m %r23(%r26) 1024 fdc,m %r23(%r26) 1025 fdc,m %r23(%r26) 1026 fdc,m %r23(%r26) 1027 fdc,m %r23(%r26) 1028 fdc,m %r23(%r26) 1029 fdc,m %r23(%r26) 1030 fdc,m %r23(%r26) 1031 fdc,m %r23(%r26) 1032 fdc,m %r23(%r26) 1033 cmpb,COND(<<=) %r22, %r25, 1b /* pre 1034 fdc,m %r23(%r26) 1035 1036 2: cmpb,COND(>>),n %r25, %r26, 2b /* pre 1037 fdc,m %r23(%r26) 1038 1039 sync 1040 89: ALTERNATIVE(88b, 89b, ALT_COND_NO_DCA 1041 bv %r0(%r2) 1042 nop 1043 ENDPROC_CFI(flush_kernel_dcache_range_asm) 1044 1045 ENTRY_CFI(purge_kernel_dcache_range_asm) 1046 88: ldil L%dcache_stride, %r1 1047 ldw R%dcache_stride(%r1), 1048 ldo -1(%r23), %r21 1049 ANDCM %r26, %r21, %r26 1050 1051 #ifdef CONFIG_64BIT 1052 depd,z %r23, 59, 60, %r21 1053 #else 1054 depw,z %r23, 27, 28, %r21 1055 #endif 1056 add %r26, %r21, %r22 1057 cmpb,COND(>>),n %r22, %r25, 2f /* pre 1058 1: add %r22, %r21, %r22 1059 pdc,m %r23(%r26) 1060 pdc,m %r23(%r26) 1061 pdc,m %r23(%r26) 1062 pdc,m %r23(%r26) 1063 pdc,m %r23(%r26) 1064 pdc,m %r23(%r26) 1065 pdc,m %r23(%r26) 1066 pdc,m %r23(%r26) 1067 pdc,m %r23(%r26) 1068 pdc,m %r23(%r26) 1069 pdc,m %r23(%r26) 1070 pdc,m %r23(%r26) 1071 pdc,m %r23(%r26) 1072 pdc,m %r23(%r26) 1073 pdc,m %r23(%r26) 1074 cmpb,COND(<<=) %r22, %r25, 1b /* pre 1075 pdc,m %r23(%r26) 1076 1077 2: cmpb,COND(>>),n %r25, %r26, 2b /* pre 1078 pdc,m %r23(%r26) 1079 1080 sync 1081 89: ALTERNATIVE(88b, 89b, ALT_COND_NO_DCA 1082 bv %r0(%r2) 1083 nop 1084 ENDPROC_CFI(purge_kernel_dcache_range_asm) 1085 1086 ENTRY_CFI(flush_user_icache_range_asm) 1087 88: ldil L%icache_stride, %r1 1088 ldw R%icache_stride(%r1), 1089 ldo -1(%r23), %r21 1090 ANDCM %r26, %r21, %r26 1091 1092 #ifdef CONFIG_64BIT 1093 depd,z %r23, 59, 60, %r21 1094 #else 1095 depw,z %r23, 27, 28, %r21 1096 #endif 1097 add %r26, %r21, %r22 1098 cmpb,COND(>>),n %r22, %r25, 2f /* pre 1099 1: add %r22, %r21, %r22 1100 fic,m %r23(%sr3, %r26) 1101 fic,m %r23(%sr3, %r26) 1102 fic,m %r23(%sr3, %r26) 1103 fic,m %r23(%sr3, %r26) 1104 fic,m %r23(%sr3, %r26) 1105 fic,m %r23(%sr3, %r26) 1106 fic,m %r23(%sr3, %r26) 1107 fic,m %r23(%sr3, %r26) 1108 fic,m %r23(%sr3, %r26) 1109 fic,m %r23(%sr3, %r26) 1110 fic,m %r23(%sr3, %r26) 1111 fic,m %r23(%sr3, %r26) 1112 fic,m %r23(%sr3, %r26) 1113 fic,m %r23(%sr3, %r26) 1114 fic,m %r23(%sr3, %r26) 1115 cmpb,COND(<<=) %r22, %r25, 1b /* pre 1116 fic,m %r23(%sr3, %r26) 1117 1118 2: cmpb,COND(>>),n %r25, %r26, 2b 1119 fic,m %r23(%sr3, %r26) 1120 1121 89: ALTERNATIVE(88b, 89b, ALT_COND_NO_ICA 1122 sync 1123 bv %r0(%r2) 1124 nop 1125 ENDPROC_CFI(flush_user_icache_range_asm) 1126 1127 ENTRY_CFI(flush_kernel_icache_page) 1128 88: ldil L%icache_stride, %r1 1129 ldw R%icache_stride(%r1), 1130 1131 #ifdef CONFIG_64BIT 1132 depdi,z 1, 63-PAGE_SHIFT,1, % 1133 #else 1134 depwi,z 1, 31-PAGE_SHIFT,1, % 1135 #endif 1136 add %r26, %r25, %r25 1137 sub %r25, %r23, %r25 1138 1139 1140 1: fic,m %r23(%sr4, %r26) 1141 fic,m %r23(%sr4, %r26) 1142 fic,m %r23(%sr4, %r26) 1143 fic,m %r23(%sr4, %r26) 1144 fic,m %r23(%sr4, %r26) 1145 fic,m %r23(%sr4, %r26) 1146 fic,m %r23(%sr4, %r26) 1147 fic,m %r23(%sr4, %r26) 1148 fic,m %r23(%sr4, %r26) 1149 fic,m %r23(%sr4, %r26) 1150 fic,m %r23(%sr4, %r26) 1151 fic,m %r23(%sr4, %r26) 1152 fic,m %r23(%sr4, %r26) 1153 fic,m %r23(%sr4, %r26) 1154 fic,m %r23(%sr4, %r26) 1155 cmpb,COND(>>) %r25, %r26, 1b /* pre 1156 fic,m %r23(%sr4, %r26) 1157 1158 89: ALTERNATIVE(88b, 89b, ALT_COND_NO_ICA 1159 sync 1160 bv %r0(%r2) 1161 nop 1162 ENDPROC_CFI(flush_kernel_icache_page) 1163 1164 ENTRY_CFI(flush_kernel_icache_range_asm) 1165 88: ldil L%icache_stride, %r1 1166 ldw R%icache_stride(%r1), 1167 ldo -1(%r23), %r21 1168 ANDCM %r26, %r21, %r26 1169 1170 #ifdef CONFIG_64BIT 1171 depd,z %r23, 59, 60, %r21 1172 #else 1173 depw,z %r23, 27, 28, %r21 1174 #endif 1175 add %r26, %r21, %r22 1176 cmpb,COND(>>),n %r22, %r25, 2f /* pre 1177 1: add %r22, %r21, %r22 1178 fic,m %r23(%sr4, %r26) 1179 fic,m %r23(%sr4, %r26) 1180 fic,m %r23(%sr4, %r26) 1181 fic,m %r23(%sr4, %r26) 1182 fic,m %r23(%sr4, %r26) 1183 fic,m %r23(%sr4, %r26) 1184 fic,m %r23(%sr4, %r26) 1185 fic,m %r23(%sr4, %r26) 1186 fic,m %r23(%sr4, %r26) 1187 fic,m %r23(%sr4, %r26) 1188 fic,m %r23(%sr4, %r26) 1189 fic,m %r23(%sr4, %r26) 1190 fic,m %r23(%sr4, %r26) 1191 fic,m %r23(%sr4, %r26) 1192 fic,m %r23(%sr4, %r26) 1193 cmpb,COND(<<=) %r22, %r25, 1b /* pre 1194 fic,m %r23(%sr4, %r26) 1195 1196 2: cmpb,COND(>>),n %r25, %r26, 2b /* pre 1197 fic,m %r23(%sr4, %r26) 1198 1199 89: ALTERNATIVE(88b, 89b, ALT_COND_NO_ICA 1200 sync 1201 bv %r0(%r2) 1202 nop 1203 ENDPROC_CFI(flush_kernel_icache_range_asm) 1204 1205 .text 1206 1207 /* align should cover use of rfi in d 1208 * srdis_done. 1209 */ 1210 .align 256 1211 ENTRY_CFI(disable_sr_hashing_asm) 1212 /* 1213 * Switch to real mode 1214 */ 1215 /* pcxt_ssm_bug */ 1216 rsm PSW_SM_I, %r0 1217 load32 PA(1f), %r1 1218 nop 1219 nop 1220 nop 1221 nop 1222 nop 1223 1224 rsm PSW_SM_Q, %r0 1225 mtctl %r0, %cr17 1226 mtctl %r0, %cr17 1227 mtctl %r1, %cr18 1228 ldo 4(%r1), %r1 1229 mtctl %r1, %cr18 1230 load32 REAL_MODE_PSW, %r1 1231 mtctl %r1, %ipsw 1232 rfi 1233 nop 1234 1235 1: cmpib,=,n SRHASH_PCXST, %r26,sr 1236 cmpib,=,n SRHASH_PCXL, %r26,srd 1237 cmpib,=,n SRHASH_PA20, %r26,srd 1238 b,n srdis_done 1239 1240 srdis_pcxs: 1241 1242 /* Disable Space Register Hashing for 1243 1244 .word 0x141c1a00 1245 .word 0x141c1a00 1246 depwi 0,18,1, %r28 1247 depwi 0,20,1, %r28 1248 .word 0x141c1600 1249 .word 0x141c1600 1250 b,n srdis_done 1251 1252 srdis_pcxl: 1253 1254 /* Disable Space Register Hashing for 1255 1256 .word 0x141c0600 1257 depwi 0,28,2, %r28 1258 .word 0x141c0240 1259 b,n srdis_done 1260 1261 srdis_pa20: 1262 1263 /* Disable Space Register Hashing for 1264 1265 .word 0x144008bc 1266 depdi 0, 54,1, %r28 1267 .word 0x145c1840 1268 1269 1270 srdis_done: 1271 /* Switch back to virtual mode */ 1272 rsm PSW_SM_I, %r0 1273 load32 2f, %r1 1274 nop 1275 nop 1276 nop 1277 nop 1278 nop 1279 1280 rsm PSW_SM_Q, %r0 1281 mtctl %r0, %cr17 1282 mtctl %r0, %cr17 1283 mtctl %r1, %cr18 1284 ldo 4(%r1), %r1 1285 mtctl %r1, %cr18 1286 load32 KERNEL_PSW, %r1 1287 mtctl %r1, %ipsw 1288 rfi 1289 nop 1290 1291 2: bv %r0(%r2) 1292 nop 1293 ENDPROC_CFI(disable_sr_hashing_asm) 1294 1295 .end
Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.