diff options
Diffstat (limited to 'arch/powerpc/mm/hash_utils_64.c')
-rw-r--r-- | arch/powerpc/mm/hash_utils_64.c | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/arch/powerpc/mm/hash_utils_64.c b/arch/powerpc/mm/hash_utils_64.c index 14be408dfc9b..8920eea34528 100644 --- a/arch/powerpc/mm/hash_utils_64.c +++ b/arch/powerpc/mm/hash_utils_64.c | |||
@@ -191,12 +191,17 @@ int htab_bolt_mapping(unsigned long vstart, unsigned long vend, | |||
191 | unsigned long hash, hpteg; | 191 | unsigned long hash, hpteg; |
192 | unsigned long vsid = get_kernel_vsid(vaddr, ssize); | 192 | unsigned long vsid = get_kernel_vsid(vaddr, ssize); |
193 | unsigned long va = hpt_va(vaddr, vsid, ssize); | 193 | unsigned long va = hpt_va(vaddr, vsid, ssize); |
194 | unsigned long tprot = prot; | ||
195 | |||
196 | /* Make kernel text executable */ | ||
197 | if (in_kernel_text(vaddr)) | ||
198 | tprot &= ~HPTE_R_N; | ||
194 | 199 | ||
195 | hash = hpt_hash(va, shift, ssize); | 200 | hash = hpt_hash(va, shift, ssize); |
196 | hpteg = ((hash & htab_hash_mask) * HPTES_PER_GROUP); | 201 | hpteg = ((hash & htab_hash_mask) * HPTES_PER_GROUP); |
197 | 202 | ||
198 | BUG_ON(!ppc_md.hpte_insert); | 203 | BUG_ON(!ppc_md.hpte_insert); |
199 | ret = ppc_md.hpte_insert(hpteg, va, paddr, prot, | 204 | ret = ppc_md.hpte_insert(hpteg, va, paddr, tprot, |
200 | HPTE_V_BOLTED, psize, ssize); | 205 | HPTE_V_BOLTED, psize, ssize); |
201 | 206 | ||
202 | if (ret < 0) | 207 | if (ret < 0) |
@@ -584,7 +589,7 @@ void __init htab_initialize(void) | |||
584 | { | 589 | { |
585 | unsigned long table; | 590 | unsigned long table; |
586 | unsigned long pteg_count; | 591 | unsigned long pteg_count; |
587 | unsigned long prot, tprot; | 592 | unsigned long prot; |
588 | unsigned long base = 0, size = 0, limit; | 593 | unsigned long base = 0, size = 0, limit; |
589 | int i; | 594 | int i; |
590 | 595 | ||
@@ -660,10 +665,9 @@ void __init htab_initialize(void) | |||
660 | for (i=0; i < lmb.memory.cnt; i++) { | 665 | for (i=0; i < lmb.memory.cnt; i++) { |
661 | base = (unsigned long)__va(lmb.memory.region[i].base); | 666 | base = (unsigned long)__va(lmb.memory.region[i].base); |
662 | size = lmb.memory.region[i].size; | 667 | size = lmb.memory.region[i].size; |
663 | tprot = prot | (in_kernel_text(base) ? _PAGE_EXEC : 0); | ||
664 | 668 | ||
665 | DBG("creating mapping for region: %lx..%lx (prot: %x)\n", | 669 | DBG("creating mapping for region: %lx..%lx (prot: %x)\n", |
666 | base, size, tprot); | 670 | base, size, prot); |
667 | 671 | ||
668 | #ifdef CONFIG_U3_DART | 672 | #ifdef CONFIG_U3_DART |
669 | /* Do not map the DART space. Fortunately, it will be aligned | 673 | /* Do not map the DART space. Fortunately, it will be aligned |
@@ -680,21 +684,21 @@ void __init htab_initialize(void) | |||
680 | unsigned long dart_table_end = dart_tablebase + 16 * MB; | 684 | unsigned long dart_table_end = dart_tablebase + 16 * MB; |
681 | if (base != dart_tablebase) | 685 | if (base != dart_tablebase) |
682 | BUG_ON(htab_bolt_mapping(base, dart_tablebase, | 686 | BUG_ON(htab_bolt_mapping(base, dart_tablebase, |
683 | __pa(base), tprot, | 687 | __pa(base), prot, |
684 | mmu_linear_psize, | 688 | mmu_linear_psize, |
685 | mmu_kernel_ssize)); | 689 | mmu_kernel_ssize)); |
686 | if ((base + size) > dart_table_end) | 690 | if ((base + size) > dart_table_end) |
687 | BUG_ON(htab_bolt_mapping(dart_tablebase+16*MB, | 691 | BUG_ON(htab_bolt_mapping(dart_tablebase+16*MB, |
688 | base + size, | 692 | base + size, |
689 | __pa(dart_table_end), | 693 | __pa(dart_table_end), |
690 | tprot, | 694 | prot, |
691 | mmu_linear_psize, | 695 | mmu_linear_psize, |
692 | mmu_kernel_ssize)); | 696 | mmu_kernel_ssize)); |
693 | continue; | 697 | continue; |
694 | } | 698 | } |
695 | #endif /* CONFIG_U3_DART */ | 699 | #endif /* CONFIG_U3_DART */ |
696 | BUG_ON(htab_bolt_mapping(base, base + size, __pa(base), | 700 | BUG_ON(htab_bolt_mapping(base, base + size, __pa(base), |
697 | tprot, mmu_linear_psize, mmu_kernel_ssize)); | 701 | prot, mmu_linear_psize, mmu_kernel_ssize)); |
698 | } | 702 | } |
699 | 703 | ||
700 | /* | 704 | /* |