From mboxrd@z Thu Jan 1 00:00:00 1970 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 B34681442E8; Fri, 6 Dec 2024 14:56:59 +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=1733497019; cv=none; b=YcuE3wrC4OKGpJnqftSvLsqmseg0XXs6gRBxTak0RE7yb8SShiH+7cSuSnt0Aq9RYXXrZeYDZjLELPqMwVBPKE8RFIzhYijh/RF3BCtZrWLmkDAbEQdTm6/B9MVvpjVKCq9xceLenKm1yugY0isA1uI76jLR9IlSayVLoSQHsBE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733497019; c=relaxed/simple; bh=A2IaY0duDk+jLtEtU3BtWgP0oJF0V7uHrWoYc2mcRis=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=shU4Smv0kLQCAcq2I+JxdH73vG3vcJ/wybYlSQJcYTUjDjHdlfq19AavOKwYB6GkkuNsOuapNAFNuxixqZdUk/TNHa0wY0kRG5VAFS2euwUUYpmMqKf3Gp5LtWXnign+HFNYScdpnX1K5uOR900y+v25G+5+8vLKaebrBrnJJnA= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=OM/br4wb; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="OM/br4wb" Received: by smtp.kernel.org (Postfix) with ESMTPSA id CA0DDC4CED1; Fri, 6 Dec 2024 14:56:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1733497019; bh=A2IaY0duDk+jLtEtU3BtWgP0oJF0V7uHrWoYc2mcRis=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=OM/br4wbAsC97Ny1rE7joY2CCzv6EeK0633oGmu1MVnXXgS0AT6jNXqmwyjKPlkzT /PMg3WJorfAZfbWe9wm3MOwT7t8CdN+arMc/dnZDBlXkzg6VYw+IHYtH+nuXuLP61h Z8evbijTmpXWZ2VLsmOSeTeXbecaGuk8QtqAqxSI= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Rob Herring , Frank Rowand , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , x86@kernel.org, "H. Peter Anvin" , Saurabh Sengar , Stephen Boyd , Rob Herring , Sasha Levin Subject: [PATCH 6.6 144/676] x86/of: Unconditionally call unflatten_and_copy_device_tree() Date: Fri, 6 Dec 2024 15:29:23 +0100 Message-ID: <20241206143658.977025897@linuxfoundation.org> X-Mailer: git-send-email 2.47.1 In-Reply-To: <20241206143653.344873888@linuxfoundation.org> References: <20241206143653.344873888@linuxfoundation.org> User-Agent: quilt/0.67 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.6-stable review patch. If anyone has any objections, please let me know. ------------------ From: Stephen Boyd [ Upstream commit 40f18dbbb42c56019b889b5b1fdce3da89e354da ] Call this function unconditionally so that we can populate an empty DTB on platforms that don't boot with a firmware provided or builtin DTB. There's no harm in calling unflatten_device_tree() unconditionally here. If there isn't a non-NULL 'initial_boot_params' pointer then unflatten_device_tree() returns early. Cc: Rob Herring Cc: Frank Rowand Cc: Thomas Gleixner Cc: Ingo Molnar Cc: Borislav Petkov Cc: Dave Hansen Cc: x86@kernel.org Cc: H. Peter Anvin Tested-by: Saurabh Sengar Signed-off-by: Stephen Boyd Link: https://lore.kernel.org/r/20240217010557.2381548-5-sboyd@kernel.org Signed-off-by: Rob Herring Stable-dep-of: b2473a359763 ("of/fdt: add dt_phys arg to early_init_dt_scan and early_init_dt_verify") Signed-off-by: Sasha Levin --- arch/x86/kernel/devicetree.c | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/arch/x86/kernel/devicetree.c b/arch/x86/kernel/devicetree.c index c13c9cb40b9b4..47fe7de1575dd 100644 --- a/arch/x86/kernel/devicetree.c +++ b/arch/x86/kernel/devicetree.c @@ -283,22 +283,24 @@ static void __init x86_flattree_get_config(void) u32 size, map_len; void *dt; - if (!initial_dtb) - return; - - map_len = max(PAGE_SIZE - (initial_dtb & ~PAGE_MASK), (u64)128); + if (initial_dtb) { + map_len = max(PAGE_SIZE - (initial_dtb & ~PAGE_MASK), (u64)128); + + dt = early_memremap(initial_dtb, map_len); + size = fdt_totalsize(dt); + if (map_len < size) { + early_memunmap(dt, map_len); + dt = early_memremap(initial_dtb, size); + map_len = size; + } - dt = early_memremap(initial_dtb, map_len); - size = fdt_totalsize(dt); - if (map_len < size) { - early_memunmap(dt, map_len); - dt = early_memremap(initial_dtb, size); - map_len = size; + early_init_dt_verify(dt); } - early_init_dt_verify(dt); unflatten_and_copy_device_tree(); - early_memunmap(dt, map_len); + + if (initial_dtb) + early_memunmap(dt, map_len); } #else static inline void x86_flattree_get_config(void) { } -- 2.43.0