On 05/05/2026 12:11, Sumit Garg wrote:
> Hi Casey,
>
> Thanks for the much needed re-spin of the SMEM patch-set.
>
> On Mon, May 04, 2026 at 08:57:28PM +0200, Casey Connolly wrote:
>> Smem is currently implemented a uclass in U-Boot. This carries with it
>> some implicit limitations about how and when we can actually talk with
>> it, since its modelled as a device.
>>
>> The SMEM uclass is qualcomm specific and has no other users, smem is
>> also largely useful for parsing the memory map and other tasks which we
>> have to do before DM is alive anyway.
>>
>> Let's drop the old smem code and replace it with a straight port from
>> Linux, providing a familiar interface and enabling us to access it much
>> earlier in the boot process than would be possible with a standard
>> udevice.
>>
>> Additionally, this will be easier to maintain going forwards since any
>> patches from Linux can be more easily ported over.
>>
>> With this new smem framework in place, we can now use SMEM to parse the
>> memory map when it's not provided via some other mechanism and to read
>> the serial number of the board.
>>
>> Implement this functionality and split the snapdragon memory parsing off
>> to its own file to try and organise things a bit better.
>>
>> Since the memory map stored in SMEM doesn't already have some carveouts
>> let's also be correct about unmapping reserved memory regions, we
>> should eventually do this on all Qualcomm boards but it's particularly
>> important when we aren't chainloading from ABL.
>
> This was really needed to unmap reserved regions in U-Boot memory map to
> increase robustness.
agreed, the ~100ms cost sucks but I hope we can bring it down by doing
this after dcache enable if we can figure that out (would probably rely
on starting with an initial minimal map to avoid the prefetcher issues)
but yeah, a problem for the future for sure.
>
>>
>> This depends on a fix for unmapping memory regions:
>> https://lore.kernel.org/u-boot/[email protected]/
>>
>> ---
>> Changes in v2:
>> - Ensure reserved regions are unmapped appropriately when using SMEM as
>> the source of truth for the memory map.
>> - Support SMEM ram layout v0/v1 for older platforms using a header from
>> Qualcomm.
>
> It would be better if you can provide proper attribution in the commit
> to which this header is being picked up.
Where is the header sourced from? I can't really use another patch
posting as a source.
>
>> - Set an environment variable (memmap_source) providing info about
>> where U-Boots memory map is from.
>> - Correctly handle serial_num missing on msm8916
>> - Link to v1:
>> https://lore.kernel.org/r/[email protected]
>>
>
> FWIW, I tested this patch-set on RB3Gen2 and lemans-evk after dropping
> the U-Boot DT overrides, so feel free to carry:
Good to know! I assume you removed the hardcoded DT memorymap for testing?
>
> Tested-by: Sumit Garg <[email protected]>
>
> I will give a proper review to this series soon.
Thanks
>
> -Sumit
>
>> To: [email protected]
>> To: Sumit Garg <[email protected]>
>> To: [email protected]
>> Cc: Tom Rini <[email protected]>
>> Cc: Simon Glass <[email protected]>
>> Cc: Casey Connolly <[email protected]>
>> Cc: Peng Fan <[email protected]>
>> Cc: Marek Vasut <[email protected]>
>> Cc: Alice Guo <[email protected]>
>> Cc: Quentin Schulz <[email protected]>
>> Cc: Ilias Apalodimas <[email protected]>
>> Cc: Neil Armstrong <[email protected]>
>> Cc: Mattijs Korpershoek <[email protected]>
>> Cc: Kuan-Wei Chiu <[email protected]>
>> Cc: Raymond Mao <[email protected]>
>> Cc: Stefan Roese <[email protected]>
>> Cc: Philip Molloy <[email protected]>
>> Cc: Jerome Forissier <[email protected]>
>> Cc: Marek Vasut <[email protected]>
>> Cc: Varadarajan Narayanan <[email protected]>
>> Cc: Patrice Chotard <[email protected]>
>> Cc: Aswin Murugan <[email protected]>
>> Cc: Rasmus Villemoes <[email protected]>
>> Cc: Heiko Schocher <[email protected]>
>> Cc: Michal Simek <[email protected]>
>> Cc: Sughosh Ganu <[email protected]>
>> Cc: Antony Kurniawan Soemardi <[email protected]>
>> Cc: Luca Weiss <[email protected]>
>> Cc: Balaji Selvanathan <[email protected]>
>>
>> ---
>> Casey Connolly (15):
>> Revert "dm: SMEM (Shared memory) uclass"
>> smem: drop drivers/smem
>> Revert "test: smem: add basic smem test"
>> Revert "drivers: smem: sandbox"
>> mach-snapdragon: fix reserved memory carveout
>> soc: qcom: import smem from Linux 6.11-rc2
>> soc: qcom: smem: adjust headers for U-Boot
>> soc: qcom: smem: adjust for U-Boot
>> soc: qcom: smem: get serial number from socinfo
>> soc: qcom: smem: stub functions
>> soc: qcom: smem: add build infra
>> mach-snapdragon: move memory parsing to its own file
>> mach-snapdragon: support parsing memory map from SMEM
>> mach-snapdragon: fetch serial# from SMEM
>> configs: add qcom_sm8650_defconfig and debug fragment
>>
>> MAINTAINERS | 1 -
>> arch/arm/Kconfig | 3 +-
>> arch/arm/mach-snapdragon/Makefile | 2 +-
>> arch/arm/mach-snapdragon/board.c | 253 ++++-----
>> arch/arm/mach-snapdragon/dram.c | 239 ++++++++
>> arch/arm/mach-snapdragon/qcom-priv.h | 17 +
>> arch/arm/mach-snapdragon/rampart.h | 194 +++++++
>> arch/sandbox/dts/test.dts | 4 -
>> board/qualcomm/debug-sm8650.config | 5 +
>> configs/qcom_sm8650_defconfig | 16 +
>> configs/sandbox64_defconfig | 2 -
>> configs/sandbox_defconfig | 2 -
>> drivers/Kconfig | 2 -
>> drivers/Makefile | 1 -
>> drivers/smem/Kconfig | 25 -
>> drivers/smem/Makefile | 7 -
>> drivers/smem/sandbox_smem.c | 44 --
>> drivers/smem/smem-uclass.c | 46 --
>> drivers/soc/qcom/Kconfig | 8 +
>> drivers/soc/qcom/Makefile | 1 +
>> drivers/{smem/msm_smem.c => soc/qcom/smem.c} | 777
>> ++++++++++++++++-----------
>> include/dm/uclass-id.h | 1 -
>> include/smem.h | 90 ----
>> include/soc/qcom/smem.h | 36 ++
>> include/soc/qcom/socinfo.h | 111 ++++
>> test/dm/Makefile | 1 -
>> test/dm/smem.c | 26 -
>> 27 files changed, 1186 insertions(+), 728 deletions(-)
>> ---
>> base-commit: 2920b49fb117dd70b6219804bf0d298c96f184f2
>>
>> // Casey (she/they)
>>
--
// Casey (she/her)