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 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 1E180CCD1BE for ; Thu, 23 Oct 2025 13:07:58 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vBv1f-0001Oz-PF; Thu, 23 Oct 2025 09:06:43 -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 1vBv1e-0001O4-O1 for qemu-arm@nongnu.org; Thu, 23 Oct 2025 09:06:42 -0400 Received: from mail-wm1-x32f.google.com ([2a00:1450:4864:20::32f]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1vBv1c-0006Hf-NA for qemu-arm@nongnu.org; Thu, 23 Oct 2025 09:06:42 -0400 Received: by mail-wm1-x32f.google.com with SMTP id 5b1f17b1804b1-471131d6121so6161775e9.1 for ; Thu, 23 Oct 2025 06:06:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1761224798; x=1761829598; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=+iYI+9qPb4lKcaT8r0cUl4054QjPkgSdWroSx2d2l+g=; b=vi6urhRuRJ7x9CKKrI9emrE4cpLqDGb7BODv/TScb63wRPOXidclzBPRZrmTobG6jI wGMf8UogLCiDRfi/X3MTpyIcyUeYTzQviSwADo7If1E+Yare81zkTFwll8sBTQErZ0UO UFX8TFPc/CA5eKMtvdLgtJyOa+/l6JVYxPXQEpli0ccDmgqsM4HFhqdlVwO3JccMoXye U1q/p2gSkjqhYF6gXKPkunfjxfjPFM5nzysGcFfoCN2UXnmCrY9UMjhQckQZJ53F/3vN qN/Bxm9UBUULFX7G0cT4hdq7Sb+1qGoCdyc+bUB2wc2FCsPEdru0N6YjG1mHREwtjJrE 2C6A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1761224798; x=1761829598; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=+iYI+9qPb4lKcaT8r0cUl4054QjPkgSdWroSx2d2l+g=; b=rCX4FM2lKFih5VMYNmIEUdcPh7P8gqTq48QEd+PxysQ/BkvLNbkJqYEV67qugg1xNr Gghxw/ZdwrYgvLlNsjalZ+Smw8MWtF/It/LuOhDi9OxA7BOu7Z1/YylkZyX7tHJ0x40A jBXNnVusYbJ/9QJOC/8sd+2fc9uPxK4NqtXMpXMdR0XfdZ/KN+kyq3klFyqBDqWgZF/r FgB2USFu+4Pei79khghvvrW6TX36fYPIoIBGRqnwxMIAXvYfTWTB+lkPe4Rv3JIzHhCH hbdV63zIocwApFvhhW2XdXmbDIgzg+AgRR0SXXol89ZaNyoiLg7zPWVC+UIhdEU7BBAB hlIA== X-Forwarded-Encrypted: i=1; AJvYcCUJQjhduhUyU3sryS489GEbMZKy9KcOVAAqUyMLz4A3/q+nPnUHqia/Lqj9CQSwboXU/LdueltA1Q==@nongnu.org X-Gm-Message-State: AOJu0YyPU9EnoIrZkxTK8UX1Ztotplz3B3xHhHP150h7UqBt4cStH2sd gTBGg3e/tOSnalVuiikflHOaySTvMQitAH4XAuNJ+a4n+m2PqkDvJlTkqTiYpDhDB/s= X-Gm-Gg: ASbGncv611V8/K/kEgzp4N0skubrYPPAu94L5AFjWo6ISbEiJn7rXa2WYq8CjTnC36l aZOLQL5+xttVFMSrRc2IvhgRu64EG2liHE5v1c7bv44QEBdqClpiQll62qc1GCDCXzf070ahxrC l2iFgi2ER3X3SANpcVlkiPCLjH/nb6UaNAsC8hU+lrjUmeGHWObfggkHy7usHqJQxGHM/t5AJIf XIuvBoVF9gxg+zzAmbmQq3BWBiMBLAEacUUme7YdQ276TlSrBTUS4+iCz9UHGMSi01g/WvV+CDJ NFMwHGulSbf07ALcOCsCUFUiNLMaE3l3i8CtqEB0ul5f9X6oTGPjL3gIlngHvCCEaJYfTDlK8SY NblY1h4/ySc21bADE0JQ3cFdP3JnkT+hdUsQTE8g5Lq5ZtHbJ2fv833HZCeu1Gu5h+d6C4JbpsN yTXIIasOstEll83z2zVbLNMfxGt7DCkkl2OoWohF5boc9a/5Glcg== X-Google-Smtp-Source: AGHT+IFO3tiqOSZiOxEn9gdYKzQwGcXYvLK0iWLousrE5gOvGzkWzXB9U2Eq8xGhqGRDgV6DwxlSYw== X-Received: by 2002:a05:600c:458b:b0:46e:4246:c90d with SMTP id 5b1f17b1804b1-471178774bfmr167520355e9.11.1761224797894; Thu, 23 Oct 2025 06:06:37 -0700 (PDT) Received: from localhost.localdomain (88-187-86-199.subs.proxad.net. [88.187.86.199]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-429897e763csm3983570f8f.6.2025.10.23.06.06.36 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Thu, 23 Oct 2025 06:06:37 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Paolo Bonzini , Richard Henderson , Mohamed Mediouni , Stefan Hajnoczi , Alexander Graf , Peter Collingbourne , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Cameron Esfahani , qemu-arm@nongnu.org, Mads Ynddal , Phil Dennis-Jordan , Peter Maydell , Roman Bolshakov Subject: [PATCH v2 44/58] accel/hvf: Have WFI returns if !cpu_has_work Date: Thu, 23 Oct 2025 15:06:20 +0200 Message-ID: <20251023130625.9157-3-philmd@linaro.org> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20251023114638.5667-1-philmd@linaro.org> References: <20251023114638.5667-1-philmd@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Received-SPF: pass client-ip=2a00:1450:4864:20::32f; envelope-from=philmd@linaro.org; helo=mail-wm1-x32f.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=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 Signed-off-by: Philippe Mathieu-Daudé --- target/arm/hvf/hvf.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/target/arm/hvf/hvf.c b/target/arm/hvf/hvf.c index cf4746c344a..8c2eac6738f 100644 --- a/target/arm/hvf/hvf.c +++ b/target/arm/hvf/hvf.c @@ -1749,6 +1749,13 @@ static void hvf_wfi(CPUState *cpu) uint64_t nanos; uint32_t cntfrq; + if (cpu_has_work(cpu)) { + /* Don't bother to go into our "low power state" if + * we would just wake up immediately. + */ + return; + } + if (cpu_test_interrupt(cpu, CPU_INTERRUPT_HARD | CPU_INTERRUPT_FIQ)) { /* Interrupt pending, no need to wait */ return; -- 2.51.0