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>
This commit is contained in:
parent
b430e55b23
commit
c7936206b9
|
@ -42,6 +42,8 @@ enum {
|
||||||
extern void iotable_init(struct map_desc *, int);
|
extern void iotable_init(struct map_desc *, int);
|
||||||
extern void vm_reserve_area_early(unsigned long addr, unsigned long size,
|
extern void vm_reserve_area_early(unsigned long addr, unsigned long size,
|
||||||
void *caller);
|
void *caller);
|
||||||
|
extern void create_mapping_late(struct mm_struct *mm, struct map_desc *md,
|
||||||
|
bool ng);
|
||||||
|
|
||||||
#ifdef CONFIG_DEBUG_LL
|
#ifdef CONFIG_DEBUG_LL
|
||||||
extern void debug_ll_addr(unsigned long *paddr, unsigned long *vaddr);
|
extern void debug_ll_addr(unsigned long *paddr, unsigned long *vaddr);
|
||||||
|
|
|
@ -724,6 +724,14 @@ static void __init *early_alloc(unsigned long sz)
|
||||||
return early_alloc_aligned(sz, 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,
|
static pte_t * __init pte_alloc(pmd_t *pmd, unsigned long addr,
|
||||||
unsigned long prot,
|
unsigned long prot,
|
||||||
void *(*alloc)(unsigned long sz))
|
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);
|
__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
|
* Create the architecture specific mappings
|
||||||
*/
|
*/
|
||||||
|
|
Loading…
Reference in New Issue