UPSTREAM: arm64: unmap idmap earlier
authorMark Rutland <mark.rutland@arm.com>
Mon, 25 Jan 2016 11:44:59 +0000 (11:44 +0000)
committerJeff Vander Stoep <jeffv@google.com>
Mon, 19 Sep 2016 04:02:30 +0000 (21:02 -0700)
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>
Bug: 30369029
Patchset: rework-pagetable

(cherry picked from commit 86ccce896cb0aa800a7a6dcd29b41ffc4eeb1a75)
Signed-off-by: Jeff Vander Stoep <jeffv@google.com>
Change-Id: I6375bd9855e45727790697875b7cd19f84a4dd7f

arch/arm64/kernel/setup.c
arch/arm64/mm/mmu.c

index de8e187ec8c66e98e58ae6e539674a4e2a1fb799..079db3ba21c46feafb59c490b11617c3a2c0e95c 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 b00462172705a65adc7c9ef8c1ab0f852ae3ff39..c0a4160331f8d4747cbd95b88bccb85f2f6c77e5 100644 (file)
@@ -460,12 +460,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();
 }
 
 /*