Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id D843AD39427 for ; Thu, 2 Apr 2026 13:47:20 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1w8ILG-0008Mh-ND; Thu, 02 Apr 2026 09:44:14 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1w8IKu-0004lE-1u; Thu, 02 Apr 2026 09:43:53 -0400 Received: from linux.microsoft.com ([13.77.154.182]) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1w8HYD-0008Sy-GI; Thu, 02 Apr 2026 08:53:34 -0400 Received: from localhost (unknown [131.107.147.136]) by linux.microsoft.com (Postfix) with ESMTPSA id C5BFA20B7017; Thu, 2 Apr 2026 05:53:04 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com C5BFA20B7017 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1775134384; bh=Lda5boUb4MXundo8aUjZAsYLSyCiH0MhXZAZjJi/qsk=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=c9ajY54Gr6CPLnq6mcK557XFy8Rg/MLiu3HIMLWIPC+8HxPzEGrws6KLrkPzuZN8t wrYLKpTNyqfeweJqKgRZss8EGeFBgdfNJ7p71/dEdaU9faHhJ2tFYsEMUhFUg3f1TU JrtuLdfvHckeUYz0Kt+57PLkEY+D6bNWx5tvuLT4= From: Aastha Rawat Date: Thu, 02 Apr 2026 12:52:36 +0000 Subject: [PATCH v2 09/14] accel/mshv: implement cpu_thread_is_idle() hook MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <20260402-mshv_accel_arm64_supp-v2-9-754895c15e9e@linux.microsoft.com> References: <20260402-mshv_accel_arm64_supp-v2-0-754895c15e9e@linux.microsoft.com> In-Reply-To: <20260402-mshv_accel_arm64_supp-v2-0-754895c15e9e@linux.microsoft.com> To: qemu-devel@nongnu.org Cc: Magnus Kulke , Wei Liu , Paolo Bonzini , =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Peter Maydell , Anirudh Rayabharam , Aastha Rawat , Magnus Kulke , qemu-arm@nongnu.org, Alexander Graf , Pedro Barbuda , Mohamed Mediouni X-Mailer: b4 0.15.1 Received-SPF: pass client-ip=13.77.154.182; envelope-from=aastharawat@linux.microsoft.com; helo=linux.microsoft.com X-Spam_score_int: -42 X-Spam_score: -4.3 X-Spam_bar: ---- X-Spam_report: (-4.3 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-arm@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-arm-bounces+qemu-arm=archiver.kernel.org@nongnu.org Sender: qemu-arm-bounces+qemu-arm=archiver.kernel.org@nongnu.org From: Magnus Kulke 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 Reviewed-by: Mohamed Mediouni --- accel/mshv/mshv-all.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/accel/mshv/mshv-all.c b/accel/mshv/mshv-all.c index 5ce76e86db..6c0ddbf3ca 100644 --- a/accel/mshv/mshv-all.c +++ b/accel/mshv/mshv-all.c @@ -704,11 +704,23 @@ static const TypeInfo mshv_accel_type = { .instance_size = sizeof(MshvState), }; +/* + * MSHV manages the LAPIC in the hypervisor. SIPI for APs are handled + * internally. Halted vCPUs must still enter mshv_cpu_exec() so that + * MSHV_RUN_VP is called and the hypervisor will deliver SIPI to wake APs. + */ + +static bool mshv_vcpu_thread_is_idle(CPUState *cpu) +{ + return false; +} + static void mshv_accel_ops_class_init(ObjectClass *oc, const void *data) { AccelOpsClass *ops = ACCEL_OPS_CLASS(oc); ops->create_vcpu_thread = mshv_start_vcpu_thread; + ops->cpu_thread_is_idle = mshv_vcpu_thread_is_idle; ops->synchronize_post_init = mshv_cpu_synchronize_post_init; ops->synchronize_post_reset = mshv_cpu_synchronize_post_reset; ops->synchronize_state = mshv_cpu_synchronize; -- 2.45.4