core: fix bug in vm_map() causing pager panic()
core: fix bug in vm_map() causing pager panic()

Prior to this patch vm_map() didn't allocate new page tables (PGTs) as
needed, it only checked that it later would be possible to allocate the
needed PGTs.  This is enough if the user_ta_ctx (UTC) isn't active. With
dynamically linked libraries the UTC will be active when vm_map() is
called to make room for the new segments. If the already allocated PGTs
happen to cover even the new memory range it will still work, this is
normally the case with CFG_WITH_LPAE=y since each page table covers 2
MiB.  With CFG_WITH_LPAE=n the page tables only covers 1 MiB and that's
not enough when loading the os_test TA in xtest case 1006.

This patch fixes the problem by instead of just checking that it later
will be possible to allocate needed PGTs, it also allocates the PGTs if
the UTC is active.

Acked-by: Etienne Carriere <f21bc5b8f3ea1962eb45af359f1abea6578cab94@linaro.org>
Signed-off-by: Jens Wiklander <7706914404370d7502c27a0eff493dcf491feb51@linaro.org>

pascal-brand-st-dev/optee_os,pascal-brand-st-dev/optee_os,pascal-brand-st-dev/optee_os,pascal-brand-st-dev/optee_os,pascal-brand-st-dev/optee_os