Received: by 2002:a05:7412:e794:b0:fa:551:50a7 with SMTP id o20csp2524880rdd; Fri, 12 Jan 2024 12:08:31 -0800 (PST) X-Google-Smtp-Source: AGHT+IG1wInV9QVS/z02xEbrutvZYN72lyMDIDw6q8z1W+T6I2eGsyzWerKJQFvuo32xLZ/KcR2W X-Received: by 2002:a17:90a:1049:b0:28c:9093:b0c4 with SMTP id y9-20020a17090a104900b0028c9093b0c4mr1483784pjd.43.1705090111750; Fri, 12 Jan 2024 12:08:31 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1705090111; cv=none; d=google.com; s=arc-20160816; b=OoNUYHiTRNXzwzPxdmqO5M3h0QUzyPAMMwWrrmT9jYDEAUiOJExGiKTl3DR+NDRwFv cIYuodarUDJFfG5IfEGtOj2595iYb9J7v8YjY7JipcbHn6hccqMkS3OATD4GJN1cxhhU BzqCekBMVSJcC9qAOSQpAdeB7W6Ttw9zNb/OmTzgp+ZoLzo4Q+uOmk914vhSYqIIDetc qX1K4K5TVTE3yZuV+oj2M/RdWzF+Df1Mr0K4ZNeE9ZGOC4lI45s4gMrPq+FZTUQVaM4L 6JKCy8e6q9VQJgb/oq6PDy28JVXNFfA4lNuaIZlrqlLnYWex2eU7qOENHTvw1PHg/2wO iuSw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=aq0wQCSGkYOTPQQZka2W9Tc3A/BNjaFDxorl+wK66v4=; fh=sz1LeV376A5PAD24wWsZ2HxecezkpG42RO1kUhR4ZVE=; b=FHwijtittRMwp0zw7nD/T0Y59es1bbjMyqEN5mPCDxXhU4RNnutg5K+SVt1COTyzys C3ARur9aP5HD7kUbMMUiuw3a19IW2aEgoP9uB9LLI7OxOWNb5gx17hyMdPrZnLENWO1d 0Zb78bpq9zfxL9VV9zgj3BcR3GDZ72q1LHd3Nj8fis2CYKTf2J954WoTfDL7We5ZoxP7 IsozxpSc0+ijXEdjkV93LYzG9yWGeRfVTViPvZvkqx3/14EJRqrTfnqz74UzU9aPdg7l XUWarhIkYR1AgwFjEYPY5CkNgQjMJmX3S9ehBitb7oOJpDOPiykMBJe4iRCIA8MvvV3P 7DKA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=pRzydyiS; spf=pass (google.com: domain of linux-kernel+bounces-25015-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-25015-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id a12-20020a17090a8c0c00b0028d01d2724esi3979599pjo.145.2024.01.12.12.08.31 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 12 Jan 2024 12:08:31 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-25015-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=pRzydyiS; spf=pass (google.com: domain of linux-kernel+bounces-25015-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-25015-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 sy.mirrors.kernel.org (Postfix) with ESMTPS id 8E6C6B22637 for ; Fri, 12 Jan 2024 20:08:25 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id D2C02168CE; Fri, 12 Jan 2024 20:07:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="pRzydyiS" 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 F1BF21643D; Fri, 12 Jan 2024 20:07:53 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0A051C433F1; Fri, 12 Jan 2024 20:07:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1705090073; bh=hCAh9IJVjneFBmTI7MeY6517yfTJZxfzJ8kdqiP/+uU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=pRzydyiSZaxydESQIgXX2hw/cVf7vyTmc+xuEwiwVlBKiyC2tWa8CvkSI8366MFYw 8SzWqLo/pkbptr5j5vAKr1z56Kk90vCACYI2PXj0ALa/bFf37lUixPzL04HSU6sU1C wqG2KjQY0pkoij12aFDltAVLeOZoCOwV99KVi/iKkJCnMGAdVUh4Fi0rOELKnCx7uD zAPLrjY6IzzNwVDG6Cs2gLMOIbsRQ4lfJrSkmxdEIpkF3Voe/+O2nWVrOTj03f+Fd2 qqrH++GNGcPFVa0oA8uzRTQgGRCHot6WZuRYR27/BoCvUWvV2N6obF523XhCQr7yHN aOfp871SxcCxw== 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 2/6] um: Unconditionally call unflatten_device_tree() Date: Fri, 12 Jan 2024 12:07:45 -0800 Message-ID: <20240112200750.4062441-3-sboyd@kernel.org> X-Mailer: git-send-email 2.43.0.275.g3460e3d667-goog In-Reply-To: <20240112200750.4062441-1-sboyd@kernel.org> References: <20240112200750.4062441-1-sboyd@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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; -- https://git.kernel.org/pub/scm/linux/kernel/git/clk/linux.git/ https://git.kernel.org/pub/scm/linux/kernel/git/sboyd/spmi.git