Received: by 2002:ab2:7855:0:b0:1f9:5764:f03e with SMTP id m21csp630354lqp; Wed, 22 May 2024 15:02:42 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXLeRpMxK1gzC093cpmrTDqF6F3nnmS7otugnASvsefV3XfV/nvSTm0Tl9DvNwA7tlPKFhqMPTMgfmVexAXyJinFMKSjTW22C5EPfB7XQ== X-Google-Smtp-Source: AGHT+IGg8AcAJgVWTtUmnNJn6pIbjxvLEknDbx7QU/lhE6Lp+kOS4QUfCX19alQTw/L+ySNLoN2/ X-Received: by 2002:a17:906:b251:b0:a62:2e8b:2ca9 with SMTP id a640c23a62f3a-a622e8b2dafmr157047766b.67.1716415362401; Wed, 22 May 2024 15:02:42 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1716415362; cv=pass; d=google.com; s=arc-20160816; b=ukF9bMEoxKnPkypCD3ksjwmXViGgBqtEClVV/eGvXylSlM0+0zWI+rbHpW9rKaqAEk 8AM8Mwx1C349Q0VEPJFSqr6YMHT6umOOkSKZU0ssrl0fw/s7W9zVl5J31VHEsRgP1TZh x8rL6YDs9PL9GHyNRzr2EL30tAQ1UMoB8gtNq76QvDU1wEp1oHIgD9dOrtfhTekJ4nMT e+FI9jtQHRpH5p9Rs/dWg9iNXQakTMzMvOAgYVLs1rnqSQDuPW9wAF+MFNIxmbGSD4ao SLUDFGhbNXBKH/+RsaP12s4v4kyNOb6KJDy1dIRntiOtlE1kFugbReJNEvRDUcSUOXMv ReDA== 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=U8JuBi3PiTbDpXQpVISnqe5gsrf64wIswzQg2DS+gq0=; fh=dDGKIMcG3H+q3nWvOlO7AA2IrGQ/jjD28aNw+O4OeK0=; b=jLq/G8YrKWMhwil3Er6gH2I4S4WhNUV/kLMWm5aBnWyoQjsdMYgwnu6MeFvQHlgEYB ZUct7u0JCC1CB28H9WX4N9M5MlZp1SakxxhnjEa8vYEhMApQmOMNjmJuv3HorIY/00GR y3fzFathYXAVFxpWF2dZcFepA6mtwgOWCoigqxQ65fPEa6VZxBgMT533iHtRGr9O9XBM hIqtKWR9hsrXTdKUzGlesIA4TEdeVKZXyOiSCMIfjWVqlMF+Ju4YKpP5e+LkS/7HCTLl Wvx/kxeHGKgTFV611oESvyUJnYUxhQWpkl0SfflUcH9vefjHGdbIW3ZfFV9zC2UrBEa+ 9Zzw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@flygoat.com header.s=fm2 header.b=s8zM7Rg1; dkim=pass header.i=@messagingengine.com header.s=fm1 header.b=ExhHPk39; 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-186759-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-186759-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. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id a640c23a62f3a-a5a1ba0e233si1542894266b.415.2024.05.22.15.02.42 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 22 May 2024 15:02:42 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-186759-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@flygoat.com header.s=fm2 header.b=s8zM7Rg1; dkim=pass header.i=@messagingengine.com header.s=fm1 header.b=ExhHPk39; 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-186759-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-186759-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 260D01F21979 for ; Wed, 22 May 2024 22:02:42 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id E2CE3146D5D; Wed, 22 May 2024 22:02:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=flygoat.com header.i=@flygoat.com header.b="s8zM7Rg1"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="ExhHPk39" 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 E245D56452; Wed, 22 May 2024 22:02:24 +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=1716415346; cv=none; b=IodtstH8u++udWQzvjbX05VaFTiE99PW46MngsdnFnZA4RqkfbfRQ0v5aA+irAYokSEIKUXGSNSfk5gqQZZtIWEhXCZ6K6G082Y9N03q7n3qGl//PjmoUMEkSgCWOzYi7WpLD7qD4uCJM0Q+ol2wwMnchF53/vYgIXaG59YWc6g= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716415346; c=relaxed/simple; bh=+ZkFOOEzPJ9R8rASkmEVkeYaiXTIikAfh4ZoUZH4DP8=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=ovvhN+bLy85Q+0GKXcjj8rwJ1Maffi03v+XHm7cMIDnRFGBc8By69iTq8Hv+zez3NnZoZ+K9KRKG1hQJWR5/ciQSJ3i9krr18X4TCn8lAhQt9woN72g+nH/uStckl1L0IJZ7SLAbZARiAXN2qK6zAnH23BQNHZM/vWGvs1Qn/FI= 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=s8zM7Rg1; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b=ExhHPk39; 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 compute2.internal (compute2.nyi.internal [10.202.2.46]) by mailfout.west.internal (Postfix) with ESMTP id DF39C1C00180; Wed, 22 May 2024 18:02:23 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute2.internal (MEProxy); Wed, 22 May 2024 18:02:24 -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=1716415343; x=1716501743; bh=U8JuBi3PiTbDpXQpVISnqe5gsrf64wIswzQg2DS+gq0=; b= s8zM7Rg1AqFT9uQxsthDiFncrnGpX92gxABQDnutw6CkqmL1uYGWPHKviPpwlkBa OD/mDfI0BP0niTYrArA7oUapJdZk1mrOXmQVMgQSOBi0yQCpoZdhHAr3iCql/Gqg 8iBAnuWRD/ZRZxgGLRyIE++vg8rv4xk3cWaIHav1eKp5d04u457H6E/M5xBFqsrw GcPMbcXagCFvsXEAwnF9pCdz6VRtIn3cutEOvaZfsdWmpBafMwXf4WJMieM6meOh IQjTxMJddslXUUkVhm6MZUgfEMaNNV4QL3YwJql32xfmNUUVFl1yLKfXi8QLQRqu rBGXAiUV6shCp3jCAXrzDA== 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=1716415343; x= 1716501743; bh=U8JuBi3PiTbDpXQpVISnqe5gsrf64wIswzQg2DS+gq0=; b=E xhHPk39rG/IiEN+DuKA3NjQY6Voz64wqGcriKhgTg33lBct/UUV+C4NMkZX4why3 uz0gvpt0HUwkP6hlwEy+jByxCiVvx6Urlnk+6E/k52ZeBMVZ2PDECEaAm4qNsTJI XldXc3HTUsfaXbn6xy5cpDyiRXxS/pIts01OFq0i8lczQ7t7Ey3iYQWfs3rEXiYO J/ZfZ1F/apgjyiLuPhOSBbxlGRmh+QWEVeve3zfcXop3C9OoA3CkqgrElGMD9F9I AsipGN32fIoCdjlAbK4Km7Sp1Ti3ruVx74lbaCdzsFAqu1fEtoQ3MEWO4JP6i0J8 3APAwjtLxpH4D9+iz1gGw== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvledrvdeihedgtdehucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhephfffufggtgfgkfhfjgfvvefosehtjeertdertdejnecuhfhrohhmpeflihgr gihunhcujggrnhhguceojhhirgiguhhnrdihrghnghesfhhlhihgohgrthdrtghomheqne cuggftrfgrthhtvghrnhepvdekiefhfeevkeeuveetfeelffekgedugefhtdduudeghfeu veegffegudekjeelnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilh hfrhhomhepjhhirgiguhhnrdihrghnghesfhhlhihgohgrthdrtghomh X-ME-Proxy: Feedback-ID: ifd894703:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Wed, 22 May 2024 18:02:22 -0400 (EDT) From: Jiaxun Yang Date: Wed, 22 May 2024 23:02:17 +0100 Subject: [PATCH v3 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: <20240522-loongarch-booting-fixes-v3-1-25e77a8fc86e@flygoat.com> References: <20240522-loongarch-booting-fixes-v3-0-25e77a8fc86e@flygoat.com> In-Reply-To: <20240522-loongarch-booting-fixes-v3-0-25e77a8fc86e@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=1478; i=jiaxun.yang@flygoat.com; h=from:subject:message-id; bh=+ZkFOOEzPJ9R8rASkmEVkeYaiXTIikAfh4ZoUZH4DP8=; b=owGbwMvMwCXmXMhTe71c8zDjabUkhjS/7JxvDx3in+xkvqjqtLrTvtNUKkvQPSKHqc4uPmC13 YqaqfYdpSwMYlwMsmKKLCECSn0bGi8uuP4g6w/MHFYmkCEMXJwCMJHCewz/K5+5OX2c7qm9b0mv XOefqYoC85qSX7ruMjzhf1VOUTrXi+EPT4OmBO+6hqlXvfofnYy+Fx6a8yDWc3a5QXZ5z0QJX1Z uAA== 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, and by coincidence __dtb_start clashed with entry of this dummy dtb. The consequence is fdt passed from firmware will never be taken. Fix by trying to utilise __dtb_start only when CONFIG_BUILTIN_DTB is enabled. Cc: stable@vger.kernel.org Fixes: 7b937cc243e5 ("of: Create of_root if no dtb provided by firmware") Signed-off-by: Jiaxun Yang --- v3: Better reasoning in commit message, thanks Binbin and Huacai! --- 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