tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master head: f1fd1610cbb6655883d1838ac79e53301596685d commit: 7c2763c42326a071220077513a9cae90db46b818 nds32: use pgtable-nopmd instead of 4level-fixup date: 2 weeks ago config: nds32-randconfig-a001-20191217 (attached as .config) compiler: nds32le-linux-gcc (GCC) 9.2.0 reproduce: wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross git checkout 7c2763c42326a071220077513a9cae90db46b818 # save the attached .config to linux build tree GCC_VERSION=9.2.0 make.cross ARCH=nds32 If you fix the issue, kindly add following tag Reported-by: kbuild test robot <lkp@xxxxxxxxx> All error/warnings (new ones prefixed by >>): In file included from arch/nds32/include/asm/cacheflush.h:43, from include/linux/highmem.h:12, from arch/nds32/mm/highmem.c:5: include/asm-generic/cacheflush.h:50:20: error: static declaration of 'flush_icache_range' follows non-static declaration 50 | static inline void flush_icache_range(unsigned long start, unsigned long end) | ^~~~~~~~~~~~~~~~~~ In file included from include/linux/highmem.h:12, from arch/nds32/mm/highmem.c:5: arch/nds32/include/asm/cacheflush.h:11:6: note: previous declaration of 'flush_icache_range' was here 11 | void flush_icache_range(unsigned long start, unsigned long end); | ^~~~~~~~~~~~~~~~~~ In file included from arch/nds32/include/asm/cacheflush.h:43, from include/linux/highmem.h:12, from arch/nds32/mm/highmem.c:5: include/asm-generic/cacheflush.h:54:20: error: static declaration of 'flush_icache_page' follows non-static declaration 54 | static inline void flush_icache_page(struct vm_area_struct *vma, | ^~~~~~~~~~~~~~~~~ In file included from include/linux/highmem.h:12, from arch/nds32/mm/highmem.c:5: arch/nds32/include/asm/cacheflush.h:12:6: note: previous declaration of 'flush_icache_page' was here 12 | void flush_icache_page(struct vm_area_struct *vma, struct page *page); | ^~~~~~~~~~~~~~~~~ In file included from arch/nds32/include/asm/page.h:57, from include/linux/mm_types_task.h:16, from include/linux/mm_types.h:5, from include/linux/mmzone.h:21, from include/linux/gfp.h:6, from include/linux/xarray.h:14, from include/linux/radix-tree.h:18, from include/linux/fs.h:15, from include/linux/highmem.h:5, from arch/nds32/mm/highmem.c:5: arch/nds32/mm/highmem.c: In function 'kmap_atomic': >> arch/nds32/include/asm/pgtable.h:360:44: error: passing argument 1 of 'pmd_offset' from incompatible pointer type [-Werror=incompatible-pointer-types] 360 | #define pgd_offset(mm, address) ((mm)->pgd + pgd_index(address)) | ~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~ | | | pgd_t * {aka long unsigned int *} arch/nds32/include/asm/memory.h:33:29: note: in definition of macro '__phys_to_virt' 33 | #define __phys_to_virt(x) ((x) - PHYS_OFFSET + PAGE_OFFSET) | ^ >> arch/nds32/include/asm/pgtable.h:193:55: note: in expansion of macro '__va' 193 | #define pmd_page_kernel(pmd) ((unsigned long) __va(pmd_val(pmd) & PAGE_MASK)) | ^~~~ >> include/asm-generic/pgtable-nop4d.h:41:24: note: in expansion of macro 'pgd_val' 41 | #define p4d_val(x) (pgd_val((x).pgd)) | ^~~~~~~ >> include/asm-generic/pgtable-nopud.h:50:24: note: in expansion of macro 'p4d_val' 50 | #define pud_val(x) (p4d_val((x).p4d)) | ^~~~~~~ >> include/asm-generic/pgtable-nopmd.h:49:24: note: in expansion of macro 'pud_val' 49 | #define pmd_val(x) (pud_val((x).pud)) | ^~~~~~~ >> arch/nds32/include/asm/pgtable.h:193:60: note: in expansion of macro 'pmd_val' 193 | #define pmd_page_kernel(pmd) ((unsigned long) __va(pmd_val(pmd) & PAGE_MASK)) | ^~~~~~~ >> arch/nds32/include/asm/pgtable.h:190:56: note: in expansion of macro 'pmd_page_kernel' 190 | #define pte_offset_kernel(dir, address) ((pte_t *)pmd_page_kernel(*(dir)) + pte_index(address)) | ^~~~~~~~~~~~~~~ >> arch/nds32/mm/highmem.c:52:9: note: in expansion of macro 'pte_offset_kernel' 52 | ptep = pte_offset_kernel(pmd_off_k(vaddr), vaddr); | ^~~~~~~~~~~~~~~~~ >> arch/nds32/include/asm/pgtable.h:362:33: note: in expansion of macro 'pgd_offset' 362 | #define pgd_offset_k(addr) pgd_offset(&init_mm, addr) | ^~~~~~~~~~ >> arch/nds32/include/asm/pgtable.h:198:39: note: in expansion of macro 'pgd_offset_k' 198 | #define pmd_off_k(address) pmd_offset(pgd_offset_k(address), address) | ^~~~~~~~~~~~ >> arch/nds32/mm/highmem.c:52:27: note: in expansion of macro 'pmd_off_k' 52 | ptep = pte_offset_kernel(pmd_off_k(vaddr), vaddr); | ^~~~~~~~~ In file included from arch/nds32/include/asm/pgtable.h:7, from include/linux/mm.h:99, from include/linux/highmem.h:8, from arch/nds32/mm/highmem.c:5: include/asm-generic/pgtable-nopmd.h:44:42: note: expected 'pud_t *' {aka 'struct <anonymous> *'} but argument is of type 'pgd_t *' {aka 'long unsigned int *'} 44 | static inline pmd_t * pmd_offset(pud_t * pud, unsigned long address) | ~~~~~~~~^~~ In file included from arch/nds32/include/asm/page.h:57, from include/linux/mm_types_task.h:16, from include/linux/mm_types.h:5, from include/linux/mmzone.h:21, from include/linux/gfp.h:6, from include/linux/xarray.h:14, from include/linux/radix-tree.h:18, from include/linux/fs.h:15, from include/linux/highmem.h:5, from arch/nds32/mm/highmem.c:5: arch/nds32/mm/highmem.c: In function '__kunmap_atomic': >> arch/nds32/include/asm/pgtable.h:360:44: error: passing argument 1 of 'pmd_offset' from incompatible pointer type [-Werror=incompatible-pointer-types] 360 | #define pgd_offset(mm, address) ((mm)->pgd + pgd_index(address)) | ~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~ | | | pgd_t * {aka long unsigned int *} arch/nds32/include/asm/memory.h:33:29: note: in definition of macro '__phys_to_virt' 33 | #define __phys_to_virt(x) ((x) - PHYS_OFFSET + PAGE_OFFSET) | ^ >> arch/nds32/include/asm/pgtable.h:193:55: note: in expansion of macro '__va' 193 | #define pmd_page_kernel(pmd) ((unsigned long) __va(pmd_val(pmd) & PAGE_MASK)) | ^~~~ >> include/asm-generic/pgtable-nop4d.h:41:24: note: in expansion of macro 'pgd_val' 41 | #define p4d_val(x) (pgd_val((x).pgd)) | ^~~~~~~ >> include/asm-generic/pgtable-nopud.h:50:24: note: in expansion of macro 'p4d_val' 50 | #define pud_val(x) (p4d_val((x).p4d)) | ^~~~~~~ >> include/asm-generic/pgtable-nopmd.h:49:24: note: in expansion of macro 'pud_val' 49 | #define pmd_val(x) (pud_val((x).pud)) | ^~~~~~~ >> arch/nds32/include/asm/pgtable.h:193:60: note: in expansion of macro 'pmd_val' 193 | #define pmd_page_kernel(pmd) ((unsigned long) __va(pmd_val(pmd) & PAGE_MASK)) | ^~~~~~~ >> arch/nds32/include/asm/pgtable.h:190:56: note: in expansion of macro 'pmd_page_kernel' 190 | #define pte_offset_kernel(dir, address) ((pte_t *)pmd_page_kernel(*(dir)) + pte_index(address)) | ^~~~~~~~~~~~~~~ arch/nds32/mm/highmem.c:72:10: note: in expansion of macro 'pte_offset_kernel' 72 | ptep = pte_offset_kernel(pmd_off_k(vaddr), vaddr); | ^~~~~~~~~~~~~~~~~ >> arch/nds32/include/asm/pgtable.h:362:33: note: in expansion of macro 'pgd_offset' 362 | #define pgd_offset_k(addr) pgd_offset(&init_mm, addr) | ^~~~~~~~~~ >> arch/nds32/include/asm/pgtable.h:198:39: note: in expansion of macro 'pgd_offset_k' 198 | #define pmd_off_k(address) pmd_offset(pgd_offset_k(address), address) | ^~~~~~~~~~~~ arch/nds32/mm/highmem.c:72:28: note: in expansion of macro 'pmd_off_k' 72 | ptep = pte_offset_kernel(pmd_off_k(vaddr), vaddr); | ^~~~~~~~~ In file included from arch/nds32/include/asm/pgtable.h:7, from include/linux/mm.h:99, from include/linux/highmem.h:8, from arch/nds32/mm/highmem.c:5: include/asm-generic/pgtable-nopmd.h:44:42: note: expected 'pud_t *' {aka 'struct <anonymous> *'} but argument is of type 'pgd_t *' {aka 'long unsigned int *'} 44 | static inline pmd_t * pmd_offset(pud_t * pud, unsigned long address) | ~~~~~~~~^~~ cc1: some warnings being treated as errors vim +/pmd_offset +360 arch/nds32/include/asm/pgtable.h 2e1aecb970b766 Greentime Hu 2017-10-24 188 2e1aecb970b766 Greentime Hu 2017-10-24 189 #define pte_index(address) (((address) >> PAGE_SHIFT) & (PTRS_PER_PTE - 1)) 2e1aecb970b766 Greentime Hu 2017-10-24 @190 #define pte_offset_kernel(dir, address) ((pte_t *)pmd_page_kernel(*(dir)) + pte_index(address)) 2e1aecb970b766 Greentime Hu 2017-10-24 191 #define pte_offset_map(dir, address) ((pte_t *)page_address(pmd_page(*(dir))) + pte_index(address)) 2e1aecb970b766 Greentime Hu 2017-10-24 192 #define pte_offset_map_nested(dir, address) pte_offset_map(dir, address) 2e1aecb970b766 Greentime Hu 2017-10-24 @193 #define pmd_page_kernel(pmd) ((unsigned long) __va(pmd_val(pmd) & PAGE_MASK)) 2e1aecb970b766 Greentime Hu 2017-10-24 194 2e1aecb970b766 Greentime Hu 2017-10-24 195 #define pte_unmap(pte) do { } while (0) 2e1aecb970b766 Greentime Hu 2017-10-24 196 #define pte_unmap_nested(pte) do { } while (0) 2e1aecb970b766 Greentime Hu 2017-10-24 197 2e1aecb970b766 Greentime Hu 2017-10-24 @198 #define pmd_off_k(address) pmd_offset(pgd_offset_k(address), address) 2e1aecb970b766 Greentime Hu 2017-10-24 199 2e1aecb970b766 Greentime Hu 2017-10-24 200 #define set_pte_at(mm,addr,ptep,pteval) set_pte(ptep,pteval) 2e1aecb970b766 Greentime Hu 2017-10-24 201 /* 2e1aecb970b766 Greentime Hu 2017-10-24 202 * Set a level 1 translation table entry, and clean it out of 2e1aecb970b766 Greentime Hu 2017-10-24 203 * any caches such that the MMUs can load it correctly. 2e1aecb970b766 Greentime Hu 2017-10-24 204 */ 2e1aecb970b766 Greentime Hu 2017-10-24 205 static inline void set_pmd(pmd_t * pmdp, pmd_t pmd) 2e1aecb970b766 Greentime Hu 2017-10-24 206 { 2e1aecb970b766 Greentime Hu 2017-10-24 207 2e1aecb970b766 Greentime Hu 2017-10-24 208 *pmdp = pmd; 2e1aecb970b766 Greentime Hu 2017-10-24 209 #if !defined(CONFIG_CPU_DCACHE_DISABLE) && !defined(CONFIG_CPU_DCACHE_WRITETHROUGH) 2e1aecb970b766 Greentime Hu 2017-10-24 210 __asm__ volatile ("\n\tcctl %0, L1D_VA_WB"::"r" (pmdp):"memory"); 2e1aecb970b766 Greentime Hu 2017-10-24 211 __nds32__msync_all(); 2e1aecb970b766 Greentime Hu 2017-10-24 212 __nds32__dsb(); 2e1aecb970b766 Greentime Hu 2017-10-24 213 #endif 2e1aecb970b766 Greentime Hu 2017-10-24 214 } 2e1aecb970b766 Greentime Hu 2017-10-24 215 2e1aecb970b766 Greentime Hu 2017-10-24 216 /* 2e1aecb970b766 Greentime Hu 2017-10-24 217 * Set a PTE and flush it out 2e1aecb970b766 Greentime Hu 2017-10-24 218 */ 2e1aecb970b766 Greentime Hu 2017-10-24 219 static inline void set_pte(pte_t * ptep, pte_t pte) 2e1aecb970b766 Greentime Hu 2017-10-24 220 { 2e1aecb970b766 Greentime Hu 2017-10-24 221 2e1aecb970b766 Greentime Hu 2017-10-24 222 *ptep = pte; 2e1aecb970b766 Greentime Hu 2017-10-24 223 #if !defined(CONFIG_CPU_DCACHE_DISABLE) && !defined(CONFIG_CPU_DCACHE_WRITETHROUGH) 2e1aecb970b766 Greentime Hu 2017-10-24 224 __asm__ volatile ("\n\tcctl %0, L1D_VA_WB"::"r" (ptep):"memory"); 2e1aecb970b766 Greentime Hu 2017-10-24 225 __nds32__msync_all(); 2e1aecb970b766 Greentime Hu 2017-10-24 226 __nds32__dsb(); 2e1aecb970b766 Greentime Hu 2017-10-24 227 #endif 2e1aecb970b766 Greentime Hu 2017-10-24 228 } 2e1aecb970b766 Greentime Hu 2017-10-24 229 2e1aecb970b766 Greentime Hu 2017-10-24 230 /* 2e1aecb970b766 Greentime Hu 2017-10-24 231 * The following only work if pte_present() is true. 2e1aecb970b766 Greentime Hu 2017-10-24 232 * Undefined behaviour if not.. 2e1aecb970b766 Greentime Hu 2017-10-24 233 */ 2e1aecb970b766 Greentime Hu 2017-10-24 234 2e1aecb970b766 Greentime Hu 2017-10-24 235 /* 2e1aecb970b766 Greentime Hu 2017-10-24 236 * pte_write: this page is writeable for user mode 2e1aecb970b766 Greentime Hu 2017-10-24 237 * pte_read: this page is readable for user mode 2e1aecb970b766 Greentime Hu 2017-10-24 238 * pte_kernel_write: this page is writeable for kernel mode 2e1aecb970b766 Greentime Hu 2017-10-24 239 * 2e1aecb970b766 Greentime Hu 2017-10-24 240 * We don't have pte_kernel_read because kernel always can read. 2e1aecb970b766 Greentime Hu 2017-10-24 241 * 2e1aecb970b766 Greentime Hu 2017-10-24 242 * */ 2e1aecb970b766 Greentime Hu 2017-10-24 243 2e1aecb970b766 Greentime Hu 2017-10-24 244 #define pte_present(pte) (pte_val(pte) & _PAGE_V) 2e1aecb970b766 Greentime Hu 2017-10-24 245 #define pte_write(pte) ((pte_val(pte) & _PAGE_M_MASK) == _PAGE_M_URW_KRW) 2e1aecb970b766 Greentime Hu 2017-10-24 246 #define pte_read(pte) (((pte_val(pte) & _PAGE_M_MASK) == _PAGE_M_UR_KR) || \ 2e1aecb970b766 Greentime Hu 2017-10-24 247 ((pte_val(pte) & _PAGE_M_MASK) == _PAGE_M_UR_KRW) || \ 2e1aecb970b766 Greentime Hu 2017-10-24 248 ((pte_val(pte) & _PAGE_M_MASK) == _PAGE_M_URW_KRW)) 2e1aecb970b766 Greentime Hu 2017-10-24 249 #define pte_kernel_write(pte) (((pte_val(pte) & _PAGE_M_MASK) == _PAGE_M_URW_KRW) || \ 2e1aecb970b766 Greentime Hu 2017-10-24 250 ((pte_val(pte) & _PAGE_M_MASK) == _PAGE_M_UR_KRW) || \ 2e1aecb970b766 Greentime Hu 2017-10-24 251 ((pte_val(pte) & _PAGE_M_MASK) == _PAGE_M_KRW) || \ 2e1aecb970b766 Greentime Hu 2017-10-24 252 (((pte_val(pte) & _PAGE_M_MASK) == _PAGE_M_XKRW) && pte_exec(pte))) 2e1aecb970b766 Greentime Hu 2017-10-24 253 #define pte_exec(pte) (pte_val(pte) & _PAGE_E) 2e1aecb970b766 Greentime Hu 2017-10-24 254 #define pte_dirty(pte) (pte_val(pte) & _PAGE_D) 2e1aecb970b766 Greentime Hu 2017-10-24 255 #define pte_young(pte) (pte_val(pte) & _PAGE_YOUNG) 2e1aecb970b766 Greentime Hu 2017-10-24 256 2e1aecb970b766 Greentime Hu 2017-10-24 257 /* 2e1aecb970b766 Greentime Hu 2017-10-24 258 * The following only works if pte_present() is not true. 2e1aecb970b766 Greentime Hu 2017-10-24 259 */ 2e1aecb970b766 Greentime Hu 2017-10-24 260 #define pte_file(pte) (pte_val(pte) & _PAGE_FILE) 2e1aecb970b766 Greentime Hu 2017-10-24 261 #define pte_to_pgoff(x) (pte_val(x) >> 2) 2e1aecb970b766 Greentime Hu 2017-10-24 262 #define pgoff_to_pte(x) __pte(((x) << 2) | _PAGE_FILE) 2e1aecb970b766 Greentime Hu 2017-10-24 263 2e1aecb970b766 Greentime Hu 2017-10-24 264 #define PTE_FILE_MAX_BITS 29 2e1aecb970b766 Greentime Hu 2017-10-24 265 2e1aecb970b766 Greentime Hu 2017-10-24 266 #define PTE_BIT_FUNC(fn,op) \ 2e1aecb970b766 Greentime Hu 2017-10-24 267 static inline pte_t pte_##fn(pte_t pte) { pte_val(pte) op; return pte; } 2e1aecb970b766 Greentime Hu 2017-10-24 268 2e1aecb970b766 Greentime Hu 2017-10-24 269 static inline pte_t pte_wrprotect(pte_t pte) 2e1aecb970b766 Greentime Hu 2017-10-24 270 { 2e1aecb970b766 Greentime Hu 2017-10-24 271 pte_val(pte) = pte_val(pte) & ~_PAGE_M_MASK; 2e1aecb970b766 Greentime Hu 2017-10-24 272 pte_val(pte) = pte_val(pte) | _PAGE_M_UR_KR; 2e1aecb970b766 Greentime Hu 2017-10-24 273 return pte; 2e1aecb970b766 Greentime Hu 2017-10-24 274 } 2e1aecb970b766 Greentime Hu 2017-10-24 275 2e1aecb970b766 Greentime Hu 2017-10-24 276 static inline pte_t pte_mkwrite(pte_t pte) 2e1aecb970b766 Greentime Hu 2017-10-24 277 { 2e1aecb970b766 Greentime Hu 2017-10-24 278 pte_val(pte) = pte_val(pte) & ~_PAGE_M_MASK; 2e1aecb970b766 Greentime Hu 2017-10-24 279 pte_val(pte) = pte_val(pte) | _PAGE_M_URW_KRW; 2e1aecb970b766 Greentime Hu 2017-10-24 280 return pte; 2e1aecb970b766 Greentime Hu 2017-10-24 281 } 2e1aecb970b766 Greentime Hu 2017-10-24 282 2e1aecb970b766 Greentime Hu 2017-10-24 283 PTE_BIT_FUNC(exprotect, &=~_PAGE_E); 2e1aecb970b766 Greentime Hu 2017-10-24 284 PTE_BIT_FUNC(mkexec, |=_PAGE_E); 2e1aecb970b766 Greentime Hu 2017-10-24 285 PTE_BIT_FUNC(mkclean, &=~_PAGE_D); 2e1aecb970b766 Greentime Hu 2017-10-24 286 PTE_BIT_FUNC(mkdirty, |=_PAGE_D); 2e1aecb970b766 Greentime Hu 2017-10-24 287 PTE_BIT_FUNC(mkold, &=~_PAGE_YOUNG); 2e1aecb970b766 Greentime Hu 2017-10-24 288 PTE_BIT_FUNC(mkyoung, |=_PAGE_YOUNG); 2e1aecb970b766 Greentime Hu 2017-10-24 289 static inline int pte_special(pte_t pte) 2e1aecb970b766 Greentime Hu 2017-10-24 290 { 2e1aecb970b766 Greentime Hu 2017-10-24 291 return 0; 2e1aecb970b766 Greentime Hu 2017-10-24 292 } 2e1aecb970b766 Greentime Hu 2017-10-24 293 2e1aecb970b766 Greentime Hu 2017-10-24 294 static inline pte_t pte_mkspecial(pte_t pte) 2e1aecb970b766 Greentime Hu 2017-10-24 295 { 2e1aecb970b766 Greentime Hu 2017-10-24 296 return pte; 2e1aecb970b766 Greentime Hu 2017-10-24 297 } 2e1aecb970b766 Greentime Hu 2017-10-24 298 2e1aecb970b766 Greentime Hu 2017-10-24 299 /* 2e1aecb970b766 Greentime Hu 2017-10-24 300 * Mark the prot value as uncacheable and unbufferable. 2e1aecb970b766 Greentime Hu 2017-10-24 301 */ 2e1aecb970b766 Greentime Hu 2017-10-24 302 #define pgprot_noncached(prot) __pgprot((pgprot_val(prot)&~_PAGE_C_MASK) | _PAGE_C_DEV) 2e1aecb970b766 Greentime Hu 2017-10-24 303 #define pgprot_writecombine(prot) __pgprot((pgprot_val(prot)&~_PAGE_C_MASK) | _PAGE_C_DEV_WB) 2e1aecb970b766 Greentime Hu 2017-10-24 304 2e1aecb970b766 Greentime Hu 2017-10-24 305 #define pmd_none(pmd) (pmd_val(pmd)&0x1) 2e1aecb970b766 Greentime Hu 2017-10-24 306 #define pmd_present(pmd) (!pmd_none(pmd)) 2e1aecb970b766 Greentime Hu 2017-10-24 307 #define pmd_bad(pmd) pmd_none(pmd) 2e1aecb970b766 Greentime Hu 2017-10-24 308 2e1aecb970b766 Greentime Hu 2017-10-24 309 #define copy_pmd(pmdpd,pmdps) set_pmd((pmdpd), *(pmdps)) 2e1aecb970b766 Greentime Hu 2017-10-24 310 #define pmd_clear(pmdp) set_pmd((pmdp), __pmd(1)) 2e1aecb970b766 Greentime Hu 2017-10-24 311 2e1aecb970b766 Greentime Hu 2017-10-24 312 static inline pmd_t __mk_pmd(pte_t * ptep, unsigned long prot) 2e1aecb970b766 Greentime Hu 2017-10-24 313 { 2e1aecb970b766 Greentime Hu 2017-10-24 314 unsigned long ptr = (unsigned long)ptep; 2e1aecb970b766 Greentime Hu 2017-10-24 315 pmd_t pmd; 2e1aecb970b766 Greentime Hu 2017-10-24 316 2e1aecb970b766 Greentime Hu 2017-10-24 317 /* 2e1aecb970b766 Greentime Hu 2017-10-24 318 * The pmd must be loaded with the physical 2e1aecb970b766 Greentime Hu 2017-10-24 319 * address of the PTE table 2e1aecb970b766 Greentime Hu 2017-10-24 320 */ 2e1aecb970b766 Greentime Hu 2017-10-24 321 2e1aecb970b766 Greentime Hu 2017-10-24 322 pmd_val(pmd) = __virt_to_phys(ptr) | prot; 2e1aecb970b766 Greentime Hu 2017-10-24 323 return pmd; 2e1aecb970b766 Greentime Hu 2017-10-24 324 } 2e1aecb970b766 Greentime Hu 2017-10-24 325 2e1aecb970b766 Greentime Hu 2017-10-24 326 #define pmd_page(pmd) virt_to_page(__va(pmd_val(pmd))) 2e1aecb970b766 Greentime Hu 2017-10-24 327 2e1aecb970b766 Greentime Hu 2017-10-24 328 /* 2e1aecb970b766 Greentime Hu 2017-10-24 329 * Permanent address of a page. We never have highmem, so this is trivial. 2e1aecb970b766 Greentime Hu 2017-10-24 330 */ 2e1aecb970b766 Greentime Hu 2017-10-24 331 #define pages_to_mb(x) ((x) >> (20 - PAGE_SHIFT)) 2e1aecb970b766 Greentime Hu 2017-10-24 332 2e1aecb970b766 Greentime Hu 2017-10-24 333 /* 2e1aecb970b766 Greentime Hu 2017-10-24 334 * Conversion functions: convert a page and protection to a page entry, 2e1aecb970b766 Greentime Hu 2017-10-24 335 * and a page entry and page directory to the page they refer to. 2e1aecb970b766 Greentime Hu 2017-10-24 336 */ 2e1aecb970b766 Greentime Hu 2017-10-24 337 #define mk_pte(page,prot) pfn_pte(page_to_pfn(page),prot) 2e1aecb970b766 Greentime Hu 2017-10-24 338 2e1aecb970b766 Greentime Hu 2017-10-24 339 /* 2e1aecb970b766 Greentime Hu 2017-10-24 340 * The "pgd_xxx()" functions here are trivial for a folded two-level 2e1aecb970b766 Greentime Hu 2017-10-24 341 * setup: the pgd is never bad, and a pmd always exists (as it's folded 2e1aecb970b766 Greentime Hu 2017-10-24 342 * into the pgd entry) 2e1aecb970b766 Greentime Hu 2017-10-24 343 */ 2e1aecb970b766 Greentime Hu 2017-10-24 344 #define pgd_none(pgd) (0) 2e1aecb970b766 Greentime Hu 2017-10-24 345 #define pgd_bad(pgd) (0) 2e1aecb970b766 Greentime Hu 2017-10-24 346 #define pgd_present(pgd) (1) 2e1aecb970b766 Greentime Hu 2017-10-24 347 #define pgd_clear(pgdp) do { } while (0) 2e1aecb970b766 Greentime Hu 2017-10-24 348 2e1aecb970b766 Greentime Hu 2017-10-24 349 #define page_pte_prot(page,prot) mk_pte(page, prot) 2e1aecb970b766 Greentime Hu 2017-10-24 350 #define page_pte(page) mk_pte(page, __pgprot(0)) 2e1aecb970b766 Greentime Hu 2017-10-24 351 /* 2e1aecb970b766 Greentime Hu 2017-10-24 352 * L1PTE = $mr1 + ((virt >> PMD_SHIFT) << 2); 2e1aecb970b766 Greentime Hu 2017-10-24 353 * L2PTE = (((virt >> PAGE_SHIFT) & (PTRS_PER_PTE -1 )) << 2); 2e1aecb970b766 Greentime Hu 2017-10-24 354 * PPN = (phys & 0xfffff000); 2e1aecb970b766 Greentime Hu 2017-10-24 355 * 2e1aecb970b766 Greentime Hu 2017-10-24 356 */ 2e1aecb970b766 Greentime Hu 2017-10-24 357 2e1aecb970b766 Greentime Hu 2017-10-24 358 /* to find an entry in a page-table-directory */ 2e1aecb970b766 Greentime Hu 2017-10-24 359 #define pgd_index(address) (((address) >> PGDIR_SHIFT) & (PTRS_PER_PGD - 1)) 2e1aecb970b766 Greentime Hu 2017-10-24 @360 #define pgd_offset(mm, address) ((mm)->pgd + pgd_index(address)) 2e1aecb970b766 Greentime Hu 2017-10-24 361 /* to find an entry in a kernel page-table-directory */ 2e1aecb970b766 Greentime Hu 2017-10-24 @362 #define pgd_offset_k(addr) pgd_offset(&init_mm, addr) 2e1aecb970b766 Greentime Hu 2017-10-24 363 :::::: The code at line 360 was first introduced by commit :::::: 2e1aecb970b7662cf3d53d2d18a54c17f1eb55b8 nds32: MMU definitions :::::: TO: Greentime Hu <greentime@xxxxxxxxxxxxx> :::::: CC: Greentime Hu <greentime@xxxxxxxxxxxxx> --- 0-DAY kernel test infrastructure Open Source Technology Center https://lists.01.org/hyperkitty/list/kbuild-all@xxxxxxxxxxxx Intel Corporation
Attachment:
.config.gz
Description: application/gzip