aboutsummaryrefslogtreecommitdiffstats
path: root/arch/sparc/mm/srmmu.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/sparc/mm/srmmu.c')
-rw-r--r--arch/sparc/mm/srmmu.c52
1 files changed, 21 insertions, 31 deletions
diff --git a/arch/sparc/mm/srmmu.c b/arch/sparc/mm/srmmu.c
index 8e97e0305b01..62e3f5773303 100644
--- a/arch/sparc/mm/srmmu.c
+++ b/arch/sparc/mm/srmmu.c
@@ -467,33 +467,6 @@ void srmmu_unmapiorange(unsigned long virt_addr, unsigned int len)
467 flush_tlb_all(); 467 flush_tlb_all();
468} 468}
469 469
470/*
471 * On the SRMMU we do not have the problems with limited tlb entries
472 * for mapping kernel pages, so we just take things from the free page
473 * pool. As a side effect we are putting a little too much pressure
474 * on the gfp() subsystem. This setup also makes the logic of the
475 * iommu mapping code a lot easier as we can transparently handle
476 * mappings on the kernel stack without any special code.
477 */
478struct thread_info *alloc_thread_info_node(struct task_struct *tsk, int node)
479{
480 struct thread_info *ret;
481
482 ret = (struct thread_info *)__get_free_pages(GFP_KERNEL,
483 THREAD_INFO_ORDER);
484#ifdef CONFIG_DEBUG_STACK_USAGE
485 if (ret)
486 memset(ret, 0, PAGE_SIZE << THREAD_INFO_ORDER);
487#endif /* DEBUG_STACK_USAGE */
488
489 return ret;
490}
491
492void free_thread_info(struct thread_info *ti)
493{
494 free_pages((unsigned long)ti, THREAD_INFO_ORDER);
495}
496
497/* tsunami.S */ 470/* tsunami.S */
498extern void tsunami_flush_cache_all(void); 471extern void tsunami_flush_cache_all(void);
499extern void tsunami_flush_cache_mm(struct mm_struct *mm); 472extern void tsunami_flush_cache_mm(struct mm_struct *mm);
@@ -673,6 +646,23 @@ static void __init srmmu_allocate_ptable_skeleton(unsigned long start,
673 } 646 }
674} 647}
675 648
649/* These flush types are not available on all chips... */
650static inline unsigned long srmmu_probe(unsigned long vaddr)
651{
652 unsigned long retval;
653
654 if (sparc_cpu_model != sparc_leon) {
655
656 vaddr &= PAGE_MASK;
657 __asm__ __volatile__("lda [%1] %2, %0\n\t" :
658 "=r" (retval) :
659 "r" (vaddr | 0x400), "i" (ASI_M_FLUSH_PROBE));
660 } else {
661 retval = leon_swprobe(vaddr, 0);
662 }
663 return retval;
664}
665
676/* 666/*
677 * This is much cleaner than poking around physical address space 667 * This is much cleaner than poking around physical address space
678 * looking at the prom's page table directly which is what most 668 * looking at the prom's page table directly which is what most
@@ -692,7 +682,7 @@ static void __init srmmu_inherit_prom_mappings(unsigned long start,
692 break; /* probably wrap around */ 682 break; /* probably wrap around */
693 if(start == 0xfef00000) 683 if(start == 0xfef00000)
694 start = KADB_DEBUGGER_BEGVM; 684 start = KADB_DEBUGGER_BEGVM;
695 if(!(prompte = srmmu_hwprobe(start))) { 685 if(!(prompte = srmmu_probe(start))) {
696 start += PAGE_SIZE; 686 start += PAGE_SIZE;
697 continue; 687 continue;
698 } 688 }
@@ -701,12 +691,12 @@ static void __init srmmu_inherit_prom_mappings(unsigned long start,
701 what = 0; 691 what = 0;
702 692
703 if(!(start & ~(SRMMU_REAL_PMD_MASK))) { 693 if(!(start & ~(SRMMU_REAL_PMD_MASK))) {
704 if(srmmu_hwprobe((start-PAGE_SIZE) + SRMMU_REAL_PMD_SIZE) == prompte) 694 if(srmmu_probe((start-PAGE_SIZE) + SRMMU_REAL_PMD_SIZE) == prompte)
705 what = 1; 695 what = 1;
706 } 696 }
707 697
708 if(!(start & ~(SRMMU_PGDIR_MASK))) { 698 if(!(start & ~(SRMMU_PGDIR_MASK))) {
709 if(srmmu_hwprobe((start-PAGE_SIZE) + SRMMU_PGDIR_SIZE) == 699 if(srmmu_probe((start-PAGE_SIZE) + SRMMU_PGDIR_SIZE) ==
710 prompte) 700 prompte)
711 what = 2; 701 what = 2;
712 } 702 }
@@ -1183,7 +1173,7 @@ static void turbosparc_flush_page_to_ram(unsigned long page)
1183#ifdef TURBOSPARC_WRITEBACK 1173#ifdef TURBOSPARC_WRITEBACK
1184 volatile unsigned long clear; 1174 volatile unsigned long clear;
1185 1175
1186 if (srmmu_hwprobe(page)) 1176 if (srmmu_probe(page))
1187 turbosparc_flush_page_cache(page); 1177 turbosparc_flush_page_cache(page);
1188 clear = srmmu_get_fstatus(); 1178 clear = srmmu_get_fstatus();
1189#endif 1179#endif