From mboxrd@z Thu Jan 1 00:00:00 1970 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 449CAC761AF for ; Fri, 31 Mar 2023 15:16:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=tKeEpzKL2bvCAfcygRvmuR4VA5QG8+bsmfOvyJ9OEF0=; b=xDKQK04tGE92zB OYbmc+8ABjG3oCtA0B5XGEBUux50sid6JwGbdHAMXnyUTtHORWXN4gpSw0eyBFnAYd2Apx3gV9Mmt VpiV3qBH1VddfSDYpJvyK4G1KWmIWI8ldK8EnZsKhvuUAZnrTBoBj+iOJ7gfM3CmvkVBlg1PcP5Uf GOydo+uSBaEzDFZlt7Ncs+WfcAdAupr5FItr+0TWAWB5kjefT0pDcU/x93V2xYbhAUEYWZTI8GOBx 9QWgqz72yk0RL/u8/Y4LZ6GmEmepkGXb92lv32Oh/pknxcAMim0oUUT0yS1UyRm0Uhqzxbri1E3b2 ruR+Edyqa1rlnWi8Se1Q==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1piGTI-007seF-2p; Fri, 31 Mar 2023 15:15:20 +0000 Received: from dfw.source.kernel.org ([2604:1380:4641:c500::1]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1piGTF-007sd8-2L for linux-arm-kernel@lists.infradead.org; Fri, 31 Mar 2023 15:15:19 +0000 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 40E6762A02; Fri, 31 Mar 2023 15:15:17 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B2CCCC4339B; Fri, 31 Mar 2023 15:15:14 +0000 (UTC) Date: Fri, 31 Mar 2023 16:15:11 +0100 From: Catalin Marinas To: Joey Gouly Cc: linux-arm-kernel@lists.infradead.org, nd@arm.com, broonie@kernel.org, james.morse@arm.com, mark.rutland@arm.com, maz@kernel.org, oliver.upton@linux.dev, suzuki.poulose@arm.com, will@kernel.org, yuzenghui@huawei.com Subject: Re: [PATCH v1 15/18] arm64: disable EL2 traps for PIE Message-ID: References: <20230309145246.22787-1-joey.gouly@arm.com> <20230309145246.22787-16-joey.gouly@arm.com> <20230328103427.GA1045151@e124191.cambridge.arm.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20230328103427.GA1045151@e124191.cambridge.arm.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230331_081517_797280_C047EAC6 X-CRM114-Status: GOOD ( 16.07 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Tue, Mar 28, 2023 at 11:34:27AM +0100, Joey Gouly wrote: > On Mon, Mar 27, 2023 at 05:59:23PM +0100, Catalin Marinas wrote: > > On Thu, Mar 09, 2023 at 02:52:43PM +0000, Joey Gouly wrote: > > > diff --git a/arch/arm64/include/asm/el2_setup.h b/arch/arm64/include/asm/el2_setup.h > > > index 037724b19c5c..6e6675fae194 100644 > > > --- a/arch/arm64/include/asm/el2_setup.h > > > +++ b/arch/arm64/include/asm/el2_setup.h > > > @@ -22,6 +22,21 @@ > > > isb > > > .endm > > > > > > +.macro __init_el2_hcrx > > > + mrs x1, id_aa64mmfr1_el1 > > > + ubfx x0, x1, #ID_AA64MMFR1_EL1_HCX_SHIFT, 4 > > > + cbz x0, .Lskip_hcrx_\@ > > > + > > > + mrs_s x1, SYS_ID_AA64MMFR2_EL1 > > > + ubfx x0, x1, #ID_AA64MMFR3_EL1_TCRX_SHIFT, 4 > > > + cbz x0, .Lskip_hcrx_\@ > > > + > > > + mrs_s x0, SYS_HCRX_EL2 > > > + orr x0, x0, #HCRX_EL2_TCR2En > > > + msr_s SYS_HCRX_EL2, x0 > > > +.Lskip_hcrx_\@: > > > +.endm > > > > Can we not just set HCRX_EL2_TCR2En without probing for TCRX? > > It's RES0, so I avoided it, but if it's fine I can drop the check. We do this in a few other places (SCTLR_ELx etc). When it's RES0, we only write 0 as we can't tell what it will do in a future architecture version. But now that it has a defined meaning, just set it and it has no effect on earlier CPUs (there is a definition of RES0 on page 11943 in the Arm ARM). -- Catalin _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel