Received: by 2002:ab2:6816:0:b0:1f9:5764:f03e with SMTP id t22csp3317855lqo; Tue, 21 May 2024 13:12:46 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVN6GaW7MU7hsaKxxb/CRErnB/D0vTV04ro5UItCzoKDogw8gA1VT75t0SSiwKmQbKmclfa5x65bWr2HgYLg6Vp3AvmxgG62h0PFTYGuw== X-Google-Smtp-Source: AGHT+IFxlHeVDaT15roSgjbwF2f0QP+Z9QgkcRqLNyVKseYtpkdH2LrMwtVZ18HJ5jfF8M2dP7eZ X-Received: by 2002:a50:ab59:0:b0:56e:238e:372c with SMTP id 4fb4d7f45d1cf-5734d67ab0fmr23022186a12.26.1716322366073; Tue, 21 May 2024 13:12:46 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1716322366; cv=pass; d=google.com; s=arc-20160816; b=BdigrB0bqL81+8wWZ0BKG3y8qLvt1dLctKJVZ395MDdeDxjfqErpU9wakG2S7Pd0s7 yVFCcmw0RWiDUXxjC1pVKPxwQzkQSaWBgD3kY0LkwsZjO68lYuKNMdzJtyFlrod2d37A oGG/Kc1HydAhN/txAV22jcZaA0zxUXtWF0Rf16SOQ6aETo9GRh1chTdwLFPFz7iCC27L s38pWggQF9GeSPJY89rGz9NKVU207wJTIr4YTxurb94Yg6gCrJ5BdC0b/tkoQri8jknY 53sUS2yCK6vtGUu2JSdJV++8K+MgtrcZW98WwqU0KEUnINDlQNK8vu6zF/n7WvmK+ASg jhxg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :subject:date:from:feedback-id:dkim-signature:dkim-signature; bh=eTTfNISa1AvyB5+NKyzaR4LUuaJMzDBXdrMDNNsuz0c=; fh=dDGKIMcG3H+q3nWvOlO7AA2IrGQ/jjD28aNw+O4OeK0=; b=xuCStYTqHnj/hj/E8CZl+UmZJ3Fpq25HcMmVVE9+7gkDSkKNQZRhqLshD8jvKnLrsR kpGiymvLZ1uWU6B8w6Tl/TeA2l44fZBFktrvlUeBcWRRgw/A6MwlLiyOU1/jDfiGNWpJ 9ihY0if4ipqFzcbGI9TUuF/ZjLyHABmPEe6ia+v5Fxz81LcB1mb2yb1+ON18CyqFzrVM gJ4XSZLqyGI/MGUtzXsqkSMxPfYJgxQXbmdDhnPBL8WucdESr4KYgfu/e20ip4OeGUKD pC96Ko3COtgPW8rqXihDRrjiBHJFOE843F3YGZB4A5CjYyYc4vroLbZSYtFdeWs/DNcN nNjA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@flygoat.com header.s=fm2 header.b=GPtqFbEz; dkim=pass header.i=@messagingengine.com header.s=fm1 header.b=OYYzxXhb; arc=pass (i=1 spf=pass spfdomain=flygoat.com dkim=pass dkdomain=flygoat.com dkim=pass dkdomain=messagingengine.com dmarc=pass fromdomain=flygoat.com); spf=pass (google.com: domain of linux-kernel+bounces-185407-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-185407-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=flygoat.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id 4fb4d7f45d1cf-5733c2d5297si14134125a12.287.2024.05.21.13.12.45 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 21 May 2024 13:12:46 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-185407-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@flygoat.com header.s=fm2 header.b=GPtqFbEz; dkim=pass header.i=@messagingengine.com header.s=fm1 header.b=OYYzxXhb; arc=pass (i=1 spf=pass spfdomain=flygoat.com dkim=pass dkdomain=flygoat.com dkim=pass dkdomain=messagingengine.com dmarc=pass fromdomain=flygoat.com); spf=pass (google.com: domain of linux-kernel+bounces-185407-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-185407-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=flygoat.com 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 am.mirrors.kernel.org (Postfix) with ESMTPS id BFE741F22062 for ; Tue, 21 May 2024 20:12:45 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id D5F21149C74; Tue, 21 May 2024 20:12:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=flygoat.com header.i=@flygoat.com header.b="GPtqFbEz"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="OYYzxXhb" Received: from wfout1-smtp.messagingengine.com (wfout1-smtp.messagingengine.com [64.147.123.144]) (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 F063114831E; Tue, 21 May 2024 20:12:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=64.147.123.144 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716322343; cv=none; b=L5l5pam8korRKldTOCN8DRXwmLXOGK8+vdISxYWJj+S5ltb9NDnzwNxWrPv3uyR9Aqii8f13GxlP6IlLnfkLR5EK9CWMafRt43uVmU7z2qAbFTO288IZQpRs+mOXBI8gmLlArmpBVwsXdHFNiIAK56AH3Hdz0KRU+xIR+jq/JH0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716322343; c=relaxed/simple; bh=xXIJHAJOc6onemD12GizOeep+GRhVclxjz9KYi4R0ZU=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=hCw69qKhfBgUBu5rT+lckYdpPzkmn9D0LbUfvPZmUVCw8XXZ16GYODFIs0R0hndZQVpIaAb3ztD7l7cvzypijk5E8zDD9jWKxMPsjrUWeDHvNU9va4yB0Xy0ZJnR3H6JUahxRO0VPDNWFCxzxd8NxRsjP0o21mTA2btar/BCFRY= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=flygoat.com; spf=pass smtp.mailfrom=flygoat.com; dkim=pass (2048-bit key) header.d=flygoat.com header.i=@flygoat.com header.b=GPtqFbEz; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b=OYYzxXhb; arc=none smtp.client-ip=64.147.123.144 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=flygoat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flygoat.com Received: from compute6.internal (compute6.nyi.internal [10.202.2.47]) by mailfout.west.internal (Postfix) with ESMTP id F338A1C000EF; Tue, 21 May 2024 16:12:19 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute6.internal (MEProxy); Tue, 21 May 2024 16:12:20 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=flygoat.com; h= cc:cc:content-transfer-encoding:content-type:content-type:date :date:from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to; s=fm2; t=1716322339; x=1716408739; bh=eTTfNISa1AvyB5+NKyzaR4LUuaJMzDBXdrMDNNsuz0c=; b= GPtqFbEzys+1djPR1hiQM1mABmXNhWXHmbryVmCTJJ8qWMGKVJbsL56EO2r5EPxd YuyMFdbyTd9tjJfpjpI/YuypQqQZJfcFj8cH2XB1U4632/skXr02n9aNKsPBopt/ ROd5ATCGjIyWtUO+MQlvS/sUHwozr2UDQ3EjmQ3+dj24oY0b+ts3BhlCT6P0NVRj 58p5a51niINw2zoEaEcGbb1f0CoNuEucrchgI5W6awEN3MAzlWp+2EoaiP3fYjS1 8POVPVk/sYvYEnz9ERDSUKrcyiBa3ST11TatWJ83wzw91gT+ormza5LgPzSIDHz1 9zn11ghXl3drA6Od6vSTyw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:content-type:date:date:feedback-id:feedback-id :from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm1; t=1716322339; x= 1716408739; bh=eTTfNISa1AvyB5+NKyzaR4LUuaJMzDBXdrMDNNsuz0c=; b=O YYzxXhbR7hXW6LiuVmJzvGQw22LdNaGj8q/3dHIg0oLIoqLbOl6vV96Yv5Yf0SuM brBtcAJhc4cRCm/2GjA7S1oicRQCIKacAMLID6FWEUeBn/DsjnRpk3B35FKOKQFW HkWckK4o8fzfeW3S0gcjCEGH9stanCL/MPEMouWTW3++pvWYMUXFVZWe1U9BNmVc Rpduy6SmLx4a8fa4Y7BjRdnpWYNUNg0qAy+RAUzE2wP93fixRJuDCRz6u5ug9aMi gk76sc+WVysCAY+0ZbeCpvrSO/cdnA8fuJOEO2XQwFahDQWnM+XxAimZx9N7gy25 lEt4fdJHTtEIWEwmD9Xww== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvledrvdeivddgudeggecutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmd enucfjughrpefhfffugggtgffkfhgjvfevofesthejredtredtjeenucfhrhhomheplfhi rgiguhhnucgjrghnghcuoehjihgrgihunhdrhigrnhhgsehflhihghhorghtrdgtohhmqe enucggtffrrghtthgvrhhnpedvkeeihfefveekueevteefleffkeegudeghfdtuddugefh ueevgeffgedukeejleenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrih hlfhhrohhmpehjihgrgihunhdrhigrnhhgsehflhihghhorghtrdgtohhm X-ME-Proxy: Feedback-ID: ifd894703:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Tue, 21 May 2024 16:12:18 -0400 (EDT) From: Jiaxun Yang Date: Tue, 21 May 2024 21:12:12 +0100 Subject: [PATCH 1/4] LoongArch: Fix built-in DTB detection Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <20240521-loongarch-booting-fixes-v1-1-659c201c0370@flygoat.com> References: <20240521-loongarch-booting-fixes-v1-0-659c201c0370@flygoat.com> In-Reply-To: <20240521-loongarch-booting-fixes-v1-0-659c201c0370@flygoat.com> To: Huacai Chen , Binbin Zhou Cc: loongarch@lists.linux.dev, linux-kernel@vger.kernel.org, Jiaxun Yang , stable@vger.kernel.org X-Mailer: b4 0.13.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=1332; i=jiaxun.yang@flygoat.com; h=from:subject:message-id; bh=xXIJHAJOc6onemD12GizOeep+GRhVclxjz9KYi4R0ZU=; b=owGbwMvMwCXmXMhTe71c8zDjabUkhjRfBgXx53MP/fBMKai9v3RdxAXtF3av8m5zvirtFXuhy GaqF7Cvo5SFQYyLQVZMkSVEQKlvQ+PFBdcfZP2BmcPKBDKEgYtTACYyfS/DfxffAN24VVy/srij jk+5EnPSYo795JDQHU+OVhyYbjCnbC8jw87ly3O3aIlVvyg0Mg9lKV+uauM8S5qBc/PtRKZbmpM 6+QA= X-Developer-Key: i=jiaxun.yang@flygoat.com; a=openpgp; fpr=980379BEFEBFBF477EA04EF9C111949073FC0F67 fdt_check_header(__dtb_start) will always success because kernel provided a dummy dtb here, thus fdt passed from firmware will never be taken. Fix by trying to utilise __dtb_start only when CONFIG_BUILTIN_DTB is enabled. Fixes: 5f346a6e5970 ("LoongArch: Allow device trees be built into the kernel") Cc: stable@vger.kernel.org Signed-off-by: Jiaxun Yang --- arch/loongarch/kernel/setup.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/arch/loongarch/kernel/setup.c b/arch/loongarch/kernel/setup.c index 60e0fe97f61a..ea6d5db6c878 100644 --- a/arch/loongarch/kernel/setup.c +++ b/arch/loongarch/kernel/setup.c @@ -275,16 +275,18 @@ static void __init arch_reserve_crashkernel(void) static void __init fdt_setup(void) { #ifdef CONFIG_OF_EARLY_FLATTREE - void *fdt_pointer; + void *fdt_pointer = NULL; /* ACPI-based systems do not require parsing fdt */ if (acpi_os_get_root_pointer()) return; +#ifdef CONFIG_BUILTIN_DTB /* Prefer to use built-in dtb, checking its legality first. */ if (!fdt_check_header(__dtb_start)) fdt_pointer = __dtb_start; - else +#endif + if (!fdt_pointer) fdt_pointer = efi_fdt_pointer(); /* Fallback to firmware dtb */ if (!fdt_pointer || fdt_check_header(fdt_pointer)) -- 2.43.0