From patchwork Tue Jan 30 00:45:01 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Boyd X-Patchwork-Id: 13536609 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 781BFC47DB3 for ; Tue, 30 Jan 2024 00:45:27 +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=PRMXny3wWgN5+8 73HzrdT+x2SfdNn9QJ2cmZkgQxyFLue7yCPoVMpiRtqMS1RBtB91tpta1QRjROqFEJEqowbAnGKp+ yqLnV3SiI5fDoTd3QH8zE7q41mjaxItX3fRkwaUpdOp5tHppv+hifQPa61ojNlqdkKTBd11LP1IGC jWbSWL8V4A3dOS2767RpyCoruXz3u8HBGNSFVV6vrq3dGS13MnQSTwPSrjilNwtWP05wdo6/4lKDA INKRlQDOz2WN66Iw5QYISayf9TO0/J4at+9ZV8GjR3q1BB0CtAoBPpkUHKChVsALq+u2+WSwVWF9L QV3lxwDSFKyLVIYe2Ctg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rUcFa-0000000EjU3-2dXe; Tue, 30 Jan 2024 00:45:18 +0000 Received: from dfw.source.kernel.org ([139.178.84.217]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rUcFU-0000000EjNt-411r; Tue, 30 Jan 2024 00:45:14 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id 4715E625D5; Tue, 30 Jan 2024 00:45:12 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 88633C43330; Tue, 30 Jan 2024 00:45:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1706575512; bh=hCAh9IJVjneFBmTI7MeY6517yfTJZxfzJ8kdqiP/+uU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=BQW+DxdZHpADTKR91v4ppHkYQ9+QCKgvfLROiSuscRQCVoMwzgo9BkRP9t9Rzty6I hQgE6xH0BVaMuJAnGsZVpUTZS5T1isEPfc+PbG0YFm0ajE8H9pnCAtL1ONUGEa+PdK 5vGsUjPO+1tJEBKbpbgo7Ohq85IS/HcI8yqOxCOj1+0L97hmbkEl1sl/DuyrLYgqFG wkegUbFNEMkuAulGBRt+vVre0qdMwKrGUfyksKhK4dqFT8g2VqiwdPUJI+XlGmk7Hb 5XSKpvg+ks/MYUMJIGucojwHElxhYMaKL+EopAKboMDnd1KT/SL0wKjY8Jvbr8i8Qv N7QCp2+WUyLJg== 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 v2 2/7] um: Unconditionally call unflatten_device_tree() Date: Mon, 29 Jan 2024 16:45:01 -0800 Message-ID: <20240130004508.1700335-3-sboyd@kernel.org> X-Mailer: git-send-email 2.43.0.429.g432eaa2c6b-goog In-Reply-To: <20240130004508.1700335-1-sboyd@kernel.org> References: <20240130004508.1700335-1-sboyd@kernel.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240129_164513_066838_A413D01B X-CRM114-Status: GOOD ( 13.82 ) 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;