Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp539838imu; Thu, 20 Dec 2018 00:57:34 -0800 (PST) X-Google-Smtp-Source: AFSGD/UKKUKn6OnCOoizVgVu8EidawcFQNwQxbBD5FCcdpKC+EbJnb94esZsJ4fr0WojVlL2WRvL X-Received: by 2002:a17:902:20c8:: with SMTP id v8mr23735366plg.319.1545296254771; Thu, 20 Dec 2018 00:57:34 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1545296254; cv=none; d=google.com; s=arc-20160816; b=R66YEUYCI1gyYu9da+/mKWYg4mruWqZXVoYW9E0nymq2vtYo4+jZdFqz366CJH2Xw6 /hKyD4wZcRloI0E3y7iHDXk2ppa6AE7uISSwk5YXx4BIqqYCPJOqVEUTIv2gIjEIT7zl UScyRC3sgv8ThZTx4Dz6Ok2i2d/vjfMYUzwIIwN3HHyCS+gobLIMyuC3OCZJRFDx2iW+ PFWNYkxPcqykgcBPI1gxJtcpW2veLCJQ7rPhvZmWl4pb5YNUymFhlYG10WzquJoWL5Ud eEG3Y7ozERRYKbmcJUp5S2wxKN83+naXuSgT/oj5duZkklosQzMd+m7GypX37qC3483g GP5Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:date:cc:to:subject:from:references :in-reply-to:message-id; bh=ycxWRwsACVQ6iEWszo/xJp8tIGdvq2AMRtRk02hMLe4=; b=xurawfpoeoMgQ5dt7/cgFiui3OCB8c70TJo7JlKOr9fCrDibqzpFdTihV0pfODzHwy WhvCRs7UvHOldsBfzDGi5Tz+SosiSvxanmqRaaN0PZ8orZIQvN5XdsH70KT7ntuIUs/J +LHP4lQ3CgeIO+1N+iaed8RTQYRobiF7lXeGATxKGnxuVcFKjyfD0aI2hjP/Uv1ylePz /FkMFNFBHCi/JzdyDoWQn3qe2MJdXgRMtHGTJBDduGRYNmxA2w8VLOxEqRph7h1RWc2y krOyWmJORUPrzToFjmtplFE2S/Qzlm8oObQkR8vNsl3TsDEw4x0IA0um8c1nS14hJe8P I5aA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v16si17815113pgc.519.2018.12.20.00.57.18; Thu, 20 Dec 2018 00:57:34 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729350AbeLTGkm (ORCPT + 99 others); Thu, 20 Dec 2018 01:40:42 -0500 Received: from pegase1.c-s.fr ([93.17.236.30]:65198 "EHLO pegase1.c-s.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729188AbeLTGkk (ORCPT ); Thu, 20 Dec 2018 01:40:40 -0500 Received: from localhost (mailhub1-int [192.168.12.234]) by localhost (Postfix) with ESMTP id 43L2Ff09V2z9vGxr; Thu, 20 Dec 2018 07:40:38 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at c-s.fr Received: from pegase1.c-s.fr ([192.168.12.234]) by localhost (pegase1.c-s.fr [192.168.12.234]) (amavisd-new, port 10024) with ESMTP id 0VqwJaeUttQj; Thu, 20 Dec 2018 07:40:37 +0100 (CET) Received: from messagerie.si.c-s.fr (messagerie.si.c-s.fr [192.168.25.192]) by pegase1.c-s.fr (Postfix) with ESMTP id 43L2Fd6k7nz9vB1r; Thu, 20 Dec 2018 07:40:37 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by messagerie.si.c-s.fr (Postfix) with ESMTP id C73DD8B796; Thu, 20 Dec 2018 07:40:38 +0100 (CET) X-Virus-Scanned: amavisd-new at c-s.fr Received: from messagerie.si.c-s.fr ([127.0.0.1]) by localhost (messagerie.si.c-s.fr [127.0.0.1]) (amavisd-new, port 10023) with ESMTP id ySZcOI9sDbty; Thu, 20 Dec 2018 07:40:38 +0100 (CET) Received: from po14163vm.idsi0.si.c-s.fr (unknown [192.168.4.90]) by messagerie.si.c-s.fr (Postfix) with ESMTP id 88B4E8B755; Thu, 20 Dec 2018 07:40:38 +0100 (CET) Received: by po14163vm.idsi0.si.c-s.fr (Postfix, from userid 0) id 5AF9B71733; Thu, 20 Dec 2018 06:40:38 +0000 (UTC) Message-Id: <1f8a5847e7af2fe7de9475f4e91c8bd92fc2b1c8.1545287470.git.christophe.leroy@c-s.fr> In-Reply-To: References: From: Christophe Leroy Subject: [RFC PATCH v2 2/3] powerpc/32: Move early_init() in a separate file To: Benjamin Herrenschmidt , Paul Mackerras , Michael Ellerman , npiggin@gmail.com, aneesh.kumar@linux.ibm.com Cc: linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org Date: Thu, 20 Dec 2018 06:40:38 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org In preparation of KASAN, move early_init() into a separate file in order to allow deactivation of KASAN for that function. Signed-off-by: Christophe Leroy --- arch/powerpc/kernel/Makefile | 2 +- arch/powerpc/kernel/early_32.c | 35 +++++++++++++++++++++++++++++++++++ arch/powerpc/kernel/setup_32.c | 26 -------------------------- 3 files changed, 36 insertions(+), 27 deletions(-) create mode 100644 arch/powerpc/kernel/early_32.c diff --git a/arch/powerpc/kernel/Makefile b/arch/powerpc/kernel/Makefile index a5a6a243f3cf..e9a9419b98b6 100644 --- a/arch/powerpc/kernel/Makefile +++ b/arch/powerpc/kernel/Makefile @@ -93,7 +93,7 @@ extra-y += vmlinux.lds obj-$(CONFIG_RELOCATABLE) += reloc_$(BITS).o -obj-$(CONFIG_PPC32) += entry_32.o setup_32.o +obj-$(CONFIG_PPC32) += entry_32.o setup_32.o early_32.o obj-$(CONFIG_PPC64) += dma-iommu.o iommu.o obj-$(CONFIG_KGDB) += kgdb.o obj-$(CONFIG_BOOTX_TEXT) += btext.o diff --git a/arch/powerpc/kernel/early_32.c b/arch/powerpc/kernel/early_32.c new file mode 100644 index 000000000000..b3e40d6d651c --- /dev/null +++ b/arch/powerpc/kernel/early_32.c @@ -0,0 +1,35 @@ +// SPDX-License-Identifier: GPL-2.0 + +/* + * Early init before relocation + */ + +#include +#include +#include +#include + +/* + * We're called here very early in the boot. + * + * Note that the kernel may be running at an address which is different + * from the address that it was linked at, so we must use RELOC/PTRRELOC + * to access static data (including strings). -- paulus + */ +notrace unsigned long __init early_init(unsigned long dt_ptr) +{ + unsigned long offset = reloc_offset(); + + /* First zero the BSS */ + memset(PTRRELOC(&__bss_start), 0, __bss_stop - __bss_start); + + /* + * Identify the CPU type and fix up code sections + * that depend on which cpu we have. + */ + identify_cpu(offset, mfspr(SPRN_PVR)); + + apply_feature_fixups(); + + return KERNELBASE + offset; +} diff --git a/arch/powerpc/kernel/setup_32.c b/arch/powerpc/kernel/setup_32.c index 00b8f54fed29..62efe32d890d 100644 --- a/arch/powerpc/kernel/setup_32.c +++ b/arch/powerpc/kernel/setup_32.c @@ -64,32 +64,6 @@ EXPORT_SYMBOL(DMA_MODE_READ); EXPORT_SYMBOL(DMA_MODE_WRITE); /* - * We're called here very early in the boot. - * - * Note that the kernel may be running at an address which is different - * from the address that it was linked at, so we must use RELOC/PTRRELOC - * to access static data (including strings). -- paulus - */ -notrace unsigned long __init early_init(unsigned long dt_ptr) -{ - unsigned long offset = reloc_offset(); - - /* First zero the BSS */ - memset(PTRRELOC(&__bss_start), 0, __bss_stop - __bss_start); - - /* - * Identify the CPU type and fix up code sections - * that depend on which cpu we have. - */ - identify_cpu(offset, mfspr(SPRN_PVR)); - - apply_feature_fixups(); - - return KERNELBASE + offset; -} - - -/* * This is run before start_kernel(), the kernel has been relocated * and we are running with enough of the MMU enabled to have our * proper kernel virtual addresses -- 2.13.3