aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc
diff options
context:
space:
mode:
authorChristophe Leroy <christophe.leroy@c-s.fr>2016-05-17 03:02:56 -0400
committerScott Wood <oss@buserror.net>2016-07-09 03:02:48 -0400
commit62f64b49d04dc70687cd713c804fecd80216b2d6 (patch)
treef4d8264d6e3a40c95cb2aecf404642e097cc9852 /arch/powerpc
parent4ad274502f66614eec3093aaa0cdeb4b70697ddf (diff)
powerpc/8xx: add CONFIG_PIN_TLB_IMMR
CONFIG_PIN_TLB maps IMMR area and the first 24 Mbytes of memory. In some circunstances it might be more interesting to not map IMMR but map 32 Mbytes of memory instead. Therefore we add config option CONFIG_PIN_TLB_IMMR to select if IMMR shall be pinned or not, hence whether we pin 24 or 32 Mbytes of RAM Signed-off-by: Christophe Leroy <christophe.leroy@c-s.fr> Signed-off-by: Scott Wood <oss@buserror.net>
Diffstat (limited to 'arch/powerpc')
-rw-r--r--arch/powerpc/Kconfig5
-rw-r--r--arch/powerpc/kernel/head_8xx.S10
-rw-r--r--arch/powerpc/mm/8xx_mmu.c12
3 files changed, 19 insertions, 8 deletions
diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig
index 394f9dc7be08..fcfe5332416f 100644
--- a/arch/powerpc/Kconfig
+++ b/arch/powerpc/Kconfig
@@ -1056,6 +1056,11 @@ config CONSISTENT_SIZE
1056config PIN_TLB 1056config PIN_TLB
1057 bool "Pinned Kernel TLBs (860 ONLY)" 1057 bool "Pinned Kernel TLBs (860 ONLY)"
1058 depends on ADVANCED_OPTIONS && 8xx 1058 depends on ADVANCED_OPTIONS && 8xx
1059
1060config PIN_TLB_IMMR
1061 bool "Pinned TLB for IMMR"
1062 depends on PIN_TLB
1063 default y
1059endmenu 1064endmenu
1060 1065
1061if PPC64 1066if PPC64
diff --git a/arch/powerpc/kernel/head_8xx.S b/arch/powerpc/kernel/head_8xx.S
index 00cc9df7d322..43ddaae42baf 100644
--- a/arch/powerpc/kernel/head_8xx.S
+++ b/arch/powerpc/kernel/head_8xx.S
@@ -414,11 +414,11 @@ DataStoreTLBMiss:
414 */ 414 */
415 mfspr r11, SPRN_MD_EPN 415 mfspr r11, SPRN_MD_EPN
416 rlwinm r11, r11, 16, 0xfff8 416 rlwinm r11, r11, 16, 0xfff8
417#ifndef CONFIG_PIN_TLB 417#ifndef CONFIG_PIN_TLB_IMMR
418 cmpli cr0, r11, VIRT_IMMR_BASE@h 418 cmpli cr0, r11, VIRT_IMMR_BASE@h
419#endif 419#endif
420 cmpli cr7, r11, PAGE_OFFSET@h 420 cmpli cr7, r11, PAGE_OFFSET@h
421#ifndef CONFIG_PIN_TLB 421#ifndef CONFIG_PIN_TLB_IMMR
422_ENTRY(DTLBMiss_jmp) 422_ENTRY(DTLBMiss_jmp)
423 beq- DTLBMissIMMR 423 beq- DTLBMissIMMR
424#endif 424#endif
@@ -819,7 +819,6 @@ initial_mmu:
819 819
820#ifdef CONFIG_PIN_TLB 820#ifdef CONFIG_PIN_TLB
821 oris r10, r10, MD_RSV4I@h 821 oris r10, r10, MD_RSV4I@h
822 ori r10, r10, 0x1c00
823 mtspr SPRN_MD_CTR, r10 /* Set data TLB control */ 822 mtspr SPRN_MD_CTR, r10 /* Set data TLB control */
824#endif 823#endif
825 824
@@ -843,7 +842,10 @@ initial_mmu:
843 /* Map a 512k page for the IMMR to get the processor 842 /* Map a 512k page for the IMMR to get the processor
844 * internal registers (among other things). 843 * internal registers (among other things).
845 */ 844 */
846#ifdef CONFIG_PIN_TLB 845#ifdef CONFIG_PIN_TLB_IMMR
846 ori r10, r10, 0x1c00
847 mtspr SPRN_MD_CTR, r10
848
847 mfspr r9, 638 /* Get current IMMR */ 849 mfspr r9, 638 /* Get current IMMR */
848 andis. r9, r9, 0xfff8 /* Get 512 kbytes boundary */ 850 andis. r9, r9, 0xfff8 /* Get 512 kbytes boundary */
849 851
diff --git a/arch/powerpc/mm/8xx_mmu.c b/arch/powerpc/mm/8xx_mmu.c
index 0f0a83ed7a20..6c5025e81236 100644
--- a/arch/powerpc/mm/8xx_mmu.c
+++ b/arch/powerpc/mm/8xx_mmu.c
@@ -61,11 +61,15 @@ void __init MMU_init_hw(void)
61#ifdef CONFIG_PIN_TLB 61#ifdef CONFIG_PIN_TLB
62 unsigned long ctr = mfspr(SPRN_MD_CTR) & 0xfe000000; 62 unsigned long ctr = mfspr(SPRN_MD_CTR) & 0xfe000000;
63 unsigned long flags = 0xf0 | MD_SPS16K | _PAGE_SHARED | _PAGE_DIRTY; 63 unsigned long flags = 0xf0 | MD_SPS16K | _PAGE_SHARED | _PAGE_DIRTY;
64 int i; 64#ifdef CONFIG_PIN_TLB_IMMR
65 int i = 29;
66#else
67 int i = 28;
68#endif
65 unsigned long addr = 0; 69 unsigned long addr = 0;
66 unsigned long mem = total_lowmem; 70 unsigned long mem = total_lowmem;
67 71
68 for (i = 29; i < 32 && mem >= LARGE_PAGE_SIZE_8M; i++) { 72 for (; i < 32 && mem >= LARGE_PAGE_SIZE_8M; i++) {
69 mtspr(SPRN_MD_CTR, ctr | (i << 8)); 73 mtspr(SPRN_MD_CTR, ctr | (i << 8));
70 mtspr(SPRN_MD_EPN, (unsigned long)__va(addr) | MD_EVALID); 74 mtspr(SPRN_MD_EPN, (unsigned long)__va(addr) | MD_EVALID);
71 mtspr(SPRN_MD_TWC, MD_PS8MEG | MD_SVALID); 75 mtspr(SPRN_MD_TWC, MD_PS8MEG | MD_SVALID);
@@ -88,7 +92,7 @@ static void mmu_mapin_immr(void)
88} 92}
89 93
90/* Address of instructions to patch */ 94/* Address of instructions to patch */
91#ifndef CONFIG_PIN_TLB 95#ifndef CONFIG_PIN_TLB_IMMR
92extern unsigned int DTLBMiss_jmp; 96extern unsigned int DTLBMiss_jmp;
93#endif 97#endif
94extern unsigned int DTLBMiss_cmp, FixupDAR_cmp; 98extern unsigned int DTLBMiss_cmp, FixupDAR_cmp;
@@ -109,7 +113,7 @@ unsigned long __init mmu_mapin_ram(unsigned long top)
109 if (__map_without_ltlbs) { 113 if (__map_without_ltlbs) {
110 mapped = 0; 114 mapped = 0;
111 mmu_mapin_immr(); 115 mmu_mapin_immr();
112#ifndef CONFIG_PIN_TLB 116#ifndef CONFIG_PIN_TLB_IMMR
113 patch_instruction(&DTLBMiss_jmp, PPC_INST_NOP); 117 patch_instruction(&DTLBMiss_jmp, PPC_INST_NOP);
114#endif 118#endif
115 } else { 119 } else {