From patchwork Tue Nov 15 14:38:22 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 13043773 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 0AA36C433FE for ; Tue, 15 Nov 2022 14:39:58 +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=qiRNP46XKepYWy+PHsXylQeWHZocjgetd9neN0kKaR0=; b=yDKe3qO2czEGdm Ccb/dYm5qBis81vlQdxPyaTk/M9Qzsx8gpfaFSAwz6VPWCU5SGIU8giTd0LBojme27MZhDC6MhVen bDsT5MHV7qsymdBgvK2Cq0c3C6WAqp+ObpUQJ9OesxSI9eiiEnEq3NeSy/oFwEgo1lCiNWpLKgpI2 PGsn059rE9bgGzj5/DzyjDrM0Trwf7ZW+fpfqwKf1ku1hiJMvz4BRca0rlAu5F9norc9M24lyRkF+ fmg1wyl5lDCvhp4L/sTujX2GigQZhk/Rj2IgLJxbwjpY60zdaL/4lmuV+W/4QKnA9acflAEkfgJU2 VLycCdPAVjlTpLmMMKKQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oux5P-00Bwr0-J1; Tue, 15 Nov 2022 14:38:51 +0000 Received: from ams.source.kernel.org ([2604:1380:4601:e00::1]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oux5B-00Bwhy-Kj for linux-arm-kernel@lists.infradead.org; Tue, 15 Nov 2022 14:38:39 +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 ams.source.kernel.org (Postfix) with ESMTPS id 45C0EB81986; Tue, 15 Nov 2022 14:38:36 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 67FF0C433C1; Tue, 15 Nov 2022 14:38:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1668523115; bh=J3AS5GSRCkHKlcwz5GrpOf4c1lQ2IliFcJ6bS66GviQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=XxL9b0tfO6prK5H5iDLA36JFyUAcI6klYoRRPa/fnqFAAIlQ+VjPDUVBDPtreyx3a vyIe1NCXq/6vjo44+kct4xbHfk9pWX/yR3nNgXVedyp+ZNLfaGJiWgYXZAVcESgFIy n4punxKh+wSLvIKLQKviGNFVwOK1WOYCcDxBoLqZr3NbDkcgSZ37Dfh7KdluABu7rY w2CoZBpLFf9LbJgFtG7z9RQNtchGeKfaIoWpoqrGy5xbNb6L7dkOXAMWTK3gBhcxH9 WPdCV5O+wXw2Vf/orAsyWU4TNs8TEI3+iorKspyKJvWN1nzk1p83sJxjef0pkfs5cq M7XAq4NV2NrDg== From: Ard Biesheuvel To: linux-arm-kernel@lists.infradead.org Cc: Ard Biesheuvel , Catalin Marinas , Will Deacon , Mark Rutland , Anshuman Khandual , Joey Gouly Subject: [PATCH 1/3] arm64: mm: get rid of kimage_vaddr global variable Date: Tue, 15 Nov 2022 15:38:22 +0100 Message-Id: <20221115143824.2798908-2-ardb@kernel.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20221115143824.2798908-1-ardb@kernel.org> References: <20221115143824.2798908-1-ardb@kernel.org> MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=2417; i=ardb@kernel.org; h=from:subject; bh=J3AS5GSRCkHKlcwz5GrpOf4c1lQ2IliFcJ6bS66GviQ=; b=owEB7QES/pANAwAKAcNPIjmS2Y8kAcsmYgBjc6Rbq6DPqK8/WTyGHY8I1Aj22GZnm/2eS1gXm06I R4/4p3iJAbMEAAEKAB0WIQT72WJ8QGnJQhU3VynDTyI5ktmPJAUCY3OkWwAKCRDDTyI5ktmPJBA7C/ 9ubXVXOOfkm4xJuZaaVGL9PjqdsH37+llxk2JwmszU4g5ScyABT6E6qbPA6xXa/IhwKs3aKOkYqZ3H H+7P+dutlkK0xwBitHdvAF7kR76LPDpu5PnK12J+PrLpLZ+DP8h0isq+EkNWjeonz6i2Mxs0hyjVZ6 Qyw9eK/UMlc/HzkFPWkUOBcJAoYFuGRwX8Or74nz9LabrAkVRJeR7ICpGAQh/y1A5RVeKqQfEJUw+L 4S3D3P+1ikk+eneYCxohrY6lsveAaQ6w8b/HQx1GYzHTyd8tctqCpvpB7XnlJjeKUvBe27cUyhRfmU P4E6ZzGMmAWC2FvTE4bYEk1EzlbycVVL5Rw/jQIzVPfuBjicG6VaTV/kNKFDuLzb4aGUT2TnQPfpzx i4GMaUXbUze9fiaoLUliWYARRuYhBIqobA/I1TJX41RQ9XZB4Bkqi5tqkVbif3+UWPvsPK7nKIPn6y +EQvKX7mMh67Po5JLeGl+8DdcvpvEUdVyzU64x01iI5rk= 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-20221115_063838_022588_7BAE22EB X-CRM114-Status: GOOD ( 16.87 ) 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 We store the address of _text in kimage_vaddr, but since commit 09e3c22a86f6889d ("arm64: Use a variable to store non-global mappings decision"), we no longer reference this variable from modules so we no longer need to export it. In fact, we don't need it at all so let's just get rid of it. Signed-off-by: Ard Biesheuvel Acked-by: Catalin Marinas --- arch/arm64/include/asm/memory.h | 6 ++---- arch/arm64/kernel/head.S | 2 +- arch/arm64/mm/mmu.c | 3 --- 3 files changed, 3 insertions(+), 8 deletions(-) diff --git a/arch/arm64/include/asm/memory.h b/arch/arm64/include/asm/memory.h index 78e5163836a0ab95..a4e1d832a15a2d7a 100644 --- a/arch/arm64/include/asm/memory.h +++ b/arch/arm64/include/asm/memory.h @@ -182,6 +182,7 @@ #include #include #include +#include #if VA_BITS > 48 extern u64 vabits_actual; @@ -193,15 +194,12 @@ extern s64 memstart_addr; /* PHYS_OFFSET - the physical address of the start of memory. */ #define PHYS_OFFSET ({ VM_BUG_ON(memstart_addr & 1); memstart_addr; }) -/* the virtual base of the kernel image */ -extern u64 kimage_vaddr; - /* the offset between the kernel virtual and physical mappings */ extern u64 kimage_voffset; static inline unsigned long kaslr_offset(void) { - return kimage_vaddr - KIMAGE_VADDR; + return (u64)&_text - KIMAGE_VADDR; } static inline bool kaslr_enabled(void) diff --git a/arch/arm64/kernel/head.S b/arch/arm64/kernel/head.S index 3ea5bf0a6e177e51..3b3c5e8e84af890e 100644 --- a/arch/arm64/kernel/head.S +++ b/arch/arm64/kernel/head.S @@ -399,7 +399,7 @@ SYM_FUNC_START_LOCAL(__primary_switched) str_l x21, __fdt_pointer, x5 // Save FDT pointer - ldr_l x4, kimage_vaddr // Save the offset between + adrp x4, _text // Save the offset between sub x4, x4, x0 // the kernel virtual and str_l x4, kimage_voffset, x5 // physical mappings diff --git a/arch/arm64/mm/mmu.c b/arch/arm64/mm/mmu.c index 6942255056aed5ae..a9714b00f5410d7d 100644 --- a/arch/arm64/mm/mmu.c +++ b/arch/arm64/mm/mmu.c @@ -50,9 +50,6 @@ u64 vabits_actual __ro_after_init = VA_BITS_MIN; EXPORT_SYMBOL(vabits_actual); #endif -u64 kimage_vaddr __ro_after_init = (u64)&_text; -EXPORT_SYMBOL(kimage_vaddr); - u64 kimage_voffset __ro_after_init; EXPORT_SYMBOL(kimage_voffset);