diff options
author | Ard Biesheuvel <ard.biesheuvel@linaro.org> | 2015-04-29 04:04:17 -0400 |
---|---|---|
committer | ard <ard.biesheuvel@linaro.org> | 2015-12-13 13:18:29 -0500 |
commit | c7936206b9715d7a3075b53789c1fed0cab9147f (patch) | |
tree | 218df320e43208e5c8ddf7962b965b4c95f6469e | |
parent | b430e55b2318ca4523b0e39ff6c0d5a2109159b4 (diff) |
ARM: implement create_mapping_late() for EFI use
This implements create_mapping_late(), which we will use to populate
the UEFI Runtime Services page tables.
Tested-by: Ryan Harkin <ryan.harkin@linaro.org>
Reviewed-by: Matt Fleming <matt@codeblueprint.co.uk>
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
-rw-r--r-- | arch/arm/include/asm/mach/map.h | 2 | ||||
-rw-r--r-- | arch/arm/mm/mmu.c | 20 |
2 files changed, 22 insertions, 0 deletions
diff --git a/arch/arm/include/asm/mach/map.h b/arch/arm/include/asm/mach/map.h index f98c7f32c9c8..9b7c328fb207 100644 --- a/arch/arm/include/asm/mach/map.h +++ b/arch/arm/include/asm/mach/map.h | |||
@@ -42,6 +42,8 @@ enum { | |||
42 | extern void iotable_init(struct map_desc *, int); | 42 | extern void iotable_init(struct map_desc *, int); |
43 | extern void vm_reserve_area_early(unsigned long addr, unsigned long size, | 43 | extern void vm_reserve_area_early(unsigned long addr, unsigned long size, |
44 | void *caller); | 44 | void *caller); |
45 | extern void create_mapping_late(struct mm_struct *mm, struct map_desc *md, | ||
46 | bool ng); | ||
45 | 47 | ||
46 | #ifdef CONFIG_DEBUG_LL | 48 | #ifdef CONFIG_DEBUG_LL |
47 | extern void debug_ll_addr(unsigned long *paddr, unsigned long *vaddr); | 49 | extern void debug_ll_addr(unsigned long *paddr, unsigned long *vaddr); |
diff --git a/arch/arm/mm/mmu.c b/arch/arm/mm/mmu.c index 2d9f628a7fe8..8c69830e791a 100644 --- a/arch/arm/mm/mmu.c +++ b/arch/arm/mm/mmu.c | |||
@@ -724,6 +724,14 @@ static void __init *early_alloc(unsigned long sz) | |||
724 | return early_alloc_aligned(sz, sz); | 724 | return early_alloc_aligned(sz, sz); |
725 | } | 725 | } |
726 | 726 | ||
727 | static void *__init late_alloc(unsigned long sz) | ||
728 | { | ||
729 | void *ptr = (void *)__get_free_pages(PGALLOC_GFP, get_order(sz)); | ||
730 | |||
731 | BUG_ON(!ptr); | ||
732 | return ptr; | ||
733 | } | ||
734 | |||
727 | static pte_t * __init pte_alloc(pmd_t *pmd, unsigned long addr, | 735 | static pte_t * __init pte_alloc(pmd_t *pmd, unsigned long addr, |
728 | unsigned long prot, | 736 | unsigned long prot, |
729 | void *(*alloc)(unsigned long sz)) | 737 | void *(*alloc)(unsigned long sz)) |
@@ -960,6 +968,18 @@ static void __init create_mapping(struct map_desc *md) | |||
960 | __create_mapping(&init_mm, md, early_alloc, false); | 968 | __create_mapping(&init_mm, md, early_alloc, false); |
961 | } | 969 | } |
962 | 970 | ||
971 | void __init create_mapping_late(struct mm_struct *mm, struct map_desc *md, | ||
972 | bool ng) | ||
973 | { | ||
974 | #ifdef CONFIG_ARM_LPAE | ||
975 | pud_t *pud = pud_alloc(mm, pgd_offset(mm, md->virtual), md->virtual); | ||
976 | if (WARN_ON(!pud)) | ||
977 | return; | ||
978 | pmd_alloc(mm, pud, 0); | ||
979 | #endif | ||
980 | __create_mapping(mm, md, late_alloc, ng); | ||
981 | } | ||
982 | |||
963 | /* | 983 | /* |
964 | * Create the architecture specific mappings | 984 | * Create the architecture specific mappings |
965 | */ | 985 | */ |