From patchwork Sat Feb 8 12:58:15 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 183233 Delivered-To: patch@linaro.org Received: by 2002:a92:1f12:0:0:0:0:0 with SMTP id i18csp1952587ile; Sat, 8 Feb 2020 05:07:29 -0800 (PST) X-Google-Smtp-Source: APXvYqxVkCBnJhABB8hxlJ/VxsPsvhHI3Gq1QX86wuEmWhzq1+ksnXM9oW7BlZcjcOriGxNjGoDg X-Received: by 2002:a0c:c542:: with SMTP id y2mr2682500qvi.225.1581167249357; Sat, 08 Feb 2020 05:07:29 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1581167249; cv=none; d=google.com; s=arc-20160816; b=FMAgZ+M0ML/ARR2mQ8R/ZgmA3DgtRrDndr9+ndkwI1OyAhtpUD70SQqwGLxwJSGfje R8qX1Jq5CbHeRacAUnIzeDsiN53E8Rm+KC01Z9dQqzy1+gPoXZ5SD24YOH6qGQyxXw4w vJ7BsV+cHOoEGvqRpIPILUaTqBSIQZ5IrBvfO8bcICm9HxJMTj+P3W/rlEUPMdszn+Zx IJsjSYMaW4jQB9HpD1ix8QYJyhT8RM8ytm5GsvcZ/S/mcq6pBFHDoo7eurKXWgZSuGFb 4GgoMyZ9/nGoVnAKBBHI15Twi9mZgWbd8tljPjE10pBxZDQXgw2H58ZqvsGaAggPK72B 08Jg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc: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=6QhxeX6zK49ooY7+NT0s0wBH571TqTaLG1uXkEqzD/o=; b=xonykVhcBNHQQCAJEu+dGZkjvHd2Hr+RxCjXRb8ztBMcZm+9nmXaT4YOk8tIsp208B XPg5GRVyw5q2kuQgUA8xZVcabCAStt1JCb5ww4wM/38e/b0toVDwAyz5+Y07JXl/c4wy sga1FHoTIBpqaVIbA5a6ew2ohz0+N50+dgyPJcp7OQM9F5JuyVQr2arlW9WdNZDkDNTn /xhnnyS+YfYIGPKKuovcqN9v2BwuEhCGzMP5cEKPYl9MuEy3KOrkO7mV0KsvqVWZaFkU ycteGlh9AtiKy5AaVGqXvjBPRnq6fplchlkunZCC+9KBV2wLml8/IgTlXvi6MudWFVkn phtw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Hq2l7CnX; 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 t37si1473252qth.239.2020.02.08.05.07.29 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sat, 08 Feb 2020 05:07:29 -0800 (PST) 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=Hq2l7CnX; 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]:41210 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j0PpY-0001Ye-Tp for patch@linaro.org; Sat, 08 Feb 2020 08:07:28 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:41565) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j0Ph1-00011R-6m for qemu-devel@nongnu.org; Sat, 08 Feb 2020 07:58:40 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1j0Ph0-0005Gq-6Z for qemu-devel@nongnu.org; Sat, 08 Feb 2020 07:58:39 -0500 Received: from mail-wr1-x441.google.com ([2a00:1450:4864:20::441]:33984) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1j0Pgz-0005FV-Vz for qemu-devel@nongnu.org; Sat, 08 Feb 2020 07:58:38 -0500 Received: by mail-wr1-x441.google.com with SMTP id t2so2072875wrr.1 for ; Sat, 08 Feb 2020 04:58:37 -0800 (PST) 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=6QhxeX6zK49ooY7+NT0s0wBH571TqTaLG1uXkEqzD/o=; b=Hq2l7CnX356ZC7G1PTAnahBVSZo3OvL/OYoSzyHE/WdonV+n1MvYaqFAaiy2XWAzmM thh1CJrEgwoAQdewaE1jheTaJgVhz2Y/7Y7X2DdT+bzmG2RBX4A75UFr7tR6hLy0wkGg 3yOUmLd7bxDrPk2QU6y7UlVh95Q0kRvY/L+lngPLZybdQ5peV+tWMlr/Ic4UZ5+veTwA sLYrH1RRAv/Wcj/yAcrg0xwESGkEOd4EIvc0t/yxqBRXNuuG0NH/S1XnUlggY8csy7YN fAcENAE5wHwkYFKD6ygVAEmwvEjyZfrbUJCMKUVQcqFQIC0EOnQPthUaMpSslaSfvyZt +mfw== 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=6QhxeX6zK49ooY7+NT0s0wBH571TqTaLG1uXkEqzD/o=; b=tZI/TbX4XPcJ+oX+aLgt1WEVoNM90n2WraZq4Q3y26qRmJf6jmN8ZWTe8uA/o8rJ2U arFEQubO4cZy/YtYMyYiJNZkGrXmy8iWjTLPiZW6cvBoTfLsYNhj/YhTkvZPV1vxSNep mQN1iHEb5Dng1y42lJ63HPUjSqMIF0gNO3ROeWjvGTugqiA1otiLRnVvQRc2Ga8xqzqY 2uA501KytPuWh8pcGEOH93HqT+ELneVBG7ZGk6P8bljzj1Qy/7KQM6RXT2mxb9k6OlBN 4faqQKSyn9uDIuXT5189V34QnAcUVQaO+8UtGrLO8+O1aPdkSQ2SU6dXgRpLZkEvGO3u GlCw== X-Gm-Message-State: APjAAAVUM8J4VEWjrB29JqQ/AqVzY43SzCVNxvVS0NNKaGnaIRNcaMk3 CfbF66TEIFk/V1OizXxB0JGN9QQ6BPezeA== X-Received: by 2002:a05:6000:50:: with SMTP id k16mr5105725wrx.145.1581166716838; Sat, 08 Feb 2020 04:58:36 -0800 (PST) Received: from localhost.localdomain ([82.3.55.76]) by smtp.gmail.com with ESMTPSA id p5sm7490534wrt.79.2020.02.08.04.58.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 08 Feb 2020 04:58:36 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v4 19/20] target/arm: Implement UAO semantics Date: Sat, 8 Feb 2020 12:58:15 +0000 Message-Id: <20200208125816.14954-20-richard.henderson@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200208125816.14954-1-richard.henderson@linaro.org> References: <20200208125816.14954-1-richard.henderson@linaro.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::441 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, alex.bennee@linaro.org Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" We need only override the current condition under which TBFLAG_A64.UNPRIV is set. Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson --- target/arm/helper.c | 41 +++++++++++++++++++++-------------------- 1 file changed, 21 insertions(+), 20 deletions(-) -- 2.20.1 diff --git a/target/arm/helper.c b/target/arm/helper.c index 11a5f0be52..366dbcf460 100644 --- a/target/arm/helper.c +++ b/target/arm/helper.c @@ -12198,28 +12198,29 @@ static uint32_t rebuild_hflags_a64(CPUARMState *env, int el, int fp_el, } /* Compute the condition for using AccType_UNPRIV for LDTR et al. */ - /* TODO: ARMv8.2-UAO */ - switch (mmu_idx) { - case ARMMMUIdx_E10_1: - case ARMMMUIdx_E10_1_PAN: - case ARMMMUIdx_SE10_1: - case ARMMMUIdx_SE10_1_PAN: - /* TODO: ARMv8.3-NV */ - flags = FIELD_DP32(flags, TBFLAG_A64, UNPRIV, 1); - break; - case ARMMMUIdx_E20_2: - case ARMMMUIdx_E20_2_PAN: - /* TODO: ARMv8.4-SecEL2 */ - /* - * Note that E20_2 is gated by HCR_EL2.E2H == 1, but E20_0 is - * gated by HCR_EL2. == '11', and so is LDTR. - */ - if (env->cp15.hcr_el2 & HCR_TGE) { + if (!(env->pstate & PSTATE_UAO)) { + switch (mmu_idx) { + case ARMMMUIdx_E10_1: + case ARMMMUIdx_E10_1_PAN: + case ARMMMUIdx_SE10_1: + case ARMMMUIdx_SE10_1_PAN: + /* TODO: ARMv8.3-NV */ flags = FIELD_DP32(flags, TBFLAG_A64, UNPRIV, 1); + break; + case ARMMMUIdx_E20_2: + case ARMMMUIdx_E20_2_PAN: + /* TODO: ARMv8.4-SecEL2 */ + /* + * Note that EL20_2 is gated by HCR_EL2.E2H == 1, but EL20_0 is + * gated by HCR_EL2. == '11', and so is LDTR. + */ + if (env->cp15.hcr_el2 & HCR_TGE) { + flags = FIELD_DP32(flags, TBFLAG_A64, UNPRIV, 1); + } + break; + default: + break; } - break; - default: - break; } return rebuild_hflags_common(env, fp_el, mmu_idx, flags);