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: 193756 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:2087:b0:106:209c:c626 with SMTP id gs7csp920479dyb; Mon, 29 Jan 2024 16:46:32 -0800 (PST) X-Google-Smtp-Source: AGHT+IHbNrqkiUgTlEm1w2Bj6O6SSXhU0t2Enp368ak3UU6qdq8qCus2yNC2jl1VVl9KMpA/I5vB X-Received: by 2002:a05:6214:1945:b0:68c:5d65:39a8 with SMTP id q5-20020a056214194500b0068c5d6539a8mr960725qvk.87.1706575591863; Mon, 29 Jan 2024 16:46:31 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706575591; cv=pass; d=google.com; s=arc-20160816; b=ygK4p9Fj4gTezIPXaY92Kpn2nRZPO8nLaqW8ipyV70pqwsJTSgiBMfyl/8DcQFoKrO sOH5zLtyFYGS+6vZDNVdOQf/M0IamAR0w6xNGBxRScqTqjzXh1AHfjwxAAE4w+gJWvBf Adc5K/pjR7zxqn42Gu7sfGA3VfUMbUns8vgpVQAgCrFzR1GnrbNb11Q/jxMtSyRM7Aw8 VtQpgJOYHEOlssGqsHsm8DPkstMuObWBvVWRPIokeVP25XZ9xd6OvOtVAB//eSxSXoJg EiJDM07hyB5QLovrfJfwNcDXOgJw5k5ASTQpZv4CqZyF1KjKYqZ783vM3oLsX6e2tYr3 ZppA== 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=sz1LeV376A5PAD24wWsZ2HxecezkpG42RO1kUhR4ZVE=; b=WXQGQow3w9J+tayS6hUoq26ctn5AEAccr0gMyKb/RPcRy7hmNBt99ag76VHdCJb/Ff MfuRtkvc2pt0yuCvCXkVJa9/CJVNkybi3obF+Fww1PFvVLyvOrEZIY/lvi3Jbz7hbGQ1 6K7S93GR4DFi2Y5zclUcuLB7oYTuufzmlniDCeBYS9+aPA15CHc1DYO9zkWiEKlGh70d sweW8oJM0p0Salb1w9+dcwbXmwT1JDIBUSkETDw7FEApuC7/UPBULOv+Nh+D2Rn4YqxC L2cezQCNXQzL57xr6G6n914gcANhXpKZEf8XnFbpxTDhSXdCZMrYZ3+BBueclpAMfjhN 2Ctg== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=BQW+DxdZ; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-43686-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-43686-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 a21-20020a05620a439500b00783fdde5670si3936872qkp.389.2024.01.29.16.46.31 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 29 Jan 2024 16:46:31 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-43686-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=BQW+DxdZ; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-43686-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-43686-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 A52DE1C219D7 for ; Tue, 30 Jan 2024 00:46:31 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 3A36137155; Tue, 30 Jan 2024 00:45:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="BQW+DxdZ" 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 78BD72E40E; Tue, 30 Jan 2024 00:45:12 +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=1706575512; cv=none; b=L+VRFm7UR40tlEOCpWdkS0rT21EaqcnTZbcPO8emlJoxfcuROW7oGhsB9SLWVQrdqm8hsRd9LOddGYY4JzgAnEW5CvHmgkbuthcpPgkRTTeWeq+VBBBYmmOL8B7eRhQEkVMJQjZnvh3SV3dmk1WZ7HmMncV06RoPV0kYTLOajnM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706575512; c=relaxed/simple; bh=hCAh9IJVjneFBmTI7MeY6517yfTJZxfzJ8kdqiP/+uU=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Bbq25jltsK+ePEgsIr4slaqedm01UB1MlNqAA2lSlzdmrFEiuHkD+cGd5Gp5q5XrBGKp0RP1my87FPRzyVoWcTnRmxxeDX7b9SZh41mPSfA4gEpGimp3deyRvvMzmSQ2+gMyIdJwpzA6apcVhEE7DC52mM4nYWvLbTGbCJ3WNlI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=BQW+DxdZ; arc=none smtp.client-ip=10.30.226.201 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> 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: 1789474207541237780 X-GMAIL-MSGID: 1789474207541237780 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;