summaryrefslogtreecommitdiff
path: root/arch/arm/mm/mmu.c
diff options
context:
space:
mode:
authorArd Biesheuvel <ard.biesheuvel@linaro.org>2015-04-29 10:04:17 +0200
committerard <ard.biesheuvel@linaro.org>2015-12-13 19:18:29 +0100
commitc7936206b9715d7a3075b53789c1fed0cab9147f (patch)
tree218df320e43208e5c8ddf7962b965b4c95f6469e /arch/arm/mm/mmu.c
parentb430e55b2318ca4523b0e39ff6c0d5a2109159b4 (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>
Diffstat (limited to 'arch/arm/mm/mmu.c')
-rw-r--r--arch/arm/mm/mmu.c20
1 files changed, 20 insertions, 0 deletions
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)
return early_alloc_aligned(sz, sz);
}
+static void *__init late_alloc(unsigned long sz)
+{
+ void *ptr = (void *)__get_free_pages(PGALLOC_GFP, get_order(sz));
+
+ BUG_ON(!ptr);
+ return ptr;
+}
+
static pte_t * __init pte_alloc(pmd_t *pmd, unsigned long addr,
unsigned long prot,
void *(*alloc)(unsigned long sz))
@@ -960,6 +968,18 @@ static void __init create_mapping(struct map_desc *md)
__create_mapping(&init_mm, md, early_alloc, false);
}
+void __init create_mapping_late(struct mm_struct *mm, struct map_desc *md,
+ bool ng)
+{
+#ifdef CONFIG_ARM_LPAE
+ pud_t *pud = pud_alloc(mm, pgd_offset(mm, md->virtual), md->virtual);
+ if (WARN_ON(!pud))
+ return;
+ pmd_alloc(mm, pud, 0);
+#endif
+ __create_mapping(mm, md, late_alloc, ng);
+}
+
/*
* Create the architecture specific mappings
*/