aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc/mm
diff options
context:
space:
mode:
authorKumar Gala <galak@kernel.crashing.org>2010-05-13 15:38:21 -0400
committerKumar Gala <galak@kernel.crashing.org>2010-05-17 11:56:20 -0400
commit78f622377f7d31d988db350a43c5689dd5f31876 (patch)
treef399c9c492b9a3397a0974981049b2adaddf279d /arch/powerpc/mm
parent78e2e68a2b79f394b7cd61e07987a8a89af907f7 (diff)
powerpc/fsl-booke: Move loadcam_entry back to asm code to fix SMP ftrace
When we build with ftrace enabled its possible that loadcam_entry would have used the stack pointer (even though the code doesn't need it). We call loadcam_entry in __secondary_start before the stack is setup. To ensure that loadcam_entry doesn't use the stack pointer the easiest solution is to just have it in asm code. Signed-off-by: Kumar Gala <galak@kernel.crashing.org>
Diffstat (limited to 'arch/powerpc/mm')
-rw-r--r--arch/powerpc/mm/fsl_booke_mmu.c25
-rw-r--r--arch/powerpc/mm/mmu_decl.h10
-rw-r--r--arch/powerpc/mm/tlb_nohash_low.S28
3 files changed, 40 insertions, 23 deletions
diff --git a/arch/powerpc/mm/fsl_booke_mmu.c b/arch/powerpc/mm/fsl_booke_mmu.c
index 1ed6b52f3031..cdc7526e9c93 100644
--- a/arch/powerpc/mm/fsl_booke_mmu.c
+++ b/arch/powerpc/mm/fsl_booke_mmu.c
@@ -2,7 +2,7 @@
2 * Modifications by Kumar Gala (galak@kernel.crashing.org) to support 2 * Modifications by Kumar Gala (galak@kernel.crashing.org) to support
3 * E500 Book E processors. 3 * E500 Book E processors.
4 * 4 *
5 * Copyright 2004 Freescale Semiconductor, Inc 5 * Copyright 2004,2010 Freescale Semiconductor, Inc.
6 * 6 *
7 * This file contains the routines for initializing the MMU 7 * This file contains the routines for initializing the MMU
8 * on the 4xx series of chips. 8 * on the 4xx series of chips.
@@ -56,19 +56,13 @@
56 56
57unsigned int tlbcam_index; 57unsigned int tlbcam_index;
58 58
59#define NUM_TLBCAMS (64)
60 59
61#if defined(CONFIG_LOWMEM_CAM_NUM_BOOL) && (CONFIG_LOWMEM_CAM_NUM >= NUM_TLBCAMS) 60#if defined(CONFIG_LOWMEM_CAM_NUM_BOOL) && (CONFIG_LOWMEM_CAM_NUM >= NUM_TLBCAMS)
62#error "LOWMEM_CAM_NUM must be less than NUM_TLBCAMS" 61#error "LOWMEM_CAM_NUM must be less than NUM_TLBCAMS"
63#endif 62#endif
64 63
65struct tlbcam { 64#define NUM_TLBCAMS (64)
66 u32 MAS0; 65struct tlbcam TLBCAM[NUM_TLBCAMS];
67 u32 MAS1;
68 unsigned long MAS2;
69 u32 MAS3;
70 u32 MAS7;
71} TLBCAM[NUM_TLBCAMS];
72 66
73struct tlbcamrange { 67struct tlbcamrange {
74 unsigned long start; 68 unsigned long start;
@@ -109,19 +103,6 @@ unsigned long p_mapped_by_tlbcam(phys_addr_t pa)
109 return 0; 103 return 0;
110} 104}
111 105
112void loadcam_entry(int idx)
113{
114 mtspr(SPRN_MAS0, TLBCAM[idx].MAS0);
115 mtspr(SPRN_MAS1, TLBCAM[idx].MAS1);
116 mtspr(SPRN_MAS2, TLBCAM[idx].MAS2);
117 mtspr(SPRN_MAS3, TLBCAM[idx].MAS3);
118
119 if (mmu_has_feature(MMU_FTR_BIG_PHYS))
120 mtspr(SPRN_MAS7, TLBCAM[idx].MAS7);
121
122 asm volatile("isync;tlbwe;isync" : : : "memory");
123}
124
125/* 106/*
126 * Set up one of the I/D BAT (block address translation) register pairs. 107 * Set up one of the I/D BAT (block address translation) register pairs.
127 * The parameters are not checked; in particular size must be a power 108 * The parameters are not checked; in particular size must be a power
diff --git a/arch/powerpc/mm/mmu_decl.h b/arch/powerpc/mm/mmu_decl.h
index eb11d5d2aa94..63b84a0d3b10 100644
--- a/arch/powerpc/mm/mmu_decl.h
+++ b/arch/powerpc/mm/mmu_decl.h
@@ -144,7 +144,15 @@ extern unsigned long mmu_mapin_ram(unsigned long top);
144extern void MMU_init_hw(void); 144extern void MMU_init_hw(void);
145extern unsigned long mmu_mapin_ram(unsigned long top); 145extern unsigned long mmu_mapin_ram(unsigned long top);
146extern void adjust_total_lowmem(void); 146extern void adjust_total_lowmem(void);
147 147extern void loadcam_entry(unsigned int index);
148
149struct tlbcam {
150 u32 MAS0;
151 u32 MAS1;
152 unsigned long MAS2;
153 u32 MAS3;
154 u32 MAS7;
155};
148#elif defined(CONFIG_PPC32) 156#elif defined(CONFIG_PPC32)
149/* anything 32-bit except 4xx or 8xx */ 157/* anything 32-bit except 4xx or 8xx */
150extern void MMU_init_hw(void); 158extern void MMU_init_hw(void);
diff --git a/arch/powerpc/mm/tlb_nohash_low.S b/arch/powerpc/mm/tlb_nohash_low.S
index e925cb58afd9..cfa768203d08 100644
--- a/arch/powerpc/mm/tlb_nohash_low.S
+++ b/arch/powerpc/mm/tlb_nohash_low.S
@@ -365,3 +365,31 @@ _GLOBAL(set_context)
365#else 365#else
366#error Unsupported processor type ! 366#error Unsupported processor type !
367#endif 367#endif
368
369#if defined(CONFIG_FSL_BOOKE)
370/*
371 * extern void loadcam_entry(unsigned int index)
372 *
373 * Load TLBCAM[index] entry in to the L2 CAM MMU
374 */
375_GLOBAL(loadcam_entry)
376 LOAD_REG_ADDR(r4, TLBCAM)
377 mulli r5,r3,TLBCAM_SIZE
378 add r3,r5,r4
379 lwz r4,TLBCAM_MAS0(r3)
380 mtspr SPRN_MAS0,r4
381 lwz r4,TLBCAM_MAS1(r3)
382 mtspr SPRN_MAS1,r4
383 PPC_LL r4,TLBCAM_MAS2(r3)
384 mtspr SPRN_MAS2,r4
385 lwz r4,TLBCAM_MAS3(r3)
386 mtspr SPRN_MAS3,r4
387BEGIN_MMU_FTR_SECTION
388 lwz r4,TLBCAM_MAS7(r3)
389 mtspr SPRN_MAS7,r4
390END_MMU_FTR_SECTION_IFSET(MMU_FTR_BIG_PHYS)
391 isync
392 tlbwe
393 isync
394 blr
395#endif