devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Rob Herring <robh@kernel.org>
To: Masahiro Yamada <masahiroy@kernel.org>
Cc: linux-kbuild@vger.kernel.org, linux-arch@vger.kernel.org,
	linux-snps-arc@lists.infradead.org, linux-kernel@vger.kernel.org,
	Michal Simek <monstr@monstr.eu>,
	devicetree@vger.kernel.org, linux-mips@vger.kernel.org,
	linux-openrisc@vger.kernel.org, Dinh Nguyen <dinguyen@kernel.org>
Subject: Re: [PATCH 03/15] kbuild: move non-boot builtin DTBs to .init.rodata section
Date: Thu, 5 Sep 2024 08:47:04 -0500	[thread overview]
Message-ID: <20240905134704.GB1517132-robh@kernel.org> (raw)
In-Reply-To: <20240904234803.698424-4-masahiroy@kernel.org>

On Thu, Sep 05, 2024 at 08:47:39AM +0900, Masahiro Yamada wrote:
> Some architectures support embedding boot DTB(s) in vmlinux. These
> architectures, except MIPS and MicroBlaze, expect a single DTB in
> the .dtb.init.rodata section. MIPS embeds multiple DTBs in vmlinux.
> MicroBlaze embeds a DTB in its own __fdt_blob section instead of the
> .dtb.init.rodata section.
> 
> For example, RISC-V previously allowed embedding multiple DTBs, but
> only the first DTB in the .dtb.init.rodata section was used. Commit
> 2672031b20f6 ("riscv: dts: Move BUILTIN_DTB_SOURCE to common Kconfig")
> ensured only one boot DTB is embedded.
> 
> Meanwhile, commit 7b937cc243e5 ("of: Create of_root if no dtb provided
> by firmware") introduced another DTB into the .dtb.init.rodata section.
> 
> The symbol dump (sorted by address) for ARCH=riscv nommu_k210_defconfig
> is now as follows:
> 
>     00000000801290e0 D __dtb_start
>     00000000801290e0 D __dtb_k210_generic_begin
>     000000008012b571 D __dtb_k210_generic_end
>     000000008012b580 D __dtb_empty_root_begin
>     000000008012b5c8 D __dtb_empty_root_end
>     000000008012b5e0 D __dtb_end
> 
> The .dtb.init.rodata section contains the following two DTB files:
> 
>     arch/riscv/boot/dts/canaan/k210_generic.dtb
>     drivers/of/empty_root.dtb
> 
> This is not an immediate problem because the boot code chooses the
> first DTB, k210_generic.dtb. The second one, empty_root.dtb is ignored.
> However, relying on the link order (i.e., the order in Makefiles) is
> fragile.
> 
> Only the boot DTB should be placed in the .dtb.init.rodata because the
> arch boot code generally does not know the DT name, thus it uses the
> __dtb_start symbol to find it.
> 
> empty_root.dtb is looked up by name, so it can be moved to the generic
> .init.rodata section.
> 
> When CONFIG_OF_UNITTEST is enabled, more unittest DTBOs are embedded in
> the .dtb.init.rodata section. These are also looked up by name, so can
> be moved to the .init.rodata section.
> 
> I added the __initdata annotation to the overlay_info data array because
> modpost knows the .init.rodata section is discarded, and would otherwise
> warn about it.
> 
> The implementation is kind of cheesy; the section is .dtb.init.rodata
> under the arch/ directory, and .init.rodata section otherwise. This will
> be refactored later.
> 
> Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
> ---
> 
>  drivers/of/unittest.c | 2 +-
>  scripts/Makefile.dtbs | 4 +++-
>  2 files changed, 4 insertions(+), 2 deletions(-)

Reviewed-by: Rob Herring (Arm) <robh@kernel.org>

  reply	other threads:[~2024-09-05 13:47 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-09-04 23:47 [PATCH 00/15] kbuild: refactor DTB build rules, introduce a generic built-in boot DTB support Masahiro Yamada
2024-09-04 23:47 ` [PATCH 01/15] kbuild: add intermediate targets for Flex/Bison in scripts/Makefile.host Masahiro Yamada
2024-09-04 23:47 ` [PATCH 02/15] kbuild: split device tree build rules into scripts/Makefile.dtbs Masahiro Yamada
2024-09-05 13:44   ` Rob Herring
2024-09-04 23:47 ` [PATCH 03/15] kbuild: move non-boot builtin DTBs to .init.rodata section Masahiro Yamada
2024-09-05 13:47   ` Rob Herring [this message]
2024-09-04 23:47 ` [PATCH 04/15] kbuild: add generic support for built-in boot DTBs Masahiro Yamada
2024-09-05 14:17   ` Rob Herring
2024-09-06  1:56     ` Masahiro Yamada
2024-09-10  9:35     ` Masahiro Yamada
2024-09-04 23:47 ` [PATCH 05/15] MIPS: migrate to generic rule for built-in DTBs Masahiro Yamada
2024-09-04 23:47 ` [PATCH 06/15] riscv: migrate to the generic rule for built-in DTB Masahiro Yamada
2024-09-09 16:30   ` Conor Dooley
2024-09-04 23:47 ` [PATCH 07/15] LoongArch: " Masahiro Yamada
2024-09-04 23:47 ` [PATCH 08/15] ARC: " Masahiro Yamada
2024-09-04 23:47 ` [PATCH 09/15] openrisc: " Masahiro Yamada
2024-09-04 23:47 ` [PATCH 10/15] xtensa: " Masahiro Yamada
2024-09-04 23:47 ` [PATCH 11/15] nios2: " Masahiro Yamada
2024-09-04 23:47 ` [PATCH 12/15] sh: " Masahiro Yamada
2024-09-04 23:47 ` [PATCH 13/15] microblaze: " Masahiro Yamada
2024-09-04 23:47 ` [PATCH 14/15] kbuild: rename CONFIG_GENERIC_BUILTIN_DTB to CONFIG_BUILTIN_DTB Masahiro Yamada
2024-09-05 14:38   ` Rob Herring
2024-09-06  0:27     ` Masahiro Yamada
2024-09-04 23:47 ` [PATCH 15/15] kbuild: use .init.rodata section unconditionally for cmd_wrap_S_dtb Masahiro Yamada

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240905134704.GB1517132-robh@kernel.org \
    --to=robh@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=dinguyen@kernel.org \
    --cc=linux-arch@vger.kernel.org \
    --cc=linux-kbuild@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mips@vger.kernel.org \
    --cc=linux-openrisc@vger.kernel.org \
    --cc=linux-snps-arc@lists.infradead.org \
    --cc=masahiroy@kernel.org \
    --cc=monstr@monstr.eu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).