From patchwork Mon Apr 11 09:48:10 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 12808893 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 0B3D7C433EF for ; Mon, 11 Apr 2022 10:06:50 +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=bgq4TmBhOvehkVNPMEt7wF9eFXWdPPowMdOBenqMzT8=; b=SIh16+OkQn1q3Y 8UZqGuh/4Dxl9REp4iAFhmSWMFYXnE4ovvuRCVLP/QwHJQ364WG/jfJsverGNLymuRYHzD+LiEqP3 urSyEcL1mftvDL2RQd1z/3+2ERuvnlAd5BTX1nn3z3VBHoFtAKMGg5p0oTurxClvHVbq7Z+5c0h5o gE4W55G9lGFPGzuU8kNdR+nvJUU6sSDJlDpp2i0T4hjpXSHt044EmxO78JfoWHycKdTVJOWTpFmns QP3BwdVtrq/ANw5ll6Pvz3z1jRVwdRDqK2VZ5qwAOb5otUj132W/RtsjItWv0qrpcDmbhAGfxU8oq 2xGyeIk+8UKwr8P8E+9w==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1ndqvR-008AGD-R0; Mon, 11 Apr 2022 10:05:39 +0000 Received: from dfw.source.kernel.org ([139.178.84.217]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1ndqfi-0082S9-7c for linux-arm-kernel@lists.infradead.org; Mon, 11 Apr 2022 09:49:24 +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 9D8C9611BE; Mon, 11 Apr 2022 09:49:21 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1C949C385A3; Mon, 11 Apr 2022 09:49:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1649670561; bh=NfYHb8uRiznV0/lqv/eaEk57pNDFEjEWBlGAGII44ng=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=IytDfc6GfDj2yUd0gEVJqefXH+eKRx1bbQDZVG0gTGP/+Tzml+HsVy7cXDJZSeG00 2cJ1p+pPqVAX/eiXoEjxzcs2M2wAGstZQQU3+zz8C+74QGgGHrdFE6ISjgeU5NZnLH gHtZZRKfDYywL+o3udfnHZL4+7OBqJm+UwkqWJTaOE0V76jOvo/qLCruhnlM3D6PYz ESGDbnFTT7q3JI9ysePhde0Ad4WTOGPxKfHfqJdrjoKDIAJ7W3igmHsrresvi6xJJm 5+9y4mPasV4eCqzCYJEkp4TV47OQ3+7SJnITQI4tdqmEdE4IYOGd1veCc5vqyaIeAp WNDIDNQ7zxcjg== From: Ard Biesheuvel To: linux-arm-kernel@lists.infradead.org Cc: linux-efi@vger.kernel.org, Ard Biesheuvel , Marc Zyngier , Will Deacon , Mark Rutland , Kees Cook , Catalin Marinas , Mark Brown Subject: [PATCH v3 16/30] arm64: head: factor out TTBR1 assignment into a macro Date: Mon, 11 Apr 2022 11:48:10 +0200 Message-Id: <20220411094824.4176877-17-ardb@kernel.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220411094824.4176877-1-ardb@kernel.org> References: <20220411094824.4176877-1-ardb@kernel.org> MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=1147; h=from:subject; bh=NfYHb8uRiznV0/lqv/eaEk57pNDFEjEWBlGAGII44ng=; b=owEB7QES/pANAwAKAcNPIjmS2Y8kAcsmYgBiU/lPIa2f8ZRyBJCObdKzMYXRfUIFoFzIcKkYCYAJ sOzR5ziJAbMEAAEKAB0WIQT72WJ8QGnJQhU3VynDTyI5ktmPJAUCYlP5TwAKCRDDTyI5ktmPJBYfC/ 918YcRhxMBTDNXqgCUk+7/E6r7rGOSDBYOf37EEfYj0e+vlR+uXaX3Hu5PWOZ7NHp+HOWQI7whcRcC KwjJWibfjeyD7EW4GhFHLr1qi8e7TgiJbgFNC5GqIy7mP8kmWmeGeF/Oc6OojPpjdSTuvD0qyLT6++ TrabAFW+dcohAmNwGdgU3QHnYE9KUDuOIsKDf/h2GvS/EvBXYNmOhsS9oTPqewIQBnubcfkLX5fTpq fVhJlHe24OsNsEtCP5cBq2Bdyx1NnVo3N+jY04/eCFofE/SM8aIWxkjHdd9Ot6IyXtU6f9vatR3H9L NUDVURkaJi3cGpt7aTPMFtqLVNqSZd0DqfQZg2I0KcMx5NbOMB/OTGMpqumLF0659FwMHrHrgqh//a epiCQUztnsrktDkGwXAun6/S6oz+Q5cP4ilJBLhlMK1PTQGDiFvGt2Tud5nH7rnoQWRkb99RyIwG2I xYv7X1aT97xJDy3MgjVMi0Aexwie49Ot2qo5+nH2njQtk= 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-20220411_024922_382989_445D97F5 X-CRM114-Status: GOOD ( 11.76 ) 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 Create a macro load_ttbr1 to avoid having to repeat the same instruction sequence 3 times in a subsequent patch. No functional change intended. Signed-off-by: Ard Biesheuvel --- arch/arm64/kernel/head.S | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/arch/arm64/kernel/head.S b/arch/arm64/kernel/head.S index eae147fabbee..e52429f9a135 100644 --- a/arch/arm64/kernel/head.S +++ b/arch/arm64/kernel/head.S @@ -697,6 +697,13 @@ SYM_FUNC_END(__secondary_too_slow) dc ivac, \tmp1 // Invalidate potentially stale cache line .endm + .macro load_ttbr1, reg, tmp + phys_to_ttbr \reg, \reg + offset_ttbr1 \reg, \tmp + msr ttbr1_el1, \reg + isb + .endm + /* * Enable the MMU. * @@ -718,12 +725,9 @@ SYM_FUNC_START(__enable_mmu) cmp x3, #ID_AA64MMFR0_TGRAN_SUPPORTED_MAX b.gt __no_granule_support update_early_cpu_boot_status 0, x3, x4 - phys_to_ttbr x1, x1 phys_to_ttbr x2, x2 msr ttbr0_el1, x2 // load TTBR0 - offset_ttbr1 x1, x3 - msr ttbr1_el1, x1 // load TTBR1 - isb + load_ttbr1 x1, x3 set_sctlr_el1 x0