[PATCH v3 0/7] Add FIT multi-DTB selection for Qualcomm platforms

Casey Connolly casey.connolly at linaro.org
Mon May 4 21:28:01 CEST 2026


Hi Aswin, Sumit,

Sorry it's taken a while, you should have the new version of the SMEM
revamp in your inbox now (or here
https://lore.kernel.org/u-boot/20260504-b4-modernise-smem-v2-0-c01ec2ff3886@linaro.org/)

I used the header from this series with some cleanups. You should be
able to rebase on that and we can get this series moving forwards a bit
more.

On 17/04/2026 14:09, Aswin Murugan wrote:
> This series adds dynamic device tree selection from FIT images for
> Qualcomm Snapdragon platforms, enabling U-Boot to select the
> appropriate DTB based on hardware parameters detected from SMEM.
> 
> Qualcomm fit based DTB format is documented in [1]
> The fit image contains only DTB, while the kernel will be part of UKI image.
> 
> The implementation consists of three parts:
> 
> 1. SMEM cache infrastructure: Provides cached access to commonly
>    used SMEM data (socinfo, RAM partitions) to avoid redundant
>    lookups during boot. Includes socinfo header from Linux kernel
>    for SoC identification.

I think this abstraction is at the wrong layer, you shouldn't be
accessing SMEM in a hot path, it seems more like your "cache" here is
just the state of the FIT parsing state machine? In which case it would
be much better modelled as a state object rather than spreading the
state around a bunch of wrapper functions.

> 
> 2. FIT multi-DTB selection: Implements the core selection logic
>    that reads hardware parameters from SMEM, parses metadata DTB,
>    matches FIT configurations, and loads the selected DTB with
>    overlays. Integrates with EFI boot flow by setting fdt_addr.

The way this code is currently laid out generally makes it quite
confusing to parse, as with my previous point I think you should rewrite
this to first get all the data you need together in one struct and
translate it into suitable formats (e.g. if you only need a few things
from socinfo then just get those and don't carry around a big socinfo
pointer where it isn't clear which properties are actually used).

Stuff like the IMEM cookie should be in it's own abstraction maybe under
drivers/soc/qcom that only exposes the properties that actually make sense.

This would then let you bring down the size of this huge file so it's a
bit more manageable.

Some properties like the mem_card_type from IMEM would be extremely
useful for simplifying the capsule update code for example, so having
this as a separate abstraction would greatly improve things.

Thanks and kind regards,

> 
> 3. mkimage: add fatfs image type for FAT partition images
>    Added fatimage.c handler that uses mkfs.vfat and mcopy to create
>    FAT images from a directory.
> 
> [1] https://github.com/qualcomm-linux/qcom-dtb-metadata/blob/main/Documentation.md
> 
> ---
> Changes in v3:
> 1. Runtime IMEM address lookup via DT: Removed CONFIG_QCOM_IMEM_SIZE Kconfig option.
>    Added qcom_imem_table[] mapping SoC compatible strings to IMEM addresses.
> 
> 2. Split SoC version sources: SoC hardware version now read from TCSR register via
>    qcom_read_tcsr_soc_version(). The soc_info->plat_ver from SMEM is stored separately
>    as board_version. Added socver and boardrev metadata node matching for finer-grained DTB selection.
> 
> 3. qcom_load_fit_image() returns int: Changed return type from efi_status_t to int,
>    returning standard Linux error codes for consistency with the rest of the driver.
> 
> 4. Code cleanup: strtok() replaced with strsep(); memcpy + manual null-termination replaced with strlcpy();
>    DDR thresholds use SZ_* macros; compatible matching and FDT loading extracted into dedicated helpers.
> 
> 5. image: add IH_TYPE_FATFS image type: Added new fatfs image type to represent a raw FAT
>    filesystem partition image, registered in the image type lookup table.
> 
> 6. mkimage: add fatfs image type for FAT partition images: Added fatimage.c handler that
>    uses mkfs.vfat and mcopy to create FAT images from a directory.
>    New --fat-extra-space, --fat-type, --fat-volume-id, --fat-mkfs-opts long options added
>    to mkimage.
> 
> 7. doc: document mkimage fatfs type and Qualcomm multi-DTB: Updated 'doc/mkimage.1' for the new
>    fatfs type and options. Added 'doc/board/qualcomm/multi_dtb.rst' covering FIT ITS configuration,
>    QCOM metadata format, socver/boardrev guidelines, and image creation steps.
> 
> Link to v2:
> https://lore.kernel.org/u-boot/20260129184817.224101-1-aswin.murugan@oss.qualcomm.com/
> 
> Changes in v2:
> - In v1, a combined DTB format was used for multi-DTB support. Based on
>   feedback, v2 implements FIT-based DTB selection instead.
> - Link to v1: https://lore.kernel.org/all/20260106122134.2047864-1-aswin.murugan@oss.qualcomm.com/
> 
> Aswin Murugan (7):
>   mach-snapdragon: Add generic SMEM cache infrastructure
>   mach-snapdragon: Add FIT multi-DTB selection support
>   configs: snapdragon: Enable FIT multi-DTB and configure IMEM
>   image: add IH_TYPE_FATFS image type
>   mkimage: add fatfs image type for FAT partition images
>   doc: document mkimage fatfs type and Qualcomm multi-DTB
>   mach-snapdragon: Reorder header includes
> 
>  arch/arm/mach-snapdragon/Kconfig             |    8 +
>  arch/arm/mach-snapdragon/Makefile            |    1 +
>  arch/arm/mach-snapdragon/board.c             |  123 +-
>  arch/arm/mach-snapdragon/qcom-priv.h         |   24 +
>  arch/arm/mach-snapdragon/qcom_fit_multidtb.c | 1103 ++++++++++++++++++
>  arch/arm/mach-snapdragon/qcom_fit_multidtb.h |  189 +++
>  arch/arm/mach-snapdragon/rampart.h           |  225 ++++
>  boot/image.c                                 |    1 +
>  configs/qcom_defconfig                       |    2 +
>  doc/board/qualcomm/index.rst                 |    1 +
>  doc/board/qualcomm/multi_dtb.rst             |  352 ++++++
>  doc/mkimage.1                                |  103 ++
>  include/image.h                              |    1 +
>  include/soc/qcom/socinfo.h                   |  114 ++
>  tools/Makefile                               |    1 +
>  tools/fatimage.c                             |  495 ++++++++
>  tools/fatimage.h                             |   25 +
>  tools/mkimage.c                              |   21 +
>  tools/mkimage.h                              |   15 +
>  19 files changed, 2793 insertions(+), 11 deletions(-)
>  create mode 100644 arch/arm/mach-snapdragon/qcom_fit_multidtb.c
>  create mode 100644 arch/arm/mach-snapdragon/qcom_fit_multidtb.h
>  create mode 100644 arch/arm/mach-snapdragon/rampart.h
>  create mode 100644 doc/board/qualcomm/multi_dtb.rst
>  create mode 100644 include/soc/qcom/socinfo.h
>  create mode 100644 tools/fatimage.c
>  create mode 100644 tools/fatimage.h
> 

-- 
// Casey (she/her)



More information about the U-Boot mailing list