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)  * Based on arch/arm/include/asm/pgalloc.h
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  4)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  5)  * Copyright (C) 2000-2001 Russell King
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  6)  * Copyright (C) 2012 ARM Ltd.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  7)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  8) #ifndef __ASM_PGALLOC_H
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  9) #define __ASM_PGALLOC_H
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11) #include <asm/pgtable-hwdef.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12) #include <asm/processor.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13) #include <asm/cacheflush.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14) #include <asm/tlbflush.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16) #define __HAVE_ARCH_PGD_FREE
^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) #define PGD_SIZE	(PTRS_PER_PGD * sizeof(pgd_t))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) #if CONFIG_PGTABLE_LEVELS > 2
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23) static inline void __pud_populate(pud_t *pudp, phys_addr_t pmdp, pudval_t prot)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25) 	set_pud(pudp, __pud(__phys_to_pud_val(pmdp) | prot));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28) static inline void pud_populate(struct mm_struct *mm, pud_t *pudp, pmd_t *pmdp)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30) 	__pud_populate(pudp, __pa(pmdp), PMD_TYPE_TABLE);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) #else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33) static inline void __pud_populate(pud_t *pudp, phys_addr_t pmdp, pudval_t prot)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35) 	BUILD_BUG();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37) #endif	/* CONFIG_PGTABLE_LEVELS > 2 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39) #if CONFIG_PGTABLE_LEVELS > 3
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41) static inline void __p4d_populate(p4d_t *p4dp, phys_addr_t pudp, p4dval_t prot)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43) 	set_p4d(p4dp, __p4d(__phys_to_p4d_val(pudp) | prot));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46) static inline void p4d_populate(struct mm_struct *mm, p4d_t *p4dp, pud_t *pudp)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48) 	__p4d_populate(p4dp, __pa(pudp), PUD_TYPE_TABLE);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 50) #else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 51) static inline void __p4d_populate(p4d_t *p4dp, phys_addr_t pudp, p4dval_t prot)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 52) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 53) 	BUILD_BUG();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 54) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 55) #endif	/* CONFIG_PGTABLE_LEVELS > 3 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 56) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 57) extern pgd_t *pgd_alloc(struct mm_struct *mm);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 58) extern void pgd_free(struct mm_struct *mm, pgd_t *pgdp);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 59) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 60) static inline void __pmd_populate(pmd_t *pmdp, phys_addr_t ptep,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 61) 				  pmdval_t prot)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 62) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 63) 	set_pmd(pmdp, __pmd(__phys_to_pmd_val(ptep) | prot));
^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) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 67)  * Populate the pmdp entry with a pointer to the pte.  This pmd is part
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 68)  * of the mm address space.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 69)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 70) static inline void
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 71) pmd_populate_kernel(struct mm_struct *mm, pmd_t *pmdp, pte_t *ptep)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 72) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 73) 	/*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 74) 	 * The pmd must be loaded with the physical address of the PTE table
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 75) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 76) 	__pmd_populate(pmdp, __pa(ptep), PMD_TYPE_TABLE);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 77) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 78) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 79) static inline void
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 80) pmd_populate(struct mm_struct *mm, pmd_t *pmdp, pgtable_t ptep)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 81) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 82) 	__pmd_populate(pmdp, page_to_phys(ptep), PMD_TYPE_TABLE);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 83) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 84) #define pmd_pgtable(pmd) pmd_page(pmd)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 85) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 86) #endif