From nobody Mon Sep 28 02:01:30 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=1785237447; cv=none; d=zohomail.com; s=zohoarc; b=V0G2CYfhrq67VZRX8jcmwN4381AG3fv1QImo5v3/fLxsOyw37IWvbYFcodMsAK4fj5vFoxuqGQcZQkJ7d6YVyXYcs1jSVv6tkx/bCM5qSKGAeqKFlAN/y2ojBrnRnjkYXfME2eY8CJWZqXa9jbNp72t0yQxMCxXHSCHW15cyp0A= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1785237447; h=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=q3WsPh2NxmXXCCvxcEgCl7mukhp33wShyS/kmhXfLk8=; b=IbKBG0XpGBEIVzWlZCoY/WFHs2ojfobkfNwGdwbMDna8k/cdzM7GaftegNLOuESrY2n/pyOOfexDYF1W2yC68ObHlxtC98nyr5B2So8nHs/GcxkPZi9VSKX7K7vOovTj5uzm/sPd7fhLTlCYbd1SIO4mhGx9qK4X/UxdX9wyEDY= 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 178523744741261.37035322576571; Tue, 28 Jul 2026 04:17:27 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wofnZ-0001Ra-Uc; Tue, 28 Jul 2026 07:16:40 -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 1wofnY-0001Qv-6S for qemu-devel@nongnu.org; Tue, 28 Jul 2026 07:16:36 -0400 Received: from mail-wr1-x42e.google.com ([2a00:1450:4864:20::42e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1wofnW-0005d3-Gi for qemu-devel@nongnu.org; Tue, 28 Jul 2026 07:16:35 -0400 Received: by mail-wr1-x42e.google.com with SMTP id ffacd0b85a97d-47c2b362ee2so3117353f8f.1 for ; Tue, 28 Jul 2026 04:16:33 -0700 (PDT) Received: from lanath.. (wildly.archaic.org.uk. [81.2.115.145]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4957b5ed646sm284546255e9.0.2026.07.28.04.16.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 28 Jul 2026 04:16:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1785237393; x=1785842193; 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:content-type; bh=q3WsPh2NxmXXCCvxcEgCl7mukhp33wShyS/kmhXfLk8=; b=hLAUcRrzWUwJqtl9CGLFWSx0fyUWFX9q9/O/+97c5w5fpEMEdT8/YW9hkGYHEEEm2n bB6dswnEP3nDxVqRWupdfzsduWg3IzuhygJ7D85qsExRgYCHLVFjft7GXVEL7Tndib+d RW3MDYDJtf0F6vh7lfsEr6SvtTiPsiQk3PChl2niruJPInnuzek4yWwVVxtu6G6dyl+4 N2ijMyoH+LxhacvdoirqGuhO4k7l80ub/hhgfVjooNrsgKQ2lKIc6Htv+2NdiWmvHgoj U0RWFin2SsNG2cTytyJDIevX6imR7BRutCEscWN2Es8nU82Tr26Gw+QK4rbUJud6yC0h Iukg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1785237393; x=1785842193; 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:content-type; bh=q3WsPh2NxmXXCCvxcEgCl7mukhp33wShyS/kmhXfLk8=; b=ej/nFwSuTgLiMfHzKHQYYNHFrJ6ZbfdUXgWfnzl3wBl++NjZiWXs6IYcsOiw/ED8A5 k9Dqr+1Uk3h8UPFZ24vHnQLYJ+KAu+6C0s5yPq3mkosWg5rkdo0OOA+m4glkryP7IW2O TzuegikZUT0pEFFZ9Of3wj6wfN74J44UYSvfgYpnIZ+NsyAqj0vH5W5/Fl6k4t3o76e+ VyVG9csFq9WG/a895ckKBwGgdQ3crYGc0tsacvEAZYDFTugPQFeIhn2k0zoHEPWq1aAD cuEbDirh31d5Fhuw5iplkAd6iMcAk0h8QguqlRtZq9PTbR1wL55mV201BAZAWyZPGLe8 TwFw== X-Forwarded-Encrypted: i=1; AHgh+RqMuTUGETnU6rh2r+j7fnVKPJgviRb67StIQZqI/THDqL+6JMrAkMHsxubLPZdzErDf8soePMNd8EU0@nongnu.org X-Gm-Message-State: AOJu0YwxNjkCNDS6Qti7wtPnXGNShhKIbbC20/SrzAV+/i0SWkzSXTHb yR5jB133oKvTOAv29tor9K4N3Ndq4TTHlN7MGTrLwXjRUtFG7sMiKqTxZXz0oADlRb8= X-Gm-Gg: AR+sD11CT3i7LcWtrvzfw4gICGT0yps2TPLV6m9rwTlOSr3BPgyX+Vqjqn2Fv8wYss+ KJVqZk2SPvMYPYskyPM3xtAdkSTk+rHd+JxYUo/kxZQHOtDKNT1Jre3A94C9hbGcqeV5wUJdo6m Il2vZlQijyibckDe0Ok/X7MfFJEAPWqgIBHd375WhEGYBwCm2Mrf+u1r+uCHBTsGBnlZO/d/JCS WmjGtScA/bK1Ndu6uUW4i8vJrOjW695MdYLUe/co1PrW9/R+S9GKghwth53HBAK3x1HqXgzfMxd 1dtlhNDT/GwNnYi+EgyHdCXhPehmch+6ndbMjYLtm0xT/INOO0PXXqM1pdANy8PYOAR4lSoUe3A BtziYfgdyX0DCHphfmf2ZPyrxBf9wURiIdL78Rx5aVpCWo/mQU8N/INCeqRbmZWrHilzLh08k4j Px1+qCmjkPsUyR2r0Y1ayQ92nas8bi6jkqJ+54ECWEyraOXgeKgZHHZHrQb818nE6wyMoiT8jW8 MfpxTsvO4A= X-Received: by 2002:a05:600c:37c9:b0:495:5062:17f9 with SMTP id 5b1f17b1804b1-496c6586ef5mr20756615e9.30.1785237392654; Tue, 28 Jul 2026 04:16:32 -0700 (PDT) From: Peter Maydell To: qemu-arm@nongnu.org, qemu-devel@nongnu.org Cc: Richard Henderson , =?UTF-8?q?Alex=20Benn=C3=A9e?= Subject: [PATCH for-11.1 1/3] target/arm: Don't NOP the SEV insn on v6K CPUs Date: Tue, 28 Jul 2026 12:16:27 +0100 Message-ID: <20260728111629.1705308-2-peter.maydell@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260728111629.1705308-1-peter.maydell@linaro.org> References: <20260728111629.1705308-1-peter.maydell@linaro.org> MIME-Version: 1.0 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::42e; envelope-from=peter.maydell@linaro.org; helo=mail-wr1-x42e.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: 1785237450042158500 Content-Type: text/plain; charset="utf-8" When we implememented SEV to do something on A-profile rather than being a nop, we got the condition slightly wrong, and made it only effective from v7. In fact the instruction's Arm encoding has non-NOP behaviour from ARMv6K. The effect is that a kernel boot may hang on a v6K CPU like the ARM11MPCore. (This wouldn't have been so noticeable if we feature checked the WFE instruction, and had made the same mistake for the condition on both instructions. But we never have done the feature checks that we ought on WFE, so the mistake on SEV meant that we showed the 11mpcore guest a WFE that did something and a SEV that was a NOP.) The v7A Arm ARM is not entirely clear about whether v6K has the Thumb SEV encoding or not: it says "ARMv7 (executes as NOP in ARMv6T2)", leaving v6K not stated. The 11MPCore TRM says it has at least WFI in both Arm and Thumb, and the v7A Arm ARM uses the same condition text for WFI, so I make the assumption that WFI, WFE, and SEV all get their functionality for both Thumb and Arm in v6K. It's possible that this differed between v6K CPUs -- the 1176 TRM says it has the v6K STREXD/STREXH/STREXB etc, but the WFI is the old-style cp15 one. Keeping the condition check the same for both Thumb and Arm encodings is the conservative choice: if guests try to execute the Thumb SEV insn it will be because they want SEV, not because they want a NOP. Resolves: https://gitlab.com/qemu-project/qemu/-/work_items/4044 Fixes: 60e7ee5bb7cd ("target/arm: implements SEV/SEVL for all modes") Signed-off-by: Peter Maydell Reviewed-by: Richard Henderson --- target/arm/tcg/translate.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/target/arm/tcg/translate.c b/target/arm/tcg/translate.c index a1fc0506188..6e52ad082e5 100644 --- a/target/arm/tcg/translate.c +++ b/target/arm/tcg/translate.c @@ -3246,12 +3246,19 @@ static bool trans_YIELD(DisasContext *s, arg_YIELD = *a) static bool trans_SEV(DisasContext *s, arg_SEV *a) { /* - * SEV is a NOP for user-mode emulation. For v6T2 and earlier - * non-M-profile cores this encoding is a NOP hint. + * SEV is a NOP for user-mode emulation. The instruction is + * also a NOP hint on cores that pre-date the architectural + * feature that adds it: + * - M-profile always has SEV + * - for A/R profile, it exists from v6K onward + * The v7A Arm ARM is not entirely clear about whether v6K has the + * Thumb SEV or not; we make the condition the same, to be + * conservative. (If guests try to execute the Thumb SEV insn it + * will be because they want SEV, not because they want a NOP.) */ #ifndef CONFIG_USER_ONLY if (arm_dc_feature(s, ARM_FEATURE_M) || - arm_dc_feature(s, ARM_FEATURE_V7)) { + arm_dc_feature(s, ARM_FEATURE_V6K)) { gen_helper_sev(tcg_env); } #endif --=20 2.43.0 From nobody Mon Sep 28 02:01:30 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=1785237439; cv=none; d=zohomail.com; s=zohoarc; b=mlHyManlwJwJoAtOEJhccPeZLdkKLM4U9HsRVCyuamlUrgw5RvSlcGR790iTawwTIzKNn4KWGp+aqmGC8YWviSU+EOSCBc8FOyAXW/hrBdAW2QADRI0x6ZFgGHcdRKZeILuThfeTQ8DxLL0QTBXMxEC16eXXAetNQ8/8J+AdIVM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1785237439; h=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=zHPb7VuAgcCWs/t++2jn3b0chMOiJkrQ0SLa31OCmCQ=; b=l41Al0CxHh+NxOFCBkFf2tR1yx3RR8Dqa5jrN79PDkyuPUaXR7nTeHsmfSNycp9BZENiu1k3Z+w6yaeOVJZemw80wxsjGXGddM+AEORKylc70vvoNW95Ykd7/SjckTUIopt5aEyoolTNQqlXfYMqC9pleoh6hGOPJRfOuumgwiA= 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 1785237438986147.29603917193867; Tue, 28 Jul 2026 04:17:18 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wofnk-0001Vd-8f; Tue, 28 Jul 2026 07:16:48 -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 1wofnZ-0001Rf-UZ for qemu-devel@nongnu.org; Tue, 28 Jul 2026 07:16:39 -0400 Received: from mail-wm1-x32d.google.com ([2a00:1450:4864:20::32d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1wofnX-0005dS-V5 for qemu-devel@nongnu.org; Tue, 28 Jul 2026 07:16:37 -0400 Received: by mail-wm1-x32d.google.com with SMTP id 5b1f17b1804b1-4954afac04bso42753585e9.0 for ; Tue, 28 Jul 2026 04:16:35 -0700 (PDT) Received: from lanath.. (wildly.archaic.org.uk. [81.2.115.145]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4957b5ed646sm284546255e9.0.2026.07.28.04.16.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 28 Jul 2026 04:16:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1785237394; x=1785842194; 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:content-type; bh=zHPb7VuAgcCWs/t++2jn3b0chMOiJkrQ0SLa31OCmCQ=; b=tiPWBj/GzcwROEkC2l/pzzFNOH1OmpaEIS4Tu4jNUS/sh8fnRXMCL/9s83fvptMPiG jwvIq4iPtrvJEp0tVrxYxVKLtbOiSWCBTyNOpLSlR1MD0OO3lnF7e050Iew1G8h8gOaJ WowN4AUnqafbwy264bHcogxskP6f0x9pVuQYmkxCN+so2vtip4CsYhgXxPE4flA9rz82 QG3Gc42Rua6VfTH/dM0iFQDjkCRR0zQmVusxWKpD1oE8VRuSYP18vFFRrI7/zINQJgY6 y4y84tZPjDv5bNp7Qt/DYBSWD4A5aLXwosFhRmmNwbD+mfRzxvmd5cd8NSVtkzwvH85W qCdA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1785237394; x=1785842194; 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:content-type; bh=zHPb7VuAgcCWs/t++2jn3b0chMOiJkrQ0SLa31OCmCQ=; b=CIa+tFpAWf8YUdS7Hpk3CBqAsXkUrcCZRxT8bMpT7sEk1bVJApQWJykQdnp6SBE2SI xOFgNAXjxkDnigBEV6CRIalPfVJa9wi+vT2fM//3D7d1JXISEBA0uk8Thjj15hUsocPI tvIy9Ic4UWXBcGD8vRtR4TtraIL8zomWVFtumtQ7KkSjRAucsP0S88gdpMAVud8iXpuA X/Y8CtF9Py1qdcm3ZaHYo2LrIBsm9HFBr4ilSjrGsmniOAaPmeBCcEe6JekVYa9RzElA ryG49T5vyge9Qyh1o/Swr6wEThbxtgdCt7l9TjYDhhyHFTJpNlrAtJQELuJVNeu2LrNa coCg== X-Forwarded-Encrypted: i=1; AHgh+Rq/QpgtCGPQPyBl6RoOEcNR252CHpjyRz/b1m6SKHdTUaue7eDOSMHCysht10c2VDCm8/9glIhEixUS@nongnu.org X-Gm-Message-State: AOJu0Yyjoa6P/Z8V/8EqKu+HV0W0UNzp+hfmLg2sL/rhGuEmjGQ+Gb5n wQQOx9No12Ea1DBmqX0LNtZno592q7Xvs0vSyWgEy0MwBZOdHJ0zmb3K0yxJh6WCpnnS0XdYjVw 9eOvD X-Gm-Gg: AR+sD127921opEmdVNlealHwAo6jv4IdZn3RDTSgNel55r+QVp6iTa4ojD/wunJjPNS D8no1C3WKm0HOP3ySW8+J8fAshjAsHDdh8rLvIuDvOtSMYhd7cT9F08qPamv/plbu2iDjHOCw5t 7pBE2EP6ebXVOZ8giu1D0pHn9Uj/hV117qJMf13g59PBG3phL/MwxWaIfrZbq+i8lyllXLG52bJ 3UB9eUdPr4e7sw7rkErsfVtKw7f6DlKC9Rb0mdqO6OkQ6zQZ6vqKEyyUdbl2LYUO0LCRPjdceT+ 0esPK2clRZFloiv4HVziND2QYXky4wpJBn5NdLjjEw41vbb8yEUtVd2mpCLg6xxNXq4MQm47Tow KO7ZkeFsVUkH1xLcjfgSSHRQhLW+4I8XGvr+4+ruxFMOxdi3HQMe15ouR1yvrtnYflYSEkAhAO3 MvcNZ7Qd009jan+ttSKVKkHcqgA9IhjEG/+FnQ+a+JhfoOKfNARBPb3147iDMxH5v0tdB2qONre UvBdUN3iPs8Aq7Z6ystPw== X-Received: by 2002:a05:600c:4452:b0:493:c453:6002 with SMTP id 5b1f17b1804b1-496c65c8abemr18671625e9.35.1785237394572; Tue, 28 Jul 2026 04:16:34 -0700 (PDT) From: Peter Maydell To: qemu-arm@nongnu.org, qemu-devel@nongnu.org Cc: Richard Henderson , =?UTF-8?q?Alex=20Benn=C3=A9e?= Subject: [PATCH for-11.1 2/3] target/arm: Make YIELD, WFI and WFE be NOPs on pre-v6K Date: Tue, 28 Jul 2026 12:16:28 +0100 Message-ID: <20260728111629.1705308-3-peter.maydell@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260728111629.1705308-1-peter.maydell@linaro.org> References: <20260728111629.1705308-1-peter.maydell@linaro.org> MIME-Version: 1.0 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::32d; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x32d.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: 1785237442075158500 Content-Type: text/plain; charset="utf-8" The YIELD, WFI and WFE instructions are in the NOP hint space, and were only defined to actual non-NOP instructions starting in the v6K architecture; they are also present for all M-profile architecture versions. We never did check the architecture version before making these instructions have their special behaviour. Mostly this has not been a problem because a guest won't execute one of these insns unless it is prepared for it to have its usual effect, and because we implemented SEV and WFE as NOPs anyway. Now we have implemented SEV and WFE to be more than just NOPs, it's important that we have the same condition on the SEV as the WFE, so that we either NOP both or else implement both. A guest probably won't try to use SEV/WFE on CPUs that don't implement them, but it is valid for it to do that and rely on them both being NOPs (and so a WFE-loop falls back to a pure busy-wait loop). Add the "only if M profile or v6K or better" check to YIELD, WFE and WFI. This means that all the insns in the NOP-hint space for A32, T32 and T16 have a correct feature check. Fixes: 60e7ee5bb7cd ("target/arm: implements SEV/SEVL for all modes") Signed-off-by: Peter Maydell Reviewed-by: Richard Henderson --- target/arm/tcg/translate.c | 35 ++++++++++++++++++++++++++--------- 1 file changed, 26 insertions(+), 9 deletions(-) diff --git a/target/arm/tcg/translate.c b/target/arm/tcg/translate.c index 6e52ad082e5..055f3c5b403 100644 --- a/target/arm/tcg/translate.c +++ b/target/arm/tcg/translate.c @@ -3235,10 +3235,14 @@ static bool trans_YIELD(DisasContext *s, arg_YIELD = *a) * the next round-robin scheduled vCPU gets a crack. When running in * MTTCG we don't generate jumps to the helper as it won't affect the * scheduling of other vCPUs. + * This is a NOP hint on older architectures. */ - if (!(tb_cflags(s->base.tb) & CF_PARALLEL)) { - gen_update_pc(s, curr_insn_len(s)); - s->base.is_jmp =3D DISAS_YIELD; + if (arm_dc_feature(s, ARM_FEATURE_M) || + arm_dc_feature(s, ARM_FEATURE_V6K)) { + if (!(tb_cflags(s->base.tb) & CF_PARALLEL)) { + gen_update_pc(s, curr_insn_len(s)); + s->base.is_jmp =3D DISAS_YIELD; + } } return true; } @@ -3280,17 +3284,30 @@ static bool trans_SEVL(DisasContext *s, arg_SEV *a) =20 static bool trans_WFE(DisasContext *s, arg_WFE *a) { - /* For WFE, halt the vCPU until an event. */ - gen_update_pc(s, curr_insn_len(s)); - s->base.is_jmp =3D DISAS_WFE; + /* + * For WFE, halt the vCPU until an event. This is a NOP + * hint on older architectures, with the same conditions + * as SEV. + */ + if (arm_dc_feature(s, ARM_FEATURE_M) || + arm_dc_feature(s, ARM_FEATURE_V6K)) { + gen_update_pc(s, curr_insn_len(s)); + s->base.is_jmp =3D DISAS_WFE; + } return true; } =20 static bool trans_WFI(DisasContext *s, arg_WFI *a) { - /* For WFI, halt the vCPU until an IRQ. */ - gen_update_pc(s, curr_insn_len(s)); - s->base.is_jmp =3D DISAS_WFI; + /* + * For WFI, halt the vCPU until an IRQ. This is a NOP + * hint on older architectures. + */ + if (arm_dc_feature(s, ARM_FEATURE_M) || + arm_dc_feature(s, ARM_FEATURE_V6K)) { + gen_update_pc(s, curr_insn_len(s)); + s->base.is_jmp =3D DISAS_WFI; + } return true; } =20 --=20 2.43.0 From nobody Mon Sep 28 02:01:30 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=1785237451; cv=none; d=zohomail.com; s=zohoarc; b=n7f8SZvBv2T4PBpK5ITIKXJt0/oHQriz1FnxPxjBOjosJeO4oG7pH/Aotv/9Exry12jug2vO9PEE5rLdtnr9vrAT/3tihly7trX9WCdQo9dhNayWxIr+AwmfyAFw9Nr3fIXyreNAJ8Uwmyv96pG4cxdhOSCQQ/9Tmoa/dlE/dT4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1785237450; h=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=+VC5XlZjOD0If4uBQba9NfUJ8lBSE0okGvUEe+SC8+M=; b=BYKQ2dfaTzBW1snw36Csmd0n370d20+AdB9exk1LpCPng/whTfXOI20buk+i0ekxmehhbIduw7G563kYP4fpx1bL5iwwSR6Y1Qs5FrRucwC5GDE3xYGXly5V7PTbaq22K5pZcgkePv8Bexo97f2aJgWzxt9SsJM8Xpq4OMDV4No= 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 1785237450933451.55284944669313; Tue, 28 Jul 2026 04:17:30 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wofnj-0001V6-NE; Tue, 28 Jul 2026 07:16: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 1wofnc-0001S3-A5 for qemu-devel@nongnu.org; Tue, 28 Jul 2026 07:16:41 -0400 Received: from mail-wm1-x332.google.com ([2a00:1450:4864:20::332]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1wofnZ-0005dn-Mp for qemu-devel@nongnu.org; Tue, 28 Jul 2026 07:16:40 -0400 Received: by mail-wm1-x332.google.com with SMTP id 5b1f17b1804b1-4956869750eso28097785e9.2 for ; Tue, 28 Jul 2026 04:16:36 -0700 (PDT) Received: from lanath.. (wildly.archaic.org.uk. [81.2.115.145]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4957b5ed646sm284546255e9.0.2026.07.28.04.16.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 28 Jul 2026 04:16:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1785237395; x=1785842195; 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:content-type; bh=+VC5XlZjOD0If4uBQba9NfUJ8lBSE0okGvUEe+SC8+M=; b=sQT+3ouVbvuv6tj5giuRpBKDmh+T8Tu5aWeGFzulT3mA7L2kMVh2y2/nipk8ftsMIk dSPtr7nmEN8IeiQeDuH2T5E+9TmF4KPIrTFu6AgMJU+6q06TGpkSnYKG/yZK8U2bDobJ n0NNgYjsGecf2VwNVKw6b0uJzddHyZxNFlkms+e6yk+guE/tOReNHkFEbhd7dab6AcCN n9dLeb8nDohr08r6fS0bt9KMoX/X1TqCw9jzUBdTshnofAMJlEmsZ38Iz3jD5ZzAx4Eu QiaUb0zTgUqexqGKMI0zLZbVZ+QZR4SwQ+2jpf/m+uLEsT8OeF+58GqFbp9Rsg711/Ge DktQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1785237395; x=1785842195; 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:content-type; bh=+VC5XlZjOD0If4uBQba9NfUJ8lBSE0okGvUEe+SC8+M=; b=NcRXOg84Ftn2rBJS9AbdK9akntQh4eajnKzToYo45Uhdoxya/edtwpmHmxtMrGQi0T c2l4mRmlCJ5zCD7aVYQkqFemwyvnRkDFyk7sgIfA+ffkh665hF/K7cjD9ORgd3uUYb3k eWypolbfEi4ir3imBZ1CYoNopZ83TXNOGrmpENzEi7h4X8E6Y0F5VCl8T83YbpTX1SGK 4IXLRwyA4nfA2Ar1WFqgUwuJ1xdWH50KK6Y5w7Ft3SMmNjVZVm4qABPZHpX0E0GbhHLm wZSGQIlKQFvuF35Dgi+S79dwGggtpraBx4u3mbJfEeFO+5awxFJrjGyjhlpUJ17FgY0w cCHw== X-Forwarded-Encrypted: i=1; AHgh+RrRGk4rA7KRwOch/IG1TYopARFGodVdAhmYZQP4v/OIADsZ0i2up4K1xn6DdsdaFKv6v74AnBFK3diL@nongnu.org X-Gm-Message-State: AOJu0YzCmgdS0LCBFm4zHXjChS8ar0c9r6PYMOPH6W+f0aFOfvLlAxyf eKgynQVqC6+pZyOJnvQu1hd9+8Ys06fvwt+Slf8heyvAqPMBAUirQlm68kvywwJcoKVkPVrKxed wqpjW X-Gm-Gg: AR+sD11Y2wh8ohMathd6NALi/S7uF380RnGGhsTk1gPDVQWnB89n+4QilLwwEqgqMR8 OWmau9I2acUrBh/NdxcTTnOW3RMyeZ6f8mVAyIWvUiOpUhTzB7oank5lnWdTUF2/h19T9fLCTcV w93jy6rMtBe1ZZsnzZEEYltLUn1LGaGYenunhGx80yj0vUxmIYyzJXebgGb3iprgvl/vxkCahim Hp8LFu2GTBDKKE/pd1q6tcBACyz4BIpQIYOBszEPuh17fJmaUZGYonrq+/MoPBMyxZG0TaOveQ8 qUfIt3CnnMA0FGt9ecUgQrcCx2lTW1dw4QQPE95np9uflS99OHMt2FtQiuCrmly0MQg6KoyEJzv vt4WEusqXAQQQYeGg/cDMbggHyMOX9EU/sdkogy7rwRJSGAEGSMixSxI2vVuOcdID+wafmYvulU LbqcueXgPTQCrjoEukuwNS4WfdjUwNGJpACkG2256RHZd67hLj+4Jf0amRDn88alzsb914VVzy3 176TsoMyNU= X-Received: by 2002:a05:600d:844e:20b0:495:5375:2510 with SMTP id 5b1f17b1804b1-496c6568a37mr15038315e9.24.1785237395488; Tue, 28 Jul 2026 04:16:35 -0700 (PDT) From: Peter Maydell To: qemu-arm@nongnu.org, qemu-devel@nongnu.org Cc: Richard Henderson , =?UTF-8?q?Alex=20Benn=C3=A9e?= Subject: [PATCH for-11.1 3/3] target/arm: Remove stale comment about WFE/SEV implementation Date: Tue, 28 Jul 2026 12:16:29 +0100 Message-ID: <20260728111629.1705308-4-peter.maydell@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260728111629.1705308-1-peter.maydell@linaro.org> References: <20260728111629.1705308-1-peter.maydell@linaro.org> MIME-Version: 1.0 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::332; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x332.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: 1785237451986158500 Content-Type: text/plain; charset="utf-8" We forgot to remove a comment about WFE/SEV only being implemented for M-profile when we added the A-profile support for this; delete the stale text. Signed-off-by: Peter Maydell Reviewed-by: Richard Henderson --- target/arm/cpu.h | 1 - 1 file changed, 1 deletion(-) diff --git a/target/arm/cpu.h b/target/arm/cpu.h index 03a30afcbed..c0492c8dfbc 100644 --- a/target/arm/cpu.h +++ b/target/arm/cpu.h @@ -766,7 +766,6 @@ typedef struct CPUArchState { /* * The event register is shared by all ARM profiles (A/R/M), * so it is stored in the top-level CPU state. - * WFE/SEV handling is currently implemented only for M-profile. */ bool event_register; =20 --=20 2.43.0