From patchwork Tue Dec 3 23:42:43 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 180779 Delivered-To: patch@linaro.org Received: by 2002:a92:3001:0:0:0:0:0 with SMTP id x1csp2214390ile; Tue, 3 Dec 2019 15:47:43 -0800 (PST) X-Google-Smtp-Source: APXvYqw8GVbxTIoaVmOlaUiAotdW2uMiasYHuH7hsXR2x4K3L3Powf+7qmAd8yq8n1QCVBHSapdw X-Received: by 2002:a17:906:e94:: with SMTP id p20mr1699052ejf.57.1575416863446; Tue, 03 Dec 2019 15:47:43 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1575416863; cv=none; d=google.com; s=arc-20160816; b=id/U89iYqRUj8fib0d6H9/mp6lEatsxuUlDwatDyoWq+wPji9edi3C5LM/ZAq0C/3y BlYZjdW0Mppnz83jjb/HKf64ZkF809kAjFsB6+dzwRbpUL6WO6h6lE5wJmtK/1KoXTA/ pWMSU4WwkMpxPtARyumfLtVNWnebAx8LXVi9gkiviBdZ8jZXLbz+e4K6ahp+K5NZ8Am9 ILNkYiw1iO437clQaHQt/ipi4Ev1e8i9qOT4eCoibBoh7TvqhUWqn5AEsGYxRZ7O+dak e3ugoPfH7FPDdaL/9yx7os+ygOd1qO2EeGPEJnBqQMu5yFA+P68ly5kzFa6IJ2k0Du9h HPXw== 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:references:in-reply-to :message-id:date:subject:to:from:dkim-signature; bh=lxpFC0QAcEEE37xlJz3y9LIaFzl9qGfUGofGgmNc6Hw=; b=nYsZUTfOSpHESnvsWEVZ0X5Osoh6cWpn6xBjoQ4emmqSmLc3Reehl2VFISXXD42aBm 40w6pr8Tm6FugsdGFq3yLIxWuBf+lM27VD7A2jn5Q4cbBTNOcXP7EIUNK1BHLpGzwF8r FwFrpz3XuNBEe8hN3Pw2bEhTlfh7yzOiIYCq8FcJJE6P9JiSB1+s9/O8k8+B92Tnw+bK 9OqlS547i8jBxyEm4f2yGhOSQLdhLsgUAMhXafsJoAZ+O11AkMHWMi9zqTKT4zoYna5F EZsVqpffotz9yVsJFt1PaqMrDx1EA5FNwfHjsoBcLI4Mq9POzpwLT1tsG5NazCMWswVH 5rkA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=o3tuX1HU; 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 y15si3535216edw.291.2019.12.03.15.47.42 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 03 Dec 2019 15:47:43 -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=o3tuX1HU; 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]:60620 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1icHtN-0007Oh-5I for patch@linaro.org; Tue, 03 Dec 2019 18:47:41 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:38741) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1icHoj-00048p-Sx for qemu-devel@nongnu.org; Tue, 03 Dec 2019 18:42:55 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1icHoi-0006WM-4h for qemu-devel@nongnu.org; Tue, 03 Dec 2019 18:42:53 -0500 Received: from mail-pf1-x442.google.com ([2607:f8b0:4864:20::442]:45916) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1icHoh-0006TX-T0 for qemu-devel@nongnu.org; Tue, 03 Dec 2019 18:42:52 -0500 Received: by mail-pf1-x442.google.com with SMTP id 2so2612097pfg.12 for ; Tue, 03 Dec 2019 15:42:51 -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; bh=lxpFC0QAcEEE37xlJz3y9LIaFzl9qGfUGofGgmNc6Hw=; b=o3tuX1HUoAvDNtmt+1KGIV75e1nXDZ5lRpQcyRQTnZA9WxuCk3jfTLG/KkmWuY5ddu OBn+p/iEQxamAbCiPJAaUy0F+ddfsz4F35QiJZMG9vr7hUc7u4kcBIXhgESFLRpE+ssB kye2A5nKd6ppqaEuHaCC3HzatD6VlWsaazR9f0uAxzXb031ytjhAvUkh3XVGlXfbUlAh bSxc9u78/8LawgVqIyYYIaTc/C/KG3zbBOvu0PUukS5Nknr3C098+BaXwhkxpy8nBYSS QCJUpbQfaOMoq0nQy73LxZID9BTf+YnWiAhbmB44QtPzgVSMsasLNoKaQzDukV2kIo73 D6qg== 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; bh=lxpFC0QAcEEE37xlJz3y9LIaFzl9qGfUGofGgmNc6Hw=; b=KOOgP/f5sERz/tms30Bpvtl8mixslfiogvGfNo5VPJ+JEM2N8QgpYNVxSWIUBEok2k gpZP45KeiuJ3gddQz6yKvv3mZvUxnjg08y3QoXzkI5XHS0wZLXiQ2GDiKXv7ka88gInN +8X0IMEIzmzOqGmML+1yvEJabM/HdjjqNn54vyH29EwpJUZDKESf28qmaJW2f3wM8RR0 QljQ9RC/zGtDTwVsxmq+rDFq9RkzgcoUXnsuxx5/ydx5mcymIXCulqYukmiP7LxWUwEh fUjhZRgMqlIXcktRviVAZcigqS7IP0b2Vy8TEZrXDb48X21HbCg+WdJZcnyHRF2MwDmv kagg== X-Gm-Message-State: APjAAAWDJpcLKaoEi2RvXYVeiThUY8vvF9FbHdwBl3k6Dx3xWWWrBkaR xgW0GIntrEcOigYrDQutsnVktl7hdl0= X-Received: by 2002:a65:6916:: with SMTP id s22mr302392pgq.244.1575416570450; Tue, 03 Dec 2019 15:42:50 -0800 (PST) Received: from localhost.localdomain (97-113-7-119.tukw.qwest.net. [97.113.7.119]) by smtp.gmail.com with ESMTPSA id k5sm4128256pju.14.2019.12.03.15.42.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 03 Dec 2019 15:42:49 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH 3/4] target/arm: Implement UAO semantics Date: Tue, 3 Dec 2019 15:42:43 -0800 Message-Id: <20191203234244.9124-4-richard.henderson@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191203234244.9124-1-richard.henderson@linaro.org> References: <20191203234244.9124-1-richard.henderson@linaro.org> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::442 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 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. Signed-off-by: Richard Henderson --- target/arm/helper.c | 41 +++++++++++++++++++++-------------------- 1 file changed, 21 insertions(+), 20 deletions(-) -- 2.17.1 Reviewed-by: Peter Maydell diff --git a/target/arm/helper.c b/target/arm/helper.c index 8941a6c10f..6d7a8349b5 100644 --- a/target/arm/helper.c +++ b/target/arm/helper.c @@ -12050,28 +12050,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_EL10_1: - case ARMMMUIdx_EL10_1_PAN: - case ARMMMUIdx_SE1: - case ARMMMUIdx_SE1_PAN: - /* TODO: ARMv8.3-NV */ - flags = FIELD_DP32(flags, TBFLAG_A64, UNPRIV, 1); - break; - case ARMMMUIdx_EL20_2: - case ARMMMUIdx_EL20_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) { + if (!(env->pstate & PSTATE_UAO)) { + switch (mmu_idx) { + case ARMMMUIdx_EL10_1: + case ARMMMUIdx_EL10_1_PAN: + case ARMMMUIdx_SE1: + case ARMMMUIdx_SE1_PAN: + /* TODO: ARMv8.3-NV */ flags = FIELD_DP32(flags, TBFLAG_A64, UNPRIV, 1); + break; + case ARMMMUIdx_EL20_2: + case ARMMMUIdx_EL20_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);