> On 6. Mar 2026, at 16:53, Mohamed Mediouni <[email protected]> wrote:
>
>
>
>> On 6. Mar 2026, at 16:44, Peter Maydell <[email protected]> wrote:
>>
>> On Fri, 6 Mar 2026 at 14:58, Peter Maydell <[email protected]
>> <mailto:[email protected]>> wrote:
>>>
>>> On Fri, 6 Mar 2026 at 13:01, Mohamed Mediouni <[email protected]>
>>> wrote:
>>>>
>>>> Link to branch: https://github.com/mediouni-m/qemu hvf-irqchip-and-nested
>>>> (tag for this submission: hvf-irqchip-and-nested-v15)
>>>>
>>>> This series adds supports for nested virtualisation when using HVF on
>>>> arm64 Macs.
>>>>
>>>> Reviews would be very welcome :-) It's maybe a bit unlikely that this will
>>>> make
>>>> it to QEMU 11.0 I might as well try.
>>>>
>>>> The first two patches are from the SME enablement series and are present
>>>> for the
>>>> series to be buildable on its own.
>>>
>>>
>>>
>>> Applied to target-arm.next, thanks.
>>
>> I'm afraid this failed to build in our gitlab CI job for macos:
>>
>> https://gitlab.com/qemu-project/qemu/-/jobs/13388426185
>>
>> In file included from ../target/arm/hvf/hvf.c:489:
>> ../target/arm/hvf/sysreg.c.inc:174:21: error: 'HV_SYS_REG_CNTHCTL_EL2'
>> is only available on macOS 15.0 or newer
>> [-Werror,-Wunguarded-availability-new]
>> 174 | DEF_SYSREG_VGIC_EL2(HV_SYS_REG_CNTHCTL_EL2, 3, 4, 14, 1, 0)
>> | ^
>> /Applications/Xcode_16.1.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/Hypervisor.framework/Headers/hv_vcpu_types.h:312:5:
>> note: 'HV_SYS_REG_CNTHCTL_EL2' has been marked as being introduced in
>> macOS 15.0 here, but the deployment target is macOS 14.0.0
>> 312 | HV_SYS_REG_CNTHCTL_EL2 API_AVAILABLE(macos(15.0))
>> API_UNAVAILABLE(ios, tvos) = 0xe708,
>> | ^
>>
>> and similarly for other registers.
>>
>> I'm going to drop the last 4 patches from the series, which I hope will
>> fix the CI problems.
>>
>> — PMM
> Hello,
>
> Will submit a new rev of the last 4 patches with a workaround for this then…
>
> (Ugh @ compiler pragmas but there aren’t better choices unfortunately)
>
For reference, the workaround:
diff --git a/target/arm/hvf/hvf.c b/target/arm/hvf/hvf.c
index 61ba5acce4..11ff74e4c7 100644
--- a/target/arm/hvf/hvf.c
+++ b/target/arm/hvf/hvf.c
@@ -471,8 +471,14 @@ static const struct hvf_reg_match hvf_sme2_preg_match[] = {
*
* SME2 registers are guarded by a runtime availability attribute instead of a
* compile-time def, so verify those at runtime in hvf_arch_init_vcpu() below.
+ *
+ * Nested virt registers are handled via a runtime check, so override the
guarded
+ * availability check done by Clang.
*/
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wunguarded-availability"
+
#define DEF_SYSREG(HVF_ID, ...) \
QEMU_BUILD_BUG_ON(HVF_ID != KVMID_TO_HVF(KVMID_AA64_SYS_REG64(__VA_ARGS__)));
#define DEF_SYSREG_15_02(...)
@@ -494,6 +500,8 @@ static const struct hvf_reg_match hvf_sme2_preg_match[] = {
#undef DEF_SYSREG_VGIC
#undef DEF_SYSREG_VGIC_EL2
+#pragma clang diagnostic pop
+
#define DEF_SYSREG(HVF_ID, op0, op1, crn, crm, op2) {HVF_ID},
#define DEF_SYSREG_15_02(...)
#define DEF_SYSREG_EL2(HVF_ID, op0, op1, crn, crm, op2) {HVF_ID, .el2 = true},