From patchwork Tue Apr 9 09:52:38 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chen-Yu Tsai X-Patchwork-Id: 13622093 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 7DA27CD1284 for ; Tue, 9 Apr 2024 09:53:09 +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:MIME-Version:Message-ID:Date:Subject:Cc :To:From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=JMQJkZ6a6xoPqIiitXZsUEFEPB8zLuQQ5aGU5UmiwMc=; b=DyqG3TJ9Xdo4nQ qenJRQTVT3g9IDM2SM2prnCzYsYtm/Vev1hoGzi/opLNoAQ72okQWVD81GtucB7GOHcvsRXq7oeIT d74Bkrr0+coDw3CrF3dDuIlevuyT8f3kIBbiBzVipyabCwGMM9rIP/iyKexgrbm9ZWLtt1no4TLqZ QK89fAbJYg2faAEKiZyIvEZe1LZYbdjBWPwJhLpgAOT8YWC58e1TSUQdIlukMYagCI+OjE7/YJ9RX IUR8uaI7pZF3b4l7JHZEBH4IQL8UXA1VM/wattJPJR9HG24ddUpm4onyI3PDnCyxjh1DB1z7585iX D3JX11FcZMgyZgxhBVTA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1ru89w-00000001Ic3-0QsA; Tue, 09 Apr 2024 09:52:56 +0000 Received: from mail-pf1-x435.google.com ([2607:f8b0:4864:20::435]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1ru89r-00000001IaU-1cey for linux-arm-kernel@lists.infradead.org; Tue, 09 Apr 2024 09:52:54 +0000 Received: by mail-pf1-x435.google.com with SMTP id d2e1a72fcca58-6eaf9565e6bso3773356b3a.2 for ; Tue, 09 Apr 2024 02:52:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1712656365; x=1713261165; darn=lists.infradead.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=Qq9SUUh2shlwi+HSCpikmSF5BpTnfRa+mJbDP7CI3P4=; b=OoNSDLDC5KW37iTnpB86bxjiUwIKbotUmT3DotWKpav0H8Vppxhva5r4xLHJl5t6Bd ZkaOIZNRxPr7mVDZv4c7oWlpm4AEi72WnIRnOSuQjYF1O6zHJkHrrVXyOHaqCdeq0J21 K1G/OcsQ0JARTISfu4A5yXahPGCTfTUMp9fWM= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712656365; x=1713261165; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=Qq9SUUh2shlwi+HSCpikmSF5BpTnfRa+mJbDP7CI3P4=; b=V9AKDmlEQRcD8USvTSc/ySftBsG784dfzUm87xdvm5v+QkjKYE0R1dut1bCW8gUxuz M+QoozWEBU9v/5/Rcees/DUbpBof5ic9+Md6YQ7azaVDb/mgc1Y1oNgp/KXkX3zebwuo Qhz1xpeFfjKPzBfvUDD9yhk2Gp7n5DfpK42u3a5kWLRAqEwADdjU22USnM/oqH17Ug7Q 95+y0iBUlS+BFT5fSKb43gybL8uS9hVNhBqtPEzDTU/kuO5fKcV6rdOvYAdc659h8Tr+ VFlC++AKFkrTlakLJPb7HPNPXOS/OwdqZI82fa0pAtqt75e87TE7T+61DEmay2/98/RI KBmg== X-Forwarded-Encrypted: i=1; AJvYcCUqsEPnwca8CxjUS0uOTQXiKGOBBINzwQuCC3RS+a9eRJeICdvVQqbDR8HZ8Oj6rJswsknQkEVYvEULoMX7GzCvdathAPDqDMkhIeMh5jqZrOdvSS0= X-Gm-Message-State: AOJu0YzCv+Z9WskJDxPqjHEzh9Bh1tmKan3ahKLqOtYWsYNPm1dmlClR BL4wS4//9OhXkgDfpbur7shHyzOEtIp+xktYHWMarD4P06IzSb5K2d18dxvQOQ== X-Google-Smtp-Source: AGHT+IHTIYMFgIsIpfetDHfBOIWNBd2HP00jBw0bY4nV4zUEdvlm/8j6ySitJ5LHkNkBYsJJiw13jw== X-Received: by 2002:a05:6a00:1782:b0:6ed:6b11:4076 with SMTP id s2-20020a056a00178200b006ed6b114076mr3371667pfg.12.1712656365506; Tue, 09 Apr 2024 02:52:45 -0700 (PDT) Received: from wenstp920.tpe.corp.google.com ([2401:fa00:1:10:cf76:4647:8bd3:d341]) by smtp.gmail.com with ESMTPSA id h18-20020aa786d2000000b006ead792b6f2sm7931509pfo.1.2024.04.09.02.52.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 09 Apr 2024 02:52:45 -0700 (PDT) From: Chen-Yu Tsai To: Rob Herring , Krzysztof Kozlowski , Conor Dooley , Matthias Brugger , AngeloGioacchino Del Regno Cc: dianders@chromium.org, Chen-Yu Tsai , devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org Subject: [PATCH RFC] arm64: dts: mediatek: mt8183-kodama: Split into base and overlays Date: Tue, 9 Apr 2024 17:52:38 +0800 Message-ID: <20240409095239.627000-1-wenst@chromium.org> X-Mailer: git-send-email 2.44.0.478.gd926399ef9-goog MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240409_025252_607281_A80F6361 X-CRM114-Status: GOOD ( 19.42 ) 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: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org All the SKUs of Kodama share much of their .dts, as evident of the inclusion of a common .dtsi file. However this scheme builds each .dtb file as a complete device tree. To deduplicate this, make the common .dtsi file a .dts file, and the SKU specific .dts files into .dtso overlay source files. Have the build system assemble the SKU specific .dtb files from these components. The final composite .dtb files increase in size by around 54 kB, or 22.5%, due to the inclusion of symbols and fixup tables, and extra phandle properties. This could be slightly reduced by dropping the symbol and fixup tables after the overlays are fully applied if desired. However if the bootloader can assemble the end .dtb using the base .dtb and overlays, and only those are counted, then the combined size decreases by around 165 kB, or 68.7%. Signed-off-by: Chen-Yu Tsai --- Hi, This is part of the work I'm looking into and will present at EOSS 2024 in Seattle [1]. The idea is to reorganize device trees so that devices within a common family, instead of having a common .dtsi file, will share a base DTB and apply one or more overlays on top. This allows an upstream [2] or downstream [3] bundling script to be able to deduplicate the base DTB and get some space savings, however minor they are compared to the kernel binary executable. This patch gives a simple conversion, but we could even look into converting the entire MT8183 Kukui family, which are all based on the "Kukui" hardware reference design. There are some issues, hence the RFC: 1. The base .dtb doesn't have a valid board compatible string sequence yet. Suppose we used the sequence "google,kodama", "mediatek,mt8183" for the base .dtb in this conversion, would that be acceptable? The base .dtb would act like a fallback. 2. The composite .dtb files grow in size substantially, due to the base .dtb file being built with overlay support. The symbols and fixup tables could be trimmed out with `fdtput`, but there will still be extra phandles, and also nodes with /omit-if-no-ref/ that would have been removed. For this I could maybe come up with a program to minify the DTB. That would also work for existing composite .dtb files in-tree. 3. Such a scheme would require more awareness on the maintainer's part, and of the .dtbo authors. The maintainer needs to be aware of how the composite .dtb files are assembled. The authors need to know that certain constructs, such as /delete-property/ or /delete-node/, won't work. [1] https://eoss24.sched.com/event/1aBGe/second-source-component-probing-on-device-tree-platforms-chen-yu-tsai-google-llc [2] https://lore.kernel.org/linux-arm-kernel/20240329032836.141899-1-sjg@chromium.org/ [3] https://crrev.com/c/5412876 arch/arm64/boot/dts/mediatek/Makefile | 6 ++++++ ...ukui-kodama-sku16.dts => mt8183-kukui-kodama-sku16.dtso} | 4 ++-- ...ui-kodama-sku272.dts => mt8183-kukui-kodama-sku272.dtso} | 4 ++-- ...ui-kodama-sku288.dts => mt8183-kukui-kodama-sku288.dtso} | 4 ++-- ...ukui-kodama-sku32.dts => mt8183-kukui-kodama-sku32.dtso} | 4 ++-- .../{mt8183-kukui-kodama.dtsi => mt8183-kukui-kodama.dts} | 0 6 files changed, 14 insertions(+), 8 deletions(-) rename arch/arm64/boot/dts/mediatek/{mt8183-kukui-kodama-sku16.dts => mt8183-kukui-kodama-sku16.dtso} (90%) rename arch/arm64/boot/dts/mediatek/{mt8183-kukui-kodama-sku272.dts => mt8183-kukui-kodama-sku272.dtso} (90%) rename arch/arm64/boot/dts/mediatek/{mt8183-kukui-kodama-sku288.dts => mt8183-kukui-kodama-sku288.dtso} (90%) rename arch/arm64/boot/dts/mediatek/{mt8183-kukui-kodama-sku32.dts => mt8183-kukui-kodama-sku32.dtso} (90%) rename arch/arm64/boot/dts/mediatek/{mt8183-kukui-kodama.dtsi => mt8183-kukui-kodama.dts} (100%) diff --git a/arch/arm64/boot/dts/mediatek/Makefile b/arch/arm64/boot/dts/mediatek/Makefile index 9234dadfe1ad..6986d7a2efaa 100644 --- a/arch/arm64/boot/dts/mediatek/Makefile +++ b/arch/arm64/boot/dts/mediatek/Makefile @@ -46,6 +46,12 @@ dtb-$(CONFIG_ARCH_MEDIATEK) += mt8183-kukui-kakadu.dtb dtb-$(CONFIG_ARCH_MEDIATEK) += mt8183-kukui-kakadu-sku22.dtb dtb-$(CONFIG_ARCH_MEDIATEK) += mt8183-kukui-katsu-sku32.dtb dtb-$(CONFIG_ARCH_MEDIATEK) += mt8183-kukui-katsu-sku38.dtb + +mt8183-kukui-kodama-sku16-dtbs := mt8183-kukui-kodama.dtb mt8183-kukui-kodama-sku16.dtbo +mt8183-kukui-kodama-sku272-dtbs := mt8183-kukui-kodama.dtb mt8183-kukui-kodama-sku272.dtbo +mt8183-kukui-kodama-sku288-dtbs := mt8183-kukui-kodama.dtb mt8183-kukui-kodama-sku288.dtbo +mt8183-kukui-kodama-sku32-dtbs := mt8183-kukui-kodama.dtb mt8183-kukui-kodama-sku32.dtbo + dtb-$(CONFIG_ARCH_MEDIATEK) += mt8183-kukui-kodama-sku16.dtb dtb-$(CONFIG_ARCH_MEDIATEK) += mt8183-kukui-kodama-sku272.dtb dtb-$(CONFIG_ARCH_MEDIATEK) += mt8183-kukui-kodama-sku288.dtb diff --git a/arch/arm64/boot/dts/mediatek/mt8183-kukui-kodama-sku16.dts b/arch/arm64/boot/dts/mediatek/mt8183-kukui-kodama-sku16.dtso similarity index 90% rename from arch/arm64/boot/dts/mediatek/mt8183-kukui-kodama-sku16.dts rename to arch/arm64/boot/dts/mediatek/mt8183-kukui-kodama-sku16.dtso index 7213cdcca612..20675de68823 100644 --- a/arch/arm64/boot/dts/mediatek/mt8183-kukui-kodama-sku16.dts +++ b/arch/arm64/boot/dts/mediatek/mt8183-kukui-kodama-sku16.dtso @@ -8,9 +8,9 @@ */ /dts-v1/; -#include "mt8183-kukui-kodama.dtsi" +/plugin/; -/ { +&{/} { model = "MediaTek kodama sku16 board"; chassis-type = "tablet"; compatible = "google,kodama-sku16", "google,kodama", "mediatek,mt8183"; diff --git a/arch/arm64/boot/dts/mediatek/mt8183-kukui-kodama-sku272.dts b/arch/arm64/boot/dts/mediatek/mt8183-kukui-kodama-sku272.dtso similarity index 90% rename from arch/arm64/boot/dts/mediatek/mt8183-kukui-kodama-sku272.dts rename to arch/arm64/boot/dts/mediatek/mt8183-kukui-kodama-sku272.dtso index bbf0cd1aa66d..46ab97a18003 100644 --- a/arch/arm64/boot/dts/mediatek/mt8183-kukui-kodama-sku272.dts +++ b/arch/arm64/boot/dts/mediatek/mt8183-kukui-kodama-sku272.dtso @@ -8,9 +8,9 @@ */ /dts-v1/; -#include "mt8183-kukui-kodama.dtsi" +/plugin/; -/ { +&{/} { model = "MediaTek kodama sku272 board"; chassis-type = "tablet"; compatible = "google,kodama-sku272", "google,kodama", "mediatek,mt8183"; diff --git a/arch/arm64/boot/dts/mediatek/mt8183-kukui-kodama-sku288.dts b/arch/arm64/boot/dts/mediatek/mt8183-kukui-kodama-sku288.dtso similarity index 90% rename from arch/arm64/boot/dts/mediatek/mt8183-kukui-kodama-sku288.dts rename to arch/arm64/boot/dts/mediatek/mt8183-kukui-kodama-sku288.dtso index a429ffeac3bd..e27b56f1826d 100644 --- a/arch/arm64/boot/dts/mediatek/mt8183-kukui-kodama-sku288.dts +++ b/arch/arm64/boot/dts/mediatek/mt8183-kukui-kodama-sku288.dtso @@ -8,9 +8,9 @@ */ /dts-v1/; -#include "mt8183-kukui-kodama.dtsi" +/plugin/; -/ { +&{/} { model = "MediaTek kodama sku288 board"; chassis-type = "tablet"; compatible = "google,kodama-sku288", "google,kodama", "mediatek,mt8183"; diff --git a/arch/arm64/boot/dts/mediatek/mt8183-kukui-kodama-sku32.dts b/arch/arm64/boot/dts/mediatek/mt8183-kukui-kodama-sku32.dtso similarity index 90% rename from arch/arm64/boot/dts/mediatek/mt8183-kukui-kodama-sku32.dts rename to arch/arm64/boot/dts/mediatek/mt8183-kukui-kodama-sku32.dtso index 5a416143b4a0..d9a13ff7abf2 100644 --- a/arch/arm64/boot/dts/mediatek/mt8183-kukui-kodama-sku32.dts +++ b/arch/arm64/boot/dts/mediatek/mt8183-kukui-kodama-sku32.dtso @@ -8,9 +8,9 @@ */ /dts-v1/; -#include "mt8183-kukui-kodama.dtsi" +/plugin/; -/ { +&{/} { model = "MediaTek kodama sku32 board"; chassis-type = "tablet"; compatible = "google,kodama-sku32", "google,kodama", "mediatek,mt8183"; diff --git a/arch/arm64/boot/dts/mediatek/mt8183-kukui-kodama.dtsi b/arch/arm64/boot/dts/mediatek/mt8183-kukui-kodama.dts similarity index 100% rename from arch/arm64/boot/dts/mediatek/mt8183-kukui-kodama.dtsi rename to arch/arm64/boot/dts/mediatek/mt8183-kukui-kodama.dts