diff options
author | Joakim Tjernlund <joakim.tjernlund@transmode.se> | 2009-11-19 19:21:10 -0500 |
---|---|---|
committer | Benjamin Herrenschmidt <benh@kernel.crashing.org> | 2009-12-09 01:10:37 -0500 |
commit | 2321f33790a6c5b80322d907a92d5739e7521a13 (patch) | |
tree | 1cb6c6a3aba5862ca7877aac6bca054377c305ec | |
parent | 15d914d72a3f4f1531c41c084cb556be22aa1d2e (diff) |
powerpc/8xx: Remove DIRTY pte handling in DTLB Error.
There is no need to do set the DIRTY bit directly in DTLB Error.
Trap to do_page_fault() and let the generic MM code do the work.
Signed-off-by: Joakim Tjernlund <Joakim.Tjernlund@transmode.se>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
-rw-r--r-- | arch/powerpc/kernel/head_8xx.S | 96 |
1 files changed, 0 insertions, 96 deletions
diff --git a/arch/powerpc/kernel/head_8xx.S b/arch/powerpc/kernel/head_8xx.S index c4ae85b8f8c0..f2de8e8a825c 100644 --- a/arch/powerpc/kernel/head_8xx.S +++ b/arch/powerpc/kernel/head_8xx.S | |||
@@ -500,102 +500,6 @@ DataTLBError: | |||
500 | cmpwi cr0, r10, 0x00f0 | 500 | cmpwi cr0, r10, 0x00f0 |
501 | beq- FixupDAR /* must be a buggy dcbX, icbi insn. */ | 501 | beq- FixupDAR /* must be a buggy dcbX, icbi insn. */ |
502 | DARFixed:/* Return from dcbx instruction bug workaround, r10 holds value of DAR */ | 502 | DARFixed:/* Return from dcbx instruction bug workaround, r10 holds value of DAR */ |
503 | mfspr r11, SPRN_DSISR | ||
504 | /* As the DAR fixup may clear store we may have all 3 states zero. | ||
505 | * Make sure only 0x0200(store) falls down into DIRTY handling | ||
506 | */ | ||
507 | andis. r11, r11, 0x4a00 /* !translation, protection or store */ | ||
508 | srwi r11, r11, 16 | ||
509 | cmpwi cr0, r11, 0x0200 /* just store ? */ | ||
510 | bne 2f | ||
511 | /* Only Change bit left now, do it here as it is faster | ||
512 | * than trapping to the C fault handler. | ||
513 | */ | ||
514 | |||
515 | /* The EA of a data TLB miss is automatically stored in the MD_EPN | ||
516 | * register. The EA of a data TLB error is automatically stored in | ||
517 | * the DAR, but not the MD_EPN register. We must copy the 20 most | ||
518 | * significant bits of the EA from the DAR to MD_EPN before we | ||
519 | * start walking the page tables. We also need to copy the CASID | ||
520 | * value from the M_CASID register. | ||
521 | * Addendum: The EA of a data TLB error is _supposed_ to be stored | ||
522 | * in DAR, but it seems that this doesn't happen in some cases, such | ||
523 | * as when the error is due to a dcbi instruction to a page with a | ||
524 | * TLB that doesn't have the changed bit set. In such cases, there | ||
525 | * does not appear to be any way to recover the EA of the error | ||
526 | * since it is neither in DAR nor MD_EPN. As a workaround, the | ||
527 | * _PAGE_HWWRITE bit is set for all kernel data pages when the PTEs | ||
528 | * are initialized in mapin_ram(). This will avoid the problem, | ||
529 | * assuming we only use the dcbi instruction on kernel addresses. | ||
530 | */ | ||
531 | |||
532 | /* DAR is in r10 already */ | ||
533 | rlwinm r11, r10, 0, 0, 19 | ||
534 | ori r11, r11, MD_EVALID | ||
535 | mfspr r10, SPRN_M_CASID | ||
536 | rlwimi r11, r10, 0, 28, 31 | ||
537 | DO_8xx_CPU6(0x3780, r3) | ||
538 | mtspr SPRN_MD_EPN, r11 | ||
539 | |||
540 | mfspr r10, SPRN_M_TWB /* Get level 1 table entry address */ | ||
541 | |||
542 | /* If we are faulting a kernel address, we have to use the | ||
543 | * kernel page tables. | ||
544 | */ | ||
545 | andi. r11, r10, 0x0800 | ||
546 | beq 3f | ||
547 | lis r11, swapper_pg_dir@h | ||
548 | ori r11, r11, swapper_pg_dir@l | ||
549 | rlwimi r10, r11, 0, 2, 19 | ||
550 | 3: | ||
551 | lwz r11, 0(r10) /* Get the level 1 entry */ | ||
552 | rlwinm. r10, r11,0,0,19 /* Extract page descriptor page address */ | ||
553 | beq 2f /* If zero, bail */ | ||
554 | |||
555 | /* We have a pte table, so fetch the pte from the table. | ||
556 | */ | ||
557 | ori r11, r11, 1 /* Set valid bit in physical L2 page */ | ||
558 | DO_8xx_CPU6(0x3b80, r3) | ||
559 | mtspr SPRN_MD_TWC, r11 /* Load pte table base address */ | ||
560 | mfspr r10, SPRN_MD_TWC /* ....and get the pte address */ | ||
561 | lwz r10, 0(r10) /* Get the pte */ | ||
562 | /* Insert the Guarded flag into the TWC from the Linux PTE. | ||
563 | * It is bit 27 of both the Linux PTE and the TWC | ||
564 | */ | ||
565 | rlwimi r11, r10, 0, 27, 27 | ||
566 | /* Insert the WriteThru flag into the TWC from the Linux PTE. | ||
567 | * It is bit 25 in the Linux PTE and bit 30 in the TWC | ||
568 | */ | ||
569 | rlwimi r11, r10, 32-5, 30, 30 | ||
570 | DO_8xx_CPU6(0x3b80, r3) | ||
571 | mtspr SPRN_MD_TWC, r11 | ||
572 | mfspr r11, SPRN_MD_TWC /* get the pte address again */ | ||
573 | |||
574 | ori r10, r10, _PAGE_DIRTY | _PAGE_ACCESSED | _PAGE_HWWRITE | ||
575 | stw r10, 0(r11) /* and update pte in table */ | ||
576 | xori r10, r10, _PAGE_RW /* RW bit is inverted */ | ||
577 | |||
578 | /* The Linux PTE won't go exactly into the MMU TLB. | ||
579 | * Software indicator bits 22 and 28 must be clear. | ||
580 | * Software indicator bits 24, 25, 26, and 27 must be | ||
581 | * set. All other Linux PTE bits control the behavior | ||
582 | * of the MMU. | ||
583 | */ | ||
584 | li r11, 0x00f0 | ||
585 | mtspr SPRN_DAR,r11 /* Tag DAR */ | ||
586 | rlwimi r10, r11, 0, 24, 28 /* Set 24-27, clear 28 */ | ||
587 | DO_8xx_CPU6(0x3d80, r3) | ||
588 | mtspr SPRN_MD_RPN, r10 /* Update TLB entry */ | ||
589 | |||
590 | mfspr r10, SPRN_M_TW /* Restore registers */ | ||
591 | lwz r11, 0(r0) | ||
592 | mtcr r11 | ||
593 | lwz r11, 4(r0) | ||
594 | #ifdef CONFIG_8xx_CPU6 | ||
595 | lwz r3, 8(r0) | ||
596 | #endif | ||
597 | rfi | ||
598 | 2: | ||
599 | mfspr r10, SPRN_M_TW /* Restore registers */ | 503 | mfspr r10, SPRN_M_TW /* Restore registers */ |
600 | lwz r11, 0(r0) | 504 | lwz r11, 0(r0) |
601 | mtcr r11 | 505 | mtcr r11 |