From patchwork Fri Jan 12 20:07:45 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Boyd X-Patchwork-Id: 187821 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:693c:2614:b0:101:6a76:bbe3 with SMTP id mm20csp413969dyc; Fri, 12 Jan 2024 12:09:14 -0800 (PST) X-Google-Smtp-Source: AGHT+IEtD/yWD+PsBWfJiHU4Rj1CE3weLBVbYUDRJWhkpuxHeNTGgGxg87zW2CnjkjtI/tL0R04k X-Received: by 2002:ae9:e007:0:b0:783:4d8:d178 with SMTP id m7-20020ae9e007000000b0078304d8d178mr2027281qkk.119.1705090154316; Fri, 12 Jan 2024 12:09:14 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1705090154; cv=none; d=google.com; s=arc-20160816; b=ClLf1H+tcxZyaq4HUHXdfWWIZO3MFY5zqXqPoilMoU4pKo/6KKssgrhYU9uhRQKrsi KpdCBxrP6C1rvNO6OkpTdCWIfQM9Pg/IMED+N5ie3nOqhrDs3gJLN84GzjuRjOtm0aTd 7XHzcL6ZLovcIcgI5eRoUlJg2LmWLzUj/XPrk3/tgLuNvWIJUtRYKiiGBQpsWVw7X2RC m2ObQFL78ywfcem9yFyG+2rJdBxxH3hmnf6EGM20lj6UZhKdMEA7mIsIc0hLOwDc8Ba4 jvy9xH3GDsryU3MDtcTUPnVAsQpXL4/bOcLcscQY0M/m0F6PLSk7BeJ47G8hUUN2edOQ feFg== 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-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-25015-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id k2-20020a05620a414200b007830c6793f3si3864554qko.226.2024.01.12.12.09.14 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 12 Jan 2024 12:09:14 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-25015-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; 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-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-25015-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 ny.mirrors.kernel.org (Postfix) with ESMTPS id E91911C2195D for ; Fri, 12 Jan 2024 20:09:13 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id AF91C1774F; Fri, 12 Jan 2024 20:07:56 +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 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1787916613591603676 X-GMAIL-MSGID: 1787916613591603676 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;