[PATCH v3 14/23] KVM: s390: arm64: Verify machine feature set before loading
From: Steffen Eiden
Date: Fri Nov 06 2026 - 11:15:12 EST
Arm guests on s390 need more than the Arm Execution Facility alone. In
addition, the PTFF time conversion functions are required. In addition
the guest mapping relies on EDAT2 for large pages.
Verify that these features are present before loading the kvm_arm64
module. Every machine having the aef facility present should also
support those. Print an error message if this is not the case.
Co-developed-by: Andreas Grapentin <gra@xxxxxxxxxxxxx>
Signed-off-by: Andreas Grapentin <gra@xxxxxxxxxxxxx>
Signed-off-by: Steffen Eiden <seiden@xxxxxxxxxxxxx>
---
arch/s390/kvm/arm64/arm.c | 21 ++++++++++++++++++++-
1 file changed, 20 insertions(+), 1 deletion(-)
diff --git a/arch/s390/kvm/arm64/arm.c b/arch/s390/kvm/arm64/arm.c
index 62c2b45599b9..3af0b47b8377 100644
--- a/arch/s390/kvm/arm64/arm.c
+++ b/arch/s390/kvm/arm64/arm.c
@@ -741,9 +741,28 @@ long kvm_arch_vcpu_unlocked_ioctl(struct file *filp, unsigned int ioctl,
return -ENOIOCTLCMD;
}
+static bool __init machine_supports_arm64_kvm(void)
+{
+ if (!sclp.has_aef || !aef_usable()) {
+ pr_info("ARM Execution Facility not available\n");
+ return false;
+ }
+
+ if (!ptff_query(PTFF_QAGTO) || !ptff_query(PTFF_QAGPT)) {
+ pr_err("No ARM time conversion functions available (unexpected machine feature set)\n");
+ return false;
+ }
+ if (!cpu_has_edat2()) {
+ pr_err("No EDAT2 facility available (unexpected machine feature set)\n");
+ return false;
+ }
+
+ return true;
+}
+
static int __init kvm_s390_arm64_init(void)
{
- if (!sclp.has_aef || !aef_usable())
+ if (!machine_supports_arm64_kvm())
return -ENODEV;
kvm_init_qaaf();
--
2.56.0