From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 4F3EDC46CD2 for ; Mon, 22 Jan 2024 22:48:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:Date:To:Cc:From:Subject:References: In-Reply-To:MIME-Version:Message-ID:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=yv/Hp3DcX3d+6zaLrX0kSanhIJGUWKcJO6gMLZOwVj0=; b=mVeneNEQ/JgC/B O1z2DKZlCd0C+Lj/Ly2vSENzY3D+Cv0s3AJ3ZbafYvcybYPMI7LvwL++PlligffAJPMIdDQtPq3Xg VCZFkCfXmTwpGCQTGpedhHTOx+4iHlDtkHF7pg6a+2JUfI8e0azugWD6/ReXUaIqgyeWRCQqaOnMg iyMIWFO5GAhmOkm5XLVV7lX5tyqxv/gUMBhNaRUlVQanOLsJmrn8Aubs4MkJ2DFtZsdqzacOYZuN7 mqnb+zTLImOkq3YepIkW7etfRlEJZ6fCMrVGv+qewctfvRqNFPmKI0LRYSs7CbKZ1wt7/A9zfQT6F cHWo3fq4IoMreAeaVY+g==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1rS35Q-00EKPH-2O; Mon, 22 Jan 2024 22:48:12 +0000 Received: from sin.source.kernel.org ([2604:1380:40e1:4800::1]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1rS35N-00EKOJ-1O; Mon, 22 Jan 2024 22:48:10 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by sin.source.kernel.org (Postfix) with ESMTP id AEA39CE2D13; Mon, 22 Jan 2024 22:48:06 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DEA8FC433C7; Mon, 22 Jan 2024 22:48:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1705963686; bh=aRO5rI2gBLdjP2Ow80R5wBiyllC8SGlBK8PAr36wVzM=; h=In-Reply-To:References:Subject:From:Cc:To:Date:From; b=SIjjwsOE6XK+oLQbheaQg4QVbT9JVjy30vmiv3ORQOgq7S6FQv8k4XG1s+wW0x7pV rx0n35Uq4nT+ZfAzyV16EE9P7CUcDxdy4Icwo2SNAdM9eOEySqywBnNzQ7Q2hl9E6p Tgywv2wmPhDPHpupI2h6rmRx1SHz6teEPZdyv/hgNuoZeaFCxSSi3LMVS1B+ibfCbK vKIDGeQ4xW+0SRKkxmJ2tElQ/1pSXE32RtcqnyaHKQaD1NOYmigFdzJeoeZzVPXj3/ b1n491PKznHSazyiLrteCXRpQiM73c5yKwOCGbF6NbuFEgi04cxyKmCb29ES6WsT/2 KFWIaCNP3a57Q== Message-ID: <47062115ff518edf8c4b02e22f3058bc.sboyd@kernel.org> MIME-Version: 1.0 In-Reply-To: References: <20240112200750.4062441-1-sboyd@kernel.org> <20240112200750.4062441-7-sboyd@kernel.org> Subject: Re: [PATCH 6/6] of: Add KUnit test to confirm DTB is loaded From: Stephen Boyd Cc: Rob Herring , 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 , Brendan Higgins To: David Gow Date: Mon, 22 Jan 2024 14:48:03 -0800 User-Agent: alot/0.10 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240122_144809_660203_803E9AB0 X-CRM114-Status: GOOD ( 16.44 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Quoting David Gow (2024-01-15 21:03:12) > On Sat, 13 Jan 2024 at 04:07, Stephen Boyd wrote: > > > > Add a KUnit test that confirms a DTB has been loaded, i.e. there is a > > root node, and that the of_have_populated_dt() API works properly. > > > > Cc: Rob Herring > > Cc: Frank Rowand > > Cc: David Gow > > Cc: Brendan Higgins > > Signed-off-by: Stephen Boyd > > --- > > I won't pretend to be a devicetree expert, but this looks good to me > from a KUnit point of view, and passes comfortably here. > > checkpatch seems to have one complaint about the kconfig help text. > Personally, I think the brief description is fine. > > Reviewed-by: David Gow > Thanks! I noticed that x86 has some devicetree init code. Did you happen to try on an x86 kvm instance? Or only run on UML? ----8<---- diff --git a/arch/x86/kernel/devicetree.c b/arch/x86/kernel/devicetree.c index afd09924094e..650752d112a6 100644 --- a/arch/x86/kernel/devicetree.c +++ b/arch/x86/kernel/devicetree.c @@ -283,22 +283,24 @@ void __init x86_flattree_get_config(void) u32 size, map_len; void *dt; - if (!initial_dtb) - return; + if (initial_dtb) { + map_len = max(PAGE_SIZE - (initial_dtb & ~PAGE_MASK), (u64)128); - 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); } #endif _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel