]> git.baikalelectronics.ru Git - kernel.git/commit
arm64/kernel: Fix range on invalidating dcache for boot page tables
authorGavin Shan <gshan@redhat.com>
Mon, 27 Apr 2020 23:57:00 +0000 (09:57 +1000)
committerWill Deacon <will@kernel.org>
Tue, 28 Apr 2020 13:48:03 +0000 (14:48 +0100)
commitcf1109aa0acd35baba68f744a83bc2ca3e2bf756
tree3cdc4869d46d7549688820869dc4590cd95cd705
parent37df1ad9dcc1ced0487cd207881f2cd0b23013fc
arm64/kernel: Fix range on invalidating dcache for boot page tables

Prior to commit 77380e3cf53622c5 ("arm64/mm: move runtime pgds to
rodata"), idmap_pgd_dir, tramp_pg_dir, reserved_ttbr0, swapper_pg_dir,
and init_pg_dir were contiguous at the end of the kernel image. The
maintenance at the end of __create_page_tables assumed these were
contiguous, and affected everything from the start of idmap_pg_dir
to the end of init_pg_dir.

That commit moved all but init_pg_dir into the .rodata section, with
other data placed between idmap_pg_dir and init_pg_dir, but did not
update the maintenance. Hence the maintenance is performed on much
more data than necessary (but as the bootloader previously made this
clean to the PoC there is no functional problem).

As we only alter idmap_pg_dir, and init_pg_dir, we only need to perform
maintenance for these. As the other dirs are in .rodata, the bootloader
will have initialised them as expected and cleaned them to the PoC. The
kernel will initialize them as necessary after enabling the MMU.

This patch reworks the maintenance to only cover the idmap_pg_dir and
init_pg_dir to avoid this unnecessary work.

Signed-off-by: Gavin Shan <gshan@redhat.com>
Reviewed-by: Mark Rutland <mark.rutland@arm.com>
Link: https://lore.kernel.org/r/20200427235700.112220-1-gshan@redhat.com
Signed-off-by: Will Deacon <will@kernel.org>
arch/arm64/include/asm/pgtable.h
arch/arm64/kernel/head.S
arch/arm64/kernel/vmlinux.lds.S