Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp21231imm; Wed, 5 Sep 2018 14:11:50 -0700 (PDT) X-Google-Smtp-Source: ANB0VdatnJfvyClwoxChGO/6XNqA3shgk+fg4nGmBoU0lzqTjf9iU6vcOiChIWFUz0Ih2IwRYBfk X-Received: by 2002:a17:902:1681:: with SMTP id h1-v6mr1437593plh.226.1536181910943; Wed, 05 Sep 2018 14:11:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1536181910; cv=none; d=google.com; s=arc-20160816; b=tGKlm/F6v0FUqAsSeIBAd+IdCXUbfB3S/KU+4/cQInlqF2UmyTcE1uZCvNYCfwrLNA JGHA3x5o9MRYQ6dq2O/fpfZQFUxNb93ipnl9RauRVoXyUv49JZ2jrsj4QfYjklXwIHcT b3FoQ/67aAqSHxo6iUo9JD5EtvSNtmQM3hrxBUjf3QzAHokej3E1NaaqIU9EX4t8KfKS GK1q0/wXwTNXm+GnzEK3w+saPitBUBJp2XBH+O/TMx0Tk1egtiBspJ/fRGqi1TP0qMxQ zpZhB2FLZfrtPNruywp/CpfOTHuwzkdTboYHb61Oq57tQp4KVltfSvnGjzlwfIVf18SO iqGA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature; bh=bLxx4+BtfCVbb+iBGRJl8fInfXNLFvBN+tvCisdL0E0=; b=pXeJtyXX8z3AgMGZprkpf/shc7gpGURVGRcwgiDN+8OpSi/PM8HfY/1W2HoHLfl4Nv VYirocN4JZo5Jcdzo1qYHYuq3jISswJJij+XgUuztIYV6np8HU064HPvsoYIkN6i0fzS P6Ku2ARyVIv/oxViKieaUta0nbG16U5ecHGaEOkSCeUvmJhrudPzau3aMsHr29mCVmVt b9BGSTSE9nbJUBxG3wyBYBKrnKScmHmw3NU6no47UZRrHlkel+cJu3LqqH+VIbQjKZPd eqErp6BW93fKjUCSVG0tiPTUXTJpx9/XIIjdZG52SiZOfvFvHarmTU0iMDm7ne0+jRP7 2VZA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=gpvrcv8r; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b2-v6si2864065plx.121.2018.09.05.14.11.35; Wed, 05 Sep 2018 14:11:50 -0700 (PDT) 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; dkim=pass header.i=@gmail.com header.s=20161025 header.b=gpvrcv8r; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727665AbeIFBmJ (ORCPT + 99 others); Wed, 5 Sep 2018 21:42:09 -0400 Received: from mail-pf1-f195.google.com ([209.85.210.195]:33590 "EHLO mail-pf1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727069AbeIFBmJ (ORCPT ); Wed, 5 Sep 2018 21:42:09 -0400 Received: by mail-pf1-f195.google.com with SMTP id d4-v6so4112609pfn.0; Wed, 05 Sep 2018 14:10:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=bLxx4+BtfCVbb+iBGRJl8fInfXNLFvBN+tvCisdL0E0=; b=gpvrcv8r/CD1bBubsXwFRTUazQTWHKKPXZa3c/u1VJBz5l5FLkkP2/qwV7nHyyqIN2 KucI2XwmRNQN7ZSMKxjJMFomtkJuxuvo5KdGdhol+eccwDqn/E33XsjxTElNFoeXzh5B X4GC3tRFbzdYnXgLAJmYlQ4t1QqOCHY3sUWQiik2ewc9BKmKpNB3+7mquUPwUC10yWv6 an91nwNM3gikWKgbBvsbeXleVk3sVQnnrSkCyhJb4BPIqXMK1GNEp09FTvUilYR1F3Us NQNxZxs5kVrPNcgdqBbXqO/BUvZFaZEU7KRLu16syjeImCG4GiSoLFpLUPaIO/ed6sQ0 SipA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=bLxx4+BtfCVbb+iBGRJl8fInfXNLFvBN+tvCisdL0E0=; b=FGQJW4Ev02Wm4HiYaNeDvEd86S/7HKybGD3fh9oJXjqK+6nc6hp0LC6VCIjQyZhyFl 3i0DJvI8NjIpAZoivcjj55cxmbULDJYorHTjHTV17t1hVyybt0gMyTUlihGfqRbW+jQ+ tO7dYMs1vmETBVwpQRNaptzAs5owJzWnJz1C/6lN87GFwetHrzBPuMitI/BqqLRbwsiF oDzJrdVhfidrxgETDs7Rh9QQ21EdB3E/TOeawMErEqRza7tdyqUQnV1GjL1X7L2Sea03 pNX6DSv8YYF9CzxgmyoxzM4ptrhIKSk0H/HmHc+yvcouDHK1N8BO+TA8gNPzljZyCmNp BNSQ== X-Gm-Message-State: APzg51BAXscFibV67HkS7B8t44jOUdzZH/SPhO1EK99TVG8Ysfskx3dU /oVJ2do0VLQzU1USKfeFIQQ= X-Received: by 2002:a62:2646:: with SMTP id m67-v6mr42798690pfm.254.1536181810178; Wed, 05 Sep 2018 14:10:10 -0700 (PDT) Received: from [192.168.1.70] (c-24-6-192-50.hsd1.ca.comcast.net. [24.6.192.50]) by smtp.gmail.com with ESMTPSA id n9-v6sm7826589pfg.21.2018.09.05.14.10.09 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 05 Sep 2018 14:10:09 -0700 (PDT) Subject: Re: [PATCH 1/3] of/fdt: Scan the root node properties earlier To: Rob Herring Cc: devicetree@vger.kernel.org, "linux-kernel@vger.kernel.org" References: <20180830190523.31474-1-robh@kernel.org> <20180830190523.31474-2-robh@kernel.org> <5da7b4ab-acd3-977a-6ac2-275911d7c436@gmail.com> From: Frank Rowand Message-ID: <00433395-ec1e-8a2c-cb88-5db659967643@gmail.com> Date: Wed, 5 Sep 2018 14:10:08 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 09/05/18 13:06, Rob Herring wrote: > On Wed, Sep 5, 2018 at 1:19 PM Frank Rowand wrote: >> >> On 09/05/18 04:51, Rob Herring wrote: >>> On Tue, Sep 4, 2018 at 8:49 PM Frank Rowand wrote: >>>> >>>> On 08/30/18 12:05, Rob Herring wrote: >>>>> Scan the root node properties (#{size,address}-cells) earlier, >>>> >>>> ^^^^^^^ >>>> before mdesc->dt_fixup() is called >>>> >>>>> so that >>>>> the dt_root_addr_cells and dt_root_size_cells variables are initialized >>>>> and can be used. >>>> by mdesc->dt_fixup() >>> >>> That's an ARM specific detail. Granted, ARM is the only caller. >> >> The dt_root_addr_cells and dt_root_size_cells variables are being >> initialized earlier in this patch series so that of_fdt_limit_memory() >> can use them. The only caller of of_fdt_limit_memory() is >> exynos_dt_fixup(), which is an mdesc->dt_fixup() function. >> >> >>> >>>>> >>>>> Cc: Frank Rowand >>>>> Signed-off-by: Rob Herring >>>>> --- >>>>> drivers/of/fdt.c | 7 ++++--- >>>>> 1 file changed, 4 insertions(+), 3 deletions(-) >>>>> >>>> Moving early_init_dt_scan_root() to inside early_init_dt_verify() >>>> puts something that has nothing to do with verifying the fdt >>>> into a function whose purpose is the verify. It hides the side >>>> effect of initializing the dt_root_addr_cells and dt_root_size_cells >>>> variables. >>> >>> It already has the side effect of setting initial_boot_params which >>> every subsequent function needs. >> >> And that side effect should probably also be moved. > > So 2 functions? One to set the blob and one to verify it. Then we can No, I would not add yet another function. All of these side effects are an argument in favor of a single setup_machine_fdt(), as I suggested below. Then all of these side effects could be in setup_machine_fdt() instead of hiding them in sub-functions that are called by all of the different architectures. > just let arches decide if they want to do any verification or not. > > Perhaps it should be called fdt_init(blob) and then it is vague enough > I can do whatever I want. > >>>> I suggest creating a new function early_init_dt_scan_init_pre_dt_fixup(), >>>> move the chunk of code there instead of to early_init_dt_scan_nodes(), >>>> and call the new function from setup_machine_fdt(), just before >>>> calling mdesc->dt_fixup(). This would be a little bit more code, >>>> but more clearly showing the intent. >>> >>> I'm trying to reduce the number of functions arches call >> >> I like that goal. >> >> >>> and renaming >>> would need a bunch of arch changes. This change will also let me make >>> early_init_dt_scan_root private as powerpc is the only user. I need to >>> dust off a patch for that. >>> >>> I'd be more inclined to push exynos to remove this altogether. After >> >> Not a bad idea. >> >>> all, if they claim their bindings are unstable, they can't really >>> claim their bootloader is stable/fixed. >> >> It seems that this series is showing us that maybe the three architecture >> specific (arc, arm, arm64) versions of setup_machine_fdt() should be >> consolidated so that we have consistent behavior for FDT. >> >> If we had a single setup_machine_fdt() then some of he hidden side >> effects of functions called by setup_machine_fdt() could instead >> be hoisted into setup_machine_fdt(). > > Those functions are all quite a bit different. ARM matches the machine > desc while arm64 doesn't have any such thing. How the DTB gets mapped > into virtual space also varies. I argue that they _should be_ made to be more alike than different. You have only pointed out two differences. Of those, the mapping could be cleanly handled by an mdesc-> callback. (I would have to look at the match to see if that could be handled easily, but I would expect so.) On the other hand, in a previous reply you considered removing of_fdt_limit_memory(), which is only used for an exynos fixup. If you do that, then patch 1 disappears, and we can continue to sweep under the rug the side effects that you reminded me of with patch 1. > > Rob >