From patchwork Mon Aug 12 10:15:45 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Rutland X-Patchwork-Id: 13760384 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 723ADC52D7C for ; Mon, 12 Aug 2024 10:18:03 +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=d5LEHJxIyq24Lh6D7fdWi9fsEMR2qg2XLjx2Ip9xBHk=; b=GBQrOJOnCptCLtsgcMrXnZ6bqj yFSoWBlRndQmDFIIEY/jYTPKTKZ81ghKVbnl9CK3oshq/Ii0fYgxjXfvzNGEmiyIEvp6maFjzIy6p io70QQudm7ZADl9ag5y6gZO+fHs0xh5GvnsFAe2Mg9L27Pp/r1nD3qeT5sTOUONqxmtHgta535kC6 Na7z0BL/JX8NElVyjbLcPjpPg2MVAtj2ci/NR2Bv8Zdx+FzhHfC/Sfc3lRD6tsTmzS/t8KCrpuEP4 ckdmZ1jKkqKs3T8MnOdpaiEIT31h6UIA5yzEvLKIEKq/v01Cv9SGe2YnXZlGsdMlgQJ4ls69+FZ5q VJcYL5qw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sdS7Y-0000000Ha0E-0MD8; Mon, 12 Aug 2024 10:17:48 +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 1sdS5s-0000000HZfq-07Oi for linux-arm-kernel@lists.infradead.org; Mon, 12 Aug 2024 10:16:07 +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 78110FEC; Mon, 12 Aug 2024 03:16:26 -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 BADB83F6A8; Mon, 12 Aug 2024 03:15:59 -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 v2 00/10] Cleanup initialization Date: Mon, 12 Aug 2024 11:15:45 +0100 Message-Id: <20240812101555.3558589-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-20240812_031604_144209_798D5E55 X-CRM114-Status: UNSURE ( 9.62 ) 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. Since v1 [1]: * Retain SPSR.T bit handling; necessary for PSCI * Comment on handling of CNTFRQ_EL0 when not entered at the highest EL * Fix missing braces in cpu_init_psci_arch() * Add Marc's Acked-by tag series-wide [1] https://lore.kernel.org/linux-arm-kernel/20240729161501.1806271-1-mark.rutland@arm.com/ Mark. Mark Rutland (10): 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 | 62 ++++--------- 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, 224 insertions(+), 164 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