From patchwork Sat Feb 8 12:58:08 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 183231 Delivered-To: patch@linaro.org Received: by 2002:a92:1f12:0:0:0:0:0 with SMTP id i18csp1950788ile; Sat, 8 Feb 2020 05:05:40 -0800 (PST) X-Google-Smtp-Source: APXvYqwKgvNrrS3arYm4T3O1gaOYj4TRJLUSHAsmWUtbz6PmRufQpAXGlUHZpy2Y4JLS1nJyjyjT X-Received: by 2002:aed:3b14:: with SMTP id p20mr2814404qte.176.1581167140005; Sat, 08 Feb 2020 05:05:40 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1581167140; cv=none; d=google.com; s=arc-20160816; b=IpnlZwxZMEtFqOX8BaiqXp+/O67rbJ+s2yYAwPIC68o9t1euMrAkquv/VkIlvCbuY3 qNzR5yC2LkJ3AtJRXI+g7oqb9JGA6TxUIjQmfIfPNIzn/+cD8SaoNAj3C33RMlc9Yddt 10PzIKWzsSuM+SqFlSzWKxwj11lb2QGOxUpWURCxuIBL/HC3KQ8vBWvgibcJodqG77M9 7NkiGMd4LNYpNgzmMYqIXzN3VBKnAH6U/xdIfsjfe2Ww/y01gONGfiJgynXWu0kwTLrT f4a3sY8dCFrJLJO/bkNpfGVBsUEiOOhzHVinVhKgsMSogP6hVd9H8Wap/BT19Yj0p6Pa WRnA== 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=8y0KNL/AFSS9j7gNmLDE5wRNKMVyyA8vBmve9VVvdXg=; b=QhMyv2vWfNQgsrUyG6IX0I6lTjGYjCFewrR5Fgol7R25Vtdcd9N/iF61Vwri3pIGFN lMvXoaspyV0LOkUO3V4dwY0aUVOLHnIiPmg7dOtf9Cq++jxe1aiFE5/zTnsBh68iscm0 T6duOCMnpiW+0iTxCx33b9rZiElq64Jnsub4cABmgj2dSnBHQftXyGAx3p6aWnqwgPHS BmHVnLL2GDcQFQEOlf1zfeKtIkQog02em6xxrD5oyHhxGzuoDgC57JwLjUDo0mRv43qa N+Y7rQh2zxiKm+nXd3Hdhh0sC1xqTv8Nujfvg08xGjH4dy5pJuAvV9jKt4DeqA1zSFxu uEwg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="wW4/AfO4"; 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 i11si1338516qvt.120.2020.02.08.05.05.39 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sat, 08 Feb 2020 05:05:39 -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="wW4/AfO4"; 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]:41158 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j0Pnn-0006QI-8T for patch@linaro.org; Sat, 08 Feb 2020 08:05:39 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:41468) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j0Pgt-0000gh-RU for qemu-devel@nongnu.org; Sat, 08 Feb 2020 07:58:32 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1j0Pgs-0004zd-UE for qemu-devel@nongnu.org; Sat, 08 Feb 2020 07:58:31 -0500 Received: from mail-wm1-x343.google.com ([2a00:1450:4864:20::343]:40479) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1j0Pgs-0004wH-Nr for qemu-devel@nongnu.org; Sat, 08 Feb 2020 07:58:30 -0500 Received: by mail-wm1-x343.google.com with SMTP id t14so5596560wmi.5 for ; Sat, 08 Feb 2020 04:58:30 -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=8y0KNL/AFSS9j7gNmLDE5wRNKMVyyA8vBmve9VVvdXg=; b=wW4/AfO4fxkE82GLltPce2B5qr9vNeQ1eorHc95qNkTgs1YiTdlIrWpSD+u4KSXeSM AYzO6Wx3uYsFcgBiv05o3beK1GlbD/FiWe9Z0zyLAS5quQStgUk40nuhEIMEVfZisZzl xMcY/6jxMdvmHhgYczlM8hN3UfQB9owqmLoW5UHH5n+3JipV0Kmy18d5H3I8Hw06XzwC A0VI3PZKbyUg04rGromLt7Mmj2Vb0urwosVnpAyt6ibw9vAZdyUEzhAAD0crbJC/kaoN LWHQl6+40+DUlXQb11l93oaTE/ZhhUrg2izyBRfZ0ohRxIP4O7sAY18yLOX97dqUWU0B 4Pbg== 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=8y0KNL/AFSS9j7gNmLDE5wRNKMVyyA8vBmve9VVvdXg=; b=BPKT2gDIyLnIZC9YAdb34avQNjkhNI1IxLMQPP8oRU17kXGY0rJVjRSDNc2gQrSGdu +CNLFLXmAMaxp7+Ukd8lX029s3lLNVAxyLrexb6/vBYTWYU9hXK1q2pX1XcE/KFAOveW u42uxCVSrDP4hLS/zqEIh7ZDIuvlxl6UdRcRTBRitO/cLVHfPmWK8EECdeZP32/TarLs MFNWngf4njRGyQa1H7mvXNpIQf/mJPyF8fQ1bk+EgGhr36cotsXoTLGWMgzI8zko4qxE wGnol9Q45yhU1ORE8LBToDlwBkVdrezbjASE+vOKzqEbN5JVXEhGJJGKR1xtuqcPtVgC Zg+A== X-Gm-Message-State: APjAAAUdR3vPv8vIfMkJ1YUhJ/3zY6LFOEZX//kovZYneb96PC8dNa8Q cfg0CKKQhBsuEq9z5zHKg1OhY/0pujqTkA== X-Received: by 2002:a7b:c7d2:: with SMTP id z18mr4396895wmk.160.1581166709590; Sat, 08 Feb 2020 04:58:29 -0800 (PST) Received: from localhost.localdomain ([82.3.55.76]) by smtp.gmail.com with ESMTPSA id p5sm7490534wrt.79.2020.02.08.04.58.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 08 Feb 2020 04:58:28 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v4 12/20] target/arm: Update arm_mmu_idx_el for PAN Date: Sat, 8 Feb 2020 12:58:08 +0000 Message-Id: <20200208125816.14954-13-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::343 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" Examine the PAN bit for EL1, EL2, and Secure EL1 to determine if it applies. Reviewed-by: Alex Bennée Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson --- target/arm/helper.c | 9 +++++++++ 1 file changed, 9 insertions(+) -- 2.20.1 diff --git a/target/arm/helper.c b/target/arm/helper.c index 058fb23959..f6a600aa00 100644 --- a/target/arm/helper.c +++ b/target/arm/helper.c @@ -11895,13 +11895,22 @@ ARMMMUIdx arm_mmu_idx_el(CPUARMState *env, int el) return ARMMMUIdx_E10_0; case 1: if (arm_is_secure_below_el3(env)) { + if (env->pstate & PSTATE_PAN) { + return ARMMMUIdx_SE10_1_PAN; + } return ARMMMUIdx_SE10_1; } + if (env->pstate & PSTATE_PAN) { + return ARMMMUIdx_E10_1_PAN; + } return ARMMMUIdx_E10_1; case 2: /* TODO: ARMv8.4-SecEL2 */ /* Note that TGE does not apply at EL2. */ if ((env->cp15.hcr_el2 & HCR_E2H) && arm_el_is_aa64(env, 2)) { + if (env->pstate & PSTATE_PAN) { + return ARMMMUIdx_E20_2_PAN; + } return ARMMMUIdx_E20_2; } return ARMMMUIdx_E2;