From patchwork Tue Mar 7 14:04:48 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 13163758 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 E1113C678D4 for ; Tue, 7 Mar 2023 14:33:42 +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:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=TzZVxrCM2rwXObaTOMj2YKNzPlunbAyNWVXqv9ikNe8=; b=F075BgO/zDtgyM PLy3B0nX/bB4Z98L2s/0ZdRFgU/T1iXMDSuwCJfuGKiej3Yvq+pVXuG46+7UYG4IBLaKAvY6+LW64 9nxrZYtUllFHPx11oiJQ5oZLPrCTXvse7JXyllQhg40FCIL92LDe0qNPj0YLIkksw6w+Yyy2un7nz /hASnSDR4m3a62D9bqqFuxYnzwQwIldrwZomHua9D28RPcQyLg+ncdo5XizFRm6rgJnArPYjlr0+3 Pya8V/4R/baQWbzUUdsnzJdX+uQDADsS3m3akTrLomlse0aN8pmXsbnf4H8zY1k90EOpn9lMh7pXO sz8s8mTuD/0YBvgTczyA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1pZYMb-000pES-CI; Tue, 07 Mar 2023 14:32:26 +0000 Received: from dfw.source.kernel.org ([2604:1380:4641:c500::1]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1pZXyg-000eP2-1u for linux-arm-kernel@lists.infradead.org; Tue, 07 Mar 2023 14:07:43 +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 66E7A61457; Tue, 7 Mar 2023 14:07:41 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D6162C433A4; Tue, 7 Mar 2023 14:07:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1678198060; bh=NW0PGhf1i6p2eNdylQMSe2x4+utKDJZCyu+uqyONhAY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=rcUOF+QHEd1jnWMXrZj5R+EYXNfLxD01pxXkwuWjvh839aQfApV8fuJnSxME6zk2l oQlxQ2hph0Pzgs6zrd92ynyO/BZvewOzML5BHSR7MJHkYMrQ48dqjA4anyKH/YMVeC CIfFy+xzkAeKvyv4J815sjfvnNCux9c86RKfaLG+2oELDINbKSvfs6x2NoxDx9hoew cNRZ2FM+8ehzAhU4394rZ3gUmiSFzkhWpCatrow9G4H8+UIVgjzXW3NdkgIHqWdmui Sxzh3Q+C1Kw8/MfO+frGDXfPgsGRngKVCJ8I6t0Xd4BgdQKvDobPUu7C0miiOJpk1v 77L9HNY8ygkxQ== From: Ard Biesheuvel To: linux-kernel@vger.kernel.org Cc: linux-arm-kernel@lists.infradead.org, Ard Biesheuvel , Catalin Marinas , Will Deacon , Marc Zyngier , Mark Rutland , Ryan Roberts , Anshuman Khandual , Kees Cook Subject: [PATCH v3 26/60] arm64: Move feature overrides into the BSS section Date: Tue, 7 Mar 2023 15:04:48 +0100 Message-Id: <20230307140522.2311461-27-ardb@kernel.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230307140522.2311461-1-ardb@kernel.org> References: <20230307140522.2311461-1-ardb@kernel.org> MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=1664; i=ardb@kernel.org; h=from:subject; bh=NW0PGhf1i6p2eNdylQMSe2x4+utKDJZCyu+uqyONhAY=; b=owGbwMvMwCFmkMcZplerG8N4Wi2JIYXdxUHQ01bgxOGkDa94b+7L5XevME6w/Xdn10Mx2flLl 0f3ffnVUcrCIMbBICumyCIw+++7nacnStU6z5KFmcPKBDKEgYtTACbS68vIcH/DGqU2Fhe7k0Uy hTNeLbwXfnVCZrLi9d2lC52Dv240mszw33/bhvhT204cqGE/Lui3P3mTo96ClP1fWVsaapfejfy 2ghcA X-Developer-Key: i=ardb@kernel.org; a=openpgp; fpr=F43D03328115A198C90016883D200E9CA6329909 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230307_060742_219837_F537BD58 X-CRM114-Status: GOOD ( 12.74 ) 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 In order to allow the CPU feature override detection code to run even earlier, move the feature override global variables into BSS, which is the only part of the static kernel image that is mapped read-write in the initial ID map. Signed-off-by: Ard Biesheuvel --- arch/arm64/kernel/cpufeature.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/arch/arm64/kernel/cpufeature.c b/arch/arm64/kernel/cpufeature.c index 88cec6c14743c4c5..0b16e676b68c6543 100644 --- a/arch/arm64/kernel/cpufeature.c +++ b/arch/arm64/kernel/cpufeature.c @@ -649,13 +649,13 @@ static const struct arm64_ftr_bits ftr_raz[] = { #define ARM64_FTR_REG(id, table) \ __ARM64_FTR_REG_OVERRIDE(#id, id, table, &no_override) -struct arm64_ftr_override __ro_after_init id_aa64mmfr1_override; -struct arm64_ftr_override __ro_after_init id_aa64pfr0_override; -struct arm64_ftr_override __ro_after_init id_aa64pfr1_override; -struct arm64_ftr_override __ro_after_init id_aa64zfr0_override; -struct arm64_ftr_override __ro_after_init id_aa64smfr0_override; -struct arm64_ftr_override __ro_after_init id_aa64isar1_override; -struct arm64_ftr_override __ro_after_init id_aa64isar2_override; +struct arm64_ftr_override id_aa64mmfr1_override; +struct arm64_ftr_override id_aa64pfr0_override; +struct arm64_ftr_override id_aa64pfr1_override; +struct arm64_ftr_override id_aa64zfr0_override; +struct arm64_ftr_override id_aa64smfr0_override; +struct arm64_ftr_override id_aa64isar1_override; +struct arm64_ftr_override id_aa64isar2_override; struct arm64_ftr_override arm64_sw_feature_override;