diff options
author | Matt Fleming <matt@console-pimps.org> | 2010-03-21 19:51:52 +0000 |
---|---|---|
committer | Paul Mundt <lethal@linux-sh.org> | 2010-03-23 13:36:21 +0900 |
commit | b5b6c7eea1124de5b110a48ac62650a690ed2419 (patch) | |
tree | d87983aa0d009f6cfc5813f67bc4beffbd4fadf2 /arch/sh/mm/tlbflush_32.c | |
parent | a9eb4f6d1a168c830a206306dfbb1f95a7fed6b3 (diff) | |
download | blackbird-op-linux-b5b6c7eea1124de5b110a48ac62650a690ed2419.tar.gz blackbird-op-linux-b5b6c7eea1124de5b110a48ac62650a690ed2419.zip |
sh: Replace unsafe manipulation of MMUCR
Setting the TI in MMUCR causes all the TLB bits in MMUCR to be
cleared. Unfortunately, the TLB wired bits are also cleared when setting
the TI bit, causing any wired TLB entries to become unwired.
Use local_flush_tlb_all() which implements TLB flushing in a safer
manner by using the memory-mapped TLB registers. As each CPU has its own
PMB the modifications in pmb_init() only affect the local CPU, so only
flush the local CPU's TLB.
Signed-off-by: Matt Fleming <matt@console-pimps.org>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
Diffstat (limited to 'arch/sh/mm/tlbflush_32.c')
-rw-r--r-- | arch/sh/mm/tlbflush_32.c | 21 |
1 files changed, 15 insertions, 6 deletions
diff --git a/arch/sh/mm/tlbflush_32.c b/arch/sh/mm/tlbflush_32.c index 004bb3f25b5f..77dc5efa7127 100644 --- a/arch/sh/mm/tlbflush_32.c +++ b/arch/sh/mm/tlbflush_32.c @@ -123,18 +123,27 @@ void local_flush_tlb_mm(struct mm_struct *mm) void local_flush_tlb_all(void) { unsigned long flags, status; + int i; /* * Flush all the TLB. - * - * Write to the MMU control register's bit: - * TF-bit for SH-3, TI-bit for SH-4. - * It's same position, bit #2. */ local_irq_save(flags); + jump_to_uncached(); + status = __raw_readl(MMUCR); - status |= 0x04; - __raw_writel(status, MMUCR); + status = ((status & MMUCR_URB) >> MMUCR_URB_SHIFT); + + if (status == 0) + status = MMUCR_URB_NENTRIES; + + for (i = 0; i < status; i++) + __raw_writel(0x0, MMU_UTLB_ADDRESS_ARRAY | (i << 8)); + + for (i = 0; i < 4; i++) + __raw_writel(0x0, MMU_ITLB_ADDRESS_ARRAY | (i << 8)); + + back_to_cached(); ctrl_barrier(); local_irq_restore(flags); } |