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: 196015 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:9bc1:b0:106:209c:c626 with SMTP id op1csp668030dyc; Fri, 2 Feb 2024 12:00:53 -0800 (PST) X-Google-Smtp-Source: AGHT+IHQuxi1aeh1x+33oh45tLTF8c7As5n6lh7AK2Hm5fjGrgBPyyLyd0HGewU5o1EGdY/qMgIg X-Received: by 2002:a17:902:ec90:b0:1d9:3320:14b2 with SMTP id x16-20020a170902ec9000b001d9332014b2mr4312086plg.46.1706904053375; Fri, 02 Feb 2024 12:00:53 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706904053; cv=pass; d=google.com; s=arc-20160816; b=QIFiKClDI3ktaOJsbH8C7qLgntHFr0/bqKiZYGSjdqCMpwAZQqzLelumIgly/3L7yR HC2FUoTkkPa1aGcF7AWkATI5yZ+bezSSOXbdsDSw3VsVTvEsOo3SmBeBcDuzsMFagk9P wIVp62bDaQ2cfAnczG7PrOZ8OnUNQ3hdlzNMIfInU66AE/BppciyEe3bxpV+XALqsPxa pR5ufCOv6KHMcQ/3FkW2TXEGwaceHwVk1md+/XgeKmDYZCtf6FzHTVuZqfx/LdNe518h zWUpKFq9IvtSFa4HkPZCIDbD+8mvDIhMblH0Pkz1m9tbuQwIJLWsdW3hy/6S6u2mqJ89 MMQg== 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=aq0wQCSGkYOTPQQZka2W9Tc3A/BNjaFDxorl+wK66v4=; fh=kTcpWcepvewse6hJ7I9l5SGFXm/9Ww70Ft9XQVNpeV8=; b=imAzE0PfvMYVm37kI3hiJF0b5J+hx+qf/nq15mlggCxlk56iSqYWU4V1kBcoPd4ATR gihiyuNKey0hS73MMZ84J0tBdjbGrGiAkOW1Ggvw9uUQAKHPkbBCGHqciTbMlu4TpGNd Ud7FVEutiSLS/4G7vzEHPyePYClJ+8LRwKfkIr3/ISwIWoJ94MdsLscBuzW9Ut0fWxIO Y9/GqenxZErQgtcEyV53w5NVwe9GSms65HvvmtWLExnzJw/JF0vVv63e2GtQtxdW7UDI 4GNN0l+B6MG56J1Tdfd7NRncGNGoXVzfnbmqZvREMsE7+ZdAm5Hugl7e+h2VLO93n4ZX AT/w==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=Oe5mTlqQ; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-50512-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-50512-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org X-Forwarded-Encrypted: i=1; AJvYcCUf0SnHPvXShLeIyjQNeRPKGHjzJ0GtrtwRbbKgkSI9ZUSJkGOcsCj+KWfmSeplLgOpR0mO3vWzyQQmosUrgZYRCKvMLQ== Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id u16-20020a170902e81000b001d93b220500si2249268plg.97.2024.02.02.12.00.53 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 02 Feb 2024 12:00:53 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-50512-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=Oe5mTlqQ; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-50512-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-50512-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 sv.mirrors.kernel.org (Postfix) with ESMTPS id 27CC028D070 for ; Fri, 2 Feb 2024 20:00:53 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id E99ED8595F; Fri, 2 Feb 2024 19:59:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="Oe5mTlqQ" 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 1B80C81748; Fri, 2 Feb 2024 19:59:13 +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=1706903954; cv=none; b=gvOiKvW05enLKlRwKrCWOTa8qvIStWvf0bAxtIVmfRj/BlcTcEOeAJX7Fk9X3rUVzwu5uBiwif+mxkUnlBwnuJD0KWxAQ605WE2dMyX+G9/L+o2JkVt8qZ/UUz6LmzQ6xjVika0uMDlUSRrW5v33B2ae3Xe/Ujlc6vt+o7rOFNw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706903954; c=relaxed/simple; bh=hCAh9IJVjneFBmTI7MeY6517yfTJZxfzJ8kdqiP/+uU=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=lXWUNX0Pji0M6zGmgtyZH3IchbNt84920vL8kMWlbCOapGqHV9ehnA+1EfyHe+ihHUERwcy4u3ZI1mGTlYguLFBxAaPQ+pCUoeP141Qx8WTXuZV9VZt4oYO0jc5OKExfEuDsvf64nvfq2EeJj1MflcWzV/Taaz9OpUr3WCGoKsw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=Oe5mTlqQ; arc=none smtp.client-ip=10.30.226.201 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> 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: 1789818624728639603 X-GMAIL-MSGID: 1789818624728639603 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;