Index: sys/arch/sparc64/sparc64/cache.c =================================================================== RCS file: /cvsroot/src/sys/arch/sparc64/sparc64/cache.c,v retrieving revision 1.8 diff -u -r1.8 cache.c --- sys/arch/sparc64/sparc64/cache.c 6 Jun 2011 02:49:39 -0000 1.8 +++ sys/arch/sparc64/sparc64/cache.c 22 Dec 2014 10:13:00 -0000 @@ -75,6 +75,35 @@ void (*sp_dcache_flush_page)(paddr_t) = dcache_flush_page_us; #endif +/* Routines to flush TLB mappings - both C and assembly used to implement these */ +void sp_tlb_flush_pte_us(vaddr_t, int); +void sp_tlb_flush_pte_usiii(vaddr_t, int); +static void sp_tlb_flush_pte_sun4v(vaddr_t, int); +void sp_tlb_flush_all_us(void); +void sp_tlb_flush_all_usiii(void); +static void sp_tlb_flush_all_sun4v(void); + +/* Function pointers to flush TLB mappings */ +static void (*sp_tlb_flush_pte_func)(vaddr_t, int) = NULL; +static void (*sp_tlb_flush_all_func)(void) = NULL; + +static void +sp_tlb_flush_pte_sun4v(vaddr_t va, int ctx) +{ + int64_t hv_rc; + hv_rc = hv_mmu_demap_page(va, ctx, MAP_DTLB|MAP_ITLB); + if ( hv_rc != H_EOK ) + panic("sp_tlb_flush_pte_sun4v(): hv_mmu_demap_page(%p,%d) failed - rc = %" PRIx64 "\n", (void*)va, ctx, hv_rc); +} + +static void +sp_tlb_flush_all_sun4v(void) +{ + panic("sp_tlb_flush_all_sun4v() not implemented yet"); +} + + + void cache_setup_funcs(void) { @@ -103,4 +132,31 @@ } #endif } + + /* Initialize the sp_tlb_flush_pte/sp_tlb_flush_all function pointers */ + if (CPU_ISSUN4V) { + sp_tlb_flush_pte_func = sp_tlb_flush_pte_sun4v; + sp_tlb_flush_all_func = sp_tlb_flush_all_sun4v; + } else if (CPU_IS_USIII_UP() || CPU_IS_SPARC64_V_UP()) { + sp_tlb_flush_pte_func = sp_tlb_flush_pte_usiii; + sp_tlb_flush_all_func = sp_tlb_flush_all_usiii; + } + else { + sp_tlb_flush_pte_func = sp_tlb_flush_pte_us; + sp_tlb_flush_all_func = sp_tlb_flush_all_us; + } + +} + +void +sp_tlb_flush_pte(vaddr_t va, int ctx) +{ + sp_tlb_flush_pte_func(va, ctx); } + +void +sp_tlb_flush_all(void) +{ + sp_tlb_flush_all_func(); +} + Index: sys/arch/sparc64/sparc64/cache.h =================================================================== RCS file: /cvsroot/src/sys/arch/sparc64/sparc64/cache.h,v retrieving revision 1.26 diff -u -r1.26 cache.h --- sys/arch/sparc64/sparc64/cache.h 5 Nov 2014 13:50:50 -0000 1.26 +++ sys/arch/sparc64/sparc64/cache.h 22 Dec 2014 10:13:00 -0000 @@ -111,41 +111,11 @@ cache_flush_phys_us(pa, size, ecache); } -/* SPARC64 specific */ -/* Assembly routines to flush TLB mappings */ -void sp_tlb_flush_pte_us(vaddr_t, int); -void sp_tlb_flush_pte_usiii(vaddr_t, int); -void sp_tlb_flush_all_us(void); -void sp_tlb_flush_all_usiii(void); - -static __inline__ void -sp_tlb_flush_pte_sun4v(vaddr_t va, int ctx) -{ - int64_t hv_rc; - hv_rc = hv_mmu_demap_page(va, ctx, MAP_DTLB|MAP_ITLB); - if ( hv_rc != H_EOK ) - panic("hv_mmu_demap_page(%p,%d) failed - rc = %" PRIx64 "\n", (void*)va, ctx, hv_rc); -} - -static __inline__ void -sp_tlb_flush_pte(vaddr_t va, int ctx) -{ - if (CPU_ISSUN4V) - sp_tlb_flush_pte_sun4v(va, ctx); - else if (CPU_IS_USIII_UP() || CPU_IS_SPARC64_V_UP()) - sp_tlb_flush_pte_usiii(va, ctx); - else - sp_tlb_flush_pte_us(va, ctx); -} - -static __inline__ void -sp_tlb_flush_all(void) -{ - if (CPU_IS_USIII_UP() || CPU_IS_SPARC64_V_UP()) - sp_tlb_flush_all_usiii(); - else - sp_tlb_flush_all_us(); -} + +/* Routines to flush TLB mappings */ +void sp_tlb_flush_pte(vaddr_t, int); +void sp_tlb_flush_all(void); + extern void (*dcache_flush_page)(paddr_t); extern void (*dcache_flush_page_cpuset)(paddr_t, sparc64_cpuset_t);