From nobody Sat Oct 24 00:32:26 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=reject dis=none) header.from=oss.qualcomm.com ARC-Seal: i=1; a=rsa-sha256; t=1790790620; cv=none; d=zohomail.com; s=zohoarc; b=h2YwowaMgCVAJHepmRo61dEsVAK4mV3n424UC9L7i/gVt/968Zt8cmhjNWPDfAzGwhfe0VaauuxLEck3fQ37p93d0ctsv1mvkk03514QG/AQT0b66bTa6cmK7p6rSuP0224edN/90OHtjiHrrrkgX0NWJoYKwdVeJONeyCDMfs8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1790790620; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=X8K/gkHcr8Z+4uB9LSTsZhx+DdfNVx9hCiBCP7+bDiA=; b=LUYKEtqbHG5HJ9SO8IhVR57EE0Wq9h8T04TYMrn1JldRZMrv/nV7ye4W8G+Tps8Qpq/Ja+Ru1scbX4OH7Bnjjkc/bMf3TakOnzu4fkbpNwZ10IUVDWjkSBIECzj5+hmG9vkRKLBqfe1JohyV8MnNIHsi+RehbbQjxcs+uqPbXOk= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=reject dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1790790620259181.2859857668103; Wed, 30 Sep 2026 10:50:20 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1xByRM-0001Pd-Tt; Wed, 30 Sep 2026 13:50:00 -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 1xByRL-0001PH-2d for qemu-devel@nongnu.org; Wed, 30 Sep 2026 13:49:59 -0400 Received: from mx0b-0031df01.pphosted.com ([205.220.180.131]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1xByRJ-0001IS-MP for qemu-devel@nongnu.org; Wed, 30 Sep 2026 13:49:58 -0400 Received: from pps.filterd (m0279872.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 68UHelgD3463970 for ; Wed, 30 Sep 2026 17:49:56 GMT Received: from mail-qk1-f198.google.com (mail-qk1-f198.google.com [209.85.222.198]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4h16wcr2pd-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Wed, 30 Sep 2026 17:49:56 +0000 (GMT) Received: by mail-qk1-f198.google.com with SMTP id af79cd13be357-93a0b66ecd9so872909585a.2 for ; Wed, 30 Sep 2026 10:49:56 -0700 (PDT) Received: from localhost.localdomain (pmd666.hd.free.fr. [88.187.86.199]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-48b0692b1c9sm632828f8f.27.2026.09.30.10.49.54 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Wed, 30 Sep 2026 10:49:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qualcomm.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=qcppdkim1; bh= X8K/gkHcr8Z+4uB9LSTsZhx+DdfNVx9hCiBCP7+bDiA=; b=RP2Ri7INKN41+xPY qcBxN0+g1zv/kcWJjCFc3ObRBt/u6AwllwmC+z+uwGfVQnLoA1UWCMWh9z9tss7t fpoUaleErr4ZX8wYgfM8LhdGb+jpbIV9AiNLYbYcFifP9mh41H90vXqr0j/qJbvE BvjZHJtJESmHWKmCXo33TS5oTtg5FDFG9i2Fsd6SnJMyrdmCQ+2+yRvBoZSCtpez yX13c74ayJFMGr3LFKcSj4Tt0yBRLLX4SpzsIoPQSpwO0a0eppTYeJkr7PnmOp4K wET+ct1JViKnaSlbp7MNM2m7hSm4WhXXUpHA+/vT3TEFoUaQMRKPf2RVuJX9eM4k q+HuEQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1790790596; x=1791395396; darn=nongnu.org; h=content-transfer-encoding:content-type:mime-version:references :in-reply-to:message-id:date:subject:cc:to:from:from:to:cc:subject :date:message-id:reply-to:content-type; bh=X8K/gkHcr8Z+4uB9LSTsZhx+DdfNVx9hCiBCP7+bDiA=; b=PR/A7NsafS0J5hNUpAVv9NVM8oI0fdd8Q7oJDbbipTAwZ/vwJSGiPtpKJJvYoHV2o0 3shwz9jy91vq56LmiHya+kLQzFeJem/vIZ2dna9hHJr2RbHeuE5+bbRu4jV9HcR2Hy/W iFlvTdGqYK53J5N90P0fLwXBypeAWtSongPm9gWhQ+xr8f/exo9e3E6SgqC05TTq5ddB HCqlZsC8DozAB1A+pd4+uC5Zudn5xE2RJhTnA2TjQToDuimYV7wo4ynZCO5YmLUw/IbC aucHLlo4htKccZwrvm9maxDftW9D024mZO7SlDfLXKIWikYRMAlbpcIHXi4oMh5+r+xA +7NQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1790790596; x=1791395396; h=content-transfer-encoding:content-type:mime-version:references :in-reply-to:message-id:date:subject:cc:to:from:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=X8K/gkHcr8Z+4uB9LSTsZhx+DdfNVx9hCiBCP7+bDiA=; b=F12eyY0n9ZvswKCKpBJd2w8Cmv6N3W7e+Mo/o7ZWQ2OHBa+B+iJCcuVADCikFZDzUK jF9/YyfbXITKm3nebsqxf7wQ6Aai7Yk4j1vDb2n4HoLWAMTkSzv+eAYxDAWCcuqiQ3k8 2l84IxGoiB319sIMrcOJoxj7PveTaA3xgK31YIMyBCKvV5wJUMBekhHT54yoEKK+ByJf 3AqFjsj6I2eb7lnouyhfaKjPNfsR+F0Hf/g6TEtIchzjuQV0dKDbg0byJO2VHCRD0G+E 9IYjrfp6gxXhP6J/QBlolT5vKpoYCpN/vSh018kwXxV5T/h2AjMXDq71RLVKMYEVontu rONQ== X-Gm-Message-State: AFuF++ldJGwOgDlnD8WGu+27aVl0MC0fk+Bcpu4mYe2GV1bGapE+yE5t mAY1TXwPJzPwHpZ3PnDMz593Hdr09rm54aLOCU9p3Y0RRExy2feMC9iCsh0EebdFQSkYCaYFTMC dQTy/nEMAk6ut2m4RD9CMHC67H3JZc1AqacKw2S4HAezNBsnlg7UMLof8Fx9wKFjMyw== X-Gm-Gg: AYBFou1vk/0Snvk7IC7SqGr/EM6713Bw94Rq8FDLlxwUr/Ntj1+eRWjtjVLGf6h2mYv gWslZAn5uO3DXJiPEYry3Mqqfn8jznACdbFoiPZfCu0i6rZ6bN9qzjW0wgcI3w2u+G7RjeVHLlO cgnbCteSwbdrb4kVQFCC4ykGXYxCRnDcMIDoVckN240zLuLW7nXEpI3xbLfu1/qvkE3Y+T2o75h l7jfZ8Sy6+ZeZlhT48WyJ2CaLWZawsERxW+IqfU2FNLh0ZyQcJ786ErjYKh/t0PtqEELQiuudnr lm+wF0FOpVBJ5JMJZ+9bsJQMC/EqK0F/aUb49/UCnr5sOAsJ7h8PsL2gR7nqn7C2lbbcQJqXUYb ysexa2nyoIb9SRn6Usd829BGAvqmiK0ePE8YLhkLJ X-Received: by 2002:a05:620a:4890:b0:93b:d79a:c469 with SMTP id af79cd13be357-93cac26261fmr353386685a.65.1790790595841; Wed, 30 Sep 2026 10:49:55 -0700 (PDT) X-Received: by 2002:a05:620a:4890:b0:93b:d79a:c469 with SMTP id af79cd13be357-93cac26261fmr353380385a.65.1790790595307; Wed, 30 Sep 2026 10:49:55 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Richard Henderson , Peter Maydell , Paolo Bonzini , qemu-arm@nongnu.org, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PATCH v4 1/9] accel/tcg: Refactor poll-while-halted flow in cpu_exec() Date: Wed, 30 Sep 2026 19:49:37 +0200 Message-ID: <20260930174946.82195-2-philmd@oss.qualcomm.com> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260930174946.82195-1-philmd@oss.qualcomm.com> References: <20260930174946.82195-1-philmd@oss.qualcomm.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwOTMwMDA3MSBTYWx0ZWRfX+kZk/5/R0cDm bjMxVxmol0kEjl51LI8UZjUq6KgaSUqbYlT8jmAy2EGp430oF1kCNG0LCalWnzHFNcc1QfYZk8/ I0oVPOdkI02fOHapYTRqG+5z7yEEECpoEmoOmGlMGAbCKS1gBIANUCDTbM05rhp08Ce5guzJkXG K9cWo0pU+zEI77yGNIvpB6rmp3QFnBRIBZOSvMqfhL4Scrm6uoAiQTZXO8Nlng8w2X0WODCPMCn Smwx683mNgeoccum3iO5/xs/rbvmRKqt6mtRgPSgPPqql1QH/gu5qWgRE5sRikVrsvrIRRhqBo8 b210vXizmmYwW+3xmmb28Ec7KIP5BwaA90vIlHdiL8XXXlLSUczWh0lDSkuq6eyL11mn7VID0vR wNuiK3LvtcKSIQpgrK3qHIQ6f1CQbEtQMmd/cjIOVWWGcJiKOWbjFcICjJmIofKT+EDhY7QvL0T 2x4pCPNCByJONeXR86w== X-Proofpoint-GUID: Ob7ApfpwjXzyENaYhScTGH1SDK-ZDIIG X-Proofpoint-Spam-Info: AW1haW4tMjYwOTMwMDA3MSBTYWx0ZWRfXwLmpnjtAKArq H+a85jKhCFQuGdiuKPAbbsJx5HR9kQCA1fkTPCIqLQFuiDFrbZcwkS+k/Mv4PFCsYzrci+ejdfb I7NblQAcql5qPqqg1uoOrIIHPOVPq3E= X-Authority-Analysis: v=2.4 cv=S51MU4sP c=1 sm=1 tr=0 ts=6abd4bc4 cx=c_pps a=qKBjSQ1v91RyAK45QCPf5w==:117 a=4s3hRJSeHn4rkQlkrse1kQ==:17 a=IkcTkHD0fZMA:10 a=VdqzKS8jKosA:10 a=M51BFTxLslgA:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=u7WPNUs3qKkmUXheDGA7:22 a=yx91gb_oNiZeI1HMLzn7:22 a=EUspDBNiAAAA:8 a=KKAkSRfTAAAA:8 a=xF3Xt6V14tk6trZ56bgA:9 a=3ZKOabzyN94A:10 a=QEXdDO2ut3YA:10 a=O8hF6Hzn-FEA:10 a=NFOGd7dJGGMPyQGDc5-O:22 a=cvBusfyB2V15izCimMoJ:22 X-Proofpoint-ORIG-GUID: Ob7ApfpwjXzyENaYhScTGH1SDK-ZDIIG X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1176,Hydra:6.1.134,FMLib:17.12.100.49 definitions=2026-09-30_04,2026-09-21_02,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 suspectscore=0 phishscore=0 priorityscore=1501 clxscore=1015 impostorscore=0 lowpriorityscore=0 spamscore=0 adultscore=0 bulkscore=0 malwarescore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2609040000 definitions=main-2609300071 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists1p.gnu.org; Received-SPF: pass client-ip=205.220.180.131; envelope-from=philmd@oss.qualcomm.com; helo=mx0b-0031df01.pphosted.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 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_LOW=-0.7, 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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @qualcomm.com) X-ZM-MESSAGEID: 1790790623105158500 Invert cpu_handle_halt()'s logic to read in cpu_exec() as "if halted, poll for async events and find work; if no work, return". Rename as cpu_poll_while_halted(). Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Richard Henderson --- accel/tcg/cpu-exec.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/accel/tcg/cpu-exec.c b/accel/tcg/cpu-exec.c index 5b4bca5084f..853c4b2f67a 100644 --- a/accel/tcg/cpu-exec.c +++ b/accel/tcg/cpu-exec.c @@ -656,18 +656,18 @@ static inline void tb_add_jump(TranslationBlock *tb, = int n, } =20 #ifndef CONFIG_USER_ONLY -static inline bool cpu_handle_halt(CPUState *cpu) +static bool cpu_poll_while_halted(CPUState *cpu) { const TCGCPUOps *tcg_ops =3D cpu->cc->tcg_ops; bool leave_halt =3D tcg_ops->cpu_exec_halt(cpu); =20 if (!leave_halt) { - return true; + return false; } =20 cpu->halted =3D 0; /* allow execution */ =20 - return false; + return true; } #endif /* !CONFIG_USER_ONLY */ =20 @@ -1029,7 +1029,7 @@ int cpu_exec(CPUState *cpu) =20 #ifndef CONFIG_USER_ONLY if (cpu->halted) { - if (cpu_handle_halt(cpu)) { + if (!cpu_poll_while_halted(cpu)) { return EXCP_HALTED; } assert(!cpu->halted); --=20 2.55.0 From nobody Sat Oct 24 00:32:26 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=reject dis=none) header.from=oss.qualcomm.com ARC-Seal: i=1; a=rsa-sha256; t=1790790643; cv=none; d=zohomail.com; s=zohoarc; b=ZvygwhLIQzhQf4glHVf2ULX7aucP/p9zh9ySc09WbAMkwORIP8NMSYCckeCuujUt8wK+FoGw0E67yxnaP/eVF4Da9YU0Y2sTlmfW77Iuyi5zlcj5LiDeQvddFzOktqwtWCtAHoQ06Vtv9VTbGWjcXgToBRNPWvmGLZQ3LxjJD34= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1790790643; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=ivKXbJVdp1NK7x91XcxNYvkjqxRlN7x4uLPtErdpCvo=; b=hy2Wu09iR0/3aI6nMscpAXs/6YSxWxqdCt1PbKb54ZmQKe0SuGfJhxx1MVHZ8vpDTsy6mejmRpcM0M1zZL/MDxsgWkrOPMN/Enrx5z2aXEFd3W5h4KY8oyuHDAAuS3kKt6vGkmvVRWSXSAGmMGuEn5huiAwtVStX8VRURWfHz48= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=reject dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1790790643942294.4928225874395; Wed, 30 Sep 2026 10:50:43 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1xByRa-0001ej-4J; Wed, 30 Sep 2026 13:50:19 -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 1xByRS-0001Rp-HN for qemu-devel@nongnu.org; Wed, 30 Sep 2026 13:50:08 -0400 Received: from mx0b-0031df01.pphosted.com ([205.220.180.131]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1xByRQ-0001Uc-Pb for qemu-devel@nongnu.org; Wed, 30 Sep 2026 13:50:06 -0400 Received: from pps.filterd (m0279873.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 68UHelhw4160745 for ; Wed, 30 Sep 2026 17:50:04 GMT Received: from mail-ua1-f69.google.com (mail-ua1-f69.google.com [209.85.222.69]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4h167pgavq-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Wed, 30 Sep 2026 17:50:03 +0000 (GMT) Received: by mail-ua1-f69.google.com with SMTP id a1e0cc1a2514c-98087b0c5deso4377967241.2 for ; Wed, 30 Sep 2026 10:50:03 -0700 (PDT) Received: from localhost.localdomain (pmd666.hd.free.fr. [88.187.86.199]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-48b0692b5d7sm628089f8f.28.2026.09.30.10.50.01 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Wed, 30 Sep 2026 10:50:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qualcomm.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=qcppdkim1; bh= ivKXbJVdp1NK7x91XcxNYvkjqxRlN7x4uLPtErdpCvo=; b=VaYRc7/03M1vhhRX ZQG4dIbj1k7m+8LxYVAsb7cqAeU+u6dJJZ3kPOyMWNff7yQah2aDWQray1lJ+Y1s 2O4C+j5fymuw7p2CwSBWVZomocurZcHnvZxEY1Om39rzQvc3E1cPXpE/SQNeSczm 0YHmaGrJpi33UDtakXg81t2vQMDNCxEpALlGgoNvOqB4cK9rjZ223t9dW3xDxfjI gQcjvgKO4Wb0fBxPcD5HAad4h4pxfVYc60NS8P7ttTuBc01OBZjgv56WUgkUrH+Y ktmcPhHeH0V9UappCMILbY9KwQwh+sTjoxkEms3HgJlcXtDSHjCr2BsVxcbf/7qu tQz38w== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1790790603; x=1791395403; darn=nongnu.org; h=content-transfer-encoding:content-type:mime-version:references :in-reply-to:message-id:date:subject:cc:to:from:from:to:cc:subject :date:message-id:reply-to:content-type; bh=ivKXbJVdp1NK7x91XcxNYvkjqxRlN7x4uLPtErdpCvo=; b=UzjMf+/eQTE1mFNHF6HC67/d3qu9ubU5Swxy314rmlukIbBVzK+yXwClYz7kLqFZuq iYKfqcwvIweZO7R++8tS0Lp3+TLL9kU8dmQ6c8fWAoaIX6KShEu6nUe4cT5ew2P/QIrc uadmAW2nw5ubEtVEg6C8oWTCC+xhLTary52OPEPMNwGQ+8BTHDC5U4QBW4otV6AZr2BN CjJ2iCHqlkMzyJyZbmm3xIVd//HPcMHoZ04+B1NLOMlUPh4hvUa2o5e47jz97XzZkPmJ O9rhUfBWfOKKEzFiTw2CCOwUHteEAEWpPS8ZWzF+fMaG0FHdOdk+3g1EMyR+EEBu3NVW gDUA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1790790603; x=1791395403; h=content-transfer-encoding:content-type:mime-version:references :in-reply-to:message-id:date:subject:cc:to:from:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=ivKXbJVdp1NK7x91XcxNYvkjqxRlN7x4uLPtErdpCvo=; b=MWjrWkvs102fWzDNCpuxGMVUnDeBx3ag5ejmSM3GB12lczs95+Om7fG2frFKu3NrC6 9++oCq5vC+yCC5wgoNfpLjLfk5JyGoqQ2hp9OrzAW3aflOBnxqwPIbXq+mGtRWCTS2OA fPrDA0K0EcFkGeTHvtKORgyXdAxWhulkF5PzWNbFiitGmi3CKmHSYrgU08ZnLGtd6ZUM dqsjmOzgg7+/ejgznNtCvto4VE3flcNGRif2QV7mzPgBOB6NJIn5ar8FaeL/YWGGi+Bz fwBQzGmO3B+2bj2GZVkV6LKqUMGLEJvfZmKmcB+PIaZH9G2FSLoNO07DHa36cPh6YWg7 AJhQ== X-Gm-Message-State: AFq9FYKH6TJY0ZbzBg/BlrnoPAzhhxP8pL/YXALB9I0KXRt+vo2oyHHR xULdaNTi1HXIaCHYWVTUhTQn11YaCBPWpRwQ/rv9WMk/XO8Po+DnUHdelXk4ep64UELecsruawD TMZY1bJzkMRZtAKrK9w23usaYeMOgAEf9T0h9EvMDuHtY9cb5tlaRRItP6gQ66QJFCg== X-Gm-Gg: AYBFou2cS5QuUuCUx5Ifi4CrglgZezKHGnhCWF4zP1VW5UGz8uaL2geJYZiGM5MbDWB IDI0yQuK5ItndSdgWENBVOGWvjJP0NNhQvyfsoDXpJ9cqCyGAwLmpdpqWze+br7k4sgwowVQnfi hXGV6jvKSdbXj7pCGwpIicbLl7bg7Zj3JZfHhn/bGVDZTxQcnPVpplYVP+DgOrl0ZK525oM4xBR bJc3V1+0M1KTTbJi5eQHGNB22w28Srr1LKx235zBnVXRtaResKZXMKpMvq9Ax9/Zvt+DgJNuEeU QHftxGmUjoRR5KDndp+dI7WfoMfZASQhtq2zLuHbqVzno6MYy3MOYa3jFlRNtVYWSKJmfeVBe3x tzyKbqV56ydKJXMap2uWyjvwQSNWgVgBY2QDv3Uyh X-Received: by 2002:a05:6102:54a1:b0:7b2:c1b1:1d0 with SMTP id ada2fe7eead31-7be729ac2a0mr712646137.11.1790790602940; Wed, 30 Sep 2026 10:50:02 -0700 (PDT) X-Received: by 2002:a05:6102:54a1:b0:7b2:c1b1:1d0 with SMTP id ada2fe7eead31-7be729ac2a0mr712635137.11.1790790602467; Wed, 30 Sep 2026 10:50:02 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Richard Henderson , Peter Maydell , Paolo Bonzini , qemu-arm@nongnu.org, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PATCH v4 2/9] accel/tcg: Introduce poll_during_halt() and leaving_halt() Date: Wed, 30 Sep 2026 19:49:38 +0200 Message-ID: <20260930174946.82195-3-philmd@oss.qualcomm.com> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260930174946.82195-1-philmd@oss.qualcomm.com> References: <20260930174946.82195-1-philmd@oss.qualcomm.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Proofpoint-ORIG-GUID: VpZCRkAjoJnXKqwOpqoAIaWFnRCbCtGj X-Proofpoint-Spam-Info: AW1haW4tMjYwOTMwMDA3MSBTYWx0ZWRfX8NNwvyPldod2 omyF5PgHU17ovDO4fS7ZlfqDwVey/V3giwXQnr4VXAmvZd/M2benH0LJgkPCsdgWt8j/u6bON7Y tsSqDY70BARdwaJWSxnvR2+5hqgA6HE= X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwOTMwMDA3MSBTYWx0ZWRfX8uIZpc26cDZ2 WQg4DTWvRU0do6Un2I9hK1FF1Ea74LRUldJL6pSWAOcvpkfmC6y1FSUtvqa14xpqryEfntY38XG u77D80W9TbjaclTa5OI4BFzJ4patla1biSqat/iG2Wqjx5dOvDT/95LZAbqvT8/ZogTYdMEIxin y1OK2plUgm+YW1Wl+MZrnvcoGUcGrU6y5U00o2IAqsHtXKOwQ/LO1PUYKOh/bbg0f4Yjw27sAvo M6rN0dRPshqKWjRNgP907DH9+tRrA2jd7l5IPI6G3jhHV30dNHq3YgbekhK3rAg5OpjB8ZtLfDj ZA0HZuwnO30yXh2xxM7StG9lINnUZBxnfsFx7y5YQ7mmVNqoj2qpFmN38zUmEbyFmWj0goOh8SS ZuUezEiRvFi3mv3JFHkcfKBGahTX/aAi8OlmLR620+yt75h3r+0f06MGhp0VHjpuTRgQ/J7YjUt /7lPiyDKwL+/BIRSJwg== X-Proofpoint-GUID: VpZCRkAjoJnXKqwOpqoAIaWFnRCbCtGj X-Authority-Analysis: v=2.4 cv=WpC+otfv c=1 sm=1 tr=0 ts=6abd4bcb cx=c_pps a=UbhLPJ621ZpgOD2l3yZY1w==:117 a=4s3hRJSeHn4rkQlkrse1kQ==:17 a=IkcTkHD0fZMA:10 a=VdqzKS8jKosA:10 a=M51BFTxLslgA:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=u7WPNUs3qKkmUXheDGA7:22 a=rJkE3RaqiGZ5pbrm-msn:22 a=20KFwNOVAAAA:8 a=EUspDBNiAAAA:8 a=KKAkSRfTAAAA:8 a=DbqnPDNGgojIjNu1nyEA:9 a=3ZKOabzyN94A:10 a=QEXdDO2ut3YA:10 a=TOPH6uDL9cOC6tEoww4z:22 a=cvBusfyB2V15izCimMoJ:22 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1176,Hydra:6.1.134,FMLib:17.12.100.49 definitions=2026-09-30_04,2026-09-21_02,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 lowpriorityscore=0 phishscore=0 bulkscore=0 priorityscore=1501 suspectscore=0 malwarescore=0 impostorscore=0 adultscore=0 clxscore=1015 spamscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2609040000 definitions=main-2609300071 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists1p.gnu.org; Received-SPF: pass client-ip=205.220.180.131; envelope-from=philmd@oss.qualcomm.com; helo=mx0b-0031df01.pphosted.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 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_LOW=-0.7, 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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @qualcomm.com) X-ZM-MESSAGEID: 1790790644927158500 Split target-specific halt handling into an optional poll_during_halt() callback before cpu_has_work() and a leaving_halt() callback after work is found. Keep cpu_exec_halt() as a legacy alternative for targets that have not migrated. Require each target to provide either cpu_exec_halt() or leaving_halt(), but not both. Inspired-by: Paolo Bonzini Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Richard Henderson --- include/accel/tcg/cpu-ops.h | 24 +++++++++++++++++++++++- accel/tcg/cpu-exec.c | 21 +++++++++++++++++---- 2 files changed, 40 insertions(+), 5 deletions(-) diff --git a/include/accel/tcg/cpu-ops.h b/include/accel/tcg/cpu-ops.h index 3ff6e6810e0..1ee5d3d8bdb 100644 --- a/include/accel/tcg/cpu-ops.h +++ b/include/accel/tcg/cpu-ops.h @@ -169,6 +169,27 @@ struct TCGCPUOps { */ vaddr (*untagged_addr)(CPUState *cs, vaddr addr); #else + /** + * @poll_during_halt: Poll target-specific events while the CPU is hal= ted. + * @cpu: vCPU context + * + * Called when the CPU is halted to handle target-specific asynchronous + * event processing before instruction execution begins. + * The caller does not hold the BQL. + */ + void (*poll_during_halt)(CPUState *cpu); + /** + * @leaving_halt: Perform target-specific cleanup before resuming + * execution. + * @cpu: vCPU context + * + * Called after a halted CPU has detected pending work and is about to + * resume execution from the halted state. This callback performs any + * necessary target-specific state transitions or synchronization befo= re + * instruction execution resumes. The caller does not hold the BQL. + * Either this callback or @cpu_exec_halt must be provided (but not bo= th). + */ + void (*leaving_halt)(CPUState *cpu); /** @do_interrupt: Callback for interrupt handling. */ void (*do_interrupt)(CPUState *cpu); /** @cpu_exec_interrupt: Callback for processing interrupts in cpu_exe= c */ @@ -185,7 +206,8 @@ struct TCGCPUOps { * if it should remain in the halted state. (This should generally * be the same value that cpu_has_work() would return.) * - * This method must be provided. If the target does not need to + * Either @leaving_halt or this method must be provided, but not both. + * If the target does not need to * do anything special for halt, the same function used for its * SysemuCPUOps::has_work method can be used here, as they have the * same function signature. diff --git a/accel/tcg/cpu-exec.c b/accel/tcg/cpu-exec.c index 853c4b2f67a..122ad9e2e49 100644 --- a/accel/tcg/cpu-exec.c +++ b/accel/tcg/cpu-exec.c @@ -48,6 +48,7 @@ #include "internal-common.h" #if !defined(CONFIG_USER_ONLY) #include "accel/tcg/iommu.h" +#include "hw/core/sysemu-cpu-ops.h" #endif =20 /* -icount align implementation. */ @@ -659,10 +660,22 @@ static inline void tb_add_jump(TranslationBlock *tb, = int n, static bool cpu_poll_while_halted(CPUState *cpu) { const TCGCPUOps *tcg_ops =3D cpu->cc->tcg_ops; - bool leave_halt =3D tcg_ops->cpu_exec_halt(cpu); =20 - if (!leave_halt) { - return false; + if (tcg_ops->leaving_halt) { + assert(!tcg_ops->cpu_exec_halt); + if (tcg_ops->poll_during_halt) { + tcg_ops->poll_during_halt(cpu); + } + if (!cpu_has_work(cpu)) { + return false; + } + tcg_ops->leaving_halt(cpu); + } else { + assert(!tcg_ops->poll_during_halt); + assert(cpu->cc->sysemu_ops->has_work =3D=3D tcg_ops->cpu_exec_halt= ); + if (!tcg_ops->cpu_exec_halt(cpu)) { + return false; + } } =20 cpu->halted =3D 0; /* allow execution */ @@ -1061,7 +1074,7 @@ bool tcg_exec_realizefn(CPUState *cpu, Error **errp) /* Check mandatory TCGCPUOps handlers */ const TCGCPUOps *tcg_ops =3D cpu->cc->tcg_ops; #ifndef CONFIG_USER_ONLY - assert(tcg_ops->cpu_exec_halt); + assert(tcg_ops->cpu_exec_halt || tcg_ops->leaving_halt); assert(tcg_ops->cpu_exec_interrupt); assert(tcg_ops->cpu_exec_reset); assert(tcg_ops->pointer_wrap); --=20 2.55.0 From nobody Sat Oct 24 00:32:26 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=reject dis=none) header.from=oss.qualcomm.com ARC-Seal: i=1; a=rsa-sha256; t=1790790671; cv=none; d=zohomail.com; s=zohoarc; b=n8lfzGGPGduXwLdZ+Mq5QOk0qWGtHvEXLLbjYqrum4mwY0iU+NHO618Y5JC42KvkBDTiOpsjs8TGsL6kU2Svx3cUBvKDZ/5+zKuvcKJ4PrTB8vhYHqjCB0bGooujbev8kB79cm+ULt5tJamIa3eBO4RvTpJQnb8v7S/HadvuU+A= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1790790671; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=ViNswaydJ0+cMUUJ+NzSqjr4UFKKWviATdqXD8YSc0o=; b=fK0ZWWfz+zxRvFBzcO+WzvlX7bZoXg5cTV7j3jc6OdLLBYzlxkpjf/q21MwgxGSARKf5FNodQ+5G8/UZ+YEt29HrhqdMV/FjGSQfVpziDRntkDi3pW4NY518k0rqfBVp+3rdlqLLKOfGsenqXldXWyWUEU65uhw/vCuXQdN16hA= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=reject dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1790790671122541.0039208931553; Wed, 30 Sep 2026 10:51:11 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1xByRi-0001i2-IG; Wed, 30 Sep 2026 13:50:22 -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 1xByRZ-0001dE-7H for qemu-devel@nongnu.org; Wed, 30 Sep 2026 13:50:13 -0400 Received: from mx0b-0031df01.pphosted.com ([205.220.180.131]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1xByRX-0001VE-N4 for qemu-devel@nongnu.org; Wed, 30 Sep 2026 13:50:12 -0400 Received: from pps.filterd (m0279870.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 68UHexd7241777 for ; Wed, 30 Sep 2026 17:50:10 GMT Received: from mail-ua1-f69.google.com (mail-ua1-f69.google.com [209.85.222.69]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4h10bka2k6-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Wed, 30 Sep 2026 17:50:10 +0000 (GMT) Received: by mail-ua1-f69.google.com with SMTP id a1e0cc1a2514c-98331b577e4so4218290241.1 for ; Wed, 30 Sep 2026 10:50:10 -0700 (PDT) Received: from localhost.localdomain (pmd666.hd.free.fr. [88.187.86.199]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-48b06778c3fsm779562f8f.0.2026.09.30.10.50.08 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Wed, 30 Sep 2026 10:50:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qualcomm.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=qcppdkim1; bh= ViNswaydJ0+cMUUJ+NzSqjr4UFKKWviATdqXD8YSc0o=; b=SUIj4S1+SZ9m4t60 GeIS1LZr8qBUi+x3UthfrgBdI1UMabDxOI7gNRYTYsS4qFfP1xDaPViMw71KX+J8 6VCkKak4JTRUDQgEGE6qYn6tGZJQ+Bn41+DcIQgG7Z2s0Om5VVSa5h6AnMnWyzHo JaQKtLwbwYbfj8CNv5qyjeVQSMV0z7mzfgYUVN9g4ZkDJFt9mgLQEaeoYgiYAZOy Hv2Gy/rb7nj2lqPcC6zJeQ5ak78pnzTvkZEkXDhxgLNtIjisdpGOafZZvA396ABW pseO88zmmUlTjY68umDodhnfJGrjva5ZNEkexhKiAuvvUnXz+6h+X3rPu6Kj8KaQ R16yiQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1790790610; x=1791395410; darn=nongnu.org; h=content-transfer-encoding:content-type:mime-version:references :in-reply-to:message-id:date:subject:cc:to:from:from:to:cc:subject :date:message-id:reply-to:content-type; bh=ViNswaydJ0+cMUUJ+NzSqjr4UFKKWviATdqXD8YSc0o=; b=FosP0yoSclEav/FaS6u4tAE+hIYqdnsTuFB3NNolncfTr4Lxp7RN+m7M4KgvQYBCog 5bIcac8xsolxjnvzstyDSlxkKU2fUtOdPIFmzGCxkAymSAwuYOWaB91CY4JejN/tGsUz P1leHpd8dx9qdCwgh6g8L6P8LIlxqAaVHxeof8FTs4ZjehzH+nIOxQQgmERNVlCILkwb H+ELMCcvJsWfqR/4ahWjBMSxp18/GPcsxMp4BcrCGF0HMg8DfkEjNyPXMV14aQoaxg06 VP/6lC3lkVRFkEYvB8bC7VkuqR2zBnoos9plIJff96hO1NccPEP0e0N6mEfDBzzdY8ON ZRtQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1790790610; x=1791395410; h=content-transfer-encoding:content-type:mime-version:references :in-reply-to:message-id:date:subject:cc:to:from:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=ViNswaydJ0+cMUUJ+NzSqjr4UFKKWviATdqXD8YSc0o=; b=1jLG4iFLNqTvcQJHdJEeM26HWuIFbPLF67JCMu1u6SZKCVJnlrxSIfjeMzG/HDxU+4 3tcxBt0VvrEclHDjWAJB1wTa0pzCdvWctCrlnfpZjpXhAWK8+VkJZP3gBNrdOhXflTS+ HCe4BOsNlR3z7wVdkvncrWksY3Dg0Wp/cYq/7ssjPNB9dd8H+y2WKPSGReLSqOrxqerM trRzvV0F4yVML1i4L64QCAF2XZledYE33uaRxYDEK5yZNcxm1X6eXV2rh1l+s9DjKTwl qT0DYGlAbkKp/sfYQ2zF2aQqWkACvyX4DtK2d30RochiGa+n4Pf1JOuQMqKtnMvY10OG NAjA== X-Gm-Message-State: AFq9FYKN0LxXVmnk8EUr1j9ObvPFrTxHwJqHlBiCDQhw0TbIT9FXDCVJ bg6q1f7xUqmzzuXKZQ1NlbQM9bDDYUMA5xI0W2aeoEZqvol7f13j97zny4BbCoWpRlQhyE7gHXd SLQhsRb0X9wSG+RFH212Y236CLbLlslBOnwfo6eWFNXVqYwEUzcwTH7dz1W64BGN6Zg== X-Gm-Gg: AYBFou2MBhifKQUQ4YpcXOYpbKyatmxozK0O2PFz3lCj9u9cpUJ5yJLQ/SQFldRx9V1 dEt882Op8kmWBkuM2mJe0o/aR2DQN7mGpCL6OCmue51YsYY6c8e5zJidfjRuQxxXEANaNBbiL8y 6+U39rZ5GQXPlNsCRzl9mPyRoraw4xRHU8U1l3mkV7ntofswuTMqS8VQYAsFtHSneg28m9KENNa iVVzrw1SLlanzP6Tlg2oqjMgt0SkwnnxrLJd+30WjF7xPPlqYuFFm0sc43h+/mN9glUkCflyrRE vJfcskbd0R15mAGsoL6G3gfHGINj6BnXSNMN/Cug0a7ky5DoRY4vM07diWbMdOKizwRd9SYMGUH voUWZ44dtdUDSOTJYkSgP35qvvUGM2/9wv5SnTzP7 X-Received: by 2002:a05:6102:508f:b0:7a1:f7c3:3a42 with SMTP id ada2fe7eead31-7be72da8dfcmr743842137.15.1790790610168; Wed, 30 Sep 2026 10:50:10 -0700 (PDT) X-Received: by 2002:a05:6102:508f:b0:7a1:f7c3:3a42 with SMTP id ada2fe7eead31-7be72da8dfcmr743826137.15.1790790609701; Wed, 30 Sep 2026 10:50:09 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Richard Henderson , Peter Maydell , Paolo Bonzini , qemu-arm@nongnu.org, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PATCH v4 3/9] target/arm: Split leaving-halt handling from arm_cpu_exec_halt() Date: Wed, 30 Sep 2026 19:49:39 +0200 Message-ID: <20260930174946.82195-4-philmd@oss.qualcomm.com> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260930174946.82195-1-philmd@oss.qualcomm.com> References: <20260930174946.82195-1-philmd@oss.qualcomm.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Proofpoint-GUID: hadSS8bEgsEIAScf2RYzkpKIXrn0XVco X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwOTMwMDA3MSBTYWx0ZWRfX+jLBvuRfLIax alkZPmuLCsN2wtDw2dMZY4uw+rnitdTLVUKmkoRpumfc6p6f2Fy0DRByE125yDuHbbOPw9BP5dY m3UoLLVQ3Um0upytLUH+XdrYQoc8hW8ir0I6eihmEp+jjfOq1O4oDkeU4Asd7OmmglI6ANdt8ki fiegPRYx1TPt/pDL+mwHJwVyicP/rwzSovt2xdW0wIp1oNvt+Blv3wjDUCoKysNHbyvYRqTO38c m9fImdHgMbiBDF116Nod7/DxMY5w0MY30f0LxZ4z+GEdMkQFOitQtMS0oFG9l6/dXtIRt11ZqwB UhElXdzlQwAfpUblwkdGniIa0i16sN3K72mZ41LJI8zX9qI87/YiPIdjsoMGjafnbfeNWzXTeag 5Zt7LmAX89Y/4yfHZav98o4f+mGbcx/1unHgYQmErLjhU+zmBKPBjfMn6HYd96X85/Q2aCrYddB otNoPEex0KbcWE+Ef3Q== X-Authority-Analysis: v=2.4 cv=MZn5KJ/f c=1 sm=1 tr=0 ts=6abd4bd2 cx=c_pps a=UbhLPJ621ZpgOD2l3yZY1w==:117 a=4s3hRJSeHn4rkQlkrse1kQ==:17 a=IkcTkHD0fZMA:10 a=VdqzKS8jKosA:10 a=M51BFTxLslgA:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=u7WPNUs3qKkmUXheDGA7:22 a=gowsoOTTUOVcmtlkKump:22 a=EUspDBNiAAAA:8 a=KKAkSRfTAAAA:8 a=snbnvTbt-5-dSQZ-83gA:9 a=3ZKOabzyN94A:10 a=QEXdDO2ut3YA:10 a=TOPH6uDL9cOC6tEoww4z:22 a=cvBusfyB2V15izCimMoJ:22 X-Proofpoint-Spam-Info: AW1haW4tMjYwOTMwMDA3MSBTYWx0ZWRfX5M8Q+b7sRB1y GSeEHNNdqWQ9OvdlF0DKEgmi4p6thRYYJz2NrC+sJu+kI1XceejM2VOP6R2iFj36Ni8U9YPq9fj 4ZLYw33e17b5Z/jGhatGZ6uYAloa8Oc= X-Proofpoint-ORIG-GUID: hadSS8bEgsEIAScf2RYzkpKIXrn0XVco X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1176,Hydra:6.1.134,FMLib:17.12.100.49 definitions=2026-09-30_04,2026-09-21_02,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 malwarescore=0 lowpriorityscore=0 spamscore=0 suspectscore=0 priorityscore=1501 bulkscore=0 clxscore=1015 impostorscore=0 adultscore=0 phishscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2609040000 definitions=main-2609300071 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists1p.gnu.org; Received-SPF: pass client-ip=205.220.180.131; envelope-from=philmd@oss.qualcomm.com; helo=mx0b-0031df01.pphosted.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 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_LOW=-0.7, 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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @qualcomm.com) X-ZM-MESSAGEID: 1790790673127158500 Move WFxT timer cleanup and halt-reason reset into arm_cpu_leaving_halt(). Keep arm_cpu_exec_halt() focused on deciding whether the CPU can leave the halted state. Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Richard Henderson --- target/arm/cpu.c | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/target/arm/cpu.c b/target/arm/cpu.c index 10ac6c98318..53f9a532a75 100644 --- a/target/arm/cpu.c +++ b/target/arm/cpu.c @@ -872,18 +872,24 @@ static bool arm_cpu_internal_is_big_endian(CPUState *= cs) } =20 #ifdef CONFIG_TCG +static void arm_cpu_leaving_halt(CPUState *cs) +{ + ARMCPU *cpu =3D ARM_CPU(cs); + + /* We're about to come out of WFI/WFE: disable the WFxT timer */ + if (cpu->wfxt_timer) { + timer_del(cpu->wfxt_timer); + } + /* clear the halt reason */ + qatomic_set(&cpu->env.halt_reason, NOT_HALTED); +} + bool arm_cpu_exec_halt(CPUState *cs) { bool leave_halt =3D cpu_has_work(cs); =20 if (leave_halt) { - /* We're about to come out of WFI/WFE: disable the WFxT timer */ - ARMCPU *cpu =3D ARM_CPU(cs); - if (cpu->wfxt_timer) { - timer_del(cpu->wfxt_timer); - } - /* clear the halt reason */ - qatomic_set(&cpu->env.halt_reason, NOT_HALTED); + arm_cpu_leaving_halt(cs); } return leave_halt; } --=20 2.55.0 From nobody Sat Oct 24 00:32:26 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=reject dis=none) header.from=oss.qualcomm.com ARC-Seal: i=1; a=rsa-sha256; t=1790790680; cv=none; d=zohomail.com; s=zohoarc; b=lSYXfVdCVq0NgaVIErO3RbwOKdn6wDmaiai36W1ZiUro38j7QbqSghSjNMWI60l0Jle9IO5MRfeFkOWo4iSB9PVJ1MJdOfkjL59Sjm1HAUBvufrOIqV6Fz9AEafViwIP1vvM6pfOEnFCg9LwhiCTbmVsU3zXjtm1PKDdJRQaJ64= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1790790680; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=O12f/RezyT+/f0MD5pwtqfJck7NgEd8TZKdE+1UgoK0=; b=CApGVs4oPqsnawYmroeIXOXOHj4t20NKgWdUYuyowkMPu0OvB3cirlhcR4RV80OMxYVS8bi/lrTI/9PZnA3hjWSNxV3O/F8UiDulsV4LTnBMox+eXaeMIRvNhQTCqKv2JKneAZDCIV2BfoqDcaZMtR3jKuVwcIwdsJ0xMMS0DXs= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=reject dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1790790680018872.686568232787; Wed, 30 Sep 2026 10:51:20 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1xByRs-0001of-2S; Wed, 30 Sep 2026 13:50:32 -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 1xByRh-0001id-T0 for qemu-devel@nongnu.org; Wed, 30 Sep 2026 13:50:22 -0400 Received: from mx0b-0031df01.pphosted.com ([205.220.180.131]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1xByRf-0001Vv-7y for qemu-devel@nongnu.org; Wed, 30 Sep 2026 13:50:21 -0400 Received: from pps.filterd (m0279871.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 68UHf9uN643880 for ; Wed, 30 Sep 2026 17:50:18 GMT Received: from mail-qk1-f200.google.com (mail-qk1-f200.google.com [209.85.222.200]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4h14n20uw1-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Wed, 30 Sep 2026 17:50:18 +0000 (GMT) Received: by mail-qk1-f200.google.com with SMTP id af79cd13be357-93c5ab5c136so750765285a.3 for ; Wed, 30 Sep 2026 10:50:18 -0700 (PDT) Received: from localhost.localdomain (pmd666.hd.free.fr. [88.187.86.199]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4a01eb84e59sm7053555e9.15.2026.09.30.10.50.15 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Wed, 30 Sep 2026 10:50:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qualcomm.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=qcppdkim1; bh= O12f/RezyT+/f0MD5pwtqfJck7NgEd8TZKdE+1UgoK0=; b=D47LKTt1su1NvD9C E3ZvvT0mWRuUz4PBXsWP2k7n0pR9iot2AtjuxTqfNl26K/ejr5mVog9hWdapFkf5 uzLpZn23f/KPz+1AqRc9+R/i7zjStKNHTbHPM1M/cyG6iuUjtYSjZOaFqqZqUVsk YIQhqxex4YrKVjMYGJtLG3O43MGGYjBTdJMQ9m0AHzV9fSbqbvzU91yVnIWflf92 vde+zWw6mdC+5Vv9ZVtBiEoStPKfZnAf3xbb38oRq2bHcpd7JYYD/+HYgxEjkCrc a/Hn3a727uO6clxvSEi0Ux4BLsHvO3WmlW8WTQ+MLGipctHB1mVexMfvGPb8XAYR b0PwEQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1790790617; x=1791395417; darn=nongnu.org; h=content-transfer-encoding:content-type:mime-version:references :in-reply-to:message-id:date:subject:cc:to:from:from:to:cc:subject :date:message-id:reply-to:content-type; bh=O12f/RezyT+/f0MD5pwtqfJck7NgEd8TZKdE+1UgoK0=; b=hlSo11oLmRISzMg4PrQzx4Qo3/AI+d+47hzOZ18p0taEpD3G/e970AgxAxYv5AqUy6 wwRtruLEJY1yj4jma/c4NM3YHgbPE5xIcbqA7mfdecadkyDYTJ5OcnzdHr/9eE9vfI2n TbOJuMxl9k33FyI/Z4FyHS+akokloD39DTeciuL+QZXZWmjgUpIOd679KmF1+SdKmIDo 7UH0sG5eDWs+CUSFGsfrBpx1VQBz1JoamTqy4HkT7+11Oe8XEG09PVQx+w4ZYF4w0RyA 3uZhJUIqYEOzSkRlN1+ZnlfkE2c1HTdswkAzxK/bmiZIk/Ilmj6/XRQlxbpeODbuDwry 7tIw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1790790617; x=1791395417; h=content-transfer-encoding:content-type:mime-version:references :in-reply-to:message-id:date:subject:cc:to:from:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=O12f/RezyT+/f0MD5pwtqfJck7NgEd8TZKdE+1UgoK0=; b=C3uwLAY/LB5S3YvLdU/BozhJc8Scw+qYHrfT3Mt1iGqJ7Sb0Q45Xt5DjmNvfscGNPW oYXvi5YseQq523S5h7SI4/+KSAYC90BwBo0QFEGhm6KTXMgtX9KZdDlR1CY66yasW1Xo pt1jUj6ONrcNlFEgPk4cYvv82XlU5yBeal7mC7o+RFecHuMoCp3ATpIwu5ARf9nEaajO 4KmaFAnjUU5sl4vHAfbZsfB5noYf7AW82nyhvtgEj6QBTldWh4zrXtYtyHOXperqJ5dG 3R8J5sDddGStKYfCIYiyJOnc5kdpfIvvWDE/swOQ9DRbFk4aeA6R/uBHcM8DooT0iQxI nfPw== X-Gm-Message-State: AFuF++m4BHcYbJgQ9nxk5aMU9McsOMBkH3Yha/1+1iHyo9xnoRh6z4Ho 8oyrn/3D/9a3cIeHQobWGxQCQfas8guV3Kp8jwlH32ggNEqkzZJhxE2u8NN7lfRWhJB31aXzGjb KN2YSE7+k+Qh7CrFIfYjrrkmem9uIMwW2tbS0VsI7BTkfRISGFzKCVYzHdni4jdAIcQ== X-Gm-Gg: AYBFou0eIOgUnREz1N7pFtLJEbzASyvUQ54w+yXGmLNTMyL0yUEF9BJI+gEeDviuk+S cJi98mw9XaI1ZP+dBHOX7yS9NLlQyMpwmmzi2DjaFZHM9UxGA9dGWcIt6zg/X9m4vqw5f1j9Kh9 HYy7ippDzLTu4oO1iyofNtWkcT1SR3LQObLeVyxq5QxshtdNTEO+XDXJjPgfQGdnjD63nCbsNHB RRRmXhAxXn0fH/0KbYMWNtgEbB0a7qpr6SPoqX6G4BzLIQ1fMe6uVw6VCXHdxwr5t/yzsT8P4Wt w6wTsQCklRROuCD22qWltUSsRxqEXmE8lqSvvRZpG1ghTF/vfrqoYwss1sMjGnAoHpfkWgYFqs3 NhtYLdxYdC2DjS+xATevccUPk1E/T5or/m7DujGPR X-Received: by 2002:a05:620a:2842:b0:936:dc4c:3bf4 with SMTP id af79cd13be357-93ca96b41eemr406654585a.28.1790790617304; Wed, 30 Sep 2026 10:50:17 -0700 (PDT) X-Received: by 2002:a05:620a:2842:b0:936:dc4c:3bf4 with SMTP id af79cd13be357-93ca96b41eemr406647885a.28.1790790616748; Wed, 30 Sep 2026 10:50:16 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Richard Henderson , Peter Maydell , Paolo Bonzini , qemu-arm@nongnu.org, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PATCH v4 4/9] target/arm: Convert cpu_exec_halt() to leaving_halt() Date: Wed, 30 Sep 2026 19:49:40 +0200 Message-ID: <20260930174946.82195-5-philmd@oss.qualcomm.com> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260930174946.82195-1-philmd@oss.qualcomm.com> References: <20260930174946.82195-1-philmd@oss.qualcomm.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Authority-Analysis: v=2.4 cv=Gr3XaU1C c=1 sm=1 tr=0 ts=6abd4bda cx=c_pps a=hnmNkyzTK/kJ09Xio7VxxA==:117 a=4s3hRJSeHn4rkQlkrse1kQ==:17 a=IkcTkHD0fZMA:10 a=VdqzKS8jKosA:10 a=M51BFTxLslgA:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=u7WPNUs3qKkmUXheDGA7:22 a=3WHJM1ZQz_JShphwDgj5:22 a=EUspDBNiAAAA:8 a=KKAkSRfTAAAA:8 a=AtaPWBxvZOLBLR1XvpsA:9 a=3ZKOabzyN94A:10 a=QEXdDO2ut3YA:10 a=PEH46H7Ffwr30OY-TuGO:22 a=cvBusfyB2V15izCimMoJ:22 X-Proofpoint-Spam-Info: AW1haW4tMjYwOTMwMDA3MSBTYWx0ZWRfX78wx5/CbF1lM 0sDhc5hWhLHSvlAv6QpdYHeroCWM0CPer3A+tWVDX22rPoJjRoTBqJ7IJQU8KNih1pSZVip8e2y ZenXSh4rQnXrRS2dtAx8V79TOAu3V+U= X-Proofpoint-GUID: _bxprZu3y1XcvrDqCTP6FDQHGBZgaYX1 X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwOTMwMDA3MSBTYWx0ZWRfX+WAjjz2MiSwV ek/e1L2WeRVeBEOAc6U9zV/H/spduZLeLVq6Gy4sGVjQCwtq4hGL/VMq7EH+qGwC9lw28If8nDb rIwQEy+3NQm4YMjaKnoxuQnzKOs/hKjWq3rEeyDNjiF6OXVFS1gZdG5v+fhfMvdWRyi1x5vmNrY rhr5APDmIEuWTpmGy3j/u/XZXv5ZrJiSJxtneeR/uu3PHZb0bVWwII/XHRJUDAnSD9XuVmU/gUq /TYwwzKQAMmcs3CBZR3Rs/hxcuR04TF30yyVri646A0N7EDgQdqNMYzu4yY02zHQxKylkR+KPB5 ZB7SnVeoSD+bR5GDTqGj4DHycBsMf3SytyCkZUabOxrLZahIBTP53t1R1CDpDbZLOcmH8er7NzH 85oOEiAVIXJGbCrhoUe0Q5XAMm9lAaY695wgoJOQVf5zw0+AIB4vk9aEMjO3rXdfiw2lczMt/Ju dI2ff7EIciXLHPaN1xg== X-Proofpoint-ORIG-GUID: _bxprZu3y1XcvrDqCTP6FDQHGBZgaYX1 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1176,Hydra:6.1.134,FMLib:17.12.100.49 definitions=2026-09-30_04,2026-09-21_02,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 clxscore=1015 bulkscore=0 malwarescore=0 adultscore=0 lowpriorityscore=0 spamscore=0 suspectscore=0 impostorscore=0 priorityscore=1501 phishscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2609040000 definitions=main-2609300071 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists1p.gnu.org; Received-SPF: pass client-ip=205.220.180.131; envelope-from=philmd@oss.qualcomm.com; helo=mx0b-0031df01.pphosted.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 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_LOW=-0.7, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable 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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @qualcomm.com) X-ZM-MESSAGEID: 1790790681057158500 arm_cpu_exec_halt() now merely checks cpu_has_work() and conditionally call arm_cpu_leaving_halt(), which is now the generic flow in cpu_has_work_after_processing_async_events(). Register the leaving_halt handler to use the generic target-agnostic flow and remove the arm_cpu_exec_halt() wrapper. Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Richard Henderson --- target/arm/internals.h | 3 --- target/arm/cpu.c | 12 +----------- target/arm/tcg/cpu-v7m.c | 1 - 3 files changed, 1 insertion(+), 15 deletions(-) diff --git a/target/arm/internals.h b/target/arm/internals.h index c41fa5225c7..9917931fae9 100644 --- a/target/arm/internals.h +++ b/target/arm/internals.h @@ -431,9 +431,6 @@ void arm_restore_state_to_opc(CPUState *cs, #ifdef CONFIG_TCG TCGTBCPUState arm_get_tb_cpu_state(CPUState *cs); void arm_cpu_synchronize_from_tb(CPUState *cs, const TranslationBlock *tb); - -/* Our implementation of TCGCPUOps::cpu_exec_halt */ -bool arm_cpu_exec_halt(CPUState *cs); int arm_cpu_mmu_index(CPUState *cs, bool ifetch); #endif /* CONFIG_TCG */ =20 diff --git a/target/arm/cpu.c b/target/arm/cpu.c index 53f9a532a75..7e411b07bde 100644 --- a/target/arm/cpu.c +++ b/target/arm/cpu.c @@ -883,16 +883,6 @@ static void arm_cpu_leaving_halt(CPUState *cs) /* clear the halt reason */ qatomic_set(&cpu->env.halt_reason, NOT_HALTED); } - -bool arm_cpu_exec_halt(CPUState *cs) -{ - bool leave_halt =3D cpu_has_work(cs); - - if (leave_halt) { - arm_cpu_leaving_halt(cs); - } - return leave_halt; -} #endif =20 /* @@ -2625,7 +2615,7 @@ static const TCGCPUOps arm_tcg_ops =3D { .tlb_fill_align =3D arm_cpu_tlb_fill_align, .pointer_wrap =3D aprofile_pointer_wrap, .cpu_exec_interrupt =3D arm_cpu_exec_interrupt, - .cpu_exec_halt =3D arm_cpu_exec_halt, + .leaving_halt =3D arm_cpu_leaving_halt, .cpu_exec_reset =3D cpu_reset, .do_interrupt =3D arm_cpu_do_interrupt, .do_transaction_failed =3D arm_cpu_do_transaction_failed, diff --git a/target/arm/tcg/cpu-v7m.c b/target/arm/tcg/cpu-v7m.c index 48b31d5eac8..1093c6cbf63 100644 --- a/target/arm/tcg/cpu-v7m.c +++ b/target/arm/tcg/cpu-v7m.c @@ -302,7 +302,6 @@ static const TCGCPUOps arm_v7m_tcg_ops =3D { .tlb_fill_align =3D arm_cpu_tlb_fill_align, .pointer_wrap =3D cpu_pointer_wrap_uint32, .cpu_exec_interrupt =3D arm_v7m_cpu_exec_interrupt, - .cpu_exec_halt =3D arm_cpu_exec_halt, .cpu_exec_reset =3D cpu_reset, .do_interrupt =3D arm_v7m_cpu_do_interrupt, .do_transaction_failed =3D arm_cpu_do_transaction_failed, --=20 2.55.0 From nobody Sat Oct 24 00:32:26 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=reject dis=none) header.from=oss.qualcomm.com ARC-Seal: i=1; a=rsa-sha256; t=1790790665; cv=none; d=zohomail.com; s=zohoarc; b=hvBiloWsCrJgeE8mxUIS0joh3+xUI4VAGIhoaBHBzOnIn4QohDdMWE2O73rSexXrUXEFKO+9h1mp6DP0OhgIXpNR2H1iqa4p0INBMftDa5bS0IRAqX2G0TICU5J2kjsE+VnhK/CrP+NxdvtUptO+qcFK/PZWqRcQFsCvdhfuPkI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1790790665; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=3ITDVxMKQyrvO/cJ01b1Bv1m3X4CEZI3TJHmNI/NA9U=; b=G0llNTHvJSsVQX0ldnd7eeJqqbKY6tn2r5UH9MtNX9JkpZu8MAqkhtRl0q6wPw2dkAPOtk1nBYKpcVfwpGRDbEYSEZnhHgsr+IQ/FWjVt6WWVfaMcu/cSAZO8sR/tuEBQEnmXzwAIF/lYyyUERHpEm3Y4UV5o0nvp7szpqRyqxA= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=reject dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1790790665480183.59256458498908; Wed, 30 Sep 2026 10:51:05 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1xBySE-00022s-LB; Wed, 30 Sep 2026 13:50:58 -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 1xByRn-0001pn-Nf for qemu-devel@nongnu.org; Wed, 30 Sep 2026 13:50:28 -0400 Received: from mx0b-0031df01.pphosted.com ([205.220.180.131]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1xByRl-0001Wg-Rc for qemu-devel@nongnu.org; Wed, 30 Sep 2026 13:50:27 -0400 Received: from pps.filterd (m0279871.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 68UHfCdJ643969 for ; Wed, 30 Sep 2026 17:50:25 GMT Received: from mail-vs1-f71.google.com (mail-vs1-f71.google.com [209.85.217.71]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4h14n20uwd-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Wed, 30 Sep 2026 17:50:24 +0000 (GMT) Received: by mail-vs1-f71.google.com with SMTP id ada2fe7eead31-7989d8ef4a6so892897137.3 for ; Wed, 30 Sep 2026 10:50:24 -0700 (PDT) Received: from localhost.localdomain (pmd666.hd.free.fr. [88.187.86.199]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4a01ef9b9e3sm5652445e9.2.2026.09.30.10.50.22 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Wed, 30 Sep 2026 10:50:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qualcomm.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=qcppdkim1; bh= 3ITDVxMKQyrvO/cJ01b1Bv1m3X4CEZI3TJHmNI/NA9U=; b=eT4e0g3F9F2/lnef Gay76jl0OWK+Mb6RtFekfmi+U4/fOsnjfLfjL2bconqtQtAjJ8xtN+HCwPo2EQ9Y Stbyd5kV0jnib8g4aDt7+kG1KLMz+pHDdUJjN1/0lKxPqcVLPGlm3X9EFNt0vXjT oMSNSF7Jkw+oD727t0cLH+qA2a7wuixdOZd08vdvkt/gVzsp041Jx+5Pn7C/nYSH bpvsDO930ovFAWNk8Vo6hwE43E1Vr9kquyQgiUkHao18kbXK3pqCrO6aBU+wgSNo SeEnrqI4YJEQ4yUIjVxKUJ/3b1A4cdgTEpDT7lVV8Z7fgmF2w7DQP9uNo39iB+EM Lc9WuA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1790790624; x=1791395424; darn=nongnu.org; h=content-transfer-encoding:content-type:mime-version:references :in-reply-to:message-id:date:subject:cc:to:from:from:to:cc:subject :date:message-id:reply-to:content-type; bh=3ITDVxMKQyrvO/cJ01b1Bv1m3X4CEZI3TJHmNI/NA9U=; b=KZey0DFFLmtJS0BhIP9uYDHiXLKVOthaoIl2XEiu8otgPYuOZYNs6TdzAgB/nGI2Vs N8DpH7Ncphz4cQ0LXt8qtQjX8ljirQVKYE8Uchwf+R3kyP4LLm0kTGH5PrPnYZCZoEXl H46eHK3OLX+fOO87u7cQ6B4bFqlOUMdbkPSSlfnjI+VqgnUdoCH7GyiDIJRQ4M160rsl rKRfm0dV++bMS1MzCQmx60L+8gUwbYdzapo2M/Z7uLq9PnVHS5axPERkgtjXgSyKbUPq ET5cQz9byon30bhu6J/pLZgaC3vFgMoAh6e26uieQWfQY80JJ6N0/IYMWqwySBkHnOr5 PBRA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1790790624; x=1791395424; h=content-transfer-encoding:content-type:mime-version:references :in-reply-to:message-id:date:subject:cc:to:from:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=3ITDVxMKQyrvO/cJ01b1Bv1m3X4CEZI3TJHmNI/NA9U=; b=puE9FRnTQcaxNxjzW+HtbPmC7Ryd7JCxNUUDqJneiYywMvErmde49tEK6B7HDCfQMQ 3oRBOujmC72AW4HYiMmTeqvOyneuFdoG4qI5Y8BFB+/a4s7Q5BARm+PYmHDw1X8DY+Jc +Eu8RtVVMcECL7jgx0GNUk9SMOezctFLAOPFcWsLuE7ZNU46lrayZ66usjnlqrJsV8uY /myP9GsecUtcxh4enPAHVwQAC8Brbkfw2zGHGZosLKlrrbiWyKUx9+36KpwZ6utsJXs5 B8wNCUvSW4f1QVbmMp31OM5zhusH8CHhz6LXMVAOkHdothRuiPGUEi/Zl8k3aDJsiE4A MryA== X-Gm-Message-State: AFq9FYLkc/pdNMjAMOHXWu9z512AwARisgjrV6bZ0tlI+8FVpb78sHwO VMxmW51Vm1opmpFIH3Rp7dHKxtPgQUDiHYwZ9v2kVGQTuIKZdT+zEgU8Cv5mYJQfwUdYYMKv9Tn t4Xx9sbxcGyTHzjaUYD9XzY4/uCl7qH1XGOiFlfSQIfoanT5JAlkp3LKMUbs24cSrsg== X-Gm-Gg: AYBFou2TS+lm5BgXnvWBmWxUCp6lY4/14hIZZ7E77znbkTmQ3RS1+CI9wT08QGvGwlK FIEuUd0ofhrLu4dpLU/KJw96xlNY5dvk0ALPauMWIOO1TBVXydw4ZHepUDXv/pHHt3JmLImRfkw TCH4mjXbCESrwT/lV92IvuoSC4Dr/TAM1vVQnyI1mM7kU0VQjhpna5b0IxTP0Sq7/1Wa+X2+tlD 5luTLgs1CLm2YBtki80Kwik/oHXqW1zymtykaPthWveXH/40jtfm/AGRUqZcKtUvfekwE3yw4BE rGQKZAwy8ec9PmGSxZBJmqsC74PZyKm7OFpdQm8bA0FIOJj076jnvXeVNc79kHPrSkD+XtuCKWw /H4yWA3plGVNgcwhJRglvKK0MZMF5JrXkdz9PWQoy X-Received: by 2002:a05:6102:54a7:b0:7af:4843:5ec9 with SMTP id ada2fe7eead31-7be724b9384mr554128137.8.1790790624118; Wed, 30 Sep 2026 10:50:24 -0700 (PDT) X-Received: by 2002:a05:6102:54a7:b0:7af:4843:5ec9 with SMTP id ada2fe7eead31-7be724b9384mr554116137.8.1790790623690; Wed, 30 Sep 2026 10:50:23 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Richard Henderson , Peter Maydell , Paolo Bonzini , qemu-arm@nongnu.org, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PATCH v4 5/9] target/i386: Split APIC polling from x86_cpu_exec_halt() Date: Wed, 30 Sep 2026 19:49:41 +0200 Message-ID: <20260930174946.82195-6-philmd@oss.qualcomm.com> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260930174946.82195-1-philmd@oss.qualcomm.com> References: <20260930174946.82195-1-philmd@oss.qualcomm.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Authority-Analysis: v=2.4 cv=Gr3XaU1C c=1 sm=1 tr=0 ts=6abd4be0 cx=c_pps a=P2rfLEam3zuxRRdjJWA2cw==:117 a=4s3hRJSeHn4rkQlkrse1kQ==:17 a=IkcTkHD0fZMA:10 a=VdqzKS8jKosA:10 a=M51BFTxLslgA:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=u7WPNUs3qKkmUXheDGA7:22 a=3WHJM1ZQz_JShphwDgj5:22 a=EUspDBNiAAAA:8 a=KKAkSRfTAAAA:8 a=h7OMh5kjI76PbTVxvEwA:9 a=3ZKOabzyN94A:10 a=QEXdDO2ut3YA:10 a=ODZdjJIeia2B_SHc_B0f:22 a=cvBusfyB2V15izCimMoJ:22 X-Proofpoint-Spam-Info: AW1haW4tMjYwOTMwMDA3MSBTYWx0ZWRfX4S48SCQy+C6B qaw+dVn+KEBnoVbxpA4RXQ/8YD13oS9Z9pyZRmCD0M7SFm0Cu8nQL1mg/aDCHkZhgRAUKhe9KaW Ag35L0Hj63BAb0zWJx+h0zj9/CSYPeQ= X-Proofpoint-GUID: 7_OF-3tzS8v5TARROijnDsE-ItZ8EfVJ X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwOTMwMDA3MSBTYWx0ZWRfX11Mxs2xQs0H5 bZ9hEy5ps68oNeWNTjlmnrMwvnr+6h4VYEUPTc7k1IkLK2HzRiPnjmJE4ZF7/OLlIuY/7rraHSy chaRZh6sRMbAlpmKmj8VtAM6opEJbkecVo0OQSI8apFQ2PTVl5QkMBi+IuCNHVgi/9gbfz63yPj 4tk+TqEN0G/A5lyz1gf7zGjpvE1FXbA+6edi//wqtQd++FEY7Ag+DRb/OYHpaWKTfqyIHEGsc2z TXKLvrbDvjjvbZSQ6zd+KqYm/mFCXH7wYNo4yNTuaFAENSkHn9GI2Bvj9iiqO7Guq5H0bjn+2KM oAbrZAujU7Ibb1SoKBt+z1EJYN/VMAReOpwyXNcuGY5kk+uUlHfOqda8qChMY8x6ndi4c9cVo1I ELx2C8tcisnvzSsLHxv5/bQvEWC0ZolgI+xJmEzf/kdecgrhsdL56TQ5vqnVxIhJVpkqHY5k1eG 4ve3gSdphtVl3efRorg== X-Proofpoint-ORIG-GUID: 7_OF-3tzS8v5TARROijnDsE-ItZ8EfVJ X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1176,Hydra:6.1.134,FMLib:17.12.100.49 definitions=2026-09-30_04,2026-09-21_02,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 clxscore=1015 bulkscore=0 malwarescore=0 adultscore=0 lowpriorityscore=0 spamscore=0 suspectscore=0 impostorscore=0 priorityscore=1501 phishscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2609040000 definitions=main-2609300071 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists1p.gnu.org; Received-SPF: pass client-ip=205.220.180.131; envelope-from=philmd@oss.qualcomm.com; helo=mx0b-0031df01.pphosted.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 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_LOW=-0.7, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable 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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @qualcomm.com) X-ZM-MESSAGEID: 1790790666941158500 Move APIC polling into x86_cpu_poll_during_halt() while keeping the remaining halt handling in x86_cpu_exec_halt(). Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Richard Henderson --- target/i386/tcg/helper-tcg.h | 1 + target/i386/tcg/system/seg_helper.c | 11 +++++++++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/target/i386/tcg/helper-tcg.h b/target/i386/tcg/helper-tcg.h index f4b2ff740d5..58e8ca0bc1b 100644 --- a/target/i386/tcg/helper-tcg.h +++ b/target/i386/tcg/helper-tcg.h @@ -37,6 +37,7 @@ */ void x86_cpu_do_interrupt(CPUState *cpu); #ifndef CONFIG_USER_ONLY +void x86_cpu_poll_during_halt(CPUState *cpu); bool x86_cpu_exec_halt(CPUState *cpu); bool x86_need_replay_interrupt(int interrupt_request); bool x86_cpu_exec_interrupt(CPUState *cpu, int int_req); diff --git a/target/i386/tcg/system/seg_helper.c b/target/i386/tcg/system/s= eg_helper.c index 8c7856be81e..9ce608a0bb7 100644 --- a/target/i386/tcg/system/seg_helper.c +++ b/target/i386/tcg/system/seg_helper.c @@ -128,10 +128,9 @@ void x86_cpu_do_interrupt(CPUState *cs) } } =20 -bool x86_cpu_exec_halt(CPUState *cpu) +void x86_cpu_poll_during_halt(CPUState *cpu) { X86CPU *x86_cpu =3D X86_CPU(cpu); - CPUX86State *env =3D &x86_cpu->env; =20 if (cpu_test_interrupt(cpu, CPU_INTERRUPT_POLL)) { bql_lock(); @@ -139,6 +138,14 @@ bool x86_cpu_exec_halt(CPUState *cpu) cpu_reset_interrupt(cpu, CPU_INTERRUPT_POLL); bql_unlock(); } +} + +bool x86_cpu_exec_halt(CPUState *cpu) +{ + X86CPU *x86_cpu =3D X86_CPU(cpu); + CPUX86State *env =3D &x86_cpu->env; + + x86_cpu_poll_during_halt(cpu); =20 if (!cpu_has_work(cpu)) { return false; --=20 2.55.0 From nobody Sat Oct 24 00:32:26 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=reject dis=none) header.from=oss.qualcomm.com ARC-Seal: i=1; a=rsa-sha256; t=1790790680; cv=none; d=zohomail.com; s=zohoarc; b=kTeSOUaGbiLiz+INdEk9Z6z0JUnJDPl2Lt7Y9RKNVQoyutyapQrjsERk+SRT9Rl6zkoIiMyOQQH2RdN2xmLW3pmAODkIb/5ZgUsijgYF4osiWBWjb9MLxSKVNa4URDMTychTNr/RUGk4YSyvDyeFokxG5cZPKN6XlFfY+7h6kCc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1790790680; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=KUfE/kAPKd/Kw3FhdD4xJiGfxG7IJoFZYr41KEw339A=; b=Tj8+5G9LQ4MmHKjKKkNM/XpYUL8XgYmznPnH6vfK/ORsuufs3eBioh2tr4ocJp5kssDrtDvC5D1gJ/oWE8TlgxQoynuiT6FtO/MadbkOi6Ujo6bQq+ctw0Z1KBj7tBHAGkItNSELKtQNb0qEvMl15btOVLKH0nBBGdbh6230lBc= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=reject dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1790790680841469.1113819276211; Wed, 30 Sep 2026 10:51:20 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1xBySN-000273-T0; Wed, 30 Sep 2026 13:51:05 -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 1xByRx-0001xv-Aq for qemu-devel@nongnu.org; Wed, 30 Sep 2026 13:50:41 -0400 Received: from mx0a-0031df01.pphosted.com ([205.220.168.131]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1xByRu-0001Xe-0Q for qemu-devel@nongnu.org; Wed, 30 Sep 2026 13:50:37 -0400 Received: from pps.filterd (m0279866.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 68UHf4rT3566541 for ; Wed, 30 Sep 2026 17:50:32 GMT Received: from mail-vs1-f71.google.com (mail-vs1-f71.google.com [209.85.217.71]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4h0smjkyub-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Wed, 30 Sep 2026 17:50:32 +0000 (GMT) Received: by mail-vs1-f71.google.com with SMTP id ada2fe7eead31-7b43c5f2b6fso586740137.1 for ; Wed, 30 Sep 2026 10:50:32 -0700 (PDT) Received: from localhost.localdomain (pmd666.hd.free.fr. [88.187.86.199]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-48b068bc9d1sm627843f8f.5.2026.09.30.10.50.29 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Wed, 30 Sep 2026 10:50:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qualcomm.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=qcppdkim1; bh= KUfE/kAPKd/Kw3FhdD4xJiGfxG7IJoFZYr41KEw339A=; b=Z9C+mSTESC9YkRH3 SpqYT7kZeYUZCZkRpD3t+Hq0DIAU6JSvDNy6k0Wp/JnK6aDiCJTjsVfrRb2ih7oh Du6j8CShIqY6jxOhzDYyp6y7K0nsIFfImqhL2zy2GdGJcutBTs1TGCLRe37SHDOS p+QErHnGJZwga0i8pLukenDiUHqrzSqwWsnFu8z9fFeSklrcVXiU7gWv93jCvDRJ ANvuLEBbIzUGeKJERm0g7xZ/J3lN0bSM5wq3L+Zz4AGzMPo141dN9yHs9Qljh/8j FXlpB52dKefwNDVTmBcRfy4BV9JiWzhc3Tl1r3Dyme2TlBCwm+CB1+7+5gN/EVl4 45R9Mg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1790790631; x=1791395431; darn=nongnu.org; h=content-transfer-encoding:content-type:mime-version:references :in-reply-to:message-id:date:subject:cc:to:from:from:to:cc:subject :date:message-id:reply-to:content-type; bh=KUfE/kAPKd/Kw3FhdD4xJiGfxG7IJoFZYr41KEw339A=; b=OCbHjtsZayYhpEnVpnsKtJHifwLYF2nNj6gPU+lmeDNtKV/tSt9aRROt13lEVxaLYk mxlA6Gms1SfBBNoWonnpO/dLs2j59iB9Cw+pLZAk0tR/85mu6OxaMBUKEPZs5ancMbtW PqZ/BNKIjM9UHK75JAJbegMHiFaN4LdhMLr03KDThF8/qzI3KTlC8rzQ39AWPJAQD31u DMMvBaZ23y7ZRZkEsFvZc44jAH8A63Xqhq+2iTT2k/l7Brkk8+a3xP3/ysyn2I7b+lv8 pOYqC9n+8dUEexG+B2ZvOK+nRJPksMMD/acTBPQHc6KGofFd5k3VmzMZwmlJjJHJ6DzO HDhw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1790790631; x=1791395431; h=content-transfer-encoding:content-type:mime-version:references :in-reply-to:message-id:date:subject:cc:to:from:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=KUfE/kAPKd/Kw3FhdD4xJiGfxG7IJoFZYr41KEw339A=; b=qCYw5BQjlI6M0FM/Nfrphp3Bq9qli5XTfW5ZKc8kqdYbBPITMMW7lkjtKkfUL5yRZP CR5SocVeQSuXbQaSr7QdVezmV9Tgc6OhIQvavyKxJL3seCDhwb4KMwlflYRk+CGRkZKp Vupte2BFf5NeDpNaew6RxLr0wrP/QjKr2GuR/WfZCsAKM0tW7IlQ9NvrKzb2EP8I2247 xUzXZ96bqCX4pkRQrzzKYmD1wgXfdekaxzwghrPO/8NRDGrRgGbq1LaIHOjaRFeBOsnH h2PRMuAT23RiLvN6KqpQIELTqyu0/+jdgK+zQUnIqUTW7FYS7sQx+jLiemnhpD8A4oaC 08vw== X-Gm-Message-State: AFq9FYKRZnVL7HlwOoNqHUZ7BsyEAxTIXbcVEQOQB7c5i8cKLkPaAL/K 6DrIiiFowLO4CnLKKtB6kTGfbQdkysklAQrG/QZ/n/IKapxrQFsqOIs5QHnjog5Ja10J+I1ptns tXOJOtKj1yBfCIlX/x3LShof4/EN2wtU4uwWKm5GIYhzpQZbML4QankKGVgRdx8tE1Q== X-Gm-Gg: AYBFou2nhr/m1HqUU1Zb0i9d6VlZClhFH4DdrOL1p8gDLbuLvr/r5LVFeBeByjqAiOA 9dqIVjbLdUbB/5JNa/Xvi7Ums7bh8vtT95VoX/FjHDXhDs3t7afkgBZrk05OWnG/rL6PVrJLL3V 0Otluknuzg/rZpl4ZyLtn5wsGiiXqALcunjJfzeYjFgS3grWUhMp1G/+3qbVz6jATwLaZlZngCF pL7C/LHHx59mIDgVfwxDh5+COZkSDmlr5b5jaA65tZRgexSQOLqY5ZWW/jWA9rDzI+zfzYZVubN ezinM6BhJgzuwbU1Tx8lAG8ENPx9rwpbwpOoNI2W1MtwWasZIcDUQApg7+DpXuvy1VhDDT/igJk KK8Yhkqg1FwksZGXxIUCPeGyaz2eJr4xESZHAXZ7Y X-Received: by 2002:a05:6102:3f0f:b0:7a6:b8fe:e834 with SMTP id ada2fe7eead31-7be7339c863mr464679137.27.1790790631240; Wed, 30 Sep 2026 10:50:31 -0700 (PDT) X-Received: by 2002:a05:6102:3f0f:b0:7a6:b8fe:e834 with SMTP id ada2fe7eead31-7be7339c863mr464672137.27.1790790630684; Wed, 30 Sep 2026 10:50:30 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Richard Henderson , Peter Maydell , Paolo Bonzini , qemu-arm@nongnu.org, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PATCH v4 6/9] target/i386: Split leaving-halt handling from x86_cpu_exec_halt() Date: Wed, 30 Sep 2026 19:49:42 +0200 Message-ID: <20260930174946.82195-7-philmd@oss.qualcomm.com> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260930174946.82195-1-philmd@oss.qualcomm.com> References: <20260930174946.82195-1-philmd@oss.qualcomm.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Proofpoint-Spam-Info: AW1haW4tMjYwOTMwMDA3MSBTYWx0ZWRfXxxLRex0XTyVN G0k/ey/ZjYYSXVgTFYcgevlXQhDfQ3/A0UeKqBqojI9pOjMTS2cZDTvmlz+KCBNghypWb1sXT6O LkiKnqOuKgvei5kyxM9WZC5gEEBTGPg= X-Proofpoint-GUID: _ljd5lzu2lVfo7PZ1CggdGftCPK6aVCz X-Proofpoint-ORIG-GUID: _ljd5lzu2lVfo7PZ1CggdGftCPK6aVCz X-Authority-Analysis: v=2.4 cv=KfxHIgYD c=1 sm=1 tr=0 ts=6abd4be8 cx=c_pps a=P2rfLEam3zuxRRdjJWA2cw==:117 a=4s3hRJSeHn4rkQlkrse1kQ==:17 a=IkcTkHD0fZMA:10 a=VdqzKS8jKosA:10 a=M51BFTxLslgA:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=u7WPNUs3qKkmUXheDGA7:22 a=YMgV9FUhrdKAYTUUvYB2:22 a=EUspDBNiAAAA:8 a=KKAkSRfTAAAA:8 a=GiXQl85om2WzCxkx9rAA:9 a=3ZKOabzyN94A:10 a=QEXdDO2ut3YA:10 a=ODZdjJIeia2B_SHc_B0f:22 a=cvBusfyB2V15izCimMoJ:22 X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwOTMwMDA3MSBTYWx0ZWRfX838cgo+WgwU0 JIicLPr0KGAVXuwGQwY1KJYHgAHjIyuNnFXr2n6v1f8sq03Z1Tnd1aqzbGsXBVEiGpmcL3JP3QN IjEWCtUogC6gdp+SZ5cVDHAute/7wJNn4ZAc6CSgAUDWyaPiKBGVpLpvONc8u7IgJSVQd7mXh10 yTIf/H+f4W0eVGJIV1YpJYXdhc1TjPY4caYb3lYSlOM0hnxI5Kx1l/UwZUHkZLtO7qjrQZQMu9h t/i7hUTkNvg+9i590R5WBK70p1neblKeqrXJaAOBuY7AnAV1qdDEBDObzs09yF3ySy3i782hJxO gam9rEovsppL0yFQDWGafr0RnIr8JIghTMrKKHMWWuyxUMO8nXBSvj5/JzrhWRBncMNpaybkl8d 5+LD2ZQeoc+axIpsvKsSxyJ47wxhX6Yt6E4ypb0dHhLk5J5GlWom7bHBVN8DhHFUDxzTiFmn6KO qUZH8ekfLfk0vCyiAEg== X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1176,Hydra:6.1.134,FMLib:17.12.100.49 definitions=2026-09-30_04,2026-09-21_02,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 malwarescore=0 impostorscore=0 suspectscore=0 phishscore=0 clxscore=1015 priorityscore=1501 bulkscore=0 adultscore=0 spamscore=0 lowpriorityscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2609040000 definitions=main-2609300071 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists1p.gnu.org; Received-SPF: pass client-ip=205.220.168.131; envelope-from=philmd@oss.qualcomm.com; helo=mx0a-0031df01.pphosted.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 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_LOW=-0.7, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable 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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @qualcomm.com) X-ZM-MESSAGEID: 1790790681057158501 Move debug exception handling performed when leaving HLT into x86_cpu_leaving_halt(). Keep x86_cpu_exec_halt() responsible for checking whether the CPU can resume. Document that #DB IRQ delivery through do_interrupt_all() runs in the vCPU thread and does not require BQL protection. Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Richard Henderson --- target/i386/tcg/helper-tcg.h | 1 + target/i386/tcg/system/seg_helper.c | 25 +++++++++++++++++-------- 2 files changed, 18 insertions(+), 8 deletions(-) diff --git a/target/i386/tcg/helper-tcg.h b/target/i386/tcg/helper-tcg.h index 58e8ca0bc1b..96accb30a80 100644 --- a/target/i386/tcg/helper-tcg.h +++ b/target/i386/tcg/helper-tcg.h @@ -39,6 +39,7 @@ void x86_cpu_do_interrupt(CPUState *cpu); #ifndef CONFIG_USER_ONLY void x86_cpu_poll_during_halt(CPUState *cpu); bool x86_cpu_exec_halt(CPUState *cpu); +void x86_cpu_leaving_halt(CPUState *cpu); bool x86_need_replay_interrupt(int interrupt_request); bool x86_cpu_exec_interrupt(CPUState *cpu, int int_req); #endif diff --git a/target/i386/tcg/system/seg_helper.c b/target/i386/tcg/system/s= eg_helper.c index 9ce608a0bb7..566b3d4d80c 100644 --- a/target/i386/tcg/system/seg_helper.c +++ b/target/i386/tcg/system/seg_helper.c @@ -140,22 +140,31 @@ void x86_cpu_poll_during_halt(CPUState *cpu) } } =20 -bool x86_cpu_exec_halt(CPUState *cpu) +void x86_cpu_leaving_halt(CPUState *cpu) { X86CPU *x86_cpu =3D X86_CPU(cpu); - CPUX86State *env =3D &x86_cpu->env; - - x86_cpu_poll_during_halt(cpu); - - if (!cpu_has_work(cpu)) { - return false; - } + CPUX86State *env =3D cpu_env(cpu); =20 /* Complete HLT instruction. */ if (env->eflags & TF_MASK) { env->dr[6] |=3D DR6_BS; + /* + * do_interrupt_all() is the normal TCG exception-delivery path + * and runs in the same vCPU thread context, so #DB delivery does + * not require BQL protection here. + */ do_interrupt_all(x86_cpu, EXCP01_DB, 0, 0, env->eip, 0); } +} + +bool x86_cpu_exec_halt(CPUState *cpu) +{ + if (!cpu_has_work(cpu)) { + return false; + } + + x86_cpu_leaving_halt(cpu); + return true; } =20 --=20 2.55.0 From nobody Sat Oct 24 00:32:26 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=reject dis=none) header.from=oss.qualcomm.com ARC-Seal: i=1; a=rsa-sha256; t=1790790724; cv=none; d=zohomail.com; s=zohoarc; b=a+rkRvUM8xrIgcGS5e7S2G+FN2W9aCiN/4bSE/g82nbShpWSQo1Jaj1EcDaoSKM6zzo5/4F+U5A29Cf2NmFHEbOrTypoAoHD53RBiJ50pOhqP5591oE0HabyhOLSv8k6qdgVcLXQDM2QUTUgw/s9+OW4UD7QPNyNGjZvNjJqBLs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1790790724; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=Tg+6JGrg8TlSUod8NUCzwBY6Ua5KjOcrJARbt2DJV6I=; b=dmKjX3ziSP3fu5mj+dC+bjuiKKPqb6JibflX5Dlg9blpPws3iKebqkfjvWlTYCumYuzVW3P2KViR249UtOiJWmBcjcyOPLmpyO6qM2dK961Qy7YJ5Lb1zhahrrljtkQyBtw7OaLN8KwxeSTNT+9dBfzk5qMsTPHdhRd8mj7+Z1c= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=reject dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1790790724985523.3450586061576; Wed, 30 Sep 2026 10:52:04 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1xBySd-0002ox-Rd; Wed, 30 Sep 2026 13:51:20 -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 1xByS1-0001yf-9k for qemu-devel@nongnu.org; Wed, 30 Sep 2026 13:50:43 -0400 Received: from mx0b-0031df01.pphosted.com ([205.220.180.131]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1xByRz-0001YD-P7 for qemu-devel@nongnu.org; Wed, 30 Sep 2026 13:50:41 -0400 Received: from pps.filterd (m0279871.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 68UHfCrA643953 for ; Wed, 30 Sep 2026 17:50:39 GMT Received: from mail-vs1-f69.google.com (mail-vs1-f69.google.com [209.85.217.69]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4h14n20uxm-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Wed, 30 Sep 2026 17:50:38 +0000 (GMT) Received: by mail-vs1-f69.google.com with SMTP id ada2fe7eead31-7b731e00834so2900688137.0 for ; Wed, 30 Sep 2026 10:50:38 -0700 (PDT) Received: from localhost.localdomain (pmd666.hd.free.fr. [88.187.86.199]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-48b068bcb8fsm679369f8f.1.2026.09.30.10.50.36 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Wed, 30 Sep 2026 10:50:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qualcomm.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=qcppdkim1; bh= Tg+6JGrg8TlSUod8NUCzwBY6Ua5KjOcrJARbt2DJV6I=; b=Ios2Xbe0fFGXybAW dfwho+AXJg+iEMPtZv531n9bOnPKB39wiGQGoHIvOrp3iBDG8PNnVltC/AGV8fRw lVuj8kfgymSTQvJvoB4xPp5dFpx0KkLl95a5tcANYlAqJY2uLAoJ1++gayBxZlOx SYrpZuYqy6cRUjZOCxw8hwUK4hsB2b6lhik/3fjNvPFtTBL81WNd222EbUP0wvnq 2qkPKnd6y6peu+c9+G4dW8TA15spL0Nesoej+WTJg5NGr8yjhDcia8jau6HUYmFl aP6O3nzfdLGHx20VRSysioLj3CSpad+RmYL9OAQa68Fmmetjeepwq+dfX7ToKSaU GX3spg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1790790638; x=1791395438; darn=nongnu.org; h=content-transfer-encoding:content-type:mime-version:references :in-reply-to:message-id:date:subject:cc:to:from:from:to:cc:subject :date:message-id:reply-to:content-type; bh=Tg+6JGrg8TlSUod8NUCzwBY6Ua5KjOcrJARbt2DJV6I=; b=hxR99tugjG9Vp4BUd4z73K1qW/gGOFcZJCMUown5+xyN/0CmG8Yz3cd5JRbsmHnsLY aCPLg6FKRNZNq3yVwVm2VyjJDAGPMdkmunkVUBZS18cVaAH0pvFN9bgjx2P3s3ylbNLj Z97cu2fF1OME13bBF6agNirAq7kvYF3OiHUogbESNUICVOPkapDKPbhxiKNVwlJqB1PJ JHTLP4VSDYXD+4eK5Us1XYeV4D4z85peIu6YMQ3UUI6nB8yv9Kk+8EI29XgfDCJ6Td3r wE56/LX84XRCW+rwyHBGsmhKkVNyaLpcXlEsJ8ooqzIYgjFVwMy+9EOzaBZeiQJ40vpq d3yA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1790790638; x=1791395438; h=content-transfer-encoding:content-type:mime-version:references :in-reply-to:message-id:date:subject:cc:to:from:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=Tg+6JGrg8TlSUod8NUCzwBY6Ua5KjOcrJARbt2DJV6I=; b=ybIHLTzaAub1oILe7YuTg72sCs0YV2/NBOLbKxtiG9SiYRfOvU6ZrErqS4XCQ2dYJB EqSPlw+b0sQWTZnVgoQBcGzqHki/e2J8LYEFy4vjzWJm1JbbP5mx6xtmb03e2sO6Awn9 Sn2DqbtvBpJcypeLe4s4CmeeieANXAzf6HFeq0tkJg/6PnhpwVanFLwTDnHKfkOsMGNT vAzK8UrBjdDkQzEZfwbLi2DELgqo3cF9Z9ibVWHLZoj8lnCKOa44R+Md8bpAaAQaUoBB xVSoPRpsI2uNZAHa4RHmxXVbLRwF4CY6nXY+lb13H5umTpiHPGDWGb5CZflrh564wxWn uKVQ== X-Gm-Message-State: AFq9FYLeNhFLEXhWpP8yxvbA4vQ+zrqfwWLT72YknMqVxJe7WXLx0SbG 9Nnfvd9ko2gRlkSgbHFnbtAvgav+4lAVGWLdVcUaV7ih8d7grO0wE6fJNJEloCIWXrrTKV7elpA I/9o6ODdqn1i4O7K/oFT+h8AnwFTXjWOjCQ3nIMx6t7fzN3VJEzq7jrl9xGusuz3eYg== X-Gm-Gg: AYBFou3BCJVzPFD4kO+9M+ouJSz+7FDzfUFV4PAXCQLTK9p2zt9Yer/zveaf7wOUYTK 6bBknOgC4XZAVScgiwf0vii4De7TiWBDav+xdjcL0vX1tkkTT/xFD3laxmQRJy8mHYvyjiDeAG+ 2IDxu8NeLmKb4SWt4s9Nginy3786xjf3JquyHxmA4DyoESCjrFNS6oBsqNEUl0x64BkxKxEPTdP wP5eVbK2+P6SKOxOIpnG6QAaoqsNXgAXhByHpcyR/Or3cNbepbknRi2EPPmlDVVD9siEPAAjf5n ru6nrO1ePZu/ytc3Qn7UAQc5/pwkkrEpj0w33JhQO+CGM3pw9Y4FQWAogjieEHCxa0L5A4bRAox TnqvkOMuA2f0MdXiJjDqn18gKml+uGqqbXlZKX4sF X-Received: by 2002:a67:e7c6:0:b0:7a1:84bd:7f50 with SMTP id ada2fe7eead31-7be61e90ccfmr698163137.1.1790790638203; Wed, 30 Sep 2026 10:50:38 -0700 (PDT) X-Received: by 2002:a67:e7c6:0:b0:7a1:84bd:7f50 with SMTP id ada2fe7eead31-7be61e90ccfmr698152137.1.1790790637730; Wed, 30 Sep 2026 10:50:37 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Richard Henderson , Peter Maydell , Paolo Bonzini , qemu-arm@nongnu.org, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PATCH v4 7/9] target/i386: Use generic halt transition handlers Date: Wed, 30 Sep 2026 19:49:43 +0200 Message-ID: <20260930174946.82195-8-philmd@oss.qualcomm.com> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260930174946.82195-1-philmd@oss.qualcomm.com> References: <20260930174946.82195-1-philmd@oss.qualcomm.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Authority-Analysis: v=2.4 cv=Gr3XaU1C c=1 sm=1 tr=0 ts=6abd4bee cx=c_pps a=5HAIKLe1ejAbszaTRHs9Ug==:117 a=4s3hRJSeHn4rkQlkrse1kQ==:17 a=IkcTkHD0fZMA:10 a=VdqzKS8jKosA:10 a=M51BFTxLslgA:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=u7WPNUs3qKkmUXheDGA7:22 a=3WHJM1ZQz_JShphwDgj5:22 a=EUspDBNiAAAA:8 a=KKAkSRfTAAAA:8 a=xWu8-Agft_6X_INOG6MA:9 a=3ZKOabzyN94A:10 a=QEXdDO2ut3YA:10 a=gYDTvv6II1OnSo0itH1n:22 a=cvBusfyB2V15izCimMoJ:22 X-Proofpoint-Spam-Info: AW1haW4tMjYwOTMwMDA3MSBTYWx0ZWRfX7qnEhkE+Vwu3 qRHIN4RYH8YUOjZpj6h5Wz92Pg5n7b4fMBGo/t2KnngsJy0nf0sh7w75zDN42TKij5dMSSOeE+5 BRDGVRYURBzqXShFoSoxYklMYPRriuo= X-Proofpoint-GUID: RsFMkdgBq1E3I4b66UN5kta2l3s19D-s X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwOTMwMDA3MSBTYWx0ZWRfXzzLAklRlmJBv THq2/v+k3H4nkPvoOpwJZdHsMcM3fplkJGL/mjpoxJBVLFn/R8PEDNvL71OUpHhQR/i1ygd4tmc 0771pSVetKWZ4wbM1HplGvqvT1nCOSIBtgXMHUybvcZrtwIHdSfq8okDALclJyMNJ4HdK37zCVJ Rc+AAgWjf+dBhrUY0tmohfOLo7N/DfSNd0u4Wyga9BP9566w2YCuS4ddYJUOUu9L/tvwVX8jOMp 8SWyoVnQ/aaPMfpN8gagwOjC+Usd3A347mMLF1THL9jDuqSaI/PqApksKiBfXsgA+EjxccBcamM XZ5+zc4U5IDrZgfMem5LpdUvWiQiUOWlibgK3RAryoB+PcyXhODkFAnbhl7qkPbwZy5ICuUOq1w GfjOOTtzGNUzWDyHABh/Y81WzpDxVLACpsNWWMuHE+MSKEbp3fgX5OrvZJDS1zO5GfEvn/YAozz ICA5BZaU2ez7Dbg2ioQ== X-Proofpoint-ORIG-GUID: RsFMkdgBq1E3I4b66UN5kta2l3s19D-s X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1176,Hydra:6.1.134,FMLib:17.12.100.49 definitions=2026-09-30_04,2026-09-21_02,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 clxscore=1015 bulkscore=0 malwarescore=0 adultscore=0 lowpriorityscore=0 spamscore=0 suspectscore=0 impostorscore=0 priorityscore=1501 phishscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2609040000 definitions=main-2609300071 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists1p.gnu.org; Received-SPF: pass client-ip=205.220.180.131; envelope-from=philmd@oss.qualcomm.com; helo=mx0b-0031df01.pphosted.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 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_LOW=-0.7, 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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @qualcomm.com) X-ZM-MESSAGEID: 1790790725312158500 Register x86_cpu_poll_during_halt() and x86_cpu_leaving_halt() with the generic TCG halt flow. Remove the target-specific x86_cpu_exec_halt() wrapper. Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Richard Henderson --- target/i386/tcg/helper-tcg.h | 1 - target/i386/tcg/system/seg_helper.c | 11 ----------- target/i386/tcg/tcg-cpu.c | 3 ++- 3 files changed, 2 insertions(+), 13 deletions(-) diff --git a/target/i386/tcg/helper-tcg.h b/target/i386/tcg/helper-tcg.h index 96accb30a80..4d543556a9f 100644 --- a/target/i386/tcg/helper-tcg.h +++ b/target/i386/tcg/helper-tcg.h @@ -38,7 +38,6 @@ void x86_cpu_do_interrupt(CPUState *cpu); #ifndef CONFIG_USER_ONLY void x86_cpu_poll_during_halt(CPUState *cpu); -bool x86_cpu_exec_halt(CPUState *cpu); void x86_cpu_leaving_halt(CPUState *cpu); bool x86_need_replay_interrupt(int interrupt_request); bool x86_cpu_exec_interrupt(CPUState *cpu, int int_req); diff --git a/target/i386/tcg/system/seg_helper.c b/target/i386/tcg/system/s= eg_helper.c index 566b3d4d80c..e24d01000ad 100644 --- a/target/i386/tcg/system/seg_helper.c +++ b/target/i386/tcg/system/seg_helper.c @@ -157,17 +157,6 @@ void x86_cpu_leaving_halt(CPUState *cpu) } } =20 -bool x86_cpu_exec_halt(CPUState *cpu) -{ - if (!cpu_has_work(cpu)) { - return false; - } - - x86_cpu_leaving_halt(cpu); - - return true; -} - bool x86_need_replay_interrupt(int interrupt_request) { /* diff --git a/target/i386/tcg/tcg-cpu.c b/target/i386/tcg/tcg-cpu.c index 6f5dc06b3b9..2fde412394f 100644 --- a/target/i386/tcg/tcg-cpu.c +++ b/target/i386/tcg/tcg-cpu.c @@ -180,7 +180,8 @@ const TCGCPUOps x86_tcg_ops =3D { .tlb_fill =3D x86_cpu_tlb_fill, .pointer_wrap =3D x86_pointer_wrap, .do_interrupt =3D x86_cpu_do_interrupt, - .cpu_exec_halt =3D x86_cpu_exec_halt, + .poll_during_halt =3D x86_cpu_poll_during_halt, + .leaving_halt =3D x86_cpu_leaving_halt, .cpu_exec_interrupt =3D x86_cpu_exec_interrupt, .cpu_exec_reset =3D x86_cpu_exec_reset, .do_unaligned_access =3D x86_cpu_do_unaligned_access, --=20 2.55.0 From nobody Sat Oct 24 00:32:26 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=reject dis=none) header.from=oss.qualcomm.com ARC-Seal: i=1; a=rsa-sha256; t=1790790718; cv=none; d=zohomail.com; s=zohoarc; b=XwiSFbzp7m3kBdafTxVRYrKWRsjFbVRDNOtLv2wPAVwtSMdlpV18jKONBUVi/W98QSWzpx0BQnR92SinkhirG54dTTySIwzb/r4HodzYEY396Eccr/dDGPQuIMwjErzqFHFf3Zmqfncl3H0nP3fJog0gwtsrfltgvMAWI9bUt80= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1790790718; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=umBn4N/wtIjXHvktox4c/lOAr71sWERl+bXZVsuFbkA=; b=fAlaCiiyctecQvB693d3a+yhUAp3EVj0IYDKcAJYnXWCeFzB+a/EHYh0PbBEUZ682oI0l3vi2Cv8QYPDXyfrmQ55shm7Q2xa3txWbsrRg3f/Vg/urqxOSmYOS69lfn14AO/XI3gLFKtqEaGyYBPLhCwrhKdwWpAP1mGLmqeysqw= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=reject dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1790790718071370.07220773943527; Wed, 30 Sep 2026 10:51:58 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1xBySd-0002mk-8M; Wed, 30 Sep 2026 13:51:19 -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 1xBySB-00023k-LN for qemu-devel@nongnu.org; Wed, 30 Sep 2026 13:50:54 -0400 Received: from mx0b-0031df01.pphosted.com ([205.220.180.131]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1xByS8-0001Yy-TT for qemu-devel@nongnu.org; Wed, 30 Sep 2026 13:50:51 -0400 Received: from pps.filterd (m0279868.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 68UHfF6V4014411 for ; Wed, 30 Sep 2026 17:50:48 GMT Received: from mail-qt1-f200.google.com (mail-qt1-f200.google.com [209.85.160.200]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4h0x27jtbs-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Wed, 30 Sep 2026 17:50:47 +0000 (GMT) Received: by mail-qt1-f200.google.com with SMTP id d75a77b69052e-5336778acfeso18334161cf.0 for ; Wed, 30 Sep 2026 10:50:47 -0700 (PDT) Received: from localhost.localdomain (pmd666.hd.free.fr. [88.187.86.199]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-48b068ff6f9sm701644f8f.7.2026.09.30.10.50.43 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Wed, 30 Sep 2026 10:50:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qualcomm.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=qcppdkim1; bh= umBn4N/wtIjXHvktox4c/lOAr71sWERl+bXZVsuFbkA=; b=F4ifl9ntNHIfGk3k j783wYRyy8QisC9Xj4swXkQHjZgpwko1b7UIfTt2uHfx/LU3zjdtqrlnkVL89nzq LDYrolkX8yk8JkrMZ2U4mtRzhn3COsWk3m+nFH83e1IGD4tCcN+lisdero612KRO YDFAxk6Ie4je6TyQ7LEaDhev8dJoG8IG5qid+xYklG1gEAR4tYy1WOllxEDTIDC/ tW218HZp1+TwkIU8yWPiewTPmGxlnBmXXApEramder+tAISaWpgtfElfah7gbUXu P8Cd91RwIpK56p0Y/xo7zG8j7sdN7kHkTxYOtFsSGKNqTRMpwRK8Hci3Y2Dvd1aK ezXkQQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1790790647; x=1791395447; darn=nongnu.org; h=content-transfer-encoding:content-type:mime-version:references :in-reply-to:message-id:date:subject:cc:to:from:from:to:cc:subject :date:message-id:reply-to:content-type; bh=umBn4N/wtIjXHvktox4c/lOAr71sWERl+bXZVsuFbkA=; b=X0bzxXY/yDmSAPuR8uP35UjddStQozyHxOWieUoHxfGvjEAbtyMtPRkcDeN5vlreSz TjIt0EjFHznCKxnwvGOv7ugZEbt/oI/QhEK+9y9by4nSFNBtUgEVTzTTk4iEntGBKlzY gcncQULvr3gszI3zgL+Oey8gqHRdLz+ttbIVbwGNunpXx7powaAToBkMyMngmf97dPly eM0hbPEKXjWj9A4qbTS9dpwxLrMROyaBA94bMrbbeIksylBZbty/pSBWK4ZRNFRkGd29 QvDlH2B5EC2Rd8LnKer5covEXvS9X4++NUhgychYZlNjNX5h5EFySMX7IXOapKAN7VLd A4rA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1790790647; x=1791395447; h=content-transfer-encoding:content-type:mime-version:references :in-reply-to:message-id:date:subject:cc:to:from:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=umBn4N/wtIjXHvktox4c/lOAr71sWERl+bXZVsuFbkA=; b=Kx1iKke/kHPecRTHLW36i7oEI0HqSuix3G3NyZyH2DNNUNaKqAXpXWzT4s1clxbvIm eiQFhduLKhEyZwsVBbwTxmewD5fahHjUTi8bMxKD+eGM4Dq75gQ4Y8rTgjxORWEjDv4/ X+ekXSJ63R9qByYjTXSsEhojpwVn0B4i6jY2B9WKwFGfejxR7NTAv9kqL55aTzghGnAq QiHEM3V+GJLBjYECsRpjj9lp8uytTkJCTNfd235mhLkjgHaJn0NOw7bGkSIxwUH0rINS NaGuZpu4AcqGuYcW/38J9IoF0cErDhW2B9/h82sC1Ols7Ng66qEcWYasR1uGBoNt9llJ i5Ag== X-Gm-Message-State: AFuF++kbRSbMk28zJBfF/vcIX/QR5oPnv8YDJfU1CKUB5FjW9E04xSIu nBDPg7dVzDZG8YKI63uHfZmcTLiSOM5T+zLH4uwWFNUYhouQlTejs4oqbp7qfTS2egWS+Ukhl57 E/0eHV6XSPyVPitcu16Sw2Oj+l+vMFb/MWGuofwrmBUgvG8pa9aJXJegJvpARMxAgZQ== X-Gm-Gg: AYBFou3UCSlH4krkDx1XuIY8ezloC3cqnJpl3ftsMUUaodQcgOKdQ/1XyaGNYXvfwUl gYwYBmSi7777WPzPDOuUKPLNNeh+/8GXjvzC2I6Nk3PpAA1Zyj6l83qP+tj4n18OercWybkCc59 eJBAGD2uylO1wWGXG8JoEYaMmU1wzh9CKBCVdnftFwznm3mzXpzCUn/Vb7GdvgY6CFB1CERhjf7 6ssOn6GKUzWyA2onS32e1Gmx6EKsMHeRC0AQvIYzuWnDnPCukg1us3IY7ZToMFc6gZt0sV0gP7E 2kcBAYVl5Yc/H5mSCz/Rk0S6sxFK1bzHNObUq2Hlyrd3O9ZwB1+LHktmE7rAnEn+x507GM7ZRZj c2nrjlEYK/d7c/Nhd31GdohHv3rA6sQdAk5lIeIq8 X-Received: by 2002:a05:620a:410f:b0:93a:48a:167 with SMTP id af79cd13be357-93ca973260fmr402117185a.39.1790790646769; Wed, 30 Sep 2026 10:50:46 -0700 (PDT) X-Received: by 2002:a05:620a:410f:b0:93a:48a:167 with SMTP id af79cd13be357-93ca973260fmr402111785a.39.1790790646099; Wed, 30 Sep 2026 10:50:46 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Richard Henderson , Peter Maydell , Paolo Bonzini , qemu-arm@nongnu.org, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Michael Rolnik , Brian Cain , Pierrick Bouvier , Helge Deller , Song Gao <17746591750@163.com>, Bibo Mao , Xianglai Li , Laurent Vivier , "Edgar E. Iglesias" , Aurelien Jarno , Jiaxun Yang , Aleksandar Rikalo , Stafford Horne , Chinmay Rath , Nicholas Piggin , Glenn Miles , Harsh Prateek Bora , Palmer Dabbelt , Alistair Francis , Weiwei Li , Daniel Henrique Barboza , Liu Zhiwei , Chao Liu , Yoshinori Sato , Ilya Leoshkevich , David Hildenbrand , Cornelia Huck , Eric Farman , Matthew Rosato , Mark Cave-Ayland , Artyom Tarasenko , Max Filippov , qemu-ppc@nongnu.org, qemu-riscv@nongnu.org, qemu-s390x@nongnu.org Subject: [PATCH v4 8/9] accel/tcg: Remove the redundant cpu_exec_halt() hook Date: Wed, 30 Sep 2026 19:49:44 +0200 Message-ID: <20260930174946.82195-9-philmd@oss.qualcomm.com> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260930174946.82195-1-philmd@oss.qualcomm.com> References: <20260930174946.82195-1-philmd@oss.qualcomm.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Proofpoint-Spam-Info: AW1haW4tMjYwOTMwMDA3MSBTYWx0ZWRfXxf/oAVU9Apk2 NAqCsiuy9VucyIgp5ZPXRNcrAkzfWKwdeuDPTievEFlGXQtCUX9S/R0dSNpunV8aw1m/MXY1rS5 FgeVwjPVGLwVCVDPvV7JFvqfFgmXVvU= X-Proofpoint-GUID: rhYkOFMInrVMt3b6_FFu5RpablqmMpuY X-Authority-Analysis: v=2.4 cv=W9GtxhWk c=1 sm=1 tr=0 ts=6abd4bf7 cx=c_pps a=JbAStetqSzwMeJznSMzCyw==:117 a=4s3hRJSeHn4rkQlkrse1kQ==:17 a=IkcTkHD0fZMA:10 a=VdqzKS8jKosA:10 a=M51BFTxLslgA:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=u7WPNUs3qKkmUXheDGA7:22 a=ZpdpYltYx_vBUK5n70dp:22 a=EUspDBNiAAAA:8 a=KKAkSRfTAAAA:8 a=Fma_We6Em7EAR7gKL-MA:9 a=3ZKOabzyN94A:10 a=QEXdDO2ut3YA:10 a=uxP6HrT_eTzRwkO_Te1X:22 a=cvBusfyB2V15izCimMoJ:22 X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwOTMwMDA3MSBTYWx0ZWRfXyhS4qgzCUH97 nWmcETRt2Qo5CT3zjbWJJajX74KHhbDPdHLGM6g1bI6Seh7EWJM6K3jMkdEOuzt0POBuHP9MDhA UEYxR7+Xc11/4l9BsH3/By+tYPqIMPIx8GbI+rgVAvBdLVNx+TV34VU2hL4Y3Sn89RUcLxZNSzl Yl4cq2R4xS+8NJPtU6cwTEEDI6MfcGLomI+qQPKsYk3dRx3/s6/ttsKl0JpEMuKazte4zneI+Pg 0raG5Wv4wCOEJivXJY5tSszTEP/kS+44YXF1MKplFrTXM1xJhV9XyLLOugZIeH0+/Yr1XYz5o+v 5rwa4zx5/cm8rztZUz52pjvjJMqA3YF87DmgEx9BBtu6UH8a6FJXbHqSHMFfmL34MXGnE/55XcZ qBj9nXSDOh1qBdCsH8z6TF71vbGJcVLCRK8ijaPrZV8ebWLuIe/s0oMBfXjscTJVypXGodA4lFn LWAYz1saNpqdlermwEg== X-Proofpoint-ORIG-GUID: rhYkOFMInrVMt3b6_FFu5RpablqmMpuY X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1176,Hydra:6.1.134,FMLib:17.12.100.49 definitions=2026-09-30_04,2026-09-21_02,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 adultscore=0 malwarescore=0 clxscore=1015 phishscore=0 spamscore=0 priorityscore=1501 bulkscore=0 impostorscore=0 suspectscore=0 lowpriorityscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2609040000 definitions=main-2609300071 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists1p.gnu.org; Received-SPF: pass client-ip=205.220.180.131; envelope-from=philmd@oss.qualcomm.com; helo=mx0b-0031df01.pphosted.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 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_LOW=-0.7, 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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @qualcomm.com) X-ZM-MESSAGEID: 1790790719583158500 All remaining users of cpu_exec_halt simply alias cpu_has_work(). Call cpu_has_work() directly from the generic halt flow and remove the redundant hook registrations and interface definition. Make affected cpu_has_work() helpers private where possible. Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Richard Henderson --- include/accel/tcg/cpu-ops.h | 18 ------------------ target/loongarch/internals.h | 1 - target/riscv/internals.h | 5 ----- target/s390x/s390x-internal.h | 1 - accel/tcg/cpu-exec.c | 23 ++++++++--------------- target/alpha/cpu.c | 1 - target/avr/cpu.c | 1 - target/hexagon/cpu.c | 1 - target/hppa/cpu.c | 1 - target/loongarch/cpu.c | 2 +- target/loongarch/tcg/tcg_cpu.c | 1 - target/m68k/cpu.c | 1 - target/microblaze/cpu.c | 1 - target/mips/cpu.c | 1 - target/or1k/cpu.c | 1 - target/ppc/cpu_init.c | 1 - target/riscv/cpu.c | 2 +- target/riscv/tcg/tcg-cpu.c | 1 - target/rx/cpu.c | 1 - target/s390x/cpu-system.c | 2 +- target/s390x/cpu.c | 1 - target/sh4/cpu.c | 1 - target/sparc/cpu.c | 1 - target/tricore/cpu.c | 1 - target/xtensa/cpu.c | 1 - 25 files changed, 11 insertions(+), 60 deletions(-) diff --git a/include/accel/tcg/cpu-ops.h b/include/accel/tcg/cpu-ops.h index 1ee5d3d8bdb..4195a29e1e4 100644 --- a/include/accel/tcg/cpu-ops.h +++ b/include/accel/tcg/cpu-ops.h @@ -187,7 +187,6 @@ struct TCGCPUOps { * resume execution from the halted state. This callback performs any * necessary target-specific state transitions or synchronization befo= re * instruction execution resumes. The caller does not hold the BQL. - * Either this callback or @cpu_exec_halt must be provided (but not bo= th). */ void (*leaving_halt)(CPUState *cpu); /** @do_interrupt: Callback for interrupt handling. */ @@ -196,23 +195,6 @@ struct TCGCPUOps { bool (*cpu_exec_interrupt)(CPUState *cpu, int interrupt_request); /** @cpu_exec_reset: Callback for reset in cpu_exec. */ void (*cpu_exec_reset)(CPUState *cpu); - /** - * @cpu_exec_halt: Callback for handling halt in cpu_exec. - * - * The target CPU should do any special processing here that it needs - * 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. (This should generally - * be the same value that cpu_has_work() would return.) - * - * Either @leaving_halt or this method must be provided, but not both. - * If the target does not need to - * do anything special for halt, the same function used for its - * SysemuCPUOps::has_work method can be used here, as they have the - * same function signature. - */ - bool (*cpu_exec_halt)(CPUState *cpu); /** * @tlb_fill_align: Handle a softmmu tlb miss * @cpu: cpu context diff --git a/target/loongarch/internals.h b/target/loongarch/internals.h index f9a0680fe0f..2e31442453e 100644 --- a/target/loongarch/internals.h +++ b/target/loongarch/internals.h @@ -38,7 +38,6 @@ void cpu_loongarch_timer_cb(void *opaque); uint64_t cpu_loongarch_get_timer_counter(CPUTimerState *timer); uint64_t cpu_loongarch_get_timer_ticks(CPUTimerState *timer); void cpu_loongarch_set_timer_config(CPUTimerState *timer, uint64_t value); -bool loongarch_cpu_has_work(CPUState *cs); bool cpu_loongarch_hw_interrupts_pending(CPULoongArchState *env); #endif /* !CONFIG_USER_ONLY */ =20 diff --git a/target/riscv/internals.h b/target/riscv/internals.h index 5d84e4de960..fb2d8b3e17a 100644 --- a/target/riscv/internals.h +++ b/target/riscv/internals.h @@ -201,11 +201,6 @@ static inline target_ulong get_xepc_mask(CPURISCVState= *env) } } =20 -#ifndef CONFIG_USER_ONLY -/* Our implementation of SysemuCPUOps::has_work */ -bool riscv_cpu_has_work(CPUState *cs); -#endif - /* Zjpm addr masking routine */ static inline target_ulong adjust_addr_body(CPURISCVState *env, target_ulong addr, diff --git a/target/s390x/s390x-internal.h b/target/s390x/s390x-internal.h index da60b2b1fd4..df1297b5c67 100644 --- a/target/s390x/s390x-internal.h +++ b/target/s390x/s390x-internal.h @@ -248,7 +248,6 @@ bool s390_cpu_system_realize(DeviceState *dev, Error **= errp); void s390_cpu_finalize(Object *obj); void s390_cpu_system_class_init(CPUClass *cc); void s390_cpu_machine_reset_cb(void *opaque); -bool s390_cpu_has_work(CPUState *cs); #endif /* CONFIG_USER_ONLY */ =20 =20 diff --git a/accel/tcg/cpu-exec.c b/accel/tcg/cpu-exec.c index 122ad9e2e49..9ead35418d3 100644 --- a/accel/tcg/cpu-exec.c +++ b/accel/tcg/cpu-exec.c @@ -48,7 +48,6 @@ #include "internal-common.h" #if !defined(CONFIG_USER_ONLY) #include "accel/tcg/iommu.h" -#include "hw/core/sysemu-cpu-ops.h" #endif =20 /* -icount align implementation. */ @@ -661,21 +660,16 @@ static bool cpu_poll_while_halted(CPUState *cpu) { const TCGCPUOps *tcg_ops =3D cpu->cc->tcg_ops; =20 + if (tcg_ops->poll_during_halt) { + tcg_ops->poll_during_halt(cpu); + } + + if (!cpu_has_work(cpu)) { + return false; + } + if (tcg_ops->leaving_halt) { - assert(!tcg_ops->cpu_exec_halt); - if (tcg_ops->poll_during_halt) { - tcg_ops->poll_during_halt(cpu); - } - if (!cpu_has_work(cpu)) { - return false; - } tcg_ops->leaving_halt(cpu); - } else { - assert(!tcg_ops->poll_during_halt); - assert(cpu->cc->sysemu_ops->has_work =3D=3D tcg_ops->cpu_exec_halt= ); - if (!tcg_ops->cpu_exec_halt(cpu)) { - return false; - } } =20 cpu->halted =3D 0; /* allow execution */ @@ -1074,7 +1068,6 @@ bool tcg_exec_realizefn(CPUState *cpu, Error **errp) /* Check mandatory TCGCPUOps handlers */ const TCGCPUOps *tcg_ops =3D cpu->cc->tcg_ops; #ifndef CONFIG_USER_ONLY - assert(tcg_ops->cpu_exec_halt || tcg_ops->leaving_halt); assert(tcg_ops->cpu_exec_interrupt); assert(tcg_ops->cpu_exec_reset); assert(tcg_ops->pointer_wrap); diff --git a/target/alpha/cpu.c b/target/alpha/cpu.c index 12e86021663..7d1d036e1d3 100644 --- a/target/alpha/cpu.c +++ b/target/alpha/cpu.c @@ -265,7 +265,6 @@ static const TCGCPUOps alpha_tcg_ops =3D { .tlb_fill =3D alpha_cpu_tlb_fill, .pointer_wrap =3D cpu_pointer_wrap_notreached, .cpu_exec_interrupt =3D alpha_cpu_exec_interrupt, - .cpu_exec_halt =3D alpha_cpu_has_work, .cpu_exec_reset =3D cpu_reset, .do_interrupt =3D alpha_cpu_do_interrupt, .do_transaction_failed =3D alpha_cpu_do_transaction_failed, diff --git a/target/avr/cpu.c b/target/avr/cpu.c index f8409f32ab9..a01e6fa4751 100644 --- a/target/avr/cpu.c +++ b/target/avr/cpu.c @@ -246,7 +246,6 @@ static const TCGCPUOps avr_tcg_ops =3D { .restore_state_to_opc =3D avr_restore_state_to_opc, .mmu_index =3D avr_cpu_mmu_index, .cpu_exec_interrupt =3D avr_cpu_exec_interrupt, - .cpu_exec_halt =3D avr_cpu_has_work, .cpu_exec_reset =3D cpu_reset, .tlb_fill =3D avr_cpu_tlb_fill, .do_interrupt =3D avr_cpu_do_interrupt, diff --git a/target/hexagon/cpu.c b/target/hexagon/cpu.c index 1f7d8a8df70..743c9260ef0 100644 --- a/target/hexagon/cpu.c +++ b/target/hexagon/cpu.c @@ -806,7 +806,6 @@ static const TCGCPUOps hexagon_tcg_ops =3D { .cpu_exec_reset =3D cpu_reset, .tlb_fill =3D hexagon_tlb_fill, .do_unaligned_access =3D hexagon_cpu_do_unaligned_access, - .cpu_exec_halt =3D hexagon_cpu_has_work, .do_interrupt =3D hexagon_cpu_do_interrupt, #endif /* !CONFIG_USER_ONLY */ }; diff --git a/target/hppa/cpu.c b/target/hppa/cpu.c index 07b49e51326..7b1309a7c38 100644 --- a/target/hppa/cpu.c +++ b/target/hppa/cpu.c @@ -270,7 +270,6 @@ static const TCGCPUOps hppa_tcg_ops =3D { .tlb_fill_align =3D hppa_cpu_tlb_fill_align, .pointer_wrap =3D cpu_pointer_wrap_notreached, .cpu_exec_interrupt =3D hppa_cpu_exec_interrupt, - .cpu_exec_halt =3D hppa_cpu_has_work, .cpu_exec_reset =3D cpu_reset, .do_interrupt =3D hppa_cpu_do_interrupt, .do_unaligned_access =3D hppa_cpu_do_unaligned_access, diff --git a/target/loongarch/cpu.c b/target/loongarch/cpu.c index f22f64efb80..6b765797393 100644 --- a/target/loongarch/cpu.c +++ b/target/loongarch/cpu.c @@ -123,7 +123,7 @@ bool cpu_loongarch_hw_interrupts_pending(CPULoongArchSt= ate *env) #endif =20 #ifndef CONFIG_USER_ONLY -bool loongarch_cpu_has_work(CPUState *cs) +static bool loongarch_cpu_has_work(CPUState *cs) { bool has_work =3D false; =20 diff --git a/target/loongarch/tcg/tcg_cpu.c b/target/loongarch/tcg/tcg_cpu.c index 4b1d44a1644..7ea2a1eb933 100644 --- a/target/loongarch/tcg/tcg_cpu.c +++ b/target/loongarch/tcg/tcg_cpu.c @@ -327,7 +327,6 @@ const TCGCPUOps loongarch_tcg_ops =3D { .tlb_fill =3D loongarch_cpu_tlb_fill, .pointer_wrap =3D loongarch_pointer_wrap, .cpu_exec_interrupt =3D loongarch_cpu_exec_interrupt, - .cpu_exec_halt =3D loongarch_cpu_has_work, .cpu_exec_reset =3D cpu_reset, .do_interrupt =3D loongarch_cpu_do_interrupt, .do_transaction_failed =3D loongarch_cpu_do_transaction_failed, diff --git a/target/m68k/cpu.c b/target/m68k/cpu.c index 9b52ad5fc23..c7771cbf643 100644 --- a/target/m68k/cpu.c +++ b/target/m68k/cpu.c @@ -710,7 +710,6 @@ static const TCGCPUOps m68k_tcg_ops =3D { .tlb_fill =3D m68k_cpu_tlb_fill, .pointer_wrap =3D cpu_pointer_wrap_uint32, .cpu_exec_interrupt =3D m68k_cpu_exec_interrupt, - .cpu_exec_halt =3D m68k_cpu_has_work, .cpu_exec_reset =3D cpu_reset, .do_interrupt =3D m68k_cpu_do_interrupt, .do_transaction_failed =3D m68k_cpu_transaction_failed, diff --git a/target/microblaze/cpu.c b/target/microblaze/cpu.c index 389a5124b12..6013a8def8e 100644 --- a/target/microblaze/cpu.c +++ b/target/microblaze/cpu.c @@ -448,7 +448,6 @@ static const TCGCPUOps mb_tcg_ops =3D { .tlb_fill =3D mb_cpu_tlb_fill, .pointer_wrap =3D cpu_pointer_wrap_uint32, .cpu_exec_interrupt =3D mb_cpu_exec_interrupt, - .cpu_exec_halt =3D mb_cpu_has_work, .cpu_exec_reset =3D cpu_reset, .do_interrupt =3D mb_cpu_do_interrupt, .do_transaction_failed =3D mb_cpu_transaction_failed, diff --git a/target/mips/cpu.c b/target/mips/cpu.c index 0fead20d651..c069aa1c0b7 100644 --- a/target/mips/cpu.c +++ b/target/mips/cpu.c @@ -716,7 +716,6 @@ static const TCGCPUOps mips_tcg_ops =3D { .tlb_fill =3D mips_cpu_tlb_fill, .pointer_wrap =3D mips_pointer_wrap, .cpu_exec_interrupt =3D mips_cpu_exec_interrupt, - .cpu_exec_halt =3D mips_cpu_has_work, .cpu_exec_reset =3D cpu_reset, .do_interrupt =3D mips_cpu_do_interrupt, .do_transaction_failed =3D mips_cpu_do_transaction_failed, diff --git a/target/or1k/cpu.c b/target/or1k/cpu.c index 66c00c0930c..42d9351b6d7 100644 --- a/target/or1k/cpu.c +++ b/target/or1k/cpu.c @@ -266,7 +266,6 @@ static const TCGCPUOps openrisc_tcg_ops =3D { .tlb_fill =3D openrisc_cpu_tlb_fill, .pointer_wrap =3D cpu_pointer_wrap_uint32, .cpu_exec_interrupt =3D openrisc_cpu_exec_interrupt, - .cpu_exec_halt =3D openrisc_cpu_has_work, .cpu_exec_reset =3D cpu_reset, .do_interrupt =3D openrisc_cpu_do_interrupt, #endif /* !CONFIG_USER_ONLY */ diff --git a/target/ppc/cpu_init.c b/target/ppc/cpu_init.c index b711f9c0a85..24748e50a20 100644 --- a/target/ppc/cpu_init.c +++ b/target/ppc/cpu_init.c @@ -7496,7 +7496,6 @@ static const TCGCPUOps ppc_tcg_ops =3D { .tlb_fill =3D ppc_cpu_tlb_fill, .pointer_wrap =3D ppc_pointer_wrap, .cpu_exec_interrupt =3D ppc_cpu_exec_interrupt, - .cpu_exec_halt =3D ppc_cpu_has_work, .cpu_exec_reset =3D cpu_reset, .do_interrupt =3D ppc_cpu_do_interrupt, .cpu_exec_enter =3D ppc_cpu_exec_enter, diff --git a/target/riscv/cpu.c b/target/riscv/cpu.c index 45e82fc30c5..5c6d638e3bd 100644 --- a/target/riscv/cpu.c +++ b/target/riscv/cpu.c @@ -960,7 +960,7 @@ uint64_t riscv_cpu_get_mip(const CPURISCVState *env) return qatomic_read(&env->mip); } =20 -bool riscv_cpu_has_work(CPUState *cs) +static bool riscv_cpu_has_work(CPUState *cs) { RISCVCPU *cpu =3D RISCV_CPU(cs); CPURISCVState *env =3D &cpu->env; diff --git a/target/riscv/tcg/tcg-cpu.c b/target/riscv/tcg/tcg-cpu.c index b68160af830..260ac6d89e7 100644 --- a/target/riscv/tcg/tcg-cpu.c +++ b/target/riscv/tcg/tcg-cpu.c @@ -286,7 +286,6 @@ const TCGCPUOps riscv_tcg_ops =3D { .tlb_fill =3D riscv_cpu_tlb_fill, .pointer_wrap =3D riscv_pointer_wrap, .cpu_exec_interrupt =3D riscv_cpu_exec_interrupt, - .cpu_exec_halt =3D riscv_cpu_has_work, .cpu_exec_reset =3D cpu_reset, .do_interrupt =3D riscv_cpu_do_interrupt, .do_transaction_failed =3D riscv_cpu_do_transaction_failed, diff --git a/target/rx/cpu.c b/target/rx/cpu.c index 9b8473d71cf..69946928995 100644 --- a/target/rx/cpu.c +++ b/target/rx/cpu.c @@ -227,7 +227,6 @@ static const TCGCPUOps rx_tcg_ops =3D { .pointer_wrap =3D cpu_pointer_wrap_uint32, =20 .cpu_exec_interrupt =3D rx_cpu_exec_interrupt, - .cpu_exec_halt =3D rx_cpu_has_work, .cpu_exec_reset =3D cpu_reset, .do_interrupt =3D rx_cpu_do_interrupt, }; diff --git a/target/s390x/cpu-system.c b/target/s390x/cpu-system.c index d963d9e940e..b2b4a7bc963 100644 --- a/target/s390x/cpu-system.c +++ b/target/s390x/cpu-system.c @@ -39,7 +39,7 @@ #include "system/tcg.h" #include "hw/core/sysemu-cpu-ops.h" =20 -bool s390_cpu_has_work(CPUState *cs) +static bool s390_cpu_has_work(CPUState *cs) { S390CPU *cpu =3D S390_CPU(cs); =20 diff --git a/target/s390x/cpu.c b/target/s390x/cpu.c index 85afc5dec9a..e7f81fabff6 100644 --- a/target/s390x/cpu.c +++ b/target/s390x/cpu.c @@ -384,7 +384,6 @@ static const TCGCPUOps s390_tcg_ops =3D { .tlb_fill =3D s390_cpu_tlb_fill, .pointer_wrap =3D s390_pointer_wrap, .cpu_exec_interrupt =3D s390_cpu_exec_interrupt, - .cpu_exec_halt =3D s390_cpu_has_work, .cpu_exec_reset =3D cpu_reset, .do_interrupt =3D s390_cpu_do_interrupt, .debug_excp_handler =3D s390x_cpu_debug_excp_handler, diff --git a/target/sh4/cpu.c b/target/sh4/cpu.c index 3bbdee301d5..55c73a1da35 100644 --- a/target/sh4/cpu.c +++ b/target/sh4/cpu.c @@ -312,7 +312,6 @@ static const TCGCPUOps superh_tcg_ops =3D { .tlb_fill =3D superh_cpu_tlb_fill, .pointer_wrap =3D cpu_pointer_wrap_notreached, .cpu_exec_interrupt =3D superh_cpu_exec_interrupt, - .cpu_exec_halt =3D superh_cpu_has_work, .cpu_exec_reset =3D cpu_reset, .do_interrupt =3D superh_cpu_do_interrupt, .do_unaligned_access =3D superh_cpu_do_unaligned_access, diff --git a/target/sparc/cpu.c b/target/sparc/cpu.c index ae9bdca9df8..1529f9570da 100644 --- a/target/sparc/cpu.c +++ b/target/sparc/cpu.c @@ -1074,7 +1074,6 @@ static const TCGCPUOps sparc_tcg_ops =3D { .tlb_fill =3D sparc_cpu_tlb_fill, .pointer_wrap =3D sparc_pointer_wrap, .cpu_exec_interrupt =3D sparc_cpu_exec_interrupt, - .cpu_exec_halt =3D sparc_cpu_has_work, .cpu_exec_reset =3D cpu_reset, .do_interrupt =3D sparc_cpu_do_interrupt, .do_transaction_failed =3D sparc_cpu_do_transaction_failed, diff --git a/target/tricore/cpu.c b/target/tricore/cpu.c index 84a05e3d363..82b56c3cd56 100644 --- a/target/tricore/cpu.c +++ b/target/tricore/cpu.c @@ -223,7 +223,6 @@ static const TCGCPUOps tricore_tcg_ops =3D { .tlb_fill =3D tricore_cpu_tlb_fill, .pointer_wrap =3D cpu_pointer_wrap_uint32, .cpu_exec_interrupt =3D tricore_cpu_exec_interrupt, - .cpu_exec_halt =3D tricore_cpu_has_work, .cpu_exec_reset =3D cpu_reset, }; =20 diff --git a/target/xtensa/cpu.c b/target/xtensa/cpu.c index 7c25b9ab707..99c8bd4b5fb 100644 --- a/target/xtensa/cpu.c +++ b/target/xtensa/cpu.c @@ -325,7 +325,6 @@ static const TCGCPUOps xtensa_tcg_ops =3D { .tlb_fill =3D xtensa_cpu_tlb_fill, .pointer_wrap =3D cpu_pointer_wrap_uint32, .cpu_exec_interrupt =3D xtensa_cpu_exec_interrupt, - .cpu_exec_halt =3D xtensa_cpu_has_work, .cpu_exec_reset =3D cpu_reset, .do_interrupt =3D xtensa_cpu_do_interrupt, .do_transaction_failed =3D xtensa_cpu_do_transaction_failed, --=20 2.55.0 From nobody Sat Oct 24 00:32:26 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=reject dis=none) header.from=oss.qualcomm.com ARC-Seal: i=1; a=rsa-sha256; t=1790790716; cv=none; d=zohomail.com; s=zohoarc; b=Sr0u5hNkPYbVn1a6WiOI9LUDyRluAIY1oCU4hK1zrGm6Q1JNw+daly1eriJnsxCtp8lYsvYj/sJjcd9fB22qft9YZzdTsS4JY6R+8eE6QDeJI6V9lK0eiZJoUqZ/ecvVzGnD0lVa8ZiNkKK+74FjMgTTBaff11HJjFRwtPfFaDs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1790790716; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=WiprO/BfxT5lE7ahfMPOMbhDy541FV9UafP7EhJU+Zk=; b=Y5NtTrV6aOhjJNShWRc+1tEtZAXR733QyHT7Y6196RAITrdhJOm84+a0ttjz/vsnspAVYcHeJCgK37DquLlqnk7vsWpHrXFCkY5bvDm/I7ZOgP2/RGRBHJV39nVbaNlTyjoOdn5BLvEeHmu7nqrZw7DSGkqTy3merxerSkcC/rU= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=reject dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1790790716636292.74355991899404; Wed, 30 Sep 2026 10:51:56 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1xBySg-00036Z-39; Wed, 30 Sep 2026 13:51:22 -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 1xBySR-0002KF-7r for qemu-devel@nongnu.org; Wed, 30 Sep 2026 13:51:09 -0400 Received: from mx0b-0031df01.pphosted.com ([205.220.180.131]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1xBySP-0001Zt-OF for qemu-devel@nongnu.org; Wed, 30 Sep 2026 13:51:06 -0400 Received: from pps.filterd (m0279871.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 68UHf8qs643862 for ; Wed, 30 Sep 2026 17:50:54 GMT Received: from mail-vs1-f71.google.com (mail-vs1-f71.google.com [209.85.217.71]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4h14n20uyu-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Wed, 30 Sep 2026 17:50:54 +0000 (GMT) Received: by mail-vs1-f71.google.com with SMTP id ada2fe7eead31-7bf5c02f7a3so78164137.2 for ; Wed, 30 Sep 2026 10:50:54 -0700 (PDT) Received: from localhost.localdomain (pmd666.hd.free.fr. [88.187.86.199]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4a01eb717acsm8138085e9.8.2026.09.30.10.50.52 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Wed, 30 Sep 2026 10:50:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qualcomm.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=qcppdkim1; bh= WiprO/BfxT5lE7ahfMPOMbhDy541FV9UafP7EhJU+Zk=; b=NPzkHbrBlvsD2t4x QnunFZ6I4x86lzRUfJWXRMtCg8UGGsowRQI6TBZ9m4p82OucFRnKBxClScSt/fc9 HHzv9KrioO0n+eVznHuL7AR/7whGm3ktmnBuxQ15hdxhQWGtqqjLQUD9BaLlKK1Q FKo9hdkappgx4ZnG0PhaKFKrE5Dy8/oYIDjaGLNG6OwTomotUX/gtobujs2HtZ8h Ce8GDJS59kckto3Krzt81Ua1yJYBkBp+0p4lKCEwPvIrWRC7E82cn36rPwNUpGqL Nj6DoIwGJpolssURAqo7rrZ+NLedMhiUsdqF1ZCr2+gVztf6nw3M5qZG7eFDrGUH xU0QFA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1790790654; x=1791395454; darn=nongnu.org; h=content-transfer-encoding:content-type:mime-version:references :in-reply-to:message-id:date:subject:cc:to:from:from:to:cc:subject :date:message-id:reply-to:content-type; bh=WiprO/BfxT5lE7ahfMPOMbhDy541FV9UafP7EhJU+Zk=; b=DvyklPkaAy9UO6v+F8wiNYrwGF0LcsoAVeGq5mBpqe7XoXUIvxjO/UZ2hTwksAnB6q 27E8YUxkOtQW145G8c3mL7ILx6J5Bwg8/Gqd96y/4OXaM7akOFtNK1FKn2PLgbeTiEsl +BMGDE39XPUqviv1tk2BZWhtAfXjY1c7QbXoIW2QZcGlWmMeXhfpvO1+W1LObZH/4XW6 wKIJHowNozoOBZ9/DCibLvQa1iyvcZHuRHyppsegi1zW1mt+T8EK/EWVcf5IZqYFwGlf rYFzFXTDGzyggNW2up9TKxkNpfJwFc/eHDnJwmSy0DeGOe3icd0ZFmdXLVbfVfu6Yss5 35HA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1790790654; x=1791395454; h=content-transfer-encoding:content-type:mime-version:references :in-reply-to:message-id:date:subject:cc:to:from:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=WiprO/BfxT5lE7ahfMPOMbhDy541FV9UafP7EhJU+Zk=; b=zu0zuKszjyGrxPMYbUwQReIqrNzAPAtBoxlCNwo0dYJXNyPr4OneZMKqNYHxFstvAY Wt5MgYbe32CTwReWAAQPZH72u+B4jXUBsrR4WUIwumRaeSnU4W2KVH2Hu4WMXDeZSi/G mVAS9Z7IM94sSs+VPxtKoZXSStuGd/6smxEA9yjzxk3o2dra2WOF0YtqQ0PdFqwCH2a1 kjQQMoV0KbhTlvdf87PIg+W4ALRd8F/hRDo8hToc9PrsJoy5qyIT3J7jasAlBY6iuMgr CpRPBL7WmpenLkP5LQ1y+sF7Fz6wrtSh6WKDxB+KAgxhqcr6RTgG5jBTYj+/MYoxkxt0 cFpA== X-Gm-Message-State: AFq9FYJJkxTGOQPWZ0ehgKiskPCOStcaLAeGRYQvJkkF2pTM3/7tDcin 6wE743lJbyZ1cLLQNyib6FVQwgM3lot4Jovt4IueESt238E1iDbkdTDOAHYw0Z3VcP0QxPsnGxY GE0/gmNhfql8aTrdhz9GUEI6aotJ/FWjhJyVlpvt7GWsyVlapLy5gobfWJprcsRPjdA== X-Gm-Gg: AYBFou1+HraDG+5rhe8KTPO0d6o5WagvTaYcnPiCDbJc91B2l/Xe4/MWYMm2CKftRBt 1X4A2+bZZrWKFaoGAbnSPIxkKvRUz9xPWgvzwzXIb7ODfK5f7I4J/dFyVMShEobVA99Fzh+AIPJ fjY5CfzHVVLowdy/rhpzy0Z6S2TqetQnyebkVbX9U6NYNLXW0tqF01SkHJcZ4m3VOdi9CEdzbKM qDnLXhacr3NPIo1hQXlIbEN9jxKPlwdqabtOpVJs8uz1D+zNtQj6CK1XtDWh01exUPTSi1nZFL+ Wkk5q8d5DnbfueKh9da46noKQySlQZgv2a+fCV4CHYilL+UjSOJlkxpJNyc/Yzwzlkq6G4T3aO/ Re7iVSWgRk1A4ofN1gDTqN6bfNg0gWYNzkmaWssbo X-Received: by 2002:a05:6102:54a7:b0:7b7:3acf:bd48 with SMTP id ada2fe7eead31-7be61e9038dmr591725137.2.1790790653796; Wed, 30 Sep 2026 10:50:53 -0700 (PDT) X-Received: by 2002:a05:6102:54a7:b0:7b7:3acf:bd48 with SMTP id ada2fe7eead31-7be61e9038dmr591708137.2.1790790653181; Wed, 30 Sep 2026 10:50:53 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Richard Henderson , Peter Maydell , Paolo Bonzini , qemu-arm@nongnu.org, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PATCH v4 9/9] target/arm: Kick vCPU after updating PSCI power state Date: Wed, 30 Sep 2026 19:49:45 +0200 Message-ID: <20260930174946.82195-10-philmd@oss.qualcomm.com> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260930174946.82195-1-philmd@oss.qualcomm.com> References: <20260930174946.82195-1-philmd@oss.qualcomm.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Authority-Analysis: v=2.4 cv=Gr3XaU1C c=1 sm=1 tr=0 ts=6abd4bfe cx=c_pps a=P2rfLEam3zuxRRdjJWA2cw==:117 a=4s3hRJSeHn4rkQlkrse1kQ==:17 a=IkcTkHD0fZMA:10 a=VdqzKS8jKosA:10 a=M51BFTxLslgA:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=u7WPNUs3qKkmUXheDGA7:22 a=3WHJM1ZQz_JShphwDgj5:22 a=20KFwNOVAAAA:8 a=EUspDBNiAAAA:8 a=Gywfzpfelcof4kT6qmkA:9 a=3ZKOabzyN94A:10 a=QEXdDO2ut3YA:10 a=ODZdjJIeia2B_SHc_B0f:22 X-Proofpoint-Spam-Info: AW1haW4tMjYwOTMwMDA3MSBTYWx0ZWRfX22SVWL2W4Uic /vj38heswsddS3SqnXweW2uSGBXKnX7EgGFBMtZW2hc0Z9xr2+fwPyFzuUUL6Fq/wUo0/JuwlCf v3LHbvw3yP4mWLR1ul+8nua/9a/Xumk= X-Proofpoint-GUID: bEq2Y7wEIEwbgFuBDbYFkvI4-NYRUucH X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwOTMwMDA3MSBTYWx0ZWRfX09HjcuqWFbuz pJkbXlUHznoYc4yuUduF1scYCHvidl+8DwgWkip9y/mKpDx0/2hD9GBH1TVSXXBrStA8/VgcqzI UBnENZ4rSbMpCy8FZbIBeVyAMgBcEJjYGQeK+cysJPFZ8UBQfUgv6SLSW3KiQecTUlDIFRTCEkb C6xS6shX8F8sZkTUbcJVD+OS/cRBRAMGkjV2vNM3RetukBkrl70NHHUhH6FfLiYMzAyZMJ/MZTW oJTNOE83XLb43LOdxSkCREoKkCmGxBes/g9UX4Uvg3/rH//sQAIUpKu0GZdMYptDTSfTmp8gL8X 0EInMNVvxEuYJvHXrMj28QU4/ZyPjfvzTD1bGgau7RHg++FuGLE2OeG306VXtboou+Bn03qqWdG e8F0h/PuqyXcUx7Qt0ALwgnCosIMuHs3edw6HmKIzYaksIQ2BShTzaEIkwHBA9eELCTIbqtbsYp it0qkujaKazI7kfL29Q== X-Proofpoint-ORIG-GUID: bEq2Y7wEIEwbgFuBDbYFkvI4-NYRUucH X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1176,Hydra:6.1.134,FMLib:17.12.100.49 definitions=2026-09-30_04,2026-09-21_02,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 clxscore=1015 bulkscore=0 malwarescore=0 adultscore=0 lowpriorityscore=0 spamscore=0 suspectscore=0 impostorscore=0 priorityscore=1501 phishscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2609040000 definitions=main-2609300071 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists1p.gnu.org; Received-SPF: pass client-ip=205.220.180.131; envelope-from=philmd@oss.qualcomm.com; helo=mx0b-0031df01.pphosted.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 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_LOW=-0.7, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable 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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @qualcomm.com) X-ZM-MESSAGEID: 1790790717417158500 PSCI can update the power state of a vCPU other than the caller. arm_cpu_has_work() reads env->halt_reason to decide whether that vCPU has work to do, and is called from the vCPU thread without the BQL held. A remote power_state/halt_reason update is therefore not observed until the target vCPU is rescheduled, so the vCPU stays halted and a PSCI CPU_ON of a secondary vCPU can hang. Kick the vCPU after changing its state so it re-evaluates promptly. Reported-by: Paolo Bonzini Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- target/arm/arm-powerctl.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/target/arm/arm-powerctl.c b/target/arm/arm-powerctl.c index ef14a1f8a94..1ba5277b023 100644 --- a/target/arm/arm-powerctl.c +++ b/target/arm/arm-powerctl.c @@ -48,9 +48,14 @@ struct CpuOnInfo { void arm_set_cpu_power_state(ARMCPU *cpu, ARMPSCIState state) { CPUARMState *env =3D &cpu->env; + CPUState *cs =3D CPU(cpu); =20 qatomic_set(&cpu->power_state, state); qatomic_set(&env->halt_reason, state =3D=3D PSCI_OFF ? HALT_PSCI : NOT= _HALTED); + + if (!qemu_cpu_is_self(cs)) { + qemu_cpu_kick(cs); + } } =20 static void arm_set_cpu_on_async_work(CPUState *target_cpu_state, --=20 2.55.0