From patchwork Tue Jun 18 20:20:32 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 805292 Delivered-To: patch@linaro.org Received: by 2002:a05:6000:144:b0:362:4979:7f74 with SMTP id r4csp371979wrx; Tue, 18 Jun 2024 13:21:14 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCX5Le2ajugkFnnsNwICFePyDWZsmzqBKyZ/0HFLac/B0hFHb1J9JhIF9dmnPUQa8BI0ejaUedccV3PuOnfqW5Se X-Google-Smtp-Source: AGHT+IFevvTgubGoeoi+MecDs0ROyS5IZVjtyKOXVPTljSnjCti8IDAaweCpTX+CO7DksaXjplzd X-Received: by 2002:a05:620a:4481:b0:796:842c:7804 with SMTP id af79cd13be357-79bb3e2df10mr72692385a.18.1718742074247; Tue, 18 Jun 2024 13:21:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1718742074; cv=none; d=google.com; s=arc-20160816; b=fO3xbP6n9iV+sfaeloIvaVrzOSsmdbbVLE5fR900kBI3Ke2NCKcpDlnPC0HnRMBCYZ BQtIhUUGcUUXRIkayINsWu5Z59n6nssTMH+feqKWng+IJvL0XF4MzlxLr6HfhWoU6w7z 2P+I+pmYZVOS3C+pa6e9jBcbVqzLqX0wXDcjhEoF1K6LSgGLw+lQNHwwsMHNVUB09u2k iCbRx8UWl3m5nW2w3GByjsL8Xck8b33B4Jz+HDYhExn8rZEBFhKOneqQ7ZiwS76y+5FE nKW2Px/03TN4mY2qlU0LhAVfjQQ8pxwL8TPN7Co4D5I5c2HRS9+pAvgNay8+jgdC1tFM 5sUA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=rVA+Vu4Mo6m4DphkREolWxSHwsbLZ4D72iVee/NbV7E=; fh=MVtmONGgcwaswePOsQaFbzD/JigNLxHXgB5l4X9593E=; b=rSXBuKEMtzeLdGGnYoilC22j10ILDXZzf4km/rVbR4zJldR6X3uq7vSVc/sxD2v7Jd 1VGY2tQ+515wYyTp3rqizEZeUtzRb5nr/jZ7jZidSSBurx56A1ihgDPDtDVYNxo1jhyy C3C6hvM/xIgr6fh2OTNl31EC6l5smkt6fnviLZT/nEA9+H60Xn1gEpotjyqZRcsyzLhp jqZ3QQctbbOVJecEUc7ztMUM0wEGlUKMdSM135NNf8BUctP+NY2GPzX4ASb36LOQs8p0 ud8tLKLgLrN5S9PcFiJMaV50sDGG8Ah2w7Hri3B8YwATTh7yrVsuHbv2CUADH2FHv08p KRcw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=rhbB7+Ut; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id af79cd13be357-798abd1d20esi1290197185a.467.2024.06.18.13.21.14 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 18 Jun 2024 13:21:14 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=rhbB7+Ut; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sJfJw-00064o-0c; Tue, 18 Jun 2024 16:20:48 -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 1sJfJs-00063j-Qq for qemu-devel@nongnu.org; Tue, 18 Jun 2024 16:20:44 -0400 Received: from mail-wm1-x334.google.com ([2a00:1450:4864:20::334]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sJfJr-00022C-2Y for qemu-devel@nongnu.org; Tue, 18 Jun 2024 16:20:44 -0400 Received: by mail-wm1-x334.google.com with SMTP id 5b1f17b1804b1-421757d217aso60947845e9.3 for ; Tue, 18 Jun 2024 13:20:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1718742041; x=1719346841; 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=rVA+Vu4Mo6m4DphkREolWxSHwsbLZ4D72iVee/NbV7E=; b=rhbB7+UtEdt/LM9+BkR+pAyRZ5gVUzhPH8VIwyHcJSvQf6bgkjNcVSmfzDQOV/TLgx IxYObnjUKla+yDsGV9zdeg/96scIhgbQzN/zQVX4yLbm0WJ902IGYnXx04keHtdn8+FC 1W0DWcDRwa+cDWtNb/NFjg6UM+KnTnDOI11xLfQdZZE/BzxX6gnSWEMKpPnGdmmqAcnC fzfjXvixZtCf7/mH2HzF3oA0LxLnB5tJy9Kb5KNwKwT4lUjQhAKKRdpOgXFuy5RtA3x/ HFdaoFIceQnyygrF5agR6IQj3KiEHPku9zO4cGeotCG+3YciEHGoKFc5iud4r5RI3dsV Hdqw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718742041; x=1719346841; 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=rVA+Vu4Mo6m4DphkREolWxSHwsbLZ4D72iVee/NbV7E=; b=gIuCCT3TRpzhQSSFJg8gPKpxXiibp3ZVk/VSJ8ILULJohJQAr9OvEGpg5brH/rtG1X 2oQvlQxDhXqk35UoznAr9si/LXQVkcrMTU2a/GRT0TriQSn5Z2OGeGbTscCoojG3Sqn+ xORCwYln+sBTuMpTVUNIB1bLgOqaI+wN4np9XAVDkBZPoxSXqu0gxt8Yi2vBOwWClju0 c5uLWwoP5rtAd6a5cYgDwM67wRbndpOiVLpqq6HnXOKHxFOqJ4xVLzyR9H9eD9zLjfjc 1smeaVdfGvNd9LUSSJi6MnJs/xhQ5/3znPDnkugRj24QkNvoSmyGPoBeU5D1W4PS/I6U AXMQ== X-Gm-Message-State: AOJu0YwzbtUgeJEzw+5RWqU+IDJluu4drWG02ShxVdDadAkPPkUZMCyy j/v1sEH7Ebk4KopUBmSwZ+jOpIkPfNOsFkGJKaNg7+qnHm4/c9nVGwI46+zeQkdFVJ21K3TR2xZ N X-Received: by 2002:a05:6000:11cb:b0:35f:2667:8b4d with SMTP id ffacd0b85a97d-36317c79fdbmr531891f8f.40.1718742040897; Tue, 18 Jun 2024 13:20:40 -0700 (PDT) Received: from m1x-phil.lan ([176.187.212.55]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-360750f2295sm15058039f8f.82.2024.06.18.13.20.39 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Tue, 18 Jun 2024 13:20:40 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Peter Maydell , =?utf-8?q?Philippe_Mathieu-Dau?= =?utf-8?q?d=C3=A9?= , Richard Henderson Subject: [PULL v2 56/76] accel/tcg: Make TCGCPUOps::cpu_exec_halt mandatory Date: Tue, 18 Jun 2024 22:20:32 +0200 Message-ID: <20240618202032.40268-2-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240618202032.40268-1-philmd@linaro.org> References: <20240618202032.40268-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::334; envelope-from=philmd@linaro.org; helo=mail-wm1-x334.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, T_SCC_BODY_TEXT_LINE=-0.01 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: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org From: Peter Maydell Now that all targets set TCGCPUOps::cpu_exec_halt, we can make it mandatory and remove the fallback handling that calls cpu_has_work. Signed-off-by: Peter Maydell Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Richard Henderson Message-ID: <20240603160933.1141717-4-peter.maydell@linaro.org> Signed-off-by: Philippe Mathieu-Daudé --- include/hw/core/tcg-cpu-ops.h | 9 ++++++--- accel/tcg/cpu-exec.c | 7 +------ 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/include/hw/core/tcg-cpu-ops.h b/include/hw/core/tcg-cpu-ops.h index 099de3375e..34318cf0e6 100644 --- a/include/hw/core/tcg-cpu-ops.h +++ b/include/hw/core/tcg-cpu-ops.h @@ -122,10 +122,13 @@ struct TCGCPUOps { * to do when the CPU is in the halted state. * * Return true to indicate that the CPU should now leave halt, false - * if it should remain in the halted state. + * if it should remain in the halted state. (This should generally + * be the same value that cpu_has_work() would return.) * - * If this method is not provided, the default is to do nothing, and - * to leave halt if cpu_has_work() returns true. + * This method must be provided. If the target does not need to + * do anything special for halt, the same function used for its + * CPUClass::has_work method can be used here, as they have the + * same function signature. */ bool (*cpu_exec_halt)(CPUState *cpu); /** diff --git a/accel/tcg/cpu-exec.c b/accel/tcg/cpu-exec.c index 6711b58e0b..8be4d2a133 100644 --- a/accel/tcg/cpu-exec.c +++ b/accel/tcg/cpu-exec.c @@ -682,13 +682,8 @@ static inline bool cpu_handle_halt(CPUState *cpu) #ifndef CONFIG_USER_ONLY if (cpu->halted) { const TCGCPUOps *tcg_ops = cpu->cc->tcg_ops; - bool leave_halt; + bool leave_halt = tcg_ops->cpu_exec_halt(cpu); - if (tcg_ops->cpu_exec_halt) { - leave_halt = tcg_ops->cpu_exec_halt(cpu); - } else { - leave_halt = cpu_has_work(cpu); - } if (!leave_halt) { return true; }