From patchwork Mon Jul 22 17:29:57 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 813736 Delivered-To: patch@linaro.org Received: by 2002:adf:f288:0:b0:367:895a:4699 with SMTP id k8csp1975968wro; Mon, 22 Jul 2024 10:31:37 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCVYR+U2N6UhUz/M7mq8obKNAqFgOpnyEcWmlWlS2b1MYHyjsT3IQ6AytS1oc/vc22bjxriSHemOxaAvgkVGSt1O X-Google-Smtp-Source: AGHT+IHC5jnphgg4jGVnNOZmq8o7YK4q6VoTjZSfGkl6WE7/1Detc/5U7op/M4c5/NZZJj/uFay4 X-Received: by 2002:a05:690c:1d:b0:65f:7ac6:7f69 with SMTP id 00721157ae682-66a684c2c6dmr122309687b3.6.1721669497112; Mon, 22 Jul 2024 10:31:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1721669497; cv=none; d=google.com; s=arc-20160816; b=Sj9E4AUVtI1Efz1bssoeORpxMlcADqBBkhSMiBfKCyjEikDqz3mD3tW8MUJZSaIK1j yQcGN44roED7/e7uA9wkHjBA4qkrAhhDon52Cmzf3TCh4YyVyEDSGQFQG2CSjMyI+zTd jDU5VmL0K6nxga4wYa6RtgYmpGChibTkMGTmsEsTLUNwZSq9H/jdNb1ZWM4TzTBEBm9U GJny2e0HUq2BAaAtpzuIQeZPPi0iF0V4V8txEQMFiYI31Bjpq2m7ZB9DOrVMqhGTTfoD 29lEbFzR+5Hbwxg8h6TWobkRvOmXRfvZ2FbzF0ahy5f0Cf7p5ea3ksab3Rod1cPtWKwk Ey0w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=bf7ARIytQmQRzsKfx3SaAbLzTh/grrFtr44A30HzPU4=; fh=nCxVRd3+tVxeeprptpg6/WD597c5rE0t/xHaEAH9TBE=; b=xOEYqqAx0EanSZPfJRaqjLUcsXpuBfi+czer0NeKafc9PlFTyGGRa9YFfWINix8sMz XgYsZ1pS15LYYxsqZA1FQlL6oFRZCn02GhTZYjNyrQwIc4Lt3D5DoHH9slFuyDHzbXeQ JjtZYxgEKwc+R5FL77InW7l9Ws1SXlemt4SFWgLOfFnEmXLDoIo7MOV6yfcJjPFCeaVb p/6EwLBd2tA+PTm6kkiWkxifsg5mSeHaZCpQ/G5bZ3rhjlbrWFe84B8SeMZPZEZtnfSO Wbwki5YsIv99TiFrcwvqlskGKMZqj0fe4UsrvUBDUkY+EBCRULqq0+/+1nUFAciyC3Rn b9cw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=SEf5FqNR; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id af79cd13be357-7a19908f4c6si810558785a.541.2024.07.22.10.31.36 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 22 Jul 2024 10:31:37 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=SEf5FqNR; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sVwrb-0000Nm-0y; Mon, 22 Jul 2024 13:30:19 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sVwrX-00009y-Lg for qemu-devel@nongnu.org; Mon, 22 Jul 2024 13:30:15 -0400 Received: from mail-wm1-x329.google.com ([2a00:1450:4864:20::329]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sVwrP-0006OK-QY for qemu-devel@nongnu.org; Mon, 22 Jul 2024 13:30:15 -0400 Received: by mail-wm1-x329.google.com with SMTP id 5b1f17b1804b1-4279c10a40eso33449335e9.3 for ; Mon, 22 Jul 2024 10:30:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1721669401; x=1722274201; 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=bf7ARIytQmQRzsKfx3SaAbLzTh/grrFtr44A30HzPU4=; b=SEf5FqNR1Kdi9mAFGhw0ttVr9xsmgCnV4h8F/5x2NiHuy37gME1nKEBiS1YMH+NXvh LPpjXwIcOXTIzgtuG+clshOdC1WxZMs+S5/l197iPSvX2Hu73T59VDV5T4CPEhFhjbsf Y/YA/IcV1tXGcK9aF/is/Gbv4D1Cdvzk+/I5+eecGcoDDWLpOPQxi61vxeVFxL9XDdI/ S50gbxhzcAE5HsdEcJrqMixmb8LcWYpNhmBsi9hrQKXHBnp4tO7H0rRhYUUEHIOdO/Te XaNh5e8uqkLuiyfq8N+ENAw+DT9IWbYFn3pZcdOojXz/uCY2TbQz6q3RyU7et4cNzNvw pePw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1721669401; x=1722274201; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=bf7ARIytQmQRzsKfx3SaAbLzTh/grrFtr44A30HzPU4=; b=DxK/kF5adz5tWvRM/DFZBqvmwvEPrLFnOvehqXJJMbR+ftxA3wXsqdHxT/cbkReEZI oT3rYCk9fL3hruPT54yJTPoliNR5TTwLa9JEpLqp6ce5Wn0CyPA57YBqrOzSlY2Wjdp3 3hGQh2f5O01QwRAOTk7asrS3t/MQ4GRxTXeWPdOlEShyffJFMAlpZfhIJwY3GInc0zFs eopEA4NN6QKlRGRMLSG+jjsgBO+wcsi9qqguqZUgVot6iPd4Upyeuap1DCeaZunSPf0T lGJBY2EWcHk4uHZ0s1BBI+GhMckYISMxZcsjP42W9O/9JrG7xVnB3ae2QWMKM2Er8UM6 vJUQ== X-Forwarded-Encrypted: i=1; AJvYcCW/Wnxc9XNaWee4fvy71w3FYASDkc8py3YIj5mVN0WAHRSTibxeHpUgPlezhJk7/pSbkFOaS3g4bYwJxkIwLcDoA1HjZUg= X-Gm-Message-State: AOJu0Yym/Dm/54rlQc4GNvd3+npV2Kdmn8SCeUUy+xD157HV4/fx7u8A +Bmph64ywzNrwtSaWNFpRa/kf/KwBEI+DRearn1ZLUUTTDIy3vleLS6dnOeMtAs= X-Received: by 2002:a05:600c:1c27:b0:426:62c5:4741 with SMTP id 5b1f17b1804b1-427dc515f90mr45072115e9.2.1721669401439; Mon, 22 Jul 2024 10:30:01 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-427d68fa493sm138035665e9.10.2024.07.22.10.30.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 Jul 2024 10:30:01 -0700 (PDT) From: Peter Maydell To: qemu-arm@nongnu.org, qemu-devel@nongnu.org Cc: qemu-stable@nongnu.org Subject: [PATCH 4/4] target/arm: Ignore SMCR_EL2.LEN and SVCR_EL2.LEN if EL2 is not enabled Date: Mon, 22 Jul 2024 18:29:57 +0100 Message-Id: <20240722172957.1041231-5-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240722172957.1041231-1-peter.maydell@linaro.org> References: <20240722172957.1041231-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::329; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x329.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: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org When determining the current vector length, the SMCR_EL2.LEN and SVCR_EL2.LEN settings should only be considered if EL2 is enabled (compare the pseudocode CurrentSVL and CurrentNSVL which call EL2Enabled()). We were checking against ARM_FEATURE_EL2 rather than calling arm_is_el2_enabled(), which meant that we would look at SMCR_EL2/SVCR_EL2 when in Secure EL1 or Secure EL0 even if Secure EL2 was not enabled. Use the correct check in sve_vqm1_for_el_sm(). Cc: qemu-stable@nongnu.org Signed-off-by: Peter Maydell --- target/arm/helper.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/target/arm/helper.c b/target/arm/helper.c index ce319572354..8fb4b474e83 100644 --- a/target/arm/helper.c +++ b/target/arm/helper.c @@ -7232,7 +7232,7 @@ uint32_t sve_vqm1_for_el_sm(CPUARMState *env, int el, bool sm) if (el <= 1 && !el_is_in_host(env, el)) { len = MIN(len, 0xf & (uint32_t)cr[1]); } - if (el <= 2 && arm_feature(env, ARM_FEATURE_EL2)) { + if (el <= 2 && arm_is_el2_enabled(env)) { len = MIN(len, 0xf & (uint32_t)cr[2]); } if (arm_feature(env, ARM_FEATURE_EL3)) {