From patchwork Fri Nov 24 16:34:49 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joey Gouly X-Patchwork-Id: 13467919 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1F377C61D97 for ; Fri, 24 Nov 2023 16:35:36 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 1F1196B0298; Fri, 24 Nov 2023 11:35:35 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 1A2326B029A; Fri, 24 Nov 2023 11:35:35 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 069596B02A1; Fri, 24 Nov 2023 11:35:34 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id E4FF46B0298 for ; Fri, 24 Nov 2023 11:35:34 -0500 (EST) Received: from smtpin25.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id C56A21CBB85 for ; Fri, 24 Nov 2023 16:35:34 +0000 (UTC) X-FDA: 81493398588.25.9214A0F Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by imf14.hostedemail.com (Postfix) with ESMTP id 2299710001B for ; Fri, 24 Nov 2023 16:35:32 +0000 (UTC) Authentication-Results: imf14.hostedemail.com; dkim=none; dmarc=pass (policy=none) header.from=arm.com; spf=pass (imf14.hostedemail.com: domain of joey.gouly@arm.com designates 217.140.110.172 as permitted sender) smtp.mailfrom=joey.gouly@arm.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1700843733; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=IbrnELc79cTTyl8mSzRLYhNT8sC3fwyI3hxFhzA9Hnk=; b=qEFpsKETBXEuqtarfTdpvoPH7AkZsjQTNqdUHBUCaDAsAF2pDcM5n0LfWkr9YNq6qDJtJq 7LFiQO27Ukq5WNGC3jUQMZu5yYnp5ss6ozv01t9LUoJwdOy2NuDiJ9lSp3FbdVNgd77cYR pbLmGJfaNTbxx7DyClwvntlXFIsFr1Y= ARC-Authentication-Results: i=1; imf14.hostedemail.com; dkim=none; dmarc=pass (policy=none) header.from=arm.com; spf=pass (imf14.hostedemail.com: domain of joey.gouly@arm.com designates 217.140.110.172 as permitted sender) smtp.mailfrom=joey.gouly@arm.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1700843733; a=rsa-sha256; cv=none; b=vGWe+OWMxdq26vY8o4U2+Za/BJhpgolw6+Vy4HqHZGEF/CdkvcvrV96n+sF1koibxz/wCZ S9RNmaI8sPEx5zDR3XTvMXdm36I6q+bvBqKfVOW0B9Qtr4/TUdZh0TEz+iHS0UaIoYISSr PcH+6q8XY/gWwiwenqEmSkXIliXBz14= Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id EA1741BCA; Fri, 24 Nov 2023 08:36:18 -0800 (PST) Received: from e124191.cambridge.arm.com (e124191.cambridge.arm.com [10.1.197.45]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 44A143F73F; Fri, 24 Nov 2023 08:35:30 -0800 (PST) From: Joey Gouly To: linux-arm-kernel@lists.infradead.org Cc: akpm@linux-foundation.org, aneesh.kumar@linux.ibm.com, broonie@kernel.org, catalin.marinas@arm.com, dave.hansen@linux.intel.com, joey.gouly@arm.com, maz@kernel.org, oliver.upton@linux.dev, shuah@kernel.org, will@kernel.org, kvmarm@lists.linux.dev, linux-fsdevel@vger.kernel.org, linux-mm@kvack.org, linux-kselftest@vger.kernel.org, James Morse , Suzuki K Poulose , Zenghui Yu Subject: [PATCH v3 04/25] arm64: disable trapping of POR_EL0 to EL2 Date: Fri, 24 Nov 2023 16:34:49 +0000 Message-Id: <20231124163510.1835740-5-joey.gouly@arm.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20231124163510.1835740-1-joey.gouly@arm.com> References: <20231124163510.1835740-1-joey.gouly@arm.com> MIME-Version: 1.0 X-Rspam-User: X-Rspamd-Server: rspam12 X-Rspamd-Queue-Id: 2299710001B X-Stat-Signature: ccurfkb6saq1pkgyogxjkhjfxqf4ormy X-HE-Tag: 1700843732-742338 X-HE-Meta: U2FsdGVkX19ESpnOglJjq8uZ26nq5raFcb7H/rC26eY02eQyGkC/IAkLwbE+Y5D3djKaYkn03HiUuardjmHyZWt0LUNUGuwV0NW/Oyeyz4qz3PEWAPZFFhhlels0sx6BPuMPoBk9zgCiSpbZA8xYHQRfKiLre29+/6r3+zGv3cxBMWO27t1KhVkGO9BzXYiIXHN8HtxSqFxw1PvsH8AwLz50h8/w5IoY9nkcjZqTyhi2eFWdXaYLFvLCKdp6p6gjAfvjDHvZDaVa8vhXOpj1dM0JzuBrgGvIUS3w0z8LToVJwiFmVkEbZxjiOOxWRS3FDJXGldthie/GxUu62E1TLduvp9cYdTsU1OlNYK/6fHlj4GozCGPSLpIcwHLf+AFB+/aObjeRL9EExOcpN/dc7SloqHxDDZSbSYwo/vWIDGrzUTolyVb2zhBXGAESUk/zXX4y6iFMZb5LRfL+yKaWEKJ+Ui1+myYeYnVrlbsLLbPOhVIGnIDR1+DjMLPFj+0oFmCtF5kwbS3/cG5Fa6RNwZEaiW6sCmHA9taroMNNNKsLMUtovv+Oaj1HDDb16WASdjoFhvyg5tjpEBpm63HUmfR6FjARybZ4bOtiE9CJX+HsPGoF0bNOZlNP/WAZWBpvNdvlGwFFYd6y8xs9eJEnAjpYviuJ2N4RK3rXkErcroLuRyhI2sfDFXJFt/X+3Tu1YB+sEqEb/kpPvWPDXQE583+utUzJ5u5RTq2fv2mg2FEYSaHaWCDI9Lr24i3bzBVG3Yy1k4eJFyDD/QMeAXrtzcVHwOtOyGMY8dUd4FjKKtnS4/PCippGpPMKkHTkL87Ris8nRz/oYetfCMf7rPKnn1nCrV4DUeR6KjzJi6NviTW17hWpXPT3sP6yK53eiQb7zYBxLIznij5YKfCLmoXIItSLEUJDLpc/1gwtj7O1iS/VfTQmzR0f00KLlnvlmIWHXGMpuWECxXT/QJMjH45 6yaorfzK FevadMYDoYmLa/MsjuMnacjjC+XOLAQOIrraD30p0h9akO3eiNDt9qvofUV3JeY5mnpGaoUfZeOVCBO48QgMIajH35oyL3DElEeTCltl/cDiZfHlnRN+4BAAs1Yvd/MqzkOaSD1srAoLwJ2q7L0dTWoJDCrDxDWbGcZ+Ji0PckJKAbBGuutzi+7jXBNkvw6Ske1BB7+WA1vFmkkUlmQ3f1IzikJiWS2r34+ePW6S7Rs8E6DhhBBTyKLxJxgMOegPZpuBBRJzO65opV7k= X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: Allow EL0 or EL1 to access POR_EL0 without being trapped to EL2. Signed-off-by: Joey Gouly Cc: Catalin Marinas Cc: Will Deacon Acked-by: Catalin Marinas --- arch/arm64/include/asm/el2_setup.h | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/arch/arm64/include/asm/el2_setup.h b/arch/arm64/include/asm/el2_setup.h index b7afaa026842..df5614be4b70 100644 --- a/arch/arm64/include/asm/el2_setup.h +++ b/arch/arm64/include/asm/el2_setup.h @@ -184,12 +184,20 @@ .Lset_pie_fgt_\@: mrs_s x1, SYS_ID_AA64MMFR3_EL1 ubfx x1, x1, #ID_AA64MMFR3_EL1_S1PIE_SHIFT, #4 - cbz x1, .Lset_fgt_\@ + cbz x1, .Lset_poe_fgt_\@ /* Disable trapping of PIR_EL1 / PIRE0_EL1 */ orr x0, x0, #HFGxTR_EL2_nPIR_EL1 orr x0, x0, #HFGxTR_EL2_nPIRE0_EL1 +.Lset_poe_fgt_\@: + mrs_s x1, SYS_ID_AA64MMFR3_EL1 + ubfx x1, x1, #ID_AA64MMFR3_EL1_S1POE_SHIFT, #4 + cbz x1, .Lset_fgt_\@ + + /* Disable trapping of POR_EL0 */ + orr x0, x0, #HFGxTR_EL2_nPOR_EL0 + .Lset_fgt_\@: msr_s SYS_HFGRTR_EL2, x0 msr_s SYS_HFGWTR_EL2, x0