Commit 3d1f1e65c5 for qemu.org
commit 3d1f1e65c5cf8f64d67eb255fface3c195b2481a
Author: Mohamed Mediouni <mohamed@unpredictable.fr>
Date: Sat May 2 01:13:53 2026 +0200
hvf: arm: override HV_SYS_REG_MDCR_EL2
In older SDKs, MDCR_EL2 was defined incorrectly.
As such, override it with a #define if compiling with an older macOS
SDK.
This is a workaround because the macOS CI setup we currently rely on
has not been kept up to date, to be able to land nested virtualization
support.
Once CI is updated, the SME stubs can be removed and this
commit can be reverted.
Signed-off-by: Mohamed Mediouni <mohamed@unpredictable.fr>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Message-id: 20260501231353.63184-1-mohamed@unpredictable.fr
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
diff --git a/target/arm/hvf/hvf.c b/target/arm/hvf/hvf.c
index ec45081c4d..d2c8ce771a 100644
--- a/target/arm/hvf/hvf.c
+++ b/target/arm/hvf/hvf.c
@@ -462,6 +462,15 @@ static const struct hvf_reg_match hvf_sme2_preg_match[] = {
#define HVF_TO_KVMID(HVF) \
(CP_REG_ARM64 | CP_REG_SIZE_U64 | CP_REG_ARM64_SYSREG | (HVF))
+/*
+ * In older SDKs, MDCR_EL2 was defined incorrectly.
+ * As such, override it with a #define if compiling with an older macOS SDK.
+ * https://lore.kernel.org/qemu-devel/BCCED674-EAEF-4755-9BE1-116FB36FB5C9@apple.com/
+ */
+#if !defined(MAC_OS_VERSION_26_0)
+#define HV_SYS_REG_MDCR_EL2 0xe089
+#endif
+
/*
* Verify this at compile-time.
*