arm64: mm: move pgd_cache initialisation to pgtable_cache_init
authorWill Deacon <will.deacon@arm.com>
Tue, 5 Jan 2016 15:36:59 +0000 (15:36 +0000)
committerAlex Shi <alex.shi@linaro.org>
Wed, 11 May 2016 09:01:08 +0000 (17:01 +0800)
commit87e4c1f363cfd0ed3a673d47f229725a6b0946d7
tree21b91116a59e36a84c8ed9a18fa87c68091c7987
parent3fd9316702a82b498fcf7055f9781589ea6c1e1c
arm64: mm: move pgd_cache initialisation to pgtable_cache_init

Initialising the suppport for EFI runtime services requires us to
allocate a pgd off the back of an early_initcall. On systems where the
PGD_SIZE is smaller than PAGE_SIZE (e.g. 64k pages and 48-bit VA), the
pgd_cache isn't initialised at this stage, and we panic with a NULL
dereference during boot:

  Unable to handle kernel NULL pointer dereference at virtual address 00000000

  __create_mapping.isra.5+0x84/0x350
  create_pgd_mapping+0x20/0x28
  efi_create_mapping+0x5c/0x6c
  arm_enable_runtime_services+0x154/0x1e4
  do_one_initcall+0x8c/0x190
  kernel_init_freeable+0x84/0x1ec
  kernel_init+0x10/0xe0
  ret_from_fork+0x10/0x50

This patch fixes the problem by initialising the pgd_cache earlier, in
the pgtable_cache_init callback, which sounds suspiciously like what it
was intended for.

Reported-by: Dennis Chen <dennis.chen@arm.com>
Signed-off-by: Will Deacon <will.deacon@arm.com>
(cherry picked from commit 39b5be9b4233a9f212b98242bddf008f379b5122)
Signed-off-by: Alex Shi <alex.shi@linaro.org>
arch/arm64/include/asm/pgtable.h
arch/arm64/mm/pgd.c