diff options
Diffstat (limited to 'arch/sparc64/mm/init.c')
-rw-r--r-- | arch/sparc64/mm/init.c | 43 |
1 files changed, 15 insertions, 28 deletions
diff --git a/arch/sparc64/mm/init.c b/arch/sparc64/mm/init.c index b5c30416fdac..f37078d96407 100644 --- a/arch/sparc64/mm/init.c +++ b/arch/sparc64/mm/init.c | |||
@@ -46,6 +46,7 @@ | |||
46 | #include <asm/prom.h> | 46 | #include <asm/prom.h> |
47 | #include <asm/sstate.h> | 47 | #include <asm/sstate.h> |
48 | #include <asm/mdesc.h> | 48 | #include <asm/mdesc.h> |
49 | #include <asm/cpudata.h> | ||
49 | 50 | ||
50 | #define MAX_PHYS_ADDRESS (1UL << 42UL) | 51 | #define MAX_PHYS_ADDRESS (1UL << 42UL) |
51 | #define KPTE_BITMAP_CHUNK_SZ (256UL * 1024UL * 1024UL) | 52 | #define KPTE_BITMAP_CHUNK_SZ (256UL * 1024UL * 1024UL) |
@@ -166,7 +167,7 @@ unsigned long sparc64_kern_pri_context __read_mostly; | |||
166 | unsigned long sparc64_kern_pri_nuc_bits __read_mostly; | 167 | unsigned long sparc64_kern_pri_nuc_bits __read_mostly; |
167 | unsigned long sparc64_kern_sec_context __read_mostly; | 168 | unsigned long sparc64_kern_sec_context __read_mostly; |
168 | 169 | ||
169 | int bigkernel = 0; | 170 | int num_kernel_image_mappings; |
170 | 171 | ||
171 | #ifdef CONFIG_DEBUG_DCFLUSH | 172 | #ifdef CONFIG_DEBUG_DCFLUSH |
172 | atomic_t dcpage_flushes = ATOMIC_INIT(0); | 173 | atomic_t dcpage_flushes = ATOMIC_INIT(0); |
@@ -572,7 +573,7 @@ static unsigned long kern_large_tte(unsigned long paddr); | |||
572 | static void __init remap_kernel(void) | 573 | static void __init remap_kernel(void) |
573 | { | 574 | { |
574 | unsigned long phys_page, tte_vaddr, tte_data; | 575 | unsigned long phys_page, tte_vaddr, tte_data; |
575 | int tlb_ent = sparc64_highest_locked_tlbent(); | 576 | int i, tlb_ent = sparc64_highest_locked_tlbent(); |
576 | 577 | ||
577 | tte_vaddr = (unsigned long) KERNBASE; | 578 | tte_vaddr = (unsigned long) KERNBASE; |
578 | phys_page = (prom_boot_mapping_phys_low >> 22UL) << 22UL; | 579 | phys_page = (prom_boot_mapping_phys_low >> 22UL) << 22UL; |
@@ -582,27 +583,20 @@ static void __init remap_kernel(void) | |||
582 | 583 | ||
583 | /* Now lock us into the TLBs via Hypervisor or OBP. */ | 584 | /* Now lock us into the TLBs via Hypervisor or OBP. */ |
584 | if (tlb_type == hypervisor) { | 585 | if (tlb_type == hypervisor) { |
585 | hypervisor_tlb_lock(tte_vaddr, tte_data, HV_MMU_DMMU); | 586 | for (i = 0; i < num_kernel_image_mappings; i++) { |
586 | hypervisor_tlb_lock(tte_vaddr, tte_data, HV_MMU_IMMU); | ||
587 | if (bigkernel) { | ||
588 | tte_vaddr += 0x400000; | ||
589 | tte_data += 0x400000; | ||
590 | hypervisor_tlb_lock(tte_vaddr, tte_data, HV_MMU_DMMU); | 587 | hypervisor_tlb_lock(tte_vaddr, tte_data, HV_MMU_DMMU); |
591 | hypervisor_tlb_lock(tte_vaddr, tte_data, HV_MMU_IMMU); | 588 | hypervisor_tlb_lock(tte_vaddr, tte_data, HV_MMU_IMMU); |
589 | tte_vaddr += 0x400000; | ||
590 | tte_data += 0x400000; | ||
592 | } | 591 | } |
593 | } else { | 592 | } else { |
594 | prom_dtlb_load(tlb_ent, tte_data, tte_vaddr); | 593 | for (i = 0; i < num_kernel_image_mappings; i++) { |
595 | prom_itlb_load(tlb_ent, tte_data, tte_vaddr); | 594 | prom_dtlb_load(tlb_ent - i, tte_data, tte_vaddr); |
596 | if (bigkernel) { | 595 | prom_itlb_load(tlb_ent - i, tte_data, tte_vaddr); |
597 | tlb_ent -= 1; | 596 | tte_vaddr += 0x400000; |
598 | prom_dtlb_load(tlb_ent, | 597 | tte_data += 0x400000; |
599 | tte_data + 0x400000, | ||
600 | tte_vaddr + 0x400000); | ||
601 | prom_itlb_load(tlb_ent, | ||
602 | tte_data + 0x400000, | ||
603 | tte_vaddr + 0x400000); | ||
604 | } | 598 | } |
605 | sparc64_highest_unlocked_tlb_ent = tlb_ent - 1; | 599 | sparc64_highest_unlocked_tlb_ent = tlb_ent - i; |
606 | } | 600 | } |
607 | if (tlb_type == cheetah_plus) { | 601 | if (tlb_type == cheetah_plus) { |
608 | sparc64_kern_pri_context = (CTX_CHEETAH_PLUS_CTX0 | | 602 | sparc64_kern_pri_context = (CTX_CHEETAH_PLUS_CTX0 | |
@@ -1280,10 +1274,6 @@ void __cpuinit sun4v_ktsb_register(void) | |||
1280 | 1274 | ||
1281 | /* paging_init() sets up the page tables */ | 1275 | /* paging_init() sets up the page tables */ |
1282 | 1276 | ||
1283 | extern void cheetah_ecache_flush_init(void); | ||
1284 | extern void sun4v_patch_tlb_handlers(void); | ||
1285 | |||
1286 | extern void cpu_probe(void); | ||
1287 | extern void central_probe(void); | 1277 | extern void central_probe(void); |
1288 | 1278 | ||
1289 | static unsigned long last_valid_pfn; | 1279 | static unsigned long last_valid_pfn; |
@@ -1352,12 +1342,9 @@ void __init paging_init(void) | |||
1352 | shift = kern_base + PAGE_OFFSET - ((unsigned long)KERNBASE); | 1342 | shift = kern_base + PAGE_OFFSET - ((unsigned long)KERNBASE); |
1353 | 1343 | ||
1354 | real_end = (unsigned long)_end; | 1344 | real_end = (unsigned long)_end; |
1355 | if ((real_end > ((unsigned long)KERNBASE + 0x400000))) | 1345 | num_kernel_image_mappings = DIV_ROUND_UP(real_end - KERNBASE, 1 << 22); |
1356 | bigkernel = 1; | 1346 | printk("Kernel: Using %d locked TLB entries for main kernel image.\n", |
1357 | if ((real_end > ((unsigned long)KERNBASE + 0x800000))) { | 1347 | num_kernel_image_mappings); |
1358 | prom_printf("paging_init: Kernel > 8MB, too large.\n"); | ||
1359 | prom_halt(); | ||
1360 | } | ||
1361 | 1348 | ||
1362 | /* Set kernel pgd to upper alias so physical page computations | 1349 | /* Set kernel pgd to upper alias so physical page computations |
1363 | * work. | 1350 | * work. |