Sync capabilities for the SME-specific ID registers to the host CPU config.
This fixes SME2 functionality.
Signed-off-by: Mohamed Mediouni <mohamed@unpredictable.fr>
Based-on: <20260306041747.54554-1-mohamed@unpredictable.fr>
---
target/arm/hvf/hvf.c | 19 +++++++++++++++++++
1 file changed, 19 insertions(+)
diff --git a/target/arm/hvf/hvf.c b/target/arm/hvf/hvf.c
index cb05db2358..b7c5aea505 100644
--- a/target/arm/hvf/hvf.c
+++ b/target/arm/hvf/hvf.c
@@ -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);
/*
--
2.50.1 (Apple Git-155)