~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/arch/xtensa/mm/mmu.c

Version: ~ [ linux-6.12-rc7 ] ~ [ linux-6.11.7 ] ~ [ linux-6.10.14 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.60 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.116 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.171 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.229 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.285 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.323 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.12 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

Diff markup

Differences between /arch/xtensa/mm/mmu.c (Version linux-6.12-rc7) and /arch/alpha/mm/mmu.c (Version linux-4.16.18)


  1 // SPDX-License-Identifier: GPL-2.0                 1 
  2 /*                                                
  3  * xtensa mmu stuff                               
  4  *                                                
  5  * Extracted from init.c                          
  6  */                                               
  7 #include <linux/memblock.h>                       
  8 #include <linux/percpu.h>                         
  9 #include <linux/init.h>                           
 10 #include <linux/string.h>                         
 11 #include <linux/slab.h>                           
 12 #include <linux/cache.h>                          
 13                                                   
 14 #include <asm/tlb.h>                              
 15 #include <asm/tlbflush.h>                         
 16 #include <asm/mmu_context.h>                      
 17 #include <asm/page.h>                             
 18 #include <asm/initialize_mmu.h>                   
 19 #include <asm/io.h>                               
 20                                                   
 21 DEFINE_PER_CPU(unsigned long, asid_cache) = AS    
 22                                                   
 23 #if defined(CONFIG_HIGHMEM)                       
 24 static void * __init init_pmd(unsigned long va    
 25 {                                                 
 26         pmd_t *pmd = pmd_off_k(vaddr);            
 27         pte_t *pte;                               
 28         unsigned long i;                          
 29                                                   
 30         n_pages = ALIGN(n_pages, PTRS_PER_PTE)    
 31                                                   
 32         pr_debug("%s: vaddr: 0x%08lx, n_pages:    
 33                  __func__, vaddr, n_pages);       
 34                                                   
 35         pte = memblock_alloc_low(n_pages * siz    
 36         if (!pte)                                 
 37                 panic("%s: Failed to allocate     
 38                       __func__, n_pages * size    
 39                                                   
 40         for (i = 0; i < n_pages; ++i)             
 41                 pte_clear(NULL, 0, pte + i);      
 42                                                   
 43         for (i = 0; i < n_pages; i += PTRS_PER    
 44                 pte_t *cur_pte = pte + i;         
 45                                                   
 46                 BUG_ON(!pmd_none(*pmd));          
 47                 set_pmd(pmd, __pmd(((unsigned     
 48                 BUG_ON(cur_pte != pte_offset_k    
 49                 pr_debug("%s: pmd: 0x%p, pte:     
 50                          __func__, pmd, cur_pt    
 51         }                                         
 52         return pte;                               
 53 }                                                 
 54                                                   
 55 static void __init fixedrange_init(void)          
 56 {                                                 
 57         BUILD_BUG_ON(FIXADDR_START < TLBTEMP_B    
 58         init_pmd(FIXADDR_START, __end_of_fixed    
 59 }                                                 
 60 #endif                                            
 61                                                   
 62 void __init paging_init(void)                     
 63 {                                                 
 64 #ifdef CONFIG_HIGHMEM                             
 65         fixedrange_init();                        
 66         pkmap_page_table = init_pmd(PKMAP_BASE    
 67         kmap_init();                              
 68 #endif                                            
 69 }                                                 
 70                                                   
 71 /*                                                
 72  * Flush the mmu and reset associated register    
 73  */                                               
 74 void init_mmu(void)                               
 75 {                                                 
 76 #if !(XCHAL_HAVE_PTP_MMU && XCHAL_HAVE_SPANNIN    
 77         /*                                        
 78          * Writing zeros to the instruction an    
 79          * registers ensure that valid values     
 80          *                                        
 81          * For existing PGSZID<w> fields, zero    
 82          * of the page-size array.  For nonexi    
 83          * zero is the best value to write.  A    
 84          * fields, the corresponding TLB must     
 85          */                                       
 86         set_itlbcfg_register(0);                  
 87         set_dtlbcfg_register(0);                  
 88 #endif                                            
 89         init_kio();                               
 90         local_flush_tlb_all();                    
 91                                                   
 92         /* Set rasid register to a known value    
 93                                                   
 94         set_rasid_register(ASID_INSERT(ASID_US    
 95                                                   
 96         /* Set PTEVADDR special register to th    
 97          * table, which is in kernel mappable     
 98          * statically mapped).  This register'    
 99          * reset.                                 
100          */                                       
101         set_ptevaddr_register(XCHAL_PAGE_TABLE    
102 }                                                 
103                                                   
104 void init_kio(void)                               
105 {                                                 
106 #if XCHAL_HAVE_PTP_MMU && XCHAL_HAVE_SPANNING_    
107         /*                                        
108          * Update the IO area mapping in case     
109          */                                       
110         write_dtlb_entry(__pte(xtensa_kio_padd    
111                         XCHAL_KIO_CACHED_VADDR    
112         write_itlb_entry(__pte(xtensa_kio_padd    
113                         XCHAL_KIO_CACHED_VADDR    
114         write_dtlb_entry(__pte(xtensa_kio_padd    
115                         XCHAL_KIO_BYPASS_VADDR    
116         write_itlb_entry(__pte(xtensa_kio_padd    
117                         XCHAL_KIO_BYPASS_VADDR    
118 #endif                                            
119 }                                                 
120                                                   

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

sflogo.php