[PATCH 00/15] qcom: smem: modernize SMEM in U-Boot

Caleb Connolly caleb.connolly at linaro.org
Sun Nov 24 20:17:42 CET 2024


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, while it
was originally proposed as a platform agnostic abstraction it seems
clear that UCLASS_MISC has served that purpose better.

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 that would be possible with a standard
device.

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.
Additionally, we can use it 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.

This depends on a patch [1] making malloc available in fdtdec_setup() since
malloc is required to initialise smem.

[1]: https://lore.kernel.org/u-boot/20241124183832.2476928-1-caleb.connolly@linaro.org

---
Caleb Connolly (15):
      Revert "dm: SMEM (Shared memory) uclass"
      smem: drop drivers/smem
      Revert "test: smem: add basic smem test"
      Revert "drivers: smem: sandbox"
      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: increase pre-relocation malloc size for smem
      mach-snapdragon: move memory parsing to its own file
      mach-snapdragon: support parsing memory map from SMEM
      mach-snapdragon: fetch serial# from SMEM
      qcom_defconfig: enable QCOM_SMEM

 arch/arm/Kconfig                             |   2 -
 arch/arm/mach-snapdragon/Kconfig             |   2 +-
 arch/arm/mach-snapdragon/Makefile            |   2 +-
 arch/arm/mach-snapdragon/board.c             | 107 +---
 arch/arm/mach-snapdragon/dram.c              | 214 ++++++++
 arch/arm/mach-snapdragon/qcom-priv.h         |   4 +
 arch/sandbox/dts/test.dts                    |   4 -
 configs/qcom_defconfig                       |   1 +
 configs/sandbox64_defconfig                  |   2 -
 configs/sandbox_defconfig                    |   2 -
 drivers/Kconfig                              |   2 -
 drivers/Makefile                             |   1 -
 drivers/smem/Kconfig                         |  24 -
 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} | 741 ++++++++++++++++-----------
 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 -
 25 files changed, 842 insertions(+), 637 deletions(-)
---
base-commit: 7aad7833323aa9260935d172744a50f56356d52a

// Caleb (they/them)



More information about the U-Boot mailing list