From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 09BEBC433EF for ; Mon, 31 Jan 2022 17:45:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:Date: Message-ID:From:References:Cc:To:Subject:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=DQWzA1XAKZObAjELPDf5Bog/g959uxnk6Ybhx7WCHN8=; b=Hp/aUkcoWUuBh8/KM/GHyg6PmV akd3GJxGlXa+Sk1ZN7cCCt6ixlzyDapNXBP1jNW9+Eannvvja3vyfcRnX6DY7i2e0cdPLkU0phFyl 8I0ot2QFbLZZFRbCtNfwAwQNWoP5wFtFx19JuBToB1Ia2Nfs74SQH7xBIQGvBxRGSap6O1B9JFZpd Jyw82Ti+/pB+gk2DhEi6uIYh+2sZzXtdEEOj6regHQaSZF5Uc4nugdyoMN98IH4MjzflZYjS1aB0Y dk/rGs/3H87DAnZtmlXkwG69JBqbbAVVD2P16x6uhwlpWUnqCo9Gr9k0IFjkSJ5tMhGjLmBKrgHvd NiFHSZnQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nEaiR-00ACYL-Jw; Mon, 31 Jan 2022 17:43:48 +0000 Received: from foss.arm.com ([217.140.110.172]) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nEaYE-00A94U-AJ for linux-arm-kernel@lists.infradead.org; Mon, 31 Jan 2022 17:33:16 +0000 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 089CFED1; Mon, 31 Jan 2022 09:33:12 -0800 (PST) Received: from [10.57.13.88] (unknown [10.57.13.88]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 241283F73B; Mon, 31 Jan 2022 09:33:10 -0800 (PST) Subject: Re: [boot-wrapper PATCH v3] Makefile: avoid dtc warnings on re-compiling DTB To: Andre Przywara , Mark Rutland Cc: Jaxson Han , linux-arm-kernel@lists.infradead.org References: <20220131163122.2188634-1-andre.przywara@arm.com> From: Vladimir Murzin Message-ID: <9226f733-bf45-fdc2-90db-c401e7cd7cd6@arm.com> Date: Mon, 31 Jan 2022 17:33:29 +0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 MIME-Version: 1.0 In-Reply-To: <20220131163122.2188634-1-andre.przywara@arm.com> Content-Language: en-US X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220131_093314_534699_FC646CC7 X-CRM114-Status: GOOD ( 26.50 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On 1/31/22 4:31 PM, Andre Przywara wrote: > When we add the PSCI nodes to the provided DTB, we use dtc to de-compile > the blob first, then re-compile it with our nodes and properties added. > > In our input DTB the proper phandle references have already been lost, > all we see in the DTB is phandle properties in the target node, and some > numbers in the clocks and gpios properties: > =========== > clk24mhz { > compatible = "fixed-clock"; > #clock-cells = <0x00>; > clock-frequency = <0x16e3600>; > clock-output-names = "v2m:clk24mhz"; > -> phandle = <0x05>; > }; > ... > serial@90000 { > compatible = "arm,pl011", "arm,primecell"; > reg = <0x90000 0x1000>; > interrupts = <0x05>; > -> clocks = <0x05 0x05>; > clock-names = "uartclk", "apb_pclk"; > }; > =========== > dtc warns that those numbers might be wrong: > ========= > :177.6-27: Warning (clocks_property): > /bus@8000000/motherboard-bus@8000000/iofpga-bus@300000000/serial@90000: > clocks: cell 0 is not a phandle reference > .... > ========= > The proper solution would be to use references (&v2m_clk24mhz) instead, > as there are in the source .dts file, but we don't have that information > anymore, and cannot easily recover it. > > To avoid the lengthy list of warnings, just drop those checks from the > dtc compilation run. This disables more checks than we want or need, but > we somewhat trust in the original DTB to be sane, so that should be > fine. > Since those warning options are not supported by older dtc versions, > introduce a compatiblity check before using them. > > Signed-off-by: Andre Przywara > --- > Hi, > > this replaces the reverted version of the patch, adding runtime detection > of dtc's compatibility. > Works fine with a clueless dtc 1.4.1. > > Cheers, > Andre > > Makefile.am | 10 +++++++++- > 1 file changed, 9 insertions(+), 1 deletion(-) > > diff --git a/Makefile.am b/Makefile.am > index 40bc5d6..08e304a 100644 > --- a/Makefile.am > +++ b/Makefile.am > @@ -162,8 +162,16 @@ $(COMMON_SRC): > model.lds: $(LD_SCRIPT) Makefile > $(CPP) $(CPPFLAGS) -ansi -DPHYS_OFFSET=$(PHYS_OFFSET) -DMBOX_OFFSET=$(MBOX_OFFSET) -DKERNEL_OFFSET=$(KERNEL_OFFSET) -DFDT_OFFSET=$(FDT_OFFSET) -DFS_OFFSET=$(FS_OFFSET) $(XEN) -DXEN_OFFSET=$(XEN_OFFSET) -DKERNEL=$(KERNEL_IMAGE) -DFILESYSTEM=$(FILESYSTEM) -DTEXT_LIMIT=$(TEXT_LIMIT) -P -C -o $@ $< > > +# Run dtc with an given command line option to check support for it. > +define test-dtc-option > +$(if $(shell echo "/dts-v1/;/{};" | $(DTC) $(1) -o /dev/null 2>&1),,$(1)) > +endef > + > +DTC_NOWARN = $(call test-dtc-option,-Wno-clocks_property) > +DTC_NOWARN += $(call test-dtc-option,-Wno-gpios_property) > + > fdt.dtb: $(KERNEL_DTB) Makefile > - ( $(DTC) -O dts -I dtb $(KERNEL_DTB) ; echo "/ { $(CHOSEN_NODE) $(PSCI_NODE) }; $(CPU_NODES)" ) | $(DTC) -O dtb -o $@ - > + ( $(DTC) -O dts -I dtb $(KERNEL_DTB) ; echo "/ { $(CHOSEN_NODE) $(PSCI_NODE) }; $(CPU_NODES)" ) | $(DTC) -O dtb -o $@ $(DTC_NOWARN) - > > # The filesystem archive might not exist if INITRD is not being used > .PHONY: all clean $(FILESYSTEM) > FWIW, Tested-by: Vladimir Murzin Thanks Vladimir _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel