lib: xlat_tables_v2: reduce time required to add a mmap region
authorVarun Wadekar <vwadekar@nvidia.com>
Tue, 3 Apr 2018 17:44:41 +0000 (10:44 -0700)
committerVarun Wadekar <vwadekar@nvidia.com>
Mon, 9 Apr 2018 23:37:23 +0000 (16:37 -0700)
commit0ed322329339a30c6bbd81ba784bb54966e4bd6c
treecd4aad4ed8f31815c127f56d7920d9d3ddc5b544
parentf11916bf1dfecd7ee76240eebd847681ce366a67
lib: xlat_tables_v2: reduce time required to add a mmap region

The last entry in the mapping table is not necessarily the same as the
end of the table. This patch loops through the table to find the last
entry marker, on every new mmap addition. The memove operation then
has to only move the memory between current entry and the last entry.
For platforms that arrange their MMIO map properly, this opearation
turns out to be a NOP.

The previous implementation added significant overhead per mmap
addition as the memmove operation always moved the difference between
the current mmap entry and the end of the table.

Tested on Tegra platforms and this new approach improves the memory
mapping time by ~75%, thus significantly reducing boot time on some
platforms.

Change-Id: Ie3478fa5942379282ef58bee2085da799137e2ca
Signed-off-by: Varun Wadekar <vwadekar@nvidia.com>
lib/xlat_tables_v2/xlat_tables_internal.c