arm64: Detect if in a realm and set RIPAS RAM
authorSuzuki K Poulose <suzuki.poulose@arm.com>
Thu, 17 Oct 2024 13:14:25 +0000 (14:14 +0100)
committerCatalin Marinas <catalin.marinas@arm.com>
Wed, 23 Oct 2024 09:19:32 +0000 (10:19 +0100)
commitc077711f718be7cebcc8b987eac2ebfd17447e9f
treea55728dd67d614957c65f6fc7422931e474a975c
parentb880a80011f56880f32bde47fc6af313359f926b
arm64: Detect if in a realm and set RIPAS RAM

Detect that the VM is a realm guest by the presence of the RSI
interface. This is done after PSCI has been initialised so that we can
check the SMCCC conduit before making any RSI calls.

If in a realm then iterate over all memory ensuring that it is marked as
RIPAS RAM. The loader is required to do this for us, however if some
memory is missed this will cause the guest to receive a hard to debug
external abort at some random point in the future. So for a
belt-and-braces approach set all memory to RIPAS RAM. Any failure here
implies that the RAM regions passed to Linux are incorrect so panic()
promptly to make the situation clear.

Reviewed-by: Gavin Shan <gshan@redhat.com>
Reviewed-by: Catalin Marinas <catalin.marinas@arm.com>
Signed-off-by: Suzuki K Poulose <suzuki.poulose@arm.com>
Co-developed-by: Steven Price <steven.price@arm.com>
Signed-off-by: Steven Price <steven.price@arm.com>
Link: https://lore.kernel.org/r/20241017131434.40935-3-steven.price@arm.com
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
arch/arm64/include/asm/rsi.h [new file with mode: 0644]
arch/arm64/kernel/Makefile
arch/arm64/kernel/rsi.c [new file with mode: 0644]
arch/arm64/kernel/setup.c