@samitouri / QOSamiQemu / commits / 37863fff59

hvf: arm: enable vGIC by default for virt-11.1 and later

Save states are incompatible between kernel-irqchip=on and off on HVF due to opaque vGIC state. Signed-off-by: Mohamed Mediouni <mohamed@unpredictable.fr> Reviewed-by: Manos Pitsidianakis <manos.pitsidianakis@linaro.org> Message-id: 20260429190532.26538-16-mohamed@unpredictable.fr Signed-off-by: Peter Maydell <peter.maydell@linaro.org>

Mohamed Mediouni committed May 5, 2026 at 09:25 UTC 37863fff59e0b2c71989f2de906a52935f11ce7b
5 files changed +30
accel/hvf/hvf-all.c
+11
@@ -25,6 +25,7 @@
25 bool hvf_allowed;
26 bool hvf_kernel_irqchip;
27 bool hvf_nested_virt;
28 +bool hvf_kernel_irqchip_override;
29
30 void hvf_nested_virt_enable(bool nested_virt)
31 {
@@ -204,6 +205,13 @@ static int hvf_accel_init(AccelState *as, MachineState *ms)
205 }
206 }
207
208 + if (mc->get_kernel_irqchip_default) {
209 + bool kernel_irqchip_default = mc->get_kernel_irqchip_default(ms);
210 + if (!hvf_kernel_irqchip_override) {
211 + hvf_kernel_irqchip = kernel_irqchip_default;
212 + }
213 + }
214 +
215 ret = hvf_arch_vm_create(ms, (uint32_t)pa_range);
216 if (ret == HV_DENIED) {
217 error_report("Could not access HVF. Is the executable signed"
@@ -230,6 +238,8 @@ static void hvf_set_kernel_irqchip(Object *obj, Visitor *v,
238 Error **errp)
239 {
240 OnOffSplit mode;
241 +
242 + hvf_kernel_irqchip_override = true;
243 if (!visit_type_OnOffSplit(v, name, &mode, errp)) {
244 return;
245 }
@@ -269,6 +279,7 @@ static void hvf_accel_class_init(ObjectClass *oc, const void *data)
279 ac->init_machine = hvf_accel_init;
280 ac->allowed = &hvf_allowed;
281 ac->gdbstub_supported_sstep_flags = hvf_gdbstub_sstep_flags;
282 + hvf_kernel_irqchip_override = false;
283 hvf_kernel_irqchip = false;
284 object_class_property_add(oc, "kernel-irqchip", "on|off|split",
285 NULL, hvf_set_kernel_irqchip,
hw/arm/virt.c
+15
@@ -3769,6 +3769,17 @@ static int virt_get_physical_address_range(MachineState *ms,
3769 return requested_ipa_size;
3770 }
3771
3772 +static bool get_kernel_irqchip_default(const MachineState *ms)
3773 +{
3774 + VirtMachineState *vms = VIRT_MACHINE(ms);
3775 + VirtMachineClass *vmc = VIRT_MACHINE_GET_CLASS(vms);
3776 + if (hvf_allowed) {
3777 + return !vmc->hvf_no_kernel_irqchip_default;
3778 + } else {
3779 + return true;
3780 + }
3781 +}
3782 +
3783 static const char *virt_get_default_cpu_type(const MachineState *ms)
3784 {
3785 return tcg_enabled() ? ARM_CPU_TYPE_NAME("cortex-a15")
@@ -3835,6 +3846,7 @@ static void virt_machine_class_init(ObjectClass *oc, const void *data)
3846 mc->get_default_cpu_node_id = virt_get_default_cpu_node_id;
3847 mc->kvm_type = virt_kvm_type;
3848 mc->get_physical_address_range = virt_get_physical_address_range;
3849 + mc->get_kernel_irqchip_default = get_kernel_irqchip_default;
3850 assert(!mc->get_hotplug_handler);
3851 mc->get_hotplug_handler = virt_machine_get_hotplug_handler;
3852 hc->pre_plug = virt_machine_device_pre_plug_cb;
@@ -4079,8 +4091,11 @@ DEFINE_VIRT_MACHINE_AS_LATEST(11, 1)
4091
4092 static void virt_machine_11_0_options(MachineClass *mc)
4093 {
4094 + VirtMachineClass *vmc = VIRT_MACHINE_CLASS(OBJECT_CLASS(mc));
4095 +
4096 virt_machine_11_1_options(mc);
4097 compat_props_add(mc->compat_props, hw_compat_11_0, hw_compat_11_0_len);
4098 + vmc->hvf_no_kernel_irqchip_default = true;
4099 }
4100 DEFINE_VIRT_MACHINE(11, 0)
4101
include/hw/arm/virt.h
+2
@@ -138,6 +138,8 @@ struct VirtMachineClass {
138 bool no_tcg_lpa2;
139 bool no_ns_el2_virt_timer_irq;
140 bool no_nested_smmu;
141 + /* HVF specific: support for kernel-irqchip=on introduced in QEMU 11.1 */
142 + bool hvf_no_kernel_irqchip_default;
143 };
144
145 struct VirtMachineState {
include/hw/core/boards.h
+1
@@ -280,6 +280,7 @@ struct MachineClass {
280 int (*kvm_type)(MachineState *machine, const char *arg);
281 int (*get_physical_address_range)(MachineState *machine,
282 int default_ipa_size, int max_ipa_size);
283 + bool (*get_kernel_irqchip_default) (const MachineState *machine);
284
285 BlockInterfaceType block_default_type;
286 int units_per_default_bus;
include/system/hvf_int.h
+1
@@ -112,4 +112,5 @@ bool hvf_arch_cpu_realize(CPUState *cpu, Error **errp);
112 uint32_t hvf_arch_get_default_ipa_bit_size(void);
113 uint32_t hvf_arch_get_max_ipa_bit_size(void);
114
115 +extern bool hvf_kernel_irqchip_override;
116 #endif