Orange Pi5 kernel

Deprecated Linux kernel 5.10.110 for OrangePi 5/5B/5+ boards

3 Commits   0 Branches   0 Tags   |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  1) /* SPDX-License-Identifier: GPL-2.0-only */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  2) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  3)  * include/asm-xtensa/pgalloc.h
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  4)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  5)  * Copyright (C) 2001-2007 Tensilica Inc.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  6)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  7) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  8) #ifndef _XTENSA_PGALLOC_H
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  9) #define _XTENSA_PGALLOC_H
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11) #ifdef CONFIG_MMU
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12) #include <linux/highmem.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13) #include <linux/slab.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15) #define __HAVE_ARCH_PTE_ALLOC_ONE_KERNEL
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16) #define __HAVE_ARCH_PTE_ALLOC_ONE
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17) #include <asm-generic/pgalloc.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20)  * Allocating and freeing a pmd is trivial: the 1-entry pmd is
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21)  * inside the pgd, so has no extra memory associated with it.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) #define pmd_populate_kernel(mm, pmdp, ptep)				     \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25) 	(pmd_val(*(pmdp)) = ((unsigned long)ptep))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26) #define pmd_populate(mm, pmdp, page)					     \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) 	(pmd_val(*(pmdp)) = ((unsigned long)page_to_virt(page)))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28) #define pmd_pgtable(pmd) pmd_page(pmd)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30) static inline pgd_t*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31) pgd_alloc(struct mm_struct *mm)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33) 	return (pgd_t*) __get_free_pages(GFP_KERNEL | __GFP_ZERO, PGD_ORDER);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36) static inline void ptes_clear(pte_t *ptep)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38) 	int i;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40) 	for (i = 0; i < PTRS_PER_PTE; i++)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41) 		pte_clear(NULL, 0, ptep + i);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44) static inline pte_t *pte_alloc_one_kernel(struct mm_struct *mm)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46) 	pte_t *ptep;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48) 	ptep = (pte_t *)__pte_alloc_one_kernel(mm);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49) 	if (!ptep)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 50) 		return NULL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 51) 	ptes_clear(ptep);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 52) 	return ptep;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 53) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 54) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 55) static inline pgtable_t pte_alloc_one(struct mm_struct *mm)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 56) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 57) 	struct page *page;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 58) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 59) 	page = __pte_alloc_one(mm, GFP_PGTABLE_USER);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 60) 	if (!page)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 61) 		return NULL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 62) 	ptes_clear(page_address(page));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 63) 	return page;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 64) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 65) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 66) #define pmd_pgtable(pmd) pmd_page(pmd)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 67) #endif /* CONFIG_MMU */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 68) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 69) #endif /* _XTENSA_PGALLOC_H */