accel/mshv: implement cpu_thread_is_idle() hook
In MSHV the hypervisor APIC is always used, so we to implement this hook to make sure the AP's vcpu thread is not blocked waiting for an INIT SIPI by the BSP. Without this change soft reboots with -smp cpus>=2 will hang. Signed-off-by: Magnus Kulke <magnuskulke@linux.microsoft.com> Reviewed-by: Mohamed Mediouni <mohamed@unpredictable.fr> Link: https://lore.kernel.org/r/20260421-mshv_accel_arm64_supp-v3-9-469f544778ba@linux.microsoft.com [Make comment not x86 specific. - Paolo] Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Magnus Kulke committed
Apr 21, 2026 at 05:21 UTC
dbfb680772d5184544f7c0a8bba96bec229c96e6
1 file changed
+12
accel/mshv/mshv-all.c
+12
@@ -714,11 +714,23 @@ static const TypeInfo mshv_accel_type = {
714
.instance_size = sizeof(MshvState),
715
};
716
717
+/*
718
+ * MSHV manages secondary processors in the hypervisor. SIPI for x86 and
719
+ * PSCI for Arm are handled internally. Halted vCPUs must still enter
720
+ * mshv_cpu_exec() so that MSHV_RUN_VP is called and the hypervisor will
721
+ * wake APs.
722
+ */
723
+static bool mshv_vcpu_thread_is_idle(CPUState *cpu)
724
+{
725
+ return false;
726
+}
727
+
728
static void mshv_accel_ops_class_init(ObjectClass *oc, const void *data)
729
{
730
AccelOpsClass *ops = ACCEL_OPS_CLASS(oc);
731
732
ops->create_vcpu_thread = mshv_start_vcpu_thread;
733
+ ops->cpu_thread_is_idle = mshv_vcpu_thread_is_idle;
734
ops->synchronize_post_init = mshv_cpu_synchronize_post_init;
735
ops->synchronize_post_reset = mshv_cpu_synchronize_post_reset;
736
ops->synchronize_state = mshv_cpu_synchronize;