From patchwork Thu Nov 24 12:39:18 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 13054931 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 429F2C43217 for ; Thu, 24 Nov 2022 12:42:44 +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=ECRn96/8I+FtR9zgxxkaAQT8m2Zu9gT0a0JapRqH484=; b=ZxF86VqbRDq53y XRD7pdebmpaut+Q1HQeNMtyraKfQ2OL3/9XlXSyLy1C77XHqb/lMx02kF07PcQdDqKTSvUCvbHT+x TSA70KHK50gVNACQdE8EzGG7orCS0JpbTCGJ3+ZfxTk05aOwTkVuL2iv6gQaPHUB7mS9rj1Ed0ir7 tbatjaiprc/SpTqJQDBibfQ5jBVOf+nBLngLLlkK4jLaLD7MV1B2GAuFpnFhgRgngURVfuWkp/whI IcgA0UB6s1WR0b1iZiN1oHIjEtqCkqRsWacdL2LALUnEkfdzMqDgwuGWC1g/48wbzLWZmP97NYC8P rmfhFpk/CCQ2XWfluRFg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oyBXs-008P6d-LI; Thu, 24 Nov 2022 12:41:37 +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 1oyBWS-008OOm-4O for linux-arm-kernel@lists.infradead.org; Thu, 24 Nov 2022 12:40:09 +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 B5412B827C8; Thu, 24 Nov 2022 12:40:06 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id CF02BC43145; Thu, 24 Nov 2022 12:40:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1669293606; bh=Q5CdlRQ+4LrdUUjU3nMXjbb2w+TFiPv1YFvplNTaYkc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=R74BDQS62Iw+mUKhsJ8jPpmoP7iU5XtkFeKXG1YVd65eGqvrY4YGywpZviuJzw1nG u+rAZTzYd+jztI7f4ZgRygkbUokKjOw/6wPUXPFG01dvXyCUOijsIQnZyNADM88n6/ QoKuqhPl72qLJUZytlAqRvvZBouOaU9mhOXOCL/9MlwT91fVMPjNOfLLHf3tbJxRU3 pTLd5X6x7CFwqKSXCltoBkvTOUKTz5JmmbXON2DGJ7BQWPEypYVwwym7imYk9VV6bK ktgLUhNnuKJzwXU1nAh6aw54iCRrAIIATUjTeRC8LzBWH2NnZbp64a3/Mx1OdCluFV czvJSHT8uIxWA== From: Ard Biesheuvel To: linux-arm-kernel@lists.infradead.org Cc: Ard Biesheuvel , Marc Zyngier , Will Deacon , Mark Rutland , Kees Cook , Catalin Marinas , Mark Brown , Anshuman Khandual , Richard Henderson , Ryan Roberts Subject: [PATCH v2 05/19] arm64: mm: get rid of kimage_vaddr global variable Date: Thu, 24 Nov 2022 13:39:18 +0100 Message-Id: <20221124123932.2648991-6-ardb@kernel.org> X-Mailer: git-send-email 2.38.1.584.g0f3c55d4c2-goog In-Reply-To: <20221124123932.2648991-1-ardb@kernel.org> References: <20221124123932.2648991-1-ardb@kernel.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20221124_044008_493711_5C8B51C8 X-CRM114-Status: GOOD ( 17.17 ) 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 --- 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 78e5163836a0..a4e1d832a15a 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 3ea5bf0a6e17..3b3c5e8e84af 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 222c1154b550..d083ac6a0764 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);