aboutsummaryrefslogtreecommitdiffstats
path: root/arch/tile/mm/init.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/tile/mm/init.c')
-rw-r--r--arch/tile/mm/init.c26
1 files changed, 15 insertions, 11 deletions
diff --git a/arch/tile/mm/init.c b/arch/tile/mm/init.c
index 830c4908ea76..6a9d20ddc34f 100644
--- a/arch/tile/mm/init.c
+++ b/arch/tile/mm/init.c
@@ -254,11 +254,6 @@ static pgprot_t __init init_pgprot(ulong address)
254 return construct_pgprot(PAGE_KERNEL_RO, PAGE_HOME_IMMUTABLE); 254 return construct_pgprot(PAGE_KERNEL_RO, PAGE_HOME_IMMUTABLE);
255 } 255 }
256 256
257 /* As a performance optimization, keep the boot init stack here. */
258 if (address >= (ulong)&init_thread_union &&
259 address < (ulong)&init_thread_union + THREAD_SIZE)
260 return construct_pgprot(PAGE_KERNEL, smp_processor_id());
261
262#ifndef __tilegx__ 257#ifndef __tilegx__
263#if !ATOMIC_LOCKS_FOUND_VIA_TABLE() 258#if !ATOMIC_LOCKS_FOUND_VIA_TABLE()
264 /* Force the atomic_locks[] array page to be hash-for-home. */ 259 /* Force the atomic_locks[] array page to be hash-for-home. */
@@ -557,6 +552,7 @@ static void __init kernel_physical_mapping_init(pgd_t *pgd_base)
557 552
558 address = MEM_SV_INTRPT; 553 address = MEM_SV_INTRPT;
559 pmd = get_pmd(pgtables, address); 554 pmd = get_pmd(pgtables, address);
555 pfn = 0; /* code starts at PA 0 */
560 if (ktext_small) { 556 if (ktext_small) {
561 /* Allocate an L2 PTE for the kernel text */ 557 /* Allocate an L2 PTE for the kernel text */
562 int cpu = 0; 558 int cpu = 0;
@@ -579,10 +575,15 @@ static void __init kernel_physical_mapping_init(pgd_t *pgd_base)
579 } 575 }
580 576
581 BUG_ON(address != (unsigned long)_stext); 577 BUG_ON(address != (unsigned long)_stext);
582 pfn = 0; /* code starts at PA 0 */ 578 pte = NULL;
583 pte = alloc_pte(); 579 for (; address < (unsigned long)_einittext;
584 for (pte_ofs = 0; address < (unsigned long)_einittext; 580 pfn++, address += PAGE_SIZE) {
585 pfn++, pte_ofs++, address += PAGE_SIZE) { 581 pte_ofs = pte_index(address);
582 if (pte_ofs == 0) {
583 if (pte)
584 assign_pte(pmd++, pte);
585 pte = alloc_pte();
586 }
586 if (!ktext_local) { 587 if (!ktext_local) {
587 prot = set_remote_cache_cpu(prot, cpu); 588 prot = set_remote_cache_cpu(prot, cpu);
588 cpu = cpumask_next(cpu, &ktext_mask); 589 cpu = cpumask_next(cpu, &ktext_mask);
@@ -591,7 +592,8 @@ static void __init kernel_physical_mapping_init(pgd_t *pgd_base)
591 } 592 }
592 pte[pte_ofs] = pfn_pte(pfn, prot); 593 pte[pte_ofs] = pfn_pte(pfn, prot);
593 } 594 }
594 assign_pte(pmd, pte); 595 if (pte)
596 assign_pte(pmd, pte);
595 } else { 597 } else {
596 pte_t pteval = pfn_pte(0, PAGE_KERNEL_EXEC); 598 pte_t pteval = pfn_pte(0, PAGE_KERNEL_EXEC);
597 pteval = pte_mkhuge(pteval); 599 pteval = pte_mkhuge(pteval);
@@ -614,7 +616,9 @@ static void __init kernel_physical_mapping_init(pgd_t *pgd_base)
614 else 616 else
615 pteval = hv_pte_set_mode(pteval, 617 pteval = hv_pte_set_mode(pteval,
616 HV_PTE_MODE_CACHE_NO_L3); 618 HV_PTE_MODE_CACHE_NO_L3);
617 *(pte_t *)pmd = pteval; 619 for (; address < (unsigned long)_einittext;
620 pfn += PFN_DOWN(HPAGE_SIZE), address += HPAGE_SIZE)
621 *(pte_t *)(pmd++) = pfn_pte(pfn, pteval);
618 } 622 }
619 623
620 /* Set swapper_pgprot here so it is flushed to memory right away. */ 624 /* Set swapper_pgprot here so it is flushed to memory right away. */