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

* master.kernel.org:/pub/scm/linux/kernel/git/davem/sparc-2.6:
[SPARC64]: Fix D-cache corruption in mremap
[SPARC64]: Make smp_processor_id() functional before start_kernel()

+71 -36
+30
arch/sparc64/kernel/head.S
··· 10 10 #include <linux/config.h> 11 11 #include <linux/version.h> 12 12 #include <linux/errno.h> 13 + #include <linux/threads.h> 13 14 #include <asm/thread_info.h> 14 15 #include <asm/asi.h> 15 16 #include <asm/pstate.h> ··· 493 492 mov %l6, %o1 ! OpenPROM stack 494 493 call prom_init 495 494 mov %l7, %o0 ! OpenPROM cif handler 495 + 496 + /* Initialize current_thread_info()->cpu as early as possible. 497 + * In order to do that accurately we have to patch up the get_cpuid() 498 + * assembler sequences. And that, in turn, requires that we know 499 + * if we are on a Starfire box or not. While we're here, patch up 500 + * the sun4v sequences as well. 501 + */ 502 + call check_if_starfire 503 + nop 504 + call per_cpu_patch 505 + nop 506 + call sun4v_patch 507 + nop 508 + 509 + #ifdef CONFIG_SMP 510 + call hard_smp_processor_id 511 + nop 512 + cmp %o0, NR_CPUS 513 + blu,pt %xcc, 1f 514 + nop 515 + call boot_cpu_id_too_large 516 + nop 517 + /* Not reached... */ 518 + 519 + 1: 520 + #else 521 + mov 0, %o0 522 + #endif 523 + stb %o0, [%g6 + TI_CPU] 496 524 497 525 /* Off we go.... */ 498 526 call start_kernel
+11 -12
arch/sparc64/kernel/setup.c
··· 220 220 221 221 static struct pt_regs fake_swapper_regs = { { 0, }, 0, 0, 0, 0 }; 222 222 223 - static void __init per_cpu_patch(void) 223 + void __init per_cpu_patch(void) 224 224 { 225 225 struct cpuid_patch_entry *p; 226 226 unsigned long ver; ··· 280 280 } 281 281 } 282 282 283 - static void __init sun4v_patch(void) 283 + void __init sun4v_patch(void) 284 284 { 285 285 struct sun4v_1insn_patch_entry *p1; 286 286 struct sun4v_2insn_patch_entry *p2; ··· 315 315 } 316 316 } 317 317 318 + #ifdef CONFIG_SMP 319 + void __init boot_cpu_id_too_large(int cpu) 320 + { 321 + prom_printf("Serious problem, boot cpu id (%d) >= NR_CPUS (%d)\n", 322 + cpu, NR_CPUS); 323 + prom_halt(); 324 + } 325 + #endif 326 + 318 327 void __init setup_arch(char **cmdline_p) 319 328 { 320 329 /* Initialize PROM console and command line. */ ··· 340 331 #elif defined(CONFIG_PROM_CONSOLE) 341 332 conswitchp = &prom_con; 342 333 #endif 343 - 344 - /* Work out if we are starfire early on */ 345 - check_if_starfire(); 346 - 347 - /* Now we know enough to patch the get_cpuid sequences 348 - * used by trap code. 349 - */ 350 - per_cpu_patch(); 351 - 352 - sun4v_patch(); 353 334 354 335 boot_flags_init(*cmdline_p); 355 336
+3 -13
arch/sparc64/kernel/smp.c
··· 1264 1264 boot_cpu_id = hard_smp_processor_id(); 1265 1265 current_tick_offset = timer_tick_offset; 1266 1266 1267 - cpu_set(boot_cpu_id, cpu_online_map); 1268 1267 prof_counter(boot_cpu_id) = prof_multiplier(boot_cpu_id) = 1; 1269 1268 } 1270 1269 ··· 1344 1345 1345 1346 void __devinit smp_prepare_boot_cpu(void) 1346 1347 { 1347 - int cpu = hard_smp_processor_id(); 1348 - 1349 - if (cpu >= NR_CPUS) { 1350 - prom_printf("Serious problem, boot cpu id >= NR_CPUS\n"); 1351 - prom_halt(); 1352 - } 1353 - 1354 - current_thread_info()->cpu = cpu; 1355 - __local_per_cpu_offset = __per_cpu_offset(cpu); 1356 - 1357 - cpu_set(smp_processor_id(), cpu_online_map); 1358 - cpu_set(smp_processor_id(), phys_cpu_present_map); 1359 1348 } 1360 1349 1361 1350 int __devinit __cpu_up(unsigned int cpu) ··· 1420 1433 1421 1434 for (i = 0; i < NR_CPUS; i++, ptr += size) 1422 1435 memcpy(ptr, __per_cpu_start, __per_cpu_end - __per_cpu_start); 1436 + 1437 + /* Setup %g5 for the boot cpu. */ 1438 + __local_per_cpu_offset = __per_cpu_offset(smp_processor_id()); 1423 1439 }
+1 -10
include/asm-generic/pgtable.h
··· 159 159 #define lazy_mmu_prot_update(pte) do { } while (0) 160 160 #endif 161 161 162 - #ifndef __HAVE_ARCH_MULTIPLE_ZERO_PAGE 162 + #ifndef __HAVE_ARCH_MOVE_PTE 163 163 #define move_pte(pte, prot, old_addr, new_addr) (pte) 164 - #else 165 - #define move_pte(pte, prot, old_addr, new_addr) \ 166 - ({ \ 167 - pte_t newpte = (pte); \ 168 - if (pte_present(pte) && pfn_valid(pte_pfn(pte)) && \ 169 - pte_page(pte) == ZERO_PAGE(old_addr)) \ 170 - newpte = mk_pte(ZERO_PAGE(new_addr), (prot)); \ 171 - newpte; \ 172 - }) 173 164 #endif 174 165 175 166 /*
+9 -1
include/asm-mips/pgtable.h
··· 70 70 #define ZERO_PAGE(vaddr) \ 71 71 (virt_to_page(empty_zero_page + (((unsigned long)(vaddr)) & zero_page_mask))) 72 72 73 - #define __HAVE_ARCH_MULTIPLE_ZERO_PAGE 73 + #define __HAVE_ARCH_MOVE_PTE 74 + #define move_pte(pte, prot, old_addr, new_addr) \ 75 + ({ \ 76 + pte_t newpte = (pte); \ 77 + if (pte_present(pte) && pfn_valid(pte_pfn(pte)) && \ 78 + pte_page(pte) == ZERO_PAGE(old_addr)) \ 79 + newpte = mk_pte(ZERO_PAGE(new_addr), (prot)); \ 80 + newpte; \ 81 + }) 74 82 75 83 extern void paging_init(void); 76 84
+17
include/asm-sparc64/pgtable.h
··· 689 689 #define pte_clear(mm,addr,ptep) \ 690 690 set_pte_at((mm), (addr), (ptep), __pte(0UL)) 691 691 692 + #ifdef DCACHE_ALIASING_POSSIBLE 693 + #define __HAVE_ARCH_MOVE_PTE 694 + #define move_pte(pte, prot, old_addr, new_addr) \ 695 + ({ \ 696 + pte_t newpte = (pte); \ 697 + if (tlb_type != hypervisor && pte_present(pte)) { \ 698 + unsigned long this_pfn = pte_pfn(pte); \ 699 + \ 700 + if (pfn_valid(this_pfn) && \ 701 + (((old_addr) ^ (new_addr)) & (1 << 13))) \ 702 + flush_dcache_page_all(current->mm, \ 703 + pfn_to_page(this_pfn)); \ 704 + } \ 705 + newpte; \ 706 + }) 707 + #endif 708 + 692 709 extern pgd_t swapper_pg_dir[2048]; 693 710 extern pmd_t swapper_low_pmd_dir[2048]; 694 711