In preparation of adding EFI support, this moves the population of the fixmap region to an earlier stage so that it can be used by the EFI init code to discover the system's memory.
Signed-off-by: Ard Biesheuvel ard.biesheuvel@linaro.org --- arch/arm/kernel/setup.c | 2 ++ arch/arm/mm/mmu.c | 12 ++++++++++-- 2 files changed, 12 insertions(+), 2 deletions(-)
diff --git a/arch/arm/kernel/setup.c b/arch/arm/kernel/setup.c index 6c777e908a24..a88d377848f2 100644 --- a/arch/arm/kernel/setup.c +++ b/arch/arm/kernel/setup.c @@ -80,6 +80,7 @@ extern void early_paging_init(const struct machine_desc *, extern void sanity_check_meminfo(void); extern enum reboot_mode reboot_mode; extern void setup_dma_zone(const struct machine_desc *desc); +extern void early_fixmap_init(void);
unsigned int processor_id; EXPORT_SYMBOL(processor_id); @@ -938,6 +939,7 @@ void __init setup_arch(char **cmdline_p)
early_paging_init(mdesc, lookup_processor_type(read_cpuid_id())); setup_dma_zone(mdesc); + early_fixmap_init(); sanity_check_meminfo(); arm_memblock_init(mdesc);
diff --git a/arch/arm/mm/mmu.c b/arch/arm/mm/mmu.c index 4e6ef896c619..8bb55c99dbfa 100644 --- a/arch/arm/mm/mmu.c +++ b/arch/arm/mm/mmu.c @@ -1321,9 +1321,17 @@ static void __init kmap_init(void) pkmap_page_table = early_pte_alloc(pmd_off_k(PKMAP_BASE), PKMAP_BASE, _PAGE_KERNEL_TABLE); #endif +} + +void __init early_fixmap_init(void) +{ + static u8 fixmap_pte[PTE_HWTABLE_OFF + PTE_HWTABLE_SIZE] __page_aligned_bss; + pmd_t *pmd = pmd_off_k(FIXADDR_START);
- early_pte_alloc(pmd_off_k(FIXADDR_START), FIXADDR_START, - _PAGE_KERNEL_TABLE); + if (pmd_none(*pmd)) + __pmd_populate(pmd, __pa(fixmap_pte), _PAGE_KERNEL_TABLE); + + BUG_ON(pmd_bad(*pmd)); }
static void __init map_lowmem(void)