Received: by 10.223.176.5 with SMTP id f5csp2951777wra; Mon, 29 Jan 2018 06:43:13 -0800 (PST) X-Google-Smtp-Source: AH8x226NCflxPf0YQbevHiTavEbAOmafa+HSFzpTTeSytZe4ZRXstk8M3ARGJYYHIVWIwlme+Z8P X-Received: by 10.98.30.1 with SMTP id e1mr27284208pfe.37.1517236993355; Mon, 29 Jan 2018 06:43:13 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1517236993; cv=none; d=google.com; s=arc-20160816; b=NEtesfU20XCq2S+QUmCyCgnUyX9ghubOh4VVlNtgMmPwGinLofgf1R+ty/8WtSgf90 kcMyGYWyN/invw/uAbdIA3ICGgsx61v3HqbpikzMEXbOxiyvryMzuLHdojX3OQdjGk33 oWqRxBgLuVNjWcbrhTjRVNihjDz2By+2peUMTvWhS2qlU9x+AOf1l1ZZkO88FOZwpC8v c9RldMX6kDey5UrbqjIaDXR/57Agjqr9qcVAX8nl9WhMrInR53ACDenygcXqVetDVAcu YHHs2pXfzBTeTfN0HYK+WVffwQzgJnfUG9EMu3OGvmXlCjCoh48XuPBZ7sTK+9/IdE+v 6LeQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :references:in-reply-to:mime-version:dmarc-filter :arc-authentication-results; bh=yn22mGIVGmCDpw1HNSa0RPoV8S4RCHItKiBxw3ebw4E=; b=u62PQit4XcBgWte62hj023AHvxoueITEv/h2Lfy56f3Yt4fSur6jifvQIWgS2cesz7 pDDNLlL71eiEOI2TytdAkdFYZNiAnUPAzoA7y1CwIR06T3rAGLg0p4pkzFtGEkOSX6Io KusW2o7+UViuxv0v9GwNnzTChac6/5YEV0UKChnF+GJi+VCB7t4n1TsQqbKtjzQm+ABw 2/78dB+/6zih7iqdLFtBh52hWT6SBsir4+7XxPEVJuACaJJRE9R/iCcSpycWa7EPZyE5 GF5ZyYbepsCy6J1ggTqDGWKvDcgtJc5I67ajvb5aRqrAuKJGnpnpPvLm9Kh73ctCoz4v +rcQ== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id z27si12094979pfk.131.2018.01.29.06.42.57; Mon, 29 Jan 2018 06:43:13 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751849AbeA2Omc (ORCPT + 99 others); Mon, 29 Jan 2018 09:42:32 -0500 Received: from mail.kernel.org ([198.145.29.99]:60268 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751421AbeA2Omb (ORCPT ); Mon, 29 Jan 2018 09:42:31 -0500 Received: from mail-wm0-f45.google.com (mail-wm0-f45.google.com [74.125.82.45]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id CAEDF21789 for ; Mon, 29 Jan 2018 14:42:30 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org CAEDF21789 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=robh@kernel.org Received: by mail-wm0-f45.google.com with SMTP id 143so14720894wma.5 for ; Mon, 29 Jan 2018 06:42:30 -0800 (PST) X-Gm-Message-State: AKwxytcmoHH24Ahml8fNTMzoAsaUu7Go/AKrJLWL2Wl3CaUtcPwC/2g/ uzyLtSLb9T01SjDh1sdYTk/FH4GR2xTAU7RZ3ryokA== X-Received: by 10.80.180.16 with SMTP id b16mr14733714edh.111.1517236949210; Mon, 29 Jan 2018 06:42:29 -0800 (PST) MIME-Version: 1.0 Received: by 10.80.171.164 with HTTP; Mon, 29 Jan 2018 06:42:08 -0800 (PST) In-Reply-To: <1517194414-19932-2-git-send-email-frowand.list@gmail.com> References: <1517194414-19932-1-git-send-email-frowand.list@gmail.com> <1517194414-19932-2-git-send-email-frowand.list@gmail.com> From: Rob Herring Date: Mon, 29 Jan 2018 08:42:08 -0600 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH 1/2] of: change overlay apply input data from EDT to FDT To: Frank Rowand Cc: Rob Herring , Pantelis Antoniou , Pantelis Antoniou , devicetree@vger.kernel.org, Linux Kernel Mailing List , Geert Uytterhoeven Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. Why the rearranging? That should be a separate patch. > > - 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. Rob