From patchwork Tue Dec 3 22:53:29 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 180770 Delivered-To: patch@linaro.org Received: by 2002:a92:3001:0:0:0:0:0 with SMTP id x1csp2174264ile; Tue, 3 Dec 2019 15:08:04 -0800 (PST) X-Google-Smtp-Source: APXvYqwq5cnGE4XPcaIEEl4c8BLxEBgwzK2YcRgPn7GO12A8Jy2TsTrMbe49BYzSkJ4lHFv43E07 X-Received: by 2002:a0c:d4aa:: with SMTP id u39mr127729qvh.76.1575414484587; Tue, 03 Dec 2019 15:08:04 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1575414484; cv=none; d=google.com; s=arc-20160816; b=eCUONIn8Ha/b6dpbwRqMr2KwrKX2K33mcn0qEllp/3+PqIko5nsdW7uMS52cZi91Xe adVA0dlIwQ0s/v154IinRstxUH3ESGZoWD7eUdduSH+whcNUhDoFIW1DeTW6nTUnTHla zn1PfohEYwpCZ7FLiVwOjc0OKzZa2Fuxr57GVq3+XiICWfRO7BbQzHzXET5rNoK/sbYL FMxc+CKK+vncw/K2PQSagZT4KA6KBdhYxLKYCZ1VErMLlOh0J8BrKunc/cAkD9xBO173 uwmBvk93pxXN9uNc0ZfVrTgW7pRUXzGdjDsumtiPq80+Win6UjjsVosbD2vYFENm0kBf 5bjQ== 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=kdW9rejh1ibQajGq3OYdmfZLH8GvxDCl1d2Jfe7OmXM=; b=vxzuwA0WyJYeLt5eyLr1xDsPAQywwHKMOSE2YNN9xXN8gEJ5nFrNhrxmiadb4hwwfX zZnNybg2LRBy+ybqxtTVuRJrY3Pdvoa2TqmfnqzjkJrC3l90CQ3StbBcu6IVXMELZiOd HFakDgOKo3WfYXZJ8aBzIMG8WiuUQjQGFQgkn9aMDMTMaM60rGj/cnY1JqC+g+94O8qf zn4ucp2xeCD8D3YTQlZfzXbT4uTsD+yygYRmEF/2irKt+qZYEaaDEwZwjhDRuUAEq4yh VrSubxSk6JC2BF8+L+Qwy0bqHaVovYV16jIzEf4SdwKnr8rSawzKBCVax3CT+k38CSOx sg4Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=McUPS8Ew; 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 u1si3001503qtb.252.2019.12.03.15.08.04 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 03 Dec 2019 15:08:04 -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=McUPS8Ew; 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]:60188 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1icHH2-0001hZ-49 for patch@linaro.org; Tue, 03 Dec 2019 18:08:04 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:58485) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1icH3T-0002fl-IN for qemu-devel@nongnu.org; Tue, 03 Dec 2019 17:54:05 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1icH3R-0006lu-ED for qemu-devel@nongnu.org; Tue, 03 Dec 2019 17:54:03 -0500 Received: from mail-pl1-x643.google.com ([2607:f8b0:4864:20::643]:45905) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1icH3F-0006Yw-Cu for qemu-devel@nongnu.org; Tue, 03 Dec 2019 17:53:51 -0500 Received: by mail-pl1-x643.google.com with SMTP id w7so2267962plz.12 for ; Tue, 03 Dec 2019 14:53:45 -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=kdW9rejh1ibQajGq3OYdmfZLH8GvxDCl1d2Jfe7OmXM=; b=McUPS8EwimSh1/Fh5SI1znSlwb1sJgYucLyst9pmIYvO6GVt4QTxxDxTnWJrxE+29L 98yJC/dLhgpW/aptS8ckulAeN6Wih1CJlNE6k8MeEnzNg7eChm/TEZmDXB49SuJvD/Oh g9iJT0ucE6FV8r4M4T18L87o0eBtvfi+793rJHjTmnSo4j6hiJ7tnecN7Vj6nIJbBQRE jd+6rKVZh9nDqrI4uD8xdaJ9VO2GKNS4u99aPnbXYVfDjQ2mIWo35XwgBv4+9K+7IDdN JjQeH0lRbJ4dRVQJLAr4ABM8nhJagfOLTLOJovrdDZzCTFymRKv0nSNqxgYyeQIJmryd WLMg== 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=kdW9rejh1ibQajGq3OYdmfZLH8GvxDCl1d2Jfe7OmXM=; b=n8BMcA1gG2ux7cBzxIszAmkiBs47J2C1RIW/IlL53MPT2lSyCWqdHbR/lj0jusJjgT tJBR2/rkVNhw+rK5CmLWMqRH5Q2DWgV6dNte/jWUpycXjZ/6w5kM8kYvstkRhEFp8Hxy T8tnwNy7/o/pEokx1V7c7JFPf6mgidHjxeuk5las0mHzLfpZstKqB2DDH0M2ZiuAdYKC VACrpbrJarKVEDnNf/rjgttjoCmhb04gn5R12tSHljQs/n2MSFjqdsxordxJQr70K+qr vXbI2+VjG0E2zG5PlwtJGDxrntlvv2RN/k37HRFMsrrf/KVCQ5nQuCRk+GIFIDcScqZH Y+AQ== X-Gm-Message-State: APjAAAU4rL066rC0QYowc35x+wGuBnjHynQdYLWE+kJbvD4lZNJf6oZZ 9w8MfCiTkJDoCDlEhKlSj8wQauGrdzo= X-Received: by 2002:a17:902:6bcc:: with SMTP id m12mr347091plt.272.1575413624119; Tue, 03 Dec 2019 14:53:44 -0800 (PST) Received: from localhost.localdomain (97-113-7-119.tukw.qwest.net. [97.113.7.119]) by smtp.gmail.com with ESMTPSA id d22sm3789713pjd.2.2019.12.03.14.53.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 03 Dec 2019 14:53:43 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH 07/11] target/arm: Update arm_mmu_idx_el for PAN Date: Tue, 3 Dec 2019 14:53:29 -0800 Message-Id: <20191203225333.17055-8-richard.henderson@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191203225333.17055-1-richard.henderson@linaro.org> References: <20191203225333.17055-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::643 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" Examine the PAN bit for EL1, EL2, and Secure EL1 to determine if it applies. Signed-off-by: Richard Henderson --- target/arm/helper.c | 9 +++++++++ 1 file changed, 9 insertions(+) -- 2.17.1 Reviewed-by: Peter Maydell diff --git a/target/arm/helper.c b/target/arm/helper.c index 512be5c644..6c65dd799e 100644 --- a/target/arm/helper.c +++ b/target/arm/helper.c @@ -11770,13 +11770,22 @@ ARMMMUIdx arm_mmu_idx_el(CPUARMState *env, int el) return ARMMMUIdx_EL10_0; case 1: if (arm_is_secure_below_el3(env)) { + if (env->pstate & PSTATE_PAN) { + return ARMMMUIdx_SE1_PAN; + } return ARMMMUIdx_SE1; } + if (env->pstate & PSTATE_PAN) { + return ARMMMUIdx_EL10_1_PAN; + } return ARMMMUIdx_EL10_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_EL20_2_PAN; + } return ARMMMUIdx_EL20_2; } return ARMMMUIdx_E2;