From patchwork Mon Mar 6 04:00:33 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Randy Dunlap X-Patchwork-Id: 64425 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp1647792wrd; Sun, 5 Mar 2023 20:04:16 -0800 (PST) X-Google-Smtp-Source: AK7set+6PtDExxqVzDs4zmqwqmlqc47h7+4gjWhDWccnW5v3HEj+GOtEG7IyNirCckTIeXKT1I2B X-Received: by 2002:a62:1850:0:b0:5a8:ab3d:3fe with SMTP id 77-20020a621850000000b005a8ab3d03femr8904637pfy.16.1678075455718; Sun, 05 Mar 2023 20:04:15 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1678075455; cv=none; d=google.com; s=arc-20160816; b=dUEgkGrR9kCqY03K5N0HirnB8k5yWn/zxNlAwckuqPaPQug0ldgoHcGb4rjmR+hdIL R9LzsNrNFx0KGjlyoovoU1DjtY62kJIwsnCCdcV26vgIn1ilJNlCHWJ0SA2sYFwsx5eK zVOAt65cRuFsBnp+ga/XxcMUgECgbGy4jjo02qYy/E4eDpPlMLvhzBlA580q95q7Bv5P DnpprhE2hwZ4mwK9G2wONgl5u40h/rca6RI15YX1WLPsO2zLi2oG9khD04afTDLsuVT6 eF7D625vGFDR8MEkj+VnH48+0SS4ONW//vOPnFVFkZYVmVaLgNsGtoGZP7nqjObqOdRo FAJw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=UhjsCF+rddzzypyrP6fAf9gWJ0k8iBH1lmCoUVV1gpY=; b=UTiHB7ZMt/e4B21QOMqe1qkQvQ3lOVaKJHiiVNVBan+G8z+1mswgIU1Q5Cfii008ql a187rvhDP60daaBofTP2k3ChazG1MhQibDCAuKjJbieAAqDeSs3IfVYVkatQ9xItn+m4 k5deUXdFT6QDctuUCdzRYInyJHC1BR0UPAATKGWiLL9aSGAUHbprSlFAPgpOfFPCX08m XDfAhi3OFLWNfksAcTADc9hd43ftFeppu+CmT+e+DqmkMg2U3uC8EnEdn8ubd4WJ1OCO dSuqSHXsrBw5oQ5+vhLekqh/Wuk8qwQ0l3jwvGQHmEEbYRraNbj2xvzCygDD/UbNKXjv wNHA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=bombadil.20210309 header.b=4+eLkNkd; 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 Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id v27-20020aa799db000000b005a8efbddf5esi9418608pfi.238.2023.03.05.20.04.03; Sun, 05 Mar 2023 20:04:15 -0800 (PST) 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; dkim=pass header.i=@infradead.org header.s=bombadil.20210309 header.b=4+eLkNkd; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229811AbjCFEAs (ORCPT + 99 others); Sun, 5 Mar 2023 23:00:48 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34312 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229684AbjCFEAo (ORCPT ); Sun, 5 Mar 2023 23:00:44 -0500 Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:3::133]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1391FF764; Sun, 5 Mar 2023 20:00:43 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender :Reply-To:Content-Type:Content-ID:Content-Description; bh=UhjsCF+rddzzypyrP6fAf9gWJ0k8iBH1lmCoUVV1gpY=; b=4+eLkNkdnjDWSXISs50Rh16wOU eWs4XaJTu6YSNuFj9fIjj/06b6S2VLIFPc+huvqMY6RwtgtbU5QAM6kn9bh+AmnfZnbIkvnWSzj7d lGhCFcaEjMH9AQrtl2E6eVA8kfR7RHLYAJbovKNyOtroF66rIXxrli/vS2Kdq+0B/N7VXW4adis2T ZDxpPFGFf4stqhZrj4iepC0PurUxSq3PUjOZqK3Fsv1DjlAsA2/EGmW/4I+ZQdAgISUFxJq6a4Zsz ZXpIEmR76bGq652+QzZBk6UEm2vHJdmA889Hwua/q472BtlcS4OIeLE/Fr78NcNQD/3NCbsAOK1DU K45Wekuw==; Received: from [2601:1c2:980:9ec0::df2f] (helo=bombadil.infradead.org) by bombadil.infradead.org with esmtpsa (Exim 4.94.2 #2 (Red Hat Linux)) id 1pZ21h-00B9yD-5Q; Mon, 06 Mar 2023 04:00:41 +0000 From: Randy Dunlap To: linux-kernel@vger.kernel.org Cc: Randy Dunlap , Rob Herring , Frank Rowand , devicetree@vger.kernel.org, Rich Felker , Yoshinori Sato , Geert Uytterhoeven , John Paul Adrian Glaubitz , linux-sh@vger.kernel.org, stable@vger.kernel.org Subject: [PATCH 3/7 v4] sh: init: use OF_EARLY_FLATTREE for early init Date: Sun, 5 Mar 2023 20:00:33 -0800 Message-Id: <20230306040037.20350-4-rdunlap@infradead.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230306040037.20350-1-rdunlap@infradead.org> References: <20230306040037.20350-1-rdunlap@infradead.org> MIME-Version: 1.0 X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_NONE 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1759589649149714246?= X-GMAIL-MSGID: =?utf-8?q?1759589649149714246?= When CONFIG_OF_EARLY_FLATTREE and CONFIG_SH_DEVICE_TREE are not set, SH3 build fails with a call to early_init_dt_scan(), so in arch/sh/kernel/setup.c and arch/sh/kernel/head_32.S, use CONFIG_OF_EARLY_FLATTREE instead of CONFIG_OF_FLATTREE. Fixes this build error: ../arch/sh/kernel/setup.c: In function 'sh_fdt_init': ../arch/sh/kernel/setup.c:262:26: error: implicit declaration of function 'early_init_dt_scan' [-Werror=implicit-function-declaration] 262 | if (!dt_virt || !early_init_dt_scan(dt_virt)) { Fixes: 03767daa1387 ("sh: fix build regression with CONFIG_OF && !CONFIG_OF_FLATTREE") Fixes: eb6b6930a70f ("sh: fix memory corruption of unflattened device tree") Signed-off-by: Randy Dunlap Suggested-by: Rob Herring Cc: Frank Rowand Cc: devicetree@vger.kernel.org Cc: Rich Felker Cc: Yoshinori Sato Cc: Geert Uytterhoeven Cc: John Paul Adrian Glaubitz Cc: linux-sh@vger.kernel.org Cc: stable@vger.kernel.org Reviewed-by: John Paul Adrian Glaubitz --- v2: use Suggested-by: for Rob. add more Cc's. v3: skipped v4: update Cc's, refresh & resend arch/sh/kernel/head_32.S | 6 +++--- arch/sh/kernel/setup.c | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff arch/sh/kernel/setup.c arch/sh/kernel/setup.c diff -- a/arch/sh/kernel/setup.c b/arch/sh/kernel/setup.c --- a/arch/sh/kernel/setup.c +++ b/arch/sh/kernel/setup.c @@ -244,7 +244,7 @@ void __init __weak plat_early_device_set { } -#ifdef CONFIG_OF_FLATTREE +#ifdef CONFIG_OF_EARLY_FLATTREE void __ref sh_fdt_init(phys_addr_t dt_phys) { static int done = 0; @@ -326,7 +326,7 @@ void __init setup_arch(char **cmdline_p) /* Let earlyprintk output early console messages */ sh_early_platform_driver_probe("earlyprintk", 1, 1); -#ifdef CONFIG_OF_FLATTREE +#ifdef CONFIG_OF_EARLY_FLATTREE #ifdef CONFIG_USE_BUILTIN_DTB unflatten_and_copy_device_tree(); #else diff -- a/arch/sh/kernel/head_32.S b/arch/sh/kernel/head_32.S --- a/arch/sh/kernel/head_32.S +++ b/arch/sh/kernel/head_32.S @@ -64,7 +64,7 @@ ENTRY(_stext) ldc r0, r6_bank #endif -#ifdef CONFIG_OF_FLATTREE +#ifdef CONFIG_OF_EARLY_FLATTREE mov r4, r12 ! Store device tree blob pointer in r12 #endif @@ -315,7 +315,7 @@ ENTRY(_stext) 10: #endif -#ifdef CONFIG_OF_FLATTREE +#ifdef CONFIG_OF_EARLY_FLATTREE mov.l 8f, r0 ! Make flat device tree available early. jsr @r0 mov r12, r4 @@ -346,7 +346,7 @@ ENTRY(stack_start) 5: .long start_kernel 6: .long cpu_init 7: .long init_thread_union -#if defined(CONFIG_OF_FLATTREE) +#if defined(CONFIG_OF_EARLY_FLATTREE) 8: .long sh_fdt_init #endif