From patchwork Tue Jul 16 14:29:02 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Luca Fancellu X-Patchwork-Id: 13734559 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 B851FC3DA59 for ; Tue, 16 Jul 2024 14:31:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=v8rt4fhWn42ohnYeBXL6kztKpuwchh0tV1oAQagJcyM=; b=kZMYngmBrmbtzKWWOc3EDlMJRa 5M1ernxERywv88qeW83r/F4jz07cj0w4uNSzOurYpI4tH2YPbKPKYLHFkHwbKM7ZBjhBIH5d99/Jl 8OUNEPg66kS6H0jMOsq7DEjqgdGp/OoYXEoNSXov0NiVMrzstBs03JmHHKG8IJn2k8EX4tWSAOT0o AW2f8dg4h3+wx+RcT+VxoFJhyEELrwN5iDfh83c36LMLxyrO0+90prHqCqSb5TnEP6sCyJY07R0BA tQFhFReQ6dgDDJOr+a27EnevTQDDlTqPmqhakX5dws3q5Lar022j4vY6vkN9TirhOjMZ8RgxoK3Zg x6c0ALKA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sTjDJ-0000000AjRV-1UVA; Tue, 16 Jul 2024 14:31:33 +0000 Received: from foss.arm.com ([217.140.110.172]) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sTjBI-0000000AiIb-12Ry for linux-arm-kernel@lists.infradead.org; Tue, 16 Jul 2024 14:29:30 +0000 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 998E1113E; Tue, 16 Jul 2024 07:29:49 -0700 (PDT) Received: from e125770.cambridge.arm.com (e125770.arm.com [10.1.199.43]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id A48933F762; Tue, 16 Jul 2024 07:29:23 -0700 (PDT) From: Luca Fancellu To: andre.przywara@arm.com, mark.rutland@arm.com Cc: linux-arm-kernel@lists.infradead.org Subject: [PATCH v2 2/6] aarch64: Prepare for lower EL booting Date: Tue, 16 Jul 2024 15:29:02 +0100 Message-Id: <20240716142906.1502802-3-luca.fancellu@arm.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240716142906.1502802-1-luca.fancellu@arm.com> References: <20240716142906.1502802-1-luca.fancellu@arm.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240716_072928_369644_1DEEB8A9 X-CRM114-Status: GOOD ( 10.28 ) 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: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Store the value of the initial SPSR into a variable during EL3 initialization and load it from the variable before dropping EL, this is done as preparation work to be able to boot from a different exception level. Signed-off-by: Luca Fancellu Reviewed-by: Andre Przywara --- v2 changes: - add Andre R-by --- arch/aarch64/boot.S | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/arch/aarch64/boot.S b/arch/aarch64/boot.S index 7727475925c1..211077af17c8 100644 --- a/arch/aarch64/boot.S +++ b/arch/aarch64/boot.S @@ -51,6 +51,10 @@ reset_at_el3: b.eq err_invalid_id bl setup_stack + mov w0, #SPSR_KERNEL + ldr x1, =spsr_to_elx + str w0, [x1] + bl cpu_init_bootwrapper bl cpu_init_el3 @@ -135,7 +139,7 @@ ASM_FUNC(jump_kernel) b.eq 1f br x19 // Keep EL -1: mov x4, #SPSR_KERNEL +1: ldr w4, spsr_to_elx /* * If bit 0 of the kernel address is set, we're entering in AArch32 @@ -153,3 +157,5 @@ ASM_FUNC(jump_kernel) .align 3 flag_keep_el: .long 0 +spsr_to_elx: + .long 0