From patchwork Mon Jul 29 16:14:50 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Rutland X-Patchwork-Id: 13745259 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 CB0F2C3DA4A for ; Mon, 29 Jul 2024 16:15: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: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:In-Reply-To:References:List-Owner; bh=1o/NeLp3ZhSO/TDJJUFchhUwVATaOCyI7pHUiEWDBCw=; b=b4yIzYmIXnKCEnChKsE2h6JwWG wqFMWwdLBri7cehAsW5elNTk/0OWvviyg6dd5QQimPVI+vkxsFqaAebEXD4e+dIaGALj4rT//fvvp zbeIGHPiZlghIzygLw0wxP16TJXEeg1GDLliW62LNe97vPIJLRA44IlT7tDIgf1ZybMpM0p98fmL5 lMo3SakieMLi2IKguJK+N0yGo21TmajQjRlY7ACHM5f1EzQNHwkBWzps56N63JLLIAe6S3laN8OOY fzFQ7fOqxnTV/rKk/FCtPVzxIUJF/faBEa7RxHvUMlroz0bz2bikaP5dwLZoSsYC1dMk8mNanEXJs XDtXgsgQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sYT29-0000000ByPt-2NsN; Mon, 29 Jul 2024 16:15:37 +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 1sYT1i-0000000ByJu-2p5a for linux-arm-kernel@lists.infradead.org; Mon, 29 Jul 2024 16:15:11 +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 A8D6B1007; Mon, 29 Jul 2024 09:15:35 -0700 (PDT) Received: from lakrids.cambridge.arm.com (usa-sjc-imap-foss1.foss.arm.com [10.121.207.14]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 404053F766; Mon, 29 Jul 2024 09:15:09 -0700 (PDT) From: Mark Rutland To: linux-arm-kernel@lists.infradead.org Cc: akos.denke@arm.com, andre.przywara@arm.com, luca.fancellu@arm.com, mark.rutland@arm.com, maz@kernel.org Subject: [BOOT-WRAPPER 00/11] Cleanup initialization Date: Mon, 29 Jul 2024 17:14:50 +0100 Message-Id: <20240729161501.1806271-1-mark.rutland@arm.com> X-Mailer: git-send-email 2.30.2 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240729_091510_790618_B2F0E05A X-CRM114-Status: UNSURE ( 8.35 ) X-CRM114-Notice: Please train this message. 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 These patches cleanup the boot-wrapper initialization logic to make it more consistent and easier to extend in C code in future. The big changes are: * The kernel is always entered via an exception return. This allows us to initialize PSTATE consistently, and will allow us to adjust the SPSR dynamically in C code in future if necessary. * Regardless of the entered exception level, CPU state is initialized under cpu_init_arch(), allowing for logic to be shared regardless of which exception level was entered. * CPUs are initialized sequentially, which allows better for better logging within the boot-wrapper. Mark. Mark Rutland (11): Always enter AArch32 kernels in ARM mode aarch64: Remove redundant EL1 entry logic aarch64: Implement cpu_init_arch() aarch64: Always enter kernel via exception return aarch32: Refactor inital entry aarch32: Implement cpu_init_arch() aarch32: Always enter kernel via exception return Unify assembly setup paths Simplify spin logic Add printing functions Boot CPUs sequentially arch/aarch32/boot.S | 95 ++++++++++---------- arch/aarch32/include/asm/{gic-v3.h => gic.h} | 2 +- arch/aarch32/init.c | 30 +++++-- arch/aarch64/boot.S | 66 ++++---------- arch/aarch64/include/asm/{gic-v3.h => gic.h} | 2 +- arch/aarch64/init.c | 30 +++++-- arch/aarch64/spin.S | 14 +-- common/boot.c | 20 ++--- common/gic-v3.c | 2 +- common/gic.c | 2 +- common/init.c | 50 +++++++++-- common/platform.c | 35 ++++++++ common/psci.c | 16 +--- include/boot.h | 8 +- include/gic.h | 16 ++++ include/platform.h | 4 + 16 files changed, 221 insertions(+), 171 deletions(-) rename arch/aarch32/include/asm/{gic-v3.h => gic.h} (91%) rename arch/aarch64/include/asm/{gic-v3.h => gic.h} (92%) create mode 100644 include/gic.h Acked-by: Marc Zyngier