diff options
| author | Ard Biesheuvel <ard.biesheuvel@linaro.org> | 2016-07-22 13:32:25 -0400 |
|---|---|---|
| committer | Catalin Marinas <catalin.marinas@arm.com> | 2016-07-25 12:43:36 -0400 |
| commit | 1378dc3d4ba07ccd295b04ef59e943162531ad25 (patch) | |
| tree | 1402ecdd8b25915aad4a252845d84b1dc75eed66 | |
| parent | 258a1605c78878ada00417de4840c4c427673ffa (diff) | |
arm64: mm: run pgtable_page_ctor() on non-swapper translation table pages
The kernel page table creation routines are accessible to other subsystems
(e.g., EFI) via the create_pgd_mapping() entry point, which allows mappings
to be created that are not covered by init_mm.
Since generic code such as apply_to_page_range() may expect translation
table pages that are not associated with init_mm to be covered by fully
constructed struct pages, add a call to pgtable_page_ctor() in the alloc
function used by create_pgd_mapping. Since it is no longer used by
create_mapping_late(), also update the name of this function to better
reflect its purpose.
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Laura Abbott <labbott@redhat.com>
Tested-by: Sudeep Holla <sudeep.holla@arm.com>
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
| -rw-r--r-- | arch/arm64/mm/mmu.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/arch/arm64/mm/mmu.c b/arch/arm64/mm/mmu.c index 33f36cede02d..51a558195bb9 100644 --- a/arch/arm64/mm/mmu.c +++ b/arch/arm64/mm/mmu.c | |||
| @@ -268,10 +268,11 @@ static void __create_pgd_mapping(pgd_t *pgdir, phys_addr_t phys, | |||
| 268 | } while (pgd++, addr = next, addr != end); | 268 | } while (pgd++, addr = next, addr != end); |
| 269 | } | 269 | } |
| 270 | 270 | ||
| 271 | static phys_addr_t late_pgtable_alloc(void) | 271 | static phys_addr_t pgd_pgtable_alloc(void) |
| 272 | { | 272 | { |
| 273 | void *ptr = (void *)__get_free_page(PGALLOC_GFP); | 273 | void *ptr = (void *)__get_free_page(PGALLOC_GFP); |
| 274 | BUG_ON(!ptr); | 274 | if (!ptr || !pgtable_page_ctor(virt_to_page(ptr))) |
| 275 | BUG(); | ||
| 275 | 276 | ||
| 276 | /* Ensure the zeroed page is visible to the page table walker */ | 277 | /* Ensure the zeroed page is visible to the page table walker */ |
| 277 | dsb(ishst); | 278 | dsb(ishst); |
| @@ -298,8 +299,10 @@ void __init create_pgd_mapping(struct mm_struct *mm, phys_addr_t phys, | |||
| 298 | unsigned long virt, phys_addr_t size, | 299 | unsigned long virt, phys_addr_t size, |
| 299 | pgprot_t prot, bool allow_block_mappings) | 300 | pgprot_t prot, bool allow_block_mappings) |
| 300 | { | 301 | { |
| 302 | BUG_ON(mm == &init_mm); | ||
| 303 | |||
| 301 | __create_pgd_mapping(mm->pgd, phys, virt, size, prot, | 304 | __create_pgd_mapping(mm->pgd, phys, virt, size, prot, |
| 302 | late_pgtable_alloc, allow_block_mappings); | 305 | pgd_pgtable_alloc, allow_block_mappings); |
| 303 | } | 306 | } |
| 304 | 307 | ||
| 305 | static void create_mapping_late(phys_addr_t phys, unsigned long virt, | 308 | static void create_mapping_late(phys_addr_t phys, unsigned long virt, |
