diff options
-rw-r--r-- | arch/arm64/mm/dump.c | 18 | ||||
-rw-r--r-- | arch/arm64/mm/mmu.c | 6 |
2 files changed, 16 insertions, 8 deletions
diff --git a/arch/arm64/mm/dump.c b/arch/arm64/mm/dump.c index bbc5a29ecaaf..612965375473 100644 --- a/arch/arm64/mm/dump.c +++ b/arch/arm64/mm/dump.c | |||
@@ -249,10 +249,12 @@ static void walk_pmd(struct pg_state *st, pud_t *pud, unsigned long start) | |||
249 | 249 | ||
250 | for (i = 0; i < PTRS_PER_PMD; i++, pmd++) { | 250 | for (i = 0; i < PTRS_PER_PMD; i++, pmd++) { |
251 | addr = start + i * PMD_SIZE; | 251 | addr = start + i * PMD_SIZE; |
252 | if (pmd_none(*pmd) || pmd_sect(*pmd) || pmd_bad(*pmd)) | 252 | if (pmd_none(*pmd) || pmd_sect(*pmd)) { |
253 | note_page(st, addr, 3, pmd_val(*pmd)); | 253 | note_page(st, addr, 3, pmd_val(*pmd)); |
254 | else | 254 | } else { |
255 | BUG_ON(pmd_bad(*pmd)); | ||
255 | walk_pte(st, pmd, addr); | 256 | walk_pte(st, pmd, addr); |
257 | } | ||
256 | } | 258 | } |
257 | } | 259 | } |
258 | 260 | ||
@@ -264,10 +266,12 @@ static void walk_pud(struct pg_state *st, pgd_t *pgd, unsigned long start) | |||
264 | 266 | ||
265 | for (i = 0; i < PTRS_PER_PUD; i++, pud++) { | 267 | for (i = 0; i < PTRS_PER_PUD; i++, pud++) { |
266 | addr = start + i * PUD_SIZE; | 268 | addr = start + i * PUD_SIZE; |
267 | if (pud_none(*pud) || pud_sect(*pud) || pud_bad(*pud)) | 269 | if (pud_none(*pud) || pud_sect(*pud)) { |
268 | note_page(st, addr, 2, pud_val(*pud)); | 270 | note_page(st, addr, 2, pud_val(*pud)); |
269 | else | 271 | } else { |
272 | BUG_ON(pud_bad(*pud)); | ||
270 | walk_pmd(st, pud, addr); | 273 | walk_pmd(st, pud, addr); |
274 | } | ||
271 | } | 275 | } |
272 | } | 276 | } |
273 | 277 | ||
@@ -279,10 +283,12 @@ static void walk_pgd(struct pg_state *st, struct mm_struct *mm, unsigned long st | |||
279 | 283 | ||
280 | for (i = 0; i < PTRS_PER_PGD; i++, pgd++) { | 284 | for (i = 0; i < PTRS_PER_PGD; i++, pgd++) { |
281 | addr = start + i * PGDIR_SIZE; | 285 | addr = start + i * PGDIR_SIZE; |
282 | if (pgd_none(*pgd) || pgd_bad(*pgd)) | 286 | if (pgd_none(*pgd)) { |
283 | note_page(st, addr, 1, pgd_val(*pgd)); | 287 | note_page(st, addr, 1, pgd_val(*pgd)); |
284 | else | 288 | } else { |
289 | BUG_ON(pgd_bad(*pgd)); | ||
285 | walk_pud(st, pgd, addr); | 290 | walk_pud(st, pgd, addr); |
291 | } | ||
286 | } | 292 | } |
287 | } | 293 | } |
288 | 294 | ||
diff --git a/arch/arm64/mm/mmu.c b/arch/arm64/mm/mmu.c index a421f535d351..2eeac10aa0cf 100644 --- a/arch/arm64/mm/mmu.c +++ b/arch/arm64/mm/mmu.c | |||
@@ -90,13 +90,14 @@ static void alloc_init_pte(pmd_t *pmd, unsigned long addr, | |||
90 | { | 90 | { |
91 | pte_t *pte; | 91 | pte_t *pte; |
92 | 92 | ||
93 | if (pmd_none(*pmd) || pmd_bad(*pmd)) { | 93 | if (pmd_none(*pmd) || pmd_sect(*pmd)) { |
94 | pte = alloc(PTRS_PER_PTE * sizeof(pte_t)); | 94 | pte = alloc(PTRS_PER_PTE * sizeof(pte_t)); |
95 | if (pmd_sect(*pmd)) | 95 | if (pmd_sect(*pmd)) |
96 | split_pmd(pmd, pte); | 96 | split_pmd(pmd, pte); |
97 | __pmd_populate(pmd, __pa(pte), PMD_TYPE_TABLE); | 97 | __pmd_populate(pmd, __pa(pte), PMD_TYPE_TABLE); |
98 | flush_tlb_all(); | 98 | flush_tlb_all(); |
99 | } | 99 | } |
100 | BUG_ON(pmd_bad(*pmd)); | ||
100 | 101 | ||
101 | pte = pte_offset_kernel(pmd, addr); | 102 | pte = pte_offset_kernel(pmd, addr); |
102 | do { | 103 | do { |
@@ -128,7 +129,7 @@ static void alloc_init_pmd(struct mm_struct *mm, pud_t *pud, | |||
128 | /* | 129 | /* |
129 | * Check for initial section mappings in the pgd/pud and remove them. | 130 | * Check for initial section mappings in the pgd/pud and remove them. |
130 | */ | 131 | */ |
131 | if (pud_none(*pud) || pud_bad(*pud)) { | 132 | if (pud_none(*pud) || pud_sect(*pud)) { |
132 | pmd = alloc(PTRS_PER_PMD * sizeof(pmd_t)); | 133 | pmd = alloc(PTRS_PER_PMD * sizeof(pmd_t)); |
133 | if (pud_sect(*pud)) { | 134 | if (pud_sect(*pud)) { |
134 | /* | 135 | /* |
@@ -140,6 +141,7 @@ static void alloc_init_pmd(struct mm_struct *mm, pud_t *pud, | |||
140 | pud_populate(mm, pud, pmd); | 141 | pud_populate(mm, pud, pmd); |
141 | flush_tlb_all(); | 142 | flush_tlb_all(); |
142 | } | 143 | } |
144 | BUG_ON(pud_bad(*pud)); | ||
143 | 145 | ||
144 | pmd = pmd_offset(pud, addr); | 146 | pmd = pmd_offset(pud, addr); |
145 | do { | 147 | do { |