aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc/mm/hash_utils_64.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/powerpc/mm/hash_utils_64.c')
-rw-r--r--arch/powerpc/mm/hash_utils_64.c106
1 files changed, 43 insertions, 63 deletions
diff --git a/arch/powerpc/mm/hash_utils_64.c b/arch/powerpc/mm/hash_utils_64.c
index d03fd2b4445e..3cc6d68f7117 100644
--- a/arch/powerpc/mm/hash_utils_64.c
+++ b/arch/powerpc/mm/hash_utils_64.c
@@ -167,34 +167,12 @@ int htab_bolt_mapping(unsigned long vstart, unsigned long vend,
167 hash = hpt_hash(va, shift); 167 hash = hpt_hash(va, shift);
168 hpteg = ((hash & htab_hash_mask) * HPTES_PER_GROUP); 168 hpteg = ((hash & htab_hash_mask) * HPTES_PER_GROUP);
169 169
170 /* The crap below can be cleaned once ppd_md.probe() can 170 DBG("htab_bolt_mapping: calling %p\n", ppc_md.hpte_insert);
171 * set up the hash callbacks, thus we can just used the 171
172 * normal insert callback here. 172 BUG_ON(!ppc_md.hpte_insert);
173 */ 173 ret = ppc_md.hpte_insert(hpteg, va, paddr,
174#ifdef CONFIG_PPC_ISERIES 174 tmp_mode, HPTE_V_BOLTED, psize);
175 if (machine_is(iseries)) 175
176 ret = iSeries_hpte_insert(hpteg, va,
177 paddr,
178 tmp_mode,
179 HPTE_V_BOLTED,
180 psize);
181 else
182#endif
183#ifdef CONFIG_PPC_PSERIES
184 if (machine_is(pseries) && firmware_has_feature(FW_FEATURE_LPAR))
185 ret = pSeries_lpar_hpte_insert(hpteg, va,
186 paddr,
187 tmp_mode,
188 HPTE_V_BOLTED,
189 psize);
190 else
191#endif
192#ifdef CONFIG_PPC_MULTIPLATFORM
193 ret = native_hpte_insert(hpteg, va,
194 paddr,
195 tmp_mode, HPTE_V_BOLTED,
196 psize);
197#endif
198 if (ret < 0) 176 if (ret < 0)
199 break; 177 break;
200 } 178 }
@@ -413,6 +391,41 @@ void create_section_mapping(unsigned long start, unsigned long end)
413} 391}
414#endif /* CONFIG_MEMORY_HOTPLUG */ 392#endif /* CONFIG_MEMORY_HOTPLUG */
415 393
394static inline void make_bl(unsigned int *insn_addr, void *func)
395{
396 unsigned long funcp = *((unsigned long *)func);
397 int offset = funcp - (unsigned long)insn_addr;
398
399 *insn_addr = (unsigned int)(0x48000001 | (offset & 0x03fffffc));
400 flush_icache_range((unsigned long)insn_addr, 4+
401 (unsigned long)insn_addr);
402}
403
404static void __init htab_finish_init(void)
405{
406 extern unsigned int *htab_call_hpte_insert1;
407 extern unsigned int *htab_call_hpte_insert2;
408 extern unsigned int *htab_call_hpte_remove;
409 extern unsigned int *htab_call_hpte_updatepp;
410
411#ifdef CONFIG_PPC_64K_PAGES
412 extern unsigned int *ht64_call_hpte_insert1;
413 extern unsigned int *ht64_call_hpte_insert2;
414 extern unsigned int *ht64_call_hpte_remove;
415 extern unsigned int *ht64_call_hpte_updatepp;
416
417 make_bl(ht64_call_hpte_insert1, ppc_md.hpte_insert);
418 make_bl(ht64_call_hpte_insert2, ppc_md.hpte_insert);
419 make_bl(ht64_call_hpte_remove, ppc_md.hpte_remove);
420 make_bl(ht64_call_hpte_updatepp, ppc_md.hpte_updatepp);
421#endif /* CONFIG_PPC_64K_PAGES */
422
423 make_bl(htab_call_hpte_insert1, ppc_md.hpte_insert);
424 make_bl(htab_call_hpte_insert2, ppc_md.hpte_insert);
425 make_bl(htab_call_hpte_remove, ppc_md.hpte_remove);
426 make_bl(htab_call_hpte_updatepp, ppc_md.hpte_updatepp);
427}
428
416void __init htab_initialize(void) 429void __init htab_initialize(void)
417{ 430{
418 unsigned long table; 431 unsigned long table;
@@ -525,6 +538,8 @@ void __init htab_initialize(void)
525 mmu_linear_psize)); 538 mmu_linear_psize));
526 } 539 }
527 540
541 htab_finish_init();
542
528 DBG(" <- htab_initialize()\n"); 543 DBG(" <- htab_initialize()\n");
529} 544}
530#undef KB 545#undef KB
@@ -787,16 +802,6 @@ void flush_hash_range(unsigned long number, int local)
787 } 802 }
788} 803}
789 804
790static inline void make_bl(unsigned int *insn_addr, void *func)
791{
792 unsigned long funcp = *((unsigned long *)func);
793 int offset = funcp - (unsigned long)insn_addr;
794
795 *insn_addr = (unsigned int)(0x48000001 | (offset & 0x03fffffc));
796 flush_icache_range((unsigned long)insn_addr, 4+
797 (unsigned long)insn_addr);
798}
799
800/* 805/*
801 * low_hash_fault is called when we the low level hash code failed 806 * low_hash_fault is called when we the low level hash code failed
802 * to instert a PTE due to an hypervisor error 807 * to instert a PTE due to an hypervisor error
@@ -815,28 +820,3 @@ void low_hash_fault(struct pt_regs *regs, unsigned long address)
815 } 820 }
816 bad_page_fault(regs, address, SIGBUS); 821 bad_page_fault(regs, address, SIGBUS);
817} 822}
818
819void __init htab_finish_init(void)
820{
821 extern unsigned int *htab_call_hpte_insert1;
822 extern unsigned int *htab_call_hpte_insert2;
823 extern unsigned int *htab_call_hpte_remove;
824 extern unsigned int *htab_call_hpte_updatepp;
825
826#ifdef CONFIG_PPC_64K_PAGES
827 extern unsigned int *ht64_call_hpte_insert1;
828 extern unsigned int *ht64_call_hpte_insert2;
829 extern unsigned int *ht64_call_hpte_remove;
830 extern unsigned int *ht64_call_hpte_updatepp;
831
832 make_bl(ht64_call_hpte_insert1, ppc_md.hpte_insert);
833 make_bl(ht64_call_hpte_insert2, ppc_md.hpte_insert);
834 make_bl(ht64_call_hpte_remove, ppc_md.hpte_remove);
835 make_bl(ht64_call_hpte_updatepp, ppc_md.hpte_updatepp);
836#endif /* CONFIG_PPC_64K_PAGES */
837
838 make_bl(htab_call_hpte_insert1, ppc_md.hpte_insert);
839 make_bl(htab_call_hpte_insert2, ppc_md.hpte_insert);
840 make_bl(htab_call_hpte_remove, ppc_md.hpte_remove);
841 make_bl(htab_call_hpte_updatepp, ppc_md.hpte_updatepp);
842}