In the current RTP0 only mapping regime, kernel translations are also
setup via RTP0 (which canonically is used for user mappings)
early boot code sets RTP0 directly with kernel swapper_pg_dir / swapper_pud
when userspace starts, RTP0 has user PGD -> PUD, but kernel identity
mapppings are copied into user PUD at right location via
arc_map_kernel_in_mm().
So far this was done on demand:
activate_mm() -> execve
arch_dup_mmap() -> fork
However a better way to do this is to copy the kernel entries into user pud
right when user pud is allocated (like some other arches). This avoids the
need for the additional arch 2 hooks to do on-demand copy. This patch thus
removes them.
The only caveat is, when you swtich to linking kernel in RTP1, the copying needs to happen on user PGD (not PUD) for the last pgd index. But that would have required changing arc_map_kernel_in_mm() in current regime too.
Absolutely this is more of a proof of concept to show that things can be done in a better way - and keep the code portable so both low mapping and high mapping work out of the box w/o gimmics.
In the current RTP0 only mapping regime, kernel translations are also setup via RTP0 (which canonically is used for user mappings)
early boot code sets RTP0 directly with kernel swapper_pg_dir / swapper_pud
when userspace starts, RTP0 has user PGD -> PUD, but kernel identity mapppings are copied into user PUD at right location via arc_map_kernel_in_mm().
So far this was done on demand:
However a better way to do this is to copy the kernel entries into user pud right when user pud is allocated (like some other arches). This avoids the need for the additional arch 2 hooks to do on-demand copy. This patch thus removes them.
The only caveat is, when you swtich to linking kernel in RTP1, the copying needs to happen on user PGD (not PUD) for the last pgd index. But that would have required changing arc_map_kernel_in_mm() in current regime too.
Signed-off-by: Vineet Gupta vgupta@kernel.org