]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
arm64/mm: Override PARange for !LPA2 and use it consistently
authorArd Biesheuvel <ardb@kernel.org>
Thu, 12 Dec 2024 08:18:44 +0000 (09:18 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 17 Feb 2025 09:05:05 +0000 (10:05 +0100)
commit8abf61300643e51c0ab1f50b62b0217e21d4560a
tree724961355461b43c1eb9d5a96b0bbd32edb9a20d
parent5a6520493c41834f548d0f2cda52b24deca78003
arm64/mm: Override PARange for !LPA2 and use it consistently

commit 62cffa496aac0c2c4eeca00d080058affd7a0172 upstream.

When FEAT_LPA{,2} are not implemented, the ID_AA64MMFR0_EL1.PARange and
TCR.IPS values corresponding with 52-bit physical addressing are
reserved.

Setting the TCR.IPS field to 0b110 (52-bit physical addressing) has side
effects, such as how the TTBRn_ELx.BADDR fields are interpreted, and so
it is important that disabling FEAT_LPA2 (by overriding the
ID_AA64MMFR0.TGran fields) also presents a PARange field consistent with
that.

So limit the field to 48 bits unless LPA2 is enabled, and update
existing references to use the override consistently.

Fixes: 352b0395b505 ("arm64: Enable 52-bit virtual addressing for 4k and 16k granule configs")
Cc: stable@vger.kernel.org
Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
Acked-by: Marc Zyngier <maz@kernel.org>
Link: https://lore.kernel.org/r/20241212081841.2168124-10-ardb+git@google.com
Signed-off-by: Will Deacon <will@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
arch/arm64/include/asm/assembler.h
arch/arm64/kernel/cpufeature.c
arch/arm64/kernel/pi/idreg-override.c
arch/arm64/kernel/pi/map_kernel.c
arch/arm64/mm/init.c