diff options
author | Kumar Gala <galak@kernel.crashing.org> | 2009-03-18 23:55:40 -0400 |
---|---|---|
committer | Benjamin Herrenschmidt <benh@kernel.crashing.org> | 2009-03-23 22:47:31 -0400 |
commit | eb3436a0139a651a39dbb37a75b10a2cccd00ad5 (patch) | |
tree | b3925f180d0a7e80b76476694db42bb338db4d6c /arch/powerpc/kernel/head_32.S | |
parent | 00fcb14703d8322a9c66cb3f48b5c49ac7d43f0a (diff) |
powerpc/mm: Used free register to save a few cycles in SW TLB miss handling
Now that r0 is free we can keep the value of I/DMISS in r3 and not reload
it before doing the tlbli/d. This saves us a few cycles in the fast path
case.
Signed-off-by: Kumar Gala <galak@kernel.crashing.org>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Diffstat (limited to 'arch/powerpc/kernel/head_32.S')
-rw-r--r-- | arch/powerpc/kernel/head_32.S | 51 |
1 files changed, 24 insertions, 27 deletions
diff --git a/arch/powerpc/kernel/head_32.S b/arch/powerpc/kernel/head_32.S index f37df0c3afbd..58dcc7c03109 100644 --- a/arch/powerpc/kernel/head_32.S +++ b/arch/powerpc/kernel/head_32.S | |||
@@ -498,28 +498,27 @@ InstructionTLBMiss: | |||
498 | rlwinm. r2,r2,0,0,19 /* extract address of pte page */ | 498 | rlwinm. r2,r2,0,0,19 /* extract address of pte page */ |
499 | beq- InstructionAddressInvalid /* return if no mapping */ | 499 | beq- InstructionAddressInvalid /* return if no mapping */ |
500 | rlwimi r2,r3,22,20,29 /* insert next 10 bits of address */ | 500 | rlwimi r2,r3,22,20,29 /* insert next 10 bits of address */ |
501 | lwz r3,0(r2) /* get linux-style pte */ | 501 | lwz r0,0(r2) /* get linux-style pte */ |
502 | andc. r1,r1,r3 /* check access & ~permission */ | 502 | andc. r1,r1,r0 /* check access & ~permission */ |
503 | bne- InstructionAddressInvalid /* return if access not permitted */ | 503 | bne- InstructionAddressInvalid /* return if access not permitted */ |
504 | ori r3,r3,_PAGE_ACCESSED /* set _PAGE_ACCESSED in pte */ | 504 | ori r0,r0,_PAGE_ACCESSED /* set _PAGE_ACCESSED in pte */ |
505 | /* | 505 | /* |
506 | * NOTE! We are assuming this is not an SMP system, otherwise | 506 | * NOTE! We are assuming this is not an SMP system, otherwise |
507 | * we would need to update the pte atomically with lwarx/stwcx. | 507 | * we would need to update the pte atomically with lwarx/stwcx. |
508 | */ | 508 | */ |
509 | stw r3,0(r2) /* update PTE (accessed bit) */ | 509 | stw r0,0(r2) /* update PTE (accessed bit) */ |
510 | /* Convert linux-style PTE to low word of PPC-style PTE */ | 510 | /* Convert linux-style PTE to low word of PPC-style PTE */ |
511 | rlwinm r1,r3,32-10,31,31 /* _PAGE_RW -> PP lsb */ | 511 | rlwinm r1,r0,32-10,31,31 /* _PAGE_RW -> PP lsb */ |
512 | rlwinm r2,r3,32-7,31,31 /* _PAGE_DIRTY -> PP lsb */ | 512 | rlwinm r2,r0,32-7,31,31 /* _PAGE_DIRTY -> PP lsb */ |
513 | and r1,r1,r2 /* writable if _RW and _DIRTY */ | 513 | and r1,r1,r2 /* writable if _RW and _DIRTY */ |
514 | rlwimi r3,r3,32-1,30,30 /* _PAGE_USER -> PP msb */ | 514 | rlwimi r0,r0,32-1,30,30 /* _PAGE_USER -> PP msb */ |
515 | rlwimi r3,r3,32-1,31,31 /* _PAGE_USER -> PP lsb */ | 515 | rlwimi r0,r0,32-1,31,31 /* _PAGE_USER -> PP lsb */ |
516 | ori r1,r1,0xe04 /* clear out reserved bits */ | 516 | ori r1,r1,0xe04 /* clear out reserved bits */ |
517 | andc r1,r3,r1 /* PP = user? (rw&dirty? 2: 3): 0 */ | 517 | andc r1,r0,r1 /* PP = user? (rw&dirty? 2: 3): 0 */ |
518 | BEGIN_FTR_SECTION | 518 | BEGIN_FTR_SECTION |
519 | rlwinm r1,r1,0,~_PAGE_COHERENT /* clear M (coherence not required) */ | 519 | rlwinm r1,r1,0,~_PAGE_COHERENT /* clear M (coherence not required) */ |
520 | END_FTR_SECTION_IFCLR(CPU_FTR_NEED_COHERENT) | 520 | END_FTR_SECTION_IFCLR(CPU_FTR_NEED_COHERENT) |
521 | mtspr SPRN_RPA,r1 | 521 | mtspr SPRN_RPA,r1 |
522 | mfspr r3,SPRN_IMISS | ||
523 | tlbli r3 | 522 | tlbli r3 |
524 | mfspr r3,SPRN_SRR1 /* Need to restore CR0 */ | 523 | mfspr r3,SPRN_SRR1 /* Need to restore CR0 */ |
525 | mtcrf 0x80,r3 | 524 | mtcrf 0x80,r3 |
@@ -573,28 +572,27 @@ DataLoadTLBMiss: | |||
573 | rlwinm. r2,r2,0,0,19 /* extract address of pte page */ | 572 | rlwinm. r2,r2,0,0,19 /* extract address of pte page */ |
574 | beq- DataAddressInvalid /* return if no mapping */ | 573 | beq- DataAddressInvalid /* return if no mapping */ |
575 | rlwimi r2,r3,22,20,29 /* insert next 10 bits of address */ | 574 | rlwimi r2,r3,22,20,29 /* insert next 10 bits of address */ |
576 | lwz r3,0(r2) /* get linux-style pte */ | 575 | lwz r0,0(r2) /* get linux-style pte */ |
577 | andc. r1,r1,r3 /* check access & ~permission */ | 576 | andc. r1,r1,r0 /* check access & ~permission */ |
578 | bne- DataAddressInvalid /* return if access not permitted */ | 577 | bne- DataAddressInvalid /* return if access not permitted */ |
579 | ori r3,r3,_PAGE_ACCESSED /* set _PAGE_ACCESSED in pte */ | 578 | ori r0,r0,_PAGE_ACCESSED /* set _PAGE_ACCESSED in pte */ |
580 | /* | 579 | /* |
581 | * NOTE! We are assuming this is not an SMP system, otherwise | 580 | * NOTE! We are assuming this is not an SMP system, otherwise |
582 | * we would need to update the pte atomically with lwarx/stwcx. | 581 | * we would need to update the pte atomically with lwarx/stwcx. |
583 | */ | 582 | */ |
584 | stw r3,0(r2) /* update PTE (accessed bit) */ | 583 | stw r0,0(r2) /* update PTE (accessed bit) */ |
585 | /* Convert linux-style PTE to low word of PPC-style PTE */ | 584 | /* Convert linux-style PTE to low word of PPC-style PTE */ |
586 | rlwinm r1,r3,32-10,31,31 /* _PAGE_RW -> PP lsb */ | 585 | rlwinm r1,r0,32-10,31,31 /* _PAGE_RW -> PP lsb */ |
587 | rlwinm r2,r3,32-7,31,31 /* _PAGE_DIRTY -> PP lsb */ | 586 | rlwinm r2,r0,32-7,31,31 /* _PAGE_DIRTY -> PP lsb */ |
588 | and r1,r1,r2 /* writable if _RW and _DIRTY */ | 587 | and r1,r1,r2 /* writable if _RW and _DIRTY */ |
589 | rlwimi r3,r3,32-1,30,30 /* _PAGE_USER -> PP msb */ | 588 | rlwimi r0,r0,32-1,30,30 /* _PAGE_USER -> PP msb */ |
590 | rlwimi r3,r3,32-1,31,31 /* _PAGE_USER -> PP lsb */ | 589 | rlwimi r0,r0,32-1,31,31 /* _PAGE_USER -> PP lsb */ |
591 | ori r1,r1,0xe04 /* clear out reserved bits */ | 590 | ori r1,r1,0xe04 /* clear out reserved bits */ |
592 | andc r1,r3,r1 /* PP = user? (rw&dirty? 2: 3): 0 */ | 591 | andc r1,r0,r1 /* PP = user? (rw&dirty? 2: 3): 0 */ |
593 | BEGIN_FTR_SECTION | 592 | BEGIN_FTR_SECTION |
594 | rlwinm r1,r1,0,~_PAGE_COHERENT /* clear M (coherence not required) */ | 593 | rlwinm r1,r1,0,~_PAGE_COHERENT /* clear M (coherence not required) */ |
595 | END_FTR_SECTION_IFCLR(CPU_FTR_NEED_COHERENT) | 594 | END_FTR_SECTION_IFCLR(CPU_FTR_NEED_COHERENT) |
596 | mtspr SPRN_RPA,r1 | 595 | mtspr SPRN_RPA,r1 |
597 | mfspr r3,SPRN_DMISS | ||
598 | tlbld r3 | 596 | tlbld r3 |
599 | mfspr r3,SPRN_SRR1 /* Need to restore CR0 */ | 597 | mfspr r3,SPRN_SRR1 /* Need to restore CR0 */ |
600 | mtcrf 0x80,r3 | 598 | mtcrf 0x80,r3 |
@@ -646,24 +644,23 @@ DataStoreTLBMiss: | |||
646 | rlwinm. r2,r2,0,0,19 /* extract address of pte page */ | 644 | rlwinm. r2,r2,0,0,19 /* extract address of pte page */ |
647 | beq- DataAddressInvalid /* return if no mapping */ | 645 | beq- DataAddressInvalid /* return if no mapping */ |
648 | rlwimi r2,r3,22,20,29 /* insert next 10 bits of address */ | 646 | rlwimi r2,r3,22,20,29 /* insert next 10 bits of address */ |
649 | lwz r3,0(r2) /* get linux-style pte */ | 647 | lwz r0,0(r2) /* get linux-style pte */ |
650 | andc. r1,r1,r3 /* check access & ~permission */ | 648 | andc. r1,r1,r0 /* check access & ~permission */ |
651 | bne- DataAddressInvalid /* return if access not permitted */ | 649 | bne- DataAddressInvalid /* return if access not permitted */ |
652 | ori r3,r3,_PAGE_ACCESSED|_PAGE_DIRTY | 650 | ori r0,r0,_PAGE_ACCESSED|_PAGE_DIRTY |
653 | /* | 651 | /* |
654 | * NOTE! We are assuming this is not an SMP system, otherwise | 652 | * NOTE! We are assuming this is not an SMP system, otherwise |
655 | * we would need to update the pte atomically with lwarx/stwcx. | 653 | * we would need to update the pte atomically with lwarx/stwcx. |
656 | */ | 654 | */ |
657 | stw r3,0(r2) /* update PTE (accessed/dirty bits) */ | 655 | stw r0,0(r2) /* update PTE (accessed/dirty bits) */ |
658 | /* Convert linux-style PTE to low word of PPC-style PTE */ | 656 | /* Convert linux-style PTE to low word of PPC-style PTE */ |
659 | rlwimi r3,r3,32-1,30,30 /* _PAGE_USER -> PP msb */ | 657 | rlwimi r0,r0,32-1,30,30 /* _PAGE_USER -> PP msb */ |
660 | li r1,0xe05 /* clear out reserved bits & PP lsb */ | 658 | li r1,0xe05 /* clear out reserved bits & PP lsb */ |
661 | andc r1,r3,r1 /* PP = user? 2: 0 */ | 659 | andc r1,r0,r1 /* PP = user? 2: 0 */ |
662 | BEGIN_FTR_SECTION | 660 | BEGIN_FTR_SECTION |
663 | rlwinm r1,r1,0,~_PAGE_COHERENT /* clear M (coherence not required) */ | 661 | rlwinm r1,r1,0,~_PAGE_COHERENT /* clear M (coherence not required) */ |
664 | END_FTR_SECTION_IFCLR(CPU_FTR_NEED_COHERENT) | 662 | END_FTR_SECTION_IFCLR(CPU_FTR_NEED_COHERENT) |
665 | mtspr SPRN_RPA,r1 | 663 | mtspr SPRN_RPA,r1 |
666 | mfspr r3,SPRN_DMISS | ||
667 | tlbld r3 | 664 | tlbld r3 |
668 | mfspr r3,SPRN_SRR1 /* Need to restore CR0 */ | 665 | mfspr r3,SPRN_SRR1 /* Need to restore CR0 */ |
669 | mtcrf 0x80,r3 | 666 | mtcrf 0x80,r3 |