target/arm/hvf/hvf.c | 9 +++++++++ 1 file changed, 9 insertions(+)
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>
---
target/arm/hvf/hvf.c | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/target/arm/hvf/hvf.c b/target/arm/hvf/hvf.c
index 4f0f7ffba1..79209bc8e9 100644
--- a/target/arm/hvf/hvf.c
+++ b/target/arm/hvf/hvf.c
@@ -468,6 +468,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.
*
--
2.50.1 (Apple Git-155)
On Sat, 2 May 2026 at 00:13, Mohamed Mediouni <mohamed@unpredictable.fr> wrote: > > 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> I put this patch into my v2 pullreq; hopefully it will get through the CI gauntlet this time :-) -- PMM
On 2/5/26 01:13, Mohamed Mediouni wrote:
> 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>
> ---
> target/arm/hvf/hvf.c | 9 +++++++++
> 1 file changed, 9 insertions(+)
>
> diff --git a/target/arm/hvf/hvf.c b/target/arm/hvf/hvf.c
> index 4f0f7ffba1..79209bc8e9 100644
> --- a/target/arm/hvf/hvf.c
> +++ b/target/arm/hvf/hvf.c
> @@ -468,6 +468,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)
Not sure about this check, i.e. wouldn't it clash with 26.1 release?
I'd expect a check such:
#if MAC_OS_X_VERSION_MAX_ALLOWED < 260000
> +#define HV_SYS_REG_MDCR_EL2 0xe089
> +#endif
> +
> /*
> * Verify this at compile-time.
> *
> On 4. May 2026, at 08:49, Philippe Mathieu-Daudé <philmd@linaro.org> wrote:
>
> On 2/5/26 01:13, Mohamed Mediouni wrote:
>> 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>
>> ---
>> target/arm/hvf/hvf.c | 9 +++++++++
>> 1 file changed, 9 insertions(+)
>> diff --git a/target/arm/hvf/hvf.c b/target/arm/hvf/hvf.c
>> index 4f0f7ffba1..79209bc8e9 100644
>> --- a/target/arm/hvf/hvf.c
>> +++ b/target/arm/hvf/hvf.c
>> @@ -468,6 +468,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)
>
> Not sure about this check, i.e. wouldn't it clash with 26.1 release?
> I'd expect a check such:
>
> #if MAC_OS_X_VERSION_MAX_ALLOWED < 260000
Hi,
MAC_OS_VERSION_26_0 will be defined in all future SDKs.
See AvailabilityVersions.h in the macOS SDK, has all of them since 10.0
>
>> +#define HV_SYS_REG_MDCR_EL2 0xe089
>> +#endif
>> +
>> /*
>> * Verify this at compile-time.
>> *
>
>
On 4/5/26 08:59, Mohamed Mediouni wrote:
>
>
>> On 4. May 2026, at 08:49, Philippe Mathieu-Daudé <philmd@linaro.org> wrote:
>>
>> On 2/5/26 01:13, Mohamed Mediouni wrote:
>>> 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>
>>> ---
>>> target/arm/hvf/hvf.c | 9 +++++++++
>>> 1 file changed, 9 insertions(+)
>>> diff --git a/target/arm/hvf/hvf.c b/target/arm/hvf/hvf.c
>>> index 4f0f7ffba1..79209bc8e9 100644
>>> --- a/target/arm/hvf/hvf.c
>>> +++ b/target/arm/hvf/hvf.c
>>> @@ -468,6 +468,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)
>>
>> Not sure about this check, i.e. wouldn't it clash with 26.1 release?
>> I'd expect a check such:
>>
>> #if MAC_OS_X_VERSION_MAX_ALLOWED < 260000
>
> Hi,
>
> MAC_OS_VERSION_26_0 will be defined in all future SDKs.
>
> See AvailabilityVersions.h in the macOS SDK, has all of them since 10.0
Right.
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
>>
>>> +#define HV_SYS_REG_MDCR_EL2 0xe089
>>> +#endif
>>> +
>>> /*
>>> * Verify this at compile-time.
>>> *
>>
>>
>
© 2016 - 2026 Red Hat, Inc.