Skip to contentSkip to conversation

hvf: arm: fix SME capabilities reporting

PATCH New Mohamed Mediouni 1 participant 1 message Mar 6

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 hvf: arm: fix SME capabilities reporting

Sync capabilities for the SME-specific ID registers to the host CPU config. This fixes SME2 functionality.

Based-on: <[email protected]>

---
 target/arm/hvf/hvf.c | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)
target/arm/hvf/hvf.c +19 -0
index cb05db2358..b7c5aea505 100644
@@ -1126,6 +1126,15 @@ static bool hvf_arm_get_host_cpu_features(ARMHostCPUFeatures *ahcf)
         { HV_FEATURE_REG_ID_AA64MMFR2_EL1, ID_AA64MMFR2_EL1_IDX },
         /* Add ID_AA64MMFR3_EL1 here when HVF supports it */
     };
+
+    API_AVAILABLE(macos(15.2)) static const struct sme_isar_regs {
+        hv_feature_reg_t reg;
+        ARMIDRegisterIdx index;
+    } sme_regs[] = {
+        { HV_FEATURE_REG_ID_AA64SMFR0_EL1, ID_AA64SMFR0_EL1_IDX },
+        { HV_FEATURE_REG_ID_AA64ZFR0_EL1, ID_AA64ZFR0_EL1_IDX },
+    };
+
     hv_return_t r = HV_SUCCESS;
     hv_vcpu_config_t config = hv_vcpu_config_create();
     uint64_t t;
@@ -1146,6 +1155,16 @@ static bool hvf_arm_get_host_cpu_features(ARMHostCPUFeatures *ahcf)
         r |= hv_vcpu_config_get_feature_reg(config, regs[i].reg,
                                             &host_isar.idregs[regs[i].index]);
     }
+
+    if (__builtin_available(macOS 15.2, *)) {
+        if (hvf_arm_sme2_supported()) {
+            for (i = 0; i < ARRAY_SIZE(sme_regs); i++) {
+                r |= hv_vcpu_config_get_feature_reg(config, sme_regs[i].reg,
+                                            &host_isar.idregs[sme_regs[i].index]);
+            }
+        }
+    }
+
     os_release(config);
 
     /*
Signature · 1 line
2.50.1 (Apple Git-155)