From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 6A612C47077 for ; Wed, 17 Jan 2024 01:19:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:Date:To:Cc:From:Subject:References: In-Reply-To:MIME-Version:Message-ID:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=D/Tj6cs1nPjo0y88H94WexvncftIUWI9TUCosD1UgD0=; b=uyM1WEc5CRoClG lsG1WRVwvBVZQJ1haWWc//QHcNwp95LQRWtZ6s0pDu+b0EtiXKiBUJNw0iGYjbnPYKuLSt3ijYhMf TO0L2O7K/ynmF//+Y4EsU333VZbfgSKyNskAUk9Lj1QBA79mKLGWw4/0yHJE3QUF4G26xMRVNfBbm /UZBkqGqfv0Q6OYJSHY0vb7YlZB/ZqwPhPtnGGKCnSxI3HxaMFY5yJvuFo/Tf5cWVo6RN1ImOIc2o pCb3U9LRF2SbWuembZ/249r6hbK+3xdq7xoThITjvF8BxZFHXPiG2UX9TQhSTSErDpT0SZJtX9H9r Ci/jh5RVa4gapZJSM41w==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1rPuZc-00E8rn-1D; Wed, 17 Jan 2024 01:18:32 +0000 Received: from dfw.source.kernel.org ([139.178.84.217]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1rPuZY-00E8py-2X; Wed, 17 Jan 2024 01:18:30 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id 314CF614C1; Wed, 17 Jan 2024 01:18:18 +0000 (UTC) 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: MIME-Version: 1.0 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 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240116_171828_931159_562E7F0C X-CRM114-Status: GOOD ( 25.64 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org 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 > > > > config OF_EARLY_FLATTREE > > - bool > > + bool "Functions for accessing Flat Devicetree (FDT) early in boot" > > I think we could instead just get rid of this kconfig option. Or > always enable with CONFIG_OF (except on Sparc). The only cost of > 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. > > > 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. > > > > 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); > > } > > > > +/** > > + * of_have_populated_dt() - Has DT been populated by bootloader > > + * > > + * Return: True if a DTB has been populated by the bootloader and it isn't the > > + * empty builtin one. False otherwise. > > + */ > > +static inline bool of_have_populated_dt(void) > > +{ > > + return of_root != NULL && !of_node_check_flag(of_root, OF_EMPTY_ROOT); > > Just a side comment, but I think many/all callers of this function could > just be removed. > > I don't love new flags. Another possible way to handle this would be > checking for "compatible" being present in the root node. I guess this > 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. _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel