From nobody Fri Dec 19 14:32:19 2025 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=1646255360; cv=none; d=zohomail.com; s=zohoarc; b=mr1JBdes6/pFJ7vi56n5wmmJ5lJzibr1ce5u8Mz9XFyHuIGNWnst+0K3GyjTdNyRVwQsMExUFxPQLB3d0niU0ud86djxaJxVhzkNLVxqqf+qktDvOjtPP4RH27b7ynCq0N0s3q+nGmn/DAj1fcF9HGRN4azZxowZQQu0sdxJ77I= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1646255360; h=Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=SM320yQbplZVI8Mj8lk3kp4hv9BTspAqO+QUiQG4O/o=; b=TxpFaB80r8ZeAlbDoCj4yqmic4UR8iueemJ4E+BQXt0+tNN51Xn323BEsb5m6N3ZekQB0n1r17Lx/goxqa/Ysc8Mpjkvtghn5BKRu01hlVpUeIQHYaog9W86mWuNVPGWAf8C7I2UStabyrcGdBzfUiRNYKJjPnQNbbEgnqbHDpk= 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 lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1646255360654704.8192774080649; Wed, 2 Mar 2022 13:09:20 -0800 (PST) Received: from localhost ([::1]:44972 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nPWDo-0007V3-79 for importer@patchew.org; Wed, 02 Mar 2022 16:09:20 -0500 Received: from eggs.gnu.org ([209.51.188.92]:43618) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nPVxw-0005uD-0P for qemu-devel@nongnu.org; Wed, 02 Mar 2022 15:52:57 -0500 Received: from [2a00:1450:4864:20::42d] (port=39428 helo=mail-wr1-x42d.google.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nPVxs-0008Sw-BY for qemu-devel@nongnu.org; Wed, 02 Mar 2022 15:52:54 -0500 Received: by mail-wr1-x42d.google.com with SMTP id ay10so4678027wrb.6 for ; Wed, 02 Mar 2022 12:52:51 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id x13-20020adfec0d000000b001e31279cc38sm90801wrn.11.2022.03.02.12.52.50 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 02 Mar 2022 12:52:50 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=SM320yQbplZVI8Mj8lk3kp4hv9BTspAqO+QUiQG4O/o=; b=NkLPESjWQnirCgbc9i98Cr+nsjeG6gDrRGGYyL2TspfsR38laJx8HNldshMrek/mTK 94/U8Z5U6VIMDJrF5a2cQZ2zDza1CgPjBkm/YDhgFmbFkE0VfYjMibQTJvMo9YKRzs1m ALLOiyDhFBIhgZ/0P+JfsuOympSh3Lz18ri8xI9PDvM+T7wP0M5DatXbgwEYQvX0jzfU P9YOUj9ysJtke833yOfBYPkQ++M4Px49fSsBvr3DYrJQ5+3/MOK0hrSa2iyFbP4zI1U0 daQaRngqnl/2OZ0hha+MsNu53bXCRCRUQhTZG2obbh4ZEDyAVoeW+03GWBGlprTgCzUB Ph2g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=SM320yQbplZVI8Mj8lk3kp4hv9BTspAqO+QUiQG4O/o=; b=mONyRruBvam590Nf4meGGVHTe2Styqj+gxOSMfM4zz8QFnolrwUFU/zeb9fPtwQNnk IIpTn+CW5Qc6PZVlX4Bj38pHIKLZIXmrWodb/Rgl4H2LKgaevTnqZVnhQ2nQT5zlgCIh 0swvotlaiIF1KFWtDn4oQwEirIDepMInL+1C8EvNni34PF+4btBK6DjjRw61qrxNdflY 49cvkPqbbnfxhRo8z5mJ85yVJHkPPfdcbfakEPBLp0EYApiI0wGxDvbnM/CbYAED4nHt gBvcTxud2oJQViK1u5+NI1VFqW3FIM0nChd9KA40GjoNpt9SCBX9gj5heYNoh+SIJSez jARA== X-Gm-Message-State: AOAM532o8iCvnJ2+njfIjfhhvdGNfG+1bm/o2eNvz7WkCuGN4jDHvMpi 4FRt3sUVUoogH4yutKE3RlfAfuLpxlBo5g== X-Google-Smtp-Source: ABdhPJyIkRMcgrKcEhxbLKktKJ9ObPaKURzcQt1I/fNjQuiNDu6UVq07IheOF1W53OJlkSXrDUV1hg== X-Received: by 2002:a5d:64ae:0:b0:1f0:490e:159f with SMTP id m14-20020a5d64ae000000b001f0490e159fmr1387979wrp.143.1646254371103; Wed, 02 Mar 2022 12:52:51 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 21/26] target/arm: Validate tlbi TG matches translation granule in use Date: Wed, 2 Mar 2022 20:52:25 +0000 Message-Id: <20220302205230.2122390-22-peter.maydell@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220302205230.2122390-1-peter.maydell@linaro.org> References: <20220302205230.2122390-1-peter.maydell@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Host-Lookup-Failed: Reverse DNS lookup failed for 2a00:1450:4864:20::42d (failed) 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=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::42d; envelope-from=peter.maydell@linaro.org; helo=mail-wr1-x42d.google.com X-Spam_score_int: -6 X-Spam_score: -0.7 X-Spam_bar: / X-Spam_report: (-0.7 / 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, PDS_HP_HELO_NORDNS=0.659, RCVD_IN_DNSWL_NONE=-0.0001, RDNS_NONE=0.793, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=no 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+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1646255362714100001 Content-Type: text/plain; charset="utf-8" From: Richard Henderson For FEAT_LPA2, we will need other ARMVAParameters, which themselves depend on the translation granule in use. We might as well validate that the given TG matches; the architecture "does not require that the instruction invalidates any entries" if this is not true. Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson Message-id: 20220301215958.157011-15-richard.henderson@linaro.org Signed-off-by: Peter Maydell --- target/arm/helper.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/target/arm/helper.c b/target/arm/helper.c index e455397fb57..3a7f5cf6f08 100644 --- a/target/arm/helper.c +++ b/target/arm/helper.c @@ -4520,12 +4520,16 @@ static TLBIRange tlbi_aa64_get_range(CPUARMState *e= nv, ARMMMUIdx mmuidx, uint64_t value) { unsigned int page_size_granule, page_shift, num, scale, exponent; + /* Extract one bit to represent the va selector in use. */ + uint64_t select =3D sextract64(value, 36, 1); + ARMVAParameters param =3D aa64_va_parameters(env, select, mmuidx, true= ); TLBIRange ret =3D { }; =20 page_size_granule =3D extract64(value, 46, 2); =20 - if (page_size_granule =3D=3D 0) { - qemu_log_mask(LOG_GUEST_ERROR, "Invalid page size granule %d\n", + /* The granule encoded in value must match the granule in use. */ + if (page_size_granule !=3D (param.using64k ? 3 : param.using16k ? 2 : = 1)) { + qemu_log_mask(LOG_GUEST_ERROR, "Invalid tlbi page size granule %d\= n", page_size_granule); return ret; } @@ -4537,7 +4541,7 @@ static TLBIRange tlbi_aa64_get_range(CPUARMState *env= , ARMMMUIdx mmuidx, =20 ret.length =3D (num + 1) << (exponent + page_shift); =20 - if (regime_has_2_ranges(mmuidx)) { + if (param.select) { ret.base =3D sextract64(value, 0, 37); } else { ret.base =3D extract64(value, 0, 37); --=20 2.25.1