aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm64
diff options
context:
space:
mode:
authorArd Biesheuvel <ard.biesheuvel@linaro.org>2014-10-20 08:02:15 -0400
committerArd Biesheuvel <ard.biesheuvel@linaro.org>2015-01-12 03:16:42 -0500
commite1e1fddae74b72d0415965821ad00fe39aac6f13 (patch)
tree535189d0e1fbc13bf6cbb4e84a7e8b9e7ac1fe12 /arch/arm64
parenteaa27f34e91a14cdceed26ed6c6793ec1d186115 (diff)
arm64/mm: add explicit struct_mm argument to __create_mapping()
Currently, swapper_pg_dir and idmap_pg_dir share the init_mm mm_struct instance. To allow the introduction of other pg_dir instances, for instance, for UEFI's mapping of Runtime Services, make the struct_mm instance an explicit argument that gets passed down to the pmd and pte instantiation functions. Note that the consumers (pmd_populate/pgd_populate) of the mm_struct argument don't actually inspect it, but let's fix it for correctness' sake. Acked-by: Steve Capper <steve.capper@linaro.org> Tested-by: Leif Lindholm <leif.lindholm@linaro.org> Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Diffstat (limited to 'arch/arm64')
-rw-r--r--arch/arm64/mm/mmu.c31
1 files changed, 16 insertions, 15 deletions
diff --git a/arch/arm64/mm/mmu.c b/arch/arm64/mm/mmu.c
index 6032f3e3056a..7d5dfe2d3de0 100644
--- a/arch/arm64/mm/mmu.c
+++ b/arch/arm64/mm/mmu.c
@@ -156,9 +156,9 @@ static void __init alloc_init_pte(pmd_t *pmd, unsigned long addr,
156 } while (pte++, addr += PAGE_SIZE, addr != end); 156 } while (pte++, addr += PAGE_SIZE, addr != end);
157} 157}
158 158
159static void __init alloc_init_pmd(pud_t *pud, unsigned long addr, 159static void __init alloc_init_pmd(struct mm_struct *mm, pud_t *pud,
160 unsigned long end, phys_addr_t phys, 160 unsigned long addr, unsigned long end,
161 int map_io) 161 phys_addr_t phys, int map_io)
162{ 162{
163 pmd_t *pmd; 163 pmd_t *pmd;
164 unsigned long next; 164 unsigned long next;
@@ -178,7 +178,7 @@ static void __init alloc_init_pmd(pud_t *pud, unsigned long addr,
178 */ 178 */
179 if (pud_none(*pud) || pud_bad(*pud)) { 179 if (pud_none(*pud) || pud_bad(*pud)) {
180 pmd = early_alloc(PTRS_PER_PMD * sizeof(pmd_t)); 180 pmd = early_alloc(PTRS_PER_PMD * sizeof(pmd_t));
181 pud_populate(&init_mm, pud, pmd); 181 pud_populate(mm, pud, pmd);
182 } 182 }
183 183
184 pmd = pmd_offset(pud, addr); 184 pmd = pmd_offset(pud, addr);
@@ -202,16 +202,16 @@ static void __init alloc_init_pmd(pud_t *pud, unsigned long addr,
202 } while (pmd++, addr = next, addr != end); 202 } while (pmd++, addr = next, addr != end);
203} 203}
204 204
205static void __init alloc_init_pud(pgd_t *pgd, unsigned long addr, 205static void __init alloc_init_pud(struct mm_struct *mm, pgd_t *pgd,
206 unsigned long end, phys_addr_t phys, 206 unsigned long addr, unsigned long end,
207 int map_io) 207 phys_addr_t phys, int map_io)
208{ 208{
209 pud_t *pud; 209 pud_t *pud;
210 unsigned long next; 210 unsigned long next;
211 211
212 if (pgd_none(*pgd)) { 212 if (pgd_none(*pgd)) {
213 pud = early_alloc(PTRS_PER_PUD * sizeof(pud_t)); 213 pud = early_alloc(PTRS_PER_PUD * sizeof(pud_t));
214 pgd_populate(&init_mm, pgd, pud); 214 pgd_populate(mm, pgd, pud);
215 } 215 }
216 BUG_ON(pgd_bad(*pgd)); 216 BUG_ON(pgd_bad(*pgd));
217 217
@@ -240,7 +240,7 @@ static void __init alloc_init_pud(pgd_t *pgd, unsigned long addr,
240 flush_tlb_all(); 240 flush_tlb_all();
241 } 241 }
242 } else { 242 } else {
243 alloc_init_pmd(pud, addr, next, phys, map_io); 243 alloc_init_pmd(mm, pud, addr, next, phys, map_io);
244 } 244 }
245 phys += next - addr; 245 phys += next - addr;
246 } while (pud++, addr = next, addr != end); 246 } while (pud++, addr = next, addr != end);
@@ -250,9 +250,9 @@ static void __init alloc_init_pud(pgd_t *pgd, unsigned long addr,
250 * Create the page directory entries and any necessary page tables for the 250 * Create the page directory entries and any necessary page tables for the
251 * mapping specified by 'md'. 251 * mapping specified by 'md'.
252 */ 252 */
253static void __init __create_mapping(pgd_t *pgd, phys_addr_t phys, 253static void __init __create_mapping(struct mm_struct *mm, pgd_t *pgd,
254 unsigned long virt, phys_addr_t size, 254 phys_addr_t phys, unsigned long virt,
255 int map_io) 255 phys_addr_t size, int map_io)
256{ 256{
257 unsigned long addr, length, end, next; 257 unsigned long addr, length, end, next;
258 258
@@ -262,7 +262,7 @@ static void __init __create_mapping(pgd_t *pgd, phys_addr_t phys,
262 end = addr + length; 262 end = addr + length;
263 do { 263 do {
264 next = pgd_addr_end(addr, end); 264 next = pgd_addr_end(addr, end);
265 alloc_init_pud(pgd, addr, next, phys, map_io); 265 alloc_init_pud(mm, pgd, addr, next, phys, map_io);
266 phys += next - addr; 266 phys += next - addr;
267 } while (pgd++, addr = next, addr != end); 267 } while (pgd++, addr = next, addr != end);
268} 268}
@@ -275,7 +275,8 @@ static void __init create_mapping(phys_addr_t phys, unsigned long virt,
275 &phys, virt); 275 &phys, virt);
276 return; 276 return;
277 } 277 }
278 __create_mapping(pgd_offset_k(virt & PAGE_MASK), phys, virt, size, 0); 278 __create_mapping(&init_mm, pgd_offset_k(virt & PAGE_MASK), phys, virt,
279 size, 0);
279} 280}
280 281
281void __init create_id_mapping(phys_addr_t addr, phys_addr_t size, int map_io) 282void __init create_id_mapping(phys_addr_t addr, phys_addr_t size, int map_io)
@@ -284,7 +285,7 @@ void __init create_id_mapping(phys_addr_t addr, phys_addr_t size, int map_io)
284 pr_warn("BUG: not creating id mapping for %pa\n", &addr); 285 pr_warn("BUG: not creating id mapping for %pa\n", &addr);
285 return; 286 return;
286 } 287 }
287 __create_mapping(&idmap_pg_dir[pgd_index(addr)], 288 __create_mapping(&init_mm, &idmap_pg_dir[pgd_index(addr)],
288 addr, addr, size, map_io); 289 addr, addr, size, map_io);
289} 290}
290 291