Commit 5a2a13bc7a for qemu.org
commit 5a2a13bc7a03f90388ab369531f2db3df06c8f7e
Author: Mohamed Mediouni <mohamed@unpredictable.fr>
Date: Tue May 5 09:25:21 2026 +0100
target/arm: hvf: instantiate GIC early
While figuring out a better spot for it, put it in hv_arch_vm_create().
After hv_vcpu_create is documented as too late, and deferring
vCPU initialization isn't enough either.
Signed-off-by: Mohamed Mediouni <mohamed@unpredictable.fr>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Message-id: 20260429190532.26538-5-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 70ff1de966..f4638002a3 100644
--- a/target/arm/hvf/hvf.c
+++ b/target/arm/hvf/hvf.c
@@ -1230,6 +1230,28 @@ hv_return_t hvf_arch_vm_create(MachineState *ms, uint32_t pa_range)
chosen_ipa_bit_size = pa_range;
ret = hv_vm_create(config);
+ if (hvf_irqchip_in_kernel()) {
+ if (__builtin_available(macOS 15.0, *)) {
+ /*
+ * Instantiate GIC.
+ * This must be done prior to the creation of any vCPU
+ * but past hv_vm_create()
+ */
+ hv_gic_config_t cfg = hv_gic_config_create();
+ hv_gic_config_set_distributor_base(cfg, 0x08000000);
+ hv_gic_config_set_redistributor_base(cfg, 0x080A0000);
+ ret = hv_gic_create(cfg);
+ if (ret != HV_SUCCESS) {
+ error_report("error creating platform VGIC");
+ goto cleanup;
+ }
+ os_release(cfg);
+ } else {
+ error_report("HVF: Unsupported OS for platform vGIC.");
+ ret = HV_UNSUPPORTED;
+ goto cleanup;
+ }
+ }
cleanup:
os_release(config);