From patchwork Fri Jul 13 16:23:35 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christophe Leroy X-Patchwork-Id: 10523793 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 304B56032C for ; Fri, 13 Jul 2018 16:23:41 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1EC732856F for ; Fri, 13 Jul 2018 16:23:41 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 12E5D287CF; Fri, 13 Jul 2018 16:23:41 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=BAYES_00, MAILING_LIST_MULTI, RCVD_IN_DNSWL_NONE autolearn=unavailable version=3.3.1 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A5E42286DB for ; Fri, 13 Jul 2018 16:23:40 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 566056B0266; Fri, 13 Jul 2018 12:23:38 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 4EF006B0269; Fri, 13 Jul 2018 12:23:38 -0400 (EDT) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 3B7EF6B026A; Fri, 13 Jul 2018 12:23:38 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-wm0-f70.google.com (mail-wm0-f70.google.com [74.125.82.70]) by kanga.kvack.org (Postfix) with ESMTP id D6F9A6B0266 for ; Fri, 13 Jul 2018 12:23:37 -0400 (EDT) Received: by mail-wm0-f70.google.com with SMTP id l4-v6so6253841wmh.0 for ; Fri, 13 Jul 2018 09:23:37 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-original-authentication-results:x-gm-message-state:message-id :in-reply-to:references:from:subject:to:cc:date; bh=yKUfx10fUDNYBiZ+BEcSsqZ7Yt63XijWAIIMIE+frts=; b=nSfcwBpARw8lIOr8tGYkR4u1hcY9amONFUO/C/NXJR0q/EXSe7gtDBQCWkXFsnxas7 zhAsHBAg5B8Rlc4Q9sy5bY2A5b3gc36WZ9NU29QkGIyeARE8zZDRbBLrP5giuTLIHg43 zC56Dw2xbsZRgr6xFVwCtY2gBucM1YPvBXshCeX1ae5YuhteAmij7Fd10mAwz8fLuteW 1SONNJ+4qykzfkow149x4llH9NNVX33Mx4j60Rgpl+t9YuUuzjyRpFCFP/ml+oV4DYHS Kv8c97vDxwAgQrNgPPhAkdvey7HVPUh3YmzlVUqIpm7cDHflkJTxDxVKlPkaw84kdjmC ZMgg== X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of christophe.leroy@c-s.fr designates 93.17.236.30 as permitted sender) smtp.mailfrom=christophe.leroy@c-s.fr X-Gm-Message-State: AOUpUlG8sjgMCY/++XcQgzFEgwy4c7WFsHSj62Ja/sJNx0CRnV2h/wCQ e/pU1haSXIu1IFN7U5wVt58qRJ31W0TyfHTyBXPOQVWXR3dwmVWn2FcNMDsaZDuJXGlI2L08CTp CdWjgb4uzmNPhsk5OZB5j0HMmwf7N28JXtAMf97tQ5u06vRKyxto0H054DceA7jmpAw== X-Received: by 2002:adf:a211:: with SMTP id p17-v6mr5396850wra.196.1531499017449; Fri, 13 Jul 2018 09:23:37 -0700 (PDT) X-Google-Smtp-Source: AAOMgpfTy+/x8rzaQgwc8pMSbq8TsYUsB/xwYGOySluAK3IkhyiN680s18/3LskATABoC701zNi0 X-Received: by 2002:adf:a211:: with SMTP id p17-v6mr5396812wra.196.1531499016677; Fri, 13 Jul 2018 09:23:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1531499016; cv=none; d=google.com; s=arc-20160816; b=WAxWGIp4WBE2FQKuf6qtteS+k3zIgMalJrhaQhb+2fF7vL+BGa+0xKNR6M3OxF4z7x ZXtum2aloP7MRaGH//s+H8yc2o+CHzLwEkcWaL5IU8kZJnFoBpxCNBV8PDuRevzAV3bA 600r1uEVXTj6bj9HzQ6iGOY3j64xmeOJqFFHEA4isR0m5BuWHDv30sDHRmDpV3twbMQ8 33fPLi8sQHiN7yowo8PTToGb8ELt4rrM3C66xuXcH/HLOcM8WQI4eIbvLMyyfhvONJIP pY7o7LLRHtv7zfutuj1M1Jw2VWd9GrrVi/TE8cFY5KYSmCjcr1wwiQaT7a2ap6Bl2QbK ZxpA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=date:cc:to:subject:from:references:in-reply-to:message-id :arc-authentication-results; bh=yKUfx10fUDNYBiZ+BEcSsqZ7Yt63XijWAIIMIE+frts=; b=TR3I2h4Cf03aeJgJ5N8DxRZ17/qHzhhRlUOzrtztMBVkyDy/iAb4+cBBa7YH9eIyUb o90s1nHanYkAi+VaofM7kDZdi1LXbT6Z0HPdRtZtjh7oXKZDzvKnyKFV1N/YlODsVGNS 1eljV6/iXHa5isbELLuTMCncGholIci3nXKdLSf5WheqL0j39tZinMoCPXwfMxWk1o8a iqV9mo2s28tKftxX/bcaoiLGBHJs48TIi1i0KXtaLdK3ix+7KROUZtsENy1IPs3RgGK+ sWnBUq5qHpKsJLWJ4LBdAksYp8NqCHjYtoO2dMiQnZoqZAmrGuK9u2xw1a9R7A4dWZ1Q Ob+w== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of christophe.leroy@c-s.fr designates 93.17.236.30 as permitted sender) smtp.mailfrom=christophe.leroy@c-s.fr Received: from pegase1.c-s.fr (pegase1.c-s.fr. [93.17.236.30]) by mx.google.com with ESMTPS id f4-v6si10956315wrg.265.2018.07.13.09.23.36 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 13 Jul 2018 09:23:36 -0700 (PDT) Received-SPF: pass (google.com: domain of christophe.leroy@c-s.fr designates 93.17.236.30 as permitted sender) client-ip=93.17.236.30; Authentication-Results: mx.google.com; spf=pass (google.com: domain of christophe.leroy@c-s.fr designates 93.17.236.30 as permitted sender) smtp.mailfrom=christophe.leroy@c-s.fr Received: from localhost (mailhub1-int [192.168.12.234]) by localhost (Postfix) with ESMTP id 41Rylq6Ltdz9ttlB; Fri, 13 Jul 2018 18:23:19 +0200 (CEST) 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 ewPGxGEoDcWw; Fri, 13 Jul 2018 18:23:19 +0200 (CEST) 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 41Rylq5m51z9ttCT; Fri, 13 Jul 2018 18:23:19 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by messagerie.si.c-s.fr (Postfix) with ESMTP id 18CD28B8A8; Fri, 13 Jul 2018 18:23:36 +0200 (CEST) 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 Vo1MaRznH_HC; Fri, 13 Jul 2018 18:23:36 +0200 (CEST) Received: from po14934vm.idsi0.si.c-s.fr (po15451.idsi0.si.c-s.fr [172.25.231.4]) by messagerie.si.c-s.fr (Postfix) with ESMTP id E8B018B75A; Fri, 13 Jul 2018 18:23:35 +0200 (CEST) Received: by po14934vm.idsi0.si.c-s.fr (Postfix, from userid 0) id DA8F5711EC; Fri, 13 Jul 2018 16:23:35 +0000 (UTC) Message-Id: <420238301eff4c95b6fb28744327417947c13bf8.1531498345.git.christophe.leroy@c-s.fr> In-Reply-To: References: From: Christophe Leroy Subject: [RFC PATCH v1 3/4] 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, linux-mm@kvack.org Date: Fri, 13 Jul 2018 16:23:35 +0000 (UTC) X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: X-Virus-Scanned: ClamAV using ClamSMTP 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 2b4c40b255e4..70e9dbdc55f5 100644 --- a/arch/powerpc/kernel/Makefile +++ b/arch/powerpc/kernel/Makefile @@ -89,7 +89,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 6a394b9e109e..1c62f81cb257 100644 --- a/arch/powerpc/kernel/setup_32.c +++ b/arch/powerpc/kernel/setup_32.c @@ -60,32 +60,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