From patchwork Mon Apr 10 14:14:07 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 672032 Delivered-To: patch@linaro.org Received: by 2002:a05:6000:184:0:0:0:0 with SMTP id p4csp276756wrx; Mon, 10 Apr 2023 07:14:54 -0700 (PDT) X-Google-Smtp-Source: AKy350bFbYhXfPVljM0qWIlopqbFcNAHwHZE55dfhuIGyBVtJUhusYPB2tYTghbXtG7HPUrR/Ht6 X-Received: by 2002:a05:622a:15d0:b0:3e6:9395:908b with SMTP id d16-20020a05622a15d000b003e69395908bmr14847914qty.27.1681136094269; Mon, 10 Apr 2023 07:14:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1681136094; cv=none; d=google.com; s=arc-20160816; b=gDHZL2SMk5XVOG62Bj0KFsFItAwtea45Cwk/PRiwGc+HPfyqmoCPX4rEVCConSdswe SxPzj162T2BOBa556hv7fpGGW0hXrvnbzrjd69Zo0iCA5IlmqubqTwBvBvrpHrYTEsLG yOy9FwAhhY+UzcVpYUDhbcVs4hg+IjWNAbVn7CcnyLHtNLynI6JtkZWiqOet7dl/Hdr+ 09X/x4Ibldsl0XSOSPYCAN7x6rYOk1KMMq8ce9WYu/OlvY3o7GrE56dX7KX0SKirbozV GphK0672MOZlYAYocWiu4cWT5/eqLlzfZlDYs/yZni+zs5pxDjCCN8y125l3KvNmiVUQ 584w== 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:to:from :dkim-signature; bh=wwcJMYioCETaUAbI9id00MHSwcNGqBVlBGyKFH1vsv4=; b=iMalITGYjWmXvu1juTFAuhXgWgY0Gefc+bciD+5in6CyA5tRsQnt4g5NnfMxrUngPi Wq6FHRJLdxTWShDHO5yftsvu4bWV5c/ykeKy0h9SESEjUPsLCgn9/XhBDJverCImuh+a IYw+0EcRdt33WlnsPjGcyc3c4T1RTRwoYAMhzM6i8cfjbdatf7omdOsX6dWeRsTAqav6 EyZOWePs4M2xHNGPe4AJ/ALqLGgi6G/PrSmRYFwglI8jemmFJUEuEjW+uabkEb4R8HKK Bvv4v71VZj+h36MI+ioGQBe0GxhRn+KgpBV1S+akxLAWutuJlOjt6/B5J+dA8en9JDy2 nN9w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=nC6fbiUv; 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id t4-20020a05622a01c400b003e37ebb0f4dsi7488257qtw.315.2023.04.10.07.14.54 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 10 Apr 2023 07:14:54 -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=nC6fbiUv; 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 Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1plsHe-0001Cz-J3; Mon, 10 Apr 2023 10:14:14 -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 1plsHd-0001CZ-86 for qemu-devel@nongnu.org; Mon, 10 Apr 2023 10:14:13 -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 1plsHb-0000Ss-Q8 for qemu-devel@nongnu.org; Mon, 10 Apr 2023 10:14:13 -0400 Received: by mail-wm1-x336.google.com with SMTP id q5so2851356wmo.4 for ; Mon, 10 Apr 2023 07:14:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1681136050; x=1683728050; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=wwcJMYioCETaUAbI9id00MHSwcNGqBVlBGyKFH1vsv4=; b=nC6fbiUv0lgpxZZqx269YJ1xlXnThxXv2LwcHSfHt+uAyWitZAlvWCGI3UFSeiZ3Gn pt5CGY93FwAcCYq7otv+toJXg7FkvH+Hs3Qx1ZvN0zxaJe9qelUkrCHDqZEKG9MEw0z6 X2H++BGz5vghVntOfZoFc8gckPvqEdBRC5Q3nM6vbcgot0ZDzJqLdomWcmrqtB0N/o6H nGZjX8JMnauZHZO/Qx5ru59lVnkkb6s0Q3iuiPPLH0qXARwCzLxJ01I7k/u4oyh0cP31 PiTV5cI+KV4FCtVVkh1D61fR872ZpgneEulDemJ2FqO5hHEGATICIlHTRzhIhM9ja5oy kDwQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1681136050; x=1683728050; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=wwcJMYioCETaUAbI9id00MHSwcNGqBVlBGyKFH1vsv4=; b=G1VvvBySxJcZkS6uRg9nmfmCTT7Dj1ycHtV2ewykZQSJl20164Y1JbcHYyqaVVH2OI WPU/MqvO+9HYkSh27aSkcgFP5XifaSX7OFFGvR/vs9YSlC1x12UQuR1Pmcmhtnkw7bzI vtaX7/pWM8YVDGMBTgcXrj6lf4XfhV8ifySKjrw2wP4agN4amqaZUHmvAG87f6b65mOc k1RL9GkGBAASCfOZ0dm4R+CGlSqCbL2ZQakPk8pgdZoszA5KfFVwoG6ifsnJrq9+BFr1 n4IRsnh7Da8WJ5i4/0EEh6D0pu2L8XC7WUKa8tpNnIh9J/0Db+VFbheHR2X9y+5uNrvh 0VJQ== X-Gm-Message-State: AAQBX9esGhQ6FjVjsUIAkhB1sY4An/VXuu4YYv7/L5JFuIfSSnQUexGU 4OrD2t5jA+oT1SG/QYh9NGRIrXvAXXzxwRQJ9Jw= X-Received: by 2002:a7b:cd87:0:b0:3ee:19b4:a2e6 with SMTP id y7-20020a7bcd87000000b003ee19b4a2e6mr7628805wmj.19.1681136050396; Mon, 10 Apr 2023 07:14:10 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id s9-20020a7bc389000000b003ef64affec7sm13793060wmj.22.2023.04.10.07.14.10 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 10 Apr 2023 07:14:10 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 1/2] target/arm: PTE bit GP only applies to stage1 Date: Mon, 10 Apr 2023 15:14:07 +0100 Message-Id: <20230410141408.3564269-2-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230410141408.3564269-1-peter.maydell@linaro.org> References: <20230410141408.3564269-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::336; envelope-from=peter.maydell@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=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 From: Richard Henderson Only perform the extract of GP during the stage1 walk. Reported-by: Peter Maydell Signed-off-by: Richard Henderson Reviewed-by: Peter Maydell Message-id: 20230407185149.3253946-2-richard.henderson@linaro.org Signed-off-by: Peter Maydell --- target/arm/ptw.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/target/arm/ptw.c b/target/arm/ptw.c index ec3f51782aa..58a6de09bc9 100644 --- a/target/arm/ptw.c +++ b/target/arm/ptw.c @@ -1585,11 +1585,6 @@ static bool get_phys_addr_lpae(CPUARMState *env, S1Translate *ptw, result->f.attrs.secure = false; } - /* When in aarch64 mode, and BTI is enabled, remember GP in the TLB. */ - if (aarch64 && cpu_isar_feature(aa64_bti, cpu)) { - result->f.guarded = extract64(attrs, 50, 1); /* GP */ - } - if (regime_is_stage2(mmu_idx)) { result->cacheattrs.is_s2_format = true; result->cacheattrs.attrs = extract32(attrs, 2, 4); @@ -1600,6 +1595,11 @@ static bool get_phys_addr_lpae(CPUARMState *env, S1Translate *ptw, assert(attrindx <= 7); result->cacheattrs.is_s2_format = false; result->cacheattrs.attrs = extract64(mair, attrindx * 8, 8); + + /* When in aarch64 mode, and BTI is enabled, remember GP in the TLB. */ + if (aarch64 && cpu_isar_feature(aa64_bti, cpu)) { + result->f.guarded = extract64(attrs, 50, 1); /* GP */ + } } /* From patchwork Mon Apr 10 14:14:08 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 672034 Delivered-To: patch@linaro.org Received: by 2002:a05:6000:184:0:0:0:0 with SMTP id p4csp277230wrx; Mon, 10 Apr 2023 07:15:47 -0700 (PDT) X-Google-Smtp-Source: AKy350aX2oLT3g1H9I+zniRHY1rPGDSrXj+TCowS5fu//mXgU27X3JyrUKFHnKd/AzntIeY4AWQJ X-Received: by 2002:a05:622a:1a0b:b0:3db:573f:8f7d with SMTP id f11-20020a05622a1a0b00b003db573f8f7dmr18963545qtb.17.1681136147004; Mon, 10 Apr 2023 07:15:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1681136146; cv=none; d=google.com; s=arc-20160816; b=p7ihL/D6S+g9PceJAV1FKkpBKMbDfEIC0Mf70phOjcjpxpDkQvOwQHYmNHE5fFVUbK icL6RFVDg0eHxLocxSp26JBogUeF5ZspXtczUGFLKKbhulpyON80F0I7nZ8hjHY3cHFE STJE0o7ck/m/EM/AjOxPxvFMXSNfrWchHJUAhc+q1giPE5+Vq6JBrxYnDDKiVkeCahFu 2LOGtniCBAF6pZCtZt1HkxULAhDUs7gjboCg1/lE4NfkdPUH1qL7rFjx/W9Sh+OUtpn6 2gIE4mveBnFAJsPPvw7A6vV/DAYtSablOMnbsfYYyew4dE7FAzYKAMuQut/YJtYfED6w 5gFg== 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:to:from :dkim-signature; bh=EDUr0McT6NiQ4OIps3CevtawlpOzEV5YKFfNxKiu6mA=; b=zzfpzqaArzbbgq/3ZCAU9Dhs9KeoZQwhAYZvtY25QT/LTVI3rLsYgC+iYHoADchjqX zlkVRBPgDIScGAbV/pZu/TWeJ1ZDsDAgDkNNajk/yqyJ9mO3r2HJOo96fWG8VAzI/onh TH7mXCaKXMmIGyKg/5HmlXIezJU65cbtjL3NxEuDBgCCs/C3y4vHldDLedSLebFIesdk ds15OzDfwLtC+PzKsH8271EV3x3I2L8oN1QbvcqXHU6c66TIrglYqLfWE97q1NABVccx 2jewuyUNbJnIHnwHRVwwSjZX8+Ou8zvzxBmUaJJhZL02xY8YedEMawQP+HCVZsBf4W8D 2Uug== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=liKYzmai; 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id q19-20020a05622a04d300b003e39113ebecsi7245150qtx.517.2023.04.10.07.15.46 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 10 Apr 2023 07:15:46 -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=liKYzmai; 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 Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1plsHf-0001DF-5P; Mon, 10 Apr 2023 10:14:15 -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 1plsHe-0001Cn-4I for qemu-devel@nongnu.org; Mon, 10 Apr 2023 10:14:14 -0400 Received: from mail-wm1-x32e.google.com ([2a00:1450:4864:20::32e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1plsHc-0000Sx-Aj for qemu-devel@nongnu.org; Mon, 10 Apr 2023 10:14:13 -0400 Received: by mail-wm1-x32e.google.com with SMTP id n9-20020a05600c4f8900b003f05f617f3cso9421733wmq.2 for ; Mon, 10 Apr 2023 07:14:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1681136051; x=1683728051; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=EDUr0McT6NiQ4OIps3CevtawlpOzEV5YKFfNxKiu6mA=; b=liKYzmainc5VEB6a4y6fuf8s4Ghws+Y2nYZqggr6MbdH889z27jRq/poLpoxmj7Cs4 xKCzEw2iXNVgaqL+ASYw8GuulTvdT0deSrKgGJ41Yx95DcG7CyLovQYEj/4qEQ3AONQb aIxTLCIKO1LoK5UA3SKwVWhNZKPLjw+lFtXhG+wnX92HnAAgzY273rpp++yld/JzMknM slzp+hmMlcDptIE9nBkJ9/jTdtF/cEvP2WVc3FSpy7kZEi8eP8ojMiM0g+LkIA2Atn/8 pV7KYnoE6W6MJnchxI09yCsn4H/3TGQpH8aJUYJOpFgJMTfDayEWGLLf6i0pN2THEfAS XmRw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1681136051; x=1683728051; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=EDUr0McT6NiQ4OIps3CevtawlpOzEV5YKFfNxKiu6mA=; b=Dlfj+Fh9zUE8e2dFmjyXkmH2X2XJJH4C7671dHs80LYmpWeZu15pQZKw7RJBxFEdpg Q1XKQ3YyThfyYJCisQlPDH2UPgig9QVbHKxhciLQ7Ln5GoxFbEqsqqYo6eQBcvUqUini x/E8+aPY692lmJyrQ7EHIkRc8pk3D4fADlMTYdjUHWBxRmtbmnQmTQYvEj7enRwq0W5t MQDnGDxRFMIuZMn/wB5xl+yaLjd+CY5Do3kCc1jBoZB60lTUmPb9vSCfEoPv//Ca3KWL HbwHKcHx/zLY7WE81CQvU3y1wovRRIHmToMAZ71N/cuDqeaZnahuxv6LyV0fhGvqn67C 7KZg== X-Gm-Message-State: AAQBX9ebEsYxPhbtQEznzBC/vzk0CGnpifJtWiPwu5miiocTTmVsXhfH MZ/BwimQhg9pC7+k7rTo0DchfG4bizaiMR7waME= X-Received: by 2002:a05:600c:2148:b0:3ed:f9d3:f95c with SMTP id v8-20020a05600c214800b003edf9d3f95cmr5029210wml.19.1681136050870; Mon, 10 Apr 2023 07:14:10 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id s9-20020a7bc389000000b003ef64affec7sm13793060wmj.22.2023.04.10.07.14.10 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 10 Apr 2023 07:14:10 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 2/2] target/arm: Copy guarded bit in combine_cacheattrs Date: Mon, 10 Apr 2023 15:14:08 +0100 Message-Id: <20230410141408.3564269-3-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230410141408.3564269-1-peter.maydell@linaro.org> References: <20230410141408.3564269-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::32e; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x32e.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 From: Richard Henderson The guarded bit comes from the stage1 walk. Fixes: Coverity CID 1507929 Signed-off-by: Richard Henderson Reviewed-by: Peter Maydell Message-id: 20230407185149.3253946-3-richard.henderson@linaro.org Signed-off-by: Peter Maydell --- target/arm/ptw.c | 1 + 1 file changed, 1 insertion(+) diff --git a/target/arm/ptw.c b/target/arm/ptw.c index 58a6de09bc9..6d72950a795 100644 --- a/target/arm/ptw.c +++ b/target/arm/ptw.c @@ -2576,6 +2576,7 @@ static ARMCacheAttrs combine_cacheattrs(uint64_t hcr, assert(!s1.is_s2_format); ret.is_s2_format = false; + ret.guarded = s1.guarded; if (s1.attrs == 0xf0) { tagged = true;