Commit bdf042486a01aefaf29d74be1b4526daa70a5f0f
1 parent
e00d349e77
Exists in
master
and in
20 other branches
[PATCH] ARM: Factor out common pmd_populate functionality
Both pmd_populate variants set two pmd entries before ensuring that they are flushed from the cache. Separate this functionality into __pmd_populate(). Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Showing 1 changed file with 9 additions and 15 deletions Side-by-side Diff
include/asm-arm/pgalloc.h
... | ... | @@ -89,6 +89,13 @@ |
89 | 89 | __free_page(pte); |
90 | 90 | } |
91 | 91 | |
92 | +static inline void __pmd_populate(pmd_t *pmdp, unsigned long pmdval) | |
93 | +{ | |
94 | + pmdp[0] = __pmd(pmdval); | |
95 | + pmdp[1] = __pmd(pmdval + 256 * sizeof(pte_t)); | |
96 | + flush_pmd_entry(pmdp); | |
97 | +} | |
98 | + | |
92 | 99 | /* |
93 | 100 | * Populate the pmdp entry with a pointer to the pte. This pmd is part |
94 | 101 | * of the mm address space. |
95 | 102 | |
96 | 103 | |
97 | 104 | |
... | ... | @@ -99,32 +106,19 @@ |
99 | 106 | pmd_populate_kernel(struct mm_struct *mm, pmd_t *pmdp, pte_t *ptep) |
100 | 107 | { |
101 | 108 | unsigned long pte_ptr = (unsigned long)ptep; |
102 | - unsigned long pmdval; | |
103 | 109 | |
104 | - BUG_ON(mm != &init_mm); | |
105 | - | |
106 | 110 | /* |
107 | 111 | * The pmd must be loaded with the physical |
108 | 112 | * address of the PTE table |
109 | 113 | */ |
110 | 114 | pte_ptr -= PTRS_PER_PTE * sizeof(void *); |
111 | - pmdval = __pa(pte_ptr) | _PAGE_KERNEL_TABLE; | |
112 | - pmdp[0] = __pmd(pmdval); | |
113 | - pmdp[1] = __pmd(pmdval + 256 * sizeof(pte_t)); | |
114 | - flush_pmd_entry(pmdp); | |
115 | + __pmd_populate(pmdp, __pa(pte_ptr) | _PAGE_KERNEL_TABLE); | |
115 | 116 | } |
116 | 117 | |
117 | 118 | static inline void |
118 | 119 | pmd_populate(struct mm_struct *mm, pmd_t *pmdp, struct page *ptep) |
119 | 120 | { |
120 | - unsigned long pmdval; | |
121 | - | |
122 | - BUG_ON(mm == &init_mm); | |
123 | - | |
124 | - pmdval = page_to_pfn(ptep) << PAGE_SHIFT | _PAGE_USER_TABLE; | |
125 | - pmdp[0] = __pmd(pmdval); | |
126 | - pmdp[1] = __pmd(pmdval + 256 * sizeof(pte_t)); | |
127 | - flush_pmd_entry(pmdp); | |
121 | + __pmd_populate(pmdp, page_to_pfn(ptep) << PAGE_SHIFT | _PAGE_USER_TABLE); | |
128 | 122 | } |
129 | 123 | |
130 | 124 | #endif |