[PATCH v3 1/7] mach-snapdragon: Add generic SMEM cache infrastructure

Simon Glass sjg at chromium.org
Mon Apr 20 06:06:37 CEST 2026


Hi Aswin,

On 2026-04-17T12:09:44, Aswin Murugan <aswin.murugan at oss.qualcomm.com> wrote:
> mach-snapdragon: Add generic SMEM cache infrastructure
>
> Add cached access functions for commonly used SMEM data to reduce
> redundant SMEM lookups across the boot process.
>
> This patch introduces three generic caching functions:
> - qcom_get_smem_device(): Cached SMEM device access
> - qcom_get_socinfo(): Cached socinfo structure access
> - qcom_get_ram_partitions(): Cached RAM partition table access
>
> The implementation includes new header files for data structures:
> - include/soc/qcom/socinfo.h: Added socinfo header from Linux [1]
>   Provides socinfo structure definitions for SoC identification
>   and hardware parameters
> - arch/arm/mach-snapdragon/rampart.h: Provides RAM partition table
>   structures for memory layout information
>
> The caching mechanism initializes SMEM data on first access and
> returns cached pointers on subsequent calls, avoiding expensive
> SMEM lookups during boot. This infrastructure is designed to be
> [...]
>
> arch/arm/mach-snapdragon/board.c     |  95 +++++++++++++++
>  arch/arm/mach-snapdragon/qcom-priv.h |  24 ++++
>  arch/arm/mach-snapdragon/rampart.h   | 225 +++++++++++++++++++++++++++++++++++
>  include/soc/qcom/socinfo.h           | 114 ++++++++++++++++++
>  4 files changed, 458 insertions(+)

> diff --git a/arch/arm/mach-snapdragon/rampart.h b/arch/arm/mach-snapdragon/rampart.h
> @@ -0,0 +1,225 @@
> +// SPDX-License-Identifier: GPL-2.0
> +/*
> + * RAM partition table definitions
> + *
> + * Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries.
> + *
> + */
> +
> +#define SMEM_USABLE_RAM_PARTITION_TABLE              402

This header should have an include guard.

> diff --git a/arch/arm/mach-snapdragon/board.c b/arch/arm/mach-snapdragon/board.c
> @@ -749,3 +761,86 @@ void enable_caches(void)
> +/**
> + * qcom_get_smem_device() - Get cached SMEM device
> + *
> + * This function provides cached access to the SMEM device.
> + * On first call, it initializes the SMEM device.
> + * Subsequent calls return the cached pointer.
> + *
> + * Return: Pointer to SMEM device on success, NULL on failure
> + */
> +struct udevice *qcom_get_smem_device(void)
> +{
> +     struct udevice *dev;
> +
> +     if (uclass_first_device_err(UCLASS_SMEM, &dev)) {
> +             log_err("Failed to get SMEM device\n");
> +             return NULL;
> +     }
> +
> +     return dev;
> +}

Can you update the commit message and function documentation since
this does not cache anything.

Reviewed-by: Simon Glass <sjg at chromium.org>

Regards,
Simon


More information about the U-Boot mailing list