Received: by 2002:a05:7412:8d1c:b0:fa:4c10:6cad with SMTP id bj28csp112583rdb; Tue, 16 Jan 2024 17:18:28 -0800 (PST) X-Google-Smtp-Source: AGHT+IGnSzx9IzvNdlUFtis+3/Yexkv5dWG3ZOQc80OH47Y295eevT9aJXAsMFuYE0peSZEcBCNY X-Received: by 2002:a05:6214:d82:b0:681:7eb:a356 with SMTP id e2-20020a0562140d8200b0068107eba356mr10821175qve.69.1705454308492; Tue, 16 Jan 2024 17:18:28 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1705454308; cv=pass; d=google.com; s=arc-20160816; b=wWA+M3YdGJPOCtdPEWqJxIIdUq1td+klD6GNv+jcy60XwteHM0gCSckqSOt0mL/5qw zABsTBbh2fqsiBDXg9oRTQh9Fayspuwh/2+vbS6anDipwSqBMc+Q1IqCUcW9tDoA+MWG Gxzmes3hQW1H3EDoG8Yj0xCdmvMMdjRuZMXkHPLhFuYwoC5/AqeqJymCCMQSD/Kpg4XJ pTYmhcqxf4Ytng+fRfN3JTDNl9JsEO5xgpR1cwgJO6D3mHDNh/kfCoDO8nnEJnIywUiJ 5j//UV4uRQEvdBb+9l5UP5SyDXizdOqcD+R3GWaVIGpH6JRwMNZAHtZnyOHg+YKZ3H16 We1A== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=user-agent:date:to:cc:from:subject:references:in-reply-to :content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:dkim-signature; bh=8s/fnjNoM/VvtwZBv/fyfh8M1BTq6L7YGx9QNARuGxo=; fh=s6j4dEoWoYEsjkCEDm5LslAvW7KQe+mluV2skin93zw=; b=KOyliw1Hb8s3mgxN5vI0S+ajXnyAXXkgtgWV8gtuxAH0hc8p9sOA2EznaupOK0ZLW7 D6TfX0tSUhphqq/f9tzeWddfXxfHk3+2+Ol6UDiRvCtq7hR5CrfLOA1CgUp/190NtFTm IDNdpsS1ilR0plFGcJ80r1w4SsEUVSVZPqux68+wseXtaNIiZ3ZhGf0TVRC7nhcw3Q3T ALDAziHjFc6lPr8ZEF625QkbQz6AjTyF03CGvGWG/Jn0T3MUE5KFmBbUcIJ9hITPbBqX TyDlFtXd2kdAmydpmOV2ncl60BkZjwfbHbSqZOkh0FsrGXqAscbGJNE3ALi/YcvunHRZ 0E+A== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=UufWcQ3z; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-28421-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-28421-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id o1-20020a0ccb01000000b0067f031e4b87si10342329qvk.616.2024.01.16.17.18.28 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 16 Jan 2024 17:18:28 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-28421-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=UufWcQ3z; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-28421-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-28421-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 ny.mirrors.kernel.org (Postfix) with ESMTPS id 05EBA1C23F98 for ; Wed, 17 Jan 2024 01:18:28 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 58DC317D9; Wed, 17 Jan 2024 01:18:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="UufWcQ3z" 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 77A2810EB; Wed, 17 Jan 2024 01:18:18 +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=1705454298; cv=none; b=F9blwx/qEDvhnUUiLeFuEejNeJXNKpAtrsoFbQDAAGiz1hV44azt36EzFkrdBunnMAevzCF0QIFwF8ac6R6TTulqwi0Z6jBQBfVaf0YRAfWCmbVAgkAL9jhklZodNdmUP8+f4p2ogHSX/g+HS6IY3sVISpICuw/N6F9u44GXHk0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705454298; c=relaxed/simple; bh=p9Rh3dyRs/5GUJfFv0bThfhcOx9k3Z/O3iFRLNLB+9Y=; h=Received:DKIM-Signature:Message-ID:Content-Type:MIME-Version: Content-Transfer-Encoding:In-Reply-To:References:Subject:From:Cc: To:Date:User-Agent; b=gH4u//CE5tSH3omZWfQpDJoIy3pmLEe1RXL0wMkFf+0WFfkHcMM46VcRZuOJDVDy1K9W3RbuQmYWSRLmoTjI6GX3wWid2CZLunPq6MZlk6sKbVWKsbb+fppo/rtoBaxITmQXiXp4a6mgLkrNFSfMxN4Ja/alJ9/Xq8bNFtXm0IY= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=UufWcQ3z; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id BE289C433C7; Wed, 17 Jan 2024 01:18:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1705454297; bh=p9Rh3dyRs/5GUJfFv0bThfhcOx9k3Z/O3iFRLNLB+9Y=; h=In-Reply-To:References:Subject:From:Cc:To:Date:From; b=UufWcQ3zY5TXWZ9yO2rkxrBig+h80cgpqDs9jkj0hrKE5Zmv3LGgrQJYivFsPDX+1 JvpxG/EPiS70zVWhzBCsttd6P9KdHSTlHviGAuCzmt3MtSzpNEOrQGx9PKhfj/O7oK 2q1xpb5tJBIv6ovLlxzcfOxzIlBdoMnJIxdQOFOrYDtnXoyo1E3VLcMLZP4LLB8FAm MIKw+D75L3kAOtUuOFQ6hNyub/u/JTwhltThkfnalFe08AnrrnBBW0ug6CabnNhs16 EXaHb9DeFDkkRgTIqjjlkgPIfDO6zCXuJO28H4TDnWXBpBL/1G+um75K/Op2/cH/12 5Ez9RKJe0ODOg== Message-ID: Content-Type: text/plain; charset="utf-8" Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable In-Reply-To: <20240115203230.GA1439771-robh@kernel.org> References: <20240112200750.4062441-1-sboyd@kernel.org> <20240112200750.4062441-5-sboyd@kernel.org> <20240115203230.GA1439771-robh@kernel.org> Subject: Re: [PATCH 4/6] of: Create of_root if no dtb provided by firmware From: Stephen Boyd Cc: Frank Rowand , 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 To: Rob Herring Date: Tue, 16 Jan 2024 17:18:15 -0800 User-Agent: alot/0.10 Quoting Rob Herring (2024-01-15 12:32:30) > On Fri, Jan 12, 2024 at 12:07:47PM -0800, Stephen Boyd wrote: > > diff --git a/drivers/of/Kconfig b/drivers/of/Kconfig > > index da9826accb1b..9628e48baa15 100644 > > --- a/drivers/of/Kconfig > > +++ b/drivers/of/Kconfig > > @@ -54,9 +54,14 @@ config OF_FLATTREE > > select CRC32 > > =20 > > config OF_EARLY_FLATTREE > > - bool > > + bool "Functions for accessing Flat Devicetree (FDT) early in boot" >=20 > I think we could instead just get rid of this kconfig option. Or=20 > always enable with CONFIG_OF (except on Sparc). The only cost of=20 > enabling it is init section functions which get freed anyways. Getting rid of it is a more massive change. It can be the default and kept hidden instead? If it can't be selected on Sparc then it should be hidden there anyway. >=20 > > select DMA_DECLARE_COHERENT if HAS_DMA && HAS_IOMEM > > select OF_FLATTREE > > + help > > + Normally selected by platforms that process an FDT that has been > > + passed to the kernel by the bootloader. If the bootloader does= not > > + pass an FDT to the kernel and you need an empty devicetree that > > + contains only a root node to exist, then say Y here. > > =20 > > config OF_PROMTREE > > bool [...] > > @@ -195,6 +191,17 @@ static inline int of_node_check_flag(const struct = device_node *n, unsigned long > > return test_bit(flag, &n->_flags); > > } > > =20 > > +/** > > + * of_have_populated_dt() - Has DT been populated by bootloader > > + * > > + * Return: True if a DTB has been populated by the bootloader and it i= sn't the > > + * empty builtin one. False otherwise. > > + */ > > +static inline bool of_have_populated_dt(void) > > +{ > > + return of_root !=3D NULL && !of_node_check_flag(of_root, OF_EMPTY= _ROOT); >=20 > Just a side comment, but I think many/all callers of this function could = > just be removed. >=20 > I don't love new flags. Another possible way to handle this would be=20 > checking for "compatible" being present in the root node. I guess this=20 > is fine as-is for now at least. Ok. I can add a check for a compatible property. That's probably better anyway. Should there be a compatible property there to signal that this DT isn't compatible with anything? I worry about DT overlays injecting a compatible string into the root node, but maybe that is already prevented.