Skip to content
Commit e25208f7 authored by Catalin Marinas's avatar Catalin Marinas
Browse files

arm64: Fix mapping of memory banks not ending on a PMD_SIZE boundary



The map_mem() function limits the current memblock limit to PGDIR_SIZE
(the initial swapper_pg_dir mapping) to avoid create_mapping()
allocating memory from unmapped areas. However, if the first block is
within PGDIR_SIZE and not ending on a PMD_SIZE boundary, when 4K page
configuration is enabled, create_mapping() will try to allocate a pte
page. Such page may be returned by memblock_alloc() from the end of such
bank (or any subsequent bank within PGDIR_SIZE) which is not mapped yet.

The patch limits the current memblock limit to the aligned end of the
first bank and gradually increases it as more memory is mapped. It also
ensures that the start of the first bank is aligned to PMD_SIZE to avoid
pte page allocation for this mapping.

Signed-off-by: default avatarCatalin Marinas <catalin.marinas@arm.com>
Reported-by: default avatar"Leizhen (ThunderTown, Euler)" <thunder.leizhen@huawei.com>
Tested-by: default avatar"Leizhen (ThunderTown, Euler)" <thunder.leizhen@huawei.com>
parent c80b7ee8
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment