Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 73337
b: refs/heads/master
c: e701d26
h: refs/heads/master
i:
  73335: 2287718
v: v3
  • Loading branch information
Benjamin Herrenschmidt authored and Josh Boyer committed Nov 1, 2007
1 parent ca4d6f2 commit 7fdb6fe
Show file tree
Hide file tree
Showing 11 changed files with 47 additions and 30 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 57d75561be5496289601b2c94787ec38c718fcae
refs/heads/master: e701d269aa28996f3502780951fe1b12d5d66b49
23 changes: 16 additions & 7 deletions trunk/arch/powerpc/kernel/misc_32.S
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,16 @@ _GLOBAL(_tlbia)
*/
_GLOBAL(_tlbie)
#if defined(CONFIG_40x)
/* We run the search with interrupts disabled because we have to change
* the PID and I don't want to preempt when that happens.
*/
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.
Expand All @@ -297,23 +306,23 @@ _GLOBAL(_tlbie)
tlbwe r3, r3, TLB_TAG
isync
10:

#elif defined(CONFIG_44x)
mfspr r4,SPRN_MMUCR
mfspr r5,SPRN_PID /* Get PID */
rlwimi r4,r5,0,24,31 /* Set TID */
mfspr r5,SPRN_MMUCR
rlwimi r5,r4,0,24,31 /* Set TID */

/* We have to run the search with interrupts disabled, even critical
* and debug interrupts (in fact the only critical exceptions we have
* are debug and machine check). Otherwise an interrupt which causes
* a TLB miss can clobber the MMUCR between the mtspr and the tlbsx. */
mfmsr r5
mfmsr r4
lis r6,(MSR_EE|MSR_CE|MSR_ME|MSR_DE)@ha
addi r6,r6,(MSR_EE|MSR_CE|MSR_ME|MSR_DE)@l
andc r6,r5,r6
andc r6,r4,r6
mtmsr r6
mtspr SPRN_MMUCR,r4
mtspr SPRN_MMUCR,r5
tlbsx. r3, 0, r3
mtmsr r5
mtmsr r4
bne 10f
sync
/* There are only 64 TLB entries, so r3 < 64,
Expand Down
2 changes: 1 addition & 1 deletion trunk/arch/powerpc/mm/fault.c
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,7 @@ int __kprobes do_page_fault(struct pt_regs *regs, unsigned long address,
set_bit(PG_arch_1, &page->flags);
}
pte_update(ptep, 0, _PAGE_HWEXEC);
_tlbie(address);
_tlbie(address, mm->context.id);
pte_unmap_unlock(ptep, ptl);
up_read(&mm->mmap_sem);
return 0;
Expand Down
4 changes: 2 additions & 2 deletions trunk/arch/powerpc/mm/mmu_decl.h
Original file line number Diff line number Diff line change
Expand Up @@ -61,12 +61,12 @@ extern unsigned long total_lowmem;
#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);

#elif defined(CONFIG_FSL_BOOKE)
#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);
extern void adjust_total_lowmem(void);
Expand Down
22 changes: 15 additions & 7 deletions trunk/arch/ppc/kernel/misc.S
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,16 @@ _GLOBAL(_tlbia)
*/
_GLOBAL(_tlbie)
#if defined(CONFIG_40x)
/* We run the search with interrupts disabled because we have to change
* the PID and I don't want to preempt when that happens.
*/
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.
Expand All @@ -234,22 +243,21 @@ _GLOBAL(_tlbie)
isync
10:
#elif defined(CONFIG_44x)
mfspr r4,SPRN_MMUCR
mfspr r5,SPRN_PID /* Get PID */
rlwimi r4,r5,0,24,31 /* Set TID */
mfspr r5,SPRN_MMUCR
rlwimi r5,r4,0,24,31 /* Set TID */

/* We have to run the search with interrupts disabled, even critical
* and debug interrupts (in fact the only critical exceptions we have
* are debug and machine check). Otherwise an interrupt which causes
* a TLB miss can clobber the MMUCR between the mtspr and the tlbsx. */
mfmsr r5
mfmsr r4
lis r6,(MSR_EE|MSR_CE|MSR_ME|MSR_DE)@ha
addi r6,r6,(MSR_EE|MSR_CE|MSR_ME|MSR_DE)@l
andc r6,r5,r6
andc r6,r4,r6
mtmsr r6
mtspr SPRN_MMUCR,r4
mtspr SPRN_MMUCR,r5
tlbsx. r3, 0, r3
mtmsr r5
mtmsr r4
bne 10f
sync
/* There are only 64 TLB entries, so r3 < 64,
Expand Down
2 changes: 1 addition & 1 deletion trunk/arch/ppc/mm/fault.c
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ int do_page_fault(struct pt_regs *regs, unsigned long address,
set_bit(PG_arch_1, &page->flags);
}
pte_update(ptep, 0, _PAGE_HWEXEC);
_tlbie(address);
_tlbie(address, mm->context.id);
pte_unmap_unlock(ptep, ptl);
up_read(&mm->mmap_sem);
return 0;
Expand Down
4 changes: 2 additions & 2 deletions trunk/arch/ppc/mm/mmu_decl.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,12 +54,12 @@ 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);

#elif defined(CONFIG_FSL_BOOKE)
#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);
extern void adjust_total_lowmem(void);
Expand Down
2 changes: 1 addition & 1 deletion trunk/arch/ppc/platforms/4xx/ebony.c
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ ebony_early_serial_map(void)
gen550_init(0, &port);

/* Purge TLB entry added in head_44x.S for early serial access */
_tlbie(UART0_IO_BASE);
_tlbie(UART0_IO_BASE, 0);
#endif

port.membase = ioremap64(PPC440GP_UART1_ADDR, 8);
Expand Down
2 changes: 1 addition & 1 deletion trunk/arch/ppc/platforms/4xx/ocotea.c
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@ ocotea_early_serial_map(void)
gen550_init(0, &port);

/* Purge TLB entry added in head_44x.S for early serial access */
_tlbie(UART0_IO_BASE);
_tlbie(UART0_IO_BASE, 0);
#endif

port.membase = ioremap64(PPC440GX_UART1_ADDR, 8);
Expand Down
2 changes: 1 addition & 1 deletion trunk/arch/ppc/platforms/4xx/taishan.c
Original file line number Diff line number Diff line change
Expand Up @@ -316,7 +316,7 @@ taishan_early_serial_map(void)
gen550_init(0, &port);

/* Purge TLB entry added in head_44x.S for early serial access */
_tlbie(UART0_IO_BASE);
_tlbie(UART0_IO_BASE, 0);
#endif

port.membase = ioremap64(PPC440GX_UART1_ADDR, 8);
Expand Down
12 changes: 6 additions & 6 deletions trunk/include/asm-powerpc/tlbflush.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#ifndef _ASM_POWERPC_TLBFLUSH_H
#define _ASM_POWERPC_TLBFLUSH_H

/*
* TLB flushing:
*
Expand All @@ -16,9 +17,6 @@
*/
#ifdef __KERNEL__

struct mm_struct;
struct vm_area_struct;

#if defined(CONFIG_4xx) || defined(CONFIG_8xx) || defined(CONFIG_FSL_BOOKE)
/*
* TLB flushing for software loaded TLB chips
Expand All @@ -28,7 +26,9 @@ struct vm_area_struct;
* specific tlbie's
*/

extern void _tlbie(unsigned long address);
#include <linux/mm.h>

extern void _tlbie(unsigned long address, unsigned int pid);

#if defined(CONFIG_40x) || defined(CONFIG_8xx)
#define _tlbia() asm volatile ("tlbia; sync" : : : "memory")
Expand All @@ -44,13 +44,13 @@ static inline void flush_tlb_mm(struct mm_struct *mm)
static inline void flush_tlb_page(struct vm_area_struct *vma,
unsigned long vmaddr)
{
_tlbie(vmaddr);
_tlbie(vmaddr, vma->vm_mm->context.id);
}

static inline void flush_tlb_page_nohash(struct vm_area_struct *vma,
unsigned long vmaddr)
{
_tlbie(vmaddr);
_tlbie(vmaddr, vma->vm_mm->context.id);
}

static inline void flush_tlb_range(struct vm_area_struct *vma,
Expand Down

0 comments on commit 7fdb6fe

Please sign in to comment.