From nobody Sat Jun 20 05:01:41 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=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1781874376; cv=none; d=zohomail.com; s=zohoarc; b=AJBBPBUHuruI1pQh4W9crK0ZBZ4bDwlXZkYHi/obfTwu/GdNEtgN3CsAZDHYhmbYabtgHiii4sg7wvnkowwii3I48SlCekWXIDc2YBIjOx3VxQj1A8C4agZc4Kv7yU+GesuZSWHVjMRGCBZfeqo2m3Wm5qjz3yn7Xw+4tA9Ed9w= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1781874376; 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:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=T72NDyunHLyFV4aqpIGKGdQkRXR7DefmzidasatP8oI=; b=i0T1kPWoywVseVM07bqnWJlzpqwYKUVKOelizIJ6JqdD1bVJ3WwdwPIdGpPxqi/Fv2WhRiD0P+wW4aKKq5jj8ShYZSPF/ogecVxs7GTq7o4nTHwCfbixAuBM4bamD49SrwP/XeCL9UZC/EZXcxBOC/Zwo8IhsAF6n2PWnnuvIgw= 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=none dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1781874376214928.2844556796698; Fri, 19 Jun 2026 06:06:16 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1waYum-0003tW-2K; Fri, 19 Jun 2026 09:05:44 -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 1waYuk-0003tD-Pd for qemu-devel@nongnu.org; Fri, 19 Jun 2026 09:05:42 -0400 Received: from mail-wr1-x434.google.com ([2a00:1450:4864:20::434]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1waYui-0003Or-Px for qemu-devel@nongnu.org; Fri, 19 Jun 2026 09:05:42 -0400 Received: by mail-wr1-x434.google.com with SMTP id ffacd0b85a97d-4626fdc829aso1606425f8f.3 for ; Fri, 19 Jun 2026 06:05:40 -0700 (PDT) Received: from draig.lan ([185.124.0.195]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-46508a04b55sm8170000f8f.5.2026.06.19.06.05.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 19 Jun 2026 06:05:38 -0700 (PDT) Received: from draig.lan (localhost [IPv6:::1]) by draig.lan (Postfix) with ESMTP id 5C3E15F814; Fri, 19 Jun 2026 14:05:37 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1781874339; x=1782479139; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=T72NDyunHLyFV4aqpIGKGdQkRXR7DefmzidasatP8oI=; b=OIj/gFV0DQ0uLt6GIviLedpL/NoyNRyGiT3RDihj2mQDqvcCTBoxdbastAQPk49f2h SEbRgWKyUThkV4pG1XIx4EyF30WiW4+mR8WaKV/SRkjWWyDqjWbpC175HFrv6XWd5UbM fd0oddnmWiY/K5Aib1C6prW0jIFhJuRN7MEApkryzBGQENcT6+mV4wuDdyMvJ83qAeSF lPXMC5dLHqTLveuLgxcWE17H0lLfcPjVsn//BVULPczeoruwpP0NQSjLz57OYL9nWSDU sEmEJOphcKTqfBQ2bnWNBsflEPUfXccJvV/y7LC4/Kayn8vevC+7u2alq+LcSWgDQ3iC BGrQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1781874339; x=1782479139; h=content-transfer-encoding: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; bh=T72NDyunHLyFV4aqpIGKGdQkRXR7DefmzidasatP8oI=; b=H2Bc4gz1DapMrzxBNwXyQpSq1SA5IUyHPavQbvYkJUUHAFrcgibBo+ZF5ZN++k0nhd Awc2kh+PUdns9L6xHgKdERMOeG1wW/f0TXlIAAE3AAfd7UGAEhbyHoO2/R8R7KOFbi+s OdXCXiWI4/2cCdmWul0dwK4eF6gJshqrmK35/M3xagaEr15mLuEVxBBARtVPet+yhk86 Ul/8PjHhUz/NS33DFJEZRxzrhqFCqJfKCjwQ/rf4rxhD+XHYQebdm73RGr8LL3DZWECd tu49ZdY1e7HRWLEBfTBLcIG0FE3l9uThKtysUyCd4vgj0RGLw7MXEvhKpFArCBjOBagw RVyw== X-Gm-Message-State: AOJu0YwuKuVVCIHzOb+H+3vROjd8yKY97cjRyR+mBf/xC1+LiSpponey PFTXJ43CXHLqUPUqSrpGOh7AZrSsOBimGf9wX2xKhr0xDf3w0JbUd6SwjO8xR9rLNo4= X-Gm-Gg: AfdE7cnggnkg0HYNJmh6HqbleRFj/2kABfMKbMU4ziewjO2B6haUAIVfak/xLJhdIW7 lVIBuvH1NdCBw/AP4GqTymLzMVwaCtF7h7GDfIAFeM+7ubmwAbYW52q2WjPuZmv1P+UTF11n5sA XhCU4bzivUT0k69SpgU68/RaEb0x8q7ntcC2XQ8Gfv/rgOjx9JIzmBtWQBJcA0KypmCR8CViFtS CPgKo6n3FTGWuFsjYiUhMGegKGz5xHuQVmYbrcFv41/ELiFvKkqX/TaDEdmz1g8xkv51z6QCMDP LSDSGwjea6ASz6PsTGnYH/rLTiy85sUapN9LX0rzSiyHeFjaxEBXhL3YLEvoLm52luveOZZv5H/ xZx3DtCD2q3dnCXHWTKXjPflMqsIUOFjt7e5DjalCjVHD5KXffrVFV54zKg4w1YKSYaOvB1oH4D 6iGvlFzpq7GUQr X-Received: by 2002:a5d:5d87:0:b0:45e:f381:cd85 with SMTP id ffacd0b85a97d-4656f4704b5mr3865725f8f.20.1781874338894; Fri, 19 Jun 2026 06:05:38 -0700 (PDT) From: =?UTF-8?q?Alex=20Benn=C3=A9e?= To: qemu-devel@nongnu.org Cc: Alexander Graf , Mohamed Mediouni , Paolo Bonzini , Pedro Barbuda , Jamin Lin , Steven Lee , Andrew Jeffery , Joel Stanley , qemu-arm@nongnu.org, Troy Lee , =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= , Kane Chen , Tyrone Ting , Peter Maydell , kvm@vger.kernel.org, Hao Wu , =?UTF-8?q?Alex=20Benn=C3=A9e?= , qemu-stable@nongnu.org, Arnd Bergmann , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PATCH v8 1/7] hw/arm: use cortex-a9 mpcore base for CBAR on npcm7xx machines Date: Fri, 19 Jun 2026 14:05:30 +0100 Message-ID: <20260619130537.820184-2-alex.bennee@linaro.org> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260619130537.820184-1-alex.bennee@linaro.org> References: <20260619130537.820184-1-alex.bennee@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable 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=2a00:1450:4864:20::434; envelope-from=alex.bennee@linaro.org; helo=mail-wr1-x434.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-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 @linaro.org) X-ZM-MESSAGEID: 1781874378277158500 CBAR is an IMPDEF register and according to the A9 TRM [1]: In Cortex-A9 MPCore implementations, the base address is reset to PERIPHBASE[31:13] so that software can determine the location of the private memory region [2]. If it doesn't we will confuse the Linux kernel as it probes the system SCU registers [3] and erroneously assumes the system is a buggy Aegis SOC and nerf the emission of SEV instructions, deadlocking any WFE's in the kernel (or QEMU smpboot code). [1] https://developer.arm.com/documentation/ddi0388/i/system-control/regist= er-descriptions/configuration-base-address-register [2] https://developer.arm.com/documentation/ddi0407/g/Introduction/Private-= Memory-Region [3] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree= /arch/arm/kernel/head.S?h=3Dv7.1#n550 Fixes: 2d8f048c25ab ("hw/arm: Add NPCM730 and NPCM750 SoC models") Cc: qemu-stable@nongnu.org Signed-off-by: Alex Benn=C3=A9e Suggested-by: Arnd Bergmann Reviewed-by: Peter Maydell Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- v2 - rewrote commit message for clarity, added links - used arnd's arndb.de address --- hw/arm/npcm7xx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/arm/npcm7xx.c b/hw/arm/npcm7xx.c index c2bbcd89dbc..c27f149c04a 100644 --- a/hw/arm/npcm7xx.c +++ b/hw/arm/npcm7xx.c @@ -492,7 +492,7 @@ static void npcm7xx_realize(DeviceState *dev, Error **e= rrp) /* CPUs */ for (i =3D 0; i < nc->num_cpus; i++) { object_property_set_int(OBJECT(&s->cpu[i]), "reset-cbar", - NPCM7XX_GIC_CPU_IF_ADDR, &error_abort); + NPCM7XX_CPUP_BA, &error_abort); object_property_set_bool(OBJECT(&s->cpu[i]), "reset-hivecs", true, &error_abort); =20 --=20 2.47.3 From nobody Sat Jun 20 05:01:41 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=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1781874398; cv=none; d=zohomail.com; s=zohoarc; b=lkmJOAYY7WDgT526S/apmW+2pP0U3sBrkVMUBQ0cFBEHPMynskmuIeEANmIwAWeqtw5nrrHSmxTSPhxv30Bf7VZzLN22K4PLpKHNPOy4AlppmFWdalSH0IL3ii3aQQcq0ys1ZvFxaZDWOYdF3nHrM0wolXmNKeSamNBnBPX3rMY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1781874398; 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:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=by9u5EKjsb+5+gHbsiBm0Rf3TJxywMdtV+jmRIHAyvY=; b=cCariJ0KihPryeb9lsZydJrv/XPZvm8hf2AIrGk3umjfuRtmwCWfPNM1usrtXx7GfI9ICPfCIQ3NKj2/5jYxlvUu7uMHbtvh5ACD9dTWYZQGnxQ8rGn9cj0V4LRnzdwC1Ma86EL8iy/vm59+zwrn6OJEyXEPIx1MERWiTlzSSLs= 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=none dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1781874398659749.9040406134671; Fri, 19 Jun 2026 06:06:38 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1waYuo-0003wC-R5; Fri, 19 Jun 2026 09:05:46 -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 1waYun-0003ut-KQ for qemu-devel@nongnu.org; Fri, 19 Jun 2026 09:05:45 -0400 Received: from mail-wr1-x42b.google.com ([2a00:1450:4864:20::42b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1waYuj-0003P0-Jp for qemu-devel@nongnu.org; Fri, 19 Jun 2026 09:05:45 -0400 Received: by mail-wr1-x42b.google.com with SMTP id ffacd0b85a97d-462bb734793so1511883f8f.1 for ; Fri, 19 Jun 2026 06:05:41 -0700 (PDT) Received: from draig.lan ([185.124.0.195]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-49245711032sm23657165e9.0.2026.06.19.06.05.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 19 Jun 2026 06:05:38 -0700 (PDT) Received: from draig.lan (localhost [IPv6:::1]) by draig.lan (Postfix) with ESMTP id 71C7B5F917; Fri, 19 Jun 2026 14:05:37 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1781874340; x=1782479140; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=by9u5EKjsb+5+gHbsiBm0Rf3TJxywMdtV+jmRIHAyvY=; b=o4E/u+gm/m+liIc/OrKFcYVWYEEdQq53Me03HhmE8FZMB6MDsO6qAdU9PxrupOxGMc DMCT3EcJXJlcwIYP9AWtZzunT1K3N9QqHh1NaNBcTFOpr44H54rn80B7ClQTox4dHl3w bsBMwhLLrt70np0SzBXiSHgyxXS7T1IxagcTPuwaxutgFpsUPc5TRzK/QKtvAj14UGYj r+wUB8W6W9Goo8G54VEElrt3JWUeCK0RqHapGiDFyHjL1iEZoRt6mg9HUJZJGcoLduID joZrh/TfD0g/4xffpzoK6wo6W1Euqy6950pse5Jy9UVMj8IPTuimSFYhfKyYPubSwHtQ tVLA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1781874340; x=1782479140; h=content-transfer-encoding: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; bh=by9u5EKjsb+5+gHbsiBm0Rf3TJxywMdtV+jmRIHAyvY=; b=XPx+OhmXRhied70jOkndCso/OAGHXSXwJJK3nKt0t90XCIced+2EdBYaNL8bgyi7RX XLS83LwTvLMIeAB6jeJ9oAbDXPvlvwZy+HDxxmNtpV9VMAAN8w9DeNvDtRQmAP002U3Y XfenK4gtzL5YgLC2h3DuIQNGRKyVWMQaBWMqROE+r+oTBQxc+4Jv2zrt+vhPnyexDKHV wD35rm80FrYRyTteL9bMyU5ymv5Ade4yVnrwimETtN82e9EjiHqdIoyhR8841hRESayH o44xfkaj3UIvJCH3cR22waR9KMQk3vQh/p5SDBaNlpFzzHxjxKwYzHHRqhTj5Jm9qXYA KyZg== X-Gm-Message-State: AOJu0Ywchg6yNt0dxMPyV8rcWzVpuFgejdCuEwi/WV9/Yafyz53PnGIL wJKW8RbJfpevy1pu7FbrtrVMXoS8nx3DSusCw54vYLTVh7+2XiRO0jVXqzOvm4fi6Zc= X-Gm-Gg: AfdE7cloekdplAJlTP5reSMWikUGV8EU3w/grNVMs9GdegYb/mtpzCh7qJsC+tkwL/p RWl+munbKt8sLBh3jp3vsvVUC8AqVO8XfS+/X2VcZEv/NnUZ8VQ3GtR0f+K+Sn9qdSSmEIYH4I8 JvBMqRhZy6FghqHEO+KTfD89z57t0OnP/ZermY63B/VoXQ8DHkgEHwSjCJH/OvHn3kTM6TTa7Bb QLmk3f/Okq6BMDuc/0vh80cx6581aN8suuBrxgo4LmBSCzSE5eJ2IxkgpfWRSTT2PC6mIirnjUN /GiXislyO1dItBp37kC2e5UwdTXVY0PuN0Hy4dTpCiLRBzYs0KHlnrmmOHvO69PRBX/uiSif2jw jR4yTZJOOK5EWVI5t/yFHU65PiZ0f1Hb63lScfrQchg42FFt85s8gg5CxVzED9H/eMZCqZfRmXe sz1Co6B5PF87Ictn2cfgHiKmg= X-Received: by 2002:a05:600c:c088:b0:490:c2a2:e91f with SMTP id 5b1f17b1804b1-4923f59f2c7mr60670475e9.35.1781874339752; Fri, 19 Jun 2026 06:05:39 -0700 (PDT) From: =?UTF-8?q?Alex=20Benn=C3=A9e?= To: qemu-devel@nongnu.org Cc: Alexander Graf , Mohamed Mediouni , Paolo Bonzini , Pedro Barbuda , Jamin Lin , Steven Lee , Andrew Jeffery , Joel Stanley , qemu-arm@nongnu.org, Troy Lee , =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= , Kane Chen , Tyrone Ting , Peter Maydell , kvm@vger.kernel.org, Hao Wu , =?UTF-8?q?Alex=20Benn=C3=A9e?= , =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= Subject: [PATCH v8 2/7] tests/functional: update anacapa-bmc image Date: Fri, 19 Jun 2026 14:05:31 +0100 Message-ID: <20260619130537.820184-3-alex.bennee@linaro.org> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260619130537.820184-1-alex.bennee@linaro.org> References: <20260619130537.820184-1-alex.bennee@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable 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=2a00:1450:4864:20::42b; envelope-from=alex.bennee@linaro.org; helo=mail-wr1-x42b.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=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 @linaro.org) X-ZM-MESSAGEID: 1781874400585158500 The initial version had the wrong DTB which caused issues with image corruption [1]. Update to the latest version. [1] https://github.com/legoater/qemu-aspeed-boot/pull/7 Suggested-by: C=C3=A9dric Le Goater Signed-off-by: Alex Benn=C3=A9e Reviewed-by: C=C3=A9dric Le Goater --- tests/functional/arm/test_aspeed_anacapa.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/functional/arm/test_aspeed_anacapa.py b/tests/functional= /arm/test_aspeed_anacapa.py index 27f8bd8b56a..b16c6035c95 100644 --- a/tests/functional/arm/test_aspeed_anacapa.py +++ b/tests/functional/arm/test_aspeed_anacapa.py @@ -11,8 +11,8 @@ class AnacapaMachine(FacebookAspeedTest): =20 ASSET_ANACAPA_FLASH =3D Asset( - 'https://github.com/legoater/qemu-aspeed-boot/raw/3fa3212827b04be4= 034d43b5adeef57c27d6ab18/images/anacapa-bmc/openbmc-20260512025228/obmc-pho= sphor-image-anacapa-20260512025228.static.mtd.xz', - '2232e241abcfb6d4f6b82cb6c378ce5ce05e364aac6d118785c2b6cc33fe43f3') + 'https://github.com/legoater/qemu-aspeed-boot/raw/refs/heads/maste= r/images/anacapa-bmc/openbmc-20260616025349/obmc-phosphor-image-anacapa-202= 60616025349.static.mtd.xz', + 'de3841fb6ed3085aec6424358ee6efc4b8ee85688361e5aa1987fd1acb7d3fb4') =20 def test_arm_ast2600_anacapa_openbmc(self): image_path =3D self.uncompress(self.ASSET_ANACAPA_FLASH) --=20 2.47.3 From nobody Sat Jun 20 05:01:41 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=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1781874452; cv=none; d=zohomail.com; s=zohoarc; b=n5zatvjOjq+hqG3GHzqqG7CbR5HC9qDOxuNpjyyVkEmCFhjl4PF99trbCCB5aUr8FXcJqGM+qBKlo0epcvb961h3ow8XLtF+rb2TRXqHoWXfJEiXg2pl1p0ENsFpnBg+DYNq30N8IZawDN1se3MFFTgLIWcUhLRDwDwgTf091c0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1781874452; 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:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=Il5WY7QfACzZ93YAvZWGe3XWn3xPIGhu97enE1XxJnA=; b=ZAw1W3fEwTqtXxf3JXVWyJzxy67+zcB+5N4Xv65WDUnsUmAXY7QWfrYxjP9VEmt97c5BstnWlh20Cj5UPlllmqe/hNxNrsyiFbc7II6XPgf3pBjZ0cyHc/Oo1f7s8Ke+fdfHxPvqKZCC5vCiwaZqrqQfDueXm4/VILgFp4qBH9E= 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=none dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1781874452812383.2172522652795; Fri, 19 Jun 2026 06:07:32 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1waYup-0003xi-RF; Fri, 19 Jun 2026 09:05:47 -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 1waYuo-0003wA-Oo for qemu-devel@nongnu.org; Fri, 19 Jun 2026 09:05:46 -0400 Received: from mail-wm1-x336.google.com ([2a00:1450:4864:20::336]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1waYuk-0003PP-FA for qemu-devel@nongnu.org; Fri, 19 Jun 2026 09:05:46 -0400 Received: by mail-wm1-x336.google.com with SMTP id 5b1f17b1804b1-49241dbf9c1so6982585e9.2 for ; Fri, 19 Jun 2026 06:05:42 -0700 (PDT) Received: from draig.lan ([185.124.0.195]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-49240efc160sm54997235e9.2.2026.06.19.06.05.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 19 Jun 2026 06:05:38 -0700 (PDT) Received: from draig.lan (localhost [IPv6:::1]) by draig.lan (Postfix) with ESMTP id 8B58F5F946; Fri, 19 Jun 2026 14:05:37 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1781874341; x=1782479141; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=Il5WY7QfACzZ93YAvZWGe3XWn3xPIGhu97enE1XxJnA=; b=ZLIbRfbg3aaP2+iuGlC8wsCnw7rQRyaXotxuWfrlcXrVLZIv/rxiACn7kQIIlbQzFD RjT4JdVJPXJQqV9CbNmYSpRHEBal7DwmAozLQh3udn/RQPfPSnXwY1sZYmaaaAXBB41Y tGoSRGTVDHSzg3zvfC6RhgERuAHa46Ogvn7wSIwGXRNgDhzYRa9Zz+Y5zHvfbNtJ6phB UomThOgnJzpRhJPatLBBZx0Rj4LY45m6OLCaJNnaZDMwXcswBI8EGbMDxxpPJqS7eCMO r/llr+eKdgoSpTJBNquqTdCVR3xmHqA+H1O10zQcNaMS/wOaDvOwvyNNoYIdSRg9ILsL adRg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1781874341; x=1782479141; h=content-transfer-encoding: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; bh=Il5WY7QfACzZ93YAvZWGe3XWn3xPIGhu97enE1XxJnA=; b=K8z08J0dkjaNBUT3JU4lnFYZv30rP2jqr7K+YiHx6TtKoBY1BmGpgoMgFFqc84k5AV j2ria1C0/MzgXIXZoHlrLqhMM6/kGHoKjs2mLprKUd1LHzEXi9iGLBKxzpK70wxpUYJZ jKgDD3uh9+q62qsw1UT7z/ZmyDu1v3yh2X5aWh1Dc2+ADo/+wod47ho32gboC8xAux3T spfy3vYkUavN38jOiilDIkApwlAS9seHnvnnuZ6cuT038wIgFFgQqHdKu5UAKDauWTnB Mm3rXu0aeInXVRmuQo5fZJMsf63oC4Xty3L6c/4uUMnhmPUwT6Gr1IjJqhh6NNn+LZRF 4Jpg== X-Gm-Message-State: AOJu0Ywd18yeYW7vgh649/DxN8FeBbf3STviyMQMZoxC7Y7ye1ZZebRp iE76MsVLa5Aikiumy8S3ppx9i9RzCfYH6vnps+tsaQInG95nSqfwRHpV6x8pAeXDsXE= X-Gm-Gg: AfdE7clijc0YA0qY/eSmEmhdE0GCIU4TAOrIng7S/mCkD+gBWbvV1ldmuqY/dej9BH4 tlij6KKgdSWepJvNQ88u2oKPxJ9JVgi64nadbEFB+GWJ6J00KNsUq1LDCxq4cW9I5FKcwp1F0Jx IHcPhPwp6PdE+9F9XH465jWEB2+x4oF6or31lmzN/cqHzAVOsUTnwkCNZCAMFnw//O8LpKX7A97 rw8gWO1mSoEF2hbz5LQzelQ27pdbAkNkgkhRltRPgP+58DP8gF8lJ9sLo/CzOweqBH9MFsVTLMZ K65CU+ypibgjn6DkU2Fp2I0tygJE1vKwxjRpS8zTPjns+x6CP9iU4OQrt4LaAl4EGpazrbXvvgL zMT6l6XAf3zErk9+IZuBZM1FejO2gGY1XscJuRoDq9Uj5AOIJoOtYyGrvjcre+4MvSh3tryVsYq 917mlUfPBzE9AQ X-Received: by 2002:a05:600d:4448:20b0:490:da12:f1fa with SMTP id 5b1f17b1804b1-49240ea7f99mr46236105e9.31.1781874340737; Fri, 19 Jun 2026 06:05:40 -0700 (PDT) From: =?UTF-8?q?Alex=20Benn=C3=A9e?= To: qemu-devel@nongnu.org Cc: Alexander Graf , Mohamed Mediouni , Paolo Bonzini , Pedro Barbuda , Jamin Lin , Steven Lee , Andrew Jeffery , Joel Stanley , qemu-arm@nongnu.org, Troy Lee , =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= , Kane Chen , Tyrone Ting , Peter Maydell , kvm@vger.kernel.org, Hao Wu , =?UTF-8?q?Alex=20Benn=C3=A9e?= Subject: [PATCH v8 3/7] target/arm: do not clear halting reason in has_work helper Date: Fri, 19 Jun 2026 14:05:32 +0100 Message-ID: <20260619130537.820184-4-alex.bennee@linaro.org> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260619130537.820184-1-alex.bennee@linaro.org> References: <20260619130537.820184-1-alex.bennee@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable 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=2a00:1450:4864:20::336; envelope-from=alex.bennee@linaro.org; helo=mail-wm1-x336.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=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 @linaro.org) X-ZM-MESSAGEID: 1781874454554158500 The helper will be called multiple times as we exit a loop and until we actually restart (via arm_cpu_exec_halt) we should leave the condition the same. Fixes: 6fd2fcdc61b (target/arm: teach arm_cpu_has_work about halting reason= s) Signed-off-by: Alex Benn=C3=A9e Reviewed-by: Peter Maydell --- include/hw/core/sysemu-cpu-ops.h | 3 +++ target/arm/cpu.c | 4 ++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/include/hw/core/sysemu-cpu-ops.h b/include/hw/core/sysemu-cpu-= ops.h index 8be6a84bd54..9a45596169a 100644 --- a/include/hw/core/sysemu-cpu-ops.h +++ b/include/hw/core/sysemu-cpu-ops.h @@ -18,6 +18,9 @@ typedef struct SysemuCPUOps { /** * @has_work: Callback for checking if there is work to do. + * + * This function should be idempotent (i.e. not change state) as + * it will likely be queried multiple times before a CPU resumes. */ bool (*has_work)(CPUState *cpu); /* MANDATORY NON-NULL */ /** diff --git a/target/arm/cpu.c b/target/arm/cpu.c index 86aae36ae55..597e0626e7f 100644 --- a/target/arm/cpu.c +++ b/target/arm/cpu.c @@ -158,7 +158,6 @@ static bool arm_cpu_has_work(CPUState *cs) * A wake-up event should only wake us if we are halted on a WFE */ if (cpu->env.halt_reason =3D=3D HALT_WFE && cpu->env.event_register) { - cpu->env.halt_reason =3D NOT_HALTED; return true; } =20 @@ -170,7 +169,6 @@ static bool arm_cpu_has_work(CPUState *cs) | CPU_INTERRUPT_NMI | CPU_INTERRUPT_VINMI | CPU= _INTERRUPT_VFNMI | CPU_INTERRUPT_VFIQ | CPU_INTERRUPT_VIRQ | CPU= _INTERRUPT_VSERR | CPU_INTERRUPT_EXITTB)) { - cpu->env.halt_reason =3D NOT_HALTED; return true; } =20 @@ -878,6 +876,8 @@ bool arm_cpu_exec_halt(CPUState *cs) if (cpu->wfxt_timer) { timer_del(cpu->wfxt_timer); } + /* clear the halt reason */ + cpu->env.halt_reason =3D NOT_HALTED; } return leave_halt; } --=20 2.47.3 From nobody Sat Jun 20 05:01:41 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=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1781874351; cv=none; d=zohomail.com; s=zohoarc; b=C9CTrK+Ur40PDIA94iXMHZDQj3nMaU/W4hav8aaMKtKUuvMisnXCRt0UZ3LYQDXaxwEo51FlZRWjT6Y02pMSG5m67eiiUd/A4rdQs606zGAgLwwzUF/Tf8JNm75Liq+ZAZAQUB+LGj1uXZ/mMMbzKvJHdSsp7I9HvOJn+JWTtu4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1781874351; 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:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=SE+r4wGFd7f55RWtkYqXbt9/MkUiYQSeM/Vm+Litt3k=; b=cBvEk5CYYlTaW/9LDd+DXyQ3Va16Vad6xicJ2MkkKxmj86I4xZB2ygDsTK7hBhfPCj2jUxXH++dlxlIFA0IDXVxBg8WMejmmwqeWOWBIGEO9FoDmFNeh/qUhDsKmxVIhdcE4T3hxHZbYMzjQToJ72b7xznjMzwK2fpRfz09u5pg= 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=none dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1781874351041654.3890937457847; Fri, 19 Jun 2026 06:05:51 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1waYup-0003wq-9V; Fri, 19 Jun 2026 09:05:47 -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 1waYun-0003um-HQ for qemu-devel@nongnu.org; Fri, 19 Jun 2026 09:05:45 -0400 Received: from mail-ej1-x62b.google.com ([2a00:1450:4864:20::62b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1waYuj-0003PC-Te for qemu-devel@nongnu.org; Fri, 19 Jun 2026 09:05:45 -0400 Received: by mail-ej1-x62b.google.com with SMTP id a640c23a62f3a-c07a6527453so239835966b.0 for ; Fri, 19 Jun 2026 06:05:41 -0700 (PDT) Received: from draig.lan ([185.124.0.195]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-4650b67a253sm8064924f8f.23.2026.06.19.06.05.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 19 Jun 2026 06:05:38 -0700 (PDT) Received: from draig.lan (localhost [IPv6:::1]) by draig.lan (Postfix) with ESMTP id A1FC85F94E; Fri, 19 Jun 2026 14:05:37 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1781874340; x=1782479140; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=SE+r4wGFd7f55RWtkYqXbt9/MkUiYQSeM/Vm+Litt3k=; b=NpNxy9in3sEultNtVNsnxkYIhnoxAyCUM3Z7k1EyyNUzfuh3pbakoca+0b+smB+Pwh mfmOPEd/myxbmQfm7Jljw5QftLNqjJ2/IhJgikefcTc7LbXCQiGMfurXh8FIjZamflmK O8lK8rWOHyxh97t0ogXyOBNMleezN8pBJEDEyHwfBT/nqFmuyveJAyiJyXTyd2YhT0/7 DlLGQAVpPODWd2L/j2cN3KJ+I/rWh6cty04HXIYvQtgct5f6Rmeb+PX8he2tMYxPCoKL p4pCzNQYZrO7PPWpg2Z7ZOUf+9aAGIOOjwLTAC8+1emNHv2Xc2kdpBuhlYq+qnKFApKu 6QLA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1781874340; x=1782479140; h=content-transfer-encoding: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; bh=SE+r4wGFd7f55RWtkYqXbt9/MkUiYQSeM/Vm+Litt3k=; b=gNPixfuoZDmdD/vkCNkvr0GzbCgpJoeT9DeBAWkYSRxajnc5h1XkXccnl029bQt5LS oBCUn4iYbjmKhLpXH59OW5nwUEg+t4V+DwX0pQsJREMHoZJRTczYkfgssxltIDXYfYXp MT80n14pngs9gr6W4sNhqy/mVc8lZq7uDVKhroLTUrspBm1ddYNm2C9gN6PhBfK3GyBK 5i6/0S354SluJskTo//KkKLOEW0VR+Ibfc1N0Pelm4/UmsyHLMIUCRjnS1z+O1zPSZek /8MQgtk8J9kHbSmzpI6UnoMTCAVOkbFsqYbWrrgZipTgA3NP05PgGVGVNFFlDKaoflB1 FLAw== X-Gm-Message-State: AOJu0Yw1nPa8KEX29UydamDQI6r4TAGsaZ9nSvaZBQRhF/1Fl39QnYDD A8R/3muWdOsyFGOeLvLnBHv1bufYQ0VM5KiK27ZgrGhD/wC4WWSp6jriqzDrbSaHh0U= X-Gm-Gg: AfdE7cn/UItnaqOvELc19SDjB5e5QdBYQCAKPxmEz2jM3kbjR7zfZm8mMN2FFq0cnYU eKjFsgHCzlAtrbmcY5RyaN1cxRoXpdKA8gM+vRxRIunUrPYDuk/4Pjjn4tUSnREW884zxUsdzvO PTIPMCXEgiO90s0Taphv0lJP/H2vrh44cKFJ7q+a0RhEYkC1us7h/K1xfr0eMHHv+uJtR1awnOW skGl37Eotgckd52EXBDMLYu8t6yA3aA/8C/5BV+5vn/mycTjUxFjMPRS6+ZN+bi+TQfJYgtxvCh MOoxKzpp3NQzh4QuFZtypc07lUrsXJbZ/MNL++wspJ+7GDG8KCJmonZ+pDJ9p5tkobKlreWtfKR y5ai6elu8q2erdzTFCFcGTVGOevjt74mU9K6qemfiomG9v9UZaYYI8D3F1QZMQ2hRc6qHdbWZ7A dEQ+Ecit3sKeZbWo65NkxMeYg= X-Received: by 2002:a17:907:94c2:b0:c05:84b7:550d with SMTP id a640c23a62f3a-c097ceba8f0mr182145466b.43.1781874340116; Fri, 19 Jun 2026 06:05:40 -0700 (PDT) From: =?UTF-8?q?Alex=20Benn=C3=A9e?= To: qemu-devel@nongnu.org Cc: Alexander Graf , Mohamed Mediouni , Paolo Bonzini , Pedro Barbuda , Jamin Lin , Steven Lee , Andrew Jeffery , Joel Stanley , qemu-arm@nongnu.org, Troy Lee , =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= , Kane Chen , Tyrone Ting , Peter Maydell , kvm@vger.kernel.org, Hao Wu , =?UTF-8?q?Alex=20Benn=C3=A9e?= Subject: [PATCH v8 4/7] target/arm: ensure we create the wxft_timer for all modes Date: Fri, 19 Jun 2026 14:05:33 +0100 Message-ID: <20260619130537.820184-5-alex.bennee@linaro.org> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260619130537.820184-1-alex.bennee@linaro.org> References: <20260619130537.820184-1-alex.bennee@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable 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=2a00:1450:4864:20::62b; envelope-from=alex.bennee@linaro.org; helo=mail-ej1-x62b.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-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 @linaro.org) X-ZM-MESSAGEID: 1781874354249158500 We don't want to just use it for timeouts as we will calculate which will comes first. Remove the wxft feature test in favour of the broader architecture checks. Signed-off-by: Alex Benn=C3=A9e --- v8 - new commit --- target/arm/cpu.h | 2 +- target/arm/cpu.c | 9 ++++++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/target/arm/cpu.h b/target/arm/cpu.h index 31a5567c951..8aa7437a397 100644 --- a/target/arm/cpu.h +++ b/target/arm/cpu.h @@ -966,7 +966,7 @@ struct ArchCPU { * pmu_op_finish() - it does not need other handling during migration */ QEMUTimer *pmu_timer; - /* Timer used for WFxT timeouts */ + /* Timer used for WFxT timeouts OR event stream events */ QEMUTimer *wfxt_timer; =20 /* GPIO outputs for generic timer */ diff --git a/target/arm/cpu.c b/target/arm/cpu.c index 597e0626e7f..61945b6e6cc 100644 --- a/target/arm/cpu.c +++ b/target/arm/cpu.c @@ -2269,7 +2269,14 @@ static void arm_cpu_realizefn(DeviceState *dev, Erro= r **errp) } =20 #ifndef CONFIG_USER_ONLY - if (tcg_enabled() && cpu_isar_feature(aa64_wfxt, cpu)) { + /* + * We use the wfxt_timer for timeouts and event stream so we + * enable from V6K up. There is no event stream on M-profile. + */ + if (tcg_enabled() && + (arm_feature(env, ARM_FEATURE_V6K) || + arm_feature(env, ARM_FEATURE_V7) || + arm_feature(env, ARM_FEATURE_V8))) { cpu->wfxt_timer =3D timer_new_ns(QEMU_CLOCK_VIRTUAL, arm_wfxt_timer_cb, cpu); } --=20 2.47.3 From nobody Sat Jun 20 05:01:41 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=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1781874380; cv=none; d=zohomail.com; s=zohoarc; b=hv02A+9/VVGS5qTZMYOPWVklJVR9NwzSvIAG9gWRFK/agTYVHiuZ/eQ7f8Fm+DcRwa6DZ49yAp7zZVPUeG8MD6twyR9y8W3nOOZyizpK5ao0NP7M3UiQPU9AF1v/drmv+xlt3RU0HnOfhtQQixmJ2QKzSKCXA5/dMGVBKwKelew= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1781874380; 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:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=MVIHfgvOBO+ct2EhyE9pq49O4xVF2moDOiCD7HY29ss=; b=LD6R80wFDODPvsN19iEWXYTVq59TkIWttndcwe+42yi370pYzUAfNV6Fg0hn9l//7AAkI1gfI87Unstb1Fe4ooer71Q6gzJUdbVMVdjVNs2RydgpD9rCfFESNtd7s6RPC9wPTZ/eMdxYKUCtLkVQqDKrtlQ4F0hHZ1nt1aMkTe0= 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=none dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1781874380547718.2942667584247; Fri, 19 Jun 2026 06:06:20 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1waYus-00041m-TN; Fri, 19 Jun 2026 09:05:50 -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 1waYuq-0003y6-HP for qemu-devel@nongnu.org; Fri, 19 Jun 2026 09:05:48 -0400 Received: from mail-wr1-x429.google.com ([2a00:1450:4864:20::429]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1waYum-0003Pr-6Q for qemu-devel@nongnu.org; Fri, 19 Jun 2026 09:05:48 -0400 Received: by mail-wr1-x429.google.com with SMTP id ffacd0b85a97d-45ef6565cfdso1046372f8f.0 for ; Fri, 19 Jun 2026 06:05:43 -0700 (PDT) Received: from draig.lan ([185.124.0.195]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4923fcf74b4sm71469645e9.6.2026.06.19.06.05.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 19 Jun 2026 06:05:40 -0700 (PDT) Received: from draig.lan (localhost [IPv6:::1]) by draig.lan (Postfix) with ESMTP id BF5895FAF9; Fri, 19 Jun 2026 14:05:37 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1781874342; x=1782479142; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=MVIHfgvOBO+ct2EhyE9pq49O4xVF2moDOiCD7HY29ss=; b=GGtBpTHaRX3H7RK3PLN1747OLRGEdqoCdYND6weuilR6Y71MBhkSeoiCfykyD5z4v0 qGARCo6TTCPrwDqYBF65YP2//HUh9muJhFbGVwmcwtAd9uxYQdF9FgUZHfmDUlSsL4oO LGZJYnmNjQ88nQMV56DKvOFb0V/abMWZDjbEFcifh1IrUBimah+FxQKkTn5UgkxLmiqg PuGVTJHq5dKyllF1h5fH5qvvHAKa059IjVd/hOsFcBXXegmJ4BSqy6tDrD4Iuc9slKLK o5590xMEArbPtRxvDmTKmS+ulBzlENwhqgpxPixarXm+Tl269SsRfWV521ebohoFcomQ 4Veg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1781874342; x=1782479142; h=content-transfer-encoding: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; bh=MVIHfgvOBO+ct2EhyE9pq49O4xVF2moDOiCD7HY29ss=; b=pOwDC7rtBNCXYfE5m97JLCjuV+hdEfUWxnpFsPDTZrKPVGK+AIL6H5CbJLAk0ZDOH5 e097ahMHCU3dE1S9MScnCSFzjV2bNEYHKYSIKP7MSzI1s9HyY0RmwHbwhZ+j5WzTd9fA Lm5kTbtirqM5qIoCh2VOw2htUx+0UPkR9ix2g46+sq/EoMw4qvYtvMUfdJOLa68Usfic UqZOrIYgTch4+aup0viJgtlGUb/gBPOI9kE3XNM0MGhXRTB1Lvprs2OzZV6fOz3j1Xla XUYmyLRz8NoJtJL7Ne0GXIJbJB//2HeFmgJLmjZicQbYY6kzz8JLXDA0t4yjeUImHI9u 378Q== X-Gm-Message-State: AOJu0Yxt1uZvx5vn3sEmKvbrkFmbFdsixnXt6bEKXVdIrX6uuxxzxZP+ ADhoYN6dKrxhxPguX7PLe3Y16m7X3UdpPW/jloleD3XUOQM6CQlYHrH5qxXD033H5h8= X-Gm-Gg: AfdE7ckccTmonUw6VnbVjzoxbQ2J9rjru+rtemXn9nz/qRsV8TeY6f/1wima2x9V/QS ph77RuGKAqtu5dVA7P8Lf8P5wD8f838egWSsJMQnTuu3cmWQ8wI5seayaLONlIQrgkusGv1jxRP tBy450mBvLQ9eQK6i0Mi2le9KZNpWx4AoxGQKsp5275nCvkcM3G92B/ir1pZXOQRRB2e/ua0EBd Pq92hPNUf/boSLaGWnynuQrhyVmvT9FbNBtvsrnecEs7e8z6I7n3j91Uhv60olfw+gDfQFXrtLX A63zUDvDNvmf4NFGOb0VAf7RhhA7BgGnTqq664sF/yEQPinFwTLbaBDzBLduf5fq/PV7mytED6q eXQNPbVvCKz90Wlx58NkW5aNPHYYp9/XHHsz75dJNsEL98kJO598PlGXSqiKHCbiKompYaIuPNe cSPEHd6Qyd+U5b X-Received: by 2002:a05:600c:c088:b0:492:32f3:a344 with SMTP id 5b1f17b1804b1-4923f594101mr61087015e9.31.1781874342110; Fri, 19 Jun 2026 06:05:42 -0700 (PDT) From: =?UTF-8?q?Alex=20Benn=C3=A9e?= To: qemu-devel@nongnu.org Cc: Alexander Graf , Mohamed Mediouni , Paolo Bonzini , Pedro Barbuda , Jamin Lin , Steven Lee , Andrew Jeffery , Joel Stanley , qemu-arm@nongnu.org, Troy Lee , =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= , Kane Chen , Tyrone Ting , Peter Maydell , kvm@vger.kernel.org, Hao Wu , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Richard Henderson Subject: [PATCH v8 5/7] target/arm: implements SEV/SEVL for all modes Date: Fri, 19 Jun 2026 14:05:34 +0100 Message-ID: <20260619130537.820184-6-alex.bennee@linaro.org> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260619130537.820184-1-alex.bennee@linaro.org> References: <20260619130537.820184-1-alex.bennee@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable 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=2a00:1450:4864:20::429; envelope-from=alex.bennee@linaro.org; helo=mail-wr1-x429.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-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 @linaro.org) X-ZM-MESSAGEID: 1781874382425158500 Remove the restrictions that make this a M-profile only operation and enable the instructions for all Arm profiles. Reviewed-by: Richard Henderson Signed-off-by: Alex Benn=C3=A9e --- v3 - restrict SEV to M profile plus - restrict SEVL to V8 v2 - fix alignment in a32.decode - set bool directly, defend with QEMU_BUILD_BUG_ON - s/instructions/profiles/ - share get_event_reg between translate/translate-a64 --- target/arm/tcg/translate.h | 18 ++++++++++++++++++ target/arm/tcg/a32.decode | 5 ++--- target/arm/tcg/a64.decode | 5 ++--- target/arm/tcg/t16.decode | 4 +--- target/arm/tcg/t32.decode | 4 +--- target/arm/tcg/op_helper.c | 4 +--- target/arm/tcg/translate-a64.c | 17 +++++++++++++++++ target/arm/tcg/translate.c | 20 +++++++++++++++++--- 8 files changed, 59 insertions(+), 18 deletions(-) diff --git a/target/arm/tcg/translate.h b/target/arm/tcg/translate.h index 462d4c1c74f..83b413ee368 100644 --- a/target/arm/tcg/translate.h +++ b/target/arm/tcg/translate.h @@ -860,6 +860,24 @@ static inline void gen_restore_rmode(TCGv_i32 old, TCG= v_ptr fpst) gen_helper_set_rmode(old, old, fpst); } =20 +/* + * Event Register signalling. + * + * A bunch of activities trigger events, we just need to latch on to + * true. The event eventually gets consumed by WFE/WFET. + * + * user-mode treats these as NOPs. + */ + +static inline void gen_event_reg(void) +{ +#ifndef CONFIG_USER_ONLY + TCGv_i32 set_event =3D tcg_constant_i32(1); + QEMU_BUILD_BUG_ON(sizeof_field(CPUARMState, event_register) !=3D 1); + tcg_gen_st8_i32(set_event, tcg_env, offsetof(CPUARMState, event_regist= er)); +#endif +} + /* * Helpers for implementing sets of trans_* functions. * Defer the implementation of NAME to FUNC, with optional extra arguments. diff --git a/target/arm/tcg/a32.decode b/target/arm/tcg/a32.decode index f2ca4809495..547aa2b1490 100644 --- a/target/arm/tcg/a32.decode +++ b/target/arm/tcg/a32.decode @@ -192,9 +192,8 @@ SMULTT .... 0001 0110 .... 0000 .... 1110 ...= . @rd0mn WFE ---- 0011 0010 0000 1111 ---- 0000 0010 WFI ---- 0011 0010 0000 1111 ---- 0000 0011 =20 - # TODO: Implement SEV, SEVL; may help SMP performance. - # SEV ---- 0011 0010 0000 1111 ---- 0000 0100 - # SEVL ---- 0011 0010 0000 1111 ---- 0000 0101 + SEV ---- 0011 0010 0000 1111 ---- 0000 0100 + SEVL ---- 0011 0010 0000 1111 ---- 0000 0101 =20 ESB ---- 0011 0010 0000 1111 ---- 0001 0000 ] diff --git a/target/arm/tcg/a64.decode b/target/arm/tcg/a64.decode index 28cd1faf61a..81070dac0a6 100644 --- a/target/arm/tcg/a64.decode +++ b/target/arm/tcg/a64.decode @@ -250,9 +250,8 @@ ERETA 1101011 0100 11111 00001 m:1 11111 1111= 1 &reta # ERETAA, ERETAB YIELD 1101 0101 0000 0011 0010 0000 001 11111 WFE 1101 0101 0000 0011 0010 0000 010 11111 WFI 1101 0101 0000 0011 0010 0000 011 11111 - # We implement WFE to never block, so our SEV/SEVL are NOPs - # SEV 1101 0101 0000 0011 0010 0000 100 11111 - # SEVL 1101 0101 0000 0011 0010 0000 101 11111 + SEV 1101 0101 0000 0011 0010 0000 100 11111 + SEVL 1101 0101 0000 0011 0010 0000 101 11111 # Our DGL is a NOP because we don't merge memory accesses anyway. # DGL 1101 0101 0000 0011 0010 0000 110 11111 XPACLRI 1101 0101 0000 0011 0010 0000 111 11111 diff --git a/target/arm/tcg/t16.decode b/target/arm/tcg/t16.decode index 778fbf16275..9a8f89538ac 100644 --- a/target/arm/tcg/t16.decode +++ b/target/arm/tcg/t16.decode @@ -228,10 +228,8 @@ REVSH 1011 1010 11 ... ... @rdm WFE 1011 1111 0010 0000 WFI 1011 1111 0011 0000 =20 - # M-profile SEV is implemented. - # TODO: Implement SEV for other profiles, and SEVL for all profiles; m= ay help SMP performance. SEV 1011 1111 0100 0000 - # SEVL 1011 1111 0101 0000 + SEVL 1011 1111 0101 0000 =20 # The canonical nop has the second nibble as 0000, but the whole of the # rest of the space is a reserved hint, behaves as nop. diff --git a/target/arm/tcg/t32.decode b/target/arm/tcg/t32.decode index 49b8d0037ec..8ae277fe112 100644 --- a/target/arm/tcg/t32.decode +++ b/target/arm/tcg/t32.decode @@ -369,10 +369,8 @@ CLZ 1111 1010 1011 ---- 1111 .... 1000 ..= .. @rdm WFE 1111 0011 1010 1111 1000 0000 0000 0010 WFI 1111 0011 1010 1111 1000 0000 0000 0011 =20 - # M-profile SEV is implemented. - # TODO: Implement SEV for other profiles, and SEVL for all profile= s; may help SMP performance. SEV 1111 0011 1010 1111 1000 0000 0000 0100 - # SEVL 1111 0011 1010 1111 1000 0000 0000 0101 + SEVL 1111 0011 1010 1111 1000 0000 0000 0101 =20 ESB 1111 0011 1010 1111 1000 0000 0001 0000 ] diff --git a/target/arm/tcg/op_helper.c b/target/arm/tcg/op_helper.c index 9f9ea39be5a..d15062e155f 100644 --- a/target/arm/tcg/op_helper.c +++ b/target/arm/tcg/op_helper.c @@ -477,9 +477,7 @@ void HELPER(sev)(CPUARMState *env) CPUState *cs =3D env_cpu(env); CPU_FOREACH(cs) { ARMCPU *target_cpu =3D ARM_CPU(cs); - if (arm_feature(&target_cpu->env, ARM_FEATURE_M)) { - target_cpu->env.event_register =3D true; - } + target_cpu->env.event_register =3D true; if (!qemu_cpu_is_self(cs)) { qemu_cpu_kick(cs); } diff --git a/target/arm/tcg/translate-a64.c b/target/arm/tcg/translate-a64.c index 227719ef25b..df5bac22acd 100644 --- a/target/arm/tcg/translate-a64.c +++ b/target/arm/tcg/translate-a64.c @@ -2142,6 +2142,23 @@ static bool trans_WFI(DisasContext *s, arg_WFI *a) return true; } =20 +static bool trans_SEV(DisasContext *s, arg_SEV *a) +{ + /* + * SEV is a NOP for user-mode emulation. + */ +#ifndef CONFIG_USER_ONLY + gen_helper_sev(tcg_env); +#endif + return true; +} + +static bool trans_SEVL(DisasContext *s, arg_SEV *a) +{ + gen_event_reg(); + return true; +} + static bool trans_WFE(DisasContext *s, arg_WFI *a) { /* diff --git a/target/arm/tcg/translate.c b/target/arm/tcg/translate.c index c744b163453..9079458a297 100644 --- a/target/arm/tcg/translate.c +++ b/target/arm/tcg/translate.c @@ -3246,17 +3246,31 @@ static bool trans_YIELD(DisasContext *s, arg_YIELD = *a) static bool trans_SEV(DisasContext *s, arg_SEV *a) { /* - * Currently SEV is a NOP for non-M-profile and in user-mode emulation. - * For system-mode M-profile, it sets the event register. + * SEV is a NOP for user-mode emulation. For v6T2 and earlier + * non-M-profile cores this encoding is a NOP hint. */ #ifndef CONFIG_USER_ONLY - if (arm_dc_feature(s, ARM_FEATURE_M)) { + if (arm_dc_feature(s, ARM_FEATURE_M) || + arm_dc_feature(s, ARM_FEATURE_V7)) { gen_helper_sev(tcg_env); } #endif return true; } =20 +static bool trans_SEVL(DisasContext *s, arg_SEV *a) +{ + /* + * SEVL only exists for v8A; for M-profile and v7A and earlier + * this encoding is an unallocated must-NOP hint. + */ + if (!arm_dc_feature(s, ARM_FEATURE_M) && + arm_dc_feature(s, ARM_FEATURE_V8)) { + gen_event_reg(); + } + return true; +} + static bool trans_WFE(DisasContext *s, arg_WFE *a) { /* --=20 2.47.3 From nobody Sat Jun 20 05:01:41 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=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1781874455; cv=none; d=zohomail.com; s=zohoarc; b=SprFjPWi4acrKf67O6wBlb3emWADZ8VB3g6ebFRVngiDLHOP9YwrpnMlhS+q3W0ts+CQS07gCy83v9glkALnW6th3JmCDQFa/SS1Veu6FV+QENgMYjn+NkbbDhqqEKtBi92cOzYU0+o3AhMv0vm8XnKt896+135iu9GLyy3zzTw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1781874455; 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:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=Nww3Chs00pQc0ueQt1pJgcckpSKjzTHLlZYJSidOTfA=; b=IZheRoWLfkjzFCw7FVF44qYEZRyUqG2SzlKlq7I5LTRTrk4ySuNY3ntzpp5U60d9z310cBW1TqJIo/255Q9WMy0g9QJYOnAFHLhHiVvOc9ekNoYtEl6aLYe9B2sZhnnaVQkrSqzzDP2eC9OiImYSunk1Vvi1i6GVGOHbQVWFAos= 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=none dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 178187445535739.65917840136876; Fri, 19 Jun 2026 06:07:35 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1waYur-0003zC-Um; Fri, 19 Jun 2026 09:05:50 -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 1waYup-0003xj-RN for qemu-devel@nongnu.org; Fri, 19 Jun 2026 09:05:47 -0400 Received: from mail-wm1-x32b.google.com ([2a00:1450:4864:20::32b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1waYul-0003Pc-BM for qemu-devel@nongnu.org; Fri, 19 Jun 2026 09:05:47 -0400 Received: by mail-wm1-x32b.google.com with SMTP id 5b1f17b1804b1-490ac357c55so20341465e9.1 for ; Fri, 19 Jun 2026 06:05:42 -0700 (PDT) Received: from draig.lan ([185.124.0.195]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4923fc47b48sm69671875e9.0.2026.06.19.06.05.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 19 Jun 2026 06:05:40 -0700 (PDT) Received: from draig.lan (localhost [IPv6:::1]) by draig.lan (Postfix) with ESMTP id DC8FB6000E; Fri, 19 Jun 2026 14:05:37 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1781874342; x=1782479142; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=Nww3Chs00pQc0ueQt1pJgcckpSKjzTHLlZYJSidOTfA=; b=TgT9s+21MvZmApq9B8MmiNtRF9GDFw5VUGV7Aa5oTWCuJxOtjNs689ACrpimazWyAp FaxoRQlVpabwLU3RUNIDvFMPvIQrLfBxRbY8C5V+m4AGAFBeW8IyLfcZFPiLD8+81JIb LiOBMonnNd7K1TU9TstEgJc5bLNdAVDLq8KiBFcLadE6QJ8Ev+7Ab+LL/0PL2tvypYEL nSGad9O8nFTafsdJQx7Xj6O5NSwjDxhmhql/zJU3kR3t4e8/BRxwwnZ+bEcTm3+tfpsM iXPgL+vkOkLVt8F8JfS+tUWcZFY4n9Y0T0cxz98rOc2Q7LUpyFbqU8ciMzqAoaN5w8tv 7w4Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1781874342; x=1782479142; h=content-transfer-encoding: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; bh=Nww3Chs00pQc0ueQt1pJgcckpSKjzTHLlZYJSidOTfA=; b=UENOXSUMhhPm+B9b3NJbDv3WjK0t4PMVP4FU/HK6vdtpqU6IAj3OVTz2S6vqsKFcQZ C3Xs0xZIGG6BYwWOteVMK06XQ4RjPPWDbpN0phdHWeBM6WWqDfpDmbfYEJExpQsaBnKt GE6lDiWObxNVVEksNoRDKuHVxdIJPb1KfBuuhe8KJLsAtIX08gq3VysUxIr3KLp1QxCE PY8YjUjq3yAuLK2oMc4K1Ha0xTPXxb03PEBwYuFRnHlyOpWRoIOq50FnVfIheDhuyBzs 1Uvt9Md5IG8XC8/H7yXz2LEUFiAto9jA1C1oNTk8iQYvd91hGahvIkUOqlZYQp5aGT+8 Ybaw== X-Gm-Message-State: AOJu0Yx9dHthcy8dHTT+neRJRf/Rj/lKNwTD7yVA1Ju/ZzW7RvL/KQGE MBdeZAEE8aB492Sg38NzxQwR5ZG0b6gmBoUuJ36UdWeCfIx/hqS5XEddhh/KkfotM7Y= X-Gm-Gg: AfdE7ckRFU43awSnj7PBDNHcDiLxxzO+HmyOWdS6H5jS18NB/agY+FkMNkNQTYazjlh 2Ia5ihqT1fhxgEnyOnwvxzwCGlyf7/LFUNA85rQRiS40soDw0PmzP8W/ekf01Pk6kN9xaQlPSUY bVq19Ghnbf3tKXIiXdlvjHiQAdJNh+h/D+sG2I3zAaRrvx62lOehCj9rq2NXpoiSkoXrnnKpvgr cees558iG2WzlIB71WF5vs/ZpuKSFVNqyQ5r1bebNK692zKMyqx/pbdBqmsmLJgZNPx7xDHNMpD WzcpcMW+923XG+d3dHS8Hrs29AanctOhXGN6wS2yeSONDhd0yqcrRC+LJkWOX70vgM33kwbcOLi NWUn5J54u9rtI0GVIkPV5p96QIFHjyYMxlWdssPLDN5RIjcr0SMo0BRMBfKpOh5wAWGrHbE8g4t GmMQEdL8TnJwYN X-Received: by 2002:a05:600d:844f:10b0:490:b355:9c70 with SMTP id 5b1f17b1804b1-49240e061e9mr44228425e9.11.1781874341425; Fri, 19 Jun 2026 06:05:41 -0700 (PDT) From: =?UTF-8?q?Alex=20Benn=C3=A9e?= To: qemu-devel@nongnu.org Cc: Alexander Graf , Mohamed Mediouni , Paolo Bonzini , Pedro Barbuda , Jamin Lin , Steven Lee , Andrew Jeffery , Joel Stanley , qemu-arm@nongnu.org, Troy Lee , =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= , Kane Chen , Tyrone Ting , Peter Maydell , kvm@vger.kernel.org, Hao Wu , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Richard Henderson Subject: [PATCH v8 6/7] target/arm: enable WFE sleeping for A-profile Date: Fri, 19 Jun 2026 14:05:35 +0100 Message-ID: <20260619130537.820184-7-alex.bennee@linaro.org> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260619130537.820184-1-alex.bennee@linaro.org> References: <20260619130537.820184-1-alex.bennee@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable 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=2a00:1450:4864:20::32b; envelope-from=alex.bennee@linaro.org; helo=mail-wm1-x32b.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-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 @linaro.org) X-ZM-MESSAGEID: 1781874456629158500 To enable full architectural behaviour for A-profile we need to do a number of things: - add support for the event stream to wake things up - add support for potential trap on sleep - handle the global monitor's interactions with WFE - remove the M-profile specific gates Event stream ------------ Two generic timers (K and H) are capable of generating timer event stream events. Provide a helper to calculate when the nearest one will happen. Now we can calculate when the next event stream event is we can re-use the wfxt_timer and configure it to fire as we enter a WFE that is going to sleep. Reverse the M-profile logic so we can enter a sleep state in both profiles. We also take care to use atomics for accessing env->event_register as we now have potential access outside the vCPU context. Traps ----- A-profile can trap WFE's *if* the instruction would otherwise sleep. To do this we need to pass the instruction size so we can deal with the is_16bit syndrome encoding. Global Monitor -------------- To avoid issues with QEMU's incomplete ldst exclusive handling causing potential deadlocks in common WFE enabled locking patterns we take advantage of the architectures flexibility and treat being in the exclusive region as a reason to exit. Reviewed-by: Richard Henderson Signed-off-by: Alex Benn=C3=A9e --- v2 - merged target/arm: add gt_calc_next_event_stream - update to use halt_reason - made arm_wfxt_timer_cb atomically consume halt_reason v4 - skip sleep if in the exclusive region - update commit message - remove the CF_PARALLEL guards so we work in smp v5 - use env_archcpu for ARMCPU rather then expensive QOM cast - rely on cpu->wfxt_timer to guard event stream leg v6 - use atomic_xchg to consume event_register - remove extraneous target_el calculation - defer calculating target_el until after the early return v7 - merged with trap patch - rewrite commit message --- target/arm/tcg/helper-defs.h | 2 +- target/arm/cpu.c | 13 +++ target/arm/tcg/op_helper.c | 156 ++++++++++++++++++++++++++++----- target/arm/tcg/translate-a64.c | 12 +-- target/arm/tcg/translate.c | 18 +--- 5 files changed, 156 insertions(+), 45 deletions(-) diff --git a/target/arm/tcg/helper-defs.h b/target/arm/tcg/helper-defs.h index 8ec6c163195..99ebd754942 100644 --- a/target/arm/tcg/helper-defs.h +++ b/target/arm/tcg/helper-defs.h @@ -54,7 +54,7 @@ DEF_HELPER_2(exception_swstep, noreturn, env, i32) DEF_HELPER_2(exception_pc_alignment, noreturn, env, vaddr) DEF_HELPER_1(setend, void, env) DEF_HELPER_2(wfi, void, env, i32) -DEF_HELPER_1(wfe, void, env) +DEF_HELPER_2(wfe, void, env, i32) DEF_HELPER_2(wfit, void, env, i32) DEF_HELPER_1(yield, void, env) DEF_HELPER_1(pre_hvc, void, env) diff --git a/target/arm/cpu.c b/target/arm/cpu.c index 61945b6e6cc..e6e79c221d9 100644 --- a/target/arm/cpu.c +++ b/target/arm/cpu.c @@ -883,10 +883,23 @@ bool arm_cpu_exec_halt(CPUState *cs) } #endif =20 +/* + * Unlike almost everything else that messes with the halt_reason and + * event_register details the timer callbacks are not in the vCPU + * context. + * + * To prevent races we atomically consume a HALT_WFE and set the event + * register. Either way we trigger the an exit event. + */ static void arm_wfxt_timer_cb(void *opaque) { ARMCPU *cpu =3D opaque; CPUState *cs =3D CPU(cpu); + CPUARMState *env =3D &cpu->env; + + if (qatomic_cmpxchg(&env->halt_reason, HALT_WFE, NOT_HALTED)) { + qatomic_set(&env->event_register, true); + } =20 /* * We expect the CPU to be halted; this will cause arm_cpu_is_work() diff --git a/target/arm/tcg/op_helper.c b/target/arm/tcg/op_helper.c index d15062e155f..3321e29898d 100644 --- a/target/arm/tcg/op_helper.c +++ b/target/arm/tcg/op_helper.c @@ -484,7 +484,98 @@ void HELPER(sev)(CPUARMState *env) } } =20 -void HELPER(wfe)(CPUARMState *env) +#ifndef CONFIG_USER_ONLY +/* + * Event Stream events don't do anything apart from wake up sleeping + * cores. These helpers calculate the next event stream event time so + * the WFE helper can decide when its next wake up tick will be. + */ +static int64_t gt_recalc_one_evt(CPUARMState *env, uint32_t control, uint6= 4_t offset) +{ + ARMCPU *cpu =3D env_archcpu(env); + bool evnten =3D FIELD_EX32(control, CNTxCTL, EVNTEN); + + if (evnten) { + int evnti =3D FIELD_EX32(control, CNTxCTL, EVNTI); + bool evntis =3D FIELD_EX32(control, CNTxCTL, EVNTIS); + bool evntdir =3D FIELD_EX32(control, CNTxCTL, EVNTDIR); + /* + * To figure out when the next event timer should fire we need + * to calculate which bit of the counter we want to flip and + * which transition counts. + * + * So we calculate 1 << bit - current lower bits and then add + * 1 << bit if the bit needs to flip twice to meet evntdir + */ + int bit =3D evntis ? evnti + 8 : evnti; + uint64_t count =3D gt_get_countervalue(env) - offset; + uint64_t target_bit =3D BIT_ULL(bit); + uint64_t lower_bits =3D MAKE_64BIT_MASK(0, bit - 1); + uint64_t next_tick =3D target_bit - (count & lower_bits); + uint64_t abstick; + + /* do we need to bit flip twice? */ + if (((count & target_bit) !=3D 0) ^ evntdir) { + next_tick +=3D target_bit; + } + + /* + * Note that the desired next expiry time might be beyond the + * signed-64-bit range of a QEMUTimer -- in this case we just + * set the timer for as far in the future as possible. When the + * timer expires we will reset the timer for any remaining period. + */ + if (uadd64_overflow(next_tick, offset, &abstick)) { + abstick =3D UINT64_MAX; + } + if (abstick > INT64_MAX / gt_cntfrq_period_ns(cpu)) { + return INT64_MAX; + } else { + return abstick; + } + } + + return -1; +} + +/* + * Calculate the next event stream time and return it. Returns -1 if + * no event streams are enabled. It is up to the WFE helpers to decide + * on the next time. + */ +static int64_t gt_calc_next_event_stream(CPUARMState *env) +{ + ARMCPU *cpu =3D env_archcpu(env); + uint64_t hcr =3D arm_hcr_el2_eff(env); + int64_t next_time =3D -1; + uint64_t offset; + + /* Unless we are missing EL2 this can generate events */ + if (arm_feature(env, ARM_FEATURE_EL2)) { + offset =3D gt_direct_access_timer_offset(env, GTIMER_PHYS); + next_time =3D gt_recalc_one_evt(env, env->cp15.cnthctl_el2, offset= ); + } + + /* Event stream events from virtual counter enabled? */ + if (!cpu_isar_feature(aa64_vh, cpu) || + !((hcr & (HCR_E2H | HCR_TGE)) =3D=3D (HCR_E2H | HCR_TGE))) { + int64_t next_virt_time; + offset =3D gt_direct_access_timer_offset(env, GTIMER_VIRT); + next_virt_time =3D gt_recalc_one_evt(env, env->cp15.c14_cntkctl, o= ffset); + + /* is this earlier than the next physical event? */ + if (next_virt_time > 0) { + if (next_time < 0 || next_virt_time < next_time) { + next_time =3D next_virt_time; + } + } + } + + return next_time; +} +#endif + +void HELPER(wfe)(CPUARMState *env, uint32_t insn_len) { #ifdef CONFIG_USER_ONLY /* @@ -496,32 +587,57 @@ void HELPER(wfe)(CPUARMState *env) #else /* * WFE (Wait For Event) is a hint instruction. - * For Cortex-M (M-profile), we implement the strict architectural beh= avior: + * * 1. Check the Event Register (set by SEV or SEVONPEND). * 2. If set, clear it and continue (consume the event). */ - if (arm_feature(env, ARM_FEATURE_M)) { - CPUState *cs =3D env_cpu(env); + CPUState *cs =3D env_cpu(env); + ARMCPU *cpu =3D env_archcpu(env); + uint32_t excp; + int target_el; =20 - if (env->event_register) { - env->event_register =3D false; - return; + if (qatomic_xchg(&env->event_register, false)) { + return; + } + + /* We might sleep, so now we check to see if we should trap */ + target_el =3D check_wfx_trap(env, true, &excp); + if (target_el) { + if (env->aarch64) { + env->pc -=3D insn_len; + } else { + env->regs[15] -=3D insn_len; } + raise_exception(env, excp, syn_wfx(1, 0xe, 0, false, WFE, insn_len= =3D=3D 2), + target_el); + } =20 - env->halt_reason =3D HALT_WFE; - cs->exception_index =3D EXCP_HLT; - cs->halted =3D 1; - cpu_loop_exit(cs); - } else { - /* - * For A-profile and others, we rely on the existing "yield" behav= ior. - * Don't actually halt the CPU, just yield back to top - * level loop. This is not going into a "low power state" - * (ie halting until some event occurs), so we never take - * a configurable trap to a different exception level - */ - HELPER(yield)(env); + /* + * If the CPU has entered the exclusive region we could sleep + * until the global monitor moves from Exclusive to Open Access. + * However it would be expensive for QEMU to fully model the + * global monitor and not doing so would potentially trigger + * deadlocks in WFE enabled locking code. However as WFE is a hint + * instruction the architecture allows for the PE to leave + * low-power state for any reason. QEMU chooses to treat being in + * an exclusive region as such and return directly. + */ + if (env->exclusive_addr !=3D -1) { + return; } + + /* For A-profile we also can be woken by the event stream */ + if (cpu->wfxt_timer) { + int64_t next_event =3D gt_calc_next_event_stream(env); + if (next_event > 0) { + timer_mod(cpu->wfxt_timer, next_event); + } + } + + env->halt_reason =3D HALT_WFE; + cs->exception_index =3D EXCP_HLT; + cs->halted =3D 1; + cpu_loop_exit(cs); #endif } =20 diff --git a/target/arm/tcg/translate-a64.c b/target/arm/tcg/translate-a64.c index df5bac22acd..b45aac6d269 100644 --- a/target/arm/tcg/translate-a64.c +++ b/target/arm/tcg/translate-a64.c @@ -2161,15 +2161,7 @@ static bool trans_SEVL(DisasContext *s, arg_SEV *a) =20 static bool trans_WFE(DisasContext *s, arg_WFI *a) { - /* - * When running in MTTCG we don't generate jumps to the yield and - * WFE helpers as it won't affect the scheduling of other vCPUs. - * If we wanted to more completely model WFE/SEV so we don't busy - * spin unnecessarily we would need to do something more involved. - */ - if (!(tb_cflags(s->base.tb) & CF_PARALLEL)) { - s->base.is_jmp =3D DISAS_WFE; - } + s->base.is_jmp =3D DISAS_WFE; return true; } =20 @@ -11232,7 +11224,7 @@ static void aarch64_tr_tb_stop(DisasContextBase *dc= base, CPUState *cpu) */ case DISAS_WFE: gen_a64_update_pc(dc, 4); - gen_helper_wfe(tcg_env); + gen_helper_wfe(tcg_env, tcg_constant_i32(4)); tcg_gen_exit_tb(NULL, 0); break; case DISAS_WFI: diff --git a/target/arm/tcg/translate.c b/target/arm/tcg/translate.c index 9079458a297..a1fc0506188 100644 --- a/target/arm/tcg/translate.c +++ b/target/arm/tcg/translate.c @@ -3273,19 +3273,9 @@ static bool trans_SEVL(DisasContext *s, arg_SEV *a) =20 static bool trans_WFE(DisasContext *s, arg_WFE *a) { - /* - * When running single-threaded TCG code, use the helper to ensure that - * the next round-robin scheduled vCPU gets a crack. - * - * For Cortex-M, we implement the architectural WFE behavior (sleeping - * until an event occurs or the Event Register is set). - * For other profiles, we currently treat this as a NOP or yield, - * to preserve existing performance characteristics. - */ - if (!(tb_cflags(s->base.tb) & CF_PARALLEL)) { - gen_update_pc(s, curr_insn_len(s)); - s->base.is_jmp =3D DISAS_WFE; - } + /* For WFE, halt the vCPU until an event. */ + gen_update_pc(s, curr_insn_len(s)); + s->base.is_jmp =3D DISAS_WFE; return true; } =20 @@ -6857,7 +6847,7 @@ static void arm_tr_tb_stop(DisasContextBase *dcbase, = CPUState *cpu) tcg_gen_exit_tb(NULL, 0); break; case DISAS_WFE: - gen_helper_wfe(tcg_env); + gen_helper_wfe(tcg_env, tcg_constant_i32(curr_insn_len(dc))); /* * The helper can return if the event register is set, so we * must go back to the main loop to check for events. --=20 2.47.3 From nobody Sat Jun 20 05:01:41 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=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1781874425; cv=none; d=zohomail.com; s=zohoarc; b=mO5MRWOU22+S9czo8GymScaNTrIMeKHaWT2HrlUGD6vukW4aRK2EZKj/GwPL/HD/ntAnQlClMxKADRWCAODIwRFL1RuyXsB0uL6tNsIoxDirsvavYgtAlHo1canBiI9MtlmorkHbYfznSZvCHKKye+4ilB/mjLBgcN68FDCKdjk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1781874425; 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:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=BFfQOO9l3CQg1O1c/LoTPy22fPXz/bgLx/p6YDwqS88=; b=ltrh3LVAI/8xzb2p2b5MB2MF2UcvQ2BajtcEKa5sZoiioHzV2H8ehGo/B5uHLeyxpEjjx9c7InbdfXA67nepsbR+z4vdHebstDS5B0zxGZqipwyU0E0Wvdn4mfK8jR9c+i2VhyiC2eNFCh8vOT8RRx9lTc2+wr8ORWLOLTWAS+g= 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=none dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1781874425457681.8501766669; Fri, 19 Jun 2026 06:07:05 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1waYus-00041G-N4; Fri, 19 Jun 2026 09:05:50 -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 1waYur-0003yo-7g for qemu-devel@nongnu.org; Fri, 19 Jun 2026 09:05:49 -0400 Received: from mail-wm1-x32f.google.com ([2a00:1450:4864:20::32f]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1waYum-0003Q2-94 for qemu-devel@nongnu.org; Fri, 19 Jun 2026 09:05:48 -0400 Received: by mail-wm1-x32f.google.com with SMTP id 5b1f17b1804b1-490ac357c55so20341585e9.1 for ; Fri, 19 Jun 2026 06:05:43 -0700 (PDT) Received: from draig.lan ([185.124.0.195]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4923fc47720sm108355655e9.0.2026.06.19.06.05.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 19 Jun 2026 06:05:40 -0700 (PDT) Received: from draig.lan (localhost [IPv6:::1]) by draig.lan (Postfix) with ESMTP id 02D7960223; Fri, 19 Jun 2026 14:05:38 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1781874343; x=1782479143; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=BFfQOO9l3CQg1O1c/LoTPy22fPXz/bgLx/p6YDwqS88=; b=AnFxIbQCEgTUh2+E7kLDCjg1H6kspGHvVBBKuc5rYh0yBT52uaCCIeoiX3HIzxEesJ vW/nVEGaRtqRymwNTL3rFaGjSHU/xkcJldWMcWbhlANJEJhqjygq6vmT/sNHx9Gd9tmw 4DDEEyFiDX4Fx2TR49wj6q1jL0zaFntnErxm7ZBLG6L1l9xUrWc5KTuuTzHUEQDcxxxh lirfp5Kzj3A+b5EMcpN3tXQQovXCRrzweIpA58gLkvNXzuuS+4FsqmlgFns8W0ztkjSz Wq+KhWDN0fn0Gf1wQdwAFasr3W/PRhDkz6fJS5VzT1YmD/+xltaVieHCCzO+QAQ0gQR4 jMew== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1781874343; x=1782479143; h=content-transfer-encoding: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; bh=BFfQOO9l3CQg1O1c/LoTPy22fPXz/bgLx/p6YDwqS88=; b=JW97D3OLU7QkNiFPhpLp3d9ZDHE+5wbkG5IXj6cBsdq7rm8SsO9fLAyFNH4nD7Wx2i tS76AXhVt31HOwfsvApzhEu79C8qGhvPn6mQMfNUuFN0G6oU5xg0Qnrt2ErL0EsjJnAT zoPGQWqqUpWOmGLZ0Rz4rBFXhRbGLgIf/z3R1NYiU9fOmx+VlHNbodzVgJAP2xnD4923 E+rw70dagYFeZoh5IhNoyMNP0BtHtCouTXX0ed7zsAVOs1usRw3P8b92gZZzwEqNFs4v UT1Yev5RfP6T3kSd4dd5f4lf68jO9aUaHipYvDlPDJVx7Nu499MdzCvyN3uFYt5tdNgH 6G0Q== X-Gm-Message-State: AOJu0YwBXd1cU3cXAock7arCaPu/jDhvUJEPwZrJlHza8/zFoiWBD08w cQMJvHjSZ9HAnPaj/y6J3OzuK6/JFw62wyNxsBblHUYjePBc8wTunuc7BIH7/RmX1Y4= X-Gm-Gg: AfdE7ckC0TJTgx4JnafiwyjZW9jbNqSxNtRKAnelfApCq3zPTZh6aXcNF/rTbeLFrMj g/ahbz2VlMECN1dwmipS8ihfesIvP7vDJeE2o1XO7QhzC75OoorGuFLa+l02LPeKW8XHTNj5ito mu4owsDpbc1fx0mnmzF3Mwe9XSPsD79kmkB6xmE7raGHp1AssUNxBvMMzjxNYKPH9m2T+pKJ0Ss PTz/J+Tijb3iuLvdpwfe9QIKJd0fo0EEWyUehzSPIMm0RsfmSkbNS/0/odohnwX7j1vjzwSIOhi KCVmYQt+buQylG3imJlsIUWkUXCHGbGBacRF+lf1CCcBqiQa2fqCojL5d+NI8xfEc7xpahkE9ax MVm3qnuK++XQ1kyD4gQhvSpXQVUjCLc3typ0F4bIp3+0adI8wSMUfAexBYMx4jybY65IjpwE7yX hbmRyCxKTz4SZH X-Received: by 2002:a05:600c:4e05:b0:490:9782:3eb8 with SMTP id 5b1f17b1804b1-49240e6c534mr57298685e9.25.1781874342580; Fri, 19 Jun 2026 06:05:42 -0700 (PDT) From: =?UTF-8?q?Alex=20Benn=C3=A9e?= To: qemu-devel@nongnu.org Cc: Alexander Graf , Mohamed Mediouni , Paolo Bonzini , Pedro Barbuda , Jamin Lin , Steven Lee , Andrew Jeffery , Joel Stanley , qemu-arm@nongnu.org, Troy Lee , =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= , Kane Chen , Tyrone Ting , Peter Maydell , kvm@vger.kernel.org, Hao Wu , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Richard Henderson Subject: [PATCH v8 7/7] target/arm: implement WFET Date: Fri, 19 Jun 2026 14:05:36 +0100 Message-ID: <20260619130537.820184-8-alex.bennee@linaro.org> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260619130537.820184-1-alex.bennee@linaro.org> References: <20260619130537.820184-1-alex.bennee@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable 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=2a00:1450:4864:20::32f; envelope-from=alex.bennee@linaro.org; helo=mail-wm1-x32f.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=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 @linaro.org) X-ZM-MESSAGEID: 1781874426281158500 Now we have the event stream and SEV/SEVL implemented we can finally enable WFET for Aarch64. To avoid issues with QEMU's incomplete ldst exclusive handling causing potential deadlocks in common WFE enabled locking patterns we take advantage of the architectures flexibility and treat being in the exclusive region as a reason to exit. Reviewed-by: Richard Henderson Signed-off-by: Alex Benn=C3=A9e --- v2 - fix exception syndrome by using enum value - use env->halt_reason v3 - fix check_wfx_trap(s/false/true/) as it is a WFE v4 - defer expensive calculations until needed - treat cs->exclusive_addr as a IMPDEF WFE exit - update commit message v5 - use atomic_xchg to consume event_register --- target/arm/tcg/helper-defs.h | 1 + target/arm/tcg/op_helper.c | 94 ++++++++++++++++++++++++++++++++++ target/arm/tcg/translate-a64.c | 15 +++--- 3 files changed, 103 insertions(+), 7 deletions(-) diff --git a/target/arm/tcg/helper-defs.h b/target/arm/tcg/helper-defs.h index 99ebd754942..0077aeb4e22 100644 --- a/target/arm/tcg/helper-defs.h +++ b/target/arm/tcg/helper-defs.h @@ -56,6 +56,7 @@ DEF_HELPER_1(setend, void, env) DEF_HELPER_2(wfi, void, env, i32) DEF_HELPER_2(wfe, void, env, i32) DEF_HELPER_2(wfit, void, env, i32) +DEF_HELPER_2(wfet, void, env, i32) DEF_HELPER_1(yield, void, env) DEF_HELPER_1(pre_hvc, void, env) DEF_HELPER_2(pre_smc, void, env, i32) diff --git a/target/arm/tcg/op_helper.c b/target/arm/tcg/op_helper.c index 3321e29898d..c4433be2ed0 100644 --- a/target/arm/tcg/op_helper.c +++ b/target/arm/tcg/op_helper.c @@ -641,6 +641,100 @@ void HELPER(wfe)(CPUARMState *env, uint32_t insn_len) #endif } =20 +void HELPER(wfet)(CPUARMState *env, uint32_t rd) +{ +#ifdef CONFIG_USER_ONLY + /* + * As for WFIT make it NOP here, because trying to raise EXCP_HLT + * would trigger an abort. + */ + return; +#else + CPUState *cs =3D env_cpu(env); + uint32_t excp; + int target_el; + ARMCPU *cpu; + uint64_t cntval, timeout, offset, cntvct, nexttick; + int64_t next_event; + + /* + * As for WFE if the event register is already set we can consume + * the event and return immediately. + */ + if (qatomic_xchg(&env->event_register, false)) { + return; + } + + /* + * Don't bother to go into our "low power state" if + * we would just wake up immediately. + * + * We want the value that we would get if we read CNTVCT_EL0 from + * the current exception level, so the direct_access offset, not + * the indirect_access one. Compare the pseudocode LocalTimeoutEvent(), + * which calls VirtualCounterTimer(). + */ + cntval =3D gt_get_countervalue(env); + offset =3D gt_direct_access_timer_offset(env, GTIMER_VIRT); + cntvct =3D cntval - offset; + timeout =3D env->xregs[rd]; + if (cpu_has_work(cs) || cntvct >=3D timeout) { + return; + } + + /* We might sleep, so now we check to see if we should trap */ + target_el =3D check_wfx_trap(env, true, &excp); + if (target_el) { + env->pc -=3D 4; + raise_exception(env, excp, syn_wfx(1, 0xe, rd, true, WFET, false),= target_el); + } + + /* + * If the CPU has entered the exclusive region we could sleep + * until the global monitor moves from Exclusive to Open Access. + * However it would be expensive for QEMU to fully model the + * global monitor and not doing so would potentially trigger + * deadlocks in WFE enabled locking code. However as WFE is a hint + * instruction the architecture allows for the PE to leave + * low-power state for any reason. QEMU chooses to treat being in + * an exclusive region as such and return directly. + */ + if (env->exclusive_addr !=3D -1) { + return; + } + + /* + * Finally work out if the timeout or event stream will kick in + * earlier. + * + * The WFET should time out when CNTVCT_EL0 >=3D the specified value. + */ + cpu =3D env_archcpu(env); + if (uadd64_overflow(timeout, offset, &nexttick)) { + nexttick =3D UINT64_MAX; + } + if (nexttick > INT64_MAX / gt_cntfrq_period_ns(cpu)) { + nexttick =3D INT64_MAX; + } + + next_event =3D gt_calc_next_event_stream(env); + if (next_event > 0 && next_event < nexttick) { + timer_mod(cpu->wfxt_timer, next_event); + } else { + if (nexttick =3D=3D INT64_MAX) { + timer_mod_ns(cpu->wfxt_timer, INT64_MAX); + } else { + timer_mod(cpu->wfxt_timer, nexttick); + } + } + + env->halt_reason =3D HALT_WFE; + cs->exception_index =3D EXCP_HLT; + cs->halted =3D 1; + cpu_loop_exit(cs); +#endif +} + void HELPER(yield)(CPUARMState *env) { CPUState *cs =3D env_cpu(env); diff --git a/target/arm/tcg/translate-a64.c b/target/arm/tcg/translate-a64.c index b45aac6d269..4a24e0a7fa0 100644 --- a/target/arm/tcg/translate-a64.c +++ b/target/arm/tcg/translate-a64.c @@ -2195,14 +2195,15 @@ static bool trans_WFET(DisasContext *s, arg_WFET *a) return false; } =20 - /* - * We rely here on our WFE implementation being a NOP, so we - * don't need to do anything different to handle the WFET timeout - * from what trans_WFE does. - */ - if (!(tb_cflags(s->base.tb) & CF_PARALLEL)) { - s->base.is_jmp =3D DISAS_WFE; + if (s->ss_active) { + /* Act like a NOP under architectural singlestep */ + return true; } + + gen_a64_update_pc(s, 4); + gen_helper_wfet(tcg_env, tcg_constant_i32(a->rd)); + /* Go back to the main loop to check for interrupts */ + s->base.is_jmp =3D DISAS_EXIT; return true; } =20 --=20 2.47.3