From patchwork Sat Feb 17 01:05:52 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Boyd X-Patchwork-Id: 202547 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:693c:2685:b0:108:e6aa:91d0 with SMTP id mn5csp91876dyc; Fri, 16 Feb 2024 17:22:53 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCWykE1HBrkjurYArhGr3HqepQtNqRpv5zyXWmRCIExsGf7LdYSYfUP+LQ7UgGCaOyeh1sxbhkGtSFZACr+kKOzv5JzfIg== X-Google-Smtp-Source: AGHT+IGFUWf2Kl6OzxzBqp87nOTKpI5Dv2uzFbAG3LLyEguJwAUmEpnIyeQ4bC+SPx0KZEhZNgf8 X-Received: by 2002:a05:6e02:370a:b0:365:1578:8c17 with SMTP id ck10-20020a056e02370a00b0036515788c17mr2600818ilb.2.1708132972988; Fri, 16 Feb 2024 17:22:52 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708132972; cv=pass; d=google.com; s=arc-20160816; b=lz/Ol59eathz/1trQVST2PnOnJDRhfQv97KLUXniz2QdAu9lvfVAqtMxnYRjnypgNh H76hvbfYZ35AzM4+y8MaryQjxrRKdJD0PufDqPBk/x3PB8LZwgQY60ujcxeOxwy3X1jO XvKjPHv66TPpE8H7aXO3jcXTnU8uSaVt16EmMle2unQGhvXNdd6z2DsWNYBWCZbvZAvG KYJWuHwLojvLWB11wOFOQmpuAJW7ma6eKsle2cMxZky0FiqSNhXbuQNTh08mTqjkpHzZ SaoEpRhkRtRUaj7nL8iI7UliGax2XkJ3dnHpH/KtGpvO81/hkAt6qiHnKiIqWnYzsduE aSHw== ARC-Message-Signature: i=2; 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=fu8ZVXP+jo7D5EaQ1/47p5cYa+9qDZG+rGOe1sBHnWk=; fh=sz1LeV376A5PAD24wWsZ2HxecezkpG42RO1kUhR4ZVE=; b=G2yAvcdw+ZjDjTSdMUX5X5k+tiQd7knkpbpyMuXRDot+gnj7z4LVf4b51FWDqiw2WW sCj5uRx97RPyYl9uPn8Z7Jcf4lzaGLUz77BzS8Xkjv5RV6NYmEm/qePCt3nbfLTUJmCr cww0TH5muse6qb+s4sLMWU1y4cTSQ3e+2gylvtGEuzwYrjRGKAYVeXBOW5Sygr8CL1Wb zwcwunAzxfM14CArAYEDKeJUstgJrONBaRL1tjZtJII+I6klCze9ZEESno4GIs77Ouka H33eH2DfzqYdrZwQUMmokk+uwEeU4G6ODPXA5CE5I0Fm+Yrj6iSpUB0YaIWMmZ7tH1St KZ4w==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=nWHPrdK5; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-69628-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-69628-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id a20-20020a637f14000000b005dc8719cdfasi702402pgd.298.2024.02.16.17.22.52 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 16 Feb 2024 17:22:52 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-69628-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=nWHPrdK5; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-69628-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-69628-ouuuleilei=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 C6227B224D0 for ; Sat, 17 Feb 2024 01:09:55 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 86E5E210ED; Sat, 17 Feb 2024 01:06:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="nWHPrdK5" 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 C7B2F200AD; Sat, 17 Feb 2024 01:06:00 +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=1708131960; cv=none; b=hGhvUpypWcAef3fk7Kxsgi+YPWHKRqXjhvSqYMdmq974s1c15ysXi3gR1LZe4Jj7flw5j5OIOlawu3vP2e42ffnR4sJezwg7qHEmlqJ7QXiV9gKgUNIYo4m+rJ2NzLgbmiqqUMu2eajoq32vVxmWUReFq8PNRPq7VQXyI7hTGgw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708131960; c=relaxed/simple; bh=bAiFEbT58TXbP+zf0tFWIGODmRi8LJ7psP4/tHXmMrI=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=oipN2FitzHPpQwjTmbtft5MGZAoxajicanu/Uft9bBX/lzx5JWGNLo7ixPXY9Z+xID/wl+dP/OP6ji/2eXylsTOGydGFQg+97IE5K3O9QeMGKMFASRWt8dFdNzREft5vEa4sPu4DSe7hLPV+N9icjQnCHXIbxEmtXEd+aGJw3Cw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=nWHPrdK5; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id BBAC4C32789; Sat, 17 Feb 2024 01:05:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1708131960; bh=bAiFEbT58TXbP+zf0tFWIGODmRi8LJ7psP4/tHXmMrI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=nWHPrdK51ANKmmUE3NqJATrEVu6sf4ZIcdhvGIb1FIOmfGEAlBBUzElIK3HXYvtau HM8OPq8HMxmE9tV8EHUsdjlUrBVacmJLtTFqEgDvSIkYu//JsuZnSiCygfMUAUP5p2 WzURYNN7LTNRzRNRTMPM9s9UNIbyHCFzBjQQSta0mjCFfUeA2MLNLYbltHu4sA/nRK xAhmAwqIQ5hcPyyiybY2EYhSeBudz+h/5mDdVenucdfsF+wgwIZur9UXrCkkKGQ4EE 8ioWUb7gB4t06y/Xgd2WQLhkZe9z3EacufoevPtfc57OygRYn0npOjK9jtlF4dknIo FNcCYQOdi1FQw== 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 v4 3/7] um: Unconditionally call unflatten_device_tree() Date: Fri, 16 Feb 2024 17:05:52 -0800 Message-ID: <20240217010557.2381548-4-sboyd@kernel.org> X-Mailer: git-send-email 2.44.0.rc0.258.g7320e95886-goog In-Reply-To: <20240217010557.2381548-1-sboyd@kernel.org> References: <20240217010557.2381548-1-sboyd@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1791107240204795543 X-GMAIL-MSGID: 1791107240204795543 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 cfd60e35a899..891752a20a5f 100644 --- a/drivers/of/unittest.c +++ b/drivers/of/unittest.c @@ -4087,10 +4087,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;