[PATCH v14 12/44] arm64: RMI: Check for LPA2 support
Steven Price
steven.price at arm.com
Wed May 13 06:17:20 PDT 2026
If KVM has enabled LPA2 support then check that the RMM also supports
it. If there is a mismatch then disable support for realm guests as the
VMM may attempt to create a guest which is incompatible with the RMM.
Signed-off-by: Steven Price <steven.price at arm.com>
---
New patch for v13
---
arch/arm64/kvm/rmi.c | 19 +++++++++++++++++++
1 file changed, 19 insertions(+)
diff --git a/arch/arm64/kvm/rmi.c b/arch/arm64/kvm/rmi.c
index 1acc972a4b92..6e28b669ded2 100644
--- a/arch/arm64/kvm/rmi.c
+++ b/arch/arm64/kvm/rmi.c
@@ -5,9 +5,25 @@
#include <linux/kvm_host.h>
+#include <asm/kvm_pgtable.h>
#include <asm/rmi_cmds.h>
#include <asm/virt.h>
+static bool rmi_has_feature(unsigned long feature)
+{
+ return !!u64_get_bits(rmm_feat_reg0, feature);
+}
+
+static int rmm_check_features(void)
+{
+ if (kvm_lpa2_is_enabled() && !rmi_has_feature(RMI_FEATURE_REGISTER_0_LPA2)) {
+ kvm_err("RMM doesn't support LPA2");
+ return -ENXIO;
+ }
+
+ return 0;
+}
+
void kvm_init_rmi(void)
{
/*
@@ -20,5 +36,8 @@ void kvm_init_rmi(void)
if (!rmi_is_available())
return;
+ if (rmm_check_features())
+ return;
+
/* Future patch will enable static branch kvm_rmi_is_available */
}
--
2.43.0
More information about the linux-arm-kernel
mailing list