Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/sparc-2.6

* git://git.kernel.org/pub/scm/linux/kernel/git/davem/sparc-2.6:
[SPARC64]: exec PT_DTRACE
[SPARC64]: Use shorter list_splice_init() for brevity.
[SPARC64]: Remove most limitations to kernel image size.

+98 -168
+1 -2
arch/sparc64/kernel/ds.c
··· 972 972 LIST_HEAD(todo); 973 973 974 974 spin_lock_irqsave(&ds_lock, flags); 975 - list_splice(&ds_work_list, &todo); 976 - INIT_LIST_HEAD(&ds_work_list); 975 + list_splice_init(&ds_work_list, &todo); 977 976 spin_unlock_irqrestore(&ds_lock, flags); 978 977 979 978 list_for_each_entry_safe(qp, tmp, &todo, list) {
+6 -2
arch/sparc64/kernel/head.S
··· 288 288 /* Leave arg2 as-is, prom_mmu_ihandle_cache */ 289 289 mov -1, %l3 290 290 stx %l3, [%sp + 2047 + 128 + 0x28] ! arg3: mode (-1 default) 291 - sethi %hi(8 * 1024 * 1024), %l3 292 - stx %l3, [%sp + 2047 + 128 + 0x30] ! arg4: size (8MB) 291 + /* 4MB align the kernel image size. */ 292 + set (_end - KERNBASE), %l3 293 + set ((4 * 1024 * 1024) - 1), %l4 294 + add %l3, %l4, %l3 295 + andn %l3, %l4, %l3 296 + stx %l3, [%sp + 2047 + 128 + 0x30] ! arg4: roundup(ksize, 4MB) 293 297 sethi %hi(KERNBASE), %l3 294 298 stx %l3, [%sp + 2047 + 128 + 0x38] ! arg5: vaddr (KERNBASE) 295 299 stx %g0, [%sp + 2047 + 128 + 0x40] ! arg6: empty
-3
arch/sparc64/kernel/process.c
··· 731 731 current_thread_info()->xfsr[0] = 0; 732 732 current_thread_info()->fpsaved[0] = 0; 733 733 regs->tstate &= ~TSTATE_PEF; 734 - task_lock(current); 735 - current->ptrace &= ~PT_DTRACE; 736 - task_unlock(current); 737 734 } 738 735 out: 739 736 return error;
+9 -8
arch/sparc64/kernel/smp.c
··· 284 284 { 285 285 extern unsigned long sparc64_ttable_tl0; 286 286 extern unsigned long kern_locked_tte_data; 287 - extern int bigkernel; 288 287 struct hvtramp_descr *hdesc; 289 288 unsigned long trampoline_ra; 290 289 struct trap_per_cpu *tb; 291 290 u64 tte_vaddr, tte_data; 292 291 unsigned long hv_err; 292 + int i; 293 293 294 - hdesc = kzalloc(sizeof(*hdesc), GFP_KERNEL); 294 + hdesc = kzalloc(sizeof(*hdesc) + 295 + (sizeof(struct hvtramp_mapping) * 296 + num_kernel_image_mappings - 1), 297 + GFP_KERNEL); 295 298 if (!hdesc) { 296 299 printk(KERN_ERR "ldom_startcpu_cpuid: Cannot allocate " 297 300 "hvtramp_descr.\n"); ··· 302 299 } 303 300 304 301 hdesc->cpu = cpu; 305 - hdesc->num_mappings = (bigkernel ? 2 : 1); 302 + hdesc->num_mappings = num_kernel_image_mappings; 306 303 307 304 tb = &trap_block[cpu]; 308 305 tb->hdesc = hdesc; ··· 315 312 tte_vaddr = (unsigned long) KERNBASE; 316 313 tte_data = kern_locked_tte_data; 317 314 318 - hdesc->maps[0].vaddr = tte_vaddr; 319 - hdesc->maps[0].tte = tte_data; 320 - if (bigkernel) { 315 + for (i = 0; i < hdesc->num_mappings; i++) { 316 + hdesc->maps[i].vaddr = tte_vaddr; 317 + hdesc->maps[i].tte = tte_data; 321 318 tte_vaddr += 0x400000; 322 319 tte_data += 0x400000; 323 - hdesc->maps[1].vaddr = tte_vaddr; 324 - hdesc->maps[1].tte = tte_data; 325 320 } 326 321 327 322 trampoline_ra = kimage_addr_to_ra(hv_cpu_startup);
-3
arch/sparc64/kernel/sys_sparc32.c
··· 678 678 current_thread_info()->xfsr[0] = 0; 679 679 current_thread_info()->fpsaved[0] = 0; 680 680 regs->tstate &= ~TSTATE_PEF; 681 - task_lock(current); 682 - current->ptrace &= ~PT_DTRACE; 683 - task_unlock(current); 684 681 } 685 682 out: 686 683 return error;
+65 -125
arch/sparc64/kernel/trampoline.S
··· 105 105 wr %g2, 0, %tick_cmpr 106 106 107 107 /* Call OBP by hand to lock KERNBASE into i/d tlbs. 108 - * We lock 2 consequetive entries if we are 'bigkernel'. 108 + * We lock 'num_kernel_image_mappings' consequetive entries. 109 109 */ 110 110 sethi %hi(prom_entry_lock), %g2 111 111 1: ldstub [%g2 + %lo(prom_entry_lock)], %g1 ··· 119 119 add %l2, -(192 + 128), %sp 120 120 flushw 121 121 122 + /* Setup the loop variables: 123 + * %l3: VADDR base 124 + * %l4: TTE base 125 + * %l5: Loop iterator, iterates from 0 to 'num_kernel_image_mappings' 126 + * %l6: Number of TTE entries to map 127 + * %l7: Highest TTE entry number, we count down 128 + */ 129 + sethi %hi(KERNBASE), %l3 130 + sethi %hi(kern_locked_tte_data), %l4 131 + ldx [%l4 + %lo(kern_locked_tte_data)], %l4 132 + clr %l5 133 + sethi %hi(num_kernel_image_mappings), %l6 134 + lduw [%l6 + %lo(num_kernel_image_mappings)], %l6 135 + add %l6, 1, %l6 136 + 137 + mov 15, %l7 138 + BRANCH_IF_ANY_CHEETAH(g1,g5,2f) 139 + 140 + mov 63, %l7 141 + 2: 142 + 143 + 3: 144 + /* Lock into I-MMU */ 122 145 sethi %hi(call_method), %g2 123 146 or %g2, %lo(call_method), %g2 124 147 stx %g2, [%sp + 2047 + 128 + 0x00] ··· 155 132 sethi %hi(prom_mmu_ihandle_cache), %g2 156 133 lduw [%g2 + %lo(prom_mmu_ihandle_cache)], %g2 157 134 stx %g2, [%sp + 2047 + 128 + 0x20] 158 - sethi %hi(KERNBASE), %g2 159 - stx %g2, [%sp + 2047 + 128 + 0x28] 160 - sethi %hi(kern_locked_tte_data), %g2 161 - ldx [%g2 + %lo(kern_locked_tte_data)], %g2 162 - stx %g2, [%sp + 2047 + 128 + 0x30] 163 135 164 - mov 15, %g2 165 - BRANCH_IF_ANY_CHEETAH(g1,g5,1f) 136 + /* Each TTE maps 4MB, convert index to offset. */ 137 + sllx %l5, 22, %g1 166 138 167 - mov 63, %g2 168 - 1: 139 + add %l3, %g1, %g2 140 + stx %g2, [%sp + 2047 + 128 + 0x28] ! VADDR 141 + add %l4, %g1, %g2 142 + stx %g2, [%sp + 2047 + 128 + 0x30] ! TTE 143 + 144 + /* TTE index is highest minus loop index. */ 145 + sub %l7, %l5, %g2 169 146 stx %g2, [%sp + 2047 + 128 + 0x38] 147 + 170 148 sethi %hi(p1275buf), %g2 171 149 or %g2, %lo(p1275buf), %g2 172 150 ldx [%g2 + 0x08], %o1 173 151 call %o1 174 152 add %sp, (2047 + 128), %o0 175 153 176 - sethi %hi(bigkernel), %g2 177 - lduw [%g2 + %lo(bigkernel)], %g2 178 - brz,pt %g2, do_dtlb 179 - nop 180 - 181 - sethi %hi(call_method), %g2 182 - or %g2, %lo(call_method), %g2 183 - stx %g2, [%sp + 2047 + 128 + 0x00] 184 - mov 5, %g2 185 - stx %g2, [%sp + 2047 + 128 + 0x08] 186 - mov 1, %g2 187 - stx %g2, [%sp + 2047 + 128 + 0x10] 188 - sethi %hi(itlb_load), %g2 189 - or %g2, %lo(itlb_load), %g2 190 - stx %g2, [%sp + 2047 + 128 + 0x18] 191 - sethi %hi(prom_mmu_ihandle_cache), %g2 192 - lduw [%g2 + %lo(prom_mmu_ihandle_cache)], %g2 193 - stx %g2, [%sp + 2047 + 128 + 0x20] 194 - sethi %hi(KERNBASE + 0x400000), %g2 195 - stx %g2, [%sp + 2047 + 128 + 0x28] 196 - sethi %hi(kern_locked_tte_data), %g2 197 - ldx [%g2 + %lo(kern_locked_tte_data)], %g2 198 - sethi %hi(0x400000), %g1 199 - add %g2, %g1, %g2 200 - stx %g2, [%sp + 2047 + 128 + 0x30] 201 - 202 - mov 14, %g2 203 - BRANCH_IF_ANY_CHEETAH(g1,g5,1f) 204 - 205 - mov 62, %g2 206 - 1: 207 - stx %g2, [%sp + 2047 + 128 + 0x38] 208 - sethi %hi(p1275buf), %g2 209 - or %g2, %lo(p1275buf), %g2 210 - ldx [%g2 + 0x08], %o1 211 - call %o1 212 - add %sp, (2047 + 128), %o0 213 - 214 - do_dtlb: 154 + /* Lock into D-MMU */ 215 155 sethi %hi(call_method), %g2 216 156 or %g2, %lo(call_method), %g2 217 157 stx %g2, [%sp + 2047 + 128 + 0x00] ··· 188 202 sethi %hi(prom_mmu_ihandle_cache), %g2 189 203 lduw [%g2 + %lo(prom_mmu_ihandle_cache)], %g2 190 204 stx %g2, [%sp + 2047 + 128 + 0x20] 191 - sethi %hi(KERNBASE), %g2 192 - stx %g2, [%sp + 2047 + 128 + 0x28] 193 - sethi %hi(kern_locked_tte_data), %g2 194 - ldx [%g2 + %lo(kern_locked_tte_data)], %g2 195 - stx %g2, [%sp + 2047 + 128 + 0x30] 196 205 197 - mov 15, %g2 198 - BRANCH_IF_ANY_CHEETAH(g1,g5,1f) 206 + /* Each TTE maps 4MB, convert index to offset. */ 207 + sllx %l5, 22, %g1 199 208 200 - mov 63, %g2 201 - 1: 209 + add %l3, %g1, %g2 210 + stx %g2, [%sp + 2047 + 128 + 0x28] ! VADDR 211 + add %l4, %g1, %g2 212 + stx %g2, [%sp + 2047 + 128 + 0x30] ! TTE 202 213 214 + /* TTE index is highest minus loop index. */ 215 + sub %l7, %l5, %g2 203 216 stx %g2, [%sp + 2047 + 128 + 0x38] 217 + 204 218 sethi %hi(p1275buf), %g2 205 219 or %g2, %lo(p1275buf), %g2 206 220 ldx [%g2 + 0x08], %o1 207 221 call %o1 208 222 add %sp, (2047 + 128), %o0 209 223 210 - sethi %hi(bigkernel), %g2 211 - lduw [%g2 + %lo(bigkernel)], %g2 212 - brz,pt %g2, do_unlock 224 + add %l5, 1, %l5 225 + cmp %l5, %l6 226 + bne,pt %xcc, 3b 213 227 nop 214 228 215 - sethi %hi(call_method), %g2 216 - or %g2, %lo(call_method), %g2 217 - stx %g2, [%sp + 2047 + 128 + 0x00] 218 - mov 5, %g2 219 - stx %g2, [%sp + 2047 + 128 + 0x08] 220 - mov 1, %g2 221 - stx %g2, [%sp + 2047 + 128 + 0x10] 222 - sethi %hi(dtlb_load), %g2 223 - or %g2, %lo(dtlb_load), %g2 224 - stx %g2, [%sp + 2047 + 128 + 0x18] 225 - sethi %hi(prom_mmu_ihandle_cache), %g2 226 - lduw [%g2 + %lo(prom_mmu_ihandle_cache)], %g2 227 - stx %g2, [%sp + 2047 + 128 + 0x20] 228 - sethi %hi(KERNBASE + 0x400000), %g2 229 - stx %g2, [%sp + 2047 + 128 + 0x28] 230 - sethi %hi(kern_locked_tte_data), %g2 231 - ldx [%g2 + %lo(kern_locked_tte_data)], %g2 232 - sethi %hi(0x400000), %g1 233 - add %g2, %g1, %g2 234 - stx %g2, [%sp + 2047 + 128 + 0x30] 235 - 236 - mov 14, %g2 237 - BRANCH_IF_ANY_CHEETAH(g1,g5,1f) 238 - 239 - mov 62, %g2 240 - 1: 241 - 242 - stx %g2, [%sp + 2047 + 128 + 0x38] 243 - sethi %hi(p1275buf), %g2 244 - or %g2, %lo(p1275buf), %g2 245 - ldx [%g2 + 0x08], %o1 246 - call %o1 247 - add %sp, (2047 + 128), %o0 248 - 249 - do_unlock: 250 229 sethi %hi(prom_entry_lock), %g2 251 230 stb %g0, [%g2 + %lo(prom_entry_lock)] 252 231 membar #StoreStore | #StoreLoad ··· 220 269 nop 221 270 222 271 niagara_lock_tlb: 272 + sethi %hi(KERNBASE), %l3 273 + sethi %hi(kern_locked_tte_data), %l4 274 + ldx [%l4 + %lo(kern_locked_tte_data)], %l4 275 + clr %l5 276 + sethi %hi(num_kernel_image_mappings), %l6 277 + lduw [%l6 + %lo(num_kernel_image_mappings)], %l6 278 + add %l6, 1, %l6 279 + 280 + 1: 223 281 mov HV_FAST_MMU_MAP_PERM_ADDR, %o5 224 - sethi %hi(KERNBASE), %o0 282 + sllx %l5, 22, %g2 283 + add %l3, %g2, %o0 225 284 clr %o1 226 - sethi %hi(kern_locked_tte_data), %o2 227 - ldx [%o2 + %lo(kern_locked_tte_data)], %o2 285 + add %l4, %g2, %o2 228 286 mov HV_MMU_IMMU, %o3 229 287 ta HV_FAST_TRAP 230 288 231 289 mov HV_FAST_MMU_MAP_PERM_ADDR, %o5 232 - sethi %hi(KERNBASE), %o0 290 + sllx %l5, 22, %g2 291 + add %l3, %g2, %o0 233 292 clr %o1 234 - sethi %hi(kern_locked_tte_data), %o2 235 - ldx [%o2 + %lo(kern_locked_tte_data)], %o2 293 + add %l4, %g2, %o2 236 294 mov HV_MMU_DMMU, %o3 237 295 ta HV_FAST_TRAP 238 296 239 - sethi %hi(bigkernel), %g2 240 - lduw [%g2 + %lo(bigkernel)], %g2 241 - brz,pt %g2, after_lock_tlb 297 + add %l5, 1, %l5 298 + cmp %l5, %l6 299 + bne,pt %xcc, 1b 242 300 nop 243 - 244 - mov HV_FAST_MMU_MAP_PERM_ADDR, %o5 245 - sethi %hi(KERNBASE + 0x400000), %o0 246 - clr %o1 247 - sethi %hi(kern_locked_tte_data), %o2 248 - ldx [%o2 + %lo(kern_locked_tte_data)], %o2 249 - sethi %hi(0x400000), %o3 250 - add %o2, %o3, %o2 251 - mov HV_MMU_IMMU, %o3 252 - ta HV_FAST_TRAP 253 - 254 - mov HV_FAST_MMU_MAP_PERM_ADDR, %o5 255 - sethi %hi(KERNBASE + 0x400000), %o0 256 - clr %o1 257 - sethi %hi(kern_locked_tte_data), %o2 258 - ldx [%o2 + %lo(kern_locked_tte_data)], %o2 259 - sethi %hi(0x400000), %o3 260 - add %o2, %o3, %o2 261 - mov HV_MMU_DMMU, %o3 262 - ta HV_FAST_TRAP 263 301 264 302 after_lock_tlb: 265 303 wrpr %g0, (PSTATE_PRIV | PSTATE_PEF), %pstate
+14 -24
arch/sparc64/mm/init.c
··· 166 166 unsigned long sparc64_kern_pri_nuc_bits __read_mostly; 167 167 unsigned long sparc64_kern_sec_context __read_mostly; 168 168 169 - int bigkernel = 0; 169 + int num_kernel_image_mappings; 170 170 171 171 #ifdef CONFIG_DEBUG_DCFLUSH 172 172 atomic_t dcpage_flushes = ATOMIC_INIT(0); ··· 572 572 static void __init remap_kernel(void) 573 573 { 574 574 unsigned long phys_page, tte_vaddr, tte_data; 575 - int tlb_ent = sparc64_highest_locked_tlbent(); 575 + int i, tlb_ent = sparc64_highest_locked_tlbent(); 576 576 577 577 tte_vaddr = (unsigned long) KERNBASE; 578 578 phys_page = (prom_boot_mapping_phys_low >> 22UL) << 22UL; ··· 582 582 583 583 /* Now lock us into the TLBs via Hypervisor or OBP. */ 584 584 if (tlb_type == hypervisor) { 585 - hypervisor_tlb_lock(tte_vaddr, tte_data, HV_MMU_DMMU); 586 - hypervisor_tlb_lock(tte_vaddr, tte_data, HV_MMU_IMMU); 587 - if (bigkernel) { 588 - tte_vaddr += 0x400000; 589 - tte_data += 0x400000; 585 + for (i = 0; i < num_kernel_image_mappings; i++) { 590 586 hypervisor_tlb_lock(tte_vaddr, tte_data, HV_MMU_DMMU); 591 587 hypervisor_tlb_lock(tte_vaddr, tte_data, HV_MMU_IMMU); 588 + tte_vaddr += 0x400000; 589 + tte_data += 0x400000; 592 590 } 593 591 } else { 594 - prom_dtlb_load(tlb_ent, tte_data, tte_vaddr); 595 - prom_itlb_load(tlb_ent, tte_data, tte_vaddr); 596 - if (bigkernel) { 597 - tlb_ent -= 1; 598 - prom_dtlb_load(tlb_ent, 599 - tte_data + 0x400000, 600 - tte_vaddr + 0x400000); 601 - prom_itlb_load(tlb_ent, 602 - tte_data + 0x400000, 603 - tte_vaddr + 0x400000); 592 + for (i = 0; i < num_kernel_image_mappings; i++) { 593 + prom_dtlb_load(tlb_ent - i, tte_data, tte_vaddr); 594 + prom_itlb_load(tlb_ent - i, tte_data, tte_vaddr); 595 + tte_vaddr += 0x400000; 596 + tte_data += 0x400000; 604 597 } 605 - sparc64_highest_unlocked_tlb_ent = tlb_ent - 1; 598 + sparc64_highest_unlocked_tlb_ent = tlb_ent - i; 606 599 } 607 600 if (tlb_type == cheetah_plus) { 608 601 sparc64_kern_pri_context = (CTX_CHEETAH_PLUS_CTX0 | ··· 1345 1352 shift = kern_base + PAGE_OFFSET - ((unsigned long)KERNBASE); 1346 1353 1347 1354 real_end = (unsigned long)_end; 1348 - if ((real_end > ((unsigned long)KERNBASE + 0x400000))) 1349 - bigkernel = 1; 1350 - if ((real_end > ((unsigned long)KERNBASE + 0x800000))) { 1351 - prom_printf("paging_init: Kernel > 8MB, too large.\n"); 1352 - prom_halt(); 1353 - } 1355 + num_kernel_image_mappings = DIV_ROUND_UP(real_end - KERNBASE, 1 << 22); 1356 + printk("Kernel: Using %d locked TLB entries for main kernel image.\n", 1357 + num_kernel_image_mappings); 1354 1358 1355 1359 /* Set kernel pgd to upper alias so physical page computations 1356 1360 * work.
+1 -1
include/asm-sparc64/hvtramp.h
··· 16 16 __u64 fault_info_va; 17 17 __u64 fault_info_pa; 18 18 __u64 thread_reg; 19 - struct hvtramp_mapping maps[2]; 19 + struct hvtramp_mapping maps[1]; 20 20 }; 21 21 22 22 extern void hv_cpu_startup(unsigned long hvdescr_pa);
+2
include/asm-sparc64/spitfire.h
··· 63 63 SPITFIRE_HIGHEST_LOCKED_TLBENT : \ 64 64 CHEETAH_HIGHEST_LOCKED_TLBENT) 65 65 66 + extern int num_kernel_image_mappings; 67 + 66 68 /* The data cache is write through, so this just invalidates the 67 69 * specified line. 68 70 */