arm64: unmap idmap earlier
authorMark Rutland <mark.rutland@arm.com>
Mon, 25 Jan 2016 11:44:59 +0000 (11:44 +0000)
committerAlex Shi <alex.shi@linaro.org>
Wed, 11 May 2016 14:19:11 +0000 (22:19 +0800)
During boot we leave the idmap in place until paging_init, as we
previously had to wait for the zero page to become allocated and
accessible.

Now that we have a statically-allocated zero page, we can uninstall the
idmap much earlier in the boot process, making it far easier to spot
accidental use of physical addresses. This also brings the cold boot
path in line with the secondary boot path.

Signed-off-by: Mark Rutland <mark.rutland@arm.com>
Reviewed-by: Catalin Marinas <catalin.marinas@arm.com>
Tested-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Tested-by: Jeremy Linton <jeremy.linton@arm.com>
Cc: Laura Abbott <labbott@fedoraproject.org>
Cc: Will Deacon <will.deacon@arm.com>
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
(cherry picked from commit 86ccce896cb0aa800a7a6dcd29b41ffc4eeb1a75)
Signed-off-by: Alex Shi <alex.shi@linaro.org>
arch/arm64/kernel/setup.c
arch/arm64/mm/mmu.c

index f6621ba071f9082f66a289c8d123948b4f44ed70..cfed56f0ad26d64714b137f124ac8112b12331b1 100644 (file)
@@ -314,6 +314,12 @@ void __init setup_arch(char **cmdline_p)
         */
        local_async_enable();
 
+       /*
+        * TTBR0 is only used for the identity mapping at this stage. Make it
+        * point to zero page to avoid speculatively fetching new entries.
+        */
+       cpu_uninstall_idmap();
+
        efi_init();
        arm64_memblock_init();
 
index dcc06b23b37ff0e1a45bc43d4ce67722f953c3f3..8587ed9d81b61dc917a6141ad96294db733e022e 100644 (file)
@@ -461,12 +461,6 @@ void __init paging_init(void)
        fixup_executable();
 
        bootmem_init();
-
-       /*
-        * TTBR0 is only used for the identity mapping at this stage. Make it
-        * point to zero page to avoid speculatively fetching new entries.
-        */
-       cpu_uninstall_idmap();
 }
 
 /*