From patchwork Fri Feb 2 19:59:04 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Boyd X-Patchwork-Id: 13543347 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 B3BDFC4828E for ; Fri, 2 Feb 2024 20:00:34 +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:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=kTACp1kf2L0bNWNoW14CzA+zortKLz1mvp1gC6puUpU=; b=hkJv9F6UQP0PZ0 4xyWTKl02YDuFSo06+7ksFFw2iON7TYEG83tMdNNKKaMNzejMSNXW/Ha8ZGGYYzi+/g+WMwb+FWVG W9Bl1zBkvCZpGna488oNeHQ8c0SQ4yYm+W3qLRYsci99giw0fZBZws2lDXcicF7vP9xynvsHCx0E4 l/cTEt3E2VhZ+5J1TQfLNE2HyxRKk4cnLjY2VVCfaQ0S+af3Ioz5+GcTy5ZpdmMrKYHNRH41FjFlE TKkL92xV72VzBzOrz4nd4v1BM7Du05+y3Tp2tJ9bfenRtqz/5X99DDJl/9tZL8RH0lmXY0/DMF4vj snMv+I+3Xh42K7QEn2MQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rVzhf-0000000DIMK-0iWB; Fri, 02 Feb 2024 19:59:59 +0000 Received: from dfw.source.kernel.org ([2604:1380:4641:c500::1]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rVzgx-0000000DI36-1tSE; Fri, 02 Feb 2024 19:59:20 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id C2CD062863; Fri, 2 Feb 2024 19:59:13 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0EA47C43390; Fri, 2 Feb 2024 19:59:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1706903953; bh=hCAh9IJVjneFBmTI7MeY6517yfTJZxfzJ8kdqiP/+uU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Oe5mTlqQV4TxhihRvuWjgYd5mxic2ugd/H4tFQBcJ/U405XynzpfABSFHTa+Foabt nGUgMGsnJ7GPKJm90IUmijMHgVU34jyZ32du/2NiMbIrfr+4NzpMSpNF0ofS3N2yK6 CFGHkLMXYwt2V3Zl50Q0AcnPcrEYu/FF/JMS8QO6pKTK8VNYZkkksNgTetK25izGPV rl+jjk+FQadEwPmK8WcaQKd6vA5wD9GqrqVe4coMaA6xgtc1xb/8LHDTbsoZVVN+3I p9/nRIR4huLAAKk4VnEmgaiGqJRIIQjY4z/H3bzHkJkNg16kubZMki/t2r5Lqzo8+Y R2crPQ+Zr50rQ== From: Stephen Boyd To: Rob Herring Cc: 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 , Richard Weinberger , Anton Ivanov , Johannes Berg Subject: [PATCH v3 3/7] um: Unconditionally call unflatten_device_tree() Date: Fri, 2 Feb 2024 11:59:04 -0800 Message-ID: <20240202195909.3458162-4-sboyd@kernel.org> X-Mailer: git-send-email 2.43.0.594.gd9cf4e227d-goog In-Reply-To: <20240202195909.3458162-1-sboyd@kernel.org> References: <20240202195909.3458162-1-sboyd@kernel.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240202_115915_792224_6F7AD850 X-CRM114-Status: GOOD ( 14.25 ) 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: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Call this function unconditionally so that we can populate an empty DTB on platforms that don't boot with a command line provided DTB. There's no harm in calling unflatten_device_tree() unconditionally. If there isn't a valid initial_boot_params dtb then unflatten_device_tree() returns early. Cc: Rob Herring Cc: Frank Rowand Cc: Richard Weinberger Cc: Anton Ivanov Cc: Johannes Berg Cc: Signed-off-by: Stephen Boyd --- arch/um/kernel/dtb.c | 14 +++++++------- drivers/of/unittest.c | 4 ---- 2 files changed, 7 insertions(+), 11 deletions(-) diff --git a/arch/um/kernel/dtb.c b/arch/um/kernel/dtb.c index 484141b06938..4954188a6a09 100644 --- a/arch/um/kernel/dtb.c +++ b/arch/um/kernel/dtb.c @@ -16,16 +16,16 @@ void uml_dtb_init(void) void *area; area = uml_load_file(dtb, &size); - if (!area) - return; + if (area) { + if (!early_init_dt_scan(area)) { + pr_err("invalid DTB %s\n", dtb); + memblock_free(area, size); + return; + } - if (!early_init_dt_scan(area)) { - pr_err("invalid DTB %s\n", dtb); - memblock_free(area, size); - return; + early_init_fdt_scan_reserved_mem(); } - early_init_fdt_scan_reserved_mem(); unflatten_device_tree(); } diff --git a/drivers/of/unittest.c b/drivers/of/unittest.c index e9e90e96600e..a8b27dd16ecf 100644 --- a/drivers/of/unittest.c +++ b/drivers/of/unittest.c @@ -4075,10 +4075,6 @@ static int __init of_unittest(void) add_taint(TAINT_TEST, LOCKDEP_STILL_OK); /* adding data for unittest */ - - if (IS_ENABLED(CONFIG_UML)) - unittest_unflatten_overlay_base(); - res = unittest_data_add(); if (res) return res;