All of lore.kernel.org
 help / color / mirror / Atom feed
From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: linux-kernel@vger.kernel.org
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	stable@vger.kernel.org, Marc Zyngier <marc.zyngier@arm.com>,
	Mark Rutland <mark.rutland@arm.com>,
	Will Deacon <will.deacon@arm.com>,
	Catalin Marinas <catalin.marinas@arm.com>,
	Nathan Chancellor <nathan@kernel.org>
Subject: [PATCH 4.9 14/21] arm64: move !VHE work to end of el2_setup
Date: Mon, 10 Jan 2022 08:23:01 +0100	[thread overview]
Message-ID: <20220110071813.280605016@linuxfoundation.org> (raw)
In-Reply-To: <20220110071812.806606886@linuxfoundation.org>

From: Mark Rutland <mark.rutland@arm.com>

commit d61c97a7773d0848b4bf5c4697855c7ce117362c upstream.

We only need to initialise sctlr_el1 if we're installing an EL2 stub, so
we may as well defer this until we're doing so. Similarly, we can defer
intialising CPTR_EL2 until then, as we do not access any trapped
functionality as part of el2_setup.

This patch modified el2_setup accordingly, allowing us to remove a
branch and simplify the code flow.

Acked-by: Marc Zyngier <marc.zyngier@arm.com>
Signed-off-by: Mark Rutland <mark.rutland@arm.com>
Cc: Will Deacon <will.deacon@arm.com>
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
Signed-off-by: Nathan Chancellor <nathan@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 arch/arm64/kernel/head.S |   37 +++++++++++++++++--------------------
 1 file changed, 17 insertions(+), 20 deletions(-)

--- a/arch/arm64/kernel/head.S
+++ b/arch/arm64/kernel/head.S
@@ -553,26 +553,6 @@ set_hcr:
 	msr	vpidr_el2, x0
 	msr	vmpidr_el2, x1
 
-	/*
-	 * When VHE is not in use, early init of EL2 and EL1 needs to be
-	 * done here.
-	 * When VHE _is_ in use, EL1 will not be used in the host and
-	 * requires no configuration, and all non-hyp-specific EL2 setup
-	 * will be done via the _EL1 system register aliases in __cpu_setup.
-	 */
-	cbnz	x2, 1f
-
-	/* sctlr_el1 */
-	mov	x0, #0x0800			// Set/clear RES{1,0} bits
-CPU_BE(	movk	x0, #0x33d0, lsl #16	)	// Set EE and E0E on BE systems
-CPU_LE(	movk	x0, #0x30d0, lsl #16	)	// Clear EE and E0E on LE systems
-	msr	sctlr_el1, x0
-
-	/* Coprocessor traps. */
-	mov	x0, #0x33ff
-	msr	cptr_el2, x0			// Disable copro. traps to EL2
-1:
-
 #ifdef CONFIG_COMPAT
 	msr	hstr_el2, xzr			// Disable CP15 traps to EL2
 #endif
@@ -598,6 +578,23 @@ CPU_LE(	movk	x0, #0x30d0, lsl #16	)	// C
 	ret
 
 install_el2_stub:
+	/*
+	 * When VHE is not in use, early init of EL2 and EL1 needs to be
+	 * done here.
+	 * When VHE _is_ in use, EL1 will not be used in the host and
+	 * requires no configuration, and all non-hyp-specific EL2 setup
+	 * will be done via the _EL1 system register aliases in __cpu_setup.
+	 */
+	/* sctlr_el1 */
+	mov	x0, #0x0800			// Set/clear RES{1,0} bits
+CPU_BE(	movk	x0, #0x33d0, lsl #16	)	// Set EE and E0E on BE systems
+CPU_LE(	movk	x0, #0x30d0, lsl #16	)	// Clear EE and E0E on LE systems
+	msr	sctlr_el1, x0
+
+	/* Coprocessor traps. */
+	mov	x0, #0x33ff
+	msr	cptr_el2, x0			// Disable copro. traps to EL2
+
 	/* Hypervisor stub */
 	adrp	x0, __hyp_stub_vectors
 	add	x0, x0, #:lo12:__hyp_stub_vectors



  parent reply	other threads:[~2022-01-10  7:26 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-10  7:22 [PATCH 4.9 00/21] 4.9.297-rc1 review Greg Kroah-Hartman
2022-01-10  7:22 ` [PATCH 4.9 01/21] Bluetooth: btusb: Apply QCA Rome patches for some ATH3012 models Greg Kroah-Hartman
2022-01-10  7:22 ` [PATCH 4.9 02/21] tracing: Fix check for trace_percpu_buffer validity in get_trace_buf() Greg Kroah-Hartman
2022-01-10  7:22 ` [PATCH 4.9 03/21] tracing: Tag trace_percpu_buffer as a percpu pointer Greg Kroah-Hartman
2022-01-10  7:22 ` [PATCH 4.9 04/21] virtio_pci: Support surprise removal of virtio pci device Greg Kroah-Hartman
2022-01-10  7:22 ` [PATCH 4.9 05/21] ieee802154: atusb: fix uninit value in atusb_set_extended_addr Greg Kroah-Hartman
2022-01-10  7:22 ` [PATCH 4.9 06/21] mac80211: initialize variable have_higher_than_11mbit Greg Kroah-Hartman
2022-01-10  7:22 ` [PATCH 4.9 07/21] i40e: Fix incorrect netdevs real number of RX/TX queues Greg Kroah-Hartman
2022-01-10  7:22 ` [PATCH 4.9 08/21] sch_qfq: prevent shift-out-of-bounds in qfq_init_qdisc Greg Kroah-Hartman
2022-01-10  7:22 ` [PATCH 4.9 09/21] xfs: map unwritten blocks in XFS_IOC_{ALLOC,FREE}SP just like fallocate Greg Kroah-Hartman
2022-01-10  7:22 ` [PATCH 4.9 10/21] rndis_host: support Hytera digital radios Greg Kroah-Hartman
2022-01-10  7:22 ` [PATCH 4.9 11/21] bug: split BUILD_BUG stuff out into <linux/build_bug.h> Greg Kroah-Hartman
2022-01-10  7:22 ` [PATCH 4.9 12/21] arm64: Remove a redundancy in sysreg.h Greg Kroah-Hartman
2022-01-10  7:23 ` [PATCH 4.9 13/21] arm64: reduce el2_setup branching Greg Kroah-Hartman
2022-01-10  7:23 ` Greg Kroah-Hartman [this message]
2022-01-10  7:23 ` [PATCH 4.9 15/21] arm64: sysreg: Move to use definitions for all the SCTLR bits Greg Kroah-Hartman
2022-01-10  7:23 ` [PATCH 4.9 16/21] phonet: refcount leak in pep_sock_accep Greg Kroah-Hartman
2022-01-10  7:23 ` [PATCH 4.9 17/21] scsi: libiscsi: Fix UAF in iscsi_conn_get_param()/iscsi_conn_teardown() Greg Kroah-Hartman
2022-01-10  7:23 ` [PATCH 4.9 18/21] ip6_vti: initialize __ip6_tnl_parm struct in vti6_siocdevprivate Greg Kroah-Hartman
2022-01-10  7:23 ` [PATCH 4.9 19/21] net: udp: fix alignment problem in udp4_seq_show() Greg Kroah-Hartman
2022-01-10  7:23 ` [PATCH 4.9 20/21] mISDN: change function names to avoid conflicts Greg Kroah-Hartman
2022-01-10  7:23 ` [PATCH 4.9 21/21] power: reset: ltc2952: Fix use of floating point literals Greg Kroah-Hartman
2022-01-10 11:49 ` [PATCH 4.9 00/21] 4.9.297-rc1 review Jon Hunter
2022-01-10 18:58 ` Florian Fainelli
2022-01-10 23:01 ` Shuah Khan
2022-01-10 23:48 ` Guenter Roeck
2022-01-11  8:39 ` Naresh Kamboju

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220110071813.280605016@linuxfoundation.org \
    --to=gregkh@linuxfoundation.org \
    --cc=catalin.marinas@arm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=marc.zyngier@arm.com \
    --cc=mark.rutland@arm.com \
    --cc=nathan@kernel.org \
    --cc=stable@vger.kernel.org \
    --cc=will.deacon@arm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.