Received: by 2002:ac0:946b:0:0:0:0:0 with SMTP id j40csp196830imj; Thu, 14 Feb 2019 18:28:08 -0800 (PST) X-Google-Smtp-Source: AHgI3IYL+ik0w2BUOE5TMlEYJKLvpFzn9djxvaWmBpz9tH0pxT/CKA+SPkOTvqbOQo9JyXDzo56r X-Received: by 2002:a62:2702:: with SMTP id n2mr7544423pfn.29.1550197688432; Thu, 14 Feb 2019 18:28:08 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1550197688; cv=none; d=google.com; s=arc-20160816; b=sCfd9KiyvRVx5LD8s7DCMpVSF6X1o+j2KDgEt1b0/Uwnd3PFg11aeDwH2mGxgsnk5R /2bomk0y9CW8PYcj7dNEjgixlhvIIINsqK2ypVR9uVC2Ayegp8UYc0BH+ljYp27yQD+5 xDdgZRbh9PzVJ7iqhXk6ZaQ4BW/ek0ZWg6jjLa3yEuEmfO8tZ9vrUzTHjW4zksEhzPsJ ajNepF+6GY/z+/Zxk0Ryzdmzl/V1NDgzmrqYE/M0yVahBwWr5kGMTtn7Sm2wAk7C/hDj vG9H85AXw/50lNeIpk8kUdFL4ts1iq2i1HSUDpR+ztPBEwzI3JdAmilSpo7sUneJQKVX kMgA== 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 :in-reply-to:references:mime-version:dkim-signature; bh=6uz0kUsZLOlyc/GsvAXtmKx3gYn3eTJy5dFjv86Wxg0=; b=Afch8YjEaW6VsKdRBIH/KyRqzApEcItMJN71bZdDHEptsv4Xtzrx9n7HIWlYgr8YgS HRXGGfsFW2lomtPgm5kbKAXzSuLr1wXwb9oxUgVSF/RfsfockxqnfnweZaLH82oLrNOi vA9GVfoCUkojV/FhWnqCM5TQl34kTxB0KSQOxnvK/iqc/1gHT78FISDjcDgaU+UAQSKw pLvwrRgdC6dYw5cyYWntzzggradRP2jyOcZnZFLJICMuLZQGE+EPDYQUoGPbfGZXaAPv DhrtZkJ7MD3fc1lDQAYQvPu7WdyuB4OC6Dzrt9lIx6+YHmyeZCU9RmavH4i1fgtz4NOj 78rg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b="KysuK/Hw"; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g7si3888308pgd.460.2019.02.14.18.27.52; Thu, 14 Feb 2019 18:28:08 -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=@google.com header.s=20161025 header.b="KysuK/Hw"; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730763AbfBOB0e (ORCPT + 99 others); Thu, 14 Feb 2019 20:26:34 -0500 Received: from mail-ot1-f68.google.com ([209.85.210.68]:36736 "EHLO mail-ot1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725939AbfBOB0e (ORCPT ); Thu, 14 Feb 2019 20:26:34 -0500 Received: by mail-ot1-f68.google.com with SMTP id v62so5149293otb.3 for ; Thu, 14 Feb 2019 17:26:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=6uz0kUsZLOlyc/GsvAXtmKx3gYn3eTJy5dFjv86Wxg0=; b=KysuK/HwzYui1rqiNnrZVF3yeoDzVUDktPelt2MN2ez+sYxdKyBc0LoYbWB/1D0zwg /0G+dI9oaSVJ2skEdxHAYvtfwJ/4tzqrGxmJmtNG3h0ZdBNPZXW8jz7wsq8VwN8NuP0d +fo9g9M7RD03uwqj38t2JtROgBLmjwnMoLIxNhnxW02zeLGyNvbHZlAsfF8zAJmRAxVK ER77k86HW3G4bvpFmKYPVjRGV5B9cdoyrH75UyBnFiMEmqxWgbuRY6EYDrlzymtoY0mm SjHQ1uE4mjnkXjO9Nt+b18hRM88N7Zpl1UbEQh64SvaTtV0bcyKPFVqvUavpyLgvxCKF r1qw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=6uz0kUsZLOlyc/GsvAXtmKx3gYn3eTJy5dFjv86Wxg0=; b=sp1H4mN0FrcSVGd1i67u6j12v3Nnm9d4nt07adfUUPD1FrHandhm5mPn9OCi9klEXf MnpoV0D5Ig13qC8sRlakcgSSzCc6XGA/1SdKvQct+19CFd6PnrlhmXfqbpsOehABtovC vYWjJfLWjmmZxPliVCzO5ZKfQQjR1qr+H6wqZt7u7c4G2fvXVsUfIT4qfL7zTkqqQZdY ZbAEKuO4J9xm6tk4tyNJ9j3cnvM9AIbGOhCPNXKM5+MWqVc2l2cHwrxYAee/lp9cjBbg 7w7wAKwR+grw7ofQeJ5HrA81tPF71ehmhWKij9MQ0sECz0KXyzlbVwXzbkWT9phArmR4 3JFg== X-Gm-Message-State: AHQUAuZ5ygeshRs9kDoqubEvxo3KVAye9yEmIBh2uFeSSz3/I5MPkB+b +zV73DL57UnpsRHFmkvTe889VPJcCoDC1Yc+loOZWw== X-Received: by 2002:a9d:7597:: with SMTP id s23mr4192113otk.25.1550193993193; Thu, 14 Feb 2019 17:26:33 -0800 (PST) MIME-Version: 1.0 References: <20190212185305.112847-1-brendanhiggins@google.com> <20190212185305.112847-2-brendanhiggins@google.com> <4cb7ca12-ce60-7516-b7eb-aef08f607acc@gmail.com> In-Reply-To: <4cb7ca12-ce60-7516-b7eb-aef08f607acc@gmail.com> From: Brendan Higgins Date: Thu, 14 Feb 2019 17:26:21 -0800 Message-ID: Subject: Re: [PATCH v1 1/1] of: unittest: unflatten device tree on UML when testing To: Frank Rowand Cc: Rob Herring , Luis Chamberlain , devicetree , Linux Kernel Mailing List 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 Thu, Feb 14, 2019 at 4:10 PM Frank Rowand wrote: > > On 2/12/19 10:53 AM, Brendan Higgins wrote: > > UML supports enabling OF, and is useful for running the device tree > > tests, so add support for unflattening device tree blobs so we can > > actually use it. > > > > Signed-off-by: Brendan Higgins > > --- > > drivers/of/unittest.c | 3 +++ > > 1 file changed, 3 insertions(+) > > > > diff --git a/drivers/of/unittest.c b/drivers/of/unittest.c > > index 84427384654d5..effa4e2b9d992 100644 > > --- a/drivers/of/unittest.c > > +++ b/drivers/of/unittest.c > > @@ -2527,6 +2527,9 @@ static int __init of_unittest(void) > > } > > of_node_put(np); > > > > + if (IS_ENABLED(CONFIG_UML)) > > + unflatten_device_tree(); > > + > > pr_info("start of unittest - you will see error messages\n"); > > of_unittest_check_tree_linkage(); > > of_unittest_check_phandles(); > > > > (Insert my usual disclaimer that I am clueless about UML, I still need to learn > about it...) > > This does not look correct to me. > > A few lines earlier in of_unittest(), the live devicetree needs to exist for > unittest_data_data() and a few of_*() functions to succeed. So it seems > that the unflatten_device_tree() for uml should be at the beginning of > of_unittest(). It is true that other functions ahead of it depend on the presence of a device tree, but an unflattened tree does get linked in somewhere else. Despite that, this is needed for overlay_base_root. I got similar behavior if you don't link in a flattened device tree on x86. Thus, the order in which you call them doesn't actually seem to matter. I found no difference from changing the order in UML myself. Without my patch we get the following error, ### dt-test ### FAIL of_unittest_overlay_high_level():2372 overlay_base_root not initialized ### dt-test ### end of unittest - 219 passed, 1 failed With my patch we get: ### dt-test ### end of unittest - 224 passed, 0 failed I used the following .config for these results: CONFIG_OF=y CONFIG_OF_UNITTEST=y CONFIG_OF_OVERLAY=y CONFIG_I2C=y CONFIG_I2C_MUX=y > > Rob, if I am correct please revert this patch. > Cheers