aboutsummaryrefslogtreecommitdiffstats
path: root/arch/ia64/mm
diff options
context:
space:
mode:
authorJonathan Herman <hermanjl@cs.unc.edu>2013-01-17 16:15:55 -0500
committerJonathan Herman <hermanjl@cs.unc.edu>2013-01-17 16:15:55 -0500
commit8dea78da5cee153b8af9c07a2745f6c55057fe12 (patch)
treea8f4d49d63b1ecc92f2fddceba0655b2472c5bd9 /arch/ia64/mm
parent406089d01562f1e2bf9f089fd7637009ebaad589 (diff)
Patched in Tegra support.
Diffstat (limited to 'arch/ia64/mm')
-rw-r--r--arch/ia64/mm/contig.c3
-rw-r--r--arch/ia64/mm/fault.c48
-rw-r--r--arch/ia64/mm/init.c13
-rw-r--r--arch/ia64/mm/tlb.c3
4 files changed, 23 insertions, 44 deletions
diff --git a/arch/ia64/mm/contig.c b/arch/ia64/mm/contig.c
index 1516d1dc11f..f114a3b14c6 100644
--- a/arch/ia64/mm/contig.c
+++ b/arch/ia64/mm/contig.c
@@ -16,7 +16,6 @@
16 */ 16 */
17#include <linux/bootmem.h> 17#include <linux/bootmem.h>
18#include <linux/efi.h> 18#include <linux/efi.h>
19#include <linux/memblock.h>
20#include <linux/mm.h> 19#include <linux/mm.h>
21#include <linux/nmi.h> 20#include <linux/nmi.h>
22#include <linux/swap.h> 21#include <linux/swap.h>
@@ -349,7 +348,7 @@ paging_init (void)
349 printk("Virtual mem_map starts at 0x%p\n", mem_map); 348 printk("Virtual mem_map starts at 0x%p\n", mem_map);
350 } 349 }
351#else /* !CONFIG_VIRTUAL_MEM_MAP */ 350#else /* !CONFIG_VIRTUAL_MEM_MAP */
352 memblock_add_node(0, PFN_PHYS(max_low_pfn), 0); 351 add_active_range(0, 0, max_low_pfn);
353 free_area_init_nodes(max_zone_pfns); 352 free_area_init_nodes(max_zone_pfns);
354#endif /* !CONFIG_VIRTUAL_MEM_MAP */ 353#endif /* !CONFIG_VIRTUAL_MEM_MAP */
355 zero_page_memmap_ptr = virt_to_page(ia64_imva(empty_zero_page)); 354 zero_page_memmap_ptr = virt_to_page(ia64_imva(empty_zero_page));
diff --git a/arch/ia64/mm/fault.c b/arch/ia64/mm/fault.c
index 6cf0341f978..20b35937612 100644
--- a/arch/ia64/mm/fault.c
+++ b/arch/ia64/mm/fault.c
@@ -14,6 +14,7 @@
14 14
15#include <asm/pgtable.h> 15#include <asm/pgtable.h>
16#include <asm/processor.h> 16#include <asm/processor.h>
17#include <asm/system.h>
17#include <asm/uaccess.h> 18#include <asm/uaccess.h>
18 19
19extern int die(char *, struct pt_regs *, long); 20extern int die(char *, struct pt_regs *, long);
@@ -72,10 +73,6 @@ mapped_kernel_page_is_present (unsigned long address)
72 return pte_present(pte); 73 return pte_present(pte);
73} 74}
74 75
75# define VM_READ_BIT 0
76# define VM_WRITE_BIT 1
77# define VM_EXEC_BIT 2
78
79void __kprobes 76void __kprobes
80ia64_do_page_fault (unsigned long address, unsigned long isr, struct pt_regs *regs) 77ia64_do_page_fault (unsigned long address, unsigned long isr, struct pt_regs *regs)
81{ 78{
@@ -85,12 +82,6 @@ ia64_do_page_fault (unsigned long address, unsigned long isr, struct pt_regs *re
85 struct siginfo si; 82 struct siginfo si;
86 unsigned long mask; 83 unsigned long mask;
87 int fault; 84 int fault;
88 unsigned int flags = FAULT_FLAG_ALLOW_RETRY | FAULT_FLAG_KILLABLE;
89
90 mask = ((((isr >> IA64_ISR_X_BIT) & 1UL) << VM_EXEC_BIT)
91 | (((isr >> IA64_ISR_W_BIT) & 1UL) << VM_WRITE_BIT));
92
93 flags |= ((mask & VM_WRITE) ? FAULT_FLAG_WRITE : 0);
94 85
95 /* mmap_sem is performance critical.... */ 86 /* mmap_sem is performance critical.... */
96 prefetchw(&mm->mmap_sem); 87 prefetchw(&mm->mmap_sem);
@@ -119,7 +110,6 @@ ia64_do_page_fault (unsigned long address, unsigned long isr, struct pt_regs *re
119 if (notify_page_fault(regs, TRAP_BRKPT)) 110 if (notify_page_fault(regs, TRAP_BRKPT))
120 return; 111 return;
121 112
122retry:
123 down_read(&mm->mmap_sem); 113 down_read(&mm->mmap_sem);
124 114
125 vma = find_vma_prev(mm, address, &prev_vma); 115 vma = find_vma_prev(mm, address, &prev_vma);
@@ -141,6 +131,10 @@ retry:
141 131
142 /* OK, we've got a good vm_area for this memory area. Check the access permissions: */ 132 /* OK, we've got a good vm_area for this memory area. Check the access permissions: */
143 133
134# define VM_READ_BIT 0
135# define VM_WRITE_BIT 1
136# define VM_EXEC_BIT 2
137
144# if (((1 << VM_READ_BIT) != VM_READ || (1 << VM_WRITE_BIT) != VM_WRITE) \ 138# if (((1 << VM_READ_BIT) != VM_READ || (1 << VM_WRITE_BIT) != VM_WRITE) \
145 || (1 << VM_EXEC_BIT) != VM_EXEC) 139 || (1 << VM_EXEC_BIT) != VM_EXEC)
146# error File is out of sync with <linux/mm.h>. Please update. 140# error File is out of sync with <linux/mm.h>. Please update.
@@ -149,6 +143,9 @@ retry:
149 if (((isr >> IA64_ISR_R_BIT) & 1UL) && (!(vma->vm_flags & (VM_READ | VM_WRITE)))) 143 if (((isr >> IA64_ISR_R_BIT) & 1UL) && (!(vma->vm_flags & (VM_READ | VM_WRITE))))
150 goto bad_area; 144 goto bad_area;
151 145
146 mask = ( (((isr >> IA64_ISR_X_BIT) & 1UL) << VM_EXEC_BIT)
147 | (((isr >> IA64_ISR_W_BIT) & 1UL) << VM_WRITE_BIT));
148
152 if ((vma->vm_flags & mask) != mask) 149 if ((vma->vm_flags & mask) != mask)
153 goto bad_area; 150 goto bad_area;
154 151
@@ -157,11 +154,7 @@ retry:
157 * sure we exit gracefully rather than endlessly redo the 154 * sure we exit gracefully rather than endlessly redo the
158 * fault. 155 * fault.
159 */ 156 */
160 fault = handle_mm_fault(mm, vma, address, flags); 157 fault = handle_mm_fault(mm, vma, address, (mask & VM_WRITE) ? FAULT_FLAG_WRITE : 0);
161
162 if ((fault & VM_FAULT_RETRY) && fatal_signal_pending(current))
163 return;
164
165 if (unlikely(fault & VM_FAULT_ERROR)) { 158 if (unlikely(fault & VM_FAULT_ERROR)) {
166 /* 159 /*
167 * We ran out of memory, or some other thing happened 160 * We ran out of memory, or some other thing happened
@@ -176,25 +169,10 @@ retry:
176 } 169 }
177 BUG(); 170 BUG();
178 } 171 }
179 172 if (fault & VM_FAULT_MAJOR)
180 if (flags & FAULT_FLAG_ALLOW_RETRY) { 173 current->maj_flt++;
181 if (fault & VM_FAULT_MAJOR) 174 else
182 current->maj_flt++; 175 current->min_flt++;
183 else
184 current->min_flt++;
185 if (fault & VM_FAULT_RETRY) {
186 flags &= ~FAULT_FLAG_ALLOW_RETRY;
187 flags |= FAULT_FLAG_TRIED;
188
189 /* No need to up_read(&mm->mmap_sem) as we would
190 * have already released it in __lock_page_or_retry
191 * in mm/filemap.c.
192 */
193
194 goto retry;
195 }
196 }
197
198 up_read(&mm->mmap_sem); 176 up_read(&mm->mmap_sem);
199 return; 177 return;
200 178
diff --git a/arch/ia64/mm/init.c b/arch/ia64/mm/init.c
index b755ea92aea..00cb0e26c64 100644
--- a/arch/ia64/mm/init.c
+++ b/arch/ia64/mm/init.c
@@ -10,7 +10,6 @@
10#include <linux/bootmem.h> 10#include <linux/bootmem.h>
11#include <linux/efi.h> 11#include <linux/efi.h>
12#include <linux/elf.h> 12#include <linux/elf.h>
13#include <linux/memblock.h>
14#include <linux/mm.h> 13#include <linux/mm.h>
15#include <linux/mmzone.h> 14#include <linux/mmzone.h>
16#include <linux/module.h> 15#include <linux/module.h>
@@ -30,6 +29,7 @@
30#include <asm/pgalloc.h> 29#include <asm/pgalloc.h>
31#include <asm/sal.h> 30#include <asm/sal.h>
32#include <asm/sections.h> 31#include <asm/sections.h>
32#include <asm/system.h>
33#include <asm/tlb.h> 33#include <asm/tlb.h>
34#include <asm/uaccess.h> 34#include <asm/uaccess.h>
35#include <asm/unistd.h> 35#include <asm/unistd.h>
@@ -138,8 +138,7 @@ ia64_init_addr_space (void)
138 vma->vm_mm = current->mm; 138 vma->vm_mm = current->mm;
139 vma->vm_end = PAGE_SIZE; 139 vma->vm_end = PAGE_SIZE;
140 vma->vm_page_prot = __pgprot(pgprot_val(PAGE_READONLY) | _PAGE_MA_NAT); 140 vma->vm_page_prot = __pgprot(pgprot_val(PAGE_READONLY) | _PAGE_MA_NAT);
141 vma->vm_flags = VM_READ | VM_MAYREAD | VM_IO | 141 vma->vm_flags = VM_READ | VM_MAYREAD | VM_IO | VM_RESERVED;
142 VM_DONTEXPAND | VM_DONTDUMP;
143 down_write(&current->mm->mmap_sem); 142 down_write(&current->mm->mmap_sem);
144 if (insert_vm_struct(current->mm, vma)) { 143 if (insert_vm_struct(current->mm, vma)) {
145 up_write(&current->mm->mmap_sem); 144 up_write(&current->mm->mmap_sem);
@@ -294,10 +293,11 @@ setup_gate (void)
294 ia64_patch_gate(); 293 ia64_patch_gate();
295} 294}
296 295
297void ia64_mmu_init(void *my_cpu_data) 296void __devinit
297ia64_mmu_init (void *my_cpu_data)
298{ 298{
299 unsigned long pta, impl_va_bits; 299 unsigned long pta, impl_va_bits;
300 extern void tlb_init(void); 300 extern void __devinit tlb_init (void);
301 301
302#ifdef CONFIG_DISABLE_VHPT 302#ifdef CONFIG_DISABLE_VHPT
303# define VHPT_ENABLE_BIT 0 303# define VHPT_ENABLE_BIT 0
@@ -557,7 +557,8 @@ int __init register_active_ranges(u64 start, u64 len, int nid)
557#endif 557#endif
558 558
559 if (start < end) 559 if (start < end)
560 memblock_add_node(__pa(start), end - start, nid); 560 add_active_range(nid, __pa(start) >> PAGE_SHIFT,
561 __pa(end) >> PAGE_SHIFT);
561 return 0; 562 return 0;
562} 563}
563 564
diff --git a/arch/ia64/mm/tlb.c b/arch/ia64/mm/tlb.c
index ed612976868..7b3cdc6c6d9 100644
--- a/arch/ia64/mm/tlb.c
+++ b/arch/ia64/mm/tlb.c
@@ -337,7 +337,8 @@ flush_tlb_range (struct vm_area_struct *vma, unsigned long start,
337} 337}
338EXPORT_SYMBOL(flush_tlb_range); 338EXPORT_SYMBOL(flush_tlb_range);
339 339
340void ia64_tlb_init(void) 340void __devinit
341ia64_tlb_init (void)
341{ 342{
342 ia64_ptce_info_t uninitialized_var(ptce_info); /* GCC be quiet */ 343 ia64_ptce_info_t uninitialized_var(ptce_info); /* GCC be quiet */
343 u64 tr_pgbits; 344 u64 tr_pgbits;