Received: by 2002:a05:6358:9144:b0:117:f937:c515 with SMTP id r4csp1924381rwr; Fri, 28 Apr 2023 03:55:37 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5MwoLzHl5KE4uVw6UsUzf9iOUMT9XiDjKCrhGVzh6c47tkOZyGCojfXjLlUvo/kku0fiN9 X-Received: by 2002:a05:6a20:e188:b0:f2:6eeb:211b with SMTP id ks8-20020a056a20e18800b000f26eeb211bmr5459766pzb.37.1682679336808; Fri, 28 Apr 2023 03:55:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1682679336; cv=none; d=google.com; s=arc-20160816; b=MMFSzDXHz0wQSID9Z9RwgTAdK2Ikyg4HMqq76xy+/IQ9GQFrzEMrZ0PPAVAygmqW3n XX/oQz6YTA3C7k+s73d3jEzc4gVyT4U69m9O5B61CYA/Z5e9NfwSvvjnUeqjxLu6Gwrq gE+B8SsM8oIATwWT6ZBEkQB721KLr2W3ZatByI5If4wA5E+CTTI33eodpWO7zjdCsDGN JEx3E8OVB3S//nAD7zEK1qF38tV4RbBS/OSXA5sUZrFqOTxXTLhILhXbSX9RbalCVxCb rSbXkg0650ndmFqVhqc4Y0yFvrjkqGeAgd1BWribrUqT82kxHFCapTbhekCrlkoN+XRx mrVQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date; bh=ObId3lc4E85/opOcABQN6hNyS34nEsVFfFvllSbLMOk=; b=QeaS9ppThtCEbhC/qrJ/Rkjhy1bvtkAs1Iw+ay90c3zxUNnDdFo8Znu1Q4UDD0cb2b rI+0Q2ggQfAfp+tgo5CrZ8XJq+45dcAXJRYqw88EDowrGwo8PqjQ2b+ONzaCVVRtBymf uSzCKSlBEDD2WkpGpQufaW6JW9e/be7a4/8Ft+cpM+Tg9dr8hoYN0d5FeFBDEexpgl+q DKqLGJ2LsN/BaanYrkxE2beJi3NXYMFbkXjtigpq5nPSckvzPxzZh0XeKPqydIrnGdm6 ZkyTtdd+qowz6hLn1NYU1moECHrd8rkXmCp194LzUzAoWajyz/lexsF+N3cAAsIkMlAh PqMA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id q17-20020a632a11000000b0051b8ecaffd0si8905069pgq.395.2023.04.28.03.55.23; Fri, 28 Apr 2023 03:55:36 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231822AbjD1KnF (ORCPT + 99 others); Fri, 28 Apr 2023 06:43:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39918 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230106AbjD1KnD (ORCPT ); Fri, 28 Apr 2023 06:43:03 -0400 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 428A8E76 for ; Fri, 28 Apr 2023 03:43:00 -0700 (PDT) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 1C532C14; Fri, 28 Apr 2023 03:43:44 -0700 (PDT) Received: from FVFF77S0Q05N (unknown [10.57.21.9]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id AAB963F64C; Fri, 28 Apr 2023 03:42:58 -0700 (PDT) Date: Fri, 28 Apr 2023 11:42:56 +0100 From: Mark Rutland To: Ard Biesheuvel Cc: linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Catalin Marinas , Will Deacon , Marc Zyngier , Ryan Roberts , Anshuman Khandual , Kees Cook Subject: Re: [PATCH v3 03/60] arm64: mm: get rid of kimage_vaddr global variable Message-ID: References: <20230307140522.2311461-1-ardb@kernel.org> <20230307140522.2311461-4-ardb@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230307140522.2311461-4-ardb@kernel.org> X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Mar 07, 2023 at 03:04:25PM +0100, Ard Biesheuvel wrote: > 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: Mark Rutland Mark. > --- > 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 b98970907226b36c..65cdaaa2c859418f 100644 > --- a/arch/arm64/kernel/head.S > +++ b/arch/arm64/kernel/head.S > @@ -482,7 +482,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 6f9d8898a02516f6..81e1420d2cc13246 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); > > -- > 2.39.2 > >