aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc/mm
diff options
context:
space:
mode:
authorBenjamin Herrenschmidt <benh@kernel.crashing.org>2008-07-14 21:54:57 -0400
committerBenjamin Herrenschmidt <benh@kernel.crashing.org>2008-07-14 21:54:57 -0400
commit930074b6b9c4895d20cdadba5aff97907e28728d (patch)
tree3725eca121188f2e9c3b8bb4d4b8ba35e92640c7 /arch/powerpc/mm
parent3fd44736db9a5bf33e4a216b9cd43c9cfd57c459 (diff)
parent2bf3016f89344d4cd8b2c96bbec2b642a2bde413 (diff)
Merge commit 'jwb/jwb-next'
Diffstat (limited to 'arch/powerpc/mm')
-rw-r--r--arch/powerpc/mm/44x_mmu.c29
-rw-r--r--arch/powerpc/mm/fault.c3
-rw-r--r--arch/powerpc/mm/init_32.c4
-rw-r--r--arch/powerpc/mm/mem.c8
-rw-r--r--arch/powerpc/mm/mmu_decl.h4
5 files changed, 38 insertions, 10 deletions
diff --git a/arch/powerpc/mm/44x_mmu.c b/arch/powerpc/mm/44x_mmu.c
index 953fb919eb06..98052ac96580 100644
--- a/arch/powerpc/mm/44x_mmu.c
+++ b/arch/powerpc/mm/44x_mmu.c
@@ -27,6 +27,7 @@
27#include <asm/mmu.h> 27#include <asm/mmu.h>
28#include <asm/system.h> 28#include <asm/system.h>
29#include <asm/page.h> 29#include <asm/page.h>
30#include <asm/cacheflush.h>
30 31
31#include "mmu_decl.h" 32#include "mmu_decl.h"
32 33
@@ -37,11 +38,35 @@ unsigned int tlb_44x_index; /* = 0 */
37unsigned int tlb_44x_hwater = PPC44x_TLB_SIZE - 1 - PPC44x_EARLY_TLBS; 38unsigned int tlb_44x_hwater = PPC44x_TLB_SIZE - 1 - PPC44x_EARLY_TLBS;
38int icache_44x_need_flush; 39int icache_44x_need_flush;
39 40
41static void __init ppc44x_update_tlb_hwater(void)
42{
43 extern unsigned int tlb_44x_patch_hwater_D[];
44 extern unsigned int tlb_44x_patch_hwater_I[];
45
46 /* The TLB miss handlers hard codes the watermark in a cmpli
47 * instruction to improve performances rather than loading it
48 * from the global variable. Thus, we patch the instructions
49 * in the 2 TLB miss handlers when updating the value
50 */
51 tlb_44x_patch_hwater_D[0] = (tlb_44x_patch_hwater_D[0] & 0xffff0000) |
52 tlb_44x_hwater;
53 flush_icache_range((unsigned long)&tlb_44x_patch_hwater_D[0],
54 (unsigned long)&tlb_44x_patch_hwater_D[1]);
55 tlb_44x_patch_hwater_I[0] = (tlb_44x_patch_hwater_I[0] & 0xffff0000) |
56 tlb_44x_hwater;
57 flush_icache_range((unsigned long)&tlb_44x_patch_hwater_I[0],
58 (unsigned long)&tlb_44x_patch_hwater_I[1]);
59}
60
40/* 61/*
41 * "Pins" a 256MB TLB entry in AS0 for kernel lowmem 62 * "Pins" a 256MB TLB entry in AS0 for kernel lowmem
42 */ 63 */
43static void __init ppc44x_pin_tlb(unsigned int virt, unsigned int phys) 64static void __init ppc44x_pin_tlb(unsigned int virt, unsigned int phys)
44{ 65{
66 unsigned int entry = tlb_44x_hwater--;
67
68 ppc44x_update_tlb_hwater();
69
45 __asm__ __volatile__( 70 __asm__ __volatile__(
46 "tlbwe %2,%3,%4\n" 71 "tlbwe %2,%3,%4\n"
47 "tlbwe %1,%3,%5\n" 72 "tlbwe %1,%3,%5\n"
@@ -50,7 +75,7 @@ static void __init ppc44x_pin_tlb(unsigned int virt, unsigned int phys)
50 : "r" (PPC44x_TLB_SW | PPC44x_TLB_SR | PPC44x_TLB_SX | PPC44x_TLB_G), 75 : "r" (PPC44x_TLB_SW | PPC44x_TLB_SR | PPC44x_TLB_SX | PPC44x_TLB_G),
51 "r" (phys), 76 "r" (phys),
52 "r" (virt | PPC44x_TLB_VALID | PPC44x_TLB_256M), 77 "r" (virt | PPC44x_TLB_VALID | PPC44x_TLB_256M),
53 "r" (tlb_44x_hwater--), /* slot for this TLB entry */ 78 "r" (entry),
54 "i" (PPC44x_TLB_PAGEID), 79 "i" (PPC44x_TLB_PAGEID),
55 "i" (PPC44x_TLB_XLAT), 80 "i" (PPC44x_TLB_XLAT),
56 "i" (PPC44x_TLB_ATTRIB)); 81 "i" (PPC44x_TLB_ATTRIB));
@@ -58,6 +83,8 @@ static void __init ppc44x_pin_tlb(unsigned int virt, unsigned int phys)
58 83
59void __init MMU_init_hw(void) 84void __init MMU_init_hw(void)
60{ 85{
86 ppc44x_update_tlb_hwater();
87
61 flush_instruction_cache(); 88 flush_instruction_cache();
62} 89}
63 90
diff --git a/arch/powerpc/mm/fault.c b/arch/powerpc/mm/fault.c
index 7b2510799266..1707d00331fc 100644
--- a/arch/powerpc/mm/fault.c
+++ b/arch/powerpc/mm/fault.c
@@ -306,7 +306,8 @@ good_area:
306 flush_dcache_icache_page(page); 306 flush_dcache_icache_page(page);
307 set_bit(PG_arch_1, &page->flags); 307 set_bit(PG_arch_1, &page->flags);
308 } 308 }
309 pte_update(ptep, 0, _PAGE_HWEXEC); 309 pte_update(ptep, 0, _PAGE_HWEXEC |
310 _PAGE_ACCESSED);
310 _tlbie(address, mm->context.id); 311 _tlbie(address, mm->context.id);
311 pte_unmap_unlock(ptep, ptl); 312 pte_unmap_unlock(ptep, ptl);
312 up_read(&mm->mmap_sem); 313 up_read(&mm->mmap_sem);
diff --git a/arch/powerpc/mm/init_32.c b/arch/powerpc/mm/init_32.c
index 45418590b6a9..388ceda632f3 100644
--- a/arch/powerpc/mm/init_32.c
+++ b/arch/powerpc/mm/init_32.c
@@ -57,8 +57,8 @@
57 57
58DEFINE_PER_CPU(struct mmu_gather, mmu_gathers); 58DEFINE_PER_CPU(struct mmu_gather, mmu_gathers);
59 59
60unsigned long total_memory; 60phys_addr_t total_memory;
61unsigned long total_lowmem; 61phys_addr_t total_lowmem;
62 62
63phys_addr_t memstart_addr = (phys_addr_t)~0ull; 63phys_addr_t memstart_addr = (phys_addr_t)~0ull;
64EXPORT_SYMBOL(memstart_addr); 64EXPORT_SYMBOL(memstart_addr);
diff --git a/arch/powerpc/mm/mem.c b/arch/powerpc/mm/mem.c
index 776ba6ad5e1e..1ca2235f0965 100644
--- a/arch/powerpc/mm/mem.c
+++ b/arch/powerpc/mm/mem.c
@@ -330,7 +330,7 @@ static int __init mark_nonram_nosave(void)
330void __init paging_init(void) 330void __init paging_init(void)
331{ 331{
332 unsigned long total_ram = lmb_phys_mem_size(); 332 unsigned long total_ram = lmb_phys_mem_size();
333 unsigned long top_of_ram = lmb_end_of_DRAM(); 333 phys_addr_t top_of_ram = lmb_end_of_DRAM();
334 unsigned long max_zone_pfns[MAX_NR_ZONES]; 334 unsigned long max_zone_pfns[MAX_NR_ZONES];
335 335
336#ifdef CONFIG_PPC32 336#ifdef CONFIG_PPC32
@@ -349,10 +349,10 @@ void __init paging_init(void)
349 kmap_prot = PAGE_KERNEL; 349 kmap_prot = PAGE_KERNEL;
350#endif /* CONFIG_HIGHMEM */ 350#endif /* CONFIG_HIGHMEM */
351 351
352 printk(KERN_DEBUG "Top of RAM: 0x%lx, Total RAM: 0x%lx\n", 352 printk(KERN_DEBUG "Top of RAM: 0x%llx, Total RAM: 0x%lx\n",
353 top_of_ram, total_ram); 353 (u64)top_of_ram, total_ram);
354 printk(KERN_DEBUG "Memory hole size: %ldMB\n", 354 printk(KERN_DEBUG "Memory hole size: %ldMB\n",
355 (top_of_ram - total_ram) >> 20); 355 (long int)((top_of_ram - total_ram) >> 20));
356 memset(max_zone_pfns, 0, sizeof(max_zone_pfns)); 356 memset(max_zone_pfns, 0, sizeof(max_zone_pfns));
357#ifdef CONFIG_HIGHMEM 357#ifdef CONFIG_HIGHMEM
358 max_zone_pfns[ZONE_DMA] = lowmem_end_addr >> PAGE_SHIFT; 358 max_zone_pfns[ZONE_DMA] = lowmem_end_addr >> PAGE_SHIFT;
diff --git a/arch/powerpc/mm/mmu_decl.h b/arch/powerpc/mm/mmu_decl.h
index 46585b7bb194..fab3cfad4099 100644
--- a/arch/powerpc/mm/mmu_decl.h
+++ b/arch/powerpc/mm/mmu_decl.h
@@ -49,8 +49,8 @@ extern unsigned int num_tlbcam_entries;
49extern unsigned long ioremap_bot; 49extern unsigned long ioremap_bot;
50extern unsigned long __max_low_memory; 50extern unsigned long __max_low_memory;
51extern phys_addr_t __initial_memory_limit_addr; 51extern phys_addr_t __initial_memory_limit_addr;
52extern unsigned long total_memory; 52extern phys_addr_t total_memory;
53extern unsigned long total_lowmem; 53extern phys_addr_t total_lowmem;
54extern phys_addr_t memstart_addr; 54extern phys_addr_t memstart_addr;
55extern phys_addr_t lowmem_end_addr; 55extern phys_addr_t lowmem_end_addr;
56 56