From mboxrd@z Thu Jan 1 00:00:00 1970 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 lists1p.gnu.org (lists1p.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 EA79CC4453A for ; Wed, 22 Jul 2026 21:17:47 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wmeJF-0000uf-BJ; Wed, 22 Jul 2026 17:16:57 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wmeJD-0000tk-Go; Wed, 22 Jul 2026 17:16:55 -0400 Received: from isrv.corpit.ru ([212.248.84.144]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wmeJB-00039o-Rd; Wed, 22 Jul 2026 17:16:55 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tls.msk.ru; s=202602; t=1784754991; bh=Bba5Oim6FU0PnmzdJ6395Tf/z4GtQW7QUrsJptKuN+A=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=r48U0XZSdKITvmgKleVzxYdnPwQjMzmpOyRZ+zLClmbAkuSGOLqw+qasjOR0QT6kv S1po0+Jg0He4msA2QIoIbzYupXC+uiJzBXroF/woOz1CvG6MppxXWHNEgWjT3JGH1l R2O+1OI3b882YoLLtMMTB9mBsScLZBatHfTOeJjGHWFRLZI3ZmY8Dmxdr15v5+c9or KgXJmoW5xR7a4bmicL00qMGaxTwQrl4yQlor6UF5sQwgDoXZhVG2td1c2U70RRKoDG lNGKhFUVNEdX7qjpMol9ZTLGYJz19IaMGNpIS89+kdjJKGUj0BRTznFcjJo3mjk6cR jXNWKt12WKM5A== Received: from tsrv.corpit.ru (tsrv.tls.msk.ru [192.168.177.2]) by isrv.corpit.ru (Postfix) with ESMTP id B94061C3D3D; Thu, 23 Jul 2026 00:16:31 +0300 (MSK) Received: from gandalf.tls.msk.ru (mjt.wg.tls.msk.ru [192.168.177.130]) by tsrv.corpit.ru (Postfix) with ESMTP id B6FC73F39F9; Thu, 23 Jul 2026 00:16:49 +0300 (MSK) Received: by gandalf.tls.msk.ru (Postfix, from userid 1000) id BFCEB1805E; Thu, 23 Jul 2026 00:16:40 +0300 (MSK) From: Michael Tokarev To: qemu-devel@nongnu.org Cc: qemu-stable@nongnu.org, =?UTF-8?q?Alex=20Benn=C3=A9e?= , Peter Maydell , Richard Henderson , Michael Tokarev Subject: [Stable-11.0.3 v3 129/129] target/arm: do not clear halting reason in has_work helper Date: Thu, 23 Jul 2026 00:16:28 +0300 Message-ID: <20260722211634.251325-2-mjt@tls.msk.ru> X-Mailer: git-send-email 2.47.3 In-Reply-To: References: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Received-SPF: pass client-ip=212.248.84.144; envelope-from=mjt@tls.msk.ru; helo=isrv.corpit.ru X-Spam_score_int: -19 X-Spam_score: -2.0 X-Spam_bar: -- X-Spam_report: (-2.0 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org From: Alex Bennée The helper will be called multiple times as we exit a loop and until we actually restart (via arm_cpu_exec_halt) we should leave the condition the same. Fixes: 6fd2fcdc61b (target/arm: teach arm_cpu_has_work about halting reasons) Fixes: aefafd403bd in 11.0.x series Reviewed-by: Peter Maydell Signed-off-by: Alex Bennée Reviewed-by: Richard Henderson Message-id: 20260624103049.884930-4-alex.bennee@linaro.org Signed-off-by: Peter Maydell (cherry picked from commit c2804566f65493f83003798d063a20f34681a5c4) Signed-off-by: Michael Tokarev diff --git a/include/hw/core/sysemu-cpu-ops.h b/include/hw/core/sysemu-cpu-ops.h index 7b2d2d2610f..32622e41cfb 100644 --- a/include/hw/core/sysemu-cpu-ops.h +++ b/include/hw/core/sysemu-cpu-ops.h @@ -18,6 +18,9 @@ typedef struct SysemuCPUOps { /** * @has_work: Callback for checking if there is work to do. + * + * This function should be idempotent (i.e. not change state) as + * it will likely be queried multiple times before a CPU resumes. */ bool (*has_work)(CPUState *cpu); /* MANDATORY NON-NULL */ /** diff --git a/target/arm/cpu.c b/target/arm/cpu.c index 124be8c401e..54748d62c8a 100644 --- a/target/arm/cpu.c +++ b/target/arm/cpu.c @@ -157,7 +157,6 @@ static bool arm_cpu_has_work(CPUState *cs) * A wake-up event should only wake us if we are halted on a WFE */ if (cpu->env.halt_reason == HALT_WFE && cpu->env.event_register) { - cpu->env.halt_reason = NOT_HALTED; return true; } @@ -169,7 +168,6 @@ static bool arm_cpu_has_work(CPUState *cs) | CPU_INTERRUPT_NMI | CPU_INTERRUPT_VINMI | CPU_INTERRUPT_VFNMI | CPU_INTERRUPT_VFIQ | CPU_INTERRUPT_VIRQ | CPU_INTERRUPT_VSERR | CPU_INTERRUPT_EXITTB)) { - cpu->env.halt_reason = NOT_HALTED; return true; } @@ -794,6 +792,8 @@ bool arm_cpu_exec_halt(CPUState *cs) if (cpu->wfxt_timer) { timer_del(cpu->wfxt_timer); } + /* clear the halt reason */ + cpu->env.halt_reason = NOT_HALTED; } return leave_halt; } -- 2.47.3