Received: by 2002:a05:7412:2a91:b0:fc:a2b0:25d7 with SMTP id u17csp77272rdh; Tue, 13 Feb 2024 09:52:25 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCVgN52s8OFiZ08Y4qG7STyb9piGJp7ca8rp+lYtrNu5U64VDxhsliAr9PmcXOb7W3shML/xKwAa03HDwW/i9rDrWuLwO/UV0EBXNprgWQ== X-Google-Smtp-Source: AGHT+IHdl/OD642kMzBQ8juVJh+aEOfqNBblZIagppWpCW36RkwXJ84Ce9Ux3dOzaJgA849vrNDW X-Received: by 2002:a17:906:fa06:b0:a39:99b8:1f7e with SMTP id lo6-20020a170906fa0600b00a3999b81f7emr82378ejb.4.1707846745433; Tue, 13 Feb 2024 09:52:25 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707846745; cv=pass; d=google.com; s=arc-20160816; b=ro/Gn8PuoGZG316cWbBx6qh8SXqjf5sOb7l0AbmcV6JhomryH/SzwXX5roHofLUwUd 8PjiH1eXdXKmqCqwkUjO7cqpNr3RpDaY20XvI/uyePydFMtmbY49muSnmKzBziZUT1aw zpI2gf9DYbGjHMC6EOA7JDMQiP3E2JQCvLXnhGYUalyEfTlYylxglqsA9m5S5pA/+0eV Fu8PzKq37ZZd8ZoI09Q2Js2QXk2n6ghbc7FvTNyYPFdLiVJ4d9Qhw+GzSkJUELMuO+2K GIbj+6Tnwp/ykskMv/IWZmSWWXAv99BV/+nci8C40HV66zxyu/Yy6flRoZMgOIvCeIeq Nr4g== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:list-unsubscribe:list-subscribe :list-id:precedence:dkim-signature; bh=U8sdSIzef20qjLYADsjPc/FWWyfyItBl7kEGNmo8QOE=; fh=MwWwZQWqQ/6AKaU7CRHf6rCol4J8W9xocNmeXSYPF/g=; b=qR6yiUhpI1akf5Mj9SDoLlrve1Ja4ImYvMLoyKxS2wvwZ1nQfmLNJZNEX6BM6XbS/z ijPDa/qagGUQVY1IhhAaq2ZSb0OS0yNhqEo7wtJ5FaRnWUnmGVEPBY0BXNHMoayT/0Uh X7Akg+JrV77eEBBDGQntqNrIeabWmwfj4qzxVx0zfRYXN4/ArPxYjVWsvOSmXyMtYw3o OBuy2A0F/ePj9uQLUIsAwWIOig9IOVtgMEEmj1WQk5LDgWpJLA/xa4kRyZNKB0ASyb0C bDIvUh9if6+qQyjXmQchISkOBfu0ei2Tuz1RjbfXzWBX++hdfoQnhjL1k62raMJjeMNh CZDQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=daxJyUTO; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-64014-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-64014-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org X-Forwarded-Encrypted: i=2; AJvYcCVKSGcs97FDQ+I/UQNJ7Iw9evu9X+YXDiTcaPhex046gA6aP5PEKnmH2NLuPpeLM+zdsifImIL/ED2eqMTWo9z3+yRmoJm7rc3hjwiGyw== Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id re18-20020a170906d8d200b00a37a7edf748si1460129ejb.1009.2024.02.13.09.52.25 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 13 Feb 2024 09:52:25 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-64014-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=daxJyUTO; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-64014-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-64014-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 05BF71F249CA for ; Tue, 13 Feb 2024 17:52:25 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 9FA79604DB; Tue, 13 Feb 2024 17:52:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="daxJyUTO" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id AF8BD604C9; Tue, 13 Feb 2024 17:52:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707846735; cv=none; b=Rteaf08U88EiTisEO+7JBhji5gxkhhLXQ+CCTBMp4X+rGMcRcujSBq3MYA6aIoSMkPuCnuCHzUauo2GVGCFMEE81DTC6E8vqT8W4bIsvDXgW8fHG8ySUvFa22w8rQjaIWedJUqkMCb65JYHTNuloyaVggTADEWXHOaQyJV/IaHE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707846735; c=relaxed/simple; bh=L8FC9DVO0Mg3A15dXzRFV/FVQ7qBDm65d4gp1EA3LVs=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=LGSWq7y2mzbzznC7Q/YgAR6vBYW+HrFpiaZmYDkiTqlHFqhavwDZI9AWTC9cRzj2147RA4P1ns/Uz0gToFKMoKLPmyTp1HzrYNsKEeXsx06iv2elSoi4c23z9XkkN7bgpH6U1ErZHhtPHvopUE8rw7diyL5THc+LWfdABIM+xzg= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=daxJyUTO; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4AE16C433A6; Tue, 13 Feb 2024 17:52:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1707846735; bh=L8FC9DVO0Mg3A15dXzRFV/FVQ7qBDm65d4gp1EA3LVs=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=daxJyUTOygGsSs/Ac0C/RS+vBvjT/1OTIQY0OFsLXyg/qVAC9zQVSgdMg5WnyLGM/ gdaRq59lek46Ry+Jxj0SH/yjhMw216i1oEawpKa7Xrxx6ZsWt5BJoW8dr6GOuZSSs9 SbACEIWrB1LROLgcDZpe37bRsJO/raRjwIx+hNR/XBCn1FKxYfZMJIejONxoulwpiV QCbelNCiNug+7eWsobbzEPtB7X5eZly6u2MGRL4aQgZ+EfG+AdsVFIq1uQiTi8OYTx 49n/n7UrCuFgv3YDGT8KLYOpCg1M2yuJ2ZhVvqYVr0Wlx+183OrsBkgSCcGwN20W9F E2O78WbM+JQhQ== Received: by mail-lj1-f180.google.com with SMTP id 38308e7fff4ca-2d0e521de4eso40571221fa.2; Tue, 13 Feb 2024 09:52:15 -0800 (PST) X-Forwarded-Encrypted: i=1; AJvYcCX/jiJY81jZnx1U2dRrAhiG+q1Rr1acY/fO34BDZkS5/A/38NGBT9L2S3/hDLVGEV1vDAM0HZ13RKWsbHU02f9QcFlcUi1izQDaaI9l1eamgjm3u7EtWNrK5eN4dbZ3AxA+t1XWBjr7N20b9u1W5fNCvdyZLTcZfRr7XTKXcKzf3tD3gG54dD14GQ== X-Gm-Message-State: AOJu0Yw6NhPh2G6DP/w67oOrUPE3HApuQxm5uFsjIfQf5huqQ0jNtLii qZ+qJHaxQZuVRfm3s3zdk/q5NOUPNBuneFf1Buei5J7fAeTBSxY6WGAaMd/lai+9YNbSmcK09lO 8tID7F8LIJdFfCNcb68A5LQ6jtg== X-Received: by 2002:a2e:9992:0:b0:2d0:fd1e:c588 with SMTP id w18-20020a2e9992000000b002d0fd1ec588mr297630lji.9.1707846733488; Tue, 13 Feb 2024 09:52:13 -0800 (PST) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <20240202195909.3458162-1-sboyd@kernel.org> <20240202195909.3458162-8-sboyd@kernel.org> <89892ecd6b1b043db58258705c32b02b.sboyd@kernel.org> <2185a3cc3152a0b9a94b0c64353bc9a1.sboyd@kernel.org> In-Reply-To: <2185a3cc3152a0b9a94b0c64353bc9a1.sboyd@kernel.org> From: Rob Herring Date: Tue, 13 Feb 2024 17:52:00 +0000 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH v3 7/7] of: Add KUnit test to confirm DTB is loaded To: Stephen Boyd Cc: Geert Uytterhoeven , David Gow , linux-kernel@vger.kernel.org, patches@lists.linux.dev, linux-um@lists.infradead.org, linux-arm-kernel@lists.infradead.org, kunit-dev@googlegroups.com, linux-kselftest@vger.kernel.org, devicetree@vger.kernel.org, Frank Rowand , Brendan Higgins Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Fri, Feb 9, 2024 at 8:59=E2=80=AFPM Stephen Boyd wrot= e: > > Quoting Geert Uytterhoeven (2024-02-05 11:55:29) > > On Mon, Feb 5, 2024 at 8:19=E2=80=AFPM Stephen Boyd = wrote: > > > Quoting David Gow (2024-02-02 20:10:17) > > > > On Sat, 3 Feb 2024 at 03:59, Stephen Boyd wrote: > > > > > Add a KUnit test that confirms a DTB has been loaded, i.e. there = is a > > > > > root node, and that the of_have_populated_dt() API works properly= . > > > > > > > > > > Cc: Rob Herring > > > > > Cc: Frank Rowand > > > > > Cc: David Gow > > > > > Cc: Brendan Higgins > > > > > Signed-off-by: Stephen Boyd > > > > > --- > > > > > > > > This looks pretty good to me test-wise, though it still fails on m6= 8k. > > > > (Everything else I tried it on works, though I've definitely not tr= ied > > > > _every_ architecture.) > > > > > > > > aarch64: PASSED > > > > i386: PASSED > > > > x86_64: PASSED > > > > x86_64 KASAN: PASSED > > > > powerpc64: PASSED > > > > UML: PASSED > > > > UML LLVM: PASSED > > > > m68k: FAILED > > > > > $ qemu-system-m68k -nodefaults -m 1024 -kernel .kunit-all-m68k/vm= linux -append 'kunit.enable=3D1 console=3Dhvc0 kunit_shutdown=3Dreboot' -no= -reboot -nographic -serial stdio -machine virt > > > > > [11:55:05] =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D dtb (2 subtests) =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D > > > > > [11:55:05] # dtb_root_node_found_by_path: EXPECTATION FAILED at d= rivers/of/of_test.c:18 > > > > > [11:55:05] Expected np is not null, but is > > > > > [11:55:05] [FAILED] dtb_root_node_found_by_path > > > > > [11:55:05] # dtb_root_node_populates_of_root: EXPECTATION FAILED = at drivers/of/of_test.c:28 > > > > > [11:55:05] Expected of_root is not null, but is > > > > > [11:55:05] [FAILED] dtb_root_node_populates_of_root > > > > > [11:55:05] # module: of_test > > > > > [11:55:05] # dtb: pass:0 fail:2 skip:0 total:2 > > > > > [11:55:05] # Totals: pass:0 fail:2 skip:0 total:2 > > > > > [11:55:05] =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D [FAILED] dtb =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D > > > > > > Ah yeah I forgot to mention that. m68k fails because it doesn't call = the > > > unflatten_(and_copy)?_device_tree() function, so we don't populate a > > > root node on that architecture. One solution would be to make CONFIG_= OF > > > unavailable on m68k. Or we have to make sure DT works on any > > > architecture. Rob, what do you prefer here? > > > > I guess the latter? > > Alpha, hexagon, parisc, s390, and sparc are also lacking calls > > to unflatten.*device_tree(). > > > > sparc does that on purpose. Perhaps it's simplest to call > unflatten_device_tree() if of_root is still NULL after setup_arch() > returns. > > ---8<--- > diff --git a/init/main.c b/init/main.c > index e24b0780fdff..02f5cf8be6c1 100644 > --- a/init/main.c > +++ b/init/main.c > @@ -97,6 +97,8 @@ > #include > #include > #include > +#include > +#include > #include > #include > #include > @@ -895,6 +897,8 @@ void start_kernel(void) > pr_notice("%s", linux_banner); > early_security_init(); > setup_arch(&command_line); > + if (!of_root) of_root is another thing I'd like to remove direct access to. That check could be inside unflatten_device_tree(). > + unflatten_device_tree(); That's back to what Frank had essentially and I wanted to avoid. I think I'd just disable the tests on the above arches and let them opt-in. I could be convinced otherwise though. Rob