Received: by 10.223.176.5 with SMTP id f5csp3601117wra; Mon, 29 Jan 2018 16:02:32 -0800 (PST) X-Google-Smtp-Source: AH8x224Y8NHzfNxwF9VvXFipLJ7TLGxjFedjy9pAyxnI7eyU5ggXcVw8HL3OplNGBYH4YOjVrwe3 X-Received: by 2002:a17:902:9a41:: with SMTP id x1-v6mr16640137plv.256.1517270552525; Mon, 29 Jan 2018 16:02:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1517270552; cv=none; d=google.com; s=arc-20160816; b=fM+7LGdu/c/kv3yLc0nPwszCKjAsDpizyQgsf11PbiUR7JxUfy9MoVlPhv2B3urJx3 43amovt+kIN24IP4TUsuG79uK1/tZlyKACdGyoy2w7nvCXlNmx3WaMxv8XFgoOdqYw5z g9thZRA7UgFYF8sZOiI8gEaKArqd45Dfk3OeL79J4VjzoDHQTT3NNZHkBY20qAQB0Ziy v/YlA2VXCGBNend0vLD7+s2kty8OcwJ8Kt/O2z90SEQpZK6QULSCeviJ0FLxyGBwlc6N co0vHGiP1GgCir1Ymp++q6p+dJZgnzYs5TyVf/52kzzMCO90nV+lN1iHPnmADs8gLkht QXkA== 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 :arc-authentication-results; bh=iGnV5z1NLrNPkbnkSttGRwI9P4FbVjASz4YAM4S6FVY=; b=G2fB4bANVv0SfhuaC7FMA6geZu2SbJjL8cFJSH1uTkweRucMmswa8dcEAwduG40ILT kF2ds9eeLwMzgtR+gbExr/jTqkZJqfab3/UIqiqJDRLmRoULvPGOHcpvRHJbROWWm1wT +RNOr+t4cInMCYRqnl/MpF+DRHTAU7/lZ4zctoYxxbOUJYxCVEJQIIXnpf81/XVzjjn8 mdJLitRm3WJDpoxRFhaUK3fYm2WK+sdA6pLAwqGfmyXws7aMqlhep6+JFcSm+yif+wjq V44ZUJcfs4egV8VaFm8bzLDSgiMkW274jhcG39BgF8AOWxvYrE6zycs8u3bBt+aAEqm7 mXMg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=XOBYhaZR; 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=NONE 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 u1si1583283pge.278.2018.01.29.16.02.17; Mon, 29 Jan 2018 16:02:32 -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; dkim=pass header.i=@gmail.com header.s=20161025 header.b=XOBYhaZR; 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=NONE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752205AbeA3ABo (ORCPT + 99 others); Mon, 29 Jan 2018 19:01:44 -0500 Received: from mail-pg0-f68.google.com ([74.125.83.68]:40606 "EHLO mail-pg0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751539AbeA3ABl (ORCPT ); Mon, 29 Jan 2018 19:01:41 -0500 Received: by mail-pg0-f68.google.com with SMTP id g16so5745490pgn.7; Mon, 29 Jan 2018 16:01:41 -0800 (PST) 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=iGnV5z1NLrNPkbnkSttGRwI9P4FbVjASz4YAM4S6FVY=; b=XOBYhaZRGMswDDnsALIjg2LaxrlLu7XQHA81JbJfenIc2bZRQsfl4kReEAlmXwVu+1 U6ZqU1MoSmUKKxVyPZUd8LYh8eOGD76UaIjY1UE3NICxk5gHPkVj47BHyDLmVdgPu/r+ Hs3Tl9x+pwEtuhMDcphEopLCiOl0V1Chf57HSjiihKt2IadW/MaCoCUOa3G0uLVZ/GMl XW3HrdW/ktbt8+9srKimXtEZkKzhndU0dsu4wtBzw0eF4vL8fEa12u7JRr5oUTiCP5Yz wn7xtdi/Ff6INmRUf6cmIX5lwaPIfg42R4WadSBXLuhwhmXusMyYsPtv3IiNjv/sCUqq aT4w== 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=iGnV5z1NLrNPkbnkSttGRwI9P4FbVjASz4YAM4S6FVY=; b=Rh3h0Jl2qYwilnYkSmWJ3y+J08ZkzS6kDK1rKA55a8poZKq6WuQB7XPl0xT7LqOSzu iNzg9OukDmqY5s+vzEZhXUW+FtaJ0PiqpOXTrPk0ZHwPSJSd5AzvZ8NwFWpsdT/UCpQV owwCfrto0wRMCCHJX+c4rTjaFRAgwV8tSpqsFqN4djuLrJalB3cLRRA6xHP69YJwgRum 8cjbU+JlrEiQAn6mUP655Kr0SChmAApU/5JH6AsQy2U8IrUmmW5sgcbGQL+fTODRyvHH bkgWW5ZSCb2MKu/+o6PqSo+vX5seO87lIC1arKM7JsBkfOCTQjzNxUpOtZoCOB09I/id a7lQ== X-Gm-Message-State: AKwxytfOt34Eh60M8KLHyQfGBTXfQzCSyQCraTgVwRK+AGctHsPgETnW 2zFjcaazfCpmN/m41eZbGF8= X-Received: by 2002:a17:902:1665:: with SMTP id g92-v6mr23468500plg.245.1517270500893; Mon, 29 Jan 2018 16:01:40 -0800 (PST) Received: from [192.168.1.70] (c-73-93-215-6.hsd1.ca.comcast.net. [73.93.215.6]) by smtp.gmail.com with ESMTPSA id l64sm24777365pfg.62.2018.01.29.16.01.39 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 29 Jan 2018 16:01:40 -0800 (PST) Subject: Re: [PATCH 1/2] of: change overlay apply input data from EDT to FDT To: Rob Herring Cc: Rob Herring , Pantelis Antoniou , Pantelis Antoniou , devicetree@vger.kernel.org, Linux Kernel Mailing List , Geert Uytterhoeven References: <1517194414-19932-1-git-send-email-frowand.list@gmail.com> <1517194414-19932-2-git-send-email-frowand.list@gmail.com> From: Frank Rowand Message-ID: Date: Mon, 29 Jan 2018 16:01:38 -0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.5.0 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 01/29/18 06:42, Rob Herring wrote: > On Sun, Jan 28, 2018 at 8:53 PM, wrote: >> From: Frank Rowand >> >> Move duplicating and unflattening of an overlay flattened devicetree >> (FDT) into the overlay application code. To accomplish this, >> of_overlay_apply() is replaced by of_overlay_fdt_apply(). >> >> The copy of the FDT (aka "duplicate FDT") now belongs to devicetree >> code, which is thus responsible for freeing the duplicate FDT. The >> caller of of_overlay_fdt_apply() remains responsible for freeing the >> original FDT. >> >> The unflattened device tree (aka expanded device tree, EDT) now > > Not really a fan of a new acronym. > >> belongs to devicetree code, which is thus responsible for freeing >> the EDT. >> >> These ownership changes prevent early freeing of the duplicated FDT >> or the EDT, which could result in use after free errors. >> >> of_overlay_fdt_apply() is a private function for the anticipated >> overlay loader. >> >> Update unittest.c to use of_overlay_fdt_apply() instead of >> of_overlay_apply(). >> >> Move overlay fragments from artificial locations in >> drivers/of/unittest-data/tests-overlay.dtsi into one devicetree >> source file per overlay. This led to changes in >> drivers/of/unitest-data/Makefile and drivers/of/unitest.c. I should have reversed the cause and effect in that sentence to instead be: The changes to drivers/of/unittest.c require the test overlays to be in FDT form instead of unflattened devicetree form. Move overlay fragments from artificial locations in drivers/of/unittest-data/tests-overlay.dtsi into one devicetree source file per overlay and thus create one FDT per overlay. > Why the rearranging? That should be a separate patch. Bisectability. I can make the changes to the devicetree files in a second patch. After the first patch, there will be 29 self test fails. I will make the change unless you respond back to this saying not to. >> - Add overlay directives to the overlay devicetree source files so >> that dtc will compile them as true overlays into one FDT data >> chunk per overlay. > > For this? > >> - Set CFLAGS for drivers/of/unittest-data/testcases.dts so that >> symbols will be generated for overlay resolution of overlays >> that are no longer artificially contained in testcases.dts >> >> - Unflatten and apply each unittest overlay FDT using >> of_overlay_fdt_apply(). >> >> - Enable the of_resolve_phandles() check for whether the overlay >> EDT is detached. This check was previously disabled because the >> overlays from tests-overlay.dtsi were not unflattened into detached >> trees. >> >> - Other changes to unittest.c infrastructure to manage multiple test >> FDTs built into the kernel image (access by name instead of >> arbitrary number). >> >> - of_unittest_overlay_high_level(): previously unused code to add >> properties from the overlay_base devicetree to the live tree >> was triggered by the restructuring of tests-overlay.dtsi and thus >> testcases.dts. This exposed two bugs: (1) the need to dup a >> property before adding it, and (2) property 'name' is >> auto-generated in the unflatten code and thus will be a duplicate >> in the __symbols__ node - do not treat this duplicate as an error. >> >> Errors while developing the patch exposed inadequate error messages >> to debug problems when overlay devicetree fragment nodes contain >> an invalid target path. Improved the messages in find_target_node(). > > Sounds like another separate patch. Will do. > > Rob >