[PATCH/RFC] powerpc: Pass PID argument to _tlbie (WAS: Apparent kernel bug with GDB on ppc405)
Matt Mackall
mpm at selenic.com
Tue Oct 30 08:13:20 EST 2007
[adding back gdb list]
On Tue, Oct 30, 2007 at 07:35:06AM +1100, Benjamin Herrenschmidt wrote:
>
> > Did a boot test on my ebony board with this patch included. It seems
> > to be happy about things so far. If Matt gets around to trying this
> > out and it works, we should probably look at getting this into 2.6.24.
> >
> > Oh, and I'd need a signed-off-by for it Ben :)
>
> Sure, I'll send you a cleaned up version (the version I posted for test
> breaks 64 bits builds :-)
>
> But I'm also waiting for Matt to test first.
Ok, just backported the 405 bits of this to my client's sad sad MV
2.6.10 kernel and it appears to work fine. Only tricky bit was
context.id -> context. So:
Tested-by: Matt Mackall <mpm at selenic.com>
And here's my backported patch, just for reference:
Index: k/arch/ppc/kernel/misc.S
===================================================================
--- k.orig/arch/ppc/kernel/misc.S 2007-10-29 15:33:03.000000000 -0500
+++ k/arch/ppc/kernel/misc.S 2007-10-29 15:34:29.000000000 -0500
@@ -496,7 +496,13 @@ _GLOBAL(_tlbia)
*/
_GLOBAL(_tlbie)
#if defined(CONFIG_40x)
+ mfmsr r5
+ mfspr r6,SPRN_PID
+ wrteei 0
+ mtspr SPRN_PID,r4
tlbsx. r3, 0, r3
+ mtspr SPRN_PID,r6
+ wrtee r5
bne 10f
sync
/* There are only 64 TLB entries, so r3 < 64, which means bit 25 is clear.
Index: k/arch/ppc/mm/fault.c
===================================================================
--- k.orig/arch/ppc/mm/fault.c 2007-10-29 15:30:04.000000000 -0500
+++ k/arch/ppc/mm/fault.c 2007-10-29 16:11:10.000000000 -0500
@@ -234,7 +234,7 @@ good_area:
set_bit(PG_arch_1, &page->flags);
}
pte_update(ptep, 0, _PAGE_HWEXEC);
- _tlbie(address);
+ _tlbie(address, mm->context);
pte_unmap(ptep);
up_read(&mm->mmap_sem);
ltt_ev_trap_exit();
Index: k/arch/ppc/mm/mmu_decl.h
===================================================================
--- k.orig/arch/ppc/mm/mmu_decl.h 2007-10-29 15:34:48.000000000 -0500
+++ k/arch/ppc/mm/mmu_decl.h 2007-10-29 16:11:25.000000000 -0500
@@ -54,7 +54,7 @@ extern unsigned int num_tlbcam_entries;
#define mmu_mapin_ram() (0UL)
#elif defined(CONFIG_4xx)
-#define flush_HPTE(X, va, pg) _tlbie(va)
+#define flush_HPTE(pid, va, pg) _tlbie(va, pid)
extern void MMU_init_hw(void);
extern unsigned long mmu_mapin_ram(void);
Index: k/include/asm-ppc/tlbflush.h
===================================================================
--- k.orig/include/asm-ppc/tlbflush.h 2007-10-29 15:31:29.000000000 -0500
+++ k/include/asm-ppc/tlbflush.h 2007-10-29 16:11:32.000000000 -0500
@@ -13,7 +13,7 @@
#include <linux/config.h>
#include <linux/mm.h>
-extern void _tlbie(unsigned long address);
+extern void _tlbie(unsigned long address, unsigned int pid);
extern void _tlbia(void);
#if defined(CONFIG_4xx)
@@ -28,10 +28,10 @@ static inline void flush_tlb_mm(struct m
{ __tlbia(); }
static inline void flush_tlb_page(struct vm_area_struct *vma,
unsigned long vmaddr)
- { _tlbie(vmaddr); }
+ { _tlbie(vmaddr, vma->vm_mm->context); }
static inline void flush_tlb_page_nohash(struct vm_area_struct *vma,
unsigned long vmaddr)
- { _tlbie(vmaddr); }
+ { _tlbie(vmaddr, vma->vm_mm->context); }
static inline void flush_tlb_range(struct vm_area_struct *vma,
unsigned long start, unsigned long end)
{ __tlbia(); }
--
Mathematics is the supreme nostalgia of our time.
More information about the Linuxppc-embedded
mailing list