From patchwork Thu Oct 8 16:21:53 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 303422 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.5 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 39064C433E7 for ; Thu, 8 Oct 2020 16:25:59 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 9AECF21D7D for ; Thu, 8 Oct 2020 16:25:58 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="Wye5DEjH" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 9AECF21D7D Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:57116 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kQYjt-0006ic-JS for qemu-devel@archiver.kernel.org; Thu, 08 Oct 2020 12:25:57 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:37326) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kQYgL-0002Wk-Pv for qemu-devel@nongnu.org; Thu, 08 Oct 2020 12:22:17 -0400 Received: from mail-ot1-x341.google.com ([2607:f8b0:4864:20::341]:41217) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kQYgC-0007e3-W5 for qemu-devel@nongnu.org; Thu, 08 Oct 2020 12:22:17 -0400 Received: by mail-ot1-x341.google.com with SMTP id q21so5999940ota.8 for ; Thu, 08 Oct 2020 09:22:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=siDQkbvJh9Bvpko0a5lV9YTIkAumZtHw2Xcw/++VZdY=; b=Wye5DEjHWxQHtc/xyy4JqjU0Jj/GF+1CrQloR02V1GTG4c/t8gNQqdXxBJwSVgW3Nq 9Jubj0jphT3qdYuPh2t0kJA0SeRHDZMHqkxd8Y0PZN33xV+FIdJ8j3kYq0H0+gZEE0TF cm2AI5VBuACe1OWLCqBLYu8YR3FKYTEtSIyCDpO45klC+gB9fhM4Sg3gnIlpUmSuBdQx AM2LKgjyCuIpCU9ca8vDQvWrZaTehsZOMBvRO5lVuGrIY/B7cx4rtWe1mdPB122a7dGf i9lyREBIJfUy4EfTRrC6zggXbW9ybd5UWSBmOGti1/GduE1FQz9Gcdmc8voz1A9ZZ+TO 0Cpg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=siDQkbvJh9Bvpko0a5lV9YTIkAumZtHw2Xcw/++VZdY=; b=DmhmXmeht5Oif8Ok/WHuI0/9D5KrMQSvYHs65F5d13QaCY6kypRBsc3OGM1ENQHJcv krJBqCJjF63qU+YYJ0zy+qvn7hdhoZAUctJw9p40+sdVTN/BPeRviTWNsfXVbqVf1mX4 HPZO93Arvi3tSBdtbn9TRHc3cag8QTc5101myyizGG6eWE/3LpuUSOPV3Cxdtw/+QTKU rx2uPrm75BryvbO60xRIeXppdPlYhqhA4sixl5T6B2o+Ybbgfs4dOO98XOqoHmlPEUUQ zdMp9+3kHAVRLhs+m3D3qEd5QlsbFG8NT/Zc4ZU5y/rktv7dt48tloUl/eZnkNI4t0JV cUGQ== X-Gm-Message-State: AOAM533CFhm2VJAOPbqY+eq9zLULOER+1WaUS3EwklBqSDy1m8iPux5s tkBtVpJUNc1u7t81ruU27GJ4ZnynaAJmdrZU X-Google-Smtp-Source: ABdhPJwaMIc4XJkw5ujvlIY4ORtvV1HrNmIFf/xfNfOQNNvrovZjYJYQ17iVQMaRJc41wQKnZeT6rg== X-Received: by 2002:a9d:2a83:: with SMTP id e3mr5346596otb.237.1602174119678; Thu, 08 Oct 2020 09:21:59 -0700 (PDT) Received: from localhost.localdomain (168.189-204-159.bestelclientes.com.mx. [189.204.159.168]) by smtp.gmail.com with ESMTPSA id l138sm5076218oih.32.2020.10.08.09.21.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 08 Oct 2020 09:21:58 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH 1/3] target/arm: Remove redundant mmu_idx lookup Date: Thu, 8 Oct 2020 11:21:53 -0500 Message-Id: <20201008162155.161886-2-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20201008162155.161886-1-richard.henderson@linaro.org> References: <20201008162155.161886-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::341; envelope-from=richard.henderson@linaro.org; helo=mail-ot1-x341.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. 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.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: peter.maydell@linaro.org, qemu-arm@nongnu.org, vincenzo.frascino@arm.com Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" We already have the full ARMMMUIdx as computed from the function parameter. For the purpose of regime_has_2_ranges, we can ignore any difference between AccType_Normal and AccType_Unpriv, which would be the only difference between the passed mmu_idx and arm_mmu_idx_el. Signed-off-by: Richard Henderson Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Vincenzo Frascino Tested-by: Vincenzo Frascino --- target/arm/mte_helper.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/target/arm/mte_helper.c b/target/arm/mte_helper.c index 5615c6706c..734cc5ca67 100644 --- a/target/arm/mte_helper.c +++ b/target/arm/mte_helper.c @@ -563,8 +563,7 @@ static void mte_check_fail(CPUARMState *env, uint32_t desc, case 2: /* Tag check fail causes asynchronous flag set. */ - mmu_idx = arm_mmu_idx_el(env, el); - if (regime_has_2_ranges(mmu_idx)) { + if (regime_has_2_ranges(arm_mmu_idx)) { select = extract64(dirty_ptr, 55, 1); } else { select = 0; From patchwork Thu Oct 8 16:21:54 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 303423 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.5 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id A8776C433DF for ; Thu, 8 Oct 2020 16:23:41 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 1BFAF21D7D for ; Thu, 8 Oct 2020 16:23:40 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="JYrxlRye" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 1BFAF21D7D Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:50490 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kQYhf-0003oQ-SK for qemu-devel@archiver.kernel.org; Thu, 08 Oct 2020 12:23:39 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:37322) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kQYgL-0002V1-44 for qemu-devel@nongnu.org; Thu, 08 Oct 2020 12:22:17 -0400 Received: from mail-oi1-x243.google.com ([2607:f8b0:4864:20::243]:36049) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kQYgD-0007eD-8F for qemu-devel@nongnu.org; Thu, 08 Oct 2020 12:22:13 -0400 Received: by mail-oi1-x243.google.com with SMTP id u17so6901508oie.3 for ; Thu, 08 Oct 2020 09:22:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=Y/sfKn+XuwGfbi+75v+dyxssWOv3tQu5rJvj1rCENB4=; b=JYrxlRyeslbCAV+j4xnxnv+kYYMbx2eoa7afZh9689kb5n/YgR7Te2x75S1tLra7Zj OrrGfdIUSX33vdwyIGmCKX8tCG+5+IYFapYtKGvc9iQUCsuaKxh0B6Gnu22/fWe0Ox0l 1R+Ko+c+Tu3P2LNYoeCuuoCQmfALkAPdOeGUmy3xTGgFrfEiSIYPb/0ZmS3aLXXlSmbU h2gv063OLYqCL7bk3FIx5KEV/ZjZEe55eCJqd3dg8DiQ9E8bGdZNb8EOn0ijZJeEhZqP TaCpeCU31oN1gBcYGfGN42Lg8Ntfs4MFr/Urpc0xzH5YeTJEnCaqW4xU7t68hBEp0JCA xMZw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Y/sfKn+XuwGfbi+75v+dyxssWOv3tQu5rJvj1rCENB4=; b=uULweEjDoNGmR6WBffn0R/iGxVoePA8IauXJ+dUVLmBSDaW+uLObsteGb2wOvJzOvC b1SmUlKaDaYpn2gdSCt1PbgZPODZker3sO2a+NXtB9huTn9EKPJT9frZ7BAUZltVF6FH GD53cDdjgjUIF+9uglx5zQqNxbkyrzo+tfFSOCsBYBXCS9uVl5Zrh19KxUfNzrqi9jq/ uHhD2ia03D0XlpmLNd1ktjqYm0y+XKyp5OjNEetKuDsE1WMw8L9dfDlMOkZUN8D6e86v /SaM+AqyItQOvK4O7sVji3ZVG4hv2t9xWgl0vvSnMk0w1rBwipy36O4lLrC86YKgCs0U hX/w== X-Gm-Message-State: AOAM533Uw4rHXyYX2e4K1nQk9dnETzpuqn7YthyJLGKMyRrA6djlEMQ9 ZAYfArEYq9PFo5J5IM8bTv2ZxMfM/RjE0f6b X-Google-Smtp-Source: ABdhPJwpjuud2h5UvNkZqwE8En7D3o2lJg7FHFsGbAkvSZnvL7JXb2nLEBdakmsq8M6dN5m/gfOsdw== X-Received: by 2002:aca:1b0b:: with SMTP id b11mr1314457oib.114.1602174121611; Thu, 08 Oct 2020 09:22:01 -0700 (PDT) Received: from localhost.localdomain (168.189-204-159.bestelclientes.com.mx. [189.204.159.168]) by smtp.gmail.com with ESMTPSA id l138sm5076218oih.32.2020.10.08.09.21.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 08 Oct 2020 09:22:00 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH 2/3] target/arm: Fix reported EL for mte_check_fail Date: Thu, 8 Oct 2020 11:21:54 -0500 Message-Id: <20201008162155.161886-3-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20201008162155.161886-1-richard.henderson@linaro.org> References: <20201008162155.161886-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::243; envelope-from=richard.henderson@linaro.org; helo=mail-oi1-x243.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. 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.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: peter.maydell@linaro.org, qemu-arm@nongnu.org, vincenzo.frascino@arm.com Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" The reporting in AArch64.TagCheckFail only depends on PSTATE.EL, and not the AccType of the operation. There are two guest visible problems that affect LDTR and STTR because of this: (1) Selecting TCF0 vs TCF1 to decide on reporting, (2) Report "data abort same el" not "data abort lower el". Reported-by: Vincenzo Frascino Signed-off-by: Richard Henderson Reviewed-by: Vincenzo Frascino Tested-by: Vincenzo Frascino --- target/arm/mte_helper.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/target/arm/mte_helper.c b/target/arm/mte_helper.c index 734cc5ca67..153bd1e9df 100644 --- a/target/arm/mte_helper.c +++ b/target/arm/mte_helper.c @@ -525,14 +525,10 @@ static void mte_check_fail(CPUARMState *env, uint32_t desc, reg_el = regime_el(env, arm_mmu_idx); sctlr = env->cp15.sctlr_el[reg_el]; - switch (arm_mmu_idx) { - case ARMMMUIdx_E10_0: - case ARMMMUIdx_E20_0: - el = 0; + el = arm_current_el(env); + if (el == 0) { tcf = extract64(sctlr, 38, 2); - break; - default: - el = reg_el; + } else { tcf = extract64(sctlr, 40, 2); } From patchwork Thu Oct 8 16:21:55 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 271812 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.5 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9E3E1C433DF for ; Thu, 8 Oct 2020 16:23:55 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 13F5821D7D for ; Thu, 8 Oct 2020 16:23:55 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="rwtKfjCK" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 13F5821D7D Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:51230 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kQYhu-00047m-2o for qemu-devel@archiver.kernel.org; Thu, 08 Oct 2020 12:23:54 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:37318) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kQYgL-0002Uv-2B for qemu-devel@nongnu.org; Thu, 08 Oct 2020 12:22:17 -0400 Received: from mail-oi1-x244.google.com ([2607:f8b0:4864:20::244]:33248) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kQYgC-0007eS-VQ for qemu-devel@nongnu.org; Thu, 08 Oct 2020 12:22:12 -0400 Received: by mail-oi1-x244.google.com with SMTP id m7so6921509oie.0 for ; Thu, 08 Oct 2020 09:22:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=QyvlAwVml9YHe9kwFtSW/ZPwkyIj+P8DM/oa1e0Xc6w=; b=rwtKfjCK8hje9Jvfy+6vADhrgbNjBCbTVp2UQ4VX5jGFO0aLke+PVfEOoZvLcvEeFr D8shsBeyQMPc/nmwiD5jv/2iU83PioDcTHNPrgGRmMcvxPaqsZOG4bAv3SV6nAD/fLXl 2uOV+mMJ8o93WZwQsOwRC8GdPC0o2nFO4fC4X+Fe1x6A1KfJ3Wxr/SJSgqBNjAiLUP10 FUyriBOzSwUi1k9QkPSq2SsR44oi+JpmXGbvz/UEsCwfYWARtbpsSTlIQUgtoP1h5H0H zRXzWA90Z4XINVKxhxpkzeH90+iygLpoUuTRmOXviOuVUdOAPylm2Z11pKkDFdVnUGKl 6L/A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=QyvlAwVml9YHe9kwFtSW/ZPwkyIj+P8DM/oa1e0Xc6w=; b=ucj8hm05D/jCzavwzCmzCRYp0jSPe3B8tHLhuz2p09+9kx13YVCbFDxOwZPvFvsklh 0KradD43Xf1aszhFVM0jbZZnQddxelRXepPF4djT4pCB25KAO/YT0/JKmeNViQ3dzn8v d+k37MfDND1VshTlu+nhu9wleH5prw8/0byXKBBuZ0ioSl65P+PawtLBDnlqtSAbqUOa djfnL0DTHAI1LGw6ZuC6tb6TNTOYf9nEegDOQuzGVdmuk2ulLv+WJrdk9FwQq3TK+RBp HaWfdjIulpXzHMyPGvaPWVfIqTwe+0V7rDvqgvB5xzdsOiNTDCP42IS8x+9i0c8AwcFW gUCQ== X-Gm-Message-State: AOAM533vdvhcctN+Od5m/VD0h/0+Ma4VshFCujdbimoBMfAbaUe38lG+ d2guSUtkG52Jex3UFPNr8DzVHZq4gAprWRzO X-Google-Smtp-Source: ABdhPJzQhkhsRl3XSjyTXcGrDBvYwzxtMZRN+TGpTJnBcfXLl8XaPUKM4ojnrMpLcnxYwp4ojgwcyg== X-Received: by 2002:aca:38c1:: with SMTP id f184mr5219577oia.145.1602174123111; Thu, 08 Oct 2020 09:22:03 -0700 (PDT) Received: from localhost.localdomain (168.189-204-159.bestelclientes.com.mx. [189.204.159.168]) by smtp.gmail.com with ESMTPSA id l138sm5076218oih.32.2020.10.08.09.22.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 08 Oct 2020 09:22:02 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH 3/3] target/arm: Ignore HCR_EL2.ATA when {E2H,TGE} != 11 Date: Thu, 8 Oct 2020 11:21:55 -0500 Message-Id: <20201008162155.161886-4-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20201008162155.161886-1-richard.henderson@linaro.org> References: <20201008162155.161886-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::244; envelope-from=richard.henderson@linaro.org; helo=mail-oi1-x244.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. 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.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: peter.maydell@linaro.org, qemu-arm@nongnu.org, vincenzo.frascino@arm.com Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" Unlike many other bits in HCR_EL2, the description for this bit does not contain the phrase "if ... this field behaves as 0 for all purposes other than", so do not squash the bit in arm_hcr_el2_eff. Instead, replicate the E2H+TGE test in the two places that require it. Reported-by: Vincenzo Frascino Signed-off-by: Richard Henderson Reviewed-by: Vincenzo Frascino Tested-by: Vincenzo Frascino --- target/arm/internals.h | 9 +++++---- target/arm/helper.c | 9 +++++---- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/target/arm/internals.h b/target/arm/internals.h index ae99725d2b..5460678756 100644 --- a/target/arm/internals.h +++ b/target/arm/internals.h @@ -1252,10 +1252,11 @@ static inline bool allocation_tag_access_enabled(CPUARMState *env, int el, && !(env->cp15.scr_el3 & SCR_ATA)) { return false; } - if (el < 2 - && arm_feature(env, ARM_FEATURE_EL2) - && !(arm_hcr_el2_eff(env) & HCR_ATA)) { - return false; + if (el < 2 && arm_feature(env, ARM_FEATURE_EL2)) { + uint64_t hcr = arm_hcr_el2_eff(env); + if (!(hcr & HCR_ATA) && (!(hcr & HCR_E2H) || !(hcr & HCR_TGE))) { + return false; + } } sctlr &= (el == 0 ? SCTLR_ATA0 : SCTLR_ATA); return sctlr != 0; diff --git a/target/arm/helper.c b/target/arm/helper.c index cd0779ff5f..0620572e44 100644 --- a/target/arm/helper.c +++ b/target/arm/helper.c @@ -6874,10 +6874,11 @@ static CPAccessResult access_mte(CPUARMState *env, const ARMCPRegInfo *ri, { int el = arm_current_el(env); - if (el < 2 && - arm_feature(env, ARM_FEATURE_EL2) && - !(arm_hcr_el2_eff(env) & HCR_ATA)) { - return CP_ACCESS_TRAP_EL2; + if (el < 2 && arm_feature(env, ARM_FEATURE_EL2)) { + uint64_t hcr = arm_hcr_el2_eff(env); + if (!(hcr & HCR_ATA) && (!(hcr & HCR_E2H) || !(hcr & HCR_TGE))) { + return CP_ACCESS_TRAP_EL2; + } } if (el < 3 && arm_feature(env, ARM_FEATURE_EL3) &&