Commit ecc54006 authored by Zenghui Yu's avatar Zenghui Yu Committed by Will Deacon
Browse files

arm64: Clear the initial ID map correctly before remapping



In the attempt to clear and recreate the initial ID map for LPA2, we
wrongly use 'start - end' as the map size and make the memset() almost a
nop.

Fix it by passing the correct map size.

Fixes: 9684ec18 ("arm64: Enable LPA2 at boot if supported by the system")
Signed-off-by: default avatarZenghui Yu <yuzenghui@huawei.com>
Reviewed-by: default avatarArd Biesheuvel <ardb@kernel.org>
Link: https://lore.kernel.org/r/20240621092809.162-1-yuzenghui@huawei.com


Signed-off-by: default avatarWill Deacon <will@kernel.org>
parent 895a3702
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -173,7 +173,7 @@ static void __init remap_idmap_for_lpa2(void)
	 * Don't bother with the FDT, we no longer need it after this.
	 */
	memset(init_idmap_pg_dir, 0,
	       (u64)init_idmap_pg_dir - (u64)init_idmap_pg_end);
	       (u64)init_idmap_pg_end - (u64)init_idmap_pg_dir);

	create_init_idmap(init_idmap_pg_dir, mask);
	dsb(ishst);