From nobody Tue Feb 10 13:36:23 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=1661188092; cv=none; d=zohomail.com; s=zohoarc; b=KoLXEcvqL4ovJQUJJjIwlBbcQ4TdZnSENPEJA/yAhNPsYz6zg+5rrKl9JApOP1nV34AZrq/kwjc6q6mnnJUHQbclFqcdvjVv3XpbodDw13uT3xhcuceZc7PcpY/5zWq26P2NCoxj/Nqbbf8m27ecZApvKgY4fywqzCTApKtIfDo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1661188092; h=Content-Transfer-Encoding:Cc: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=PKVm0lHT4WCbN6cjWU3f5Rl68TusjrY3hk9BnIKlewk=; b=EroNkpKY/MzqOOWgqj5o8OdaG1DghyOJut8eWfzgf029XQ/XpHoF6hW2dS+pIAmAnrUjS4o32QuiPmt9fmvfMul3HX0kpF1S7I2/1nZNqx/lM3VySDX4FncYrra7r3xArHGEtiGYgF1JldglxdIbZmKIufiXUMiV0G+CByURM3s= 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 1661188092598247.2277330368678; Mon, 22 Aug 2022 10:08:12 -0700 (PDT) Received: from localhost ([::1]:34822 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oQAuJ-0006CU-8h for importer@patchew.org; Mon, 22 Aug 2022 13:08:11 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:55010) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oQ9Le-0008Go-6u for qemu-devel@nongnu.org; Mon, 22 Aug 2022 11:28:18 -0400 Received: from mail-pj1-x102c.google.com ([2607:f8b0:4864:20::102c]:44769) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oQ9LR-0000oF-PJ for qemu-devel@nongnu.org; Mon, 22 Aug 2022 11:28:17 -0400 Received: by mail-pj1-x102c.google.com with SMTP id r15-20020a17090a1bcf00b001fabf42a11cso11650170pjr.3 for ; Mon, 22 Aug 2022 08:28:05 -0700 (PDT) Received: from stoup.. ([71.212.157.236]) by smtp.gmail.com with ESMTPSA id q7-20020a17090311c700b0016bffc59718sm8665222plh.58.2022.08.22.08.28.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 Aug 2022 08:28:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc; bh=PKVm0lHT4WCbN6cjWU3f5Rl68TusjrY3hk9BnIKlewk=; b=kS1sHI1jh2LEgjdd1mGf8UbiFwKTmdlKzL4dKbF+ka0oCTo/hoSpNOM0MQCzOAbYLi 09QYUEDVR9inf7d3dmv6yLXBwXPFr5OTzSiPdPc/I3PnUG4QxY67NWDtVp6tBJrr5aIJ DbGKfEoYlZ9lSCRos81r0gbBg9ym4nr+RmNBasI2jZMzpBcRddx07mHHmj7N52jAP4AU lZB0uTTNkWZgeUsgea9lV6fcgALwIhZmrUj7W37SmTqVq2qBB2KXrtDboOZgmIzr4br4 H0hdvR6UnlCAEmLijPQQ+L6z7bK/aEvwnwGh6UbC15JVv78FL0FcKQRN+mx7v9o2JGfm jKKg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc; bh=PKVm0lHT4WCbN6cjWU3f5Rl68TusjrY3hk9BnIKlewk=; b=DKby5J6hI+KGJwmLdiZY4YehgVnNSQJ1orJdFExEQ4oVKKxx/kC5O+tp2WRXJcuAOn /gkrZR4Oe4wfnAAVcReTLdf7sJ/0UG+oybqKngRORgWpAX76WoGYc2i2UwZR1w+v6uiB AeYbBUAwDWPFd+fSPyFn5ZfP9c6/bPCt4+ajuJzosD0UdYZ4liXzkjVyvDeixtX1jo2H upbXmgTmQejxVszCaC2x7c5vYx8HNRdwqAqiwRobgHH+I44MYUrC+kOf+Ztzqx7pM5hN 2mcrK5cGgxXwLghrfMwTuAvLniXf9Li/BrAr1PKLo7mu4o9wTpDWuLl5CUxUVC3yxJcI zX4Q== X-Gm-Message-State: ACgBeo29gLLFapco7PZesNefPxKr4MgCX/+14nAS6cVNEUczywq8wx92 yvkZlcHWC1z9tcytIXWJB8urJgi7NUCVkw== X-Google-Smtp-Source: AA6agR5TKmu86TeCXrOrcfw8y6WMdjEBuWtfhJylxbCwi5r9DbryQTK1ePUSV4qXoilSmm/zNRVW6w== X-Received: by 2002:a17:90b:1c90:b0:1f8:42dd:9eba with SMTP id oo16-20020a17090b1c9000b001f842dd9ebamr30141374pjb.160.1661182084283; Mon, 22 Aug 2022 08:28:04 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org Subject: [PATCH v2 27/66] target/arm: Reorg regime_translation_disabled Date: Mon, 22 Aug 2022 08:27:02 -0700 Message-Id: <20220822152741.1617527-28-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220822152741.1617527-1-richard.henderson@linaro.org> References: <20220822152741.1617527-1-richard.henderson@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=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::102c; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x102c.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, T_SCC_BODY_TEXT_LINE=-0.01, T_SPF_TEMPERROR=0.01 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+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1661188094798100001 Content-Type: text/plain; charset="utf-8" Use a switch on mmu_idx for the a-profile indexes, instead of three different if's vs regime_el and arm_mmu_idx_is_stage1_of_2. Signed-off-by: Richard Henderson Reviewed-by: Peter Maydell --- target/arm/ptw.c | 32 +++++++++++++++++++++++++------- 1 file changed, 25 insertions(+), 7 deletions(-) diff --git a/target/arm/ptw.c b/target/arm/ptw.c index 2c13586396..ae9552f46f 100644 --- a/target/arm/ptw.c +++ b/target/arm/ptw.c @@ -148,21 +148,39 @@ static bool regime_translation_disabled(CPUARMState *= env, ARMMMUIdx mmu_idx, =20 hcr_el2 =3D arm_hcr_el2_eff(env); =20 - if (mmu_idx =3D=3D ARMMMUIdx_Stage2 || mmu_idx =3D=3D ARMMMUIdx_Stage2= _S) { + switch (mmu_idx) { + case ARMMMUIdx_Stage2: + case ARMMMUIdx_Stage2_S: /* HCR.DC means HCR.VM behaves as 1 */ return (hcr_el2 & (HCR_DC | HCR_VM)) =3D=3D 0; - } =20 - if (hcr_el2 & HCR_TGE) { + case ARMMMUIdx_E10_0: + case ARMMMUIdx_E10_1: + case ARMMMUIdx_E10_1_PAN: /* TGE means that NS EL0/1 act as if SCTLR_EL1.M is zero */ - if (!is_secure && regime_el(env, mmu_idx) =3D=3D 1) { + if (!is_secure && (hcr_el2 & HCR_TGE)) { return true; } - } + break; =20 - if ((hcr_el2 & HCR_DC) && arm_mmu_idx_is_stage1_of_2(mmu_idx)) { + case ARMMMUIdx_Stage1_E0: + case ARMMMUIdx_Stage1_E1: + case ARMMMUIdx_Stage1_E1_PAN: /* HCR.DC means SCTLR_EL1.M behaves as 0 */ - return true; + if (hcr_el2 & HCR_DC) { + return true; + } + break; + + case ARMMMUIdx_E20_0: + case ARMMMUIdx_E20_2: + case ARMMMUIdx_E20_2_PAN: + case ARMMMUIdx_E2: + case ARMMMUIdx_E3: + break; + + default: + g_assert_not_reached(); } =20 return (regime_sctlr(env, mmu_idx) & SCTLR_M) =3D=3D 0; --=20 2.34.1