From patchwork Tue Oct 3 16:18:15 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Rob Herring (Arm)" X-Patchwork-Id: 9983207 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 023046029B for ; Tue, 3 Oct 2017 16:18:57 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E7A7828A26 for ; Tue, 3 Oct 2017 16:18:56 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id DC52328A29; Tue, 3 Oct 2017 16:18:56 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-3.7 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, RCVD_IN_DNSWL_MED, RCVD_IN_SORBS_SPAM autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 78EC428A26 for ; Tue, 3 Oct 2017 16:18:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=S/APByyCVCTHUOCC5a+roq4SLNANR6V0NHYKKQYJY8Q=; b=LMxgYW8cjVIuzuB9nHEbdJJ8r0 SU9EWk/dXIKaBgi+VAg/8pAM42FWcqkbNtsdHMJSBVOs9n7EDuCPkwPFSean7ojzaj7ck6ZoAfKvC B8Fe9JW2VtE/JwUu+009Xi/dP8n0w5w5D3XO3c4CwRYp0vRfTEysmmcn5/QDTZ8XyU1Dja0cSKCN/ afQH0OtLRvOcLcWLfieyKTSskjYMcnvDnHqBUvCONmBX7hB9Y0+rMXOmfZ8ZunVdFjNQJdCFEBlTC cNM0oRH/0LJyFgyjT+CIjiVaMODs3JDBiV5FH8lrkPOGYPz1F/+Sz69k5ryNMXZEgLNie128lbKf5 w7vob9Jg==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1dzPuD-0006uG-7m; Tue, 03 Oct 2017 16:18:49 +0000 Received: from merlin.infradead.org ([2001:8b0:10b:1231::1]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1dzPuB-0006tX-0J for linux-arm-kernel@bombadil.infradead.org; Tue, 03 Oct 2017 16:18:47 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=merlin.20170209; h=References:In-Reply-To:Message-Id:Date: Subject:Cc:To:From:Sender:Reply-To:MIME-Version:Content-Type: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=TpkveIpqbX3wzWd+pKDV3srAxDl9TUuj3UR8Nw0b7LI=; b=SVQS1hyC3qOj99u7MgcyOEQ/y ovwp4HC5D87CtvM47cJJHBNeIui/E8RBByoxXo9HKXiN1kPK/gxZzYz4Y53hz/eX99UK48XQorfzx gZhtO+ZxCj2NyGG5pK60fVTIHqmV2NFJ61c3r1cs3FjNotko+KQNpOPykuniorXrb6shQPptUrx6S T9hSgjfPNREi+l0x2hVQHzESUdSFGEPo2QEnTSGsK09kchiUHH0yrS6T2LBldvdwFbn0nwyGlSss2 B4aesW3jrmRNigcat6ELKMvI3TRYwZCmdnK/LPMyDbrqvJR2q1zunBCG1TZl+SOuV48d8tOfDSE3l dlyMUUGvQ==; Received: from mail-oi0-f68.google.com ([209.85.218.68]) by merlin.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1dzPu8-0007r9-2W for linux-arm-kernel@lists.infradead.org; Tue, 03 Oct 2017 16:18:45 +0000 Received: by mail-oi0-f68.google.com with SMTP id n82so7941864oig.3 for ; Tue, 03 Oct 2017 09:18:21 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=TpkveIpqbX3wzWd+pKDV3srAxDl9TUuj3UR8Nw0b7LI=; b=PRw6c5szdbQ4IDTgLieE87C0J8iY9GXsxwHsUJ9pMx04gmyU5YWka9/Pk0P/ZJKKU3 209v4EUpuzqLTOLOdXPGimAz36szXpKhxP4sz1aMI1du1KjrzYstSzhQ4GFBsnm9Exbk mdnTnf+DhrthnazEV0WvPq3auoXYxad7OgRXmJBzXyaJYtu9k0G65J/dQTTRdnswIjpy ZdPnt6i+RPgAAe4hF3LP3gohu0zVphV1sDKtjA7pdulvsekipzUarIinjFW6OHIwo+iK Ybnv/OJKofYO+UQfuK3kq4dp8cVkjd+moLH5TXEmErM0Mf6gHp62So6St/EWAX/g0G5Y av8g== X-Gm-Message-State: AMCzsaU3Z25llpKdk8mT09lCuPI/1vMpHj+ixHNpJB8eHi6pGCkvzO4k bSt9f4QqHVOU1NEBsW0Shw== X-Google-Smtp-Source: AOwi7QBIRKPsPWTe25bzxmO6Qjp7aGmnoiULD5fX+umEnsK159ZONHOn6lgwiFig9r6Wx2OHBd5UKA== X-Received: by 10.202.253.213 with SMTP id b204mr3691031oii.101.1507047500669; Tue, 03 Oct 2017 09:18:20 -0700 (PDT) Received: from localhost.localdomain (216-188-254-6.dyn.grandenetworks.net. [216.188.254.6]) by smtp.googlemail.com with ESMTPSA id y90sm4334451ota.52.2017.10.03.09.18.19 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 03 Oct 2017 09:18:20 -0700 (PDT) From: Rob Herring To: devicetree@vger.kernel.org Subject: [PATCH 2/2] of/fdt: skip unflattening of disabled nodes Date: Tue, 3 Oct 2017 11:18:15 -0500 Message-Id: <20171003161815.25999-2-robh@kernel.org> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20171003161815.25999-1-robh@kernel.org> References: <20171003161815.25999-1-robh@kernel.org> X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Nicolas Pitre , Frank Rowand , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP For static DT usecases, we don't need the disabled nodes and can skip unflattening. This saves a significant amount of RAM in memory constrained cases. In one example on STM32F469, the RAM usage goes from 118K to 26K. There are a few cases in the kernel that modify the status property dynamically. These all are changes from enabled to disabled, depend on OF_DYNAMIC or are not FDT based (PDT based). Cc: Nicolas Pitre Cc: Frank Rowand Signed-off-by: Rob Herring Tested-by: Nicolas Pitre --- For more background, see this presentation from Nico: https://connect.linaro.org/resource/sfo17/sfo17-100/ drivers/of/fdt.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/of/fdt.c b/drivers/of/fdt.c index f8c39705418b..efe91c6856a0 100644 --- a/drivers/of/fdt.c +++ b/drivers/of/fdt.c @@ -396,6 +396,10 @@ static int unflatten_dt_nodes(const void *blob, if (WARN_ON_ONCE(depth >= FDT_MAX_DEPTH)) continue; + if (!IS_ENABLED(CONFIG_OF_DYNAMIC) && + !of_fdt_device_is_available(blob, offset)) + continue; + if (!populate_node(blob, offset, &mem, nps[depth], &nps[depth+1], dryrun)) return mem - base;