From patchwork Tue Jan 23 14:53:13 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 13527719 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 59BACC47DDB for ; Tue, 23 Jan 2024 16:01:07 +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:Cc:To:From:Subject:Message-ID: References:Mime-Version:In-Reply-To:Date:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=Vi6Z/LqZGKoLQyPnxflJ7ny9SFCJU4xcMnV0ngmwdxc=; b=KyNtSAM9s4IWkMGIneTYkqAbN8 wzZ2b4ZQnowKAKy+jZRwCrCyuw+vGBYuQel+Epmslw6m3qPYafFsg2yWehrN1Frp9JWCDK/bQ1E7D oMNK1B0XMZJg+wg/qhRbIPdIGHpcAK+CmOnz8CyjoaBJoP5IQdgYUPk9dBNo5YXMvEdphuwZGG+Ab 3xijfmDJSbhlMdrDg8gdocAVZ9P9FZQkFjfDs+P/5lCuu2DaXLClpcWYv+oBUxHlVaKZbizzSv2pd lf3ZhcoEEdfyJyoIjlktV6KWqnOg6gKmuiprsLUNXhdlgDIeN4AcVrqUaea+v0uYDPSlGp4aSoppG Eh29D58g==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1rSJCR-00HArV-2T; Tue, 23 Jan 2024 16:00:31 +0000 Received: from mail-yb1-xb4a.google.com ([2607:f8b0:4864:20::b4a]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1rSIAx-00GtoI-2C for linux-arm-kernel@lists.infradead.org; Tue, 23 Jan 2024 14:55:03 +0000 Received: by mail-yb1-xb4a.google.com with SMTP id 3f1490d57ef6-dc37b0ac33cso689948276.2 for ; Tue, 23 Jan 2024 06:54:55 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1706021694; x=1706626494; darn=lists.infradead.org; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=FEN215+vp7ZnhP1/JiILPedrshyx5I3UlpHwXzSi3Fg=; b=aVp79voBy4NAqEM/rjrPyDOVT0HSH9sr3ZXI9HbU4g7JeKv8C+etaUwUrenpf8ipiG Em5pFHjhmxUMv65HVOFPtCsnuztC3N5cPkT2OuY04QQpA8LrSkkUDuRMpf8qE/uuQrlb OGVtS8ZVcopw93etybX4z33Vs/KsMC38hii3szPp6GYj+yIgY3BN2v2+OPmy51BmG/3N 3410gspVLEM+NobGrXi1YBhyl9c3Nb+gPtxq3367MiEkjtoyzz+5LxQHW6jCiXgXDVxU xo/QILBEJeMzLhREwL7aFs0Tp6/U0eqA29GO1oizK35bG2+355lQbbKzNOnMKeVkdqFl a76A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706021694; x=1706626494; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=FEN215+vp7ZnhP1/JiILPedrshyx5I3UlpHwXzSi3Fg=; b=se5AZ/RspCZZnD/bwXpK/BA4bwj+r+tyTWnS6q4WFk+rUvxTXll8zltcW8ZXf7p+MH GEtGPea/Lxfo3A8FJ06LERVvE5ZRA6CHz2YAPHW53SvrzcI1BOC+lGH0Ps9VLsEv1yuO HU1O+TiU6dKbcFQBGieXhGveIpILVhgZRJ9LWZNNjb9EiCwovE6ej0+d46sXbCGndQeX jKHsVFgKaPyyA5X4f4v+yL6hjWUrvdjlDALg56x6cO31ypKnJkhq/YzjEW9T5daOdIKd lqLBCwHztrMgfnD9SYde9cYPt6dNksSM/Fr57vAQ/PevF3IO6TJacfvoUQcCF9WRu0pF P6kQ== X-Gm-Message-State: AOJu0YxTzBhGkl84wN/u8FLAS2vot3Tr55WVXaX+yQW0sFoM+IVMAjCe VoV90cZELS1hLQD9LWVyCDs+ogO5Az1vJql7qORtjLgeJeM4BSo8wea/5TMJ7UYWRBTEH+TKR/R fTs4Yy1DJMk5TKKkg87ut6L5DkpKGsbBZRwGadwbZSm1adbln8TZgJ33Y/ciumUnLEIS8M+z9Yc ixPaskVCTNZB1316ItjN7+SDNi6+psL3qp7R3TzKfx X-Google-Smtp-Source: AGHT+IFNtVhCMIW9rYikMxFwQj2q6WDjYB7+XsZ0kQ+CUTbns4xEiPhEBU39VNL+yorqQ6tEBpC/ictO X-Received: from palermo.c.googlers.com ([fda3:e722:ac3:cc00:28:9cb1:c0a8:118a]) (user=ardb job=sendgmr) by 2002:a25:d385:0:b0:db5:3ce2:7977 with SMTP id e127-20020a25d385000000b00db53ce27977mr2680947ybf.7.1706021694321; Tue, 23 Jan 2024 06:54:54 -0800 (PST) Date: Tue, 23 Jan 2024 15:53:13 +0100 In-Reply-To: <20240123145258.1462979-52-ardb+git@google.com> Mime-Version: 1.0 References: <20240123145258.1462979-52-ardb+git@google.com> X-Developer-Key: i=ardb@kernel.org; a=openpgp; fpr=F43D03328115A198C90016883D200E9CA6329909 X-Developer-Signature: v=1; a=openpgp-sha256; l=1677; i=ardb@kernel.org; h=from:subject; bh=YJlMcHy0Yl0/2FBKrYcsDu4CFFijocVGx6QsSYsz73g=; b=owGbwMvMwCFmkMcZplerG8N4Wi2JIXX9pVsKi/q1mdK3TZzUnlJbZSA8uSefv/PJLUYm8YtzL 0vcbv/XUcrCIMbBICumyCIw+++7nacnStU6z5KFmcPKBDKEgYtTACYytZXhr4xtypF4N73Pauck /BkkhCyXhK+KnhVRJVEuuPNSV4xRGSPDnClHA/vEttU9eqO62f7Vml8v5+5k1J/8xHN/kydPxte L3AA= X-Mailer: git-send-email 2.43.0.429.g432eaa2c6b-goog Message-ID: <20240123145258.1462979-66-ardb+git@google.com> Subject: [PATCH v7 14/50] arm64: Move feature overrides into the BSS section From: Ard Biesheuvel To: linux-arm-kernel@lists.infradead.org Cc: Ard Biesheuvel , Catalin Marinas , Will Deacon , Marc Zyngier , Mark Rutland , Ryan Roberts , Anshuman Khandual , Kees Cook X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240123_065455_776174_5F0DE025 X-CRM114-Status: GOOD ( 11.38 ) 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 From: Ard Biesheuvel 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 8d1a634a403e..a99ad79adee2 100644 --- a/arch/arm64/kernel/cpufeature.c +++ b/arch/arm64/kernel/cpufeature.c @@ -655,13 +655,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;