All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 00/32] spl: Preparation for Universal Payload
@ 2023-08-30 18:04 Simon Glass
  2023-08-30 18:04 ` [PATCH 01/32] dm: core: support reading a single indexed u64 value Simon Glass
                   ` (31 more replies)
  0 siblings, 32 replies; 86+ messages in thread
From: Simon Glass @ 2023-08-30 18:04 UTC (permalink / raw)
  To: U-Boot Mailing List
  Cc: Tom Rini, Marek Vasut, Simon Glass, Anatolij Gustschin,
	Andrew F. Davis, Aswath Govindraju, Bin Meng, Breno Lima,
	Chunfeng Yun, Dave Gerlach, Dinh Nguyen, Green Wan,
	Hiremath Gireesh, Le Jin, Marcel Ziswiler, Mario Kicherer,
	Martyn Welch, Matteo Lisi, Matthias Winker, Mayuresh Chitale,
	Michael Walle, Michal Simek, Michal Suchanek,
	Navin Sankar Velliangiri, Niel Fourie, Paweł Anikiel,
	Peng Fan, Silvio Fricke, Stefan Roese, Svyatoslav Ryhel,
	Udit Agarwal, Wasim Khan

This series tidies up SPL a little and adds some core ofnode functions
needed to support Universal Payload. It also includes a few minor fix-ups
for sandbox.

For SPL the changes include CONFIG naming, removing various #ifdefs and
tidying up the FIT code.

One notable piece of the ofnode improvements is support for flattening
a livetree. This should be useful in future as we move FDT fixups to use
the ofnode API.


Michal Simek (1):
  dm: core: support reading a single indexed u64 value

Simon Glass (31):
  spl: Use CONFIG_SPL... instead of CONFIG_..._SPL_...
  spl: Rename SYS_SPL_ARGS_ADDR to SPL_SYS_ARGS_ADDR
  spl: Avoid #ifdef with CONFIG_SPL_SYS_MALLOC
  spl: mx6: powerpc: Drop the condition on timer_init()
  spl: Drop #ifdefs for BOARD_INIT and watchdog
  spl: Avoid #ifdef with CONFIG_SPL_SYS_ARGS_ADDR
  spl: Drop the switch() statement for OS selection
  spl: Avoid an #ifdef when printing gd->malloc_ptr
  spl: Remove #ifdefs with BOOTSTAGE
  spl: Rename spl_load_fit_image() to load_simple_fit()
  spl: Move the full FIT code to spl_fit.c
  spl: Use the correct FIT_..._PROP constants
  spl: Move bloblist writing until the image is known
  dm: core: Reverse the argument order in ofnode_copy_props()
  dm: core: Ensure we run flattree tests on ofnode
  dm: core: Tidy up comments in the ofnode tests
  dm: core: Add a function to create an empty tree
  dm: core: Add a way to copy a node
  dm: core: Add a way to delete a node
  dm: core: Add a way to convert a devicetree to a dtb
  dm: core: Support writing a boolean
  dm: core: Support writing a 64-bit value
  dm: core: Add tests for oftree_path()
  sandbox: Move reading the RAM buffer into a better place
  sandbox: Init the EC properly even if no state file is available
  sandbox: Only read the state if we have a state file
  sandbox: Move the bloblist down a little in memory
  bloblist: Support initing from multiple places
  fdt: Allow the devicetree to come from a bloblist
  command: Include a required header in command.h
  pci: serial: Support reading PCI-register size with base

 Kconfig                                       |   2 +-
 README                                        |   2 +-
 arch/arm/cpu/armv7/ls102xa/fdt.c              |   2 +-
 .../armv8/fsl-layerscape/doc/README.falcon    |   2 +-
 arch/sandbox/cpu/start.c                      |  27 +-
 arch/sandbox/cpu/state.c                      |   2 +
 arch/sandbox/dts/test.dts                     |   7 +-
 boot/vbe_request.c                            |   2 +-
 boot/vbe_simple_os.c                          |   2 +-
 common/Kconfig                                |   2 +-
 common/bloblist.c                             |  15 +-
 common/board_f.c                              |   4 +-
 common/spl/Kconfig                            |  17 +-
 common/spl/Kconfig.nxp                        |   2 +-
 common/spl/spl.c                              | 234 ++++-----------
 common/spl/spl_ext.c                          |   4 +-
 common/spl/spl_fat.c                          |   4 +-
 common/spl/spl_fit.c                          | 127 +++++++--
 common/spl/spl_mmc.c                          |   2 +-
 common/spl/spl_nand.c                         |  10 +-
 common/spl/spl_nor.c                          |   8 +-
 common/spl/spl_spi.c                          |   2 +-
 common/spl/spl_ubi.c                          |   2 +-
 common/spl/spl_xip.c                          |   2 +-
 configs/am335x_baltos_defconfig               |   4 +-
 configs/am335x_boneblack_vboot_defconfig      |   4 +-
 configs/am335x_evm_defconfig                  |   4 +-
 configs/am335x_evm_spiboot_defconfig          |   4 +-
 configs/am335x_guardian_defconfig             |   4 +-
 configs/am335x_hs_evm_defconfig               |   4 +-
 configs/am335x_hs_evm_uart_defconfig          |   4 +-
 configs/am335x_igep003x_defconfig             |   4 +-
 configs/am335x_pdu001_defconfig               |   4 +-
 configs/am335x_shc_defconfig                  |   4 +-
 configs/am335x_shc_ict_defconfig              |   4 +-
 configs/am335x_shc_netboot_defconfig          |   4 +-
 configs/am335x_shc_sdboot_defconfig           |   4 +-
 configs/am335x_sl50_defconfig                 |   4 +-
 configs/am3517_evm_defconfig                  |   6 +-
 configs/am43xx_evm_defconfig                  |   4 +-
 configs/am43xx_evm_rtconly_defconfig          |   4 +-
 configs/am43xx_evm_usbhost_boot_defconfig     |   4 +-
 configs/am43xx_hs_evm_defconfig               |   4 +-
 configs/am57xx_evm_defconfig                  |   4 +-
 configs/am57xx_hs_evm_defconfig               |   4 +-
 configs/am57xx_hs_evm_usb_defconfig           |   4 +-
 configs/am62ax_evm_r5_defconfig               |   6 +-
 configs/am62x_evm_r5_defconfig                |   8 +-
 configs/am64x_evm_a53_defconfig               |   4 +-
 configs/am64x_evm_r5_defconfig                |   8 +-
 configs/am65x_evm_a53_defconfig               |   4 +-
 configs/am65x_evm_r5_defconfig                |   8 +-
 configs/am65x_evm_r5_usbdfu_defconfig         |   8 +-
 configs/am65x_evm_r5_usbmsc_defconfig         |   8 +-
 configs/am65x_hs_evm_a53_defconfig            |   4 +-
 configs/am65x_hs_evm_r5_defconfig             |   8 +-
 configs/apalis-tk1_defconfig                  |   8 +-
 configs/apalis_imx6_defconfig                 |   2 +-
 configs/apalis_t30_defconfig                  |   8 +-
 configs/axm_defconfig                         |   8 +-
 configs/beaver_defconfig                      |   8 +-
 configs/bitmain_antminer_s9_defconfig         |   4 +-
 configs/brppt1_mmc_defconfig                  |   4 +-
 configs/brppt2_defconfig                      |   2 +-
 configs/brsmarc1_defconfig                    |   4 +-
 configs/brxre1_defconfig                      |   4 +-
 configs/cardhu_defconfig                      |   8 +-
 configs/cei-tk1-som_defconfig                 |   8 +-
 configs/cgtqmx8_defconfig                     |   8 +-
 configs/chiliboard_defconfig                  |   4 +-
 configs/cl-som-imx7_defconfig                 |   2 +-
 configs/cm_fx6_defconfig                      |   2 +-
 configs/cm_t43_defconfig                      |   4 +-
 configs/colibri_imx6_defconfig                |   2 +-
 configs/colibri_t20_defconfig                 |   8 +-
 configs/colibri_t30_defconfig                 |   8 +-
 configs/da850evm_defconfig                    |   8 +-
 configs/da850evm_nand_defconfig               |   8 +-
 configs/dalmore_defconfig                     |   8 +-
 configs/deneb_defconfig                       |   8 +-
 configs/devkit8000_defconfig                  |   8 +-
 configs/dh_imx6_defconfig                     |   2 +-
 configs/display5_defconfig                    |   4 +-
 configs/display5_factory_defconfig            |   4 +-
 configs/dra7xx_evm_defconfig                  |   4 +-
 configs/dra7xx_hs_evm_defconfig               |   4 +-
 configs/dra7xx_hs_evm_usb_defconfig           |   4 +-
 configs/draco_defconfig                       |   6 +-
 configs/endeavoru_defconfig                   |   8 +-
 configs/etamin_defconfig                      |   6 +-
 .../gardena-smart-gateway-at91sam_defconfig   |   4 +-
 configs/ge_b1x5v2_defconfig                   |   2 +-
 configs/giedi_defconfig                       |   8 +-
 configs/grouper_common_defconfig              |   8 +-
 configs/gwventana_emmc_defconfig              |   4 +-
 configs/gwventana_nand_defconfig              |   4 +-
 configs/harmony_defconfig                     |   8 +-
 configs/igep00x0_defconfig                    |   6 +-
 configs/imx28_xea_defconfig                   |   2 +-
 configs/imx6dl_icore_nand_defconfig           |   2 +-
 configs/imx6dl_mamoj_defconfig                |   4 +-
 configs/imx6q_bosch_acc_defconfig             |   2 +-
 configs/imx6q_icore_nand_defconfig            |   2 +-
 configs/imx6q_logic_defconfig                 |   4 +-
 configs/imx6qdl_icore_mipi_defconfig          |   4 +-
 configs/imx6qdl_icore_mmc_defconfig           |   4 +-
 configs/imx6qdl_icore_nand_defconfig          |   2 +-
 configs/imx6qdl_icore_rqs_defconfig           |   4 +-
 configs/imx6ul_geam_mmc_defconfig             |   2 +-
 configs/imx6ul_geam_nand_defconfig            |   2 +-
 configs/imx6ul_isiot_emmc_defconfig           |   2 +-
 configs/imx6ul_isiot_nand_defconfig           |   2 +-
 configs/imx6ulz_smm_m2_defconfig              |   2 +-
 configs/imx7_cm_defconfig                     |   2 +-
 configs/imx8mm-cl-iot-gate-optee_defconfig    |   8 +-
 configs/imx8mm-cl-iot-gate_defconfig          |   8 +-
 configs/imx8mm-icore-mx8mm-ctouch2_defconfig  |   8 +-
 configs/imx8mm-icore-mx8mm-edimm2.2_defconfig |   8 +-
 configs/imx8mm-mx8menlo_defconfig             |   8 +-
 configs/imx8mm_beacon_defconfig               |   8 +-
 configs/imx8mm_beacon_fspi_defconfig          |   8 +-
 configs/imx8mm_data_modul_edm_sbc_defconfig   |   8 +-
 configs/imx8mm_evk_defconfig                  |   8 +-
 configs/imx8mm_evk_fspi_defconfig             |   8 +-
 configs/imx8mm_phg_defconfig                  |   8 +-
 configs/imx8mm_venice_defconfig               |   6 +-
 configs/imx8mn_beacon_2g_defconfig            |   8 +-
 configs/imx8mn_beacon_defconfig               |   8 +-
 configs/imx8mn_beacon_fspi_defconfig          |   8 +-
 configs/imx8mn_bsh_smm_s2_defconfig           |   8 +-
 configs/imx8mn_bsh_smm_s2pro_defconfig        |   8 +-
 configs/imx8mn_ddr4_evk_defconfig             |   8 +-
 configs/imx8mn_evk_defconfig                  |   8 +-
 configs/imx8mn_var_som_defconfig              |   8 +-
 configs/imx8mn_venice_defconfig               |   8 +-
 configs/imx8mp-icore-mx8mp-edimm2.2_defconfig |   8 +-
 configs/imx8mp_beacon_defconfig               |   8 +-
 configs/imx8mp_data_modul_edm_sbc_defconfig   |   8 +-
 configs/imx8mp_dhcom_pdk2_defconfig           |   8 +-
 configs/imx8mp_dhcom_pdk3_defconfig           |   8 +-
 configs/imx8mp_evk_defconfig                  |   8 +-
 configs/imx8mp_rsb3720a1_4G_defconfig         |   8 +-
 configs/imx8mp_rsb3720a1_6G_defconfig         |   8 +-
 configs/imx8mp_venice_defconfig               |   8 +-
 configs/imx8mq_cm_defconfig                   |   8 +-
 configs/imx8mq_evk_defconfig                  |   8 +-
 configs/imx8mq_phanbell_defconfig             |   8 +-
 configs/imx8mq_reform2_defconfig              |   8 +-
 configs/imx8qm_mek_defconfig                  |   8 +-
 configs/imx8qxp_mek_defconfig                 |   8 +-
 configs/imx8ulp_evk_defconfig                 |   8 +-
 configs/imx93_11x11_evk_defconfig             |   8 +-
 configs/imx93_11x11_evk_ld_defconfig          |   8 +-
 configs/iot2050_defconfig                     |   4 +-
 configs/j7200_evm_a72_defconfig               |   4 +-
 configs/j7200_evm_r5_defconfig                |   8 +-
 configs/j721e_evm_a72_defconfig               |   4 +-
 configs/j721e_evm_r5_defconfig                |   8 +-
 configs/j721s2_evm_a72_defconfig              |   4 +-
 configs/j721s2_evm_r5_defconfig               |   8 +-
 configs/jetson-tk1_defconfig                  |   8 +-
 configs/k2e_evm_defconfig                     |   4 +-
 configs/k2g_evm_defconfig                     |   4 +-
 configs/k2hk_evm_defconfig                    |   4 +-
 configs/k2l_evm_defconfig                     |   4 +-
 configs/kontron-sl-mx6ul_defconfig            |   2 +-
 configs/kontron-sl-mx8mm_defconfig            |   8 +-
 configs/kontron_pitx_imx8m_defconfig          |   8 +-
 configs/kontron_sl28_defconfig                |   2 +-
 configs/kp_imx6q_tpc_defconfig                |   2 +-
 configs/librem5_defconfig                     |   8 +-
 configs/liteboard_defconfig                   |   2 +-
 configs/ls1021aiot_sdcard_defconfig           |   6 +-
 configs/ls1021aqds_nand_defconfig             |   6 +-
 configs/ls1021aqds_sdcard_ifc_defconfig       |   6 +-
 configs/ls1021aqds_sdcard_qspi_defconfig      |   6 +-
 configs/ls1021atsn_sdcard_defconfig           |   6 +-
 ...s1021atwr_sdcard_ifc_SECURE_BOOT_defconfig |   6 +-
 configs/ls1021atwr_sdcard_ifc_defconfig       |   6 +-
 configs/ls1021atwr_sdcard_qspi_defconfig      |   6 +-
 configs/ls1043aqds_nand_defconfig             |   6 +-
 configs/ls1043aqds_sdcard_ifc_defconfig       |   2 +-
 configs/ls1043aqds_sdcard_qspi_defconfig      |   2 +-
 configs/ls1043ardb_nand_SECURE_BOOT_defconfig |   6 +-
 configs/ls1043ardb_nand_defconfig             |   6 +-
 .../ls1043ardb_sdcard_SECURE_BOOT_defconfig   |   2 +-
 configs/ls1043ardb_sdcard_defconfig           |   2 +-
 configs/ls1046aqds_nand_defconfig             |   2 +-
 configs/ls1046aqds_sdcard_ifc_defconfig       |   2 +-
 configs/ls1046aqds_sdcard_qspi_defconfig      |   2 +-
 configs/ls1046ardb_emmc_defconfig             |   2 +-
 configs/ls1046ardb_qspi_spl_defconfig         |   4 +-
 .../ls1046ardb_sdcard_SECURE_BOOT_defconfig   |   2 +-
 configs/ls1046ardb_sdcard_defconfig           |   2 +-
 configs/ls1088aqds_sdcard_ifc_defconfig       |   2 +-
 configs/ls1088aqds_sdcard_qspi_defconfig      |   2 +-
 ...1088ardb_sdcard_qspi_SECURE_BOOT_defconfig |   2 +-
 configs/ls1088ardb_sdcard_qspi_defconfig      |   2 +-
 configs/ls2080aqds_nand_defconfig             |   2 +-
 configs/ls2080aqds_sdcard_defconfig           |   2 +-
 configs/ls2080ardb_nand_defconfig             |   2 +-
 configs/mccmon6_nor_defconfig                 |   4 +-
 configs/mccmon6_sd_defconfig                  |   2 +-
 configs/medcom-wide_defconfig                 |   8 +-
 configs/msc_sm2s_imx8mp_defconfig             |   8 +-
 configs/mx6cuboxi_defconfig                   |   2 +-
 configs/mx6memcal_defconfig                   |   2 +-
 configs/mx6sabreauto_defconfig                |   2 +-
 configs/mx6sabresd_defconfig                  |   2 +-
 configs/mx6slevk_spl_defconfig                |   2 +-
 configs/mx6ul_14x14_evk_defconfig             |   2 +-
 configs/mx6ul_9x9_evk_defconfig               |   2 +-
 configs/myir_mys_6ulx_defconfig               |   2 +-
 configs/novena_defconfig                      |   2 +-
 configs/nyan-big_defconfig                    |   8 +-
 configs/omap35_logic_defconfig                |   6 +-
 configs/omap35_logic_somlv_defconfig          |   6 +-
 configs/omap3_beagle_defconfig                |   4 +-
 configs/omap3_evm_defconfig                   |   4 +-
 configs/omap3_logic_defconfig                 |   6 +-
 configs/omap3_logic_somlv_defconfig           |   6 +-
 configs/omap4_panda_defconfig                 |   4 +-
 configs/omap4_sdp4430_defconfig               |   4 +-
 configs/omapl138_lcdk_defconfig               |   8 +-
 configs/openpiton_riscv64_spl_defconfig       |   2 +-
 configs/opos6uldev_defconfig                  |   2 +-
 configs/paz00_defconfig                       |   8 +-
 configs/pcm058_defconfig                      |   2 +-
 configs/phycore-am335x-r2-regor_defconfig     |   4 +-
 configs/phycore-am335x-r2-wega_defconfig      |   4 +-
 configs/phycore-imx8mm_defconfig              |   8 +-
 configs/phycore-imx8mp_defconfig              |   8 +-
 configs/phycore_pcl063_defconfig              |   2 +-
 configs/phycore_pcl063_ull_defconfig          |   2 +-
 configs/pico-dwarf-imx6ul_defconfig           |   2 +-
 configs/pico-dwarf-imx7d_defconfig            |   2 +-
 configs/pico-hobbit-imx6ul_defconfig          |   2 +-
 configs/pico-hobbit-imx7d_defconfig           |   2 +-
 configs/pico-imx6_defconfig                   |   2 +-
 configs/pico-imx6ul_defconfig                 |   2 +-
 configs/pico-imx7d_bl33_defconfig             |   2 +-
 configs/pico-imx7d_defconfig                  |   2 +-
 configs/pico-imx8mq_defconfig                 |   8 +-
 configs/pico-nymph-imx7d_defconfig            |   2 +-
 configs/pico-pi-imx6ul_defconfig              |   2 +-
 configs/pico-pi-imx7d_defconfig               |   2 +-
 configs/plutux_defconfig                      |   8 +-
 configs/pxm2_defconfig                        |   6 +-
 configs/qemu-riscv32_spl_defconfig            |   2 +-
 configs/qemu-riscv64_spl_defconfig            |   2 +-
 configs/rastaban_defconfig                    |   6 +-
 configs/ringneck-px30_defconfig               |   2 +-
 configs/riotboard_defconfig                   |   4 +-
 configs/rut_defconfig                         |   6 +-
 configs/sama5d27_giantboard_defconfig         |   4 +-
 configs/sama5d27_som1_ek_mmc1_defconfig       |   4 +-
 configs/sama5d27_som1_ek_mmc_defconfig        |   4 +-
 configs/sama5d27_som1_ek_qspiflash_defconfig  |   4 +-
 configs/sama5d27_wlsom1_ek_mmc_defconfig      |   4 +-
 .../sama5d27_wlsom1_ek_qspiflash_defconfig    |   4 +-
 configs/sama5d2_icp_mmc_defconfig             |   4 +-
 configs/sama5d2_xplained_emmc_defconfig       |   4 +-
 configs/sama5d2_xplained_mmc_defconfig        |   4 +-
 configs/sama5d2_xplained_qspiflash_defconfig  |   4 +-
 configs/sama5d2_xplained_spiflash_defconfig   |   4 +-
 configs/sama5d3_xplained_mmc_defconfig        |   4 +-
 configs/sama5d3_xplained_nandflash_defconfig  |   4 +-
 configs/sama5d3xek_mmc_defconfig              |   4 +-
 configs/sama5d3xek_nandflash_defconfig        |   4 +-
 configs/sama5d3xek_spiflash_defconfig         |   4 +-
 configs/sama5d4_xplained_mmc_defconfig        |   4 +-
 configs/sama5d4_xplained_nandflash_defconfig  |   4 +-
 configs/sama5d4_xplained_spiflash_defconfig   |   4 +-
 configs/sama5d4ek_mmc_defconfig               |   4 +-
 configs/sama5d4ek_nandflash_defconfig         |   4 +-
 configs/sama5d4ek_spiflash_defconfig          |   4 +-
 configs/seaboard_defconfig                    |   8 +-
 configs/seeed_npi_imx6ull_defconfig           |   2 +-
 configs/sifive_unleashed_defconfig            |   2 +-
 configs/sifive_unmatched_defconfig            |   2 +-
 configs/smartweb_defconfig                    |   4 +-
 configs/sniper_defconfig                      |   6 +-
 configs/socfpga_agilex_atf_defconfig          |   8 +-
 configs/socfpga_agilex_defconfig              |   8 +-
 configs/socfpga_agilex_vab_defconfig          |   8 +-
 configs/socfpga_arria10_defconfig             |   8 +-
 configs/socfpga_chameleonv3_defconfig         |   8 +-
 configs/socfpga_n5x_atf_defconfig             |   8 +-
 configs/socfpga_n5x_defconfig                 |   8 +-
 configs/socfpga_n5x_vab_defconfig             |   8 +-
 configs/socfpga_stratix10_atf_defconfig       |   8 +-
 configs/socfpga_stratix10_defconfig           |   8 +-
 configs/starfive_visionfive2_defconfig        |   8 +-
 configs/stm32746g-eval_spl_defconfig          |   2 +-
 configs/stm32f746-disco_spl_defconfig         |   2 +-
 configs/stm32f769-disco_spl_defconfig         |   2 +-
 ...stm32mp15-icore-stm32mp1-ctouch2_defconfig |   8 +-
 ...tm32mp15-icore-stm32mp1-edimm2.2_defconfig |   8 +-
 ...-microgea-stm32mp1-microdev2-of7_defconfig |   8 +-
 ...mp15-microgea-stm32mp1-microdev2_defconfig |   8 +-
 configs/stm32mp15_basic_defconfig             |   8 +-
 configs/stm32mp15_dhcom_basic_defconfig       |   8 +-
 configs/stm32mp15_dhcor_basic_defconfig       |   8 +-
 configs/syzygy_hub_defconfig                  |   6 +-
 configs/taurus_defconfig                      |   8 +-
 configs/tec-ng_defconfig                      |   8 +-
 configs/tec_defconfig                         |   8 +-
 configs/thuban_defconfig                      |   6 +-
 configs/topic_miami_defconfig                 |   4 +-
 configs/topic_miamilite_defconfig             |   4 +-
 configs/topic_miamiplus_defconfig             |   4 +-
 configs/transformer_t30_defconfig             |   8 +-
 configs/trimslice_defconfig                   |   8 +-
 configs/udoo_defconfig                        |   2 +-
 configs/udoo_neo_defconfig                    |   2 +-
 configs/variscite_dart6ul_defconfig           |   2 +-
 configs/venice2_defconfig                     |   8 +-
 configs/ventana_defconfig                     |   8 +-
 configs/verdin-am62_r5_defconfig              |   8 +-
 configs/verdin-imx8mm_defconfig               |   8 +-
 configs/verdin-imx8mp_defconfig               |   8 +-
 configs/vining_2000_defconfig                 |   2 +-
 configs/vyasa-rk3288_defconfig                |   2 +-
 configs/wandboard_defconfig                   |   2 +-
 configs/x3_t30_defconfig                      |   8 +-
 configs/xilinx_zynq_virt_defconfig            |   6 +-
 configs/xilinx_zynqmp_mini_emmc0_defconfig    |   8 +-
 configs/xilinx_zynqmp_mini_emmc1_defconfig    |   8 +-
 configs/xilinx_zynqmp_mini_qspi_defconfig     |   8 +-
 configs/xilinx_zynqmp_virt_defconfig          |  10 +-
 configs/zynq_cse_nand_defconfig               |   8 +-
 configs/zynq_cse_nor_defconfig                |   8 +-
 configs/zynq_cse_qspi_defconfig               |   8 +-
 doc/arch/sandbox/sandbox.rst                  |   4 +-
 doc/develop/devicetree/control.rst            |   3 +
 doc/develop/falcon.rst                        |   2 +-
 drivers/core/Kconfig                          |   6 +-
 drivers/core/fdtaddr.c                        |   6 +-
 drivers/core/of_access.c                      |  81 +++++-
 drivers/core/ofnode.c                         | 213 +++++++++++++-
 drivers/core/read.c                           |   6 +-
 drivers/core/util.c                           |   2 +-
 drivers/misc/cros_ec_sandbox.c                |   9 +-
 drivers/pci/pci-uclass.c                      |   2 +-
 drivers/pci/pci_mvebu.c                       |   3 +-
 drivers/pci/pci_tegra.c                       |   2 +-
 drivers/pci/pcie_mediatek.c                   |   4 +-
 drivers/serial/Kconfig                        |   2 +-
 drivers/serial/ns16550.c                      |  15 +-
 dts/Kconfig                                   |   8 +
 include/asm-generic/global_data.h             |  11 +
 include/bloblist.h                            |  23 ++
 include/bootstage.h                           |  26 ++
 include/command.h                             |   3 +
 include/configs/socfpga_common.h              |   2 +-
 include/configs/socfpga_soc64_common.h        |   2 +-
 include/dm/fdtaddr.h                          |   3 +-
 include/dm/of_access.h                        |  37 +++
 include/dm/ofnode.h                           | 114 +++++++-
 include/dm/read.h                             |   8 +-
 include/fdtdec.h                              |   3 +-
 include/ns16550.h                             |   4 +-
 include/of_live.h                             |  18 ++
 include/serial.h                              |   2 +
 include/spl.h                                 |  28 +-
 include/system-constants.h                    |  11 +-
 lib/fdtdec.c                                  |  44 ++-
 lib/of_live.c                                 | 141 ++++++++++
 test/dm/ofnode.c                              | 266 ++++++++++++++++--
 test/dm/pci.c                                 |  14 +-
 test/lib/kconfig.c                            |   4 +-
 371 files changed, 2071 insertions(+), 1138 deletions(-)

-- 
2.42.0.rc2.253.gd59a3bf2b4-goog


^ permalink raw reply	[flat|nested] 86+ messages in thread

* [PATCH 01/32] dm: core: support reading a single indexed u64 value
  2023-08-30 18:04 [PATCH 00/32] spl: Preparation for Universal Payload Simon Glass
@ 2023-08-30 18:04 ` Simon Glass
  2023-08-30 18:04 ` [PATCH 02/32] spl: Use CONFIG_SPL... instead of CONFIG_..._SPL_ Simon Glass
                   ` (30 subsequent siblings)
  31 siblings, 0 replies; 86+ messages in thread
From: Simon Glass @ 2023-08-30 18:04 UTC (permalink / raw)
  To: U-Boot Mailing List
  Cc: Tom Rini, Marek Vasut, Michal Simek, Ashok Reddy Soma,
	Simon Glass, Abdellatif El Khlifi, Dzmitry Sankouski,
	Ilias Apalodimas, Nikhil M Jain, Pavel Herrmann

From: Michal Simek <michal.simek@amd.com>

Add helper function to allow reading a single indexed u64 value from a
device-tree property containing multiple u64 values, that is an array of
u64's.

Co-developed-by: Ashok Reddy Soma <ashok.reddy.soma@amd.com>
Signed-off-by: Ashok Reddy Soma <ashok.reddy.soma@amd.com>
Signed-off-by: Michal Simek <michal.simek@amd.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Simon Glass <sjg@chromium.org>
---

 arch/sandbox/dts/test.dts |  1 +
 drivers/core/of_access.c  | 16 ++++++++++++----
 drivers/core/ofnode.c     | 30 ++++++++++++++++++++++++++++++
 include/dm/of_access.h    | 19 +++++++++++++++++++
 include/dm/ofnode.h       | 12 ++++++++++++
 test/dm/ofnode.c          |  8 ++++++++
 6 files changed, 82 insertions(+), 4 deletions(-)

diff --git a/arch/sandbox/dts/test.dts b/arch/sandbox/dts/test.dts
index b48456aebee..a413cbe4989 100644
--- a/arch/sandbox/dts/test.dts
+++ b/arch/sandbox/dts/test.dts
@@ -301,6 +301,7 @@
 		uint-value = <(-1234)>;
 		int64-value = /bits/ 64 <0x1111222233334444>;
 		int-array = <5678 9123 4567>;
+		int64-array = /bits/ 64 <0x1111222233334444 0x4444333322221111>;
 		str-value = "test string";
 		interrupts-extended = <&irq 3 0>;
 		acpi,name = "GHIJ";
diff --git a/drivers/core/of_access.c b/drivers/core/of_access.c
index 57f10445b12..1bb4d8eab70 100644
--- a/drivers/core/of_access.c
+++ b/drivers/core/of_access.c
@@ -570,26 +570,34 @@ int of_read_u32_index(const struct device_node *np, const char *propname,
 	return 0;
 }
 
-int of_read_u64(const struct device_node *np, const char *propname, u64 *outp)
+int of_read_u64_index(const struct device_node *np, const char *propname,
+		      int index, u64 *outp)
 {
 	const __be64 *val;
 
 	debug("%s: %s: ", __func__, propname);
 	if (!np)
 		return -EINVAL;
-	val = of_find_property_value_of_size(np, propname, sizeof(*outp));
+
+	val = of_find_property_value_of_size(np, propname,
+					     sizeof(*outp) * (index + 1));
 	if (IS_ERR(val)) {
 		debug("(not found)\n");
 		return PTR_ERR(val);
 	}
 
-	*outp = be64_to_cpup(val);
+	*outp = be64_to_cpup(val + index);
 	debug("%#llx (%lld)\n", (unsigned long long)*outp,
-              (unsigned long long)*outp);
+	      (unsigned long long)*outp);
 
 	return 0;
 }
 
+int of_read_u64(const struct device_node *np, const char *propname, u64 *outp)
+{
+	return of_read_u64_index(np, propname, 0, outp);
+}
+
 int of_property_match_string(const struct device_node *np, const char *propname,
 			     const char *string)
 {
diff --git a/drivers/core/ofnode.c b/drivers/core/ofnode.c
index a4dc9bde085..8311282abf6 100644
--- a/drivers/core/ofnode.c
+++ b/drivers/core/ofnode.c
@@ -344,6 +344,36 @@ int ofnode_read_u32_index(ofnode node, const char *propname, int index,
 	return 0;
 }
 
+int ofnode_read_u64_index(ofnode node, const char *propname, int index,
+			  u64 *outp)
+{
+	const fdt64_t *cell;
+	int len;
+
+	assert(ofnode_valid(node));
+
+	if (ofnode_is_np(node))
+		return of_read_u64_index(ofnode_to_np(node), propname, index,
+					 outp);
+
+	cell = fdt_getprop(ofnode_to_fdt(node), ofnode_to_offset(node),
+			   propname, &len);
+	if (!cell) {
+		debug("(not found)\n");
+		return -EINVAL;
+	}
+
+	if (len < (sizeof(u64) * (index + 1))) {
+		debug("(not large enough)\n");
+		return -EOVERFLOW;
+	}
+
+	*outp = fdt64_to_cpu(cell[index]);
+	debug("%#llx (%lld)\n", *outp, *outp);
+
+	return 0;
+}
+
 u32 ofnode_read_u32_index_default(ofnode node, const char *propname, int index,
 				  u32 def)
 {
diff --git a/include/dm/of_access.h b/include/dm/of_access.h
index c556a18f7d9..9361d0a87bf 100644
--- a/include/dm/of_access.h
+++ b/include/dm/of_access.h
@@ -333,6 +333,25 @@ int of_read_u32(const struct device_node *np, const char *propname, u32 *outp);
 int of_read_u32_index(const struct device_node *np, const char *propname,
 		      int index, u32 *outp);
 
+/**
+ * of_read_u64_index() - Find and read a 64-bit value from a multi-value
+ *                       property
+ *
+ * @np:		device node from which the property value is to be read.
+ * @propname:	name of the property to be searched.
+ * @index:	index of the u32 in the list of values
+ * @outp:	pointer to return value, modified only if return value is 0.
+ *
+ * Search for a property in a device node and read a 64-bit value from
+ * it.
+ *
+ * Return:
+ *   0 on success, -EINVAL if the property does not exist, or -EOVERFLOW if the
+ *   property data isn't large enough.
+ */
+int of_read_u64_index(const struct device_node *np, const char *propname,
+		      int index, u64 *outp);
+
 /**
  * of_read_u64() - Find and read a 64-bit integer from a property
  *
diff --git a/include/dm/ofnode.h b/include/dm/ofnode.h
index 0f38b3e736d..0a85db31f36 100644
--- a/include/dm/ofnode.h
+++ b/include/dm/ofnode.h
@@ -434,6 +434,18 @@ int ofnode_read_u32(ofnode node, const char *propname, u32 *outp);
 int ofnode_read_u32_index(ofnode node, const char *propname, int index,
 			  u32 *outp);
 
+/**
+ * ofnode_read_u64_index() - Read a 64-bit integer from a multi-value property
+ *
+ * @node:	valid node reference to read property from
+ * @propname:	name of the property to read from
+ * @index:	index of the integer to return
+ * @outp:	place to put value (if found)
+ * Return: 0 if OK, -ve on error
+ */
+int ofnode_read_u64_index(ofnode node, const char *propname, int index,
+			  u64 *outp);
+
 /**
  * ofnode_read_s32() - Read a 32-bit integer from a property
  *
diff --git a/test/dm/ofnode.c b/test/dm/ofnode.c
index 6fbebc7da08..b74f5c2ebcf 100644
--- a/test/dm/ofnode.c
+++ b/test/dm/ofnode.c
@@ -967,6 +967,14 @@ static int dm_test_ofnode_u64(struct unit_test_state *uts)
 	ut_asserteq_64(0x1111222233334444, val);
 	ut_asserteq(-EINVAL, ofnode_read_u64(node, "missing", &val));
 
+	ut_assertok(ofnode_read_u64_index(node, "int64-array", 0, &val));
+	ut_asserteq_64(0x1111222233334444, val);
+	ut_assertok(ofnode_read_u64_index(node, "int64-array", 1, &val));
+	ut_asserteq_64(0x4444333322221111, val);
+	ut_asserteq(-EOVERFLOW,
+		    ofnode_read_u64_index(node, "int64-array", 2, &val));
+	ut_asserteq(-EINVAL, ofnode_read_u64_index(node, "missing", 0, &val));
+
 	return 0;
 }
 DM_TEST(dm_test_ofnode_u64, UT_TESTF_SCAN_FDT);
-- 
2.42.0.rc2.253.gd59a3bf2b4-goog


^ permalink raw reply related	[flat|nested] 86+ messages in thread

* [PATCH 02/32] spl: Use CONFIG_SPL... instead of CONFIG_..._SPL_...
  2023-08-30 18:04 [PATCH 00/32] spl: Preparation for Universal Payload Simon Glass
  2023-08-30 18:04 ` [PATCH 01/32] dm: core: support reading a single indexed u64 value Simon Glass
@ 2023-08-30 18:04 ` Simon Glass
  2023-08-31  7:37   ` Marcel Ziswiler
                     ` (2 more replies)
  2023-08-30 18:04 ` [PATCH 03/32] spl: Rename SYS_SPL_ARGS_ADDR to SPL_SYS_ARGS_ADDR Simon Glass
                   ` (29 subsequent siblings)
  31 siblings, 3 replies; 86+ messages in thread
From: Simon Glass @ 2023-08-30 18:04 UTC (permalink / raw)
  To: U-Boot Mailing List
  Cc: Tom Rini, Marek Vasut, Simon Glass, Alban Bedel,
	Anatolij Gustschin, Andrew F. Davis, Aswath Govindraju,
	Breno Lima, Dave Gerlach, Dinh Nguyen, Green Wan,
	Heinrich Schuchardt, Hiremath Gireesh, Le Jin, Marcel Ziswiler,
	Martyn Welch, Matteo Lisi, Matthias Winker, Mayuresh Chitale,
	Michael Walle, Michal Simek, Navin Sankar Velliangiri,
	Niel Fourie, Patrick Wildt, Paweł Anikiel, Peng Fan,
	Siew Chin Lim, Silvio Fricke, Stefan Roese, Svyatoslav Ryhel,
	Udit Agarwal, Wasim Khan

We like to put the SPL first so it is clear that it relates to SPL. Rename
various malloc-related options which have crept in, to stick to this
convention.

Signed-off-by: Simon Glass <sjg@chromium.org>
---

 Kconfig                                            |  2 +-
 README                                             |  2 +-
 arch/arm/cpu/armv7/ls102xa/fdt.c                   |  2 +-
 common/spl/Kconfig                                 | 14 +++++++-------
 common/spl/Kconfig.nxp                             |  2 +-
 common/spl/spl.c                                   |  6 +++---
 common/spl/spl_fit.c                               |  2 +-
 configs/am335x_baltos_defconfig                    |  4 ++--
 configs/am335x_boneblack_vboot_defconfig           |  4 ++--
 configs/am335x_evm_defconfig                       |  4 ++--
 configs/am335x_evm_spiboot_defconfig               |  4 ++--
 configs/am335x_guardian_defconfig                  |  4 ++--
 configs/am335x_hs_evm_defconfig                    |  4 ++--
 configs/am335x_hs_evm_uart_defconfig               |  4 ++--
 configs/am335x_igep003x_defconfig                  |  4 ++--
 configs/am335x_pdu001_defconfig                    |  4 ++--
 configs/am335x_shc_defconfig                       |  4 ++--
 configs/am335x_shc_ict_defconfig                   |  4 ++--
 configs/am335x_shc_netboot_defconfig               |  4 ++--
 configs/am335x_shc_sdboot_defconfig                |  4 ++--
 configs/am335x_sl50_defconfig                      |  4 ++--
 configs/am3517_evm_defconfig                       |  4 ++--
 configs/am43xx_evm_defconfig                       |  4 ++--
 configs/am43xx_evm_rtconly_defconfig               |  4 ++--
 configs/am43xx_evm_usbhost_boot_defconfig          |  4 ++--
 configs/am43xx_hs_evm_defconfig                    |  4 ++--
 configs/am57xx_evm_defconfig                       |  4 ++--
 configs/am57xx_hs_evm_defconfig                    |  4 ++--
 configs/am57xx_hs_evm_usb_defconfig                |  4 ++--
 configs/am62ax_evm_r5_defconfig                    |  6 +++---
 configs/am62x_evm_r5_defconfig                     |  8 ++++----
 configs/am64x_evm_a53_defconfig                    |  4 ++--
 configs/am64x_evm_r5_defconfig                     |  8 ++++----
 configs/am65x_evm_a53_defconfig                    |  4 ++--
 configs/am65x_evm_r5_defconfig                     |  8 ++++----
 configs/am65x_evm_r5_usbdfu_defconfig              |  8 ++++----
 configs/am65x_evm_r5_usbmsc_defconfig              |  8 ++++----
 configs/am65x_hs_evm_a53_defconfig                 |  4 ++--
 configs/am65x_hs_evm_r5_defconfig                  |  8 ++++----
 configs/apalis-tk1_defconfig                       |  8 ++++----
 configs/apalis_imx6_defconfig                      |  2 +-
 configs/apalis_t30_defconfig                       |  8 ++++----
 configs/axm_defconfig                              |  8 ++++----
 configs/beaver_defconfig                           |  8 ++++----
 configs/bitmain_antminer_s9_defconfig              |  4 ++--
 configs/brppt1_mmc_defconfig                       |  4 ++--
 configs/brppt2_defconfig                           |  2 +-
 configs/brsmarc1_defconfig                         |  4 ++--
 configs/brxre1_defconfig                           |  4 ++--
 configs/cardhu_defconfig                           |  8 ++++----
 configs/cei-tk1-som_defconfig                      |  8 ++++----
 configs/cgtqmx8_defconfig                          |  8 ++++----
 configs/chiliboard_defconfig                       |  4 ++--
 configs/cl-som-imx7_defconfig                      |  2 +-
 configs/cm_fx6_defconfig                           |  2 +-
 configs/cm_t43_defconfig                           |  4 ++--
 configs/colibri_imx6_defconfig                     |  2 +-
 configs/colibri_t20_defconfig                      |  8 ++++----
 configs/colibri_t30_defconfig                      |  8 ++++----
 configs/da850evm_defconfig                         |  8 ++++----
 configs/da850evm_nand_defconfig                    |  8 ++++----
 configs/dalmore_defconfig                          |  8 ++++----
 configs/deneb_defconfig                            |  8 ++++----
 configs/devkit8000_defconfig                       |  6 +++---
 configs/dh_imx6_defconfig                          |  2 +-
 configs/display5_defconfig                         |  2 +-
 configs/display5_factory_defconfig                 |  2 +-
 configs/dra7xx_evm_defconfig                       |  4 ++--
 configs/dra7xx_hs_evm_defconfig                    |  4 ++--
 configs/dra7xx_hs_evm_usb_defconfig                |  4 ++--
 configs/draco_defconfig                            |  6 +++---
 configs/endeavoru_defconfig                        |  8 ++++----
 configs/etamin_defconfig                           |  6 +++---
 configs/gardena-smart-gateway-at91sam_defconfig    |  4 ++--
 configs/ge_b1x5v2_defconfig                        |  2 +-
 configs/giedi_defconfig                            |  8 ++++----
 configs/grouper_common_defconfig                   |  8 ++++----
 configs/gwventana_emmc_defconfig                   |  2 +-
 configs/gwventana_nand_defconfig                   |  2 +-
 configs/harmony_defconfig                          |  8 ++++----
 configs/igep00x0_defconfig                         |  4 ++--
 configs/imx6dl_icore_nand_defconfig                |  2 +-
 configs/imx6dl_mamoj_defconfig                     |  2 +-
 configs/imx6q_bosch_acc_defconfig                  |  2 +-
 configs/imx6q_icore_nand_defconfig                 |  2 +-
 configs/imx6q_logic_defconfig                      |  2 +-
 configs/imx6qdl_icore_mipi_defconfig               |  2 +-
 configs/imx6qdl_icore_mmc_defconfig                |  2 +-
 configs/imx6qdl_icore_nand_defconfig               |  2 +-
 configs/imx6qdl_icore_rqs_defconfig                |  2 +-
 configs/imx6ul_geam_mmc_defconfig                  |  2 +-
 configs/imx6ul_geam_nand_defconfig                 |  2 +-
 configs/imx6ul_isiot_emmc_defconfig                |  2 +-
 configs/imx6ul_isiot_nand_defconfig                |  2 +-
 configs/imx6ulz_smm_m2_defconfig                   |  2 +-
 configs/imx7_cm_defconfig                          |  2 +-
 configs/imx8mm-cl-iot-gate-optee_defconfig         |  8 ++++----
 configs/imx8mm-cl-iot-gate_defconfig               |  8 ++++----
 configs/imx8mm-icore-mx8mm-ctouch2_defconfig       |  8 ++++----
 configs/imx8mm-icore-mx8mm-edimm2.2_defconfig      |  8 ++++----
 configs/imx8mm-mx8menlo_defconfig                  |  8 ++++----
 configs/imx8mm_beacon_defconfig                    |  8 ++++----
 configs/imx8mm_beacon_fspi_defconfig               |  8 ++++----
 configs/imx8mm_data_modul_edm_sbc_defconfig        |  8 ++++----
 configs/imx8mm_evk_defconfig                       |  8 ++++----
 configs/imx8mm_evk_fspi_defconfig                  |  8 ++++----
 configs/imx8mm_phg_defconfig                       |  8 ++++----
 configs/imx8mm_venice_defconfig                    |  6 +++---
 configs/imx8mn_beacon_2g_defconfig                 |  8 ++++----
 configs/imx8mn_beacon_defconfig                    |  8 ++++----
 configs/imx8mn_beacon_fspi_defconfig               |  8 ++++----
 configs/imx8mn_bsh_smm_s2_defconfig                |  8 ++++----
 configs/imx8mn_bsh_smm_s2pro_defconfig             |  8 ++++----
 configs/imx8mn_ddr4_evk_defconfig                  |  8 ++++----
 configs/imx8mn_evk_defconfig                       |  8 ++++----
 configs/imx8mn_var_som_defconfig                   |  8 ++++----
 configs/imx8mn_venice_defconfig                    |  8 ++++----
 configs/imx8mp-icore-mx8mp-edimm2.2_defconfig      |  8 ++++----
 configs/imx8mp_beacon_defconfig                    |  8 ++++----
 configs/imx8mp_data_modul_edm_sbc_defconfig        |  8 ++++----
 configs/imx8mp_dhcom_pdk2_defconfig                |  8 ++++----
 configs/imx8mp_dhcom_pdk3_defconfig                |  8 ++++----
 configs/imx8mp_evk_defconfig                       |  8 ++++----
 configs/imx8mp_rsb3720a1_4G_defconfig              |  8 ++++----
 configs/imx8mp_rsb3720a1_6G_defconfig              |  8 ++++----
 configs/imx8mp_venice_defconfig                    |  8 ++++----
 configs/imx8mq_cm_defconfig                        |  8 ++++----
 configs/imx8mq_evk_defconfig                       |  8 ++++----
 configs/imx8mq_phanbell_defconfig                  |  8 ++++----
 configs/imx8mq_reform2_defconfig                   |  8 ++++----
 configs/imx8qm_mek_defconfig                       |  8 ++++----
 configs/imx8qxp_mek_defconfig                      |  8 ++++----
 configs/imx8ulp_evk_defconfig                      |  8 ++++----
 configs/imx93_11x11_evk_defconfig                  |  8 ++++----
 configs/imx93_11x11_evk_ld_defconfig               |  8 ++++----
 configs/iot2050_defconfig                          |  4 ++--
 configs/j7200_evm_a72_defconfig                    |  4 ++--
 configs/j7200_evm_r5_defconfig                     |  8 ++++----
 configs/j721e_evm_a72_defconfig                    |  4 ++--
 configs/j721e_evm_r5_defconfig                     |  8 ++++----
 configs/j721s2_evm_a72_defconfig                   |  4 ++--
 configs/j721s2_evm_r5_defconfig                    |  8 ++++----
 configs/jetson-tk1_defconfig                       |  8 ++++----
 configs/k2e_evm_defconfig                          |  4 ++--
 configs/k2g_evm_defconfig                          |  4 ++--
 configs/k2hk_evm_defconfig                         |  4 ++--
 configs/k2l_evm_defconfig                          |  4 ++--
 configs/kontron-sl-mx6ul_defconfig                 |  2 +-
 configs/kontron-sl-mx8mm_defconfig                 |  8 ++++----
 configs/kontron_pitx_imx8m_defconfig               |  8 ++++----
 configs/kontron_sl28_defconfig                     |  2 +-
 configs/kp_imx6q_tpc_defconfig                     |  2 +-
 configs/librem5_defconfig                          |  8 ++++----
 configs/liteboard_defconfig                        |  2 +-
 configs/ls1021aiot_sdcard_defconfig                |  6 +++---
 configs/ls1021aqds_nand_defconfig                  |  6 +++---
 configs/ls1021aqds_sdcard_ifc_defconfig            |  6 +++---
 configs/ls1021aqds_sdcard_qspi_defconfig           |  6 +++---
 configs/ls1021atsn_sdcard_defconfig                |  6 +++---
 .../ls1021atwr_sdcard_ifc_SECURE_BOOT_defconfig    |  6 +++---
 configs/ls1021atwr_sdcard_ifc_defconfig            |  6 +++---
 configs/ls1021atwr_sdcard_qspi_defconfig           |  6 +++---
 configs/ls1043aqds_nand_defconfig                  |  6 +++---
 configs/ls1043aqds_sdcard_ifc_defconfig            |  2 +-
 configs/ls1043aqds_sdcard_qspi_defconfig           |  2 +-
 configs/ls1043ardb_nand_SECURE_BOOT_defconfig      |  6 +++---
 configs/ls1043ardb_nand_defconfig                  |  6 +++---
 configs/ls1043ardb_sdcard_SECURE_BOOT_defconfig    |  2 +-
 configs/ls1043ardb_sdcard_defconfig                |  2 +-
 configs/ls1046aqds_nand_defconfig                  |  2 +-
 configs/ls1046aqds_sdcard_ifc_defconfig            |  2 +-
 configs/ls1046aqds_sdcard_qspi_defconfig           |  2 +-
 configs/ls1046ardb_emmc_defconfig                  |  2 +-
 configs/ls1046ardb_qspi_spl_defconfig              |  2 +-
 configs/ls1046ardb_sdcard_SECURE_BOOT_defconfig    |  2 +-
 configs/ls1046ardb_sdcard_defconfig                |  2 +-
 configs/ls1088aqds_sdcard_ifc_defconfig            |  2 +-
 configs/ls1088aqds_sdcard_qspi_defconfig           |  2 +-
 .../ls1088ardb_sdcard_qspi_SECURE_BOOT_defconfig   |  2 +-
 configs/ls1088ardb_sdcard_qspi_defconfig           |  2 +-
 configs/ls2080aqds_nand_defconfig                  |  2 +-
 configs/ls2080aqds_sdcard_defconfig                |  2 +-
 configs/ls2080ardb_nand_defconfig                  |  2 +-
 configs/mccmon6_nor_defconfig                      |  2 +-
 configs/mccmon6_sd_defconfig                       |  2 +-
 configs/medcom-wide_defconfig                      |  8 ++++----
 configs/msc_sm2s_imx8mp_defconfig                  |  8 ++++----
 configs/mx6cuboxi_defconfig                        |  2 +-
 configs/mx6memcal_defconfig                        |  2 +-
 configs/mx6sabreauto_defconfig                     |  2 +-
 configs/mx6sabresd_defconfig                       |  2 +-
 configs/mx6slevk_spl_defconfig                     |  2 +-
 configs/mx6ul_14x14_evk_defconfig                  |  2 +-
 configs/mx6ul_9x9_evk_defconfig                    |  2 +-
 configs/myir_mys_6ulx_defconfig                    |  2 +-
 configs/novena_defconfig                           |  2 +-
 configs/nyan-big_defconfig                         |  8 ++++----
 configs/omap35_logic_defconfig                     |  4 ++--
 configs/omap35_logic_somlv_defconfig               |  4 ++--
 configs/omap3_beagle_defconfig                     |  4 ++--
 configs/omap3_evm_defconfig                        |  4 ++--
 configs/omap3_logic_defconfig                      |  4 ++--
 configs/omap3_logic_somlv_defconfig                |  4 ++--
 configs/omap4_panda_defconfig                      |  4 ++--
 configs/omap4_sdp4430_defconfig                    |  4 ++--
 configs/omapl138_lcdk_defconfig                    |  8 ++++----
 configs/openpiton_riscv64_spl_defconfig            |  2 +-
 configs/opos6uldev_defconfig                       |  2 +-
 configs/paz00_defconfig                            |  8 ++++----
 configs/pcm058_defconfig                           |  2 +-
 configs/phycore-am335x-r2-regor_defconfig          |  4 ++--
 configs/phycore-am335x-r2-wega_defconfig           |  4 ++--
 configs/phycore-imx8mm_defconfig                   |  8 ++++----
 configs/phycore-imx8mp_defconfig                   |  8 ++++----
 configs/phycore_pcl063_defconfig                   |  2 +-
 configs/phycore_pcl063_ull_defconfig               |  2 +-
 configs/pico-dwarf-imx6ul_defconfig                |  2 +-
 configs/pico-dwarf-imx7d_defconfig                 |  2 +-
 configs/pico-hobbit-imx6ul_defconfig               |  2 +-
 configs/pico-hobbit-imx7d_defconfig                |  2 +-
 configs/pico-imx6_defconfig                        |  2 +-
 configs/pico-imx6ul_defconfig                      |  2 +-
 configs/pico-imx7d_bl33_defconfig                  |  2 +-
 configs/pico-imx7d_defconfig                       |  2 +-
 configs/pico-imx8mq_defconfig                      |  8 ++++----
 configs/pico-nymph-imx7d_defconfig                 |  2 +-
 configs/pico-pi-imx6ul_defconfig                   |  2 +-
 configs/pico-pi-imx7d_defconfig                    |  2 +-
 configs/plutux_defconfig                           |  8 ++++----
 configs/pxm2_defconfig                             |  6 +++---
 configs/qemu-riscv32_spl_defconfig                 |  2 +-
 configs/qemu-riscv64_spl_defconfig                 |  2 +-
 configs/rastaban_defconfig                         |  6 +++---
 configs/ringneck-px30_defconfig                    |  2 +-
 configs/riotboard_defconfig                        |  2 +-
 configs/rut_defconfig                              |  6 +++---
 configs/sama5d27_giantboard_defconfig              |  4 ++--
 configs/sama5d27_som1_ek_mmc1_defconfig            |  4 ++--
 configs/sama5d27_som1_ek_mmc_defconfig             |  4 ++--
 configs/sama5d27_som1_ek_qspiflash_defconfig       |  4 ++--
 configs/sama5d27_wlsom1_ek_mmc_defconfig           |  4 ++--
 configs/sama5d27_wlsom1_ek_qspiflash_defconfig     |  4 ++--
 configs/sama5d2_icp_mmc_defconfig                  |  4 ++--
 configs/sama5d2_xplained_emmc_defconfig            |  4 ++--
 configs/sama5d2_xplained_mmc_defconfig             |  4 ++--
 configs/sama5d2_xplained_qspiflash_defconfig       |  4 ++--
 configs/sama5d2_xplained_spiflash_defconfig        |  4 ++--
 configs/sama5d3_xplained_mmc_defconfig             |  4 ++--
 configs/sama5d3_xplained_nandflash_defconfig       |  4 ++--
 configs/sama5d3xek_mmc_defconfig                   |  4 ++--
 configs/sama5d3xek_nandflash_defconfig             |  4 ++--
 configs/sama5d3xek_spiflash_defconfig              |  4 ++--
 configs/sama5d4_xplained_mmc_defconfig             |  4 ++--
 configs/sama5d4_xplained_nandflash_defconfig       |  4 ++--
 configs/sama5d4_xplained_spiflash_defconfig        |  4 ++--
 configs/sama5d4ek_mmc_defconfig                    |  4 ++--
 configs/sama5d4ek_nandflash_defconfig              |  4 ++--
 configs/sama5d4ek_spiflash_defconfig               |  4 ++--
 configs/seaboard_defconfig                         |  8 ++++----
 configs/seeed_npi_imx6ull_defconfig                |  2 +-
 configs/sifive_unleashed_defconfig                 |  2 +-
 configs/sifive_unmatched_defconfig                 |  2 +-
 configs/smartweb_defconfig                         |  4 ++--
 configs/sniper_defconfig                           |  6 +++---
 configs/socfpga_agilex_atf_defconfig               |  8 ++++----
 configs/socfpga_agilex_defconfig                   |  8 ++++----
 configs/socfpga_agilex_vab_defconfig               |  8 ++++----
 configs/socfpga_arria10_defconfig                  |  8 ++++----
 configs/socfpga_chameleonv3_defconfig              |  8 ++++----
 configs/socfpga_n5x_atf_defconfig                  |  8 ++++----
 configs/socfpga_n5x_defconfig                      |  8 ++++----
 configs/socfpga_n5x_vab_defconfig                  |  8 ++++----
 configs/socfpga_stratix10_atf_defconfig            |  8 ++++----
 configs/socfpga_stratix10_defconfig                |  8 ++++----
 configs/starfive_visionfive2_defconfig             |  8 ++++----
 configs/stm32mp15-icore-stm32mp1-ctouch2_defconfig |  8 ++++----
 .../stm32mp15-icore-stm32mp1-edimm2.2_defconfig    |  8 ++++----
 ...2mp15-microgea-stm32mp1-microdev2-of7_defconfig |  8 ++++----
 ...stm32mp15-microgea-stm32mp1-microdev2_defconfig |  8 ++++----
 configs/stm32mp15_basic_defconfig                  |  8 ++++----
 configs/stm32mp15_dhcom_basic_defconfig            |  8 ++++----
 configs/stm32mp15_dhcor_basic_defconfig            |  8 ++++----
 configs/syzygy_hub_defconfig                       |  4 ++--
 configs/taurus_defconfig                           |  8 ++++----
 configs/tec-ng_defconfig                           |  8 ++++----
 configs/tec_defconfig                              |  8 ++++----
 configs/thuban_defconfig                           |  6 +++---
 configs/topic_miami_defconfig                      |  4 ++--
 configs/topic_miamilite_defconfig                  |  4 ++--
 configs/topic_miamiplus_defconfig                  |  4 ++--
 configs/transformer_t30_defconfig                  |  8 ++++----
 configs/trimslice_defconfig                        |  8 ++++----
 configs/udoo_defconfig                             |  2 +-
 configs/udoo_neo_defconfig                         |  2 +-
 configs/variscite_dart6ul_defconfig                |  2 +-
 configs/venice2_defconfig                          |  8 ++++----
 configs/ventana_defconfig                          |  8 ++++----
 configs/verdin-am62_r5_defconfig                   |  8 ++++----
 configs/verdin-imx8mm_defconfig                    |  8 ++++----
 configs/verdin-imx8mp_defconfig                    |  8 ++++----
 configs/vining_2000_defconfig                      |  2 +-
 configs/wandboard_defconfig                        |  2 +-
 configs/x3_t30_defconfig                           |  8 ++++----
 configs/xilinx_zynq_virt_defconfig                 |  4 ++--
 configs/xilinx_zynqmp_mini_emmc0_defconfig         |  8 ++++----
 configs/xilinx_zynqmp_mini_emmc1_defconfig         |  8 ++++----
 configs/xilinx_zynqmp_mini_qspi_defconfig          |  8 ++++----
 configs/xilinx_zynqmp_virt_defconfig               |  8 ++++----
 configs/zynq_cse_nand_defconfig                    |  8 ++++----
 configs/zynq_cse_nor_defconfig                     |  8 ++++----
 configs/zynq_cse_qspi_defconfig                    |  8 ++++----
 drivers/core/Kconfig                               |  6 +++---
 drivers/serial/Kconfig                             |  2 +-
 include/configs/socfpga_common.h                   |  2 +-
 include/configs/socfpga_soc64_common.h             |  2 +-
 include/system-constants.h                         |  6 +++---
 316 files changed, 794 insertions(+), 794 deletions(-)

diff --git a/Kconfig b/Kconfig
index 91170bf8d22..1460f8aa849 100644
--- a/Kconfig
+++ b/Kconfig
@@ -308,7 +308,7 @@ config SPL_SYS_MALLOC_F_LEN
 	  particular needs this to operate, so that it can allocate the
 	  initial serial device and any others that are needed.
 
-	  It is possible to enable CFG_SYS_SPL_MALLOC_START to start a new
+	  It is possible to enable CFG_SPL_SYS_MALLOC_START to start a new
 	  malloc() region in SDRAM once it is inited.
 
 config TPL_SYS_MALLOC_F_LEN
diff --git a/README b/README
index 15a19caf740..a1f90642274 100644
--- a/README
+++ b/README
@@ -1297,7 +1297,7 @@ Configuration Settings:
 - CONFIG_SYS_MALLOC_SIMPLE
 		Provides a simple and small malloc() and calloc() for those
 		boards which do not use the full malloc in SPL (which is
-		enabled with CONFIG_SYS_SPL_MALLOC).
+		enabled with CONFIG_SPL_SYS_MALLOC).
 
 - CFG_SYS_BOOTMAPSZ:
 		Maximum size of memory mapped by the startup code of
diff --git a/arch/arm/cpu/armv7/ls102xa/fdt.c b/arch/arm/cpu/armv7/ls102xa/fdt.c
index a5c5c780ae8..1c3d24bcad9 100644
--- a/arch/arm/cpu/armv7/ls102xa/fdt.c
+++ b/arch/arm/cpu/armv7/ls102xa/fdt.c
@@ -136,7 +136,7 @@ void ft_cpu_setup(void *blob, struct bd_info *bd)
 	 */
 	off = fdt_add_mem_rsv(blob, CONFIG_TEXT_BASE - UBOOT_HEAD_LEN,
 			      CONFIG_SYS_MONITOR_LEN +
-			      CONFIG_SYS_SPL_MALLOC_SIZE + UBOOT_HEAD_LEN);
+			      CONFIG_SPL_SYS_MALLOC_SIZE + UBOOT_HEAD_LEN);
 	if (off < 0)
 		printf("Failed to reserve memory for SD boot deep sleep: %s\n",
 		       fdt_strerror(off));
diff --git a/common/spl/Kconfig b/common/spl/Kconfig
index 1c2fe78e3e0..b9d96fbe135 100644
--- a/common/spl/Kconfig
+++ b/common/spl/Kconfig
@@ -402,21 +402,21 @@ config SPL_SEPARATE_BSS
 	  location is used. Normally we put the device tree at the end of BSS
 	  but with this option enabled, it goes at _image_binary_end.
 
-config SYS_SPL_MALLOC
+config SPL_SYS_MALLOC
 	bool "Enable malloc pool in SPL"
 	depends on SPL_FRAMEWORK
 
-config HAS_CUSTOM_SPL_MALLOC_START
+config SPL_HAS_CUSTOM_MALLOC_START
 	bool "For the SPL malloc pool, define a custom starting address"
-	depends on SYS_SPL_MALLOC
+	depends on SPL_SYS_MALLOC
 
-config CUSTOM_SYS_SPL_MALLOC_ADDR
+config SPL_CUSTOM_SYS_MALLOC_ADDR
 	hex "SPL malloc addr"
-	depends on HAS_CUSTOM_SPL_MALLOC_START
+	depends on SPL_HAS_CUSTOM_MALLOC_START
 
-config SYS_SPL_MALLOC_SIZE
+config SPL_SYS_MALLOC_SIZE
 	hex "Size of the SPL malloc pool"
-	depends on SYS_SPL_MALLOC
+	depends on SPL_SYS_MALLOC
 	default 0x100000
 
 config SPL_READ_ONLY
diff --git a/common/spl/Kconfig.nxp b/common/spl/Kconfig.nxp
index fc696cf0cee..53e9b9f8d34 100644
--- a/common/spl/Kconfig.nxp
+++ b/common/spl/Kconfig.nxp
@@ -59,7 +59,7 @@ config SPL_RELOC_TEXT_BASE
 config SPL_RELOC_STACK
 	hex "Address of the start of the stack SPL will use after relocation."
 	help
-	  If unspecified, this is equal to CFG_SYS_SPL_MALLOC_START.  Starting
+	  If unspecified, this is equal to CFG_SPL_SYS_MALLOC_START.  Starting
 	  address of the malloc pool used in SPL.  When this option is set the full
 	  malloc is used in SPL and it is set up by spl_init() and before that, the
 	  simple malloc() can be used if CONFIG_SYS_MALLOC_F is defined.
diff --git a/common/spl/spl.c b/common/spl/spl.c
index 0062f3f45d9..1e50043cf77 100644
--- a/common/spl/spl.c
+++ b/common/spl/spl.c
@@ -754,8 +754,8 @@ void board_init_r(gd_t *dummy1, ulong dummy2)
 
 	spl_set_bd();
 
-#if defined(CONFIG_SYS_SPL_MALLOC)
-	mem_malloc_init(SYS_SPL_MALLOC_START, CONFIG_SYS_SPL_MALLOC_SIZE);
+#if defined(CONFIG_SPL_SYS_MALLOC)
+	mem_malloc_init(SPL_SYS_MALLOC_START, CONFIG_SPL_SYS_MALLOC_SIZE);
 	gd->flags |= GD_FLG_FULL_MALLOC_INIT;
 #endif
 	if (!(gd->flags & GD_FLG_SPL_INIT)) {
@@ -886,7 +886,7 @@ void board_init_r(gd_t *dummy1, ulong dummy2)
 	default:
 		debug("Unsupported OS image.. Jumping nevertheless..\n");
 	}
-#if CONFIG_VAL(SYS_MALLOC_F_LEN) && !defined(CONFIG_SYS_SPL_MALLOC_SIZE)
+#if CONFIG_VAL(SYS_MALLOC_F_LEN) && !defined(CONFIG_SPL_SYS_MALLOC_SIZE)
 	debug("SPL malloc() used 0x%lx bytes (%ld KB)\n", gd->malloc_ptr,
 	      gd->malloc_ptr / 1024);
 #endif
diff --git a/common/spl/spl_fit.c b/common/spl/spl_fit.c
index 730639f7562..1bfdc0af496 100644
--- a/common/spl/spl_fit.c
+++ b/common/spl/spl_fit.c
@@ -530,7 +530,7 @@ static void *spl_get_fit_load_buffer(size_t size)
 	buf = malloc_cache_aligned(size);
 	if (!buf) {
 		pr_err("Could not get FIT buffer of %lu bytes\n", (ulong)size);
-		pr_err("\tcheck CONFIG_SYS_SPL_MALLOC_SIZE\n");
+		pr_err("\tcheck CONFIG_SPL_SYS_MALLOC_SIZE\n");
 		buf = spl_get_load_buffer(0, size);
 	}
 	return buf;
diff --git a/configs/am335x_baltos_defconfig b/configs/am335x_baltos_defconfig
index 6ef3c78390a..c4b8e6785eb 100644
--- a/configs/am335x_baltos_defconfig
+++ b/configs/am335x_baltos_defconfig
@@ -18,8 +18,8 @@ CONFIG_OF_BOARD_SETUP=y
 CONFIG_DISTRO_DEFAULTS=y
 CONFIG_BOOTCOMMAND="run findfdt; run usbboot;run mmcboot;setenv mmcdev 1; setenv bootpart 1:2; run mmcboot;run nandboot;"
 CONFIG_SYS_CONSOLE_INFO_QUIET=y
-CONFIG_SYS_SPL_MALLOC=y
-CONFIG_SYS_SPL_MALLOC_SIZE=0x800000
+CONFIG_SPL_SYS_MALLOC=y
+CONFIG_SPL_SYS_MALLOC_SIZE=0x800000
 CONFIG_SPL_FS_EXT4=y
 CONFIG_SPL_I2C=y
 CONFIG_SPL_MTD_SUPPORT=y
diff --git a/configs/am335x_boneblack_vboot_defconfig b/configs/am335x_boneblack_vboot_defconfig
index e581accc217..531703010ab 100644
--- a/configs/am335x_boneblack_vboot_defconfig
+++ b/configs/am335x_boneblack_vboot_defconfig
@@ -23,8 +23,8 @@ CONFIG_AUTOBOOT_STOP_STR=" "
 CONFIG_BOOTCOMMAND="run findfdt; run init_console; run finduuid; run distro_bootcmd"
 CONFIG_SYS_CONSOLE_INFO_QUIET=y
 CONFIG_ARCH_MISC_INIT=y
-CONFIG_SYS_SPL_MALLOC=y
-CONFIG_SYS_SPL_MALLOC_SIZE=0x800000
+CONFIG_SPL_SYS_MALLOC=y
+CONFIG_SPL_SYS_MALLOC_SIZE=0x800000
 CONFIG_SPL_MUSB_NEW=y
 # CONFIG_SPL_NAND_SUPPORT is not set
 CONFIG_SPL_NET=y
diff --git a/configs/am335x_evm_defconfig b/configs/am335x_evm_defconfig
index a179f1ed5f2..08e3f22b1fe 100644
--- a/configs/am335x_evm_defconfig
+++ b/configs/am335x_evm_defconfig
@@ -20,8 +20,8 @@ CONFIG_BOOTCOMMAND="run findfdt; run init_console; run finduuid; run distro_boot
 CONFIG_LOGLEVEL=3
 CONFIG_SYS_CONSOLE_INFO_QUIET=y
 CONFIG_ARCH_MISC_INIT=y
-CONFIG_SYS_SPL_MALLOC=y
-CONFIG_SYS_SPL_MALLOC_SIZE=0x800000
+CONFIG_SPL_SYS_MALLOC=y
+CONFIG_SPL_SYS_MALLOC_SIZE=0x800000
 CONFIG_SPL_FIT_IMAGE_TINY=y
 CONFIG_SPL_ETH=y
 # CONFIG_SPL_FS_EXT4 is not set
diff --git a/configs/am335x_evm_spiboot_defconfig b/configs/am335x_evm_spiboot_defconfig
index 09d5e803a3e..e72a936983b 100644
--- a/configs/am335x_evm_spiboot_defconfig
+++ b/configs/am335x_evm_spiboot_defconfig
@@ -23,8 +23,8 @@ CONFIG_BOOTCOMMAND="run findfdt; run init_console; run finduuid; run distro_boot
 CONFIG_LOGLEVEL=3
 CONFIG_SYS_CONSOLE_INFO_QUIET=y
 CONFIG_ARCH_MISC_INIT=y
-CONFIG_SYS_SPL_MALLOC=y
-CONFIG_SYS_SPL_MALLOC_SIZE=0x800000
+CONFIG_SPL_SYS_MALLOC=y
+CONFIG_SPL_SYS_MALLOC_SIZE=0x800000
 CONFIG_SPL_FIT_IMAGE_TINY=y
 # CONFIG_SPL_FS_EXT4 is not set
 CONFIG_SPL_FS_LOAD_PAYLOAD_NAME="u-boot.img"
diff --git a/configs/am335x_guardian_defconfig b/configs/am335x_guardian_defconfig
index 7c4085d0849..01d848ceede 100644
--- a/configs/am335x_guardian_defconfig
+++ b/configs/am335x_guardian_defconfig
@@ -31,8 +31,8 @@ CONFIG_AUTOBOOT_STOP_STR=" "
 CONFIG_SYS_CONSOLE_INFO_QUIET=y
 CONFIG_ARCH_MISC_INIT=y
 # CONFIG_SPL_RAW_IMAGE_SUPPORT is not set
-CONFIG_SYS_SPL_MALLOC=y
-CONFIG_SYS_SPL_MALLOC_SIZE=0x800000
+CONFIG_SPL_SYS_MALLOC=y
+CONFIG_SPL_SYS_MALLOC_SIZE=0x800000
 # CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR is not set
 CONFIG_SPL_ENV_SUPPORT=y
 CONFIG_SPL_ETH=y
diff --git a/configs/am335x_hs_evm_defconfig b/configs/am335x_hs_evm_defconfig
index a3a4ab361c3..4f5e2088c56 100644
--- a/configs/am335x_hs_evm_defconfig
+++ b/configs/am335x_hs_evm_defconfig
@@ -21,8 +21,8 @@ CONFIG_LOGLEVEL=3
 CONFIG_SYS_CONSOLE_INFO_QUIET=y
 CONFIG_ARCH_MISC_INIT=y
 CONFIG_SPL_MAX_SIZE=0xb0b0
-CONFIG_SYS_SPL_MALLOC=y
-CONFIG_SYS_SPL_MALLOC_SIZE=0x800000
+CONFIG_SPL_SYS_MALLOC=y
+CONFIG_SPL_SYS_MALLOC_SIZE=0x800000
 CONFIG_SPL_FIT_IMAGE_TINY=y
 # CONFIG_SPL_ENV_SUPPORT is not set
 # CONFIG_SPL_FS_EXT4 is not set
diff --git a/configs/am335x_hs_evm_uart_defconfig b/configs/am335x_hs_evm_uart_defconfig
index 6e4d327880c..dc7fc4b0aa4 100644
--- a/configs/am335x_hs_evm_uart_defconfig
+++ b/configs/am335x_hs_evm_uart_defconfig
@@ -24,8 +24,8 @@ CONFIG_LOGLEVEL=3
 CONFIG_SYS_CONSOLE_INFO_QUIET=y
 CONFIG_ARCH_MISC_INIT=y
 CONFIG_SPL_MAX_SIZE=0x9ab0
-CONFIG_SYS_SPL_MALLOC=y
-CONFIG_SYS_SPL_MALLOC_SIZE=0x800000
+CONFIG_SPL_SYS_MALLOC=y
+CONFIG_SPL_SYS_MALLOC_SIZE=0x800000
 CONFIG_SPL_FIT_IMAGE_TINY=y
 # CONFIG_SPL_ENV_SUPPORT is not set
 # CONFIG_SPL_FS_EXT4 is not set
diff --git a/configs/am335x_igep003x_defconfig b/configs/am335x_igep003x_defconfig
index 37e1259a8b1..04ddba706ba 100644
--- a/configs/am335x_igep003x_defconfig
+++ b/configs/am335x_igep003x_defconfig
@@ -19,8 +19,8 @@ CONFIG_OF_BOARD_SETUP=y
 CONFIG_DISTRO_DEFAULTS=y
 CONFIG_BOOTCOMMAND="run findfdt;run mmcboot;run nandboot;run netboot;"
 CONFIG_SYS_CONSOLE_INFO_QUIET=y
-CONFIG_SYS_SPL_MALLOC=y
-CONFIG_SYS_SPL_MALLOC_SIZE=0x800000
+CONFIG_SPL_SYS_MALLOC=y
+CONFIG_SPL_SYS_MALLOC_SIZE=0x800000
 CONFIG_SPL_FS_EXT4=y
 CONFIG_SPL_I2C=y
 CONFIG_SPL_MTD_SUPPORT=y
diff --git a/configs/am335x_pdu001_defconfig b/configs/am335x_pdu001_defconfig
index e68efde33b6..557949c651e 100644
--- a/configs/am335x_pdu001_defconfig
+++ b/configs/am335x_pdu001_defconfig
@@ -24,8 +24,8 @@ CONFIG_AUTOBOOT_PROMPT="Press SPACE to abort autoboot in %d seconds\n"
 CONFIG_AUTOBOOT_STOP_STR=" "
 CONFIG_BOOTCOMMAND="run eval_boot_device;part uuid mmc ${mmc_boot}:${root_fs_partition} root_fs_partuuid;setenv bootargs console=${console} vt.global_cursor_default=0 root=PARTUUID=${root_fs_partuuid} rootfstype=ext4 rootwait rootdelay=1;fatload mmc ${mmc_boot} ${fdtaddr} ${fdtfile};fatload mmc ${mmc_boot} ${loadaddr} ${bootfile};bootz ${loadaddr} - ${fdtaddr}"
 CONFIG_BOARD_LATE_INIT=y
-CONFIG_SYS_SPL_MALLOC=y
-CONFIG_SYS_SPL_MALLOC_SIZE=0x800000
+CONFIG_SPL_SYS_MALLOC=y
+CONFIG_SPL_SYS_MALLOC_SIZE=0x800000
 # CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR is not set
 CONFIG_SPL_I2C=y
 # CONFIG_SPL_NAND_SUPPORT is not set
diff --git a/configs/am335x_shc_defconfig b/configs/am335x_shc_defconfig
index 51b25fda643..c902354863b 100644
--- a/configs/am335x_shc_defconfig
+++ b/configs/am335x_shc_defconfig
@@ -33,8 +33,8 @@ CONFIG_BOOTCOMMAND="if mmc dev 1; mmc rescan; then run emmc_setup; else echo ERR
 CONFIG_DEFAULT_FDT_FILE="am335x-shc"
 CONFIG_SYS_CONSOLE_INFO_QUIET=y
 CONFIG_SPL_SYS_MALLOC_SIMPLE=y
-CONFIG_SYS_SPL_MALLOC=y
-CONFIG_SYS_SPL_MALLOC_SIZE=0x800000
+CONFIG_SPL_SYS_MALLOC=y
+CONFIG_SPL_SYS_MALLOC_SIZE=0x800000
 CONFIG_SPL_FS_EXT4=y
 CONFIG_SPL_I2C=y
 # CONFIG_SPL_NAND_SUPPORT is not set
diff --git a/configs/am335x_shc_ict_defconfig b/configs/am335x_shc_ict_defconfig
index 5766f71c1c8..1cbb57fb529 100644
--- a/configs/am335x_shc_ict_defconfig
+++ b/configs/am335x_shc_ict_defconfig
@@ -31,8 +31,8 @@ CONFIG_BOOTCOMMAND="if mmc dev 0; mmc rescan; then run sd_setup; else echo ERROR
 CONFIG_DEFAULT_FDT_FILE="am335x-shc"
 CONFIG_SYS_CONSOLE_INFO_QUIET=y
 CONFIG_SPL_SYS_MALLOC_SIMPLE=y
-CONFIG_SYS_SPL_MALLOC=y
-CONFIG_SYS_SPL_MALLOC_SIZE=0x800000
+CONFIG_SPL_SYS_MALLOC=y
+CONFIG_SPL_SYS_MALLOC_SIZE=0x800000
 CONFIG_SPL_FS_EXT4=y
 CONFIG_SPL_I2C=y
 # CONFIG_SPL_NAND_SUPPORT is not set
diff --git a/configs/am335x_shc_netboot_defconfig b/configs/am335x_shc_netboot_defconfig
index 5073efa01ab..7ac1ef81870 100644
--- a/configs/am335x_shc_netboot_defconfig
+++ b/configs/am335x_shc_netboot_defconfig
@@ -34,8 +34,8 @@ CONFIG_BOOTCOMMAND="run fusecmd; if run netboot; then echo Booting from network;
 CONFIG_DEFAULT_FDT_FILE="am335x-shc"
 CONFIG_SYS_CONSOLE_INFO_QUIET=y
 CONFIG_SPL_SYS_MALLOC_SIMPLE=y
-CONFIG_SYS_SPL_MALLOC=y
-CONFIG_SYS_SPL_MALLOC_SIZE=0x800000
+CONFIG_SPL_SYS_MALLOC=y
+CONFIG_SPL_SYS_MALLOC_SIZE=0x800000
 CONFIG_SPL_ENV_SUPPORT=y
 CONFIG_SPL_FS_EXT4=y
 CONFIG_SPL_I2C=y
diff --git a/configs/am335x_shc_sdboot_defconfig b/configs/am335x_shc_sdboot_defconfig
index f35df6c23c6..127f095c02a 100644
--- a/configs/am335x_shc_sdboot_defconfig
+++ b/configs/am335x_shc_sdboot_defconfig
@@ -34,8 +34,8 @@ CONFIG_BOOTCOMMAND="if mmc dev 0; mmc rescan; then run sd_setup; else echo ERROR
 CONFIG_DEFAULT_FDT_FILE="am335x-shc"
 CONFIG_SYS_CONSOLE_INFO_QUIET=y
 CONFIG_SPL_SYS_MALLOC_SIMPLE=y
-CONFIG_SYS_SPL_MALLOC=y
-CONFIG_SYS_SPL_MALLOC_SIZE=0x800000
+CONFIG_SPL_SYS_MALLOC=y
+CONFIG_SPL_SYS_MALLOC_SIZE=0x800000
 CONFIG_SPL_FS_EXT4=y
 CONFIG_SPL_I2C=y
 # CONFIG_SPL_NAND_SUPPORT is not set
diff --git a/configs/am335x_sl50_defconfig b/configs/am335x_sl50_defconfig
index 44c23019e49..9ba376feda8 100644
--- a/configs/am335x_sl50_defconfig
+++ b/configs/am335x_sl50_defconfig
@@ -23,8 +23,8 @@ CONFIG_AUTOBOOT_PROMPT="Press SPACE to abort autoboot in %d seconds\n"
 CONFIG_AUTOBOOT_DELAY_STR="d"
 CONFIG_AUTOBOOT_STOP_STR=" "
 CONFIG_SYS_CONSOLE_INFO_QUIET=y
-CONFIG_SYS_SPL_MALLOC=y
-CONFIG_SYS_SPL_MALLOC_SIZE=0x800000
+CONFIG_SPL_SYS_MALLOC=y
+CONFIG_SPL_SYS_MALLOC_SIZE=0x800000
 CONFIG_SPL_ENV_SUPPORT=y
 CONFIG_SPL_FS_EXT4=y
 CONFIG_SPL_I2C=y
diff --git a/configs/am3517_evm_defconfig b/configs/am3517_evm_defconfig
index fcb0b3d32bc..dda23549278 100644
--- a/configs/am3517_evm_defconfig
+++ b/configs/am3517_evm_defconfig
@@ -22,8 +22,8 @@ CONFIG_BOOTDELAY=10
 CONFIG_BOOTCOMMAND="mmc dev ${mmcdev}; if mmc rescan; then echo SD/MMC found on device $mmcdev; if run loadbootenv; then run importbootenv; fi; echo Checking if uenvcmd is set ...; if test -n $uenvcmd; then echo Running uenvcmd ...; run uenvcmd; fi; echo Running default loadimage ...; setenv bootfile zImage; if run loadimage; then run loadfdt; run mmcboot; fi; else run nandboot; fi"
 CONFIG_SPL_MAX_SIZE=0xec00
 CONFIG_SPL_SYS_MALLOC_SIMPLE=y
-CONFIG_SYS_SPL_MALLOC=y
-CONFIG_SYS_SPL_MALLOC_SIZE=0x800000
+CONFIG_SPL_SYS_MALLOC=y
+CONFIG_SPL_SYS_MALLOC_SIZE=0x800000
 # CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR is not set
 # CONFIG_SPL_FS_EXT4 is not set
 # CONFIG_SPL_I2C is not set
diff --git a/configs/am43xx_evm_defconfig b/configs/am43xx_evm_defconfig
index 323862009fc..6571afd345e 100644
--- a/configs/am43xx_evm_defconfig
+++ b/configs/am43xx_evm_defconfig
@@ -18,8 +18,8 @@ CONFIG_BOOTCOMMAND="run findfdt; run finduuid; run distro_bootcmd"
 CONFIG_SYS_CONSOLE_INFO_QUIET=y
 # CONFIG_MISC_INIT_R is not set
 CONFIG_SPL_MAX_SIZE=0x439e0
-CONFIG_SYS_SPL_MALLOC=y
-CONFIG_SYS_SPL_MALLOC_SIZE=0x800000
+CONFIG_SPL_SYS_MALLOC=y
+CONFIG_SPL_SYS_MALLOC_SIZE=0x800000
 CONFIG_SPL_ETH=y
 CONFIG_SPL_FS_LOAD_PAYLOAD_NAME="u-boot.img"
 CONFIG_SPL_MTD_SUPPORT=y
diff --git a/configs/am43xx_evm_rtconly_defconfig b/configs/am43xx_evm_rtconly_defconfig
index 9cafe9c10c8..e84aed4d54d 100644
--- a/configs/am43xx_evm_rtconly_defconfig
+++ b/configs/am43xx_evm_rtconly_defconfig
@@ -18,8 +18,8 @@ CONFIG_BOOTCOMMAND="run findfdt; run finduuid; run distro_bootcmd"
 CONFIG_SYS_CONSOLE_INFO_QUIET=y
 # CONFIG_MISC_INIT_R is not set
 CONFIG_SPL_MAX_SIZE=0x439e0
-CONFIG_SYS_SPL_MALLOC=y
-CONFIG_SYS_SPL_MALLOC_SIZE=0x800000
+CONFIG_SPL_SYS_MALLOC=y
+CONFIG_SPL_SYS_MALLOC_SIZE=0x800000
 CONFIG_SPL_FS_LOAD_PAYLOAD_NAME="u-boot.img"
 CONFIG_SPL_MTD_SUPPORT=y
 CONFIG_SPL_NAND_DRIVERS=y
diff --git a/configs/am43xx_evm_usbhost_boot_defconfig b/configs/am43xx_evm_usbhost_boot_defconfig
index 406c0fc2d7c..0cae3242b04 100644
--- a/configs/am43xx_evm_usbhost_boot_defconfig
+++ b/configs/am43xx_evm_usbhost_boot_defconfig
@@ -17,8 +17,8 @@ CONFIG_BOOTCOMMAND="run findfdt; run finduuid; run distro_bootcmd"
 CONFIG_SYS_CONSOLE_INFO_QUIET=y
 # CONFIG_MISC_INIT_R is not set
 CONFIG_SPL_MAX_SIZE=0x37690
-CONFIG_SYS_SPL_MALLOC=y
-CONFIG_SYS_SPL_MALLOC_SIZE=0x800000
+CONFIG_SPL_SYS_MALLOC=y
+CONFIG_SPL_SYS_MALLOC_SIZE=0x800000
 CONFIG_SPL_FS_LOAD_PAYLOAD_NAME="u-boot.img"
 CONFIG_SPL_MTD_SUPPORT=y
 CONFIG_SPL_NAND_DRIVERS=y
diff --git a/configs/am43xx_hs_evm_defconfig b/configs/am43xx_hs_evm_defconfig
index 01428ac7aa7..115ce68d680 100644
--- a/configs/am43xx_hs_evm_defconfig
+++ b/configs/am43xx_hs_evm_defconfig
@@ -24,8 +24,8 @@ CONFIG_BOOTCOMMAND="run findfdt; run finduuid; run distro_bootcmd"
 CONFIG_SYS_CONSOLE_INFO_QUIET=y
 # CONFIG_MISC_INIT_R is not set
 CONFIG_SPL_MAX_SIZE=0x36100
-CONFIG_SYS_SPL_MALLOC=y
-CONFIG_SYS_SPL_MALLOC_SIZE=0x800000
+CONFIG_SPL_SYS_MALLOC=y
+CONFIG_SPL_SYS_MALLOC_SIZE=0x800000
 CONFIG_SPL_ETH=y
 CONFIG_SPL_FS_LOAD_PAYLOAD_NAME="u-boot.img"
 CONFIG_SPL_MTD_SUPPORT=y
diff --git a/configs/am57xx_evm_defconfig b/configs/am57xx_evm_defconfig
index 6db59225c28..b4c04acec79 100644
--- a/configs/am57xx_evm_defconfig
+++ b/configs/am57xx_evm_defconfig
@@ -30,8 +30,8 @@ CONFIG_AVB_VERIFY=y
 CONFIG_ANDROID_AB=y
 CONFIG_SPL_MAX_SIZE=0x7bc00
 CONFIG_SPL_SYS_MALLOC_SIMPLE=y
-CONFIG_SYS_SPL_MALLOC=y
-CONFIG_SYS_SPL_MALLOC_SIZE=0x800000
+CONFIG_SPL_SYS_MALLOC=y
+CONFIG_SPL_SYS_MALLOC_SIZE=0x800000
 CONFIG_SPL_DMA=y
 CONFIG_SPL_FS_LOAD_PAYLOAD_NAME="u-boot.img"
 # CONFIG_SPL_NAND_SUPPORT is not set
diff --git a/configs/am57xx_hs_evm_defconfig b/configs/am57xx_hs_evm_defconfig
index 94ffce1a998..d137cc3c57b 100644
--- a/configs/am57xx_hs_evm_defconfig
+++ b/configs/am57xx_hs_evm_defconfig
@@ -33,8 +33,8 @@ CONFIG_AVB_VERIFY=y
 CONFIG_ANDROID_AB=y
 CONFIG_SPL_MAX_SIZE=0x7a8b0
 CONFIG_SPL_SYS_MALLOC_SIMPLE=y
-CONFIG_SYS_SPL_MALLOC=y
-CONFIG_SYS_SPL_MALLOC_SIZE=0x800000
+CONFIG_SPL_SYS_MALLOC=y
+CONFIG_SPL_SYS_MALLOC_SIZE=0x800000
 CONFIG_SPL_DMA=y
 CONFIG_SPL_FS_LOAD_PAYLOAD_NAME="u-boot.img"
 # CONFIG_SPL_NAND_SUPPORT is not set
diff --git a/configs/am57xx_hs_evm_usb_defconfig b/configs/am57xx_hs_evm_usb_defconfig
index 404e714d4f0..b12f262ff57 100644
--- a/configs/am57xx_hs_evm_usb_defconfig
+++ b/configs/am57xx_hs_evm_usb_defconfig
@@ -35,8 +35,8 @@ CONFIG_AVB_VERIFY=y
 CONFIG_ANDROID_AB=y
 CONFIG_SPL_MAX_SIZE=0x74eb0
 CONFIG_SPL_SYS_MALLOC_SIMPLE=y
-CONFIG_SYS_SPL_MALLOC=y
-CONFIG_SYS_SPL_MALLOC_SIZE=0x800000
+CONFIG_SPL_SYS_MALLOC=y
+CONFIG_SPL_SYS_MALLOC_SIZE=0x800000
 CONFIG_SPL_DMA=y
 CONFIG_SPL_FS_LOAD_PAYLOAD_NAME="u-boot.img"
 # CONFIG_SPL_NAND_SUPPORT is not set
diff --git a/configs/am62ax_evm_r5_defconfig b/configs/am62ax_evm_r5_defconfig
index 05c30cbba19..2c53673debb 100644
--- a/configs/am62ax_evm_r5_defconfig
+++ b/configs/am62ax_evm_r5_defconfig
@@ -36,9 +36,9 @@ CONFIG_SPL_SYS_REPORT_STACK_F_USAGE=y
 CONFIG_SPL_SYS_MALLOC_SIMPLE=y
 CONFIG_SPL_STACK_R=y
 CONFIG_SPL_SEPARATE_BSS=y
-CONFIG_SYS_SPL_MALLOC=y
-CONFIG_HAS_CUSTOM_SPL_MALLOC_START=y
-CONFIG_CUSTOM_SYS_SPL_MALLOC_ADDR=0x84000000
+CONFIG_SPL_SYS_MALLOC=y
+CONFIG_SPL_HAS_CUSTOM_MALLOC_START=y
+CONFIG_SPL_CUSTOM_SYS_MALLOC_ADDR=0x84000000
 CONFIG_SPL_EARLY_BSS=y
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR=y
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0x400
diff --git a/configs/am62x_evm_r5_defconfig b/configs/am62x_evm_r5_defconfig
index 3c5f3672984..b85da381bed 100644
--- a/configs/am62x_evm_r5_defconfig
+++ b/configs/am62x_evm_r5_defconfig
@@ -43,10 +43,10 @@ CONFIG_SPL_SYS_REPORT_STACK_F_USAGE=y
 CONFIG_SPL_SYS_MALLOC_SIMPLE=y
 CONFIG_SPL_STACK_R=y
 CONFIG_SPL_SEPARATE_BSS=y
-CONFIG_SYS_SPL_MALLOC=y
-CONFIG_HAS_CUSTOM_SPL_MALLOC_START=y
-CONFIG_CUSTOM_SYS_SPL_MALLOC_ADDR=0x84000000
-CONFIG_SYS_SPL_MALLOC_SIZE=0x1000000
+CONFIG_SPL_SYS_MALLOC=y
+CONFIG_SPL_HAS_CUSTOM_MALLOC_START=y
+CONFIG_SPL_CUSTOM_SYS_MALLOC_ADDR=0x84000000
+CONFIG_SPL_SYS_MALLOC_SIZE=0x1000000
 CONFIG_SPL_EARLY_BSS=y
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR=y
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0x400
diff --git a/configs/am64x_evm_a53_defconfig b/configs/am64x_evm_a53_defconfig
index 718ad176cb3..9c41055b1e9 100644
--- a/configs/am64x_evm_a53_defconfig
+++ b/configs/am64x_evm_a53_defconfig
@@ -41,8 +41,8 @@ CONFIG_SPL_BSS_MAX_SIZE=0x80000
 CONFIG_SPL_BOARD_INIT=y
 CONFIG_SPL_SYS_MALLOC_SIMPLE=y
 CONFIG_SPL_STACK_R=y
-CONFIG_SYS_SPL_MALLOC=y
-CONFIG_SYS_SPL_MALLOC_SIZE=0x800000
+CONFIG_SPL_SYS_MALLOC=y
+CONFIG_SPL_SYS_MALLOC_SIZE=0x800000
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR=y
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0x1400
 CONFIG_SPL_DMA=y
diff --git a/configs/am64x_evm_r5_defconfig b/configs/am64x_evm_r5_defconfig
index b501c17b87a..ddc41480583 100644
--- a/configs/am64x_evm_r5_defconfig
+++ b/configs/am64x_evm_r5_defconfig
@@ -44,10 +44,10 @@ CONFIG_SPL_BOARD_INIT=y
 CONFIG_SPL_SYS_MALLOC_SIMPLE=y
 CONFIG_SPL_STACK_R=y
 CONFIG_SPL_SEPARATE_BSS=y
-CONFIG_SYS_SPL_MALLOC=y
-CONFIG_HAS_CUSTOM_SPL_MALLOC_START=y
-CONFIG_CUSTOM_SYS_SPL_MALLOC_ADDR=0x84000000
-CONFIG_SYS_SPL_MALLOC_SIZE=0x1000000
+CONFIG_SPL_SYS_MALLOC=y
+CONFIG_SPL_HAS_CUSTOM_MALLOC_START=y
+CONFIG_SPL_CUSTOM_SYS_MALLOC_ADDR=0x84000000
+CONFIG_SPL_SYS_MALLOC_SIZE=0x1000000
 CONFIG_SPL_EARLY_BSS=y
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR=y
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0x400
diff --git a/configs/am65x_evm_a53_defconfig b/configs/am65x_evm_a53_defconfig
index 4301553af8d..c3b44488492 100644
--- a/configs/am65x_evm_a53_defconfig
+++ b/configs/am65x_evm_a53_defconfig
@@ -43,8 +43,8 @@ CONFIG_SPL_BSS_START_ADDR=0x80a00000
 CONFIG_SPL_BSS_MAX_SIZE=0x80000
 CONFIG_SPL_SYS_MALLOC_SIMPLE=y
 CONFIG_SPL_STACK_R=y
-CONFIG_SYS_SPL_MALLOC=y
-CONFIG_SYS_SPL_MALLOC_SIZE=0x800000
+CONFIG_SPL_SYS_MALLOC=y
+CONFIG_SPL_SYS_MALLOC_SIZE=0x800000
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR=y
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0x1400
 CONFIG_SPL_DMA=y
diff --git a/configs/am65x_evm_r5_defconfig b/configs/am65x_evm_r5_defconfig
index d5196c2024e..b2f1e721b36 100644
--- a/configs/am65x_evm_r5_defconfig
+++ b/configs/am65x_evm_r5_defconfig
@@ -40,10 +40,10 @@ CONFIG_SPL_BSS_MAX_SIZE=0xc00
 CONFIG_SPL_SYS_REPORT_STACK_F_USAGE=y
 CONFIG_SPL_STACK_R=y
 CONFIG_SPL_SEPARATE_BSS=y
-CONFIG_SYS_SPL_MALLOC=y
-CONFIG_HAS_CUSTOM_SPL_MALLOC_START=y
-CONFIG_CUSTOM_SYS_SPL_MALLOC_ADDR=0x84000000
-CONFIG_SYS_SPL_MALLOC_SIZE=0x1000000
+CONFIG_SPL_SYS_MALLOC=y
+CONFIG_SPL_HAS_CUSTOM_MALLOC_START=y
+CONFIG_SPL_CUSTOM_SYS_MALLOC_ADDR=0x84000000
+CONFIG_SPL_SYS_MALLOC_SIZE=0x1000000
 CONFIG_SPL_EARLY_BSS=y
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR=y
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0x400
diff --git a/configs/am65x_evm_r5_usbdfu_defconfig b/configs/am65x_evm_r5_usbdfu_defconfig
index 88f68aa70e4..f610b2dd94e 100644
--- a/configs/am65x_evm_r5_usbdfu_defconfig
+++ b/configs/am65x_evm_r5_usbdfu_defconfig
@@ -37,10 +37,10 @@ CONFIG_SPL_BSS_MAX_SIZE=0xc00
 CONFIG_SPL_SYS_REPORT_STACK_F_USAGE=y
 CONFIG_SPL_STACK_R=y
 CONFIG_SPL_SEPARATE_BSS=y
-CONFIG_SYS_SPL_MALLOC=y
-CONFIG_HAS_CUSTOM_SPL_MALLOC_START=y
-CONFIG_CUSTOM_SYS_SPL_MALLOC_ADDR=0x84000000
-CONFIG_SYS_SPL_MALLOC_SIZE=0x1000000
+CONFIG_SPL_SYS_MALLOC=y
+CONFIG_SPL_HAS_CUSTOM_MALLOC_START=y
+CONFIG_SPL_CUSTOM_SYS_MALLOC_ADDR=0x84000000
+CONFIG_SPL_SYS_MALLOC_SIZE=0x1000000
 CONFIG_SPL_EARLY_BSS=y
 CONFIG_SPL_DMA=y
 CONFIG_SPL_ENV_SUPPORT=y
diff --git a/configs/am65x_evm_r5_usbmsc_defconfig b/configs/am65x_evm_r5_usbmsc_defconfig
index 8da49c78c82..70ba50083b8 100644
--- a/configs/am65x_evm_r5_usbmsc_defconfig
+++ b/configs/am65x_evm_r5_usbmsc_defconfig
@@ -36,10 +36,10 @@ CONFIG_SPL_BSS_MAX_SIZE=0xc00
 CONFIG_SPL_SYS_REPORT_STACK_F_USAGE=y
 CONFIG_SPL_STACK_R=y
 CONFIG_SPL_SEPARATE_BSS=y
-CONFIG_SYS_SPL_MALLOC=y
-CONFIG_HAS_CUSTOM_SPL_MALLOC_START=y
-CONFIG_CUSTOM_SYS_SPL_MALLOC_ADDR=0x84000000
-CONFIG_SYS_SPL_MALLOC_SIZE=0x1000000
+CONFIG_SPL_SYS_MALLOC=y
+CONFIG_SPL_HAS_CUSTOM_MALLOC_START=y
+CONFIG_SPL_CUSTOM_SYS_MALLOC_ADDR=0x84000000
+CONFIG_SPL_SYS_MALLOC_SIZE=0x1000000
 CONFIG_SPL_EARLY_BSS=y
 CONFIG_SPL_DMA=y
 CONFIG_SPL_ENV_SUPPORT=y
diff --git a/configs/am65x_hs_evm_a53_defconfig b/configs/am65x_hs_evm_a53_defconfig
index 3f9626e4550..ca90eea421a 100644
--- a/configs/am65x_hs_evm_a53_defconfig
+++ b/configs/am65x_hs_evm_a53_defconfig
@@ -43,8 +43,8 @@ CONFIG_SPL_BSS_START_ADDR=0x80a00000
 CONFIG_SPL_BSS_MAX_SIZE=0x80000
 CONFIG_SPL_SYS_MALLOC_SIMPLE=y
 CONFIG_SPL_STACK_R=y
-CONFIG_SYS_SPL_MALLOC=y
-CONFIG_SYS_SPL_MALLOC_SIZE=0x800000
+CONFIG_SPL_SYS_MALLOC=y
+CONFIG_SPL_SYS_MALLOC_SIZE=0x800000
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR=y
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0x1400
 CONFIG_SPL_DMA=y
diff --git a/configs/am65x_hs_evm_r5_defconfig b/configs/am65x_hs_evm_r5_defconfig
index 0c7b53ca2c0..8b3b3fcb136 100644
--- a/configs/am65x_hs_evm_r5_defconfig
+++ b/configs/am65x_hs_evm_r5_defconfig
@@ -36,10 +36,10 @@ CONFIG_SPL_BSS_START_ADDR=0x41c7effc
 CONFIG_SPL_BSS_MAX_SIZE=0xc00
 CONFIG_SPL_STACK_R=y
 CONFIG_SPL_SEPARATE_BSS=y
-CONFIG_SYS_SPL_MALLOC=y
-CONFIG_HAS_CUSTOM_SPL_MALLOC_START=y
-CONFIG_CUSTOM_SYS_SPL_MALLOC_ADDR=0x84000000
-CONFIG_SYS_SPL_MALLOC_SIZE=0x1000000
+CONFIG_SPL_SYS_MALLOC=y
+CONFIG_SPL_HAS_CUSTOM_MALLOC_START=y
+CONFIG_SPL_CUSTOM_SYS_MALLOC_ADDR=0x84000000
+CONFIG_SPL_SYS_MALLOC_SIZE=0x1000000
 CONFIG_SPL_EARLY_BSS=y
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR=y
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0x400
diff --git a/configs/apalis-tk1_defconfig b/configs/apalis-tk1_defconfig
index fda85c2d6ae..59bca77cc65 100644
--- a/configs/apalis-tk1_defconfig
+++ b/configs/apalis-tk1_defconfig
@@ -29,10 +29,10 @@ CONFIG_ARCH_MISC_INIT=y
 CONFIG_SPL_FOOTPRINT_LIMIT=y
 CONFIG_SPL_MAX_FOOTPRINT=0x8000
 # CONFIG_SPL_SHARES_INIT_SP_ADDR is not set
-CONFIG_SYS_SPL_MALLOC=y
-CONFIG_HAS_CUSTOM_SPL_MALLOC_START=y
-CONFIG_CUSTOM_SYS_SPL_MALLOC_ADDR=0x80090000
-CONFIG_SYS_SPL_MALLOC_SIZE=0x10000
+CONFIG_SPL_SYS_MALLOC=y
+CONFIG_SPL_HAS_CUSTOM_MALLOC_START=y
+CONFIG_SPL_CUSTOM_SYS_MALLOC_ADDR=0x80090000
+CONFIG_SPL_SYS_MALLOC_SIZE=0x10000
 CONFIG_SYS_MAXARGS=32
 CONFIG_SYS_CBSIZE=1024
 CONFIG_SYS_PBSIZE=1054
diff --git a/configs/apalis_imx6_defconfig b/configs/apalis_imx6_defconfig
index 5f0f78191c4..f3062b360a6 100644
--- a/configs/apalis_imx6_defconfig
+++ b/configs/apalis_imx6_defconfig
@@ -40,7 +40,7 @@ CONFIG_SYS_CONSOLE_OVERWRITE_ROUTINE=y
 CONFIG_DISPLAY_BOARDINFO_LATE=y
 CONFIG_BOARD_EARLY_INIT_F=y
 CONFIG_MISC_INIT_R=y
-CONFIG_SYS_SPL_MALLOC=y
+CONFIG_SPL_SYS_MALLOC=y
 CONFIG_SPL_DMA=y
 CONFIG_SPL_I2C=y
 CONFIG_SYS_MAXARGS=48
diff --git a/configs/apalis_t30_defconfig b/configs/apalis_t30_defconfig
index 83aab2450be..b7e87de62e4 100644
--- a/configs/apalis_t30_defconfig
+++ b/configs/apalis_t30_defconfig
@@ -24,10 +24,10 @@ CONFIG_ARCH_MISC_INIT=y
 CONFIG_SPL_FOOTPRINT_LIMIT=y
 CONFIG_SPL_MAX_FOOTPRINT=0x8000
 # CONFIG_SPL_SHARES_INIT_SP_ADDR is not set
-CONFIG_SYS_SPL_MALLOC=y
-CONFIG_HAS_CUSTOM_SPL_MALLOC_START=y
-CONFIG_CUSTOM_SYS_SPL_MALLOC_ADDR=0x80090000
-CONFIG_SYS_SPL_MALLOC_SIZE=0x10000
+CONFIG_SPL_SYS_MALLOC=y
+CONFIG_SPL_HAS_CUSTOM_MALLOC_START=y
+CONFIG_SPL_CUSTOM_SYS_MALLOC_ADDR=0x80090000
+CONFIG_SPL_SYS_MALLOC_SIZE=0x10000
 CONFIG_SYS_MAXARGS=32
 CONFIG_SYS_CBSIZE=1024
 CONFIG_SYS_PBSIZE=1054
diff --git a/configs/axm_defconfig b/configs/axm_defconfig
index 5d6dd2ae913..00e02e02374 100644
--- a/configs/axm_defconfig
+++ b/configs/axm_defconfig
@@ -45,10 +45,10 @@ CONFIG_SPL_BSS_MAX_SIZE=0x600
 # CONFIG_SPL_LEGACY_IMAGE_FORMAT is not set
 CONFIG_SPL_SYS_MALLOC_SIMPLE=y
 # CONFIG_SPL_SHARES_INIT_SP_ADDR is not set
-CONFIG_SYS_SPL_MALLOC=y
-CONFIG_HAS_CUSTOM_SPL_MALLOC_START=y
-CONFIG_CUSTOM_SYS_SPL_MALLOC_ADDR=0x20ba0000
-CONFIG_SYS_SPL_MALLOC_SIZE=0x460000
+CONFIG_SPL_SYS_MALLOC=y
+CONFIG_SPL_HAS_CUSTOM_MALLOC_START=y
+CONFIG_SPL_CUSTOM_SYS_MALLOC_ADDR=0x20ba0000
+CONFIG_SPL_SYS_MALLOC_SIZE=0x460000
 CONFIG_SPL_NAND_SUPPORT=y
 CONFIG_SPL_NAND_RAW_ONLY=y
 CONFIG_SPL_NAND_DRIVERS=y
diff --git a/configs/beaver_defconfig b/configs/beaver_defconfig
index 0d8a74be7aa..b1fbe55b072 100644
--- a/configs/beaver_defconfig
+++ b/configs/beaver_defconfig
@@ -22,10 +22,10 @@ CONFIG_SYS_STDIO_DEREGISTER=y
 CONFIG_SPL_FOOTPRINT_LIMIT=y
 CONFIG_SPL_MAX_FOOTPRINT=0x8000
 # CONFIG_SPL_SHARES_INIT_SP_ADDR is not set
-CONFIG_SYS_SPL_MALLOC=y
-CONFIG_HAS_CUSTOM_SPL_MALLOC_START=y
-CONFIG_CUSTOM_SYS_SPL_MALLOC_ADDR=0x80090000
-CONFIG_SYS_SPL_MALLOC_SIZE=0x10000
+CONFIG_SPL_SYS_MALLOC=y
+CONFIG_SPL_HAS_CUSTOM_MALLOC_START=y
+CONFIG_SPL_CUSTOM_SYS_MALLOC_ADDR=0x80090000
+CONFIG_SPL_SYS_MALLOC_SIZE=0x10000
 CONFIG_SYS_MAXARGS=64
 CONFIG_SYS_PBSIZE=2084
 # CONFIG_CMD_IMI is not set
diff --git a/configs/bitmain_antminer_s9_defconfig b/configs/bitmain_antminer_s9_defconfig
index 3995d41ce1b..8893358a884 100644
--- a/configs/bitmain_antminer_s9_defconfig
+++ b/configs/bitmain_antminer_s9_defconfig
@@ -34,8 +34,8 @@ CONFIG_SPL_BSS_START_ADDR=0x100000
 CONFIG_SPL_BSS_MAX_SIZE=0x100000
 # CONFIG_SPL_SHARES_INIT_SP_ADDR is not set
 CONFIG_SPL_STACK_R=y
-CONFIG_SYS_SPL_MALLOC=y
-CONFIG_SYS_SPL_MALLOC_SIZE=0x2000000
+CONFIG_SPL_SYS_MALLOC=y
+CONFIG_SPL_SYS_MALLOC_SIZE=0x2000000
 CONFIG_HUSH_PARSER=y
 CONFIG_SYS_MAXARGS=32
 CONFIG_SYS_PBSIZE=2075
diff --git a/configs/brppt1_mmc_defconfig b/configs/brppt1_mmc_defconfig
index 653620263cd..165e4d91fcc 100644
--- a/configs/brppt1_mmc_defconfig
+++ b/configs/brppt1_mmc_defconfig
@@ -37,8 +37,8 @@ CONFIG_SYS_CONSOLE_INFO_QUIET=y
 # CONFIG_DISPLAY_BOARDINFO is not set
 CONFIG_ARCH_MISC_INIT=y
 CONFIG_SPL_SYS_MALLOC_SIMPLE=y
-CONFIG_SYS_SPL_MALLOC=y
-CONFIG_SYS_SPL_MALLOC_SIZE=0x500000
+CONFIG_SPL_SYS_MALLOC=y
+CONFIG_SPL_SYS_MALLOC_SIZE=0x500000
 CONFIG_SPL_I2C=y
 # CONFIG_SPL_NAND_SUPPORT is not set
 CONFIG_SPL_POWER=y
diff --git a/configs/brppt2_defconfig b/configs/brppt2_defconfig
index 05ee4c5797e..73bc6240068 100644
--- a/configs/brppt2_defconfig
+++ b/configs/brppt2_defconfig
@@ -32,7 +32,7 @@ CONFIG_USE_BOOTCOMMAND=y
 CONFIG_BOOTCOMMAND="run b_default"
 CONFIG_BOARD_EARLY_INIT_F=y
 CONFIG_SPL_BOARD_INIT=y
-CONFIG_SYS_SPL_MALLOC=y
+CONFIG_SPL_SYS_MALLOC=y
 # CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR is not set
 CONFIG_SPL_I2C=y
 CONFIG_SPL_DM_SPI_FLASH=y
diff --git a/configs/brsmarc1_defconfig b/configs/brsmarc1_defconfig
index 94943fccf1a..419fe4529de 100644
--- a/configs/brsmarc1_defconfig
+++ b/configs/brsmarc1_defconfig
@@ -38,8 +38,8 @@ CONFIG_BOARD_TYPES=y
 CONFIG_ARCH_MISC_INIT=y
 # CONFIG_SPL_RAW_IMAGE_SUPPORT is not set
 CONFIG_SPL_SYS_MALLOC_SIMPLE=y
-CONFIG_SYS_SPL_MALLOC=y
-CONFIG_SYS_SPL_MALLOC_SIZE=0x500000
+CONFIG_SPL_SYS_MALLOC=y
+CONFIG_SPL_SYS_MALLOC_SIZE=0x500000
 # CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR is not set
 CONFIG_SPL_I2C=y
 # CONFIG_SPL_NAND_SUPPORT is not set
diff --git a/configs/brxre1_defconfig b/configs/brxre1_defconfig
index b50aef0aad9..3ef35f0a675 100644
--- a/configs/brxre1_defconfig
+++ b/configs/brxre1_defconfig
@@ -34,8 +34,8 @@ CONFIG_SYS_CONSOLE_INFO_QUIET=y
 # CONFIG_DISPLAY_BOARDINFO is not set
 CONFIG_ARCH_MISC_INIT=y
 CONFIG_SPL_SYS_MALLOC_SIMPLE=y
-CONFIG_SYS_SPL_MALLOC=y
-CONFIG_SYS_SPL_MALLOC_SIZE=0x500000
+CONFIG_SPL_SYS_MALLOC=y
+CONFIG_SPL_SYS_MALLOC_SIZE=0x500000
 CONFIG_SPL_I2C=y
 # CONFIG_SPL_NAND_SUPPORT is not set
 CONFIG_SPL_POWER=y
diff --git a/configs/cardhu_defconfig b/configs/cardhu_defconfig
index 4fe4621f037..e076215f28d 100644
--- a/configs/cardhu_defconfig
+++ b/configs/cardhu_defconfig
@@ -21,10 +21,10 @@ CONFIG_SYS_STDIO_DEREGISTER=y
 CONFIG_SPL_FOOTPRINT_LIMIT=y
 CONFIG_SPL_MAX_FOOTPRINT=0x8000
 # CONFIG_SPL_SHARES_INIT_SP_ADDR is not set
-CONFIG_SYS_SPL_MALLOC=y
-CONFIG_HAS_CUSTOM_SPL_MALLOC_START=y
-CONFIG_CUSTOM_SYS_SPL_MALLOC_ADDR=0x80090000
-CONFIG_SYS_SPL_MALLOC_SIZE=0x10000
+CONFIG_SPL_SYS_MALLOC=y
+CONFIG_SPL_HAS_CUSTOM_MALLOC_START=y
+CONFIG_SPL_CUSTOM_SYS_MALLOC_ADDR=0x80090000
+CONFIG_SPL_SYS_MALLOC_SIZE=0x10000
 CONFIG_SYS_MAXARGS=64
 CONFIG_SYS_PBSIZE=2084
 # CONFIG_CMD_IMI is not set
diff --git a/configs/cei-tk1-som_defconfig b/configs/cei-tk1-som_defconfig
index b920ac2ae40..e7221678dd8 100644
--- a/configs/cei-tk1-som_defconfig
+++ b/configs/cei-tk1-som_defconfig
@@ -25,10 +25,10 @@ CONFIG_SYS_STDIO_DEREGISTER=y
 CONFIG_SPL_FOOTPRINT_LIMIT=y
 CONFIG_SPL_MAX_FOOTPRINT=0x8000
 # CONFIG_SPL_SHARES_INIT_SP_ADDR is not set
-CONFIG_SYS_SPL_MALLOC=y
-CONFIG_HAS_CUSTOM_SPL_MALLOC_START=y
-CONFIG_CUSTOM_SYS_SPL_MALLOC_ADDR=0x80090000
-CONFIG_SYS_SPL_MALLOC_SIZE=0x10000
+CONFIG_SPL_SYS_MALLOC=y
+CONFIG_SPL_HAS_CUSTOM_MALLOC_START=y
+CONFIG_SPL_CUSTOM_SYS_MALLOC_ADDR=0x80090000
+CONFIG_SPL_SYS_MALLOC_SIZE=0x10000
 CONFIG_SYS_MAXARGS=64
 CONFIG_SYS_PBSIZE=2086
 # CONFIG_CMD_IMI is not set
diff --git a/configs/cgtqmx8_defconfig b/configs/cgtqmx8_defconfig
index 32e0647c93c..e699430bf9f 100644
--- a/configs/cgtqmx8_defconfig
+++ b/configs/cgtqmx8_defconfig
@@ -36,10 +36,10 @@ CONFIG_SPL_BSS_MAX_SIZE=0x1000
 # CONFIG_SPL_BINMAN_UBOOT_SYMBOLS is not set
 CONFIG_SPL_BOARD_INIT=y
 # CONFIG_SPL_SHARES_INIT_SP_ADDR is not set
-CONFIG_SYS_SPL_MALLOC=y
-CONFIG_HAS_CUSTOM_SPL_MALLOC_START=y
-CONFIG_CUSTOM_SYS_SPL_MALLOC_ADDR=0x120000
-CONFIG_SYS_SPL_MALLOC_SIZE=0x3000
+CONFIG_SPL_SYS_MALLOC=y
+CONFIG_SPL_HAS_CUSTOM_MALLOC_START=y
+CONFIG_SPL_CUSTOM_SYS_MALLOC_ADDR=0x120000
+CONFIG_SPL_SYS_MALLOC_SIZE=0x3000
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR=y
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0x800
 CONFIG_SYS_MMCSD_FS_BOOT_PARTITION=0
diff --git a/configs/chiliboard_defconfig b/configs/chiliboard_defconfig
index 0c3fd428407..06642d282d1 100644
--- a/configs/chiliboard_defconfig
+++ b/configs/chiliboard_defconfig
@@ -24,8 +24,8 @@ CONFIG_BOOTCOMMAND="run mmcboot; run nandboot; run netboot"
 CONFIG_DEFAULT_FDT_FILE="am335x-chiliboard.dtb"
 CONFIG_SYS_CONSOLE_INFO_QUIET=y
 CONFIG_ARCH_MISC_INIT=y
-CONFIG_SYS_SPL_MALLOC=y
-CONFIG_SYS_SPL_MALLOC_SIZE=0x800000
+CONFIG_SPL_SYS_MALLOC=y
+CONFIG_SPL_SYS_MALLOC_SIZE=0x800000
 CONFIG_SPL_I2C=y
 CONFIG_SPL_NAND_DRIVERS=y
 CONFIG_SPL_NAND_ECC=y
diff --git a/configs/cl-som-imx7_defconfig b/configs/cl-som-imx7_defconfig
index 2277d19a2d8..69eba97f4e6 100644
--- a/configs/cl-som-imx7_defconfig
+++ b/configs/cl-som-imx7_defconfig
@@ -32,7 +32,7 @@ CONFIG_SPL_MAX_SIZE=0xe000
 CONFIG_SPL_HAS_BSS_LINKER_SECTION=y
 CONFIG_SPL_BSS_MAX_SIZE=0x100000
 CONFIG_SPL_BOARD_INIT=y
-CONFIG_SYS_SPL_MALLOC=y
+CONFIG_SPL_SYS_MALLOC=y
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0x80
 CONFIG_SPL_I2C=y
 CONFIG_SPL_SPI_LOAD=y
diff --git a/configs/cm_fx6_defconfig b/configs/cm_fx6_defconfig
index 56527dadd0d..c20e0fb8942 100644
--- a/configs/cm_fx6_defconfig
+++ b/configs/cm_fx6_defconfig
@@ -33,7 +33,7 @@ CONFIG_BOOTCOMMAND="run findfdt; run distro_bootcmd; run legacy_bootcmd"
 CONFIG_USE_PREBOOT=y
 CONFIG_PREBOOT="usb start;sf probe"
 CONFIG_MISC_INIT_R=y
-CONFIG_SYS_SPL_MALLOC=y
+CONFIG_SPL_SYS_MALLOC=y
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0x80
 CONFIG_SPL_I2C=y
 CONFIG_SPL_SPI_LOAD=y
diff --git a/configs/cm_t43_defconfig b/configs/cm_t43_defconfig
index 12d010ab64b..32c4ec45d4b 100644
--- a/configs/cm_t43_defconfig
+++ b/configs/cm_t43_defconfig
@@ -33,8 +33,8 @@ CONFIG_SYS_CONSOLE_INFO_QUIET=y
 # CONFIG_DISPLAY_BOARDINFO is not set
 # CONFIG_MISC_INIT_R is not set
 CONFIG_SPL_MAX_SIZE=0x37690
-CONFIG_SYS_SPL_MALLOC=y
-CONFIG_SYS_SPL_MALLOC_SIZE=0x800000
+CONFIG_SPL_SYS_MALLOC=y
+CONFIG_SPL_SYS_MALLOC_SIZE=0x800000
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0x480
 CONFIG_SPL_FS_EXT4=y
 CONFIG_SPL_I2C=y
diff --git a/configs/colibri_imx6_defconfig b/configs/colibri_imx6_defconfig
index be1037b6cbb..f41895ce704 100644
--- a/configs/colibri_imx6_defconfig
+++ b/configs/colibri_imx6_defconfig
@@ -39,7 +39,7 @@ CONFIG_SYS_CONSOLE_OVERWRITE_ROUTINE=y
 CONFIG_DISPLAY_BOARDINFO_LATE=y
 CONFIG_BOARD_EARLY_INIT_F=y
 CONFIG_MISC_INIT_R=y
-CONFIG_SYS_SPL_MALLOC=y
+CONFIG_SPL_SYS_MALLOC=y
 CONFIG_SPL_DMA=y
 CONFIG_SPL_I2C=y
 CONFIG_SYS_MAXARGS=48
diff --git a/configs/colibri_t20_defconfig b/configs/colibri_t20_defconfig
index eb2e202f6f2..f6ac66456a0 100644
--- a/configs/colibri_t20_defconfig
+++ b/configs/colibri_t20_defconfig
@@ -22,10 +22,10 @@ CONFIG_ARCH_MISC_INIT=y
 CONFIG_SPL_FOOTPRINT_LIMIT=y
 CONFIG_SPL_MAX_FOOTPRINT=0x8000
 # CONFIG_SPL_SHARES_INIT_SP_ADDR is not set
-CONFIG_SYS_SPL_MALLOC=y
-CONFIG_HAS_CUSTOM_SPL_MALLOC_START=y
-CONFIG_CUSTOM_SYS_SPL_MALLOC_ADDR=0x90000
-CONFIG_SYS_SPL_MALLOC_SIZE=0x10000
+CONFIG_SPL_SYS_MALLOC=y
+CONFIG_SPL_HAS_CUSTOM_MALLOC_START=y
+CONFIG_SPL_CUSTOM_SYS_MALLOC_ADDR=0x90000
+CONFIG_SPL_SYS_MALLOC_SIZE=0x10000
 CONFIG_SYS_MAXARGS=32
 CONFIG_SYS_CBSIZE=1024
 CONFIG_SYS_PBSIZE=1055
diff --git a/configs/colibri_t30_defconfig b/configs/colibri_t30_defconfig
index 8098ff7abc1..31b3ee84a3e 100644
--- a/configs/colibri_t30_defconfig
+++ b/configs/colibri_t30_defconfig
@@ -23,10 +23,10 @@ CONFIG_ARCH_MISC_INIT=y
 CONFIG_SPL_FOOTPRINT_LIMIT=y
 CONFIG_SPL_MAX_FOOTPRINT=0x8000
 # CONFIG_SPL_SHARES_INIT_SP_ADDR is not set
-CONFIG_SYS_SPL_MALLOC=y
-CONFIG_HAS_CUSTOM_SPL_MALLOC_START=y
-CONFIG_CUSTOM_SYS_SPL_MALLOC_ADDR=0x80090000
-CONFIG_SYS_SPL_MALLOC_SIZE=0x10000
+CONFIG_SPL_SYS_MALLOC=y
+CONFIG_SPL_HAS_CUSTOM_MALLOC_START=y
+CONFIG_SPL_CUSTOM_SYS_MALLOC_ADDR=0x80090000
+CONFIG_SPL_SYS_MALLOC_SIZE=0x10000
 CONFIG_SYS_MAXARGS=32
 CONFIG_SYS_CBSIZE=1024
 CONFIG_SYS_PBSIZE=1055
diff --git a/configs/da850evm_defconfig b/configs/da850evm_defconfig
index 2001327ab08..91f2370a236 100644
--- a/configs/da850evm_defconfig
+++ b/configs/da850evm_defconfig
@@ -46,10 +46,10 @@ CONFIG_SPL_FOOTPRINT_LIMIT=y
 CONFIG_SPL_MAX_FOOTPRINT=0x8000
 CONFIG_SPL_SYS_MALLOC_SIMPLE=y
 # CONFIG_SPL_SHARES_INIT_SP_ADDR is not set
-CONFIG_SYS_SPL_MALLOC=y
-CONFIG_HAS_CUSTOM_SPL_MALLOC_START=y
-CONFIG_CUSTOM_SYS_SPL_MALLOC_ADDR=0xc0f70000
-CONFIG_SYS_SPL_MALLOC_SIZE=0x110000
+CONFIG_SPL_SYS_MALLOC=y
+CONFIG_SPL_HAS_CUSTOM_MALLOC_START=y
+CONFIG_SPL_CUSTOM_SYS_MALLOC_ADDR=0xc0f70000
+CONFIG_SPL_SYS_MALLOC_SIZE=0x110000
 # CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR is not set
 CONFIG_SPL_DM_SPI_FLASH=y
 CONFIG_SPL_SPI_LOAD=y
diff --git a/configs/da850evm_nand_defconfig b/configs/da850evm_nand_defconfig
index eddaa49f0f2..5fd0bd13c92 100644
--- a/configs/da850evm_nand_defconfig
+++ b/configs/da850evm_nand_defconfig
@@ -42,10 +42,10 @@ CONFIG_SPL_FOOTPRINT_LIMIT=y
 CONFIG_SPL_MAX_FOOTPRINT=0x8000
 CONFIG_SPL_SYS_MALLOC_SIMPLE=y
 # CONFIG_SPL_SHARES_INIT_SP_ADDR is not set
-CONFIG_SYS_SPL_MALLOC=y
-CONFIG_HAS_CUSTOM_SPL_MALLOC_START=y
-CONFIG_CUSTOM_SYS_SPL_MALLOC_ADDR=0xc0f70000
-CONFIG_SYS_SPL_MALLOC_SIZE=0x110000
+CONFIG_SPL_SYS_MALLOC=y
+CONFIG_SPL_HAS_CUSTOM_MALLOC_START=y
+CONFIG_SPL_CUSTOM_SYS_MALLOC_ADDR=0xc0f70000
+CONFIG_SPL_SYS_MALLOC_SIZE=0x110000
 # CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR is not set
 CONFIG_SPL_NAND_SUPPORT=y
 CONFIG_SPL_NAND_DRIVERS=y
diff --git a/configs/dalmore_defconfig b/configs/dalmore_defconfig
index 92f4436eebd..5ef9b358673 100644
--- a/configs/dalmore_defconfig
+++ b/configs/dalmore_defconfig
@@ -21,10 +21,10 @@ CONFIG_SYS_STDIO_DEREGISTER=y
 CONFIG_SPL_FOOTPRINT_LIMIT=y
 CONFIG_SPL_MAX_FOOTPRINT=0x8000
 # CONFIG_SPL_SHARES_INIT_SP_ADDR is not set
-CONFIG_SYS_SPL_MALLOC=y
-CONFIG_HAS_CUSTOM_SPL_MALLOC_START=y
-CONFIG_CUSTOM_SYS_SPL_MALLOC_ADDR=0x80090000
-CONFIG_SYS_SPL_MALLOC_SIZE=0x10000
+CONFIG_SPL_SYS_MALLOC=y
+CONFIG_SPL_HAS_CUSTOM_MALLOC_START=y
+CONFIG_SPL_CUSTOM_SYS_MALLOC_ADDR=0x80090000
+CONFIG_SPL_SYS_MALLOC_SIZE=0x10000
 CONFIG_SYS_MAXARGS=64
 CONFIG_SYS_PBSIZE=2086
 # CONFIG_CMD_IMI is not set
diff --git a/configs/deneb_defconfig b/configs/deneb_defconfig
index 0d714bd313b..051de7b5c58 100644
--- a/configs/deneb_defconfig
+++ b/configs/deneb_defconfig
@@ -47,10 +47,10 @@ CONFIG_SPL_BSS_MAX_SIZE=0x1000
 CONFIG_SPL_BOARD_INIT=y
 CONFIG_SPL_SYS_MALLOC_SIMPLE=y
 # CONFIG_SPL_SHARES_INIT_SP_ADDR is not set
-CONFIG_SYS_SPL_MALLOC=y
-CONFIG_HAS_CUSTOM_SPL_MALLOC_START=y
-CONFIG_CUSTOM_SYS_SPL_MALLOC_ADDR=0x120000
-CONFIG_SYS_SPL_MALLOC_SIZE=0x3000
+CONFIG_SPL_SYS_MALLOC=y
+CONFIG_SPL_HAS_CUSTOM_MALLOC_START=y
+CONFIG_SPL_CUSTOM_SYS_MALLOC_ADDR=0x120000
+CONFIG_SPL_SYS_MALLOC_SIZE=0x3000
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR=y
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0x800
 CONFIG_SPL_POWER_DOMAIN=y
diff --git a/configs/devkit8000_defconfig b/configs/devkit8000_defconfig
index caeb0094cda..1431e54dc95 100644
--- a/configs/devkit8000_defconfig
+++ b/configs/devkit8000_defconfig
@@ -19,9 +19,9 @@ CONFIG_SYS_CONSOLE_INFO_QUIET=y
 CONFIG_SPL_MAX_SIZE=0xec00
 CONFIG_SPL_BSS_START_ADDR=0x80000500
 CONFIG_SPL_SYS_MALLOC_SIMPLE=y
-CONFIG_SYS_SPL_MALLOC=y
-CONFIG_HAS_CUSTOM_SPL_MALLOC_START=y
-CONFIG_CUSTOM_SYS_SPL_MALLOC_ADDR=0x80208000
+CONFIG_SPL_SYS_MALLOC=y
+CONFIG_SPL_HAS_CUSTOM_MALLOC_START=y
+CONFIG_SPL_CUSTOM_SYS_MALLOC_ADDR=0x80208000
 # CONFIG_SPL_FS_EXT4 is not set
 CONFIG_SPL_NAND_DRIVERS=y
 CONFIG_SPL_NAND_ECC=y
diff --git a/configs/dh_imx6_defconfig b/configs/dh_imx6_defconfig
index c1094b4eda9..e01776c7796 100644
--- a/configs/dh_imx6_defconfig
+++ b/configs/dh_imx6_defconfig
@@ -39,7 +39,7 @@ CONFIG_DISTRO_DEFAULTS=y
 CONFIG_BOOTDELAY=3
 # CONFIG_USE_BOOTCOMMAND is not set
 CONFIG_SYS_CONSOLE_OVERWRITE_ROUTINE=y
-CONFIG_SYS_SPL_MALLOC=y
+CONFIG_SPL_SYS_MALLOC=y
 CONFIG_SPL_SPI_LOAD=y
 CONFIG_SYS_SPI_U_BOOT_OFFS=0x11400
 CONFIG_SPL_WATCHDOG=y
diff --git a/configs/display5_defconfig b/configs/display5_defconfig
index 551e2a97a33..9c4334af15c 100644
--- a/configs/display5_defconfig
+++ b/configs/display5_defconfig
@@ -39,7 +39,7 @@ CONFIG_USE_BOOTCOMMAND=y
 CONFIG_BOOTCOMMAND="if run check_em_pad; then run recovery;else if test ${BOOT_FROM} = FACTORY; then run factory_nfs;else run boot_mmc;fi;fi"
 CONFIG_MISC_INIT_R=y
 CONFIG_SPL_BOOTCOUNT_LIMIT=y
-CONFIG_SYS_SPL_MALLOC=y
+CONFIG_SPL_SYS_MALLOC=y
 # CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR is not set
 CONFIG_SPL_DMA=y
 CONFIG_SPL_ENV_SUPPORT=y
diff --git a/configs/display5_factory_defconfig b/configs/display5_factory_defconfig
index a5396f7e54c..67ba7658861 100644
--- a/configs/display5_factory_defconfig
+++ b/configs/display5_factory_defconfig
@@ -36,7 +36,7 @@ CONFIG_BOOTDELAY=3
 CONFIG_USE_BOOTCOMMAND=y
 CONFIG_BOOTCOMMAND="echo SDP Display5 recovery"
 CONFIG_MISC_INIT_R=y
-CONFIG_SYS_SPL_MALLOC=y
+CONFIG_SPL_SYS_MALLOC=y
 # CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR is not set
 CONFIG_SPL_DMA=y
 CONFIG_SPL_I2C=y
diff --git a/configs/dra7xx_evm_defconfig b/configs/dra7xx_evm_defconfig
index 14dff632215..b61c311d803 100644
--- a/configs/dra7xx_evm_defconfig
+++ b/configs/dra7xx_evm_defconfig
@@ -30,8 +30,8 @@ CONFIG_BOARD_EARLY_INIT_F=y
 # CONFIG_MISC_INIT_R is not set
 CONFIG_SPL_MAX_SIZE=0x7bc00
 CONFIG_SPL_SYS_MALLOC_SIMPLE=y
-CONFIG_SYS_SPL_MALLOC=y
-CONFIG_SYS_SPL_MALLOC_SIZE=0x800000
+CONFIG_SPL_SYS_MALLOC=y
+CONFIG_SPL_SYS_MALLOC_SIZE=0x800000
 CONFIG_SPL_DMA=y
 CONFIG_SPL_FS_LOAD_PAYLOAD_NAME="u-boot.img"
 CONFIG_SPL_NAND_DRIVERS=y
diff --git a/configs/dra7xx_hs_evm_defconfig b/configs/dra7xx_hs_evm_defconfig
index 0d6d9efd4e2..d5da5923bba 100644
--- a/configs/dra7xx_hs_evm_defconfig
+++ b/configs/dra7xx_hs_evm_defconfig
@@ -33,8 +33,8 @@ CONFIG_BOARD_EARLY_INIT_F=y
 # CONFIG_MISC_INIT_R is not set
 CONFIG_SPL_MAX_SIZE=0x7a8b0
 CONFIG_SPL_SYS_MALLOC_SIMPLE=y
-CONFIG_SYS_SPL_MALLOC=y
-CONFIG_SYS_SPL_MALLOC_SIZE=0x800000
+CONFIG_SPL_SYS_MALLOC=y
+CONFIG_SPL_SYS_MALLOC_SIZE=0x800000
 CONFIG_SPL_DMA=y
 CONFIG_SPL_FS_LOAD_PAYLOAD_NAME="u-boot.img"
 # CONFIG_SPL_NAND_SUPPORT is not set
diff --git a/configs/dra7xx_hs_evm_usb_defconfig b/configs/dra7xx_hs_evm_usb_defconfig
index 506a65aac3d..4acb392f0de 100644
--- a/configs/dra7xx_hs_evm_usb_defconfig
+++ b/configs/dra7xx_hs_evm_usb_defconfig
@@ -34,8 +34,8 @@ CONFIG_BOARD_EARLY_INIT_F=y
 # CONFIG_MISC_INIT_R is not set
 CONFIG_SPL_MAX_SIZE=0x74eb0
 CONFIG_SPL_SYS_MALLOC_SIMPLE=y
-CONFIG_SYS_SPL_MALLOC=y
-CONFIG_SYS_SPL_MALLOC_SIZE=0x800000
+CONFIG_SPL_SYS_MALLOC=y
+CONFIG_SPL_SYS_MALLOC_SIZE=0x800000
 CONFIG_SPL_DMA=y
 CONFIG_SPL_FS_LOAD_PAYLOAD_NAME="u-boot.img"
 # CONFIG_SPL_NAND_SUPPORT is not set
diff --git a/configs/draco_defconfig b/configs/draco_defconfig
index b71b23faac7..4966ffd2a04 100644
--- a/configs/draco_defconfig
+++ b/configs/draco_defconfig
@@ -38,9 +38,9 @@ CONFIG_SYS_CONSOLE_INFO_QUIET=y
 # CONFIG_DISPLAY_BOARDINFO is not set
 CONFIG_ARCH_MISC_INIT=y
 CONFIG_SPL_BSS_START_ADDR=0x80000000
-CONFIG_SYS_SPL_MALLOC=y
-CONFIG_HAS_CUSTOM_SPL_MALLOC_START=y
-CONFIG_CUSTOM_SYS_SPL_MALLOC_ADDR=0x80208000
+CONFIG_SPL_SYS_MALLOC=y
+CONFIG_SPL_HAS_CUSTOM_MALLOC_START=y
+CONFIG_SPL_CUSTOM_SYS_MALLOC_ADDR=0x80208000
 CONFIG_SPL_I2C=y
 CONFIG_SPL_NAND_DRIVERS=y
 CONFIG_SPL_NAND_ECC=y
diff --git a/configs/endeavoru_defconfig b/configs/endeavoru_defconfig
index 38f26f2dcc5..baaa28aac3d 100644
--- a/configs/endeavoru_defconfig
+++ b/configs/endeavoru_defconfig
@@ -26,10 +26,10 @@ CONFIG_BOOTCOMMAND="if run check_button; then bootmenu; fi; run bootcmd_mmc0; po
 CONFIG_SPL_FOOTPRINT_LIMIT=y
 CONFIG_SPL_MAX_FOOTPRINT=0x8000
 # CONFIG_SPL_SHARES_INIT_SP_ADDR is not set
-CONFIG_SYS_SPL_MALLOC=y
-CONFIG_HAS_CUSTOM_SPL_MALLOC_START=y
-CONFIG_CUSTOM_SYS_SPL_MALLOC_ADDR=0x80090000
-CONFIG_SYS_SPL_MALLOC_SIZE=0x10000
+CONFIG_SPL_SYS_MALLOC=y
+CONFIG_SPL_HAS_CUSTOM_MALLOC_START=y
+CONFIG_SPL_CUSTOM_SYS_MALLOC_ADDR=0x80090000
+CONFIG_SPL_SYS_MALLOC_SIZE=0x10000
 CONFIG_SYS_MAXARGS=64
 CONFIG_SYS_PBSIZE=2084
 CONFIG_CMD_BOOTMENU=y
diff --git a/configs/etamin_defconfig b/configs/etamin_defconfig
index 43cfed9fb34..f3a9f712508 100644
--- a/configs/etamin_defconfig
+++ b/configs/etamin_defconfig
@@ -39,9 +39,9 @@ CONFIG_SYS_CONSOLE_INFO_QUIET=y
 # CONFIG_DISPLAY_BOARDINFO is not set
 CONFIG_ARCH_MISC_INIT=y
 CONFIG_SPL_BSS_START_ADDR=0x80000000
-CONFIG_SYS_SPL_MALLOC=y
-CONFIG_HAS_CUSTOM_SPL_MALLOC_START=y
-CONFIG_CUSTOM_SYS_SPL_MALLOC_ADDR=0x80208000
+CONFIG_SPL_SYS_MALLOC=y
+CONFIG_SPL_HAS_CUSTOM_MALLOC_START=y
+CONFIG_SPL_CUSTOM_SYS_MALLOC_ADDR=0x80208000
 CONFIG_SPL_I2C=y
 CONFIG_SPL_NAND_DRIVERS=y
 CONFIG_SPL_NAND_ECC=y
diff --git a/configs/gardena-smart-gateway-at91sam_defconfig b/configs/gardena-smart-gateway-at91sam_defconfig
index f6a67401867..439fcc05753 100644
--- a/configs/gardena-smart-gateway-at91sam_defconfig
+++ b/configs/gardena-smart-gateway-at91sam_defconfig
@@ -43,8 +43,8 @@ CONFIG_SPL_BSS_START_ADDR=0x20000000
 CONFIG_SPL_BSS_MAX_SIZE=0x80000
 CONFIG_SPL_SYS_MALLOC_SIMPLE=y
 # CONFIG_SPL_SHARES_INIT_SP_ADDR is not set
-CONFIG_SYS_SPL_MALLOC=y
-CONFIG_SYS_SPL_MALLOC_SIZE=0x80000
+CONFIG_SPL_SYS_MALLOC=y
+CONFIG_SPL_SYS_MALLOC_SIZE=0x80000
 # CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR is not set
 CONFIG_SPL_NAND_SUPPORT=y
 CONFIG_SPL_NAND_RAW_ONLY=y
diff --git a/configs/ge_b1x5v2_defconfig b/configs/ge_b1x5v2_defconfig
index b3b69a642a4..8f58454175f 100644
--- a/configs/ge_b1x5v2_defconfig
+++ b/configs/ge_b1x5v2_defconfig
@@ -39,7 +39,7 @@ CONFIG_LOG_MAX_LEVEL=8
 CONFIG_LOG_DEFAULT_LEVEL=4
 CONFIG_BOARD_EARLY_INIT_F=y
 CONFIG_MISC_INIT_R=y
-CONFIG_SYS_SPL_MALLOC=y
+CONFIG_SPL_SYS_MALLOC=y
 CONFIG_SPL_SPI_LOAD=y
 CONFIG_SYS_SPI_U_BOOT_OFFS=0x11400
 CONFIG_HUSH_PARSER=y
diff --git a/configs/giedi_defconfig b/configs/giedi_defconfig
index 75d5d89823f..8b2f7c23e59 100644
--- a/configs/giedi_defconfig
+++ b/configs/giedi_defconfig
@@ -47,10 +47,10 @@ CONFIG_SPL_BSS_MAX_SIZE=0x1000
 CONFIG_SPL_BOARD_INIT=y
 CONFIG_SPL_SYS_MALLOC_SIMPLE=y
 # CONFIG_SPL_SHARES_INIT_SP_ADDR is not set
-CONFIG_SYS_SPL_MALLOC=y
-CONFIG_HAS_CUSTOM_SPL_MALLOC_START=y
-CONFIG_CUSTOM_SYS_SPL_MALLOC_ADDR=0x120000
-CONFIG_SYS_SPL_MALLOC_SIZE=0x3000
+CONFIG_SPL_SYS_MALLOC=y
+CONFIG_SPL_HAS_CUSTOM_MALLOC_START=y
+CONFIG_SPL_CUSTOM_SYS_MALLOC_ADDR=0x120000
+CONFIG_SPL_SYS_MALLOC_SIZE=0x3000
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR=y
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0x800
 CONFIG_SPL_POWER_DOMAIN=y
diff --git a/configs/grouper_common_defconfig b/configs/grouper_common_defconfig
index 8dc88851f5a..e445e64931d 100644
--- a/configs/grouper_common_defconfig
+++ b/configs/grouper_common_defconfig
@@ -26,10 +26,10 @@ CONFIG_BOOTCOMMAND="if run check_button; then bootmenu; fi; run bootcmd_mmc0; po
 CONFIG_SPL_FOOTPRINT_LIMIT=y
 CONFIG_SPL_MAX_FOOTPRINT=0x8000
 # CONFIG_SPL_SHARES_INIT_SP_ADDR is not set
-CONFIG_SYS_SPL_MALLOC=y
-CONFIG_HAS_CUSTOM_SPL_MALLOC_START=y
-CONFIG_CUSTOM_SYS_SPL_MALLOC_ADDR=0x80090000
-CONFIG_SYS_SPL_MALLOC_SIZE=0x10000
+CONFIG_SPL_SYS_MALLOC=y
+CONFIG_SPL_HAS_CUSTOM_MALLOC_START=y
+CONFIG_SPL_CUSTOM_SYS_MALLOC_ADDR=0x80090000
+CONFIG_SPL_SYS_MALLOC_SIZE=0x10000
 CONFIG_SYS_MAXARGS=64
 CONFIG_SYS_PBSIZE=2084
 CONFIG_CMD_BOOTMENU=y
diff --git a/configs/gwventana_emmc_defconfig b/configs/gwventana_emmc_defconfig
index 3c558ba7f92..eb29268c6fa 100644
--- a/configs/gwventana_emmc_defconfig
+++ b/configs/gwventana_emmc_defconfig
@@ -44,7 +44,7 @@ CONFIG_MISC_INIT_R=y
 CONFIG_PCI_INIT_R=y
 CONFIG_SPL_BOARD_INIT=y
 CONFIG_SPL_STACK_R=y
-CONFIG_SYS_SPL_MALLOC=y
+CONFIG_SPL_SYS_MALLOC=y
 CONFIG_SPL_FIT_IMAGE_TINY=y
 CONFIG_SPL_DMA=y
 CONFIG_SPL_I2C=y
diff --git a/configs/gwventana_nand_defconfig b/configs/gwventana_nand_defconfig
index a41a8924871..17a86d6447d 100644
--- a/configs/gwventana_nand_defconfig
+++ b/configs/gwventana_nand_defconfig
@@ -44,7 +44,7 @@ CONFIG_MISC_INIT_R=y
 CONFIG_PCI_INIT_R=y
 CONFIG_SPL_BOARD_INIT=y
 CONFIG_SPL_STACK_R=y
-CONFIG_SYS_SPL_MALLOC=y
+CONFIG_SPL_SYS_MALLOC=y
 CONFIG_SPL_FIT_IMAGE_TINY=y
 CONFIG_SPL_DMA=y
 CONFIG_SPL_I2C=y
diff --git a/configs/harmony_defconfig b/configs/harmony_defconfig
index 8b49505a650..a1dfc0a738f 100644
--- a/configs/harmony_defconfig
+++ b/configs/harmony_defconfig
@@ -19,10 +19,10 @@ CONFIG_SYS_STDIO_DEREGISTER=y
 CONFIG_SPL_FOOTPRINT_LIMIT=y
 CONFIG_SPL_MAX_FOOTPRINT=0x8000
 # CONFIG_SPL_SHARES_INIT_SP_ADDR is not set
-CONFIG_SYS_SPL_MALLOC=y
-CONFIG_HAS_CUSTOM_SPL_MALLOC_START=y
-CONFIG_CUSTOM_SYS_SPL_MALLOC_ADDR=0x90000
-CONFIG_SYS_SPL_MALLOC_SIZE=0x10000
+CONFIG_SPL_SYS_MALLOC=y
+CONFIG_SPL_HAS_CUSTOM_MALLOC_START=y
+CONFIG_SPL_CUSTOM_SYS_MALLOC_ADDR=0x90000
+CONFIG_SPL_SYS_MALLOC_SIZE=0x10000
 CONFIG_SYS_MAXARGS=64
 CONFIG_SYS_PBSIZE=2085
 # CONFIG_CMD_IMI is not set
diff --git a/configs/igep00x0_defconfig b/configs/igep00x0_defconfig
index a0078e15ef4..e0cc3995966 100644
--- a/configs/igep00x0_defconfig
+++ b/configs/igep00x0_defconfig
@@ -20,8 +20,8 @@ CONFIG_SYS_CONSOLE_INFO_QUIET=y
 # CONFIG_DISPLAY_BOARDINFO is not set
 CONFIG_SPL_MAX_SIZE=0xec00
 CONFIG_SPL_SYS_MALLOC_SIMPLE=y
-CONFIG_SYS_SPL_MALLOC=y
-CONFIG_SYS_SPL_MALLOC_SIZE=0x800000
+CONFIG_SPL_SYS_MALLOC=y
+CONFIG_SPL_SYS_MALLOC_SIZE=0x800000
 # CONFIG_SPL_FS_EXT4 is not set
 CONFIG_SPL_MTD_SUPPORT=y
 CONFIG_SPL_NAND_DRIVERS=y
diff --git a/configs/imx6dl_icore_nand_defconfig b/configs/imx6dl_icore_nand_defconfig
index f4adda5b6d4..856123dc34a 100644
--- a/configs/imx6dl_icore_nand_defconfig
+++ b/configs/imx6dl_icore_nand_defconfig
@@ -25,7 +25,7 @@ CONFIG_LEGACY_IMAGE_FORMAT=y
 CONFIG_BOOTDELAY=3
 CONFIG_USE_BOOTCOMMAND=y
 CONFIG_BOOTCOMMAND="run $modeboot"
-CONFIG_SYS_SPL_MALLOC=y
+CONFIG_SPL_SYS_MALLOC=y
 CONFIG_SPL_DMA=y
 CONFIG_SPL_NAND_SUPPORT=y
 CONFIG_SPL_WATCHDOG=y
diff --git a/configs/imx6dl_mamoj_defconfig b/configs/imx6dl_mamoj_defconfig
index 8c7c13ebc88..933a9d83f34 100644
--- a/configs/imx6dl_mamoj_defconfig
+++ b/configs/imx6dl_mamoj_defconfig
@@ -18,7 +18,7 @@ CONFIG_SYS_MEMTEST_END=0x88000000
 CONFIG_LTO=y
 CONFIG_DISTRO_DEFAULTS=y
 CONFIG_BOOTDELAY=3
-CONFIG_SYS_SPL_MALLOC=y
+CONFIG_SPL_SYS_MALLOC=y
 CONFIG_SPL_OS_BOOT=y
 CONFIG_SYS_SPL_ARGS_ADDR=0x13000000
 CONFIG_SPL_FALCON_BOOT_MMCSD=y
diff --git a/configs/imx6q_bosch_acc_defconfig b/configs/imx6q_bosch_acc_defconfig
index c44d43aacaf..05bab034e0f 100644
--- a/configs/imx6q_bosch_acc_defconfig
+++ b/configs/imx6q_bosch_acc_defconfig
@@ -35,7 +35,7 @@ CONFIG_USE_BOOTCOMMAND=y
 CONFIG_BOOTCOMMAND="run mmc_mmc_fit"
 CONFIG_SPL_BOARD_INIT=y
 CONFIG_SPL_RAW_IMAGE_SUPPORT=y
-CONFIG_SYS_SPL_MALLOC=y
+CONFIG_SPL_SYS_MALLOC=y
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0xaa
 # CONFIG_SPL_CRYPTO is not set
 CONFIG_SPL_WATCHDOG=y
diff --git a/configs/imx6q_icore_nand_defconfig b/configs/imx6q_icore_nand_defconfig
index 3b579bac460..8e53700e836 100644
--- a/configs/imx6q_icore_nand_defconfig
+++ b/configs/imx6q_icore_nand_defconfig
@@ -26,7 +26,7 @@ CONFIG_SUPPORT_RAW_INITRD=y
 CONFIG_BOOTDELAY=3
 CONFIG_USE_BOOTCOMMAND=y
 CONFIG_BOOTCOMMAND="run $modeboot"
-CONFIG_SYS_SPL_MALLOC=y
+CONFIG_SPL_SYS_MALLOC=y
 CONFIG_SPL_DMA=y
 CONFIG_SPL_NAND_SUPPORT=y
 CONFIG_SPL_WATCHDOG=y
diff --git a/configs/imx6q_logic_defconfig b/configs/imx6q_logic_defconfig
index 74733c4de32..b307fea5f25 100644
--- a/configs/imx6q_logic_defconfig
+++ b/configs/imx6q_logic_defconfig
@@ -29,7 +29,7 @@ CONFIG_BOOTCOMMAND="run autoboot"
 CONFIG_SYS_CONSOLE_IS_IN_ENV=y
 CONFIG_SYS_CONSOLE_OVERWRITE_ROUTINE=y
 CONFIG_SPL_RAW_IMAGE_SUPPORT=y
-CONFIG_SYS_SPL_MALLOC=y
+CONFIG_SPL_SYS_MALLOC=y
 # CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR is not set
 CONFIG_SPL_DMA=y
 CONFIG_SPL_FS_LOAD_PAYLOAD_NAME="u-boot-dtb.img"
diff --git a/configs/imx6qdl_icore_mipi_defconfig b/configs/imx6qdl_icore_mipi_defconfig
index 4fdd891cc3e..ecb8fb2ba57 100644
--- a/configs/imx6qdl_icore_mipi_defconfig
+++ b/configs/imx6qdl_icore_mipi_defconfig
@@ -34,7 +34,7 @@ CONFIG_BOOTDELAY=3
 CONFIG_USE_BOOTCOMMAND=y
 CONFIG_BOOTCOMMAND="run $modeboot"
 CONFIG_SPL_RAW_IMAGE_SUPPORT=y
-CONFIG_SYS_SPL_MALLOC=y
+CONFIG_SPL_SYS_MALLOC=y
 CONFIG_SPL_OS_BOOT=y
 CONFIG_SYS_SPL_ARGS_ADDR=0x18000000
 CONFIG_SPL_FALCON_BOOT_MMCSD=y
diff --git a/configs/imx6qdl_icore_mmc_defconfig b/configs/imx6qdl_icore_mmc_defconfig
index 319e808e469..42889188cc3 100644
--- a/configs/imx6qdl_icore_mmc_defconfig
+++ b/configs/imx6qdl_icore_mmc_defconfig
@@ -37,7 +37,7 @@ CONFIG_BOOTDELAY=3
 CONFIG_USE_BOOTCOMMAND=y
 CONFIG_BOOTCOMMAND="run $modeboot"
 CONFIG_SPL_RAW_IMAGE_SUPPORT=y
-CONFIG_SYS_SPL_MALLOC=y
+CONFIG_SPL_SYS_MALLOC=y
 CONFIG_SPL_OS_BOOT=y
 CONFIG_SYS_SPL_ARGS_ADDR=0x18000000
 CONFIG_SPL_FALCON_BOOT_MMCSD=y
diff --git a/configs/imx6qdl_icore_nand_defconfig b/configs/imx6qdl_icore_nand_defconfig
index 3b579bac460..8e53700e836 100644
--- a/configs/imx6qdl_icore_nand_defconfig
+++ b/configs/imx6qdl_icore_nand_defconfig
@@ -26,7 +26,7 @@ CONFIG_SUPPORT_RAW_INITRD=y
 CONFIG_BOOTDELAY=3
 CONFIG_USE_BOOTCOMMAND=y
 CONFIG_BOOTCOMMAND="run $modeboot"
-CONFIG_SYS_SPL_MALLOC=y
+CONFIG_SPL_SYS_MALLOC=y
 CONFIG_SPL_DMA=y
 CONFIG_SPL_NAND_SUPPORT=y
 CONFIG_SPL_WATCHDOG=y
diff --git a/configs/imx6qdl_icore_rqs_defconfig b/configs/imx6qdl_icore_rqs_defconfig
index 697e4c28803..2ab42979fa6 100644
--- a/configs/imx6qdl_icore_rqs_defconfig
+++ b/configs/imx6qdl_icore_rqs_defconfig
@@ -31,7 +31,7 @@ CONFIG_BOOTDELAY=3
 CONFIG_USE_BOOTCOMMAND=y
 CONFIG_BOOTCOMMAND="run $modeboot"
 CONFIG_SPL_RAW_IMAGE_SUPPORT=y
-CONFIG_SYS_SPL_MALLOC=y
+CONFIG_SPL_SYS_MALLOC=y
 CONFIG_SPL_OS_BOOT=y
 CONFIG_SYS_SPL_ARGS_ADDR=0x18000000
 CONFIG_SPL_FALCON_BOOT_MMCSD=y
diff --git a/configs/imx6ul_geam_mmc_defconfig b/configs/imx6ul_geam_mmc_defconfig
index 87d693cff54..857569f99ee 100644
--- a/configs/imx6ul_geam_mmc_defconfig
+++ b/configs/imx6ul_geam_mmc_defconfig
@@ -30,7 +30,7 @@ CONFIG_BOOTDELAY=3
 CONFIG_USE_BOOTCOMMAND=y
 CONFIG_BOOTCOMMAND="run $modeboot"
 CONFIG_SPL_RAW_IMAGE_SUPPORT=y
-CONFIG_SYS_SPL_MALLOC=y
+CONFIG_SPL_SYS_MALLOC=y
 CONFIG_SPL_WATCHDOG=y
 CONFIG_HUSH_PARSER=y
 CONFIG_SYS_MAXARGS=32
diff --git a/configs/imx6ul_geam_nand_defconfig b/configs/imx6ul_geam_nand_defconfig
index 0b989e64847..3bf99aedc08 100644
--- a/configs/imx6ul_geam_nand_defconfig
+++ b/configs/imx6ul_geam_nand_defconfig
@@ -26,7 +26,7 @@ CONFIG_SUPPORT_RAW_INITRD=y
 CONFIG_BOOTDELAY=3
 CONFIG_USE_BOOTCOMMAND=y
 CONFIG_BOOTCOMMAND="run $modeboot"
-CONFIG_SYS_SPL_MALLOC=y
+CONFIG_SPL_SYS_MALLOC=y
 CONFIG_SPL_DMA=y
 CONFIG_SPL_NAND_SUPPORT=y
 CONFIG_SPL_WATCHDOG=y
diff --git a/configs/imx6ul_isiot_emmc_defconfig b/configs/imx6ul_isiot_emmc_defconfig
index e7242cad981..73caf9a552c 100644
--- a/configs/imx6ul_isiot_emmc_defconfig
+++ b/configs/imx6ul_isiot_emmc_defconfig
@@ -30,7 +30,7 @@ CONFIG_BOOTDELAY=3
 CONFIG_USE_BOOTCOMMAND=y
 CONFIG_BOOTCOMMAND="run $modeboot"
 CONFIG_SPL_RAW_IMAGE_SUPPORT=y
-CONFIG_SYS_SPL_MALLOC=y
+CONFIG_SPL_SYS_MALLOC=y
 CONFIG_SPL_WATCHDOG=y
 CONFIG_HUSH_PARSER=y
 CONFIG_SYS_MAXARGS=32
diff --git a/configs/imx6ul_isiot_nand_defconfig b/configs/imx6ul_isiot_nand_defconfig
index 8318197fdef..68a716ce8e4 100644
--- a/configs/imx6ul_isiot_nand_defconfig
+++ b/configs/imx6ul_isiot_nand_defconfig
@@ -26,7 +26,7 @@ CONFIG_SUPPORT_RAW_INITRD=y
 CONFIG_BOOTDELAY=3
 CONFIG_USE_BOOTCOMMAND=y
 CONFIG_BOOTCOMMAND="run $modeboot"
-CONFIG_SYS_SPL_MALLOC=y
+CONFIG_SPL_SYS_MALLOC=y
 CONFIG_SPL_DMA=y
 CONFIG_SPL_NAND_SUPPORT=y
 CONFIG_SPL_WATCHDOG=y
diff --git a/configs/imx6ulz_smm_m2_defconfig b/configs/imx6ulz_smm_m2_defconfig
index f3da19deb07..d6edc719004 100644
--- a/configs/imx6ulz_smm_m2_defconfig
+++ b/configs/imx6ulz_smm_m2_defconfig
@@ -23,7 +23,7 @@ CONFIG_DISTRO_DEFAULTS=y
 CONFIG_BOOTDELAY=3
 CONFIG_BOARD_LATE_INIT=y
 CONFIG_SPL_BSS_START_ADDR=0x84100000
-CONFIG_SYS_SPL_MALLOC=y
+CONFIG_SPL_SYS_MALLOC=y
 CONFIG_SPL_DMA=y
 CONFIG_SPL_MTD_SUPPORT=y
 CONFIG_SPL_NAND_SUPPORT=y
diff --git a/configs/imx7_cm_defconfig b/configs/imx7_cm_defconfig
index c43aed4a94c..30bf4eb3b0c 100644
--- a/configs/imx7_cm_defconfig
+++ b/configs/imx7_cm_defconfig
@@ -28,7 +28,7 @@ CONFIG_DEFAULT_FDT_FILE="ask"
 CONFIG_SPL_MAX_SIZE=0xe000
 CONFIG_SPL_HAS_BSS_LINKER_SECTION=y
 CONFIG_SPL_BSS_MAX_SIZE=0x100000
-CONFIG_SYS_SPL_MALLOC=y
+CONFIG_SPL_SYS_MALLOC=y
 CONFIG_SPL_I2C=y
 CONFIG_SYS_MAXARGS=32
 CONFIG_SYS_PBSIZE=532
diff --git a/configs/imx8mm-cl-iot-gate-optee_defconfig b/configs/imx8mm-cl-iot-gate-optee_defconfig
index 11fdc7ffe81..f94be32cf0a 100644
--- a/configs/imx8mm-cl-iot-gate-optee_defconfig
+++ b/configs/imx8mm-cl-iot-gate-optee_defconfig
@@ -31,10 +31,10 @@ CONFIG_SPL_BSS_START_ADDR=0x910000
 CONFIG_SPL_BSS_MAX_SIZE=0x2000
 CONFIG_SPL_BOARD_INIT=y
 # CONFIG_SPL_SHARES_INIT_SP_ADDR is not set
-CONFIG_SYS_SPL_MALLOC=y
-CONFIG_HAS_CUSTOM_SPL_MALLOC_START=y
-CONFIG_CUSTOM_SYS_SPL_MALLOC_ADDR=0x42200000
-CONFIG_SYS_SPL_MALLOC_SIZE=0x80000
+CONFIG_SPL_SYS_MALLOC=y
+CONFIG_SPL_HAS_CUSTOM_MALLOC_START=y
+CONFIG_SPL_CUSTOM_SYS_MALLOC_ADDR=0x42200000
+CONFIG_SPL_SYS_MALLOC_SIZE=0x80000
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR=y
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0x300
 CONFIG_SPL_I2C=y
diff --git a/configs/imx8mm-cl-iot-gate_defconfig b/configs/imx8mm-cl-iot-gate_defconfig
index bdabb80edbb..92c9b90c2a4 100644
--- a/configs/imx8mm-cl-iot-gate_defconfig
+++ b/configs/imx8mm-cl-iot-gate_defconfig
@@ -33,10 +33,10 @@ CONFIG_SPL_BSS_START_ADDR=0x910000
 CONFIG_SPL_BSS_MAX_SIZE=0x2000
 CONFIG_SPL_BOARD_INIT=y
 # CONFIG_SPL_SHARES_INIT_SP_ADDR is not set
-CONFIG_SYS_SPL_MALLOC=y
-CONFIG_HAS_CUSTOM_SPL_MALLOC_START=y
-CONFIG_CUSTOM_SYS_SPL_MALLOC_ADDR=0x42200000
-CONFIG_SYS_SPL_MALLOC_SIZE=0x80000
+CONFIG_SPL_SYS_MALLOC=y
+CONFIG_SPL_HAS_CUSTOM_MALLOC_START=y
+CONFIG_SPL_CUSTOM_SYS_MALLOC_ADDR=0x42200000
+CONFIG_SPL_SYS_MALLOC_SIZE=0x80000
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR=y
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0x300
 CONFIG_SPL_I2C=y
diff --git a/configs/imx8mm-icore-mx8mm-ctouch2_defconfig b/configs/imx8mm-icore-mx8mm-ctouch2_defconfig
index 6d283ec562c..523224820de 100644
--- a/configs/imx8mm-icore-mx8mm-ctouch2_defconfig
+++ b/configs/imx8mm-icore-mx8mm-ctouch2_defconfig
@@ -30,10 +30,10 @@ CONFIG_SPL_BSS_START_ADDR=0x910000
 CONFIG_SPL_BSS_MAX_SIZE=0x2000
 CONFIG_SPL_BOARD_INIT=y
 # CONFIG_SPL_SHARES_INIT_SP_ADDR is not set
-CONFIG_SYS_SPL_MALLOC=y
-CONFIG_HAS_CUSTOM_SPL_MALLOC_START=y
-CONFIG_CUSTOM_SYS_SPL_MALLOC_ADDR=0x42200000
-CONFIG_SYS_SPL_MALLOC_SIZE=0x80000
+CONFIG_SPL_SYS_MALLOC=y
+CONFIG_SPL_HAS_CUSTOM_MALLOC_START=y
+CONFIG_SPL_CUSTOM_SYS_MALLOC_ADDR=0x42200000
+CONFIG_SPL_SYS_MALLOC_SIZE=0x80000
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR=y
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0x300
 CONFIG_SPL_POWER=y
diff --git a/configs/imx8mm-icore-mx8mm-edimm2.2_defconfig b/configs/imx8mm-icore-mx8mm-edimm2.2_defconfig
index 38c0c87b22f..19160437f14 100644
--- a/configs/imx8mm-icore-mx8mm-edimm2.2_defconfig
+++ b/configs/imx8mm-icore-mx8mm-edimm2.2_defconfig
@@ -30,10 +30,10 @@ CONFIG_SPL_BSS_START_ADDR=0x910000
 CONFIG_SPL_BSS_MAX_SIZE=0x2000
 CONFIG_SPL_BOARD_INIT=y
 # CONFIG_SPL_SHARES_INIT_SP_ADDR is not set
-CONFIG_SYS_SPL_MALLOC=y
-CONFIG_HAS_CUSTOM_SPL_MALLOC_START=y
-CONFIG_CUSTOM_SYS_SPL_MALLOC_ADDR=0x42200000
-CONFIG_SYS_SPL_MALLOC_SIZE=0x80000
+CONFIG_SPL_SYS_MALLOC=y
+CONFIG_SPL_HAS_CUSTOM_MALLOC_START=y
+CONFIG_SPL_CUSTOM_SYS_MALLOC_ADDR=0x42200000
+CONFIG_SPL_SYS_MALLOC_SIZE=0x80000
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR=y
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0x300
 CONFIG_SPL_POWER=y
diff --git a/configs/imx8mm-mx8menlo_defconfig b/configs/imx8mm-mx8menlo_defconfig
index 13bd1951512..6dff20e739d 100644
--- a/configs/imx8mm-mx8menlo_defconfig
+++ b/configs/imx8mm-mx8menlo_defconfig
@@ -43,10 +43,10 @@ CONFIG_SPL_BSS_START_ADDR=0x910000
 CONFIG_SPL_BSS_MAX_SIZE=0x2000
 CONFIG_SPL_BOARD_INIT=y
 # CONFIG_SPL_SHARES_INIT_SP_ADDR is not set
-CONFIG_SYS_SPL_MALLOC=y
-CONFIG_HAS_CUSTOM_SPL_MALLOC_START=y
-CONFIG_CUSTOM_SYS_SPL_MALLOC_ADDR=0x42200000
-CONFIG_SYS_SPL_MALLOC_SIZE=0x80000
+CONFIG_SPL_SYS_MALLOC=y
+CONFIG_SPL_HAS_CUSTOM_MALLOC_START=y
+CONFIG_SPL_CUSTOM_SYS_MALLOC_ADDR=0x42200000
+CONFIG_SPL_SYS_MALLOC_SIZE=0x80000
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR=y
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0x300
 CONFIG_SPL_I2C=y
diff --git a/configs/imx8mm_beacon_defconfig b/configs/imx8mm_beacon_defconfig
index 52edb2ed19d..de4ea8496f7 100644
--- a/configs/imx8mm_beacon_defconfig
+++ b/configs/imx8mm_beacon_defconfig
@@ -33,10 +33,10 @@ CONFIG_SPL_HAS_BSS_LINKER_SECTION=y
 CONFIG_SPL_BSS_START_ADDR=0x910000
 CONFIG_SPL_BSS_MAX_SIZE=0x2000
 # CONFIG_SPL_SHARES_INIT_SP_ADDR is not set
-CONFIG_SYS_SPL_MALLOC=y
-CONFIG_HAS_CUSTOM_SPL_MALLOC_START=y
-CONFIG_CUSTOM_SYS_SPL_MALLOC_ADDR=0x42200000
-CONFIG_SYS_SPL_MALLOC_SIZE=0x80000
+CONFIG_SPL_SYS_MALLOC=y
+CONFIG_SPL_HAS_CUSTOM_MALLOC_START=y
+CONFIG_SPL_CUSTOM_SYS_MALLOC_ADDR=0x42200000
+CONFIG_SPL_SYS_MALLOC_SIZE=0x80000
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR=y
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0x300
 CONFIG_SPL_I2C=y
diff --git a/configs/imx8mm_beacon_fspi_defconfig b/configs/imx8mm_beacon_fspi_defconfig
index e1b75d6416f..a3cdd069db7 100644
--- a/configs/imx8mm_beacon_fspi_defconfig
+++ b/configs/imx8mm_beacon_fspi_defconfig
@@ -36,10 +36,10 @@ CONFIG_SPL_BSS_START_ADDR=0x910000
 CONFIG_SPL_BSS_MAX_SIZE=0x2000
 CONFIG_SPL_BOARD_INIT=y
 # CONFIG_SPL_SHARES_INIT_SP_ADDR is not set
-CONFIG_SYS_SPL_MALLOC=y
-CONFIG_HAS_CUSTOM_SPL_MALLOC_START=y
-CONFIG_CUSTOM_SYS_SPL_MALLOC_ADDR=0x42200000
-CONFIG_SYS_SPL_MALLOC_SIZE=0x80000
+CONFIG_SPL_SYS_MALLOC=y
+CONFIG_SPL_HAS_CUSTOM_MALLOC_START=y
+CONFIG_SPL_CUSTOM_SYS_MALLOC_ADDR=0x42200000
+CONFIG_SPL_SYS_MALLOC_SIZE=0x80000
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR=y
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0x300
 CONFIG_SPL_I2C=y
diff --git a/configs/imx8mm_data_modul_edm_sbc_defconfig b/configs/imx8mm_data_modul_edm_sbc_defconfig
index e2bca406113..b201d833e5d 100644
--- a/configs/imx8mm_data_modul_edm_sbc_defconfig
+++ b/configs/imx8mm_data_modul_edm_sbc_defconfig
@@ -54,10 +54,10 @@ CONFIG_SPL_BSS_MAX_SIZE=0x2000
 CONFIG_SPL_LEGACY_IMAGE_FORMAT=y
 CONFIG_SPL_LEGACY_IMAGE_CRC_CHECK=y
 # CONFIG_SPL_SHARES_INIT_SP_ADDR is not set
-CONFIG_SYS_SPL_MALLOC=y
-CONFIG_HAS_CUSTOM_SPL_MALLOC_START=y
-CONFIG_CUSTOM_SYS_SPL_MALLOC_ADDR=0x42200000
-CONFIG_SYS_SPL_MALLOC_SIZE=0x1000000
+CONFIG_SPL_SYS_MALLOC=y
+CONFIG_SPL_HAS_CUSTOM_MALLOC_START=y
+CONFIG_SPL_CUSTOM_SYS_MALLOC_ADDR=0x42200000
+CONFIG_SPL_SYS_MALLOC_SIZE=0x1000000
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR=y
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0x300
 CONFIG_SPL_I2C=y
diff --git a/configs/imx8mm_evk_defconfig b/configs/imx8mm_evk_defconfig
index ac9810fe1b7..361e8144140 100644
--- a/configs/imx8mm_evk_defconfig
+++ b/configs/imx8mm_evk_defconfig
@@ -31,10 +31,10 @@ CONFIG_SPL_BSS_START_ADDR=0x910000
 CONFIG_SPL_BSS_MAX_SIZE=0x2000
 CONFIG_SPL_BOARD_INIT=y
 # CONFIG_SPL_SHARES_INIT_SP_ADDR is not set
-CONFIG_SYS_SPL_MALLOC=y
-CONFIG_HAS_CUSTOM_SPL_MALLOC_START=y
-CONFIG_CUSTOM_SYS_SPL_MALLOC_ADDR=0x42200000
-CONFIG_SYS_SPL_MALLOC_SIZE=0x80000
+CONFIG_SPL_SYS_MALLOC=y
+CONFIG_SPL_HAS_CUSTOM_MALLOC_START=y
+CONFIG_SPL_CUSTOM_SYS_MALLOC_ADDR=0x42200000
+CONFIG_SPL_SYS_MALLOC_SIZE=0x80000
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR=y
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0x300
 CONFIG_SPL_I2C=y
diff --git a/configs/imx8mm_evk_fspi_defconfig b/configs/imx8mm_evk_fspi_defconfig
index 75f0a950289..2308022053d 100644
--- a/configs/imx8mm_evk_fspi_defconfig
+++ b/configs/imx8mm_evk_fspi_defconfig
@@ -34,10 +34,10 @@ CONFIG_SPL_BSS_START_ADDR=0x910000
 CONFIG_SPL_BSS_MAX_SIZE=0x2000
 CONFIG_SPL_BOARD_INIT=y
 # CONFIG_SPL_SHARES_INIT_SP_ADDR is not set
-CONFIG_SYS_SPL_MALLOC=y
-CONFIG_HAS_CUSTOM_SPL_MALLOC_START=y
-CONFIG_CUSTOM_SYS_SPL_MALLOC_ADDR=0x42200000
-CONFIG_SYS_SPL_MALLOC_SIZE=0x80000
+CONFIG_SPL_SYS_MALLOC=y
+CONFIG_SPL_HAS_CUSTOM_MALLOC_START=y
+CONFIG_SPL_CUSTOM_SYS_MALLOC_ADDR=0x42200000
+CONFIG_SPL_SYS_MALLOC_SIZE=0x80000
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR=y
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0x300
 CONFIG_SPL_I2C=y
diff --git a/configs/imx8mm_phg_defconfig b/configs/imx8mm_phg_defconfig
index 9fdce5c8b52..23e2c116312 100644
--- a/configs/imx8mm_phg_defconfig
+++ b/configs/imx8mm_phg_defconfig
@@ -31,10 +31,10 @@ CONFIG_SPL_BSS_START_ADDR=0x910000
 CONFIG_SPL_BSS_MAX_SIZE=0x2000
 CONFIG_SPL_BOARD_INIT=y
 # CONFIG_SPL_SHARES_INIT_SP_ADDR is not set
-CONFIG_SYS_SPL_MALLOC=y
-CONFIG_HAS_CUSTOM_SPL_MALLOC_START=y
-CONFIG_CUSTOM_SYS_SPL_MALLOC_ADDR=0x42200000
-CONFIG_SYS_SPL_MALLOC_SIZE=0x80000
+CONFIG_SPL_SYS_MALLOC=y
+CONFIG_SPL_HAS_CUSTOM_MALLOC_START=y
+CONFIG_SPL_CUSTOM_SYS_MALLOC_ADDR=0x42200000
+CONFIG_SPL_SYS_MALLOC_SIZE=0x80000
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR=y
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0x300
 CONFIG_SPL_I2C=y
diff --git a/configs/imx8mm_venice_defconfig b/configs/imx8mm_venice_defconfig
index a485910a529..c584294c07d 100644
--- a/configs/imx8mm_venice_defconfig
+++ b/configs/imx8mm_venice_defconfig
@@ -38,9 +38,9 @@ CONFIG_SPL_BSS_START_ADDR=0x910000
 CONFIG_SPL_BSS_MAX_SIZE=0x2000
 CONFIG_SPL_BOARD_INIT=y
 # CONFIG_SPL_SHARES_INIT_SP_ADDR is not set
-CONFIG_SYS_SPL_MALLOC=y
-CONFIG_HAS_CUSTOM_SPL_MALLOC_START=y
-CONFIG_CUSTOM_SYS_SPL_MALLOC_ADDR=0x42200000
+CONFIG_SPL_SYS_MALLOC=y
+CONFIG_SPL_HAS_CUSTOM_MALLOC_START=y
+CONFIG_SPL_CUSTOM_SYS_MALLOC_ADDR=0x42200000
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR=y
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0x300
 CONFIG_SPL_I2C=y
diff --git a/configs/imx8mn_beacon_2g_defconfig b/configs/imx8mn_beacon_2g_defconfig
index 975fcc2481a..3508bd88146 100644
--- a/configs/imx8mn_beacon_2g_defconfig
+++ b/configs/imx8mn_beacon_2g_defconfig
@@ -43,10 +43,10 @@ CONFIG_SPL_BSS_MAX_SIZE=0x2000
 CONFIG_SPL_BOARD_INIT=y
 CONFIG_SPL_BOOTROM_SUPPORT=y
 # CONFIG_SPL_SHARES_INIT_SP_ADDR is not set
-CONFIG_SYS_SPL_MALLOC=y
-CONFIG_HAS_CUSTOM_SPL_MALLOC_START=y
-CONFIG_CUSTOM_SYS_SPL_MALLOC_ADDR=0x42200000
-CONFIG_SYS_SPL_MALLOC_SIZE=0x80000
+CONFIG_SPL_SYS_MALLOC=y
+CONFIG_SPL_HAS_CUSTOM_MALLOC_START=y
+CONFIG_SPL_CUSTOM_SYS_MALLOC_ADDR=0x42200000
+CONFIG_SPL_SYS_MALLOC_SIZE=0x80000
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR=y
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0x300
 CONFIG_SPL_I2C=y
diff --git a/configs/imx8mn_beacon_defconfig b/configs/imx8mn_beacon_defconfig
index f4ecdc88f39..c3263f96d0f 100644
--- a/configs/imx8mn_beacon_defconfig
+++ b/configs/imx8mn_beacon_defconfig
@@ -42,10 +42,10 @@ CONFIG_SPL_BSS_MAX_SIZE=0x2000
 CONFIG_SPL_BOARD_INIT=y
 CONFIG_SPL_BOOTROM_SUPPORT=y
 # CONFIG_SPL_SHARES_INIT_SP_ADDR is not set
-CONFIG_SYS_SPL_MALLOC=y
-CONFIG_HAS_CUSTOM_SPL_MALLOC_START=y
-CONFIG_CUSTOM_SYS_SPL_MALLOC_ADDR=0x42200000
-CONFIG_SYS_SPL_MALLOC_SIZE=0x80000
+CONFIG_SPL_SYS_MALLOC=y
+CONFIG_SPL_HAS_CUSTOM_MALLOC_START=y
+CONFIG_SPL_CUSTOM_SYS_MALLOC_ADDR=0x42200000
+CONFIG_SPL_SYS_MALLOC_SIZE=0x80000
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR=y
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0x300
 CONFIG_SPL_I2C=y
diff --git a/configs/imx8mn_beacon_fspi_defconfig b/configs/imx8mn_beacon_fspi_defconfig
index f5e57fb50bc..26db542d3be 100644
--- a/configs/imx8mn_beacon_fspi_defconfig
+++ b/configs/imx8mn_beacon_fspi_defconfig
@@ -42,10 +42,10 @@ CONFIG_SPL_BSS_MAX_SIZE=0x2000
 CONFIG_SPL_BOARD_INIT=y
 CONFIG_SPL_BOOTROM_SUPPORT=y
 # CONFIG_SPL_SHARES_INIT_SP_ADDR is not set
-CONFIG_SYS_SPL_MALLOC=y
-CONFIG_HAS_CUSTOM_SPL_MALLOC_START=y
-CONFIG_CUSTOM_SYS_SPL_MALLOC_ADDR=0x42200000
-CONFIG_SYS_SPL_MALLOC_SIZE=0x80000
+CONFIG_SPL_SYS_MALLOC=y
+CONFIG_SPL_HAS_CUSTOM_MALLOC_START=y
+CONFIG_SPL_CUSTOM_SYS_MALLOC_ADDR=0x42200000
+CONFIG_SPL_SYS_MALLOC_SIZE=0x80000
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR=y
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0x300
 CONFIG_SPL_I2C=y
diff --git a/configs/imx8mn_bsh_smm_s2_defconfig b/configs/imx8mn_bsh_smm_s2_defconfig
index f356b9cc466..735cc5d1044 100644
--- a/configs/imx8mn_bsh_smm_s2_defconfig
+++ b/configs/imx8mn_bsh_smm_s2_defconfig
@@ -36,10 +36,10 @@ CONFIG_SPL_BSS_MAX_SIZE=0x2000
 CONFIG_SPL_BOARD_INIT=y
 CONFIG_SPL_BOOTROM_SUPPORT=y
 # CONFIG_SPL_SHARES_INIT_SP_ADDR is not set
-CONFIG_SYS_SPL_MALLOC=y
-CONFIG_HAS_CUSTOM_SPL_MALLOC_START=y
-CONFIG_CUSTOM_SYS_SPL_MALLOC_ADDR=0x42200000
-CONFIG_SYS_SPL_MALLOC_SIZE=0x80000
+CONFIG_SPL_SYS_MALLOC=y
+CONFIG_SPL_HAS_CUSTOM_MALLOC_START=y
+CONFIG_SPL_CUSTOM_SYS_MALLOC_ADDR=0x42200000
+CONFIG_SPL_SYS_MALLOC_SIZE=0x80000
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR=y
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0x300
 CONFIG_SPL_DMA=y
diff --git a/configs/imx8mn_bsh_smm_s2pro_defconfig b/configs/imx8mn_bsh_smm_s2pro_defconfig
index 57d11310284..96f752b7fea 100644
--- a/configs/imx8mn_bsh_smm_s2pro_defconfig
+++ b/configs/imx8mn_bsh_smm_s2pro_defconfig
@@ -37,10 +37,10 @@ CONFIG_SPL_BSS_MAX_SIZE=0x2000
 CONFIG_SPL_BOARD_INIT=y
 CONFIG_SPL_BOOTROM_SUPPORT=y
 # CONFIG_SPL_SHARES_INIT_SP_ADDR is not set
-CONFIG_SYS_SPL_MALLOC=y
-CONFIG_HAS_CUSTOM_SPL_MALLOC_START=y
-CONFIG_CUSTOM_SYS_SPL_MALLOC_ADDR=0x42200000
-CONFIG_SYS_SPL_MALLOC_SIZE=0x80000
+CONFIG_SPL_SYS_MALLOC=y
+CONFIG_SPL_HAS_CUSTOM_MALLOC_START=y
+CONFIG_SPL_CUSTOM_SYS_MALLOC_ADDR=0x42200000
+CONFIG_SPL_SYS_MALLOC_SIZE=0x80000
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR=y
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0x300
 CONFIG_SPL_I2C=y
diff --git a/configs/imx8mn_ddr4_evk_defconfig b/configs/imx8mn_ddr4_evk_defconfig
index 4faeb473fa7..9f1670bf6bc 100644
--- a/configs/imx8mn_ddr4_evk_defconfig
+++ b/configs/imx8mn_ddr4_evk_defconfig
@@ -35,10 +35,10 @@ CONFIG_SPL_BSS_MAX_SIZE=0x2000
 CONFIG_SPL_BOARD_INIT=y
 CONFIG_SPL_BOOTROM_SUPPORT=y
 # CONFIG_SPL_SHARES_INIT_SP_ADDR is not set
-CONFIG_SYS_SPL_MALLOC=y
-CONFIG_HAS_CUSTOM_SPL_MALLOC_START=y
-CONFIG_CUSTOM_SYS_SPL_MALLOC_ADDR=0x42200000
-CONFIG_SYS_SPL_MALLOC_SIZE=0x80000
+CONFIG_SPL_SYS_MALLOC=y
+CONFIG_SPL_HAS_CUSTOM_MALLOC_START=y
+CONFIG_SPL_CUSTOM_SYS_MALLOC_ADDR=0x42200000
+CONFIG_SPL_SYS_MALLOC_SIZE=0x80000
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR=y
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0x300
 CONFIG_SPL_I2C=y
diff --git a/configs/imx8mn_evk_defconfig b/configs/imx8mn_evk_defconfig
index 230ce6be374..535129bb679 100644
--- a/configs/imx8mn_evk_defconfig
+++ b/configs/imx8mn_evk_defconfig
@@ -38,10 +38,10 @@ CONFIG_SPL_BOOTROM_SUPPORT=y
 CONFIG_SPL_LEGACY_IMAGE_FORMAT=y
 CONFIG_SPL_LEGACY_IMAGE_CRC_CHECK=y
 # CONFIG_SPL_SHARES_INIT_SP_ADDR is not set
-CONFIG_SYS_SPL_MALLOC=y
-CONFIG_HAS_CUSTOM_SPL_MALLOC_START=y
-CONFIG_CUSTOM_SYS_SPL_MALLOC_ADDR=0x42200000
-CONFIG_SYS_SPL_MALLOC_SIZE=0x80000
+CONFIG_SPL_SYS_MALLOC=y
+CONFIG_SPL_HAS_CUSTOM_MALLOC_START=y
+CONFIG_SPL_CUSTOM_SYS_MALLOC_ADDR=0x42200000
+CONFIG_SPL_SYS_MALLOC_SIZE=0x80000
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR=y
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0x300
 CONFIG_SPL_I2C=y
diff --git a/configs/imx8mn_var_som_defconfig b/configs/imx8mn_var_som_defconfig
index b346b14ebdd..9ae0902c69a 100644
--- a/configs/imx8mn_var_som_defconfig
+++ b/configs/imx8mn_var_som_defconfig
@@ -40,10 +40,10 @@ CONFIG_SPL_BSS_MAX_SIZE=0x2000
 CONFIG_SPL_BOARD_INIT=y
 CONFIG_SPL_BOOTROM_SUPPORT=y
 # CONFIG_SPL_SHARES_INIT_SP_ADDR is not set
-CONFIG_SYS_SPL_MALLOC=y
-CONFIG_HAS_CUSTOM_SPL_MALLOC_START=y
-CONFIG_CUSTOM_SYS_SPL_MALLOC_ADDR=0x42200000
-CONFIG_SYS_SPL_MALLOC_SIZE=0x80000
+CONFIG_SPL_SYS_MALLOC=y
+CONFIG_SPL_HAS_CUSTOM_MALLOC_START=y
+CONFIG_SPL_CUSTOM_SYS_MALLOC_ADDR=0x42200000
+CONFIG_SPL_SYS_MALLOC_SIZE=0x80000
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR=y
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0x300
 CONFIG_SPL_I2C=y
diff --git a/configs/imx8mn_venice_defconfig b/configs/imx8mn_venice_defconfig
index 39f930ae2ca..ff016373f75 100644
--- a/configs/imx8mn_venice_defconfig
+++ b/configs/imx8mn_venice_defconfig
@@ -41,10 +41,10 @@ CONFIG_SPL_BSS_MAX_SIZE=0x2000
 CONFIG_SPL_BOARD_INIT=y
 CONFIG_SPL_BOOTROM_SUPPORT=y
 # CONFIG_SPL_SHARES_INIT_SP_ADDR is not set
-CONFIG_SYS_SPL_MALLOC=y
-CONFIG_HAS_CUSTOM_SPL_MALLOC_START=y
-CONFIG_CUSTOM_SYS_SPL_MALLOC_ADDR=0x42200000
-CONFIG_SYS_SPL_MALLOC_SIZE=0x80000
+CONFIG_SPL_SYS_MALLOC=y
+CONFIG_SPL_HAS_CUSTOM_MALLOC_START=y
+CONFIG_SPL_CUSTOM_SYS_MALLOC_ADDR=0x42200000
+CONFIG_SPL_SYS_MALLOC_SIZE=0x80000
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR=y
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0x300
 CONFIG_SPL_I2C=y
diff --git a/configs/imx8mp-icore-mx8mp-edimm2.2_defconfig b/configs/imx8mp-icore-mx8mp-edimm2.2_defconfig
index 494be362172..1642ad1eb31 100644
--- a/configs/imx8mp-icore-mx8mp-edimm2.2_defconfig
+++ b/configs/imx8mp-icore-mx8mp-edimm2.2_defconfig
@@ -38,10 +38,10 @@ CONFIG_SPL_BOARD_INIT=y
 CONFIG_SPL_BOOTROM_SUPPORT=y
 CONFIG_SPL_SYS_MALLOC_SIMPLE=y
 # CONFIG_SPL_SHARES_INIT_SP_ADDR is not set
-CONFIG_SYS_SPL_MALLOC=y
-CONFIG_HAS_CUSTOM_SPL_MALLOC_START=y
-CONFIG_CUSTOM_SYS_SPL_MALLOC_ADDR=0x42200000
-CONFIG_SYS_SPL_MALLOC_SIZE=0x80000
+CONFIG_SPL_SYS_MALLOC=y
+CONFIG_SPL_HAS_CUSTOM_MALLOC_START=y
+CONFIG_SPL_CUSTOM_SYS_MALLOC_ADDR=0x42200000
+CONFIG_SPL_SYS_MALLOC_SIZE=0x80000
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR=y
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0x300
 CONFIG_SPL_I2C=y
diff --git a/configs/imx8mp_beacon_defconfig b/configs/imx8mp_beacon_defconfig
index c6a3e35e73a..5c9de2e0026 100644
--- a/configs/imx8mp_beacon_defconfig
+++ b/configs/imx8mp_beacon_defconfig
@@ -52,10 +52,10 @@ CONFIG_SPL_BOARD_INIT=y
 CONFIG_SPL_BOOTROM_SUPPORT=y
 CONFIG_SPL_SYS_MALLOC_SIMPLE=y
 # CONFIG_SPL_SHARES_INIT_SP_ADDR is not set
-CONFIG_SYS_SPL_MALLOC=y
-CONFIG_HAS_CUSTOM_SPL_MALLOC_START=y
-CONFIG_CUSTOM_SYS_SPL_MALLOC_ADDR=0x42200000
-CONFIG_SYS_SPL_MALLOC_SIZE=0x80000
+CONFIG_SPL_SYS_MALLOC=y
+CONFIG_SPL_HAS_CUSTOM_MALLOC_START=y
+CONFIG_SPL_CUSTOM_SYS_MALLOC_ADDR=0x42200000
+CONFIG_SPL_SYS_MALLOC_SIZE=0x80000
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR=y
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0x300
 CONFIG_SPL_I2C=y
diff --git a/configs/imx8mp_data_modul_edm_sbc_defconfig b/configs/imx8mp_data_modul_edm_sbc_defconfig
index d3b629caf5c..fa8c2ff6e2a 100644
--- a/configs/imx8mp_data_modul_edm_sbc_defconfig
+++ b/configs/imx8mp_data_modul_edm_sbc_defconfig
@@ -60,10 +60,10 @@ CONFIG_SPL_BSS_MAX_SIZE=0x400
 CONFIG_SPL_BOOTROM_SUPPORT=y
 # CONFIG_SPL_RAW_IMAGE_SUPPORT is not set
 # CONFIG_SPL_SHARES_INIT_SP_ADDR is not set
-CONFIG_SYS_SPL_MALLOC=y
-CONFIG_HAS_CUSTOM_SPL_MALLOC_START=y
-CONFIG_CUSTOM_SYS_SPL_MALLOC_ADDR=0x4c000000
-CONFIG_SYS_SPL_MALLOC_SIZE=0x80000
+CONFIG_SPL_SYS_MALLOC=y
+CONFIG_SPL_HAS_CUSTOM_MALLOC_START=y
+CONFIG_SPL_CUSTOM_SYS_MALLOC_ADDR=0x4c000000
+CONFIG_SPL_SYS_MALLOC_SIZE=0x80000
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR=y
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0x300
 CONFIG_SPL_I2C=y
diff --git a/configs/imx8mp_dhcom_pdk2_defconfig b/configs/imx8mp_dhcom_pdk2_defconfig
index 24c87aae781..e30bb437cb0 100644
--- a/configs/imx8mp_dhcom_pdk2_defconfig
+++ b/configs/imx8mp_dhcom_pdk2_defconfig
@@ -58,10 +58,10 @@ CONFIG_SPL_BSS_MAX_SIZE=0x400
 CONFIG_SPL_BOOTROM_SUPPORT=y
 # CONFIG_SPL_RAW_IMAGE_SUPPORT is not set
 # CONFIG_SPL_SHARES_INIT_SP_ADDR is not set
-CONFIG_SYS_SPL_MALLOC=y
-CONFIG_HAS_CUSTOM_SPL_MALLOC_START=y
-CONFIG_CUSTOM_SYS_SPL_MALLOC_ADDR=0x4c000000
-CONFIG_SYS_SPL_MALLOC_SIZE=0x80000
+CONFIG_SPL_SYS_MALLOC=y
+CONFIG_SPL_HAS_CUSTOM_MALLOC_START=y
+CONFIG_SPL_CUSTOM_SYS_MALLOC_ADDR=0x4c000000
+CONFIG_SPL_SYS_MALLOC_SIZE=0x80000
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR=y
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0x300
 CONFIG_SPL_I2C=y
diff --git a/configs/imx8mp_dhcom_pdk3_defconfig b/configs/imx8mp_dhcom_pdk3_defconfig
index 3e89e0f8293..c955ef64091 100644
--- a/configs/imx8mp_dhcom_pdk3_defconfig
+++ b/configs/imx8mp_dhcom_pdk3_defconfig
@@ -59,10 +59,10 @@ CONFIG_SPL_BSS_MAX_SIZE=0x400
 CONFIG_SPL_BOOTROM_SUPPORT=y
 # CONFIG_SPL_RAW_IMAGE_SUPPORT is not set
 # CONFIG_SPL_SHARES_INIT_SP_ADDR is not set
-CONFIG_SYS_SPL_MALLOC=y
-CONFIG_HAS_CUSTOM_SPL_MALLOC_START=y
-CONFIG_CUSTOM_SYS_SPL_MALLOC_ADDR=0x4c000000
-CONFIG_SYS_SPL_MALLOC_SIZE=0x80000
+CONFIG_SPL_SYS_MALLOC=y
+CONFIG_SPL_HAS_CUSTOM_MALLOC_START=y
+CONFIG_SPL_CUSTOM_SYS_MALLOC_ADDR=0x4c000000
+CONFIG_SPL_SYS_MALLOC_SIZE=0x80000
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR=y
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0x300
 CONFIG_SPL_I2C=y
diff --git a/configs/imx8mp_evk_defconfig b/configs/imx8mp_evk_defconfig
index 73e30db4eed..9596b11d90c 100644
--- a/configs/imx8mp_evk_defconfig
+++ b/configs/imx8mp_evk_defconfig
@@ -38,10 +38,10 @@ CONFIG_SPL_BOARD_INIT=y
 CONFIG_SPL_BOOTROM_SUPPORT=y
 CONFIG_SPL_SYS_MALLOC_SIMPLE=y
 # CONFIG_SPL_SHARES_INIT_SP_ADDR is not set
-CONFIG_SYS_SPL_MALLOC=y
-CONFIG_HAS_CUSTOM_SPL_MALLOC_START=y
-CONFIG_CUSTOM_SYS_SPL_MALLOC_ADDR=0x42200000
-CONFIG_SYS_SPL_MALLOC_SIZE=0x80000
+CONFIG_SPL_SYS_MALLOC=y
+CONFIG_SPL_HAS_CUSTOM_MALLOC_START=y
+CONFIG_SPL_CUSTOM_SYS_MALLOC_ADDR=0x42200000
+CONFIG_SPL_SYS_MALLOC_SIZE=0x80000
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR=y
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0x300
 CONFIG_SPL_I2C=y
diff --git a/configs/imx8mp_rsb3720a1_4G_defconfig b/configs/imx8mp_rsb3720a1_4G_defconfig
index 02ce80c7832..e6a1cc09eca 100644
--- a/configs/imx8mp_rsb3720a1_4G_defconfig
+++ b/configs/imx8mp_rsb3720a1_4G_defconfig
@@ -47,10 +47,10 @@ CONFIG_SPL_BOARD_INIT=y
 CONFIG_SPL_BOOTROM_SUPPORT=y
 CONFIG_SPL_SYS_MALLOC_SIMPLE=y
 # CONFIG_SPL_SHARES_INIT_SP_ADDR is not set
-CONFIG_SYS_SPL_MALLOC=y
-CONFIG_HAS_CUSTOM_SPL_MALLOC_START=y
-CONFIG_CUSTOM_SYS_SPL_MALLOC_ADDR=0x42200000
-CONFIG_SYS_SPL_MALLOC_SIZE=0x80000
+CONFIG_SPL_SYS_MALLOC=y
+CONFIG_SPL_HAS_CUSTOM_MALLOC_START=y
+CONFIG_SPL_CUSTOM_SYS_MALLOC_ADDR=0x42200000
+CONFIG_SPL_SYS_MALLOC_SIZE=0x80000
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR=y
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0x300
 CONFIG_SPL_I2C=y
diff --git a/configs/imx8mp_rsb3720a1_6G_defconfig b/configs/imx8mp_rsb3720a1_6G_defconfig
index d0bf25a6f5f..8838936e124 100644
--- a/configs/imx8mp_rsb3720a1_6G_defconfig
+++ b/configs/imx8mp_rsb3720a1_6G_defconfig
@@ -47,10 +47,10 @@ CONFIG_SPL_BOARD_INIT=y
 CONFIG_SPL_BOOTROM_SUPPORT=y
 CONFIG_SPL_SYS_MALLOC_SIMPLE=y
 # CONFIG_SPL_SHARES_INIT_SP_ADDR is not set
-CONFIG_SYS_SPL_MALLOC=y
-CONFIG_HAS_CUSTOM_SPL_MALLOC_START=y
-CONFIG_CUSTOM_SYS_SPL_MALLOC_ADDR=0x42200000
-CONFIG_SYS_SPL_MALLOC_SIZE=0x80000
+CONFIG_SPL_SYS_MALLOC=y
+CONFIG_SPL_HAS_CUSTOM_MALLOC_START=y
+CONFIG_SPL_CUSTOM_SYS_MALLOC_ADDR=0x42200000
+CONFIG_SPL_SYS_MALLOC_SIZE=0x80000
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR=y
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0x300
 CONFIG_SPL_I2C=y
diff --git a/configs/imx8mp_venice_defconfig b/configs/imx8mp_venice_defconfig
index 294206ba8b2..82485529ae0 100644
--- a/configs/imx8mp_venice_defconfig
+++ b/configs/imx8mp_venice_defconfig
@@ -41,10 +41,10 @@ CONFIG_SPL_BSS_MAX_SIZE=0x400
 CONFIG_SPL_BOARD_INIT=y
 CONFIG_SPL_BOOTROM_SUPPORT=y
 # CONFIG_SPL_SHARES_INIT_SP_ADDR is not set
-CONFIG_SYS_SPL_MALLOC=y
-CONFIG_HAS_CUSTOM_SPL_MALLOC_START=y
-CONFIG_CUSTOM_SYS_SPL_MALLOC_ADDR=0x42200000
-CONFIG_SYS_SPL_MALLOC_SIZE=0x80000
+CONFIG_SPL_SYS_MALLOC=y
+CONFIG_SPL_HAS_CUSTOM_MALLOC_START=y
+CONFIG_SPL_CUSTOM_SYS_MALLOC_ADDR=0x42200000
+CONFIG_SPL_SYS_MALLOC_SIZE=0x80000
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR=y
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0x300
 CONFIG_SPL_I2C=y
diff --git a/configs/imx8mq_cm_defconfig b/configs/imx8mq_cm_defconfig
index 89a7485bd1d..fd08e35f079 100644
--- a/configs/imx8mq_cm_defconfig
+++ b/configs/imx8mq_cm_defconfig
@@ -35,10 +35,10 @@ CONFIG_SPL_BSS_START_ADDR=0x180000
 CONFIG_SPL_BSS_MAX_SIZE=0x2000
 CONFIG_SPL_BOARD_INIT=y
 # CONFIG_SPL_SHARES_INIT_SP_ADDR is not set
-CONFIG_SYS_SPL_MALLOC=y
-CONFIG_HAS_CUSTOM_SPL_MALLOC_START=y
-CONFIG_CUSTOM_SYS_SPL_MALLOC_ADDR=0x42200000
-CONFIG_SYS_SPL_MALLOC_SIZE=0x80000
+CONFIG_SPL_SYS_MALLOC=y
+CONFIG_SPL_HAS_CUSTOM_MALLOC_START=y
+CONFIG_SPL_CUSTOM_SYS_MALLOC_ADDR=0x42200000
+CONFIG_SPL_SYS_MALLOC_SIZE=0x80000
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR=y
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0x300
 CONFIG_SPL_I2C=y
diff --git a/configs/imx8mq_evk_defconfig b/configs/imx8mq_evk_defconfig
index 7b135bf9fad..674d15c5bf6 100644
--- a/configs/imx8mq_evk_defconfig
+++ b/configs/imx8mq_evk_defconfig
@@ -38,10 +38,10 @@ CONFIG_SPL_BSS_START_ADDR=0x180000
 CONFIG_SPL_BSS_MAX_SIZE=0x2000
 CONFIG_SPL_BOARD_INIT=y
 # CONFIG_SPL_SHARES_INIT_SP_ADDR is not set
-CONFIG_SYS_SPL_MALLOC=y
-CONFIG_HAS_CUSTOM_SPL_MALLOC_START=y
-CONFIG_CUSTOM_SYS_SPL_MALLOC_ADDR=0x42200000
-CONFIG_SYS_SPL_MALLOC_SIZE=0x80000
+CONFIG_SPL_SYS_MALLOC=y
+CONFIG_SPL_HAS_CUSTOM_MALLOC_START=y
+CONFIG_SPL_CUSTOM_SYS_MALLOC_ADDR=0x42200000
+CONFIG_SPL_SYS_MALLOC_SIZE=0x80000
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR=y
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0x300
 CONFIG_SPL_I2C=y
diff --git a/configs/imx8mq_phanbell_defconfig b/configs/imx8mq_phanbell_defconfig
index 114ddab10b4..875cf54925b 100644
--- a/configs/imx8mq_phanbell_defconfig
+++ b/configs/imx8mq_phanbell_defconfig
@@ -38,10 +38,10 @@ CONFIG_SPL_BSS_START_ADDR=0x180000
 CONFIG_SPL_BSS_MAX_SIZE=0x2000
 CONFIG_SPL_BOARD_INIT=y
 # CONFIG_SPL_SHARES_INIT_SP_ADDR is not set
-CONFIG_SYS_SPL_MALLOC=y
-CONFIG_HAS_CUSTOM_SPL_MALLOC_START=y
-CONFIG_CUSTOM_SYS_SPL_MALLOC_ADDR=0x42200000
-CONFIG_SYS_SPL_MALLOC_SIZE=0x80000
+CONFIG_SPL_SYS_MALLOC=y
+CONFIG_SPL_HAS_CUSTOM_MALLOC_START=y
+CONFIG_SPL_CUSTOM_SYS_MALLOC_ADDR=0x42200000
+CONFIG_SPL_SYS_MALLOC_SIZE=0x80000
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR=y
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0x300
 CONFIG_SPL_I2C=y
diff --git a/configs/imx8mq_reform2_defconfig b/configs/imx8mq_reform2_defconfig
index a17a180d433..da0d424f2ad 100644
--- a/configs/imx8mq_reform2_defconfig
+++ b/configs/imx8mq_reform2_defconfig
@@ -41,10 +41,10 @@ CONFIG_SPL_BSS_START_ADDR=0x180000
 CONFIG_SPL_BSS_MAX_SIZE=0x2000
 CONFIG_SPL_BOARD_INIT=y
 # CONFIG_SPL_SHARES_INIT_SP_ADDR is not set
-CONFIG_SYS_SPL_MALLOC=y
-CONFIG_HAS_CUSTOM_SPL_MALLOC_START=y
-CONFIG_CUSTOM_SYS_SPL_MALLOC_ADDR=0x42200000
-CONFIG_SYS_SPL_MALLOC_SIZE=0x80000
+CONFIG_SPL_SYS_MALLOC=y
+CONFIG_SPL_HAS_CUSTOM_MALLOC_START=y
+CONFIG_SPL_CUSTOM_SYS_MALLOC_ADDR=0x42200000
+CONFIG_SPL_SYS_MALLOC_SIZE=0x80000
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR=y
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0x300
 CONFIG_SPL_I2C=y
diff --git a/configs/imx8qm_mek_defconfig b/configs/imx8qm_mek_defconfig
index 7f7a20e5a2f..0336b96b000 100644
--- a/configs/imx8qm_mek_defconfig
+++ b/configs/imx8qm_mek_defconfig
@@ -40,10 +40,10 @@ CONFIG_SPL_BSS_MAX_SIZE=0x1000
 CONFIG_SPL_BOARD_INIT=y
 CONFIG_SPL_SYS_MALLOC_SIMPLE=y
 # CONFIG_SPL_SHARES_INIT_SP_ADDR is not set
-CONFIG_SYS_SPL_MALLOC=y
-CONFIG_HAS_CUSTOM_SPL_MALLOC_START=y
-CONFIG_CUSTOM_SYS_SPL_MALLOC_ADDR=0x120000
-CONFIG_SYS_SPL_MALLOC_SIZE=0x3000
+CONFIG_SPL_SYS_MALLOC=y
+CONFIG_SPL_HAS_CUSTOM_MALLOC_START=y
+CONFIG_SPL_CUSTOM_SYS_MALLOC_ADDR=0x120000
+CONFIG_SPL_SYS_MALLOC_SIZE=0x3000
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR=y
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0x800
 CONFIG_SPL_POWER_DOMAIN=y
diff --git a/configs/imx8qxp_mek_defconfig b/configs/imx8qxp_mek_defconfig
index f34b988c2e1..2c83e97bbf4 100644
--- a/configs/imx8qxp_mek_defconfig
+++ b/configs/imx8qxp_mek_defconfig
@@ -40,10 +40,10 @@ CONFIG_SPL_BSS_MAX_SIZE=0x1000
 CONFIG_SPL_BOARD_INIT=y
 CONFIG_SPL_SYS_MALLOC_SIMPLE=y
 # CONFIG_SPL_SHARES_INIT_SP_ADDR is not set
-CONFIG_SYS_SPL_MALLOC=y
-CONFIG_HAS_CUSTOM_SPL_MALLOC_START=y
-CONFIG_CUSTOM_SYS_SPL_MALLOC_ADDR=0x120000
-CONFIG_SYS_SPL_MALLOC_SIZE=0x3000
+CONFIG_SPL_SYS_MALLOC=y
+CONFIG_SPL_HAS_CUSTOM_MALLOC_START=y
+CONFIG_SPL_CUSTOM_SYS_MALLOC_ADDR=0x120000
+CONFIG_SPL_SYS_MALLOC_SIZE=0x3000
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR=y
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0x800
 CONFIG_SPL_POWER_DOMAIN=y
diff --git a/configs/imx8ulp_evk_defconfig b/configs/imx8ulp_evk_defconfig
index c08db70b96f..40a4dca250c 100644
--- a/configs/imx8ulp_evk_defconfig
+++ b/configs/imx8ulp_evk_defconfig
@@ -37,10 +37,10 @@ CONFIG_SPL_BSS_MAX_SIZE=0x2000
 CONFIG_SPL_BOARD_INIT=y
 CONFIG_SPL_BOOTROM_SUPPORT=y
 # CONFIG_SPL_SHARES_INIT_SP_ADDR is not set
-CONFIG_SYS_SPL_MALLOC=y
-CONFIG_HAS_CUSTOM_SPL_MALLOC_START=y
-CONFIG_CUSTOM_SYS_SPL_MALLOC_ADDR=0x22040000
-CONFIG_SYS_SPL_MALLOC_SIZE=0x8000
+CONFIG_SPL_SYS_MALLOC=y
+CONFIG_SPL_HAS_CUSTOM_MALLOC_START=y
+CONFIG_SPL_CUSTOM_SYS_MALLOC_ADDR=0x22040000
+CONFIG_SPL_SYS_MALLOC_SIZE=0x8000
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR=y
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0x300
 CONFIG_SPL_WATCHDOG=y
diff --git a/configs/imx93_11x11_evk_defconfig b/configs/imx93_11x11_evk_defconfig
index 65f473885c6..2de5ee4e9b4 100644
--- a/configs/imx93_11x11_evk_defconfig
+++ b/configs/imx93_11x11_evk_defconfig
@@ -35,10 +35,10 @@ CONFIG_SPL_BSS_MAX_SIZE=0x2000
 CONFIG_SPL_BOARD_INIT=y
 CONFIG_SPL_BOOTROM_SUPPORT=y
 # CONFIG_SPL_SHARES_INIT_SP_ADDR is not set
-CONFIG_SYS_SPL_MALLOC=y
-CONFIG_HAS_CUSTOM_SPL_MALLOC_START=y
-CONFIG_CUSTOM_SYS_SPL_MALLOC_ADDR=0x83200000
-CONFIG_SYS_SPL_MALLOC_SIZE=0x80000
+CONFIG_SPL_SYS_MALLOC=y
+CONFIG_SPL_HAS_CUSTOM_MALLOC_START=y
+CONFIG_SPL_CUSTOM_SYS_MALLOC_ADDR=0x83200000
+CONFIG_SPL_SYS_MALLOC_SIZE=0x80000
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR=y
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0x1040
 CONFIG_SPL_I2C=y
diff --git a/configs/imx93_11x11_evk_ld_defconfig b/configs/imx93_11x11_evk_ld_defconfig
index 27165da8b97..08975151620 100644
--- a/configs/imx93_11x11_evk_ld_defconfig
+++ b/configs/imx93_11x11_evk_ld_defconfig
@@ -36,10 +36,10 @@ CONFIG_SPL_BSS_MAX_SIZE=0x2000
 CONFIG_SPL_BOARD_INIT=y
 CONFIG_SPL_BOOTROM_SUPPORT=y
 # CONFIG_SPL_SHARES_INIT_SP_ADDR is not set
-CONFIG_SYS_SPL_MALLOC=y
-CONFIG_HAS_CUSTOM_SPL_MALLOC_START=y
-CONFIG_CUSTOM_SYS_SPL_MALLOC_ADDR=0x83200000
-CONFIG_SYS_SPL_MALLOC_SIZE=0x80000
+CONFIG_SPL_SYS_MALLOC=y
+CONFIG_SPL_HAS_CUSTOM_MALLOC_START=y
+CONFIG_SPL_CUSTOM_SYS_MALLOC_ADDR=0x83200000
+CONFIG_SPL_SYS_MALLOC_SIZE=0x80000
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR=y
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0x1040
 CONFIG_SPL_I2C=y
diff --git a/configs/iot2050_defconfig b/configs/iot2050_defconfig
index bcbaa92ee89..bdd85d43824 100644
--- a/configs/iot2050_defconfig
+++ b/configs/iot2050_defconfig
@@ -50,8 +50,8 @@ CONFIG_SPL_BSS_MAX_SIZE=0x80000
 CONFIG_SPL_BOARD_INIT=y
 CONFIG_SPL_SYS_MALLOC_SIMPLE=y
 CONFIG_SPL_STACK_R=y
-CONFIG_SYS_SPL_MALLOC=y
-CONFIG_SYS_SPL_MALLOC_SIZE=0x800000
+CONFIG_SPL_SYS_MALLOC=y
+CONFIG_SPL_SYS_MALLOC_SIZE=0x800000
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR=y
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0x1400
 CONFIG_SPL_DM_MAILBOX=y
diff --git a/configs/j7200_evm_a72_defconfig b/configs/j7200_evm_a72_defconfig
index ba5914d3b60..e392553a7ee 100644
--- a/configs/j7200_evm_a72_defconfig
+++ b/configs/j7200_evm_a72_defconfig
@@ -42,8 +42,8 @@ CONFIG_SPL_BSS_MAX_SIZE=0x80000
 CONFIG_SPL_BOARD_INIT=y
 CONFIG_SPL_SYS_MALLOC_SIMPLE=y
 CONFIG_SPL_STACK_R=y
-CONFIG_SYS_SPL_MALLOC=y
-CONFIG_SYS_SPL_MALLOC_SIZE=0x800000
+CONFIG_SPL_SYS_MALLOC=y
+CONFIG_SPL_SYS_MALLOC_SIZE=0x800000
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR=y
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0x1800
 CONFIG_SPL_DMA=y
diff --git a/configs/j7200_evm_r5_defconfig b/configs/j7200_evm_r5_defconfig
index c4dd33627bd..42ff450aa08 100644
--- a/configs/j7200_evm_r5_defconfig
+++ b/configs/j7200_evm_r5_defconfig
@@ -37,10 +37,10 @@ CONFIG_SPL_BSS_MAX_SIZE=0xa000
 CONFIG_SPL_BOARD_INIT=y
 CONFIG_SPL_STACK_R=y
 CONFIG_SPL_SEPARATE_BSS=y
-CONFIG_SYS_SPL_MALLOC=y
-CONFIG_HAS_CUSTOM_SPL_MALLOC_START=y
-CONFIG_CUSTOM_SYS_SPL_MALLOC_ADDR=0x84000000
-CONFIG_SYS_SPL_MALLOC_SIZE=0x1000000
+CONFIG_SPL_SYS_MALLOC=y
+CONFIG_SPL_HAS_CUSTOM_MALLOC_START=y
+CONFIG_SPL_CUSTOM_SYS_MALLOC_ADDR=0x84000000
+CONFIG_SPL_SYS_MALLOC_SIZE=0x1000000
 CONFIG_SPL_EARLY_BSS=y
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR=y
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0x800
diff --git a/configs/j721e_evm_a72_defconfig b/configs/j721e_evm_a72_defconfig
index 214fa8b2f35..3f36d655a9e 100644
--- a/configs/j721e_evm_a72_defconfig
+++ b/configs/j721e_evm_a72_defconfig
@@ -42,8 +42,8 @@ CONFIG_SPL_BSS_MAX_SIZE=0x80000
 CONFIG_SPL_BOARD_INIT=y
 CONFIG_SPL_SYS_MALLOC_SIMPLE=y
 CONFIG_SPL_STACK_R=y
-CONFIG_SYS_SPL_MALLOC=y
-CONFIG_SYS_SPL_MALLOC_SIZE=0x800000
+CONFIG_SPL_SYS_MALLOC=y
+CONFIG_SPL_SYS_MALLOC_SIZE=0x800000
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR=y
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0x1400
 CONFIG_SPL_DMA=y
diff --git a/configs/j721e_evm_r5_defconfig b/configs/j721e_evm_r5_defconfig
index cf7bc872b5f..803b38bd39b 100644
--- a/configs/j721e_evm_r5_defconfig
+++ b/configs/j721e_evm_r5_defconfig
@@ -42,10 +42,10 @@ CONFIG_SPL_BSS_MAX_SIZE=0xa000
 CONFIG_SPL_BOARD_INIT=y
 CONFIG_SPL_STACK_R=y
 CONFIG_SPL_SEPARATE_BSS=y
-CONFIG_SYS_SPL_MALLOC=y
-CONFIG_HAS_CUSTOM_SPL_MALLOC_START=y
-CONFIG_CUSTOM_SYS_SPL_MALLOC_ADDR=0x84000000
-CONFIG_SYS_SPL_MALLOC_SIZE=0x1000000
+CONFIG_SPL_SYS_MALLOC=y
+CONFIG_SPL_HAS_CUSTOM_MALLOC_START=y
+CONFIG_SPL_CUSTOM_SYS_MALLOC_ADDR=0x84000000
+CONFIG_SPL_SYS_MALLOC_SIZE=0x1000000
 CONFIG_SPL_EARLY_BSS=y
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR=y
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0x400
diff --git a/configs/j721s2_evm_a72_defconfig b/configs/j721s2_evm_a72_defconfig
index 09addcbb25d..df7f6b0f07a 100644
--- a/configs/j721s2_evm_a72_defconfig
+++ b/configs/j721s2_evm_a72_defconfig
@@ -41,8 +41,8 @@ CONFIG_SPL_BSS_MAX_SIZE=0x80000
 CONFIG_SPL_BOARD_INIT=y
 CONFIG_SPL_SYS_MALLOC_SIMPLE=y
 CONFIG_SPL_STACK_R=y
-CONFIG_SYS_SPL_MALLOC=y
-CONFIG_SYS_SPL_MALLOC_SIZE=0x800000
+CONFIG_SPL_SYS_MALLOC=y
+CONFIG_SPL_SYS_MALLOC_SIZE=0x800000
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR=y
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0x1400
 CONFIG_SPL_DMA=y
diff --git a/configs/j721s2_evm_r5_defconfig b/configs/j721s2_evm_r5_defconfig
index 1e66ac23d05..6fd90defd59 100644
--- a/configs/j721s2_evm_r5_defconfig
+++ b/configs/j721s2_evm_r5_defconfig
@@ -43,10 +43,10 @@ CONFIG_SPL_BOARD_INIT=y
 CONFIG_SPL_SYS_MALLOC_SIMPLE=y
 CONFIG_SPL_STACK_R=y
 CONFIG_SPL_SEPARATE_BSS=y
-CONFIG_SYS_SPL_MALLOC=y
-CONFIG_HAS_CUSTOM_SPL_MALLOC_START=y
-CONFIG_CUSTOM_SYS_SPL_MALLOC_ADDR=0x84000000
-CONFIG_SYS_SPL_MALLOC_SIZE=0x1000000
+CONFIG_SPL_SYS_MALLOC=y
+CONFIG_SPL_HAS_CUSTOM_MALLOC_START=y
+CONFIG_SPL_CUSTOM_SYS_MALLOC_ADDR=0x84000000
+CONFIG_SPL_SYS_MALLOC_SIZE=0x1000000
 CONFIG_SPL_EARLY_BSS=y
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR=y
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0x400
diff --git a/configs/jetson-tk1_defconfig b/configs/jetson-tk1_defconfig
index d8086281582..01f84c4ef2b 100644
--- a/configs/jetson-tk1_defconfig
+++ b/configs/jetson-tk1_defconfig
@@ -24,10 +24,10 @@ CONFIG_SYS_STDIO_DEREGISTER=y
 CONFIG_SPL_FOOTPRINT_LIMIT=y
 CONFIG_SPL_MAX_FOOTPRINT=0x8000
 # CONFIG_SPL_SHARES_INIT_SP_ADDR is not set
-CONFIG_SYS_SPL_MALLOC=y
-CONFIG_HAS_CUSTOM_SPL_MALLOC_START=y
-CONFIG_CUSTOM_SYS_SPL_MALLOC_ADDR=0x80090000
-CONFIG_SYS_SPL_MALLOC_SIZE=0x10000
+CONFIG_SPL_SYS_MALLOC=y
+CONFIG_SPL_HAS_CUSTOM_MALLOC_START=y
+CONFIG_SPL_CUSTOM_SYS_MALLOC_ADDR=0x80090000
+CONFIG_SPL_SYS_MALLOC_SIZE=0x10000
 CONFIG_SYS_MAXARGS=64
 CONFIG_SYS_PBSIZE=2089
 # CONFIG_CMD_IMI is not set
diff --git a/configs/k2e_evm_defconfig b/configs/k2e_evm_defconfig
index 44bed00ec97..7eea78d000d 100644
--- a/configs/k2e_evm_defconfig
+++ b/configs/k2e_evm_defconfig
@@ -36,8 +36,8 @@ CONFIG_SPL_HAS_BSS_LINKER_SECTION=y
 CONFIG_SPL_BSS_START_ADDR=0xc10fff8
 CONFIG_SPL_BSS_MAX_SIZE=0x8000
 # CONFIG_SPL_SHARES_INIT_SP_ADDR is not set
-CONFIG_SYS_SPL_MALLOC=y
-CONFIG_SYS_SPL_MALLOC_SIZE=0x8000
+CONFIG_SPL_SYS_MALLOC=y
+CONFIG_SPL_SYS_MALLOC_SIZE=0x8000
 CONFIG_SPL_I2C=y
 CONFIG_SPL_NAND_DRIVERS=y
 CONFIG_SPL_NAND_ECC=y
diff --git a/configs/k2g_evm_defconfig b/configs/k2g_evm_defconfig
index 45c7fade320..98b9dcb6999 100644
--- a/configs/k2g_evm_defconfig
+++ b/configs/k2g_evm_defconfig
@@ -35,8 +35,8 @@ CONFIG_SPL_HAS_BSS_LINKER_SECTION=y
 CONFIG_SPL_BSS_START_ADDR=0xc0afff8
 CONFIG_SPL_BSS_MAX_SIZE=0x8000
 # CONFIG_SPL_SHARES_INIT_SP_ADDR is not set
-CONFIG_SYS_SPL_MALLOC=y
-CONFIG_SYS_SPL_MALLOC_SIZE=0x8000
+CONFIG_SPL_SYS_MALLOC=y
+CONFIG_SPL_SYS_MALLOC_SIZE=0x8000
 CONFIG_SPL_I2C=y
 CONFIG_SPL_NAND_DRIVERS=y
 CONFIG_SPL_NAND_ECC=y
diff --git a/configs/k2hk_evm_defconfig b/configs/k2hk_evm_defconfig
index a2651780484..21aa3943132 100644
--- a/configs/k2hk_evm_defconfig
+++ b/configs/k2hk_evm_defconfig
@@ -36,8 +36,8 @@ CONFIG_SPL_HAS_BSS_LINKER_SECTION=y
 CONFIG_SPL_BSS_START_ADDR=0xc20fff8
 CONFIG_SPL_BSS_MAX_SIZE=0x8000
 # CONFIG_SPL_SHARES_INIT_SP_ADDR is not set
-CONFIG_SYS_SPL_MALLOC=y
-CONFIG_SYS_SPL_MALLOC_SIZE=0x8000
+CONFIG_SPL_SYS_MALLOC=y
+CONFIG_SPL_SYS_MALLOC_SIZE=0x8000
 CONFIG_SPL_I2C=y
 CONFIG_SPL_NAND_DRIVERS=y
 CONFIG_SPL_NAND_ECC=y
diff --git a/configs/k2l_evm_defconfig b/configs/k2l_evm_defconfig
index 55ddd3cce96..4c9e79c1a8d 100644
--- a/configs/k2l_evm_defconfig
+++ b/configs/k2l_evm_defconfig
@@ -36,8 +36,8 @@ CONFIG_SPL_HAS_BSS_LINKER_SECTION=y
 CONFIG_SPL_BSS_START_ADDR=0xc10fff8
 CONFIG_SPL_BSS_MAX_SIZE=0x8000
 # CONFIG_SPL_SHARES_INIT_SP_ADDR is not set
-CONFIG_SYS_SPL_MALLOC=y
-CONFIG_SYS_SPL_MALLOC_SIZE=0x8000
+CONFIG_SPL_SYS_MALLOC=y
+CONFIG_SPL_SYS_MALLOC_SIZE=0x8000
 CONFIG_SPL_I2C=y
 CONFIG_SPL_NAND_DRIVERS=y
 CONFIG_SPL_NAND_ECC=y
diff --git a/configs/kontron-sl-mx6ul_defconfig b/configs/kontron-sl-mx6ul_defconfig
index d54e60395d2..3e38b4978a4 100644
--- a/configs/kontron-sl-mx6ul_defconfig
+++ b/configs/kontron-sl-mx6ul_defconfig
@@ -33,7 +33,7 @@ CONFIG_BOARD_EARLY_INIT_F=y
 CONFIG_SPL_RAW_IMAGE_SUPPORT=y
 CONFIG_SPL_LEGACY_IMAGE_FORMAT=y
 CONFIG_SPL_LEGACY_IMAGE_CRC_CHECK=y
-CONFIG_SYS_SPL_MALLOC=y
+CONFIG_SPL_SYS_MALLOC=y
 CONFIG_SPL_SPI_LOAD=y
 CONFIG_SYS_SPI_U_BOOT_OFFS=0x11400
 CONFIG_SPL_WATCHDOG=y
diff --git a/configs/kontron-sl-mx8mm_defconfig b/configs/kontron-sl-mx8mm_defconfig
index 9558cf1a2d1..3d7d3c2fa59 100644
--- a/configs/kontron-sl-mx8mm_defconfig
+++ b/configs/kontron-sl-mx8mm_defconfig
@@ -38,10 +38,10 @@ CONFIG_SPL_BSS_START_ADDR=0x910000
 CONFIG_SPL_BSS_MAX_SIZE=0x2000
 CONFIG_SPL_BOARD_INIT=y
 # CONFIG_SPL_SHARES_INIT_SP_ADDR is not set
-CONFIG_SYS_SPL_MALLOC=y
-CONFIG_HAS_CUSTOM_SPL_MALLOC_START=y
-CONFIG_CUSTOM_SYS_SPL_MALLOC_ADDR=0x42200000
-CONFIG_SYS_SPL_MALLOC_SIZE=0x80000
+CONFIG_SPL_SYS_MALLOC=y
+CONFIG_SPL_HAS_CUSTOM_MALLOC_START=y
+CONFIG_SPL_CUSTOM_SYS_MALLOC_ADDR=0x42200000
+CONFIG_SPL_SYS_MALLOC_SIZE=0x80000
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR=y
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0x300
 CONFIG_SPL_I2C=y
diff --git a/configs/kontron_pitx_imx8m_defconfig b/configs/kontron_pitx_imx8m_defconfig
index 295cc51c4fd..01c54e7d233 100644
--- a/configs/kontron_pitx_imx8m_defconfig
+++ b/configs/kontron_pitx_imx8m_defconfig
@@ -37,10 +37,10 @@ CONFIG_SPL_HAS_BSS_LINKER_SECTION=y
 CONFIG_SPL_BSS_START_ADDR=0x180000
 CONFIG_SPL_BSS_MAX_SIZE=0x2000
 # CONFIG_SPL_SHARES_INIT_SP_ADDR is not set
-CONFIG_SYS_SPL_MALLOC=y
-CONFIG_HAS_CUSTOM_SPL_MALLOC_START=y
-CONFIG_CUSTOM_SYS_SPL_MALLOC_ADDR=0x42200000
-CONFIG_SYS_SPL_MALLOC_SIZE=0x80000
+CONFIG_SPL_SYS_MALLOC=y
+CONFIG_SPL_HAS_CUSTOM_MALLOC_START=y
+CONFIG_SPL_CUSTOM_SYS_MALLOC_ADDR=0x42200000
+CONFIG_SPL_SYS_MALLOC_SIZE=0x80000
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR=y
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0x300
 CONFIG_SPL_I2C=y
diff --git a/configs/kontron_sl28_defconfig b/configs/kontron_sl28_defconfig
index 21a397933e7..c5c95d11c36 100644
--- a/configs/kontron_sl28_defconfig
+++ b/configs/kontron_sl28_defconfig
@@ -47,7 +47,7 @@ CONFIG_SPL_BSS_START_ADDR=0x80100000
 CONFIG_SPL_BSS_MAX_SIZE=0x100000
 CONFIG_SPL_BOARD_INIT=y
 # CONFIG_SPL_SHARES_INIT_SP_ADDR is not set
-CONFIG_SYS_SPL_MALLOC=y
+CONFIG_SPL_SYS_MALLOC=y
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR=y
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0x900
 CONFIG_SPL_MPC8XXX_INIT_DDR=y
diff --git a/configs/kp_imx6q_tpc_defconfig b/configs/kp_imx6q_tpc_defconfig
index dbfb0bafec1..3a7763c4435 100644
--- a/configs/kp_imx6q_tpc_defconfig
+++ b/configs/kp_imx6q_tpc_defconfig
@@ -28,7 +28,7 @@ CONFIG_AUTOBOOT_STOP_STR="."
 # CONFIG_USE_BOOTCOMMAND is not set
 CONFIG_SYS_CONSOLE_OVERWRITE_ROUTINE=y
 CONFIG_SPL_RAW_IMAGE_SUPPORT=y
-CONFIG_SYS_SPL_MALLOC=y
+CONFIG_SPL_SYS_MALLOC=y
 CONFIG_SPL_POWER=y
 CONFIG_SPL_WATCHDOG=y
 CONFIG_SYS_MAXARGS=32
diff --git a/configs/librem5_defconfig b/configs/librem5_defconfig
index 973b2ea20c4..21b84e4be80 100644
--- a/configs/librem5_defconfig
+++ b/configs/librem5_defconfig
@@ -42,10 +42,10 @@ CONFIG_SPL_BSS_START_ADDR=0x180000
 CONFIG_SPL_BSS_MAX_SIZE=0x2000
 CONFIG_SPL_BOARD_INIT=y
 # CONFIG_SPL_SHARES_INIT_SP_ADDR is not set
-CONFIG_SYS_SPL_MALLOC=y
-CONFIG_HAS_CUSTOM_SPL_MALLOC_START=y
-CONFIG_CUSTOM_SYS_SPL_MALLOC_ADDR=0x42200000
-CONFIG_SYS_SPL_MALLOC_SIZE=0x80000
+CONFIG_SPL_SYS_MALLOC=y
+CONFIG_SPL_HAS_CUSTOM_MALLOC_START=y
+CONFIG_SPL_CUSTOM_SYS_MALLOC_ADDR=0x42200000
+CONFIG_SPL_SYS_MALLOC_SIZE=0x80000
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR=y
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0x300
 CONFIG_SPL_I2C=y
diff --git a/configs/liteboard_defconfig b/configs/liteboard_defconfig
index 83be20fb907..1ff5b3c0cbe 100644
--- a/configs/liteboard_defconfig
+++ b/configs/liteboard_defconfig
@@ -25,7 +25,7 @@ CONFIG_USE_BOOTCOMMAND=y
 CONFIG_BOOTCOMMAND="mmc dev ${mmcdev};if mmc rescan; then if run loadbootscript; then run bootscript; else if run loadimage; then run mmcboot; else run netboot; fi; fi; else run netboot; fi"
 CONFIG_DEFAULT_FDT_FILE="imx6ul-liteboard.dtb"
 CONFIG_BOARD_EARLY_INIT_F=y
-CONFIG_SYS_SPL_MALLOC=y
+CONFIG_SPL_SYS_MALLOC=y
 CONFIG_SPL_WATCHDOG=y
 CONFIG_HUSH_PARSER=y
 CONFIG_SYS_MAXARGS=32
diff --git a/configs/ls1021aiot_sdcard_defconfig b/configs/ls1021aiot_sdcard_defconfig
index b271792570e..22b861584a3 100644
--- a/configs/ls1021aiot_sdcard_defconfig
+++ b/configs/ls1021aiot_sdcard_defconfig
@@ -44,9 +44,9 @@ CONFIG_SPL_BSS_START_ADDR=0x80100000
 CONFIG_SPL_BSS_MAX_SIZE=0x80000
 CONFIG_SPL_FSL_PBL=y
 # CONFIG_SPL_SHARES_INIT_SP_ADDR is not set
-CONFIG_SYS_SPL_MALLOC=y
-CONFIG_HAS_CUSTOM_SPL_MALLOC_START=y
-CONFIG_CUSTOM_SYS_SPL_MALLOC_ADDR=0x82080000
+CONFIG_SPL_SYS_MALLOC=y
+CONFIG_SPL_HAS_CUSTOM_MALLOC_START=y
+CONFIG_SPL_CUSTOM_SYS_MALLOC_ADDR=0x82080000
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR=y
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0xe8
 CONFIG_SPL_ENV_SUPPORT=y
diff --git a/configs/ls1021aqds_nand_defconfig b/configs/ls1021aqds_nand_defconfig
index ee569eaac6c..b9636d3140a 100644
--- a/configs/ls1021aqds_nand_defconfig
+++ b/configs/ls1021aqds_nand_defconfig
@@ -54,9 +54,9 @@ CONFIG_SPL_BSS_START_ADDR=0x80100000
 CONFIG_SPL_BSS_MAX_SIZE=0x80000
 CONFIG_SPL_FSL_PBL=y
 # CONFIG_SPL_SHARES_INIT_SP_ADDR is not set
-CONFIG_SYS_SPL_MALLOC=y
-CONFIG_HAS_CUSTOM_SPL_MALLOC_START=y
-CONFIG_CUSTOM_SYS_SPL_MALLOC_ADDR=0x80200000
+CONFIG_SPL_SYS_MALLOC=y
+CONFIG_SPL_HAS_CUSTOM_MALLOC_START=y
+CONFIG_SPL_CUSTOM_SYS_MALLOC_ADDR=0x80200000
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR=y
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0xe8
 CONFIG_SPL_ENV_SUPPORT=y
diff --git a/configs/ls1021aqds_sdcard_ifc_defconfig b/configs/ls1021aqds_sdcard_ifc_defconfig
index 25bd6c72a55..c5d01354af1 100644
--- a/configs/ls1021aqds_sdcard_ifc_defconfig
+++ b/configs/ls1021aqds_sdcard_ifc_defconfig
@@ -53,9 +53,9 @@ CONFIG_SPL_BSS_START_ADDR=0x80100000
 CONFIG_SPL_BSS_MAX_SIZE=0x80000
 CONFIG_SPL_FSL_PBL=y
 # CONFIG_SPL_SHARES_INIT_SP_ADDR is not set
-CONFIG_SYS_SPL_MALLOC=y
-CONFIG_HAS_CUSTOM_SPL_MALLOC_START=y
-CONFIG_CUSTOM_SYS_SPL_MALLOC_ADDR=0x820c0000
+CONFIG_SPL_SYS_MALLOC=y
+CONFIG_SPL_HAS_CUSTOM_MALLOC_START=y
+CONFIG_SPL_CUSTOM_SYS_MALLOC_ADDR=0x820c0000
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR=y
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0xe8
 CONFIG_SPL_ENV_SUPPORT=y
diff --git a/configs/ls1021aqds_sdcard_qspi_defconfig b/configs/ls1021aqds_sdcard_qspi_defconfig
index 2845386007f..8e4b2183612 100644
--- a/configs/ls1021aqds_sdcard_qspi_defconfig
+++ b/configs/ls1021aqds_sdcard_qspi_defconfig
@@ -52,9 +52,9 @@ CONFIG_SPL_BSS_START_ADDR=0x80100000
 CONFIG_SPL_BSS_MAX_SIZE=0x80000
 CONFIG_SPL_FSL_PBL=y
 # CONFIG_SPL_SHARES_INIT_SP_ADDR is not set
-CONFIG_SYS_SPL_MALLOC=y
-CONFIG_HAS_CUSTOM_SPL_MALLOC_START=y
-CONFIG_CUSTOM_SYS_SPL_MALLOC_ADDR=0x820c0000
+CONFIG_SPL_SYS_MALLOC=y
+CONFIG_SPL_HAS_CUSTOM_MALLOC_START=y
+CONFIG_SPL_CUSTOM_SYS_MALLOC_ADDR=0x820c0000
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR=y
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0xe8
 CONFIG_SPL_ENV_SUPPORT=y
diff --git a/configs/ls1021atsn_sdcard_defconfig b/configs/ls1021atsn_sdcard_defconfig
index 7a8b157926b..d10482705ab 100644
--- a/configs/ls1021atsn_sdcard_defconfig
+++ b/configs/ls1021atsn_sdcard_defconfig
@@ -46,9 +46,9 @@ CONFIG_SPL_BSS_START_ADDR=0x80100000
 CONFIG_SPL_BSS_MAX_SIZE=0x80000
 CONFIG_SPL_FSL_PBL=y
 # CONFIG_SPL_SHARES_INIT_SP_ADDR is not set
-CONFIG_SYS_SPL_MALLOC=y
-CONFIG_HAS_CUSTOM_SPL_MALLOC_START=y
-CONFIG_CUSTOM_SYS_SPL_MALLOC_ADDR=0x82100000
+CONFIG_SPL_SYS_MALLOC=y
+CONFIG_SPL_HAS_CUSTOM_MALLOC_START=y
+CONFIG_SPL_CUSTOM_SYS_MALLOC_ADDR=0x82100000
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR=y
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0xe8
 CONFIG_SPL_ENV_SUPPORT=y
diff --git a/configs/ls1021atwr_sdcard_ifc_SECURE_BOOT_defconfig b/configs/ls1021atwr_sdcard_ifc_SECURE_BOOT_defconfig
index 4a42427b001..0b895747ce4 100644
--- a/configs/ls1021atwr_sdcard_ifc_SECURE_BOOT_defconfig
+++ b/configs/ls1021atwr_sdcard_ifc_SECURE_BOOT_defconfig
@@ -54,9 +54,9 @@ CONFIG_SPL_BSS_START_ADDR=0x80100000
 CONFIG_SPL_BSS_MAX_SIZE=0x80000
 CONFIG_SPL_FSL_PBL=y
 # CONFIG_SPL_SHARES_INIT_SP_ADDR is not set
-CONFIG_SYS_SPL_MALLOC=y
-CONFIG_HAS_CUSTOM_SPL_MALLOC_START=y
-CONFIG_CUSTOM_SYS_SPL_MALLOC_ADDR=0x82104000
+CONFIG_SPL_SYS_MALLOC=y
+CONFIG_SPL_HAS_CUSTOM_MALLOC_START=y
+CONFIG_SPL_CUSTOM_SYS_MALLOC_ADDR=0x82104000
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR=y
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0xe8
 CONFIG_SPL_ENV_SUPPORT=y
diff --git a/configs/ls1021atwr_sdcard_ifc_defconfig b/configs/ls1021atwr_sdcard_ifc_defconfig
index 34b229e6f23..52712bb390e 100644
--- a/configs/ls1021atwr_sdcard_ifc_defconfig
+++ b/configs/ls1021atwr_sdcard_ifc_defconfig
@@ -55,9 +55,9 @@ CONFIG_SPL_BSS_START_ADDR=0x80100000
 CONFIG_SPL_BSS_MAX_SIZE=0x80000
 CONFIG_SPL_FSL_PBL=y
 # CONFIG_SPL_SHARES_INIT_SP_ADDR is not set
-CONFIG_SYS_SPL_MALLOC=y
-CONFIG_HAS_CUSTOM_SPL_MALLOC_START=y
-CONFIG_CUSTOM_SYS_SPL_MALLOC_ADDR=0x82100000
+CONFIG_SPL_SYS_MALLOC=y
+CONFIG_SPL_HAS_CUSTOM_MALLOC_START=y
+CONFIG_SPL_CUSTOM_SYS_MALLOC_ADDR=0x82100000
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR=y
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0xe8
 CONFIG_SPL_ENV_SUPPORT=y
diff --git a/configs/ls1021atwr_sdcard_qspi_defconfig b/configs/ls1021atwr_sdcard_qspi_defconfig
index 3738107321f..51c4c7ac6f8 100644
--- a/configs/ls1021atwr_sdcard_qspi_defconfig
+++ b/configs/ls1021atwr_sdcard_qspi_defconfig
@@ -56,9 +56,9 @@ CONFIG_SPL_BSS_START_ADDR=0x80100000
 CONFIG_SPL_BSS_MAX_SIZE=0x80000
 CONFIG_SPL_FSL_PBL=y
 # CONFIG_SPL_SHARES_INIT_SP_ADDR is not set
-CONFIG_SYS_SPL_MALLOC=y
-CONFIG_HAS_CUSTOM_SPL_MALLOC_START=y
-CONFIG_CUSTOM_SYS_SPL_MALLOC_ADDR=0x82100000
+CONFIG_SPL_SYS_MALLOC=y
+CONFIG_SPL_HAS_CUSTOM_MALLOC_START=y
+CONFIG_SPL_CUSTOM_SYS_MALLOC_ADDR=0x82100000
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR=y
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0xe8
 CONFIG_SPL_ENV_SUPPORT=y
diff --git a/configs/ls1043aqds_nand_defconfig b/configs/ls1043aqds_nand_defconfig
index e5f570a3b3c..e62261d4809 100644
--- a/configs/ls1043aqds_nand_defconfig
+++ b/configs/ls1043aqds_nand_defconfig
@@ -61,9 +61,9 @@ CONFIG_SPL_BSS_START_ADDR=0x80100000
 CONFIG_SPL_BSS_MAX_SIZE=0x80000
 CONFIG_SPL_FSL_PBL=y
 # CONFIG_SPL_SHARES_INIT_SP_ADDR is not set
-CONFIG_SYS_SPL_MALLOC=y
-CONFIG_HAS_CUSTOM_SPL_MALLOC_START=y
-CONFIG_CUSTOM_SYS_SPL_MALLOC_ADDR=0x80200000
+CONFIG_SPL_SYS_MALLOC=y
+CONFIG_SPL_HAS_CUSTOM_MALLOC_START=y
+CONFIG_SPL_CUSTOM_SYS_MALLOC_ADDR=0x80200000
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR=y
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0xf0
 CONFIG_SPL_ENV_SUPPORT=y
diff --git a/configs/ls1043aqds_sdcard_ifc_defconfig b/configs/ls1043aqds_sdcard_ifc_defconfig
index 6cb961d33dc..12ad4ce08ca 100644
--- a/configs/ls1043aqds_sdcard_ifc_defconfig
+++ b/configs/ls1043aqds_sdcard_ifc_defconfig
@@ -62,7 +62,7 @@ CONFIG_SPL_BSS_START_ADDR=0x8f000000
 CONFIG_SPL_BSS_MAX_SIZE=0x80000
 CONFIG_SPL_FSL_PBL=y
 # CONFIG_SPL_SHARES_INIT_SP_ADDR is not set
-CONFIG_SYS_SPL_MALLOC=y
+CONFIG_SPL_SYS_MALLOC=y
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR=y
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0xf0
 CONFIG_SPL_ENV_SUPPORT=y
diff --git a/configs/ls1043aqds_sdcard_qspi_defconfig b/configs/ls1043aqds_sdcard_qspi_defconfig
index 4e41508251d..813a147f810 100644
--- a/configs/ls1043aqds_sdcard_qspi_defconfig
+++ b/configs/ls1043aqds_sdcard_qspi_defconfig
@@ -62,7 +62,7 @@ CONFIG_SPL_BSS_START_ADDR=0x8f000000
 CONFIG_SPL_BSS_MAX_SIZE=0x80000
 CONFIG_SPL_FSL_PBL=y
 # CONFIG_SPL_SHARES_INIT_SP_ADDR is not set
-CONFIG_SYS_SPL_MALLOC=y
+CONFIG_SPL_SYS_MALLOC=y
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR=y
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0xf0
 CONFIG_SPL_ENV_SUPPORT=y
diff --git a/configs/ls1043ardb_nand_SECURE_BOOT_defconfig b/configs/ls1043ardb_nand_SECURE_BOOT_defconfig
index d9ff0fd16a5..316716e5421 100644
--- a/configs/ls1043ardb_nand_SECURE_BOOT_defconfig
+++ b/configs/ls1043ardb_nand_SECURE_BOOT_defconfig
@@ -46,9 +46,9 @@ CONFIG_SPL_BSS_START_ADDR=0x80100000
 CONFIG_SPL_BSS_MAX_SIZE=0x80000
 CONFIG_SPL_FSL_PBL=y
 # CONFIG_SPL_SHARES_INIT_SP_ADDR is not set
-CONFIG_SYS_SPL_MALLOC=y
-CONFIG_HAS_CUSTOM_SPL_MALLOC_START=y
-CONFIG_CUSTOM_SYS_SPL_MALLOC_ADDR=0x80200000
+CONFIG_SPL_SYS_MALLOC=y
+CONFIG_SPL_HAS_CUSTOM_MALLOC_START=y
+CONFIG_SPL_CUSTOM_SYS_MALLOC_ADDR=0x80200000
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR=y
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0xf0
 CONFIG_SPL_ENV_SUPPORT=y
diff --git a/configs/ls1043ardb_nand_defconfig b/configs/ls1043ardb_nand_defconfig
index ad118187432..9754c56e1d8 100644
--- a/configs/ls1043ardb_nand_defconfig
+++ b/configs/ls1043ardb_nand_defconfig
@@ -52,9 +52,9 @@ CONFIG_SPL_BSS_MAX_SIZE=0x80000
 CONFIG_SPL_FSL_PBL=y
 CONFIG_SPL_BOARD_INIT=y
 # CONFIG_SPL_SHARES_INIT_SP_ADDR is not set
-CONFIG_SYS_SPL_MALLOC=y
-CONFIG_HAS_CUSTOM_SPL_MALLOC_START=y
-CONFIG_CUSTOM_SYS_SPL_MALLOC_ADDR=0x80200000
+CONFIG_SPL_SYS_MALLOC=y
+CONFIG_SPL_HAS_CUSTOM_MALLOC_START=y
+CONFIG_SPL_CUSTOM_SYS_MALLOC_ADDR=0x80200000
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR=y
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0xf0
 CONFIG_SPL_ENV_SUPPORT=y
diff --git a/configs/ls1043ardb_sdcard_SECURE_BOOT_defconfig b/configs/ls1043ardb_sdcard_SECURE_BOOT_defconfig
index fe0dd04f1f9..bb4d03dcea6 100644
--- a/configs/ls1043ardb_sdcard_SECURE_BOOT_defconfig
+++ b/configs/ls1043ardb_sdcard_SECURE_BOOT_defconfig
@@ -47,7 +47,7 @@ CONFIG_SPL_BSS_START_ADDR=0x8f000000
 CONFIG_SPL_BSS_MAX_SIZE=0x80000
 CONFIG_SPL_FSL_PBL=y
 # CONFIG_SPL_SHARES_INIT_SP_ADDR is not set
-CONFIG_SYS_SPL_MALLOC=y
+CONFIG_SPL_SYS_MALLOC=y
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR=y
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0x110
 CONFIG_SPL_ENV_SUPPORT=y
diff --git a/configs/ls1043ardb_sdcard_defconfig b/configs/ls1043ardb_sdcard_defconfig
index aa5404cbb50..c9db9e30d22 100644
--- a/configs/ls1043ardb_sdcard_defconfig
+++ b/configs/ls1043ardb_sdcard_defconfig
@@ -53,7 +53,7 @@ CONFIG_SPL_BSS_MAX_SIZE=0x80000
 CONFIG_SPL_FSL_PBL=y
 CONFIG_SPL_BOARD_INIT=y
 # CONFIG_SPL_SHARES_INIT_SP_ADDR is not set
-CONFIG_SYS_SPL_MALLOC=y
+CONFIG_SPL_SYS_MALLOC=y
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR=y
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0xf0
 CONFIG_SPL_ENV_SUPPORT=y
diff --git a/configs/ls1046aqds_nand_defconfig b/configs/ls1046aqds_nand_defconfig
index 95616f97054..78b94adb24e 100644
--- a/configs/ls1046aqds_nand_defconfig
+++ b/configs/ls1046aqds_nand_defconfig
@@ -62,7 +62,7 @@ CONFIG_SPL_BSS_MAX_SIZE=0x80000
 CONFIG_SPL_FSL_PBL=y
 CONFIG_SPL_BOARD_INIT=y
 # CONFIG_SPL_SHARES_INIT_SP_ADDR is not set
-CONFIG_SYS_SPL_MALLOC=y
+CONFIG_SPL_SYS_MALLOC=y
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR=y
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0x110
 CONFIG_SPL_ENV_SUPPORT=y
diff --git a/configs/ls1046aqds_sdcard_ifc_defconfig b/configs/ls1046aqds_sdcard_ifc_defconfig
index 179fa70f4ee..75255492e82 100644
--- a/configs/ls1046aqds_sdcard_ifc_defconfig
+++ b/configs/ls1046aqds_sdcard_ifc_defconfig
@@ -63,7 +63,7 @@ CONFIG_SPL_BSS_MAX_SIZE=0x80000
 CONFIG_SPL_FSL_PBL=y
 CONFIG_SPL_BOARD_INIT=y
 # CONFIG_SPL_SHARES_INIT_SP_ADDR is not set
-CONFIG_SYS_SPL_MALLOC=y
+CONFIG_SPL_SYS_MALLOC=y
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR=y
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0x110
 CONFIG_SPL_ENV_SUPPORT=y
diff --git a/configs/ls1046aqds_sdcard_qspi_defconfig b/configs/ls1046aqds_sdcard_qspi_defconfig
index b571eaadf62..6e353a1db1e 100644
--- a/configs/ls1046aqds_sdcard_qspi_defconfig
+++ b/configs/ls1046aqds_sdcard_qspi_defconfig
@@ -63,7 +63,7 @@ CONFIG_SPL_BSS_MAX_SIZE=0x80000
 CONFIG_SPL_FSL_PBL=y
 CONFIG_SPL_BOARD_INIT=y
 # CONFIG_SPL_SHARES_INIT_SP_ADDR is not set
-CONFIG_SYS_SPL_MALLOC=y
+CONFIG_SPL_SYS_MALLOC=y
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR=y
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0x110
 CONFIG_SPL_ENV_SUPPORT=y
diff --git a/configs/ls1046ardb_emmc_defconfig b/configs/ls1046ardb_emmc_defconfig
index 924ff78b459..c265040df6d 100644
--- a/configs/ls1046ardb_emmc_defconfig
+++ b/configs/ls1046ardb_emmc_defconfig
@@ -53,7 +53,7 @@ CONFIG_SPL_BSS_MAX_SIZE=0x80000
 CONFIG_SPL_FSL_PBL=y
 CONFIG_SPL_BOARD_INIT=y
 # CONFIG_SPL_SHARES_INIT_SP_ADDR is not set
-CONFIG_SYS_SPL_MALLOC=y
+CONFIG_SPL_SYS_MALLOC=y
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR=y
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0x110
 CONFIG_SPL_ENV_SUPPORT=y
diff --git a/configs/ls1046ardb_qspi_spl_defconfig b/configs/ls1046ardb_qspi_spl_defconfig
index eb0184c5927..e11a90f09b2 100644
--- a/configs/ls1046ardb_qspi_spl_defconfig
+++ b/configs/ls1046ardb_qspi_spl_defconfig
@@ -55,7 +55,7 @@ CONFIG_SPL_BSS_START_ADDR=0x8f000000
 CONFIG_SPL_BSS_MAX_SIZE=0x80000
 CONFIG_SPL_BOARD_INIT=y
 # CONFIG_SPL_SHARES_INIT_SP_ADDR is not set
-CONFIG_SYS_SPL_MALLOC=y
+CONFIG_SPL_SYS_MALLOC=y
 CONFIG_SPL_ENV_SUPPORT=y
 CONFIG_SPL_I2C=y
 CONFIG_SPL_MPC8XXX_INIT_DDR=y
diff --git a/configs/ls1046ardb_sdcard_SECURE_BOOT_defconfig b/configs/ls1046ardb_sdcard_SECURE_BOOT_defconfig
index 2813c79f597..589117434e6 100644
--- a/configs/ls1046ardb_sdcard_SECURE_BOOT_defconfig
+++ b/configs/ls1046ardb_sdcard_SECURE_BOOT_defconfig
@@ -50,7 +50,7 @@ CONFIG_SPL_BSS_START_ADDR=0x8f000000
 CONFIG_SPL_BSS_MAX_SIZE=0x80000
 CONFIG_SPL_FSL_PBL=y
 # CONFIG_SPL_SHARES_INIT_SP_ADDR is not set
-CONFIG_SYS_SPL_MALLOC=y
+CONFIG_SPL_SYS_MALLOC=y
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR=y
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0x110
 CONFIG_SPL_ENV_SUPPORT=y
diff --git a/configs/ls1046ardb_sdcard_defconfig b/configs/ls1046ardb_sdcard_defconfig
index a621859aa79..8e1061fbc5d 100644
--- a/configs/ls1046ardb_sdcard_defconfig
+++ b/configs/ls1046ardb_sdcard_defconfig
@@ -53,7 +53,7 @@ CONFIG_SPL_BSS_MAX_SIZE=0x80000
 CONFIG_SPL_FSL_PBL=y
 CONFIG_SPL_BOARD_INIT=y
 # CONFIG_SPL_SHARES_INIT_SP_ADDR is not set
-CONFIG_SYS_SPL_MALLOC=y
+CONFIG_SPL_SYS_MALLOC=y
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR=y
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0x110
 CONFIG_SPL_ENV_SUPPORT=y
diff --git a/configs/ls1088aqds_sdcard_ifc_defconfig b/configs/ls1088aqds_sdcard_ifc_defconfig
index 1f52769ac21..735449a718a 100644
--- a/configs/ls1088aqds_sdcard_ifc_defconfig
+++ b/configs/ls1088aqds_sdcard_ifc_defconfig
@@ -50,7 +50,7 @@ CONFIG_SPL_HAS_BSS_LINKER_SECTION=y
 CONFIG_SPL_BSS_START_ADDR=0x80100000
 CONFIG_SPL_BSS_MAX_SIZE=0x100000
 # CONFIG_SPL_SHARES_INIT_SP_ADDR is not set
-CONFIG_SYS_SPL_MALLOC=y
+CONFIG_SPL_SYS_MALLOC=y
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR=y
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0x8b0
 CONFIG_SPL_ENV_SUPPORT=y
diff --git a/configs/ls1088aqds_sdcard_qspi_defconfig b/configs/ls1088aqds_sdcard_qspi_defconfig
index 93d07829b4b..52d7f94ea5d 100644
--- a/configs/ls1088aqds_sdcard_qspi_defconfig
+++ b/configs/ls1088aqds_sdcard_qspi_defconfig
@@ -51,7 +51,7 @@ CONFIG_SPL_HAS_BSS_LINKER_SECTION=y
 CONFIG_SPL_BSS_START_ADDR=0x80100000
 CONFIG_SPL_BSS_MAX_SIZE=0x100000
 # CONFIG_SPL_SHARES_INIT_SP_ADDR is not set
-CONFIG_SYS_SPL_MALLOC=y
+CONFIG_SPL_SYS_MALLOC=y
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR=y
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0x8b0
 CONFIG_SPL_ENV_SUPPORT=y
diff --git a/configs/ls1088ardb_sdcard_qspi_SECURE_BOOT_defconfig b/configs/ls1088ardb_sdcard_qspi_SECURE_BOOT_defconfig
index c0812a983d5..8c6a8105d9a 100644
--- a/configs/ls1088ardb_sdcard_qspi_SECURE_BOOT_defconfig
+++ b/configs/ls1088ardb_sdcard_qspi_SECURE_BOOT_defconfig
@@ -51,7 +51,7 @@ CONFIG_SPL_HAS_BSS_LINKER_SECTION=y
 CONFIG_SPL_BSS_START_ADDR=0x80100000
 CONFIG_SPL_BSS_MAX_SIZE=0x100000
 # CONFIG_SPL_SHARES_INIT_SP_ADDR is not set
-CONFIG_SYS_SPL_MALLOC=y
+CONFIG_SPL_SYS_MALLOC=y
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR=y
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0x8b0
 CONFIG_SPL_ENV_SUPPORT=y
diff --git a/configs/ls1088ardb_sdcard_qspi_defconfig b/configs/ls1088ardb_sdcard_qspi_defconfig
index b98825cdb92..699678f3526 100644
--- a/configs/ls1088ardb_sdcard_qspi_defconfig
+++ b/configs/ls1088ardb_sdcard_qspi_defconfig
@@ -52,7 +52,7 @@ CONFIG_SPL_HAS_BSS_LINKER_SECTION=y
 CONFIG_SPL_BSS_START_ADDR=0x80100000
 CONFIG_SPL_BSS_MAX_SIZE=0x100000
 # CONFIG_SPL_SHARES_INIT_SP_ADDR is not set
-CONFIG_SYS_SPL_MALLOC=y
+CONFIG_SPL_SYS_MALLOC=y
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR=y
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0x8b0
 CONFIG_SPL_ENV_SUPPORT=y
diff --git a/configs/ls2080aqds_nand_defconfig b/configs/ls2080aqds_nand_defconfig
index 1afaac2686d..6920eefb4ae 100644
--- a/configs/ls2080aqds_nand_defconfig
+++ b/configs/ls2080aqds_nand_defconfig
@@ -42,7 +42,7 @@ CONFIG_SPL_HAS_BSS_LINKER_SECTION=y
 CONFIG_SPL_BSS_START_ADDR=0x80100000
 CONFIG_SPL_BSS_MAX_SIZE=0x100000
 # CONFIG_SPL_SHARES_INIT_SP_ADDR is not set
-CONFIG_SYS_SPL_MALLOC=y
+CONFIG_SPL_SYS_MALLOC=y
 CONFIG_SPL_ENV_SUPPORT=y
 CONFIG_SPL_I2C=y
 CONFIG_SPL_MPC8XXX_INIT_DDR=y
diff --git a/configs/ls2080aqds_sdcard_defconfig b/configs/ls2080aqds_sdcard_defconfig
index b45819f87b3..4965b4a4951 100644
--- a/configs/ls2080aqds_sdcard_defconfig
+++ b/configs/ls2080aqds_sdcard_defconfig
@@ -42,7 +42,7 @@ CONFIG_SPL_HAS_BSS_LINKER_SECTION=y
 CONFIG_SPL_BSS_START_ADDR=0x80100000
 CONFIG_SPL_BSS_MAX_SIZE=0x100000
 # CONFIG_SPL_SHARES_INIT_SP_ADDR is not set
-CONFIG_SYS_SPL_MALLOC=y
+CONFIG_SPL_SYS_MALLOC=y
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR=y
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0x8b0
 CONFIG_SPL_ENV_SUPPORT=y
diff --git a/configs/ls2080ardb_nand_defconfig b/configs/ls2080ardb_nand_defconfig
index a406bae1ec7..acc8c031d7b 100644
--- a/configs/ls2080ardb_nand_defconfig
+++ b/configs/ls2080ardb_nand_defconfig
@@ -48,7 +48,7 @@ CONFIG_SPL_HAS_BSS_LINKER_SECTION=y
 CONFIG_SPL_BSS_START_ADDR=0x80100000
 CONFIG_SPL_BSS_MAX_SIZE=0x100000
 # CONFIG_SPL_SHARES_INIT_SP_ADDR is not set
-CONFIG_SYS_SPL_MALLOC=y
+CONFIG_SPL_SYS_MALLOC=y
 CONFIG_SPL_ENV_SUPPORT=y
 CONFIG_SPL_I2C=y
 CONFIG_SPL_MPC8XXX_INIT_DDR=y
diff --git a/configs/mccmon6_nor_defconfig b/configs/mccmon6_nor_defconfig
index 6afddd2356e..88a72b39299 100644
--- a/configs/mccmon6_nor_defconfig
+++ b/configs/mccmon6_nor_defconfig
@@ -24,7 +24,7 @@ CONFIG_DISTRO_DEFAULTS=y
 # CONFIG_USE_BOOTCOMMAND is not set
 CONFIG_BOARD_LATE_INIT=y
 CONFIG_SPL_BOARD_INIT=y
-CONFIG_SYS_SPL_MALLOC=y
+CONFIG_SPL_SYS_MALLOC=y
 CONFIG_SPL_FIT_IMAGE_TINY=y
 CONFIG_SPL_ENV_SUPPORT=y
 CONFIG_SPL_NOR_SUPPORT=y
diff --git a/configs/mccmon6_sd_defconfig b/configs/mccmon6_sd_defconfig
index c95ee252428..83f2b1a42db 100644
--- a/configs/mccmon6_sd_defconfig
+++ b/configs/mccmon6_sd_defconfig
@@ -26,7 +26,7 @@ CONFIG_DISTRO_DEFAULTS=y
 # CONFIG_USE_BOOTCOMMAND is not set
 CONFIG_BOARD_LATE_INIT=y
 CONFIG_SPL_BOARD_INIT=y
-CONFIG_SYS_SPL_MALLOC=y
+CONFIG_SPL_SYS_MALLOC=y
 CONFIG_SPL_ENV_SUPPORT=y
 CONFIG_SPL_NOR_SUPPORT=y
 CONFIG_SYS_MAXARGS=32
diff --git a/configs/medcom-wide_defconfig b/configs/medcom-wide_defconfig
index e99bb8f5b52..3492c9d2d54 100644
--- a/configs/medcom-wide_defconfig
+++ b/configs/medcom-wide_defconfig
@@ -19,10 +19,10 @@ CONFIG_SYS_STDIO_DEREGISTER=y
 CONFIG_SPL_FOOTPRINT_LIMIT=y
 CONFIG_SPL_MAX_FOOTPRINT=0x8000
 # CONFIG_SPL_SHARES_INIT_SP_ADDR is not set
-CONFIG_SYS_SPL_MALLOC=y
-CONFIG_HAS_CUSTOM_SPL_MALLOC_START=y
-CONFIG_CUSTOM_SYS_SPL_MALLOC_ADDR=0x90000
-CONFIG_SYS_SPL_MALLOC_SIZE=0x10000
+CONFIG_SPL_SYS_MALLOC=y
+CONFIG_SPL_HAS_CUSTOM_MALLOC_START=y
+CONFIG_SPL_CUSTOM_SYS_MALLOC_ADDR=0x90000
+CONFIG_SPL_SYS_MALLOC_SIZE=0x10000
 CONFIG_SYS_MAXARGS=64
 CONFIG_SYS_PBSIZE=2089
 # CONFIG_CMD_IMI is not set
diff --git a/configs/msc_sm2s_imx8mp_defconfig b/configs/msc_sm2s_imx8mp_defconfig
index 323a7040261..ad12a69e324 100644
--- a/configs/msc_sm2s_imx8mp_defconfig
+++ b/configs/msc_sm2s_imx8mp_defconfig
@@ -35,10 +35,10 @@ CONFIG_SPL_BOARD_INIT=y
 CONFIG_SPL_BOOTROM_SUPPORT=y
 CONFIG_SPL_SYS_MALLOC_SIMPLE=y
 # CONFIG_SPL_SHARES_INIT_SP_ADDR is not set
-CONFIG_SYS_SPL_MALLOC=y
-CONFIG_HAS_CUSTOM_SPL_MALLOC_START=y
-CONFIG_CUSTOM_SYS_SPL_MALLOC_ADDR=0x42200000
-CONFIG_SYS_SPL_MALLOC_SIZE=0x80000
+CONFIG_SPL_SYS_MALLOC=y
+CONFIG_SPL_HAS_CUSTOM_MALLOC_START=y
+CONFIG_SPL_CUSTOM_SYS_MALLOC_ADDR=0x42200000
+CONFIG_SPL_SYS_MALLOC_SIZE=0x80000
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR=y
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0x300
 CONFIG_SPL_I2C=y
diff --git a/configs/mx6cuboxi_defconfig b/configs/mx6cuboxi_defconfig
index b23c78984d1..a1ab269b37d 100644
--- a/configs/mx6cuboxi_defconfig
+++ b/configs/mx6cuboxi_defconfig
@@ -28,7 +28,7 @@ CONFIG_BOOTCOMMAND="run findfdt; run finduuid; run distro_bootcmd"
 CONFIG_USE_PREBOOT=y
 CONFIG_PREBOOT="if hdmidet; then usb start; setenv stdin  serial,usbkbd; setenv stdout serial,vidconsole; setenv stderr serial,vidconsole; else setenv stdin  serial; setenv stdout serial; setenv stderr serial; fi;"
 CONFIG_BOARD_EARLY_INIT_F=y
-CONFIG_SYS_SPL_MALLOC=y
+CONFIG_SPL_SYS_MALLOC=y
 CONFIG_SPL_FS_EXT4=y
 CONFIG_SPL_FS_LOAD_PAYLOAD_NAME="u-boot-dtb.img"
 CONFIG_SPL_I2C=y
diff --git a/configs/mx6memcal_defconfig b/configs/mx6memcal_defconfig
index a488ce41fb8..6dd64b6da1b 100644
--- a/configs/mx6memcal_defconfig
+++ b/configs/mx6memcal_defconfig
@@ -15,7 +15,7 @@ CONFIG_SPL=y
 CONFIG_SYS_MEMTEST_START=0x10000000
 CONFIG_SYS_MEMTEST_END=0x20000000
 CONFIG_SUPPORT_RAW_INITRD=y
-CONFIG_SYS_SPL_MALLOC=y
+CONFIG_SPL_SYS_MALLOC=y
 CONFIG_SPL_WATCHDOG=y
 CONFIG_HUSH_PARSER=y
 CONFIG_SYS_MAXARGS=32
diff --git a/configs/mx6sabreauto_defconfig b/configs/mx6sabreauto_defconfig
index ee518cab6dc..deb0b655356 100644
--- a/configs/mx6sabreauto_defconfig
+++ b/configs/mx6sabreauto_defconfig
@@ -31,7 +31,7 @@ CONFIG_BOOTCOMMAND="run findfdt;mmc dev ${mmcdev};if mmc rescan; then if run loa
 CONFIG_SYS_CONSOLE_IS_IN_ENV=y
 CONFIG_SYS_CONSOLE_OVERWRITE_ROUTINE=y
 CONFIG_SPL_LEGACY_IMAGE_FORMAT=y
-CONFIG_SYS_SPL_MALLOC=y
+CONFIG_SPL_SYS_MALLOC=y
 CONFIG_SPL_FIT_IMAGE_TINY=y
 CONFIG_SPL_FS_EXT4=y
 CONFIG_SPL_FS_LOAD_PAYLOAD_NAME="u-boot-dtb.img"
diff --git a/configs/mx6sabresd_defconfig b/configs/mx6sabresd_defconfig
index 0a8b0477b48..edc92f804da 100644
--- a/configs/mx6sabresd_defconfig
+++ b/configs/mx6sabresd_defconfig
@@ -31,7 +31,7 @@ CONFIG_BOOTCOMMAND="run findfdt;mmc dev ${mmcdev};if mmc rescan; then if run loa
 CONFIG_SYS_CONSOLE_IS_IN_ENV=y
 CONFIG_SYS_CONSOLE_OVERWRITE_ROUTINE=y
 CONFIG_SPL_LEGACY_IMAGE_FORMAT=y
-CONFIG_SYS_SPL_MALLOC=y
+CONFIG_SPL_SYS_MALLOC=y
 CONFIG_SPL_FIT_IMAGE_TINY=y
 CONFIG_SPL_WATCHDOG=y
 CONFIG_HUSH_PARSER=y
diff --git a/configs/mx6slevk_spl_defconfig b/configs/mx6slevk_spl_defconfig
index fee3c6fc950..8db45764d5d 100644
--- a/configs/mx6slevk_spl_defconfig
+++ b/configs/mx6slevk_spl_defconfig
@@ -27,7 +27,7 @@ CONFIG_SUPPORT_RAW_INITRD=y
 CONFIG_USE_BOOTCOMMAND=y
 CONFIG_BOOTCOMMAND="mmc dev ${mmcdev}; if mmc rescan; then if run loadbootscript; then run bootscript; else if run loadimage; then run mmcboot; else run netboot; fi; fi; else run netboot; fi"
 CONFIG_BOARD_EARLY_INIT_F=y
-CONFIG_SYS_SPL_MALLOC=y
+CONFIG_SPL_SYS_MALLOC=y
 CONFIG_SPL_FS_EXT4=y
 CONFIG_SPL_FS_LOAD_PAYLOAD_NAME="u-boot-dtb.img"
 CONFIG_SPL_I2C=y
diff --git a/configs/mx6ul_14x14_evk_defconfig b/configs/mx6ul_14x14_evk_defconfig
index 0e036606c1b..f727423a38b 100644
--- a/configs/mx6ul_14x14_evk_defconfig
+++ b/configs/mx6ul_14x14_evk_defconfig
@@ -29,7 +29,7 @@ CONFIG_BOOTCOMMAND="run findfdt;mmc dev ${mmcdev};mmc dev ${mmcdev}; if mmc resc
 # CONFIG_CONSOLE_MUX is not set
 CONFIG_SYS_CONSOLE_IS_IN_ENV=y
 CONFIG_BOARD_EARLY_INIT_F=y
-CONFIG_SYS_SPL_MALLOC=y
+CONFIG_SPL_SYS_MALLOC=y
 CONFIG_SPL_FS_EXT4=y
 CONFIG_SPL_FS_LOAD_PAYLOAD_NAME="u-boot-dtb.img"
 CONFIG_SPL_I2C=y
diff --git a/configs/mx6ul_9x9_evk_defconfig b/configs/mx6ul_9x9_evk_defconfig
index 740968d98e4..1e4ec0b017a 100644
--- a/configs/mx6ul_9x9_evk_defconfig
+++ b/configs/mx6ul_9x9_evk_defconfig
@@ -29,7 +29,7 @@ CONFIG_BOOTCOMMAND="run findfdt;mmc dev ${mmcdev};mmc dev ${mmcdev}; if mmc resc
 # CONFIG_CONSOLE_MUX is not set
 CONFIG_SYS_CONSOLE_IS_IN_ENV=y
 CONFIG_BOARD_EARLY_INIT_F=y
-CONFIG_SYS_SPL_MALLOC=y
+CONFIG_SPL_SYS_MALLOC=y
 CONFIG_SPL_FS_EXT4=y
 CONFIG_SPL_FS_LOAD_PAYLOAD_NAME="u-boot-dtb.img"
 CONFIG_SPL_I2C=y
diff --git a/configs/myir_mys_6ulx_defconfig b/configs/myir_mys_6ulx_defconfig
index 8e3938dcaa8..456d1b86541 100644
--- a/configs/myir_mys_6ulx_defconfig
+++ b/configs/myir_mys_6ulx_defconfig
@@ -20,7 +20,7 @@ CONFIG_FIT=y
 CONFIG_DISTRO_DEFAULTS=y
 CONFIG_BOOTDELAY=3
 CONFIG_BOARD_EARLY_INIT_F=y
-CONFIG_SYS_SPL_MALLOC=y
+CONFIG_SPL_SYS_MALLOC=y
 CONFIG_SPL_DMA=y
 CONFIG_SPL_NAND_SUPPORT=y
 CONFIG_SPL_WATCHDOG=y
diff --git a/configs/novena_defconfig b/configs/novena_defconfig
index 3cb0cb8712e..278e3fd8adb 100644
--- a/configs/novena_defconfig
+++ b/configs/novena_defconfig
@@ -32,7 +32,7 @@ CONFIG_BOOTARGS="console=ttymxc1,115200 "
 CONFIG_BOOTCOMMAND="run distro_bootcmd ; run net_nfs"
 CONFIG_BOARD_EARLY_INIT_F=y
 CONFIG_MISC_INIT_R=y
-CONFIG_SYS_SPL_MALLOC=y
+CONFIG_SPL_SYS_MALLOC=y
 CONFIG_SPL_FS_EXT4=y
 CONFIG_SPL_FS_LOAD_PAYLOAD_NAME="u-boot-dtb.img"
 CONFIG_SPL_I2C=y
diff --git a/configs/nyan-big_defconfig b/configs/nyan-big_defconfig
index cc64facd5f2..bc1b2e35b10 100644
--- a/configs/nyan-big_defconfig
+++ b/configs/nyan-big_defconfig
@@ -30,10 +30,10 @@ CONFIG_DISPLAY_BOARDINFO_LATE=y
 CONFIG_SPL_FOOTPRINT_LIMIT=y
 CONFIG_SPL_MAX_FOOTPRINT=0xef8100
 # CONFIG_SPL_SHARES_INIT_SP_ADDR is not set
-CONFIG_SYS_SPL_MALLOC=y
-CONFIG_HAS_CUSTOM_SPL_MALLOC_START=y
-CONFIG_CUSTOM_SYS_SPL_MALLOC_ADDR=0x80090000
-CONFIG_SYS_SPL_MALLOC_SIZE=0x10000
+CONFIG_SPL_SYS_MALLOC=y
+CONFIG_SPL_HAS_CUSTOM_MALLOC_START=y
+CONFIG_SPL_CUSTOM_SYS_MALLOC_ADDR=0x80090000
+CONFIG_SPL_SYS_MALLOC_SIZE=0x10000
 CONFIG_SYS_MAXARGS=64
 CONFIG_SYS_PBSIZE=2087
 # CONFIG_CMD_IMI is not set
diff --git a/configs/omap35_logic_defconfig b/configs/omap35_logic_defconfig
index b8c48e6bf50..3534753dd3e 100644
--- a/configs/omap35_logic_defconfig
+++ b/configs/omap35_logic_defconfig
@@ -26,8 +26,8 @@ CONFIG_DEFAULT_FDT_FILE="logicpd-torpedo-35xx-devkit.dtb"
 CONFIG_SYS_CONSOLE_INFO_QUIET=y
 CONFIG_SPL_MAX_SIZE=0xec00
 CONFIG_SPL_SYS_MALLOC_SIMPLE=y
-CONFIG_SYS_SPL_MALLOC=y
-CONFIG_SYS_SPL_MALLOC_SIZE=0x800000
+CONFIG_SPL_SYS_MALLOC=y
+CONFIG_SPL_SYS_MALLOC_SIZE=0x800000
 # CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR is not set
 # CONFIG_SPL_FS_EXT4 is not set
 # CONFIG_SPL_I2C is not set
diff --git a/configs/omap35_logic_somlv_defconfig b/configs/omap35_logic_somlv_defconfig
index d9b7e0de5d5..835252acc9b 100644
--- a/configs/omap35_logic_somlv_defconfig
+++ b/configs/omap35_logic_somlv_defconfig
@@ -27,8 +27,8 @@ CONFIG_DEFAULT_FDT_FILE="logicpd-som-lv-35xx-devkit.dtb"
 CONFIG_SYS_CONSOLE_INFO_QUIET=y
 CONFIG_SPL_MAX_SIZE=0xec00
 CONFIG_SPL_SYS_MALLOC_SIMPLE=y
-CONFIG_SYS_SPL_MALLOC=y
-CONFIG_SYS_SPL_MALLOC_SIZE=0x800000
+CONFIG_SPL_SYS_MALLOC=y
+CONFIG_SPL_SYS_MALLOC_SIZE=0x800000
 # CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR is not set
 # CONFIG_SPL_FS_EXT4 is not set
 # CONFIG_SPL_I2C is not set
diff --git a/configs/omap3_beagle_defconfig b/configs/omap3_beagle_defconfig
index a1d43018aa1..1b9adcff893 100644
--- a/configs/omap3_beagle_defconfig
+++ b/configs/omap3_beagle_defconfig
@@ -20,8 +20,8 @@ CONFIG_DEFAULT_FDT_FILE="omap3-beagle.dtb"
 CONFIG_SYS_CONSOLE_INFO_QUIET=y
 CONFIG_SPL_MAX_SIZE=0xec00
 CONFIG_SPL_SYS_MALLOC_SIMPLE=y
-CONFIG_SYS_SPL_MALLOC=y
-CONFIG_SYS_SPL_MALLOC_SIZE=0x800000
+CONFIG_SPL_SYS_MALLOC=y
+CONFIG_SPL_SYS_MALLOC_SIZE=0x800000
 # CONFIG_SPL_FS_EXT4 is not set
 CONFIG_SPL_MTD_SUPPORT=y
 CONFIG_SPL_NAND_DRIVERS=y
diff --git a/configs/omap3_evm_defconfig b/configs/omap3_evm_defconfig
index 34f7d8c8c41..fa2b84a500b 100644
--- a/configs/omap3_evm_defconfig
+++ b/configs/omap3_evm_defconfig
@@ -20,8 +20,8 @@ CONFIG_DEFAULT_FDT_FILE="omap3-evm.dtb"
 CONFIG_SYS_CONSOLE_INFO_QUIET=y
 CONFIG_SPL_MAX_SIZE=0xec00
 CONFIG_SPL_SYS_MALLOC_SIMPLE=y
-CONFIG_SYS_SPL_MALLOC=y
-CONFIG_SYS_SPL_MALLOC_SIZE=0x800000
+CONFIG_SPL_SYS_MALLOC=y
+CONFIG_SPL_SYS_MALLOC_SIZE=0x800000
 # CONFIG_SPL_FS_EXT4 is not set
 CONFIG_SPL_MTD_SUPPORT=y
 CONFIG_SPL_NAND_DRIVERS=y
diff --git a/configs/omap3_logic_defconfig b/configs/omap3_logic_defconfig
index 90c1b6cabff..e747a0c1e93 100644
--- a/configs/omap3_logic_defconfig
+++ b/configs/omap3_logic_defconfig
@@ -25,8 +25,8 @@ CONFIG_PREBOOT="setenv preboot;saveenv;"
 CONFIG_SYS_CONSOLE_INFO_QUIET=y
 CONFIG_SPL_MAX_SIZE=0xec00
 CONFIG_SPL_SYS_MALLOC_SIMPLE=y
-CONFIG_SYS_SPL_MALLOC=y
-CONFIG_SYS_SPL_MALLOC_SIZE=0x800000
+CONFIG_SPL_SYS_MALLOC=y
+CONFIG_SPL_SYS_MALLOC_SIZE=0x800000
 # CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR is not set
 # CONFIG_SPL_FS_EXT4 is not set
 # CONFIG_SPL_I2C is not set
diff --git a/configs/omap3_logic_somlv_defconfig b/configs/omap3_logic_somlv_defconfig
index 17fda31a1e7..b9d6284faad 100644
--- a/configs/omap3_logic_somlv_defconfig
+++ b/configs/omap3_logic_somlv_defconfig
@@ -27,8 +27,8 @@ CONFIG_DEFAULT_FDT_FILE="logicpd-som-lv-37xx-devkit.dtb"
 CONFIG_SYS_CONSOLE_INFO_QUIET=y
 CONFIG_SPL_MAX_SIZE=0xec00
 CONFIG_SPL_SYS_MALLOC_SIMPLE=y
-CONFIG_SYS_SPL_MALLOC=y
-CONFIG_SYS_SPL_MALLOC_SIZE=0x800000
+CONFIG_SPL_SYS_MALLOC=y
+CONFIG_SPL_SYS_MALLOC_SIZE=0x800000
 # CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR is not set
 # CONFIG_SPL_FS_EXT4 is not set
 # CONFIG_SPL_I2C is not set
diff --git a/configs/omap4_panda_defconfig b/configs/omap4_panda_defconfig
index 5571722ea6d..d126d2c07b0 100644
--- a/configs/omap4_panda_defconfig
+++ b/configs/omap4_panda_defconfig
@@ -15,8 +15,8 @@ CONFIG_DEFAULT_FDT_FILE="omap4-panda.dtb"
 CONFIG_SYS_CONSOLE_IS_IN_ENV=y
 CONFIG_SYS_CONSOLE_INFO_QUIET=y
 CONFIG_SPL_MAX_SIZE=0xbc00
-CONFIG_SYS_SPL_MALLOC=y
-CONFIG_SYS_SPL_MALLOC_SIZE=0x800000
+CONFIG_SPL_SYS_MALLOC=y
+CONFIG_SPL_SYS_MALLOC_SIZE=0x800000
 # CONFIG_SPL_FS_EXT4 is not set
 # CONFIG_SPL_I2C is not set
 # CONFIG_SPL_NAND_SUPPORT is not set
diff --git a/configs/omap4_sdp4430_defconfig b/configs/omap4_sdp4430_defconfig
index 0a8a1c77ea4..53710351d04 100644
--- a/configs/omap4_sdp4430_defconfig
+++ b/configs/omap4_sdp4430_defconfig
@@ -19,8 +19,8 @@ CONFIG_DEFAULT_FDT_FILE="omap4-sdp.dtb"
 CONFIG_SYS_CONSOLE_IS_IN_ENV=y
 CONFIG_SYS_CONSOLE_INFO_QUIET=y
 CONFIG_SPL_MAX_SIZE=0xbc00
-CONFIG_SYS_SPL_MALLOC=y
-CONFIG_SYS_SPL_MALLOC_SIZE=0x800000
+CONFIG_SPL_SYS_MALLOC=y
+CONFIG_SPL_SYS_MALLOC_SIZE=0x800000
 # CONFIG_SPL_I2C is not set
 # CONFIG_SPL_NAND_SUPPORT is not set
 CONFIG_SYS_MAXARGS=64
diff --git a/configs/omapl138_lcdk_defconfig b/configs/omapl138_lcdk_defconfig
index dec7a4bf317..47feff21bd4 100644
--- a/configs/omapl138_lcdk_defconfig
+++ b/configs/omapl138_lcdk_defconfig
@@ -41,10 +41,10 @@ CONFIG_SPL_FOOTPRINT_LIMIT=y
 CONFIG_SPL_MAX_FOOTPRINT=0x8000
 CONFIG_SPL_SYS_MALLOC_SIMPLE=y
 # CONFIG_SPL_SHARES_INIT_SP_ADDR is not set
-CONFIG_SYS_SPL_MALLOC=y
-CONFIG_HAS_CUSTOM_SPL_MALLOC_START=y
-CONFIG_CUSTOM_SYS_SPL_MALLOC_ADDR=0xc0f70000
-CONFIG_SYS_SPL_MALLOC_SIZE=0x110000
+CONFIG_SPL_SYS_MALLOC=y
+CONFIG_SPL_HAS_CUSTOM_MALLOC_START=y
+CONFIG_SPL_CUSTOM_SYS_MALLOC_ADDR=0xc0f70000
+CONFIG_SPL_SYS_MALLOC_SIZE=0x110000
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0xb5
 CONFIG_SPL_NAND_SUPPORT=y
 CONFIG_SPL_NAND_DRIVERS=y
diff --git a/configs/openpiton_riscv64_spl_defconfig b/configs/openpiton_riscv64_spl_defconfig
index b7696d7cf30..4371c0350a5 100644
--- a/configs/openpiton_riscv64_spl_defconfig
+++ b/configs/openpiton_riscv64_spl_defconfig
@@ -30,7 +30,7 @@ CONFIG_SPL_BSS_START_ADDR=0x82000000
 # CONFIG_SPL_LEGACY_IMAGE_FORMAT is not set
 CONFIG_SPL_SYS_MALLOC_SIMPLE=y
 # CONFIG_SPL_SHARES_INIT_SP_ADDR is not set
-CONFIG_SYS_SPL_MALLOC=y
+CONFIG_SPL_SYS_MALLOC=y
 # CONFIG_SPL_BANNER_PRINT is not set
 CONFIG_SPL_CPU=y
 CONFIG_SPL_FS_EXT4=y
diff --git a/configs/opos6uldev_defconfig b/configs/opos6uldev_defconfig
index c4d738af3fc..068928ffa98 100644
--- a/configs/opos6uldev_defconfig
+++ b/configs/opos6uldev_defconfig
@@ -34,7 +34,7 @@ CONFIG_DEFAULT_FDT_FILE="imx6ul-opos6uldev.dtb"
 # CONFIG_CONSOLE_MUX is not set
 CONFIG_SYS_CONSOLE_IS_IN_ENV=y
 CONFIG_SPL_BOARD_INIT=y
-CONFIG_SYS_SPL_MALLOC=y
+CONFIG_SPL_SYS_MALLOC=y
 CONFIG_SPL_ENV_SUPPORT=y
 CONFIG_SPL_WATCHDOG=y
 CONFIG_SPL_YMODEM_SUPPORT=y
diff --git a/configs/paz00_defconfig b/configs/paz00_defconfig
index 8c125c39b2f..cc2ef1ed528 100644
--- a/configs/paz00_defconfig
+++ b/configs/paz00_defconfig
@@ -17,10 +17,10 @@ CONFIG_SYS_STDIO_DEREGISTER=y
 CONFIG_SPL_FOOTPRINT_LIMIT=y
 CONFIG_SPL_MAX_FOOTPRINT=0x8000
 # CONFIG_SPL_SHARES_INIT_SP_ADDR is not set
-CONFIG_SYS_SPL_MALLOC=y
-CONFIG_HAS_CUSTOM_SPL_MALLOC_START=y
-CONFIG_CUSTOM_SYS_SPL_MALLOC_ADDR=0x90000
-CONFIG_SYS_SPL_MALLOC_SIZE=0x10000
+CONFIG_SPL_SYS_MALLOC=y
+CONFIG_SPL_HAS_CUSTOM_MALLOC_START=y
+CONFIG_SPL_CUSTOM_SYS_MALLOC_ADDR=0x90000
+CONFIG_SPL_SYS_MALLOC_SIZE=0x10000
 CONFIG_SYS_MAXARGS=64
 CONFIG_SYS_PBSIZE=2087
 # CONFIG_CMD_IMI is not set
diff --git a/configs/pcm058_defconfig b/configs/pcm058_defconfig
index f8b587275f8..15ae95e8943 100644
--- a/configs/pcm058_defconfig
+++ b/configs/pcm058_defconfig
@@ -32,7 +32,7 @@ CONFIG_BOOTDELAY=3
 CONFIG_BOOTCOMMAND="run mmcboot;run nandboot"
 CONFIG_DISPLAY_BOARDINFO_LATE=y
 CONFIG_SPL_BOARD_INIT=y
-CONFIG_SYS_SPL_MALLOC=y
+CONFIG_SPL_SYS_MALLOC=y
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0x18a
 CONFIG_SPL_DMA=y
 CONFIG_SPL_FS_EXT4=y
diff --git a/configs/phycore-am335x-r2-regor_defconfig b/configs/phycore-am335x-r2-regor_defconfig
index d74078c7bed..e37fd1bfab9 100644
--- a/configs/phycore-am335x-r2-regor_defconfig
+++ b/configs/phycore-am335x-r2-regor_defconfig
@@ -24,8 +24,8 @@ CONFIG_BOOTCOMMAND="run distro_bootcmd"
 CONFIG_DEFAULT_FDT_FILE="am335x-regor-rdk.dtb"
 CONFIG_SYS_CONSOLE_INFO_QUIET=y
 CONFIG_ARCH_MISC_INIT=y
-CONFIG_SYS_SPL_MALLOC=y
-CONFIG_SYS_SPL_MALLOC_SIZE=0x800000
+CONFIG_SPL_SYS_MALLOC=y
+CONFIG_SPL_SYS_MALLOC_SIZE=0x800000
 CONFIG_SPL_I2C=y
 CONFIG_SPL_MTD_SUPPORT=y
 CONFIG_SPL_NAND_DRIVERS=y
diff --git a/configs/phycore-am335x-r2-wega_defconfig b/configs/phycore-am335x-r2-wega_defconfig
index 0f75d56c881..08b857ea9c0 100644
--- a/configs/phycore-am335x-r2-wega_defconfig
+++ b/configs/phycore-am335x-r2-wega_defconfig
@@ -24,8 +24,8 @@ CONFIG_BOOTCOMMAND="run distro_bootcmd"
 CONFIG_DEFAULT_FDT_FILE="am335x-wega-rdk.dtb"
 CONFIG_SYS_CONSOLE_INFO_QUIET=y
 CONFIG_ARCH_MISC_INIT=y
-CONFIG_SYS_SPL_MALLOC=y
-CONFIG_SYS_SPL_MALLOC_SIZE=0x800000
+CONFIG_SPL_SYS_MALLOC=y
+CONFIG_SPL_SYS_MALLOC_SIZE=0x800000
 CONFIG_SPL_I2C=y
 CONFIG_SPL_MTD_SUPPORT=y
 CONFIG_SPL_NAND_DRIVERS=y
diff --git a/configs/phycore-imx8mm_defconfig b/configs/phycore-imx8mm_defconfig
index 4a27d15cb11..10fd667722f 100644
--- a/configs/phycore-imx8mm_defconfig
+++ b/configs/phycore-imx8mm_defconfig
@@ -34,10 +34,10 @@ CONFIG_SPL_HAS_BSS_LINKER_SECTION=y
 CONFIG_SPL_BSS_START_ADDR=0x910000
 CONFIG_SPL_BSS_MAX_SIZE=0x2000
 # CONFIG_SPL_SHARES_INIT_SP_ADDR is not set
-CONFIG_SYS_SPL_MALLOC=y
-CONFIG_HAS_CUSTOM_SPL_MALLOC_START=y
-CONFIG_CUSTOM_SYS_SPL_MALLOC_ADDR=0x42200000
-CONFIG_SYS_SPL_MALLOC_SIZE=0x80000
+CONFIG_SPL_SYS_MALLOC=y
+CONFIG_SPL_HAS_CUSTOM_MALLOC_START=y
+CONFIG_SPL_CUSTOM_SYS_MALLOC_ADDR=0x42200000
+CONFIG_SPL_SYS_MALLOC_SIZE=0x80000
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR=y
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0x300
 CONFIG_SPL_I2C=y
diff --git a/configs/phycore-imx8mp_defconfig b/configs/phycore-imx8mp_defconfig
index 7bf404be860..2ba91563d39 100644
--- a/configs/phycore-imx8mp_defconfig
+++ b/configs/phycore-imx8mp_defconfig
@@ -38,10 +38,10 @@ CONFIG_SPL_BOARD_INIT=y
 CONFIG_SPL_BOOTROM_SUPPORT=y
 CONFIG_SPL_SYS_MALLOC_SIMPLE=y
 # CONFIG_SPL_SHARES_INIT_SP_ADDR is not set
-CONFIG_SYS_SPL_MALLOC=y
-CONFIG_HAS_CUSTOM_SPL_MALLOC_START=y
-CONFIG_CUSTOM_SYS_SPL_MALLOC_ADDR=0x42200000
-CONFIG_SYS_SPL_MALLOC_SIZE=0x80000
+CONFIG_SPL_SYS_MALLOC=y
+CONFIG_SPL_HAS_CUSTOM_MALLOC_START=y
+CONFIG_SPL_CUSTOM_SYS_MALLOC_ADDR=0x42200000
+CONFIG_SPL_SYS_MALLOC_SIZE=0x80000
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR=y
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0x300
 CONFIG_SPL_I2C=y
diff --git a/configs/phycore_pcl063_defconfig b/configs/phycore_pcl063_defconfig
index 2d06621963c..11db9681a8c 100644
--- a/configs/phycore_pcl063_defconfig
+++ b/configs/phycore_pcl063_defconfig
@@ -19,7 +19,7 @@ CONFIG_SYS_MEMTEST_END=0x90000000
 CONFIG_DISTRO_DEFAULTS=y
 CONFIG_BOOTDELAY=3
 CONFIG_BOARD_EARLY_INIT_F=y
-CONFIG_SYS_SPL_MALLOC=y
+CONFIG_SPL_SYS_MALLOC=y
 CONFIG_SPL_WATCHDOG=y
 CONFIG_SYS_MAXARGS=32
 CONFIG_SYS_PBSIZE=532
diff --git a/configs/phycore_pcl063_ull_defconfig b/configs/phycore_pcl063_ull_defconfig
index 327ea56cb8a..f0a2398ebdb 100644
--- a/configs/phycore_pcl063_ull_defconfig
+++ b/configs/phycore_pcl063_ull_defconfig
@@ -19,7 +19,7 @@ CONFIG_DISTRO_DEFAULTS=y
 CONFIG_BOOTDELAY=3
 CONFIG_BOOTCOMMAND="run mmc_mmc_fit"
 CONFIG_BOARD_EARLY_INIT_F=y
-CONFIG_SYS_SPL_MALLOC=y
+CONFIG_SPL_SYS_MALLOC=y
 CONFIG_SPL_WATCHDOG=y
 CONFIG_SYS_MAXARGS=32
 CONFIG_SYS_PBSIZE=532
diff --git a/configs/pico-dwarf-imx6ul_defconfig b/configs/pico-dwarf-imx6ul_defconfig
index 4fd588051cd..e9a5302cb7d 100644
--- a/configs/pico-dwarf-imx6ul_defconfig
+++ b/configs/pico-dwarf-imx6ul_defconfig
@@ -26,7 +26,7 @@ CONFIG_BOOTDELAY=3
 CONFIG_BOOTCOMMAND="run findfdt; run finduuid; run distro_bootcmd"
 CONFIG_DEFAULT_FDT_FILE="imx6ul-pico-dwarf.dtb"
 CONFIG_BOARD_EARLY_INIT_F=y
-CONFIG_SYS_SPL_MALLOC=y
+CONFIG_SPL_SYS_MALLOC=y
 CONFIG_SYS_MAXARGS=32
 CONFIG_SYS_PBSIZE=532
 CONFIG_CMD_BOOTMENU=y
diff --git a/configs/pico-dwarf-imx7d_defconfig b/configs/pico-dwarf-imx7d_defconfig
index 2cd906a63da..613ed6cc94a 100644
--- a/configs/pico-dwarf-imx7d_defconfig
+++ b/configs/pico-dwarf-imx7d_defconfig
@@ -25,7 +25,7 @@ CONFIG_DEFAULT_FDT_FILE="imx7d-pico-dwarf.dtb"
 CONFIG_SPL_MAX_SIZE=0xe000
 CONFIG_SPL_HAS_BSS_LINKER_SECTION=y
 CONFIG_SPL_BSS_MAX_SIZE=0x100000
-CONFIG_SYS_SPL_MALLOC=y
+CONFIG_SPL_SYS_MALLOC=y
 CONFIG_SYS_MAXARGS=32
 CONFIG_SYS_PBSIZE=532
 # CONFIG_CMD_BOOTD is not set
diff --git a/configs/pico-hobbit-imx6ul_defconfig b/configs/pico-hobbit-imx6ul_defconfig
index c430b4d6222..b3a1023271c 100644
--- a/configs/pico-hobbit-imx6ul_defconfig
+++ b/configs/pico-hobbit-imx6ul_defconfig
@@ -27,7 +27,7 @@ CONFIG_BOOTDELAY=3
 CONFIG_BOOTCOMMAND="run findfdt; run finduuid; run distro_bootcmd"
 CONFIG_DEFAULT_FDT_FILE="imx6ul-pico-hobbit.dtb"
 CONFIG_BOARD_EARLY_INIT_F=y
-CONFIG_SYS_SPL_MALLOC=y
+CONFIG_SPL_SYS_MALLOC=y
 CONFIG_SYS_MAXARGS=32
 CONFIG_SYS_PBSIZE=532
 CONFIG_CMD_BOOTMENU=y
diff --git a/configs/pico-hobbit-imx7d_defconfig b/configs/pico-hobbit-imx7d_defconfig
index b63281e5332..82d70c7f37a 100644
--- a/configs/pico-hobbit-imx7d_defconfig
+++ b/configs/pico-hobbit-imx7d_defconfig
@@ -25,7 +25,7 @@ CONFIG_DEFAULT_FDT_FILE="imx7d-pico-hobbit.dtb"
 CONFIG_SPL_MAX_SIZE=0xe000
 CONFIG_SPL_HAS_BSS_LINKER_SECTION=y
 CONFIG_SPL_BSS_MAX_SIZE=0x100000
-CONFIG_SYS_SPL_MALLOC=y
+CONFIG_SPL_SYS_MALLOC=y
 CONFIG_SYS_MAXARGS=32
 CONFIG_SYS_PBSIZE=532
 # CONFIG_CMD_BOOTD is not set
diff --git a/configs/pico-imx6_defconfig b/configs/pico-imx6_defconfig
index be7b119ba78..39aa63c1aaa 100644
--- a/configs/pico-imx6_defconfig
+++ b/configs/pico-imx6_defconfig
@@ -27,7 +27,7 @@ CONFIG_DISTRO_DEFAULTS=y
 CONFIG_BOOTCOMMAND="run default_boot"
 CONFIG_DEFAULT_FDT_FILE="ask"
 CONFIG_SYS_CONSOLE_OVERWRITE_ROUTINE=y
-CONFIG_SYS_SPL_MALLOC=y
+CONFIG_SPL_SYS_MALLOC=y
 CONFIG_SPL_FIT_IMAGE_TINY=y
 CONFIG_SPL_FS_EXT4=y
 CONFIG_SPL_FS_LOAD_PAYLOAD_NAME="u-boot-dtb.img"
diff --git a/configs/pico-imx6ul_defconfig b/configs/pico-imx6ul_defconfig
index a6cbc513317..6f84b6aeb49 100644
--- a/configs/pico-imx6ul_defconfig
+++ b/configs/pico-imx6ul_defconfig
@@ -27,7 +27,7 @@ CONFIG_BOOTDELAY=3
 CONFIG_BOOTCOMMAND="run findfdt; run finduuid; run distro_bootcmd"
 CONFIG_DEFAULT_FDT_FILE="ask"
 CONFIG_BOARD_EARLY_INIT_F=y
-CONFIG_SYS_SPL_MALLOC=y
+CONFIG_SPL_SYS_MALLOC=y
 CONFIG_SYS_MAXARGS=32
 CONFIG_SYS_PBSIZE=532
 CONFIG_CMD_BOOTMENU=y
diff --git a/configs/pico-imx7d_bl33_defconfig b/configs/pico-imx7d_bl33_defconfig
index 546e1e6545d..289cf6ba7c1 100644
--- a/configs/pico-imx7d_bl33_defconfig
+++ b/configs/pico-imx7d_bl33_defconfig
@@ -27,7 +27,7 @@ CONFIG_BOOTCOMMAND="run distro_bootcmd"
 CONFIG_SPL_MAX_SIZE=0xe000
 CONFIG_SPL_HAS_BSS_LINKER_SECTION=y
 CONFIG_SPL_BSS_MAX_SIZE=0x100000
-CONFIG_SYS_SPL_MALLOC=y
+CONFIG_SPL_SYS_MALLOC=y
 CONFIG_HUSH_PARSER=y
 CONFIG_SYS_MAXARGS=32
 CONFIG_SYS_PBSIZE=532
diff --git a/configs/pico-imx7d_defconfig b/configs/pico-imx7d_defconfig
index f11e1f4ef41..dbe4c5245b4 100644
--- a/configs/pico-imx7d_defconfig
+++ b/configs/pico-imx7d_defconfig
@@ -25,7 +25,7 @@ CONFIG_DEFAULT_FDT_FILE="ask"
 CONFIG_SPL_MAX_SIZE=0xe000
 CONFIG_SPL_HAS_BSS_LINKER_SECTION=y
 CONFIG_SPL_BSS_MAX_SIZE=0x100000
-CONFIG_SYS_SPL_MALLOC=y
+CONFIG_SPL_SYS_MALLOC=y
 CONFIG_SYS_MAXARGS=32
 CONFIG_SYS_PBSIZE=532
 # CONFIG_CMD_BOOTD is not set
diff --git a/configs/pico-imx8mq_defconfig b/configs/pico-imx8mq_defconfig
index 4ee9b88c32b..f2c342eb8f3 100644
--- a/configs/pico-imx8mq_defconfig
+++ b/configs/pico-imx8mq_defconfig
@@ -38,10 +38,10 @@ CONFIG_SPL_BSS_START_ADDR=0x180000
 CONFIG_SPL_BSS_MAX_SIZE=0x2000
 CONFIG_SPL_BOARD_INIT=y
 # CONFIG_SPL_SHARES_INIT_SP_ADDR is not set
-CONFIG_SYS_SPL_MALLOC=y
-CONFIG_HAS_CUSTOM_SPL_MALLOC_START=y
-CONFIG_CUSTOM_SYS_SPL_MALLOC_ADDR=0x42200000
-CONFIG_SYS_SPL_MALLOC_SIZE=0x80000
+CONFIG_SPL_SYS_MALLOC=y
+CONFIG_SPL_HAS_CUSTOM_MALLOC_START=y
+CONFIG_SPL_CUSTOM_SYS_MALLOC_ADDR=0x42200000
+CONFIG_SPL_SYS_MALLOC_SIZE=0x80000
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR=y
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0x300
 CONFIG_SPL_I2C=y
diff --git a/configs/pico-nymph-imx7d_defconfig b/configs/pico-nymph-imx7d_defconfig
index 2cd906a63da..613ed6cc94a 100644
--- a/configs/pico-nymph-imx7d_defconfig
+++ b/configs/pico-nymph-imx7d_defconfig
@@ -25,7 +25,7 @@ CONFIG_DEFAULT_FDT_FILE="imx7d-pico-dwarf.dtb"
 CONFIG_SPL_MAX_SIZE=0xe000
 CONFIG_SPL_HAS_BSS_LINKER_SECTION=y
 CONFIG_SPL_BSS_MAX_SIZE=0x100000
-CONFIG_SYS_SPL_MALLOC=y
+CONFIG_SPL_SYS_MALLOC=y
 CONFIG_SYS_MAXARGS=32
 CONFIG_SYS_PBSIZE=532
 # CONFIG_CMD_BOOTD is not set
diff --git a/configs/pico-pi-imx6ul_defconfig b/configs/pico-pi-imx6ul_defconfig
index 3c822d10a4f..1eee1e6c2ff 100644
--- a/configs/pico-pi-imx6ul_defconfig
+++ b/configs/pico-pi-imx6ul_defconfig
@@ -27,7 +27,7 @@ CONFIG_BOOTDELAY=3
 CONFIG_BOOTCOMMAND="run findfdt; run finduuid; run distro_bootcmd"
 CONFIG_DEFAULT_FDT_FILE="imx6ul-pico-pi.dtb"
 CONFIG_BOARD_EARLY_INIT_F=y
-CONFIG_SYS_SPL_MALLOC=y
+CONFIG_SPL_SYS_MALLOC=y
 CONFIG_SYS_MAXARGS=32
 CONFIG_SYS_PBSIZE=532
 CONFIG_CMD_BOOTMENU=y
diff --git a/configs/pico-pi-imx7d_defconfig b/configs/pico-pi-imx7d_defconfig
index 3e26aae4005..c5e34219ece 100644
--- a/configs/pico-pi-imx7d_defconfig
+++ b/configs/pico-pi-imx7d_defconfig
@@ -25,7 +25,7 @@ CONFIG_DEFAULT_FDT_FILE="imx7d-pico-pi.dtb"
 CONFIG_SPL_MAX_SIZE=0xe000
 CONFIG_SPL_HAS_BSS_LINKER_SECTION=y
 CONFIG_SPL_BSS_MAX_SIZE=0x100000
-CONFIG_SYS_SPL_MALLOC=y
+CONFIG_SPL_SYS_MALLOC=y
 CONFIG_SYS_MAXARGS=32
 CONFIG_SYS_PBSIZE=532
 # CONFIG_CMD_BOOTD is not set
diff --git a/configs/plutux_defconfig b/configs/plutux_defconfig
index ab9aef5e478..4a4816874bf 100644
--- a/configs/plutux_defconfig
+++ b/configs/plutux_defconfig
@@ -20,10 +20,10 @@ CONFIG_SYS_STDIO_DEREGISTER=y
 CONFIG_SPL_FOOTPRINT_LIMIT=y
 CONFIG_SPL_MAX_FOOTPRINT=0x8000
 # CONFIG_SPL_SHARES_INIT_SP_ADDR is not set
-CONFIG_SYS_SPL_MALLOC=y
-CONFIG_HAS_CUSTOM_SPL_MALLOC_START=y
-CONFIG_CUSTOM_SYS_SPL_MALLOC_ADDR=0x90000
-CONFIG_SYS_SPL_MALLOC_SIZE=0x10000
+CONFIG_SPL_SYS_MALLOC=y
+CONFIG_SPL_HAS_CUSTOM_MALLOC_START=y
+CONFIG_SPL_CUSTOM_SYS_MALLOC_ADDR=0x90000
+CONFIG_SPL_SYS_MALLOC_SIZE=0x10000
 CONFIG_SYS_MAXARGS=64
 CONFIG_SYS_PBSIZE=2084
 # CONFIG_CMD_IMI is not set
diff --git a/configs/pxm2_defconfig b/configs/pxm2_defconfig
index 88a6dbd7db0..4697959b860 100644
--- a/configs/pxm2_defconfig
+++ b/configs/pxm2_defconfig
@@ -38,9 +38,9 @@ CONFIG_SYS_CONSOLE_INFO_QUIET=y
 # CONFIG_DISPLAY_BOARDINFO is not set
 CONFIG_ARCH_MISC_INIT=y
 CONFIG_SPL_BSS_START_ADDR=0x80000000
-CONFIG_SYS_SPL_MALLOC=y
-CONFIG_HAS_CUSTOM_SPL_MALLOC_START=y
-CONFIG_CUSTOM_SYS_SPL_MALLOC_ADDR=0x80208000
+CONFIG_SPL_SYS_MALLOC=y
+CONFIG_SPL_HAS_CUSTOM_MALLOC_START=y
+CONFIG_SPL_CUSTOM_SYS_MALLOC_ADDR=0x80208000
 CONFIG_SPL_I2C=y
 CONFIG_SPL_NAND_DRIVERS=y
 CONFIG_SPL_NAND_ECC=y
diff --git a/configs/qemu-riscv32_spl_defconfig b/configs/qemu-riscv32_spl_defconfig
index 9a81bdd767d..e63d6fd9346 100644
--- a/configs/qemu-riscv32_spl_defconfig
+++ b/configs/qemu-riscv32_spl_defconfig
@@ -18,7 +18,7 @@ CONFIG_DISPLAY_CPUINFO=y
 CONFIG_DISPLAY_BOARDINFO=y
 CONFIG_SPL_MAX_SIZE=0x100000
 CONFIG_SPL_BSS_START_ADDR=0x84000000
-CONFIG_SYS_SPL_MALLOC=y
+CONFIG_SPL_SYS_MALLOC=y
 CONFIG_SYS_CBSIZE=256
 CONFIG_SYS_PBSIZE=276
 CONFIG_SYS_BOOTM_LEN=0x4000000
diff --git a/configs/qemu-riscv64_spl_defconfig b/configs/qemu-riscv64_spl_defconfig
index bb10145e6e7..b048bb8aed0 100644
--- a/configs/qemu-riscv64_spl_defconfig
+++ b/configs/qemu-riscv64_spl_defconfig
@@ -17,7 +17,7 @@ CONFIG_DISPLAY_CPUINFO=y
 CONFIG_DISPLAY_BOARDINFO=y
 CONFIG_SPL_MAX_SIZE=0x100000
 CONFIG_SPL_BSS_START_ADDR=0x84000000
-CONFIG_SYS_SPL_MALLOC=y
+CONFIG_SPL_SYS_MALLOC=y
 CONFIG_SYS_CBSIZE=256
 CONFIG_SYS_PBSIZE=276
 CONFIG_SYS_BOOTM_LEN=0x4000000
diff --git a/configs/rastaban_defconfig b/configs/rastaban_defconfig
index 7e4580f2cc7..7c443d518ed 100644
--- a/configs/rastaban_defconfig
+++ b/configs/rastaban_defconfig
@@ -38,9 +38,9 @@ CONFIG_SYS_CONSOLE_INFO_QUIET=y
 # CONFIG_DISPLAY_BOARDINFO is not set
 CONFIG_ARCH_MISC_INIT=y
 CONFIG_SPL_BSS_START_ADDR=0x80000000
-CONFIG_SYS_SPL_MALLOC=y
-CONFIG_HAS_CUSTOM_SPL_MALLOC_START=y
-CONFIG_CUSTOM_SYS_SPL_MALLOC_ADDR=0x80208000
+CONFIG_SPL_SYS_MALLOC=y
+CONFIG_SPL_HAS_CUSTOM_MALLOC_START=y
+CONFIG_SPL_CUSTOM_SYS_MALLOC_ADDR=0x80208000
 CONFIG_SPL_I2C=y
 CONFIG_SPL_NAND_DRIVERS=y
 CONFIG_SPL_NAND_ECC=y
diff --git a/configs/ringneck-px30_defconfig b/configs/ringneck-px30_defconfig
index cdec0c52e6a..b4666d0e90f 100644
--- a/configs/ringneck-px30_defconfig
+++ b/configs/ringneck-px30_defconfig
@@ -42,7 +42,7 @@ CONFIG_SPL_BOOTROM_SUPPORT=y
 # CONFIG_SPL_RAW_IMAGE_SUPPORT is not set
 # CONFIG_SPL_SHARES_INIT_SP_ADDR is not set
 CONFIG_SPL_STACK_R=y
-CONFIG_SYS_SPL_MALLOC=y
+CONFIG_SPL_SYS_MALLOC=y
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0x200
 CONFIG_SPL_ATF=y
 # CONFIG_TPL_FRAMEWORK is not set
diff --git a/configs/riotboard_defconfig b/configs/riotboard_defconfig
index 98fef09e18c..f8bc8c63969 100644
--- a/configs/riotboard_defconfig
+++ b/configs/riotboard_defconfig
@@ -30,7 +30,7 @@ CONFIG_SYS_CONSOLE_IS_IN_ENV=y
 CONFIG_SYS_CONSOLE_OVERWRITE_ROUTINE=y
 CONFIG_BOARD_EARLY_INIT_F=y
 CONFIG_SPL_RAW_IMAGE_SUPPORT=y
-CONFIG_SYS_SPL_MALLOC=y
+CONFIG_SPL_SYS_MALLOC=y
 CONFIG_SPL_FS_EXT4=y
 CONFIG_SPL_FS_LOAD_PAYLOAD_NAME="u-boot-dtb.img"
 CONFIG_SPL_FS_LOAD_ARGS_NAME="imx6dl-riotboard.dtb"
diff --git a/configs/rut_defconfig b/configs/rut_defconfig
index ba89b4d24cd..40c17a58882 100644
--- a/configs/rut_defconfig
+++ b/configs/rut_defconfig
@@ -38,9 +38,9 @@ CONFIG_SYS_CONSOLE_INFO_QUIET=y
 # CONFIG_DISPLAY_BOARDINFO is not set
 CONFIG_ARCH_MISC_INIT=y
 CONFIG_SPL_BSS_START_ADDR=0x80000000
-CONFIG_SYS_SPL_MALLOC=y
-CONFIG_HAS_CUSTOM_SPL_MALLOC_START=y
-CONFIG_CUSTOM_SYS_SPL_MALLOC_ADDR=0x80208000
+CONFIG_SPL_SYS_MALLOC=y
+CONFIG_SPL_HAS_CUSTOM_MALLOC_START=y
+CONFIG_SPL_CUSTOM_SYS_MALLOC_ADDR=0x80208000
 CONFIG_SPL_I2C=y
 CONFIG_SPL_NAND_DRIVERS=y
 CONFIG_SPL_NAND_ECC=y
diff --git a/configs/sama5d27_giantboard_defconfig b/configs/sama5d27_giantboard_defconfig
index e58b4542509..677658dca13 100644
--- a/configs/sama5d27_giantboard_defconfig
+++ b/configs/sama5d27_giantboard_defconfig
@@ -46,8 +46,8 @@ CONFIG_SPL_HAS_BSS_LINKER_SECTION=y
 CONFIG_SPL_BSS_START_ADDR=0x20000000
 CONFIG_SPL_BSS_MAX_SIZE=0x80000
 # CONFIG_SPL_SHARES_INIT_SP_ADDR is not set
-CONFIG_SYS_SPL_MALLOC=y
-CONFIG_SYS_SPL_MALLOC_SIZE=0x80000
+CONFIG_SPL_SYS_MALLOC=y
+CONFIG_SPL_SYS_MALLOC_SIZE=0x80000
 CONFIG_HUSH_PARSER=y
 CONFIG_SYS_CBSIZE=256
 CONFIG_SYS_PBSIZE=276
diff --git a/configs/sama5d27_som1_ek_mmc1_defconfig b/configs/sama5d27_som1_ek_mmc1_defconfig
index 65466ebb5c6..ec82311b16c 100644
--- a/configs/sama5d27_som1_ek_mmc1_defconfig
+++ b/configs/sama5d27_som1_ek_mmc1_defconfig
@@ -43,8 +43,8 @@ CONFIG_SPL_HAS_BSS_LINKER_SECTION=y
 CONFIG_SPL_BSS_START_ADDR=0x20000000
 CONFIG_SPL_BSS_MAX_SIZE=0x80000
 # CONFIG_SPL_SHARES_INIT_SP_ADDR is not set
-CONFIG_SYS_SPL_MALLOC=y
-CONFIG_SYS_SPL_MALLOC_SIZE=0x80000
+CONFIG_SPL_SYS_MALLOC=y
+CONFIG_SPL_SYS_MALLOC_SIZE=0x80000
 CONFIG_HUSH_PARSER=y
 CONFIG_SYS_CBSIZE=256
 CONFIG_SYS_PBSIZE=276
diff --git a/configs/sama5d27_som1_ek_mmc_defconfig b/configs/sama5d27_som1_ek_mmc_defconfig
index cb47dc6baa6..f3037445149 100644
--- a/configs/sama5d27_som1_ek_mmc_defconfig
+++ b/configs/sama5d27_som1_ek_mmc_defconfig
@@ -44,8 +44,8 @@ CONFIG_SPL_HAS_BSS_LINKER_SECTION=y
 CONFIG_SPL_BSS_START_ADDR=0x20000000
 CONFIG_SPL_BSS_MAX_SIZE=0x80000
 # CONFIG_SPL_SHARES_INIT_SP_ADDR is not set
-CONFIG_SYS_SPL_MALLOC=y
-CONFIG_SYS_SPL_MALLOC_SIZE=0x80000
+CONFIG_SPL_SYS_MALLOC=y
+CONFIG_SPL_SYS_MALLOC_SIZE=0x80000
 CONFIG_HUSH_PARSER=y
 CONFIG_SYS_CBSIZE=256
 CONFIG_SYS_PBSIZE=276
diff --git a/configs/sama5d27_som1_ek_qspiflash_defconfig b/configs/sama5d27_som1_ek_qspiflash_defconfig
index 702495e1c91..eed190d2ef4 100644
--- a/configs/sama5d27_som1_ek_qspiflash_defconfig
+++ b/configs/sama5d27_som1_ek_qspiflash_defconfig
@@ -42,8 +42,8 @@ CONFIG_SPL_HAS_BSS_LINKER_SECTION=y
 CONFIG_SPL_BSS_START_ADDR=0x20000000
 CONFIG_SPL_BSS_MAX_SIZE=0x80000
 # CONFIG_SPL_SHARES_INIT_SP_ADDR is not set
-CONFIG_SYS_SPL_MALLOC=y
-CONFIG_SYS_SPL_MALLOC_SIZE=0x80000
+CONFIG_SPL_SYS_MALLOC=y
+CONFIG_SPL_SYS_MALLOC_SIZE=0x80000
 CONFIG_HUSH_PARSER=y
 CONFIG_SYS_CBSIZE=256
 CONFIG_SYS_PBSIZE=276
diff --git a/configs/sama5d27_wlsom1_ek_mmc_defconfig b/configs/sama5d27_wlsom1_ek_mmc_defconfig
index 79210090122..2b8461da1c2 100644
--- a/configs/sama5d27_wlsom1_ek_mmc_defconfig
+++ b/configs/sama5d27_wlsom1_ek_mmc_defconfig
@@ -43,8 +43,8 @@ CONFIG_SPL_HAS_BSS_LINKER_SECTION=y
 CONFIG_SPL_BSS_START_ADDR=0x20000000
 CONFIG_SPL_BSS_MAX_SIZE=0x80000
 # CONFIG_SPL_SHARES_INIT_SP_ADDR is not set
-CONFIG_SYS_SPL_MALLOC=y
-CONFIG_SYS_SPL_MALLOC_SIZE=0x80000
+CONFIG_SPL_SYS_MALLOC=y
+CONFIG_SPL_SYS_MALLOC_SIZE=0x80000
 CONFIG_SPL_DISPLAY_PRINT=y
 # CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR is not set
 CONFIG_SPL_AT91_MCK_BYPASS=y
diff --git a/configs/sama5d27_wlsom1_ek_qspiflash_defconfig b/configs/sama5d27_wlsom1_ek_qspiflash_defconfig
index a7c84746e3e..f47183ae5c9 100644
--- a/configs/sama5d27_wlsom1_ek_qspiflash_defconfig
+++ b/configs/sama5d27_wlsom1_ek_qspiflash_defconfig
@@ -43,8 +43,8 @@ CONFIG_SPL_HAS_BSS_LINKER_SECTION=y
 CONFIG_SPL_BSS_START_ADDR=0x20000000
 CONFIG_SPL_BSS_MAX_SIZE=0x80000
 # CONFIG_SPL_SHARES_INIT_SP_ADDR is not set
-CONFIG_SYS_SPL_MALLOC=y
-CONFIG_SYS_SPL_MALLOC_SIZE=0x80000
+CONFIG_SPL_SYS_MALLOC=y
+CONFIG_SPL_SYS_MALLOC_SIZE=0x80000
 CONFIG_SPL_DISPLAY_PRINT=y
 # CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR is not set
 CONFIG_SPL_DM_SPI_FLASH=y
diff --git a/configs/sama5d2_icp_mmc_defconfig b/configs/sama5d2_icp_mmc_defconfig
index 9456b9e1e13..7ad94ecbdee 100644
--- a/configs/sama5d2_icp_mmc_defconfig
+++ b/configs/sama5d2_icp_mmc_defconfig
@@ -44,8 +44,8 @@ CONFIG_SPL_BSS_START_ADDR=0x20000000
 CONFIG_SPL_BSS_MAX_SIZE=0x80000
 CONFIG_SPL_SYS_MALLOC_SIMPLE=y
 # CONFIG_SPL_SHARES_INIT_SP_ADDR is not set
-CONFIG_SYS_SPL_MALLOC=y
-CONFIG_SYS_SPL_MALLOC_SIZE=0x80000
+CONFIG_SPL_SYS_MALLOC=y
+CONFIG_SPL_SYS_MALLOC_SIZE=0x80000
 CONFIG_SPL_DISPLAY_PRINT=y
 # CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR is not set
 CONFIG_SPL_RAM_SUPPORT=y
diff --git a/configs/sama5d2_xplained_emmc_defconfig b/configs/sama5d2_xplained_emmc_defconfig
index 9ef0ff4aa9a..7c373360a9b 100644
--- a/configs/sama5d2_xplained_emmc_defconfig
+++ b/configs/sama5d2_xplained_emmc_defconfig
@@ -43,8 +43,8 @@ CONFIG_SPL_HAS_BSS_LINKER_SECTION=y
 CONFIG_SPL_BSS_START_ADDR=0x20000000
 CONFIG_SPL_BSS_MAX_SIZE=0x80000
 # CONFIG_SPL_SHARES_INIT_SP_ADDR is not set
-CONFIG_SYS_SPL_MALLOC=y
-CONFIG_SYS_SPL_MALLOC_SIZE=0x80000
+CONFIG_SPL_SYS_MALLOC=y
+CONFIG_SPL_SYS_MALLOC_SIZE=0x80000
 CONFIG_HUSH_PARSER=y
 CONFIG_SYS_CBSIZE=256
 CONFIG_SYS_PBSIZE=276
diff --git a/configs/sama5d2_xplained_mmc_defconfig b/configs/sama5d2_xplained_mmc_defconfig
index aed9edafdf7..26b281f7085 100644
--- a/configs/sama5d2_xplained_mmc_defconfig
+++ b/configs/sama5d2_xplained_mmc_defconfig
@@ -45,8 +45,8 @@ CONFIG_SPL_HAS_BSS_LINKER_SECTION=y
 CONFIG_SPL_BSS_START_ADDR=0x20000000
 CONFIG_SPL_BSS_MAX_SIZE=0x80000
 # CONFIG_SPL_SHARES_INIT_SP_ADDR is not set
-CONFIG_SYS_SPL_MALLOC=y
-CONFIG_SYS_SPL_MALLOC_SIZE=0x80000
+CONFIG_SPL_SYS_MALLOC=y
+CONFIG_SPL_SYS_MALLOC_SIZE=0x80000
 CONFIG_HUSH_PARSER=y
 CONFIG_SYS_CBSIZE=256
 CONFIG_SYS_PBSIZE=276
diff --git a/configs/sama5d2_xplained_qspiflash_defconfig b/configs/sama5d2_xplained_qspiflash_defconfig
index c9a20723f5a..9ed35e3113e 100644
--- a/configs/sama5d2_xplained_qspiflash_defconfig
+++ b/configs/sama5d2_xplained_qspiflash_defconfig
@@ -46,8 +46,8 @@ CONFIG_SPL_HAS_BSS_LINKER_SECTION=y
 CONFIG_SPL_BSS_START_ADDR=0x20000000
 CONFIG_SPL_BSS_MAX_SIZE=0x80000
 # CONFIG_SPL_SHARES_INIT_SP_ADDR is not set
-CONFIG_SYS_SPL_MALLOC=y
-CONFIG_SYS_SPL_MALLOC_SIZE=0x80000
+CONFIG_SPL_SYS_MALLOC=y
+CONFIG_SPL_SYS_MALLOC_SIZE=0x80000
 CONFIG_HUSH_PARSER=y
 CONFIG_SYS_CBSIZE=256
 CONFIG_SYS_PBSIZE=276
diff --git a/configs/sama5d2_xplained_spiflash_defconfig b/configs/sama5d2_xplained_spiflash_defconfig
index c01a0c4cc7c..b87a63f2d23 100644
--- a/configs/sama5d2_xplained_spiflash_defconfig
+++ b/configs/sama5d2_xplained_spiflash_defconfig
@@ -47,8 +47,8 @@ CONFIG_SPL_HAS_BSS_LINKER_SECTION=y
 CONFIG_SPL_BSS_START_ADDR=0x20000000
 CONFIG_SPL_BSS_MAX_SIZE=0x80000
 # CONFIG_SPL_SHARES_INIT_SP_ADDR is not set
-CONFIG_SYS_SPL_MALLOC=y
-CONFIG_SYS_SPL_MALLOC_SIZE=0x80000
+CONFIG_SPL_SYS_MALLOC=y
+CONFIG_SPL_SYS_MALLOC_SIZE=0x80000
 CONFIG_SPL_DM_SPI_FLASH=y
 CONFIG_SPL_SPI_LOAD=y
 CONFIG_SYS_SPI_U_BOOT_OFFS=0x10000
diff --git a/configs/sama5d3_xplained_mmc_defconfig b/configs/sama5d3_xplained_mmc_defconfig
index 9b4affe1c49..fc0de8c3e83 100644
--- a/configs/sama5d3_xplained_mmc_defconfig
+++ b/configs/sama5d3_xplained_mmc_defconfig
@@ -42,8 +42,8 @@ CONFIG_SPL_HAS_BSS_LINKER_SECTION=y
 CONFIG_SPL_BSS_START_ADDR=0x20000000
 CONFIG_SPL_BSS_MAX_SIZE=0x80000
 # CONFIG_SPL_SHARES_INIT_SP_ADDR is not set
-CONFIG_SYS_SPL_MALLOC=y
-CONFIG_SYS_SPL_MALLOC_SIZE=0x80000
+CONFIG_SPL_SYS_MALLOC=y
+CONFIG_SPL_SYS_MALLOC_SIZE=0x80000
 CONFIG_HUSH_PARSER=y
 CONFIG_SYS_CBSIZE=256
 CONFIG_SYS_PBSIZE=276
diff --git a/configs/sama5d3_xplained_nandflash_defconfig b/configs/sama5d3_xplained_nandflash_defconfig
index 2fcb2b75e80..a1b6122f8eb 100644
--- a/configs/sama5d3_xplained_nandflash_defconfig
+++ b/configs/sama5d3_xplained_nandflash_defconfig
@@ -39,8 +39,8 @@ CONFIG_SPL_HAS_BSS_LINKER_SECTION=y
 CONFIG_SPL_BSS_START_ADDR=0x20000000
 CONFIG_SPL_BSS_MAX_SIZE=0x80000
 # CONFIG_SPL_SHARES_INIT_SP_ADDR is not set
-CONFIG_SYS_SPL_MALLOC=y
-CONFIG_SYS_SPL_MALLOC_SIZE=0x80000
+CONFIG_SPL_SYS_MALLOC=y
+CONFIG_SPL_SYS_MALLOC_SIZE=0x80000
 CONFIG_SPL_NAND_SUPPORT=y
 CONFIG_SPL_NAND_DRIVERS=y
 CONFIG_SPL_NAND_BASE=y
diff --git a/configs/sama5d3xek_mmc_defconfig b/configs/sama5d3xek_mmc_defconfig
index bfe19e0169f..631e85ea059 100644
--- a/configs/sama5d3xek_mmc_defconfig
+++ b/configs/sama5d3xek_mmc_defconfig
@@ -44,8 +44,8 @@ CONFIG_SPL_HAS_BSS_LINKER_SECTION=y
 CONFIG_SPL_BSS_START_ADDR=0x20000000
 CONFIG_SPL_BSS_MAX_SIZE=0x80000
 # CONFIG_SPL_SHARES_INIT_SP_ADDR is not set
-CONFIG_SYS_SPL_MALLOC=y
-CONFIG_SYS_SPL_MALLOC_SIZE=0x80000
+CONFIG_SPL_SYS_MALLOC=y
+CONFIG_SPL_SYS_MALLOC_SIZE=0x80000
 CONFIG_HUSH_PARSER=y
 CONFIG_SYS_CBSIZE=256
 CONFIG_SYS_PBSIZE=276
diff --git a/configs/sama5d3xek_nandflash_defconfig b/configs/sama5d3xek_nandflash_defconfig
index 2978a7e2d7d..6278a6c68a7 100644
--- a/configs/sama5d3xek_nandflash_defconfig
+++ b/configs/sama5d3xek_nandflash_defconfig
@@ -41,8 +41,8 @@ CONFIG_SPL_HAS_BSS_LINKER_SECTION=y
 CONFIG_SPL_BSS_START_ADDR=0x20000000
 CONFIG_SPL_BSS_MAX_SIZE=0x80000
 # CONFIG_SPL_SHARES_INIT_SP_ADDR is not set
-CONFIG_SYS_SPL_MALLOC=y
-CONFIG_SYS_SPL_MALLOC_SIZE=0x80000
+CONFIG_SPL_SYS_MALLOC=y
+CONFIG_SPL_SYS_MALLOC_SIZE=0x80000
 CONFIG_SPL_NAND_SUPPORT=y
 CONFIG_SPL_NAND_DRIVERS=y
 CONFIG_SPL_NAND_BASE=y
diff --git a/configs/sama5d3xek_spiflash_defconfig b/configs/sama5d3xek_spiflash_defconfig
index 1d30843e08b..5f47f8b6ba9 100644
--- a/configs/sama5d3xek_spiflash_defconfig
+++ b/configs/sama5d3xek_spiflash_defconfig
@@ -44,8 +44,8 @@ CONFIG_SPL_HAS_BSS_LINKER_SECTION=y
 CONFIG_SPL_BSS_START_ADDR=0x20000000
 CONFIG_SPL_BSS_MAX_SIZE=0x80000
 # CONFIG_SPL_SHARES_INIT_SP_ADDR is not set
-CONFIG_SYS_SPL_MALLOC=y
-CONFIG_SYS_SPL_MALLOC_SIZE=0x80000
+CONFIG_SPL_SYS_MALLOC=y
+CONFIG_SPL_SYS_MALLOC_SIZE=0x80000
 CONFIG_SPL_DM_SPI_FLASH=y
 CONFIG_SPL_SPI_LOAD=y
 CONFIG_SYS_SPI_U_BOOT_OFFS=0x10000
diff --git a/configs/sama5d4_xplained_mmc_defconfig b/configs/sama5d4_xplained_mmc_defconfig
index befe26b18e9..9f0349e7f58 100644
--- a/configs/sama5d4_xplained_mmc_defconfig
+++ b/configs/sama5d4_xplained_mmc_defconfig
@@ -44,8 +44,8 @@ CONFIG_SPL_HAS_BSS_LINKER_SECTION=y
 CONFIG_SPL_BSS_START_ADDR=0x20000000
 CONFIG_SPL_BSS_MAX_SIZE=0x80000
 # CONFIG_SPL_SHARES_INIT_SP_ADDR is not set
-CONFIG_SYS_SPL_MALLOC=y
-CONFIG_SYS_SPL_MALLOC_SIZE=0x80000
+CONFIG_SPL_SYS_MALLOC=y
+CONFIG_SPL_SYS_MALLOC_SIZE=0x80000
 CONFIG_HUSH_PARSER=y
 CONFIG_SYS_CBSIZE=256
 CONFIG_SYS_PBSIZE=276
diff --git a/configs/sama5d4_xplained_nandflash_defconfig b/configs/sama5d4_xplained_nandflash_defconfig
index 749c8ba30e6..d12f749d7f4 100644
--- a/configs/sama5d4_xplained_nandflash_defconfig
+++ b/configs/sama5d4_xplained_nandflash_defconfig
@@ -41,8 +41,8 @@ CONFIG_SPL_HAS_BSS_LINKER_SECTION=y
 CONFIG_SPL_BSS_START_ADDR=0x20000000
 CONFIG_SPL_BSS_MAX_SIZE=0x80000
 # CONFIG_SPL_SHARES_INIT_SP_ADDR is not set
-CONFIG_SYS_SPL_MALLOC=y
-CONFIG_SYS_SPL_MALLOC_SIZE=0x80000
+CONFIG_SPL_SYS_MALLOC=y
+CONFIG_SPL_SYS_MALLOC_SIZE=0x80000
 CONFIG_SPL_NAND_SUPPORT=y
 CONFIG_SPL_NAND_DRIVERS=y
 CONFIG_SPL_NAND_BASE=y
diff --git a/configs/sama5d4_xplained_spiflash_defconfig b/configs/sama5d4_xplained_spiflash_defconfig
index 02a0de3ed27..0d239ef0008 100644
--- a/configs/sama5d4_xplained_spiflash_defconfig
+++ b/configs/sama5d4_xplained_spiflash_defconfig
@@ -46,8 +46,8 @@ CONFIG_SPL_HAS_BSS_LINKER_SECTION=y
 CONFIG_SPL_BSS_START_ADDR=0x20000000
 CONFIG_SPL_BSS_MAX_SIZE=0x80000
 # CONFIG_SPL_SHARES_INIT_SP_ADDR is not set
-CONFIG_SYS_SPL_MALLOC=y
-CONFIG_SYS_SPL_MALLOC_SIZE=0x80000
+CONFIG_SPL_SYS_MALLOC=y
+CONFIG_SPL_SYS_MALLOC_SIZE=0x80000
 CONFIG_SPL_DM_SPI_FLASH=y
 CONFIG_SPL_SPI_LOAD=y
 CONFIG_SYS_SPI_U_BOOT_OFFS=0x10000
diff --git a/configs/sama5d4ek_mmc_defconfig b/configs/sama5d4ek_mmc_defconfig
index 48607e1ca43..4139fcfadb2 100644
--- a/configs/sama5d4ek_mmc_defconfig
+++ b/configs/sama5d4ek_mmc_defconfig
@@ -44,8 +44,8 @@ CONFIG_SPL_HAS_BSS_LINKER_SECTION=y
 CONFIG_SPL_BSS_START_ADDR=0x20000000
 CONFIG_SPL_BSS_MAX_SIZE=0x80000
 # CONFIG_SPL_SHARES_INIT_SP_ADDR is not set
-CONFIG_SYS_SPL_MALLOC=y
-CONFIG_SYS_SPL_MALLOC_SIZE=0x80000
+CONFIG_SPL_SYS_MALLOC=y
+CONFIG_SPL_SYS_MALLOC_SIZE=0x80000
 CONFIG_HUSH_PARSER=y
 CONFIG_SYS_CBSIZE=256
 CONFIG_SYS_PBSIZE=276
diff --git a/configs/sama5d4ek_nandflash_defconfig b/configs/sama5d4ek_nandflash_defconfig
index 60c936b0479..27bfcdf0084 100644
--- a/configs/sama5d4ek_nandflash_defconfig
+++ b/configs/sama5d4ek_nandflash_defconfig
@@ -41,8 +41,8 @@ CONFIG_SPL_HAS_BSS_LINKER_SECTION=y
 CONFIG_SPL_BSS_START_ADDR=0x20000000
 CONFIG_SPL_BSS_MAX_SIZE=0x80000
 # CONFIG_SPL_SHARES_INIT_SP_ADDR is not set
-CONFIG_SYS_SPL_MALLOC=y
-CONFIG_SYS_SPL_MALLOC_SIZE=0x80000
+CONFIG_SPL_SYS_MALLOC=y
+CONFIG_SPL_SYS_MALLOC_SIZE=0x80000
 CONFIG_SPL_NAND_SUPPORT=y
 CONFIG_SPL_NAND_DRIVERS=y
 CONFIG_SPL_NAND_BASE=y
diff --git a/configs/sama5d4ek_spiflash_defconfig b/configs/sama5d4ek_spiflash_defconfig
index aee8169fdc0..f41c4e9eddb 100644
--- a/configs/sama5d4ek_spiflash_defconfig
+++ b/configs/sama5d4ek_spiflash_defconfig
@@ -44,8 +44,8 @@ CONFIG_SPL_HAS_BSS_LINKER_SECTION=y
 CONFIG_SPL_BSS_START_ADDR=0x20000000
 CONFIG_SPL_BSS_MAX_SIZE=0x80000
 # CONFIG_SPL_SHARES_INIT_SP_ADDR is not set
-CONFIG_SYS_SPL_MALLOC=y
-CONFIG_SYS_SPL_MALLOC_SIZE=0x80000
+CONFIG_SPL_SYS_MALLOC=y
+CONFIG_SPL_SYS_MALLOC_SIZE=0x80000
 CONFIG_SPL_DM_SPI_FLASH=y
 CONFIG_SPL_SPI_LOAD=y
 CONFIG_SYS_SPI_U_BOOT_OFFS=0x10000
diff --git a/configs/seaboard_defconfig b/configs/seaboard_defconfig
index f8759f25546..2d9b7955273 100644
--- a/configs/seaboard_defconfig
+++ b/configs/seaboard_defconfig
@@ -18,10 +18,10 @@ CONFIG_USE_PREBOOT=y
 CONFIG_SPL_FOOTPRINT_LIMIT=y
 CONFIG_SPL_MAX_FOOTPRINT=0x8000
 # CONFIG_SPL_SHARES_INIT_SP_ADDR is not set
-CONFIG_SYS_SPL_MALLOC=y
-CONFIG_HAS_CUSTOM_SPL_MALLOC_START=y
-CONFIG_CUSTOM_SYS_SPL_MALLOC_ADDR=0x90000
-CONFIG_SYS_SPL_MALLOC_SIZE=0x10000
+CONFIG_SPL_SYS_MALLOC=y
+CONFIG_SPL_HAS_CUSTOM_MALLOC_START=y
+CONFIG_SPL_CUSTOM_SYS_MALLOC_ADDR=0x90000
+CONFIG_SPL_SYS_MALLOC_SIZE=0x10000
 CONFIG_SYS_MAXARGS=64
 CONFIG_SYS_PBSIZE=2086
 # CONFIG_CMD_IMI is not set
diff --git a/configs/seeed_npi_imx6ull_defconfig b/configs/seeed_npi_imx6ull_defconfig
index 9dec10ef392..d4f2a88ee46 100644
--- a/configs/seeed_npi_imx6ull_defconfig
+++ b/configs/seeed_npi_imx6ull_defconfig
@@ -21,7 +21,7 @@ CONFIG_FIT=y
 CONFIG_DISTRO_DEFAULTS=y
 CONFIG_BOOTDELAY=3
 CONFIG_BOARD_EARLY_INIT_F=y
-CONFIG_SYS_SPL_MALLOC=y
+CONFIG_SPL_SYS_MALLOC=y
 CONFIG_SPL_DMA=y
 CONFIG_SPL_NAND_SUPPORT=y
 CONFIG_SPL_WATCHDOG=y
diff --git a/configs/sifive_unleashed_defconfig b/configs/sifive_unleashed_defconfig
index f9f03463ee7..f99ce30b910 100644
--- a/configs/sifive_unleashed_defconfig
+++ b/configs/sifive_unleashed_defconfig
@@ -29,7 +29,7 @@ CONFIG_MISC_INIT_R=y
 CONFIG_SPL_MAX_SIZE=0x100000
 CONFIG_SPL_BSS_START_ADDR=0x85000000
 # CONFIG_SPL_SHARES_INIT_SP_ADDR is not set
-CONFIG_SYS_SPL_MALLOC=y
+CONFIG_SPL_SYS_MALLOC=y
 CONFIG_SPL_DM_SPI_FLASH=y
 CONFIG_SPL_DM_RESET=y
 CONFIG_SPL_SPI_LOAD=y
diff --git a/configs/sifive_unmatched_defconfig b/configs/sifive_unmatched_defconfig
index 867611b6b4e..826cf977c34 100644
--- a/configs/sifive_unmatched_defconfig
+++ b/configs/sifive_unmatched_defconfig
@@ -35,7 +35,7 @@ CONFIG_PCI_INIT_R=y
 CONFIG_SPL_MAX_SIZE=0x100000
 CONFIG_SPL_BSS_START_ADDR=0x85000000
 # CONFIG_SPL_SHARES_INIT_SP_ADDR is not set
-CONFIG_SYS_SPL_MALLOC=y
+CONFIG_SPL_SYS_MALLOC=y
 CONFIG_SPL_DM_SPI_FLASH=y
 CONFIG_SPL_DM_RESET=y
 CONFIG_SPL_SPI_LOAD=y
diff --git a/configs/smartweb_defconfig b/configs/smartweb_defconfig
index 836e0c002de..21c9c39be49 100644
--- a/configs/smartweb_defconfig
+++ b/configs/smartweb_defconfig
@@ -41,8 +41,8 @@ CONFIG_SPL_HAS_BSS_LINKER_SECTION=y
 CONFIG_SPL_BSS_START_ADDR=0x20000000
 CONFIG_SPL_BSS_MAX_SIZE=0x4000
 # CONFIG_SPL_SHARES_INIT_SP_ADDR is not set
-CONFIG_SYS_SPL_MALLOC=y
-CONFIG_SYS_SPL_MALLOC_SIZE=0x460000
+CONFIG_SPL_SYS_MALLOC=y
+CONFIG_SPL_SYS_MALLOC_SIZE=0x460000
 CONFIG_SPL_NAND_SUPPORT=y
 CONFIG_SPL_NAND_RAW_ONLY=y
 CONFIG_SPL_NAND_DRIVERS=y
diff --git a/configs/sniper_defconfig b/configs/sniper_defconfig
index c762d75aec1..703805916f9 100644
--- a/configs/sniper_defconfig
+++ b/configs/sniper_defconfig
@@ -18,9 +18,9 @@ CONFIG_SYS_CONSOLE_IS_IN_ENV=y
 CONFIG_SPL_MAX_SIZE=0xec00
 CONFIG_SPL_BSS_START_ADDR=0x80000000
 # CONFIG_SPL_SHARES_INIT_SP_ADDR is not set
-CONFIG_SYS_SPL_MALLOC=y
-CONFIG_HAS_CUSTOM_SPL_MALLOC_START=y
-CONFIG_CUSTOM_SYS_SPL_MALLOC_ADDR=0x80208000
+CONFIG_SPL_SYS_MALLOC=y
+CONFIG_SPL_HAS_CUSTOM_MALLOC_START=y
+CONFIG_SPL_CUSTOM_SYS_MALLOC_ADDR=0x80208000
 # CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR is not set
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_PARTITION=y
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_PARTITION=2
diff --git a/configs/socfpga_agilex_atf_defconfig b/configs/socfpga_agilex_atf_defconfig
index ba0dbb8496b..453010076ca 100644
--- a/configs/socfpga_agilex_atf_defconfig
+++ b/configs/socfpga_agilex_atf_defconfig
@@ -35,10 +35,10 @@ CONFIG_SPL_HAS_BSS_LINKER_SECTION=y
 CONFIG_SPL_BSS_START_ADDR=0x3ff00000
 CONFIG_SPL_BSS_MAX_SIZE=0x100000
 # CONFIG_SPL_SHARES_INIT_SP_ADDR is not set
-CONFIG_SYS_SPL_MALLOC=y
-CONFIG_HAS_CUSTOM_SPL_MALLOC_START=y
-CONFIG_CUSTOM_SYS_SPL_MALLOC_ADDR=0x3fa00000
-CONFIG_SYS_SPL_MALLOC_SIZE=0x500000
+CONFIG_SPL_SYS_MALLOC=y
+CONFIG_SPL_HAS_CUSTOM_MALLOC_START=y
+CONFIG_SPL_CUSTOM_SYS_MALLOC_ADDR=0x3fa00000
+CONFIG_SPL_SYS_MALLOC_SIZE=0x500000
 CONFIG_SPL_CACHE=y
 CONFIG_SPL_SPI_LOAD=y
 CONFIG_SYS_SPI_U_BOOT_OFFS=0x02000000
diff --git a/configs/socfpga_agilex_defconfig b/configs/socfpga_agilex_defconfig
index 406fe712fe4..bddfd4b20ce 100644
--- a/configs/socfpga_agilex_defconfig
+++ b/configs/socfpga_agilex_defconfig
@@ -33,10 +33,10 @@ CONFIG_SPL_HAS_BSS_LINKER_SECTION=y
 CONFIG_SPL_BSS_START_ADDR=0x3ff00000
 CONFIG_SPL_BSS_MAX_SIZE=0x100000
 # CONFIG_SPL_SHARES_INIT_SP_ADDR is not set
-CONFIG_SYS_SPL_MALLOC=y
-CONFIG_HAS_CUSTOM_SPL_MALLOC_START=y
-CONFIG_CUSTOM_SYS_SPL_MALLOC_ADDR=0x3fa00000
-CONFIG_SYS_SPL_MALLOC_SIZE=0x500000
+CONFIG_SPL_SYS_MALLOC=y
+CONFIG_SPL_HAS_CUSTOM_MALLOC_START=y
+CONFIG_SPL_CUSTOM_SYS_MALLOC_ADDR=0x3fa00000
+CONFIG_SPL_SYS_MALLOC_SIZE=0x500000
 CONFIG_SPL_CACHE=y
 CONFIG_SPL_SPI_LOAD=y
 CONFIG_SYS_SPI_U_BOOT_OFFS=0x3c00000
diff --git a/configs/socfpga_agilex_vab_defconfig b/configs/socfpga_agilex_vab_defconfig
index 7c83ec971ac..e5f32c055c0 100644
--- a/configs/socfpga_agilex_vab_defconfig
+++ b/configs/socfpga_agilex_vab_defconfig
@@ -36,10 +36,10 @@ CONFIG_SPL_HAS_BSS_LINKER_SECTION=y
 CONFIG_SPL_BSS_START_ADDR=0x3ff00000
 CONFIG_SPL_BSS_MAX_SIZE=0x100000
 # CONFIG_SPL_SHARES_INIT_SP_ADDR is not set
-CONFIG_SYS_SPL_MALLOC=y
-CONFIG_HAS_CUSTOM_SPL_MALLOC_START=y
-CONFIG_CUSTOM_SYS_SPL_MALLOC_ADDR=0x3fa00000
-CONFIG_SYS_SPL_MALLOC_SIZE=0x500000
+CONFIG_SPL_SYS_MALLOC=y
+CONFIG_SPL_HAS_CUSTOM_MALLOC_START=y
+CONFIG_SPL_CUSTOM_SYS_MALLOC_ADDR=0x3fa00000
+CONFIG_SPL_SYS_MALLOC_SIZE=0x500000
 CONFIG_SPL_CACHE=y
 CONFIG_SPL_SPI_LOAD=y
 CONFIG_SYS_SPI_U_BOOT_OFFS=0x02000000
diff --git a/configs/socfpga_arria10_defconfig b/configs/socfpga_arria10_defconfig
index 82b16418a6f..30d28e19588 100644
--- a/configs/socfpga_arria10_defconfig
+++ b/configs/socfpga_arria10_defconfig
@@ -30,10 +30,10 @@ CONFIG_CLOCKS=y
 CONFIG_SPL_PAD_TO=0x40000
 CONFIG_SPL_NO_BSS_LIMIT=y
 # CONFIG_SPL_SHARES_INIT_SP_ADDR is not set
-CONFIG_SYS_SPL_MALLOC=y
-CONFIG_HAS_CUSTOM_SPL_MALLOC_START=y
-CONFIG_CUSTOM_SYS_SPL_MALLOC_ADDR=0xffe2b000
-CONFIG_SYS_SPL_MALLOC_SIZE=0x15000
+CONFIG_SPL_SYS_MALLOC=y
+CONFIG_SPL_HAS_CUSTOM_MALLOC_START=y
+CONFIG_SPL_CUSTOM_SYS_MALLOC_ADDR=0xffe2b000
+CONFIG_SPL_SYS_MALLOC_SIZE=0x15000
 CONFIG_SPL_ENV_SUPPORT=y
 CONFIG_SPL_FPGA=y
 CONFIG_SYS_MAXARGS=32
diff --git a/configs/socfpga_chameleonv3_defconfig b/configs/socfpga_chameleonv3_defconfig
index 441942c2f2b..457ad4b2977 100644
--- a/configs/socfpga_chameleonv3_defconfig
+++ b/configs/socfpga_chameleonv3_defconfig
@@ -14,10 +14,10 @@ CONFIG_DISTRO_DEFAULTS=y
 CONFIG_MISC_INIT_R=y
 CONFIG_SPL_MAX_SIZE=0x40000
 CONFIG_SPL_NO_BSS_LIMIT=y
-CONFIG_SYS_SPL_MALLOC=y
-CONFIG_HAS_CUSTOM_SPL_MALLOC_START=y
-CONFIG_CUSTOM_SYS_SPL_MALLOC_ADDR=0xffe2b000
-CONFIG_SYS_SPL_MALLOC_SIZE=0x15000
+CONFIG_SPL_SYS_MALLOC=y
+CONFIG_SPL_HAS_CUSTOM_MALLOC_START=y
+CONFIG_SPL_CUSTOM_SYS_MALLOC_ADDR=0xffe2b000
+CONFIG_SPL_SYS_MALLOC_SIZE=0x15000
 CONFIG_SPL_ENV_SUPPORT=y
 CONFIG_SPL_FS_EXT4=y
 CONFIG_SPL_FPGA=y
diff --git a/configs/socfpga_n5x_atf_defconfig b/configs/socfpga_n5x_atf_defconfig
index 78595c5d9ec..bd4a8b84af7 100644
--- a/configs/socfpga_n5x_atf_defconfig
+++ b/configs/socfpga_n5x_atf_defconfig
@@ -34,10 +34,10 @@ CONFIG_SPL_HAS_BSS_LINKER_SECTION=y
 CONFIG_SPL_BSS_START_ADDR=0x3ff00000
 CONFIG_SPL_BSS_MAX_SIZE=0x100000
 # CONFIG_SPL_SHARES_INIT_SP_ADDR is not set
-CONFIG_SYS_SPL_MALLOC=y
-CONFIG_HAS_CUSTOM_SPL_MALLOC_START=y
-CONFIG_CUSTOM_SYS_SPL_MALLOC_ADDR=0x3fa00000
-CONFIG_SYS_SPL_MALLOC_SIZE=0x500000
+CONFIG_SPL_SYS_MALLOC=y
+CONFIG_SPL_HAS_CUSTOM_MALLOC_START=y
+CONFIG_SPL_CUSTOM_SYS_MALLOC_ADDR=0x3fa00000
+CONFIG_SPL_SYS_MALLOC_SIZE=0x500000
 CONFIG_SPL_CACHE=y
 CONFIG_SPL_SPI_LOAD=y
 CONFIG_SYS_SPI_U_BOOT_OFFS=0x02000000
diff --git a/configs/socfpga_n5x_defconfig b/configs/socfpga_n5x_defconfig
index 99a12df91ac..745f4ed59d7 100644
--- a/configs/socfpga_n5x_defconfig
+++ b/configs/socfpga_n5x_defconfig
@@ -30,10 +30,10 @@ CONFIG_SPL_HAS_BSS_LINKER_SECTION=y
 CONFIG_SPL_BSS_START_ADDR=0x3ff00000
 CONFIG_SPL_BSS_MAX_SIZE=0x100000
 # CONFIG_SPL_SHARES_INIT_SP_ADDR is not set
-CONFIG_SYS_SPL_MALLOC=y
-CONFIG_HAS_CUSTOM_SPL_MALLOC_START=y
-CONFIG_CUSTOM_SYS_SPL_MALLOC_ADDR=0x3fa00000
-CONFIG_SYS_SPL_MALLOC_SIZE=0x500000
+CONFIG_SPL_SYS_MALLOC=y
+CONFIG_SPL_HAS_CUSTOM_MALLOC_START=y
+CONFIG_SPL_CUSTOM_SYS_MALLOC_ADDR=0x3fa00000
+CONFIG_SPL_SYS_MALLOC_SIZE=0x500000
 CONFIG_SPL_CACHE=y
 CONFIG_SPL_SPI_LOAD=y
 CONFIG_SYS_SPI_U_BOOT_OFFS=0x3c00000
diff --git a/configs/socfpga_n5x_vab_defconfig b/configs/socfpga_n5x_vab_defconfig
index e8c62d0575f..86429bf6ec2 100644
--- a/configs/socfpga_n5x_vab_defconfig
+++ b/configs/socfpga_n5x_vab_defconfig
@@ -35,10 +35,10 @@ CONFIG_SPL_HAS_BSS_LINKER_SECTION=y
 CONFIG_SPL_BSS_START_ADDR=0x3ff00000
 CONFIG_SPL_BSS_MAX_SIZE=0x100000
 # CONFIG_SPL_SHARES_INIT_SP_ADDR is not set
-CONFIG_SYS_SPL_MALLOC=y
-CONFIG_HAS_CUSTOM_SPL_MALLOC_START=y
-CONFIG_CUSTOM_SYS_SPL_MALLOC_ADDR=0x3fa00000
-CONFIG_SYS_SPL_MALLOC_SIZE=0x500000
+CONFIG_SPL_SYS_MALLOC=y
+CONFIG_SPL_HAS_CUSTOM_MALLOC_START=y
+CONFIG_SPL_CUSTOM_SYS_MALLOC_ADDR=0x3fa00000
+CONFIG_SPL_SYS_MALLOC_SIZE=0x500000
 CONFIG_SPL_CACHE=y
 CONFIG_SPL_SPI_LOAD=y
 CONFIG_SYS_SPI_U_BOOT_OFFS=0x02000000
diff --git a/configs/socfpga_stratix10_atf_defconfig b/configs/socfpga_stratix10_atf_defconfig
index 2d4f70592d2..0ca1da96510 100644
--- a/configs/socfpga_stratix10_atf_defconfig
+++ b/configs/socfpga_stratix10_atf_defconfig
@@ -35,10 +35,10 @@ CONFIG_SPL_HAS_BSS_LINKER_SECTION=y
 CONFIG_SPL_BSS_START_ADDR=0x3ff00000
 CONFIG_SPL_BSS_MAX_SIZE=0x100000
 # CONFIG_SPL_SHARES_INIT_SP_ADDR is not set
-CONFIG_SYS_SPL_MALLOC=y
-CONFIG_HAS_CUSTOM_SPL_MALLOC_START=y
-CONFIG_CUSTOM_SYS_SPL_MALLOC_ADDR=0x3fa00000
-CONFIG_SYS_SPL_MALLOC_SIZE=0x500000
+CONFIG_SPL_SYS_MALLOC=y
+CONFIG_SPL_HAS_CUSTOM_MALLOC_START=y
+CONFIG_SPL_CUSTOM_SYS_MALLOC_ADDR=0x3fa00000
+CONFIG_SPL_SYS_MALLOC_SIZE=0x500000
 CONFIG_SPL_SPI_LOAD=y
 CONFIG_SYS_SPI_U_BOOT_OFFS=0x02000000
 CONFIG_SPL_ATF=y
diff --git a/configs/socfpga_stratix10_defconfig b/configs/socfpga_stratix10_defconfig
index 7d078dd18e0..add3d15c858 100644
--- a/configs/socfpga_stratix10_defconfig
+++ b/configs/socfpga_stratix10_defconfig
@@ -35,10 +35,10 @@ CONFIG_SPL_HAS_BSS_LINKER_SECTION=y
 CONFIG_SPL_BSS_START_ADDR=0x3ff00000
 CONFIG_SPL_BSS_MAX_SIZE=0x100000
 # CONFIG_SPL_SHARES_INIT_SP_ADDR is not set
-CONFIG_SYS_SPL_MALLOC=y
-CONFIG_HAS_CUSTOM_SPL_MALLOC_START=y
-CONFIG_CUSTOM_SYS_SPL_MALLOC_ADDR=0x3fa00000
-CONFIG_SYS_SPL_MALLOC_SIZE=0x500000
+CONFIG_SPL_SYS_MALLOC=y
+CONFIG_SPL_HAS_CUSTOM_MALLOC_START=y
+CONFIG_SPL_CUSTOM_SYS_MALLOC_ADDR=0x3fa00000
+CONFIG_SPL_SYS_MALLOC_SIZE=0x500000
 CONFIG_SPL_SPI_LOAD=y
 CONFIG_SYS_SPI_U_BOOT_OFFS=0x3C00000
 CONFIG_SPL_TARGET="spl/u-boot-spl-dtb.hex"
diff --git a/configs/starfive_visionfive2_defconfig b/configs/starfive_visionfive2_defconfig
index e9b63e5b847..586f2929851 100644
--- a/configs/starfive_visionfive2_defconfig
+++ b/configs/starfive_visionfive2_defconfig
@@ -54,10 +54,10 @@ CONFIG_SPL_PAD_TO=0x0
 CONFIG_SPL_BSS_START_ADDR=0x8040000
 CONFIG_SPL_BSS_MAX_SIZE=0x10000
 # CONFIG_SPL_SHARES_INIT_SP_ADDR is not set
-CONFIG_SYS_SPL_MALLOC=y
-CONFIG_HAS_CUSTOM_SPL_MALLOC_START=y
-CONFIG_CUSTOM_SYS_SPL_MALLOC_ADDR=0x80000000
-CONFIG_SYS_SPL_MALLOC_SIZE=0x400000
+CONFIG_SPL_SYS_MALLOC=y
+CONFIG_SPL_HAS_CUSTOM_MALLOC_START=y
+CONFIG_SPL_CUSTOM_SYS_MALLOC_ADDR=0x80000000
+CONFIG_SPL_SYS_MALLOC_SIZE=0x400000
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_PARTITION=y
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_PARTITION=0x2
 CONFIG_SPL_I2C=y
diff --git a/configs/stm32mp15-icore-stm32mp1-ctouch2_defconfig b/configs/stm32mp15-icore-stm32mp1-ctouch2_defconfig
index e01745498c0..189703fee07 100644
--- a/configs/stm32mp15-icore-stm32mp1-ctouch2_defconfig
+++ b/configs/stm32mp15-icore-stm32mp1-ctouch2_defconfig
@@ -22,10 +22,10 @@ CONFIG_BOOTCOMMAND="run bootcmd_stm32mp"
 CONFIG_SPL_FOOTPRINT_LIMIT=y
 CONFIG_SPL_MAX_FOOTPRINT=0x3db00
 # CONFIG_SPL_SHARES_INIT_SP_ADDR is not set
-CONFIG_SYS_SPL_MALLOC=y
-CONFIG_HAS_CUSTOM_SPL_MALLOC_START=y
-CONFIG_CUSTOM_SYS_SPL_MALLOC_ADDR=0xc0300000
-CONFIG_SYS_SPL_MALLOC_SIZE=0x1d00000
+CONFIG_SPL_SYS_MALLOC=y
+CONFIG_SPL_HAS_CUSTOM_MALLOC_START=y
+CONFIG_SPL_CUSTOM_SYS_MALLOC_ADDR=0xc0300000
+CONFIG_SPL_SYS_MALLOC_SIZE=0x1d00000
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_PARTITION=y
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_PARTITION=3
 CONFIG_SPL_ENV_SUPPORT=y
diff --git a/configs/stm32mp15-icore-stm32mp1-edimm2.2_defconfig b/configs/stm32mp15-icore-stm32mp1-edimm2.2_defconfig
index e72684683e7..6e8fc2f5cda 100644
--- a/configs/stm32mp15-icore-stm32mp1-edimm2.2_defconfig
+++ b/configs/stm32mp15-icore-stm32mp1-edimm2.2_defconfig
@@ -22,10 +22,10 @@ CONFIG_BOOTCOMMAND="run bootcmd_stm32mp"
 CONFIG_SPL_FOOTPRINT_LIMIT=y
 CONFIG_SPL_MAX_FOOTPRINT=0x3db00
 # CONFIG_SPL_SHARES_INIT_SP_ADDR is not set
-CONFIG_SYS_SPL_MALLOC=y
-CONFIG_HAS_CUSTOM_SPL_MALLOC_START=y
-CONFIG_CUSTOM_SYS_SPL_MALLOC_ADDR=0xc0300000
-CONFIG_SYS_SPL_MALLOC_SIZE=0x1d00000
+CONFIG_SPL_SYS_MALLOC=y
+CONFIG_SPL_HAS_CUSTOM_MALLOC_START=y
+CONFIG_SPL_CUSTOM_SYS_MALLOC_ADDR=0xc0300000
+CONFIG_SPL_SYS_MALLOC_SIZE=0x1d00000
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_PARTITION=y
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_PARTITION=3
 CONFIG_SPL_ENV_SUPPORT=y
diff --git a/configs/stm32mp15-microgea-stm32mp1-microdev2-of7_defconfig b/configs/stm32mp15-microgea-stm32mp1-microdev2-of7_defconfig
index b910d474ca7..d6cb330bae1 100644
--- a/configs/stm32mp15-microgea-stm32mp1-microdev2-of7_defconfig
+++ b/configs/stm32mp15-microgea-stm32mp1-microdev2-of7_defconfig
@@ -22,10 +22,10 @@ CONFIG_BOOTCOMMAND="run bootcmd_stm32mp"
 CONFIG_SPL_FOOTPRINT_LIMIT=y
 CONFIG_SPL_MAX_FOOTPRINT=0x3db00
 # CONFIG_SPL_SHARES_INIT_SP_ADDR is not set
-CONFIG_SYS_SPL_MALLOC=y
-CONFIG_HAS_CUSTOM_SPL_MALLOC_START=y
-CONFIG_CUSTOM_SYS_SPL_MALLOC_ADDR=0xc0300000
-CONFIG_SYS_SPL_MALLOC_SIZE=0x1d00000
+CONFIG_SPL_SYS_MALLOC=y
+CONFIG_SPL_HAS_CUSTOM_MALLOC_START=y
+CONFIG_SPL_CUSTOM_SYS_MALLOC_ADDR=0xc0300000
+CONFIG_SPL_SYS_MALLOC_SIZE=0x1d00000
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_PARTITION=y
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_PARTITION=3
 CONFIG_SPL_ENV_SUPPORT=y
diff --git a/configs/stm32mp15-microgea-stm32mp1-microdev2_defconfig b/configs/stm32mp15-microgea-stm32mp1-microdev2_defconfig
index 5007e6246d4..a99fc89be31 100644
--- a/configs/stm32mp15-microgea-stm32mp1-microdev2_defconfig
+++ b/configs/stm32mp15-microgea-stm32mp1-microdev2_defconfig
@@ -22,10 +22,10 @@ CONFIG_BOOTCOMMAND="run bootcmd_stm32mp"
 CONFIG_SPL_FOOTPRINT_LIMIT=y
 CONFIG_SPL_MAX_FOOTPRINT=0x3db00
 # CONFIG_SPL_SHARES_INIT_SP_ADDR is not set
-CONFIG_SYS_SPL_MALLOC=y
-CONFIG_HAS_CUSTOM_SPL_MALLOC_START=y
-CONFIG_CUSTOM_SYS_SPL_MALLOC_ADDR=0xc0300000
-CONFIG_SYS_SPL_MALLOC_SIZE=0x1d00000
+CONFIG_SPL_SYS_MALLOC=y
+CONFIG_SPL_HAS_CUSTOM_MALLOC_START=y
+CONFIG_SPL_CUSTOM_SYS_MALLOC_ADDR=0xc0300000
+CONFIG_SPL_SYS_MALLOC_SIZE=0x1d00000
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_PARTITION=y
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_PARTITION=3
 CONFIG_SPL_ENV_SUPPORT=y
diff --git a/configs/stm32mp15_basic_defconfig b/configs/stm32mp15_basic_defconfig
index 9ea5aaa7145..2cb2ad64b27 100644
--- a/configs/stm32mp15_basic_defconfig
+++ b/configs/stm32mp15_basic_defconfig
@@ -32,10 +32,10 @@ CONFIG_BOARD_EARLY_INIT_F=y
 CONFIG_SPL_FOOTPRINT_LIMIT=y
 CONFIG_SPL_MAX_FOOTPRINT=0x3db00
 # CONFIG_SPL_SHARES_INIT_SP_ADDR is not set
-CONFIG_SYS_SPL_MALLOC=y
-CONFIG_HAS_CUSTOM_SPL_MALLOC_START=y
-CONFIG_CUSTOM_SYS_SPL_MALLOC_ADDR=0xc0300000
-CONFIG_SYS_SPL_MALLOC_SIZE=0x1d00000
+CONFIG_SPL_SYS_MALLOC=y
+CONFIG_SPL_HAS_CUSTOM_MALLOC_START=y
+CONFIG_SPL_CUSTOM_SYS_MALLOC_ADDR=0xc0300000
+CONFIG_SPL_SYS_MALLOC_SIZE=0x1d00000
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_PARTITION=y
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_PARTITION=3
 CONFIG_SPL_ENV_SUPPORT=y
diff --git a/configs/stm32mp15_dhcom_basic_defconfig b/configs/stm32mp15_dhcom_basic_defconfig
index af7416659c1..289040e011a 100644
--- a/configs/stm32mp15_dhcom_basic_defconfig
+++ b/configs/stm32mp15_dhcom_basic_defconfig
@@ -40,10 +40,10 @@ CONFIG_SPL_MAX_FOOTPRINT=0x3db00
 CONFIG_SPL_BOOTCOUNT_LIMIT=y
 CONFIG_SPL_LEGACY_IMAGE_FORMAT=y
 # CONFIG_SPL_SHARES_INIT_SP_ADDR is not set
-CONFIG_SYS_SPL_MALLOC=y
-CONFIG_HAS_CUSTOM_SPL_MALLOC_START=y
-CONFIG_CUSTOM_SYS_SPL_MALLOC_ADDR=0xc0300000
-CONFIG_SYS_SPL_MALLOC_SIZE=0x1d00000
+CONFIG_SPL_SYS_MALLOC=y
+CONFIG_SPL_HAS_CUSTOM_MALLOC_START=y
+CONFIG_SPL_CUSTOM_SYS_MALLOC_ADDR=0xc0300000
+CONFIG_SPL_SYS_MALLOC_SIZE=0x1d00000
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_PARTITION=y
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_PARTITION=3
 CONFIG_SPL_ENV_SUPPORT=y
diff --git a/configs/stm32mp15_dhcor_basic_defconfig b/configs/stm32mp15_dhcor_basic_defconfig
index b7f372f9e4d..fe45e2b7d51 100644
--- a/configs/stm32mp15_dhcor_basic_defconfig
+++ b/configs/stm32mp15_dhcor_basic_defconfig
@@ -38,10 +38,10 @@ CONFIG_SPL_MAX_FOOTPRINT=0x3db00
 CONFIG_SPL_BOOTCOUNT_LIMIT=y
 CONFIG_SPL_LEGACY_IMAGE_FORMAT=y
 # CONFIG_SPL_SHARES_INIT_SP_ADDR is not set
-CONFIG_SYS_SPL_MALLOC=y
-CONFIG_HAS_CUSTOM_SPL_MALLOC_START=y
-CONFIG_CUSTOM_SYS_SPL_MALLOC_ADDR=0xc0300000
-CONFIG_SYS_SPL_MALLOC_SIZE=0x1d00000
+CONFIG_SPL_SYS_MALLOC=y
+CONFIG_SPL_HAS_CUSTOM_MALLOC_START=y
+CONFIG_SPL_CUSTOM_SYS_MALLOC_ADDR=0xc0300000
+CONFIG_SPL_SYS_MALLOC_SIZE=0x1d00000
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_PARTITION=y
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_PARTITION=3
 CONFIG_SPL_ENV_SUPPORT=y
diff --git a/configs/syzygy_hub_defconfig b/configs/syzygy_hub_defconfig
index bf234548253..7bcb3191000 100644
--- a/configs/syzygy_hub_defconfig
+++ b/configs/syzygy_hub_defconfig
@@ -28,8 +28,8 @@ CONFIG_SPL_BSS_START_ADDR=0x100000
 CONFIG_SPL_BSS_MAX_SIZE=0x100000
 # CONFIG_SPL_SHARES_INIT_SP_ADDR is not set
 CONFIG_SPL_STACK_R=y
-CONFIG_SYS_SPL_MALLOC=y
-CONFIG_SYS_SPL_MALLOC_SIZE=0x2000000
+CONFIG_SPL_SYS_MALLOC=y
+CONFIG_SPL_SYS_MALLOC_SIZE=0x2000000
 CONFIG_SPL_FS_LOAD_ARGS_NAME="system.dtb"
 CONFIG_SPL_OS_BOOT=y
 CONFIG_SYS_SPL_ARGS_ADDR=0x10000000
diff --git a/configs/taurus_defconfig b/configs/taurus_defconfig
index 81a83771cde..0db0a75cbb8 100644
--- a/configs/taurus_defconfig
+++ b/configs/taurus_defconfig
@@ -49,10 +49,10 @@ CONFIG_SPL_BSS_MAX_SIZE=0x600
 # CONFIG_SPL_LEGACY_IMAGE_FORMAT is not set
 CONFIG_SPL_SYS_MALLOC_SIMPLE=y
 # CONFIG_SPL_SHARES_INIT_SP_ADDR is not set
-CONFIG_SYS_SPL_MALLOC=y
-CONFIG_HAS_CUSTOM_SPL_MALLOC_START=y
-CONFIG_CUSTOM_SYS_SPL_MALLOC_ADDR=0x20ba0000
-CONFIG_SYS_SPL_MALLOC_SIZE=0x460000
+CONFIG_SPL_SYS_MALLOC=y
+CONFIG_SPL_HAS_CUSTOM_MALLOC_START=y
+CONFIG_SPL_CUSTOM_SYS_MALLOC_ADDR=0x20ba0000
+CONFIG_SPL_SYS_MALLOC_SIZE=0x460000
 CONFIG_SPL_NAND_SUPPORT=y
 CONFIG_SPL_NAND_RAW_ONLY=y
 CONFIG_SPL_NAND_DRIVERS=y
diff --git a/configs/tec-ng_defconfig b/configs/tec-ng_defconfig
index 4776e92683d..607112c2cb2 100644
--- a/configs/tec-ng_defconfig
+++ b/configs/tec-ng_defconfig
@@ -21,10 +21,10 @@ CONFIG_SYS_STDIO_DEREGISTER=y
 CONFIG_SPL_FOOTPRINT_LIMIT=y
 CONFIG_SPL_MAX_FOOTPRINT=0x8000
 # CONFIG_SPL_SHARES_INIT_SP_ADDR is not set
-CONFIG_SYS_SPL_MALLOC=y
-CONFIG_HAS_CUSTOM_SPL_MALLOC_START=y
-CONFIG_CUSTOM_SYS_SPL_MALLOC_ADDR=0x80090000
-CONFIG_SYS_SPL_MALLOC_SIZE=0x10000
+CONFIG_SPL_SYS_MALLOC=y
+CONFIG_SPL_HAS_CUSTOM_MALLOC_START=y
+CONFIG_SPL_CUSTOM_SYS_MALLOC_ADDR=0x80090000
+CONFIG_SPL_SYS_MALLOC_SIZE=0x10000
 CONFIG_SYS_MAXARGS=64
 CONFIG_SYS_PBSIZE=2084
 # CONFIG_CMD_IMI is not set
diff --git a/configs/tec_defconfig b/configs/tec_defconfig
index 8a5d959a5c0..de76f1a39e6 100644
--- a/configs/tec_defconfig
+++ b/configs/tec_defconfig
@@ -19,10 +19,10 @@ CONFIG_SYS_STDIO_DEREGISTER=y
 CONFIG_SPL_FOOTPRINT_LIMIT=y
 CONFIG_SPL_MAX_FOOTPRINT=0x8000
 # CONFIG_SPL_SHARES_INIT_SP_ADDR is not set
-CONFIG_SYS_SPL_MALLOC=y
-CONFIG_HAS_CUSTOM_SPL_MALLOC_START=y
-CONFIG_CUSTOM_SYS_SPL_MALLOC_ADDR=0x90000
-CONFIG_SYS_SPL_MALLOC_SIZE=0x10000
+CONFIG_SPL_SYS_MALLOC=y
+CONFIG_SPL_HAS_CUSTOM_MALLOC_START=y
+CONFIG_SPL_CUSTOM_SYS_MALLOC_ADDR=0x90000
+CONFIG_SPL_SYS_MALLOC_SIZE=0x10000
 CONFIG_SYS_MAXARGS=64
 CONFIG_SYS_PBSIZE=2081
 # CONFIG_CMD_IMI is not set
diff --git a/configs/thuban_defconfig b/configs/thuban_defconfig
index 6302c1a4151..a1370bd2b9d 100644
--- a/configs/thuban_defconfig
+++ b/configs/thuban_defconfig
@@ -38,9 +38,9 @@ CONFIG_SYS_CONSOLE_INFO_QUIET=y
 # CONFIG_DISPLAY_BOARDINFO is not set
 CONFIG_ARCH_MISC_INIT=y
 CONFIG_SPL_BSS_START_ADDR=0x80000000
-CONFIG_SYS_SPL_MALLOC=y
-CONFIG_HAS_CUSTOM_SPL_MALLOC_START=y
-CONFIG_CUSTOM_SYS_SPL_MALLOC_ADDR=0x80208000
+CONFIG_SPL_SYS_MALLOC=y
+CONFIG_SPL_HAS_CUSTOM_MALLOC_START=y
+CONFIG_SPL_CUSTOM_SYS_MALLOC_ADDR=0x80208000
 CONFIG_SPL_I2C=y
 CONFIG_SPL_NAND_DRIVERS=y
 CONFIG_SPL_NAND_ECC=y
diff --git a/configs/topic_miami_defconfig b/configs/topic_miami_defconfig
index ef1b66e9069..5c845592f3d 100644
--- a/configs/topic_miami_defconfig
+++ b/configs/topic_miami_defconfig
@@ -33,8 +33,8 @@ CONFIG_SPL_BSS_START_ADDR=0x100000
 CONFIG_SPL_BSS_MAX_SIZE=0x100000
 # CONFIG_SPL_SHARES_INIT_SP_ADDR is not set
 CONFIG_SPL_STACK_R=y
-CONFIG_SYS_SPL_MALLOC=y
-CONFIG_SYS_SPL_MALLOC_SIZE=0x2000000
+CONFIG_SPL_SYS_MALLOC=y
+CONFIG_SPL_SYS_MALLOC_SIZE=0x2000000
 CONFIG_SPL_SPI_LOAD=y
 CONFIG_SYS_SPI_U_BOOT_OFFS=0x20000
 CONFIG_SYS_MAXARGS=32
diff --git a/configs/topic_miamilite_defconfig b/configs/topic_miamilite_defconfig
index af829ac15b8..3a464a52483 100644
--- a/configs/topic_miamilite_defconfig
+++ b/configs/topic_miamilite_defconfig
@@ -33,8 +33,8 @@ CONFIG_SPL_BSS_START_ADDR=0x100000
 CONFIG_SPL_BSS_MAX_SIZE=0x100000
 # CONFIG_SPL_SHARES_INIT_SP_ADDR is not set
 CONFIG_SPL_STACK_R=y
-CONFIG_SYS_SPL_MALLOC=y
-CONFIG_SYS_SPL_MALLOC_SIZE=0x2000000
+CONFIG_SPL_SYS_MALLOC=y
+CONFIG_SPL_SYS_MALLOC_SIZE=0x2000000
 CONFIG_SPL_SPI_LOAD=y
 CONFIG_SYS_SPI_U_BOOT_OFFS=0x20000
 CONFIG_SYS_MAXARGS=32
diff --git a/configs/topic_miamiplus_defconfig b/configs/topic_miamiplus_defconfig
index 9287b1d79aa..6e66081bf3b 100644
--- a/configs/topic_miamiplus_defconfig
+++ b/configs/topic_miamiplus_defconfig
@@ -33,8 +33,8 @@ CONFIG_SPL_BSS_START_ADDR=0x100000
 CONFIG_SPL_BSS_MAX_SIZE=0x100000
 # CONFIG_SPL_SHARES_INIT_SP_ADDR is not set
 CONFIG_SPL_STACK_R=y
-CONFIG_SYS_SPL_MALLOC=y
-CONFIG_SYS_SPL_MALLOC_SIZE=0x2000000
+CONFIG_SPL_SYS_MALLOC=y
+CONFIG_SPL_SYS_MALLOC_SIZE=0x2000000
 CONFIG_SPL_SPI_LOAD=y
 CONFIG_SYS_SPI_U_BOOT_OFFS=0x20000
 CONFIG_SYS_MAXARGS=32
diff --git a/configs/transformer_t30_defconfig b/configs/transformer_t30_defconfig
index 6fe6f2548dc..a46dfed74ae 100644
--- a/configs/transformer_t30_defconfig
+++ b/configs/transformer_t30_defconfig
@@ -26,10 +26,10 @@ CONFIG_BOOTCOMMAND="setenv gpio_button 150; if run check_button; then poweroff;
 CONFIG_SPL_FOOTPRINT_LIMIT=y
 CONFIG_SPL_MAX_FOOTPRINT=0x8000
 # CONFIG_SPL_SHARES_INIT_SP_ADDR is not set
-CONFIG_SYS_SPL_MALLOC=y
-CONFIG_HAS_CUSTOM_SPL_MALLOC_START=y
-CONFIG_CUSTOM_SYS_SPL_MALLOC_ADDR=0x80090000
-CONFIG_SYS_SPL_MALLOC_SIZE=0x10000
+CONFIG_SPL_SYS_MALLOC=y
+CONFIG_SPL_HAS_CUSTOM_MALLOC_START=y
+CONFIG_SPL_CUSTOM_SYS_MALLOC_ADDR=0x80090000
+CONFIG_SPL_SYS_MALLOC_SIZE=0x10000
 CONFIG_SYS_MAXARGS=64
 CONFIG_SYS_PBSIZE=2084
 CONFIG_CMD_BOOTMENU=y
diff --git a/configs/trimslice_defconfig b/configs/trimslice_defconfig
index 9ec08bda883..0e49272a80d 100644
--- a/configs/trimslice_defconfig
+++ b/configs/trimslice_defconfig
@@ -21,10 +21,10 @@ CONFIG_SYS_STDIO_DEREGISTER=y
 CONFIG_SPL_FOOTPRINT_LIMIT=y
 CONFIG_SPL_MAX_FOOTPRINT=0x8000
 # CONFIG_SPL_SHARES_INIT_SP_ADDR is not set
-CONFIG_SYS_SPL_MALLOC=y
-CONFIG_HAS_CUSTOM_SPL_MALLOC_START=y
-CONFIG_CUSTOM_SYS_SPL_MALLOC_ADDR=0x90000
-CONFIG_SYS_SPL_MALLOC_SIZE=0x10000
+CONFIG_SPL_SYS_MALLOC=y
+CONFIG_SPL_HAS_CUSTOM_MALLOC_START=y
+CONFIG_SPL_CUSTOM_SYS_MALLOC_ADDR=0x90000
+CONFIG_SPL_SYS_MALLOC_SIZE=0x10000
 CONFIG_SYS_MAXARGS=64
 CONFIG_SYS_PBSIZE=2087
 # CONFIG_CMD_IMI is not set
diff --git a/configs/udoo_defconfig b/configs/udoo_defconfig
index ab8cb489db7..e128a62cd00 100644
--- a/configs/udoo_defconfig
+++ b/configs/udoo_defconfig
@@ -23,7 +23,7 @@ CONFIG_DISTRO_DEFAULTS=y
 CONFIG_BOOTDELAY=3
 CONFIG_BOOTCOMMAND="run findfdt; run distro_bootcmd"
 CONFIG_BOARD_EARLY_INIT_F=y
-CONFIG_SYS_SPL_MALLOC=y
+CONFIG_SPL_SYS_MALLOC=y
 CONFIG_SPL_FS_EXT4=y
 CONFIG_SPL_FS_LOAD_PAYLOAD_NAME="u-boot-dtb.img"
 CONFIG_SPL_I2C=y
diff --git a/configs/udoo_neo_defconfig b/configs/udoo_neo_defconfig
index e06de7be682..853472f4f49 100644
--- a/configs/udoo_neo_defconfig
+++ b/configs/udoo_neo_defconfig
@@ -21,7 +21,7 @@ CONFIG_SPL_LIBDISK_SUPPORT=y
 # CONFIG_CMD_BMODE is not set
 CONFIG_DISTRO_DEFAULTS=y
 CONFIG_BOOTCOMMAND="run findfdt; run distro_bootcmd"
-CONFIG_SYS_SPL_MALLOC=y
+CONFIG_SPL_SYS_MALLOC=y
 CONFIG_SPL_ENV_SUPPORT=y
 CONFIG_SPL_FS_EXT4=y
 CONFIG_SPL_FS_LOAD_PAYLOAD_NAME="u-boot-dtb.img"
diff --git a/configs/variscite_dart6ul_defconfig b/configs/variscite_dart6ul_defconfig
index 1cfa3421fd1..1cf4a8fe56a 100644
--- a/configs/variscite_dart6ul_defconfig
+++ b/configs/variscite_dart6ul_defconfig
@@ -19,7 +19,7 @@ CONFIG_FIT=y
 CONFIG_DISTRO_DEFAULTS=y
 CONFIG_BOOTDELAY=3
 CONFIG_BOOTCOMMAND="run mmc_mmc_fit"
-CONFIG_SYS_SPL_MALLOC=y
+CONFIG_SPL_SYS_MALLOC=y
 CONFIG_SPL_WATCHDOG=y
 CONFIG_SYS_MAXARGS=32
 CONFIG_SYS_PBSIZE=532
diff --git a/configs/venice2_defconfig b/configs/venice2_defconfig
index ebd1754fc8b..77e6ffeb945 100644
--- a/configs/venice2_defconfig
+++ b/configs/venice2_defconfig
@@ -21,10 +21,10 @@ CONFIG_SYS_STDIO_DEREGISTER=y
 CONFIG_SPL_FOOTPRINT_LIMIT=y
 CONFIG_SPL_MAX_FOOTPRINT=0x8000
 # CONFIG_SPL_SHARES_INIT_SP_ADDR is not set
-CONFIG_SYS_SPL_MALLOC=y
-CONFIG_HAS_CUSTOM_SPL_MALLOC_START=y
-CONFIG_CUSTOM_SYS_SPL_MALLOC_ADDR=0x80090000
-CONFIG_SYS_SPL_MALLOC_SIZE=0x10000
+CONFIG_SPL_SYS_MALLOC=y
+CONFIG_SPL_HAS_CUSTOM_MALLOC_START=y
+CONFIG_SPL_CUSTOM_SYS_MALLOC_ADDR=0x80090000
+CONFIG_SPL_SYS_MALLOC_SIZE=0x10000
 CONFIG_SYS_MAXARGS=64
 CONFIG_SYS_PBSIZE=2086
 # CONFIG_CMD_IMI is not set
diff --git a/configs/ventana_defconfig b/configs/ventana_defconfig
index 2da8ba94d62..0524758b056 100644
--- a/configs/ventana_defconfig
+++ b/configs/ventana_defconfig
@@ -18,10 +18,10 @@ CONFIG_USE_PREBOOT=y
 CONFIG_SPL_FOOTPRINT_LIMIT=y
 CONFIG_SPL_MAX_FOOTPRINT=0x8000
 # CONFIG_SPL_SHARES_INIT_SP_ADDR is not set
-CONFIG_SYS_SPL_MALLOC=y
-CONFIG_HAS_CUSTOM_SPL_MALLOC_START=y
-CONFIG_CUSTOM_SYS_SPL_MALLOC_ADDR=0x90000
-CONFIG_SYS_SPL_MALLOC_SIZE=0x10000
+CONFIG_SPL_SYS_MALLOC=y
+CONFIG_SPL_HAS_CUSTOM_MALLOC_START=y
+CONFIG_SPL_CUSTOM_SYS_MALLOC_ADDR=0x90000
+CONFIG_SPL_SYS_MALLOC_SIZE=0x10000
 CONFIG_SYS_MAXARGS=64
 CONFIG_SYS_PBSIZE=2085
 # CONFIG_CMD_IMI is not set
diff --git a/configs/verdin-am62_r5_defconfig b/configs/verdin-am62_r5_defconfig
index 878195a61ac..794b6216b90 100644
--- a/configs/verdin-am62_r5_defconfig
+++ b/configs/verdin-am62_r5_defconfig
@@ -38,10 +38,10 @@ CONFIG_SPL_SYS_MALLOC_SIMPLE=y
 CONFIG_SPL_STACK_R=y
 CONFIG_SPL_STACK_R_MALLOC_SIMPLE_LEN=0x140000
 CONFIG_SPL_SEPARATE_BSS=y
-CONFIG_SYS_SPL_MALLOC=y
-CONFIG_HAS_CUSTOM_SPL_MALLOC_START=y
-CONFIG_CUSTOM_SYS_SPL_MALLOC_ADDR=0x84000000
-CONFIG_SYS_SPL_MALLOC_SIZE=0x1000000
+CONFIG_SPL_SYS_MALLOC=y
+CONFIG_SPL_HAS_CUSTOM_MALLOC_START=y
+CONFIG_SPL_CUSTOM_SYS_MALLOC_ADDR=0x84000000
+CONFIG_SPL_SYS_MALLOC_SIZE=0x1000000
 CONFIG_SPL_EARLY_BSS=y
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR=y
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0x400
diff --git a/configs/verdin-imx8mm_defconfig b/configs/verdin-imx8mm_defconfig
index 09e14c6f8c4..3e3848085c3 100644
--- a/configs/verdin-imx8mm_defconfig
+++ b/configs/verdin-imx8mm_defconfig
@@ -43,10 +43,10 @@ CONFIG_SPL_BSS_START_ADDR=0x910000
 CONFIG_SPL_BSS_MAX_SIZE=0x2000
 CONFIG_SPL_BOARD_INIT=y
 # CONFIG_SPL_SHARES_INIT_SP_ADDR is not set
-CONFIG_SYS_SPL_MALLOC=y
-CONFIG_HAS_CUSTOM_SPL_MALLOC_START=y
-CONFIG_CUSTOM_SYS_SPL_MALLOC_ADDR=0x42200000
-CONFIG_SYS_SPL_MALLOC_SIZE=0x80000
+CONFIG_SPL_SYS_MALLOC=y
+CONFIG_SPL_HAS_CUSTOM_MALLOC_START=y
+CONFIG_SPL_CUSTOM_SYS_MALLOC_ADDR=0x42200000
+CONFIG_SPL_SYS_MALLOC_SIZE=0x80000
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR=y
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0x300
 CONFIG_SPL_I2C=y
diff --git a/configs/verdin-imx8mp_defconfig b/configs/verdin-imx8mp_defconfig
index 2df0f4f3443..e499ed851c4 100644
--- a/configs/verdin-imx8mp_defconfig
+++ b/configs/verdin-imx8mp_defconfig
@@ -53,10 +53,10 @@ CONFIG_SPL_BOARD_INIT=y
 CONFIG_SPL_BOOTROM_SUPPORT=y
 CONFIG_SPL_SYS_MALLOC_SIMPLE=y
 # CONFIG_SPL_SHARES_INIT_SP_ADDR is not set
-CONFIG_SYS_SPL_MALLOC=y
-CONFIG_HAS_CUSTOM_SPL_MALLOC_START=y
-CONFIG_CUSTOM_SYS_SPL_MALLOC_ADDR=0x42200000
-CONFIG_SYS_SPL_MALLOC_SIZE=0x80000
+CONFIG_SPL_SYS_MALLOC=y
+CONFIG_SPL_HAS_CUSTOM_MALLOC_START=y
+CONFIG_SPL_CUSTOM_SYS_MALLOC_ADDR=0x42200000
+CONFIG_SPL_SYS_MALLOC_SIZE=0x80000
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR=y
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0x300
 CONFIG_SPL_I2C=y
diff --git a/configs/vining_2000_defconfig b/configs/vining_2000_defconfig
index cbb82593d09..e5d34959fca 100644
--- a/configs/vining_2000_defconfig
+++ b/configs/vining_2000_defconfig
@@ -33,7 +33,7 @@ CONFIG_USE_BOOTCOMMAND=y
 CONFIG_BOOTCOMMAND="run distro_bootcmd"
 CONFIG_SYS_CONSOLE_IS_IN_ENV=y
 CONFIG_BOARD_EARLY_INIT_F=y
-CONFIG_SYS_SPL_MALLOC=y
+CONFIG_SPL_SYS_MALLOC=y
 CONFIG_SPL_FS_EXT4=y
 CONFIG_SPL_FS_LOAD_PAYLOAD_NAME="u-boot-dtb.img"
 CONFIG_SPL_I2C=y
diff --git a/configs/wandboard_defconfig b/configs/wandboard_defconfig
index 0493ef2f67c..7c1727f8b12 100644
--- a/configs/wandboard_defconfig
+++ b/configs/wandboard_defconfig
@@ -33,7 +33,7 @@ CONFIG_SYS_CONSOLE_IS_IN_ENV=y
 CONFIG_SYS_CONSOLE_OVERWRITE_ROUTINE=y
 # CONFIG_DISPLAY_BOARDINFO is not set
 CONFIG_BOARD_EARLY_INIT_F=y
-CONFIG_SYS_SPL_MALLOC=y
+CONFIG_SPL_SYS_MALLOC=y
 CONFIG_SPL_FIT_IMAGE_TINY=y
 CONFIG_SPL_FS_EXT4=y
 CONFIG_SPL_FS_LOAD_PAYLOAD_NAME="u-boot-dtb.img"
diff --git a/configs/x3_t30_defconfig b/configs/x3_t30_defconfig
index 540c43096d8..6fbb9d6481c 100644
--- a/configs/x3_t30_defconfig
+++ b/configs/x3_t30_defconfig
@@ -27,10 +27,10 @@ CONFIG_BOOTCOMMAND="if run check_button; then bootmenu; fi; run bootcmd_mmc1; ru
 CONFIG_SPL_FOOTPRINT_LIMIT=y
 CONFIG_SPL_MAX_FOOTPRINT=0x8000
 # CONFIG_SPL_SHARES_INIT_SP_ADDR is not set
-CONFIG_SYS_SPL_MALLOC=y
-CONFIG_HAS_CUSTOM_SPL_MALLOC_START=y
-CONFIG_CUSTOM_SYS_SPL_MALLOC_ADDR=0x80090000
-CONFIG_SYS_SPL_MALLOC_SIZE=0x10000
+CONFIG_SPL_SYS_MALLOC=y
+CONFIG_SPL_HAS_CUSTOM_MALLOC_START=y
+CONFIG_SPL_CUSTOM_SYS_MALLOC_ADDR=0x80090000
+CONFIG_SPL_SYS_MALLOC_SIZE=0x10000
 CONFIG_SYS_MAXARGS=64
 CONFIG_SYS_PBSIZE=2084
 CONFIG_CMD_BOOTMENU=y
diff --git a/configs/xilinx_zynq_virt_defconfig b/configs/xilinx_zynq_virt_defconfig
index 99005773459..4ea5caff547 100644
--- a/configs/xilinx_zynq_virt_defconfig
+++ b/configs/xilinx_zynq_virt_defconfig
@@ -37,8 +37,8 @@ CONFIG_SPL_BSS_START_ADDR=0x100000
 CONFIG_SPL_BSS_MAX_SIZE=0x100000
 # CONFIG_SPL_SHARES_INIT_SP_ADDR is not set
 CONFIG_SPL_STACK_R=y
-CONFIG_SYS_SPL_MALLOC=y
-CONFIG_SYS_SPL_MALLOC_SIZE=0x2000000
+CONFIG_SPL_SYS_MALLOC=y
+CONFIG_SPL_SYS_MALLOC_SIZE=0x2000000
 CONFIG_SPL_FS_LOAD_PAYLOAD_NAME="u-boot.img"
 CONFIG_SPL_FS_LOAD_ARGS_NAME="system.dtb"
 CONFIG_SPL_FPGA=y
diff --git a/configs/xilinx_zynqmp_mini_emmc0_defconfig b/configs/xilinx_zynqmp_mini_emmc0_defconfig
index cf7c7eda8c9..72b1ad4660a 100644
--- a/configs/xilinx_zynqmp_mini_emmc0_defconfig
+++ b/configs/xilinx_zynqmp_mini_emmc0_defconfig
@@ -26,10 +26,10 @@ CONFIG_CLOCKS=y
 CONFIG_SPL_MAX_SIZE=0x40000
 CONFIG_SPL_BSS_MAX_SIZE=0x80000
 # CONFIG_SPL_SHARES_INIT_SP_ADDR is not set
-CONFIG_SYS_SPL_MALLOC=y
-CONFIG_HAS_CUSTOM_SPL_MALLOC_START=y
-CONFIG_CUSTOM_SYS_SPL_MALLOC_ADDR=0x20000000
-CONFIG_SYS_SPL_MALLOC_SIZE=0x1000000
+CONFIG_SPL_SYS_MALLOC=y
+CONFIG_SPL_HAS_CUSTOM_MALLOC_START=y
+CONFIG_SPL_CUSTOM_SYS_MALLOC_ADDR=0x20000000
+CONFIG_SPL_SYS_MALLOC_SIZE=0x1000000
 # CONFIG_CMDLINE_EDITING is not set
 # CONFIG_AUTO_COMPLETE is not set
 CONFIG_SYS_MAXARGS=64
diff --git a/configs/xilinx_zynqmp_mini_emmc1_defconfig b/configs/xilinx_zynqmp_mini_emmc1_defconfig
index a4a43b58a85..310aad445a5 100644
--- a/configs/xilinx_zynqmp_mini_emmc1_defconfig
+++ b/configs/xilinx_zynqmp_mini_emmc1_defconfig
@@ -26,10 +26,10 @@ CONFIG_CLOCKS=y
 CONFIG_SPL_MAX_SIZE=0x40000
 CONFIG_SPL_BSS_MAX_SIZE=0x80000
 # CONFIG_SPL_SHARES_INIT_SP_ADDR is not set
-CONFIG_SYS_SPL_MALLOC=y
-CONFIG_HAS_CUSTOM_SPL_MALLOC_START=y
-CONFIG_CUSTOM_SYS_SPL_MALLOC_ADDR=0x20000000
-CONFIG_SYS_SPL_MALLOC_SIZE=0x1000000
+CONFIG_SPL_SYS_MALLOC=y
+CONFIG_SPL_HAS_CUSTOM_MALLOC_START=y
+CONFIG_SPL_CUSTOM_SYS_MALLOC_ADDR=0x20000000
+CONFIG_SPL_SYS_MALLOC_SIZE=0x1000000
 # CONFIG_CMDLINE_EDITING is not set
 # CONFIG_AUTO_COMPLETE is not set
 CONFIG_SYS_MAXARGS=64
diff --git a/configs/xilinx_zynqmp_mini_qspi_defconfig b/configs/xilinx_zynqmp_mini_qspi_defconfig
index e6a9dd31a57..4c732398fc5 100644
--- a/configs/xilinx_zynqmp_mini_qspi_defconfig
+++ b/configs/xilinx_zynqmp_mini_qspi_defconfig
@@ -27,10 +27,10 @@ CONFIG_CLOCKS=y
 CONFIG_SPL_MAX_SIZE=0x40000
 CONFIG_SPL_BSS_MAX_SIZE=0x80000
 # CONFIG_SPL_SHARES_INIT_SP_ADDR is not set
-CONFIG_SYS_SPL_MALLOC=y
-CONFIG_HAS_CUSTOM_SPL_MALLOC_START=y
-CONFIG_CUSTOM_SYS_SPL_MALLOC_ADDR=0x20000000
-CONFIG_SYS_SPL_MALLOC_SIZE=0x1000000
+CONFIG_SPL_SYS_MALLOC=y
+CONFIG_SPL_HAS_CUSTOM_MALLOC_START=y
+CONFIG_SPL_CUSTOM_SYS_MALLOC_ADDR=0x20000000
+CONFIG_SPL_SYS_MALLOC_SIZE=0x1000000
 # CONFIG_CMDLINE_EDITING is not set
 # CONFIG_AUTO_COMPLETE is not set
 # CONFIG_SYS_LONGHELP is not set
diff --git a/configs/xilinx_zynqmp_virt_defconfig b/configs/xilinx_zynqmp_virt_defconfig
index 26260841c59..59be5f42493 100644
--- a/configs/xilinx_zynqmp_virt_defconfig
+++ b/configs/xilinx_zynqmp_virt_defconfig
@@ -36,10 +36,10 @@ CONFIG_SPL_MAX_SIZE=0x40000
 CONFIG_SPL_BSS_MAX_SIZE=0x80000
 # CONFIG_SPL_SHARES_INIT_SP_ADDR is not set
 CONFIG_SPL_STACK_R=y
-CONFIG_SYS_SPL_MALLOC=y
-CONFIG_HAS_CUSTOM_SPL_MALLOC_START=y
-CONFIG_CUSTOM_SYS_SPL_MALLOC_ADDR=0x20000000
-CONFIG_SYS_SPL_MALLOC_SIZE=0x1000000
+CONFIG_SPL_SYS_MALLOC=y
+CONFIG_SPL_HAS_CUSTOM_MALLOC_START=y
+CONFIG_SPL_CUSTOM_SYS_MALLOC_ADDR=0x20000000
+CONFIG_SPL_SYS_MALLOC_SIZE=0x1000000
 CONFIG_SPL_FS_LOAD_KERNEL_NAME="atf-uboot.ub"
 CONFIG_SPL_FS_LOAD_ARGS_NAME="u-boot.bin"
 CONFIG_SPL_FPGA=y
diff --git a/configs/zynq_cse_nand_defconfig b/configs/zynq_cse_nand_defconfig
index 64cdffbb9a4..19f653f40d0 100644
--- a/configs/zynq_cse_nand_defconfig
+++ b/configs/zynq_cse_nand_defconfig
@@ -28,10 +28,10 @@ CONFIG_SPL_BSS_START_ADDR=0x20000
 CONFIG_SPL_BSS_MAX_SIZE=0x8000
 # CONFIG_SPL_SHARES_INIT_SP_ADDR is not set
 CONFIG_SPL_STACK_R=y
-CONFIG_SYS_SPL_MALLOC=y
-CONFIG_HAS_CUSTOM_SPL_MALLOC_START=y
-CONFIG_CUSTOM_SYS_SPL_MALLOC_ADDR=0x200000
-CONFIG_SYS_SPL_MALLOC_SIZE=0x2000000
+CONFIG_SPL_SYS_MALLOC=y
+CONFIG_SPL_HAS_CUSTOM_MALLOC_START=y
+CONFIG_SPL_CUSTOM_SYS_MALLOC_ADDR=0x200000
+CONFIG_SPL_SYS_MALLOC_SIZE=0x2000000
 # CONFIG_CMDLINE_EDITING is not set
 # CONFIG_AUTO_COMPLETE is not set
 # CONFIG_SYS_LONGHELP is not set
diff --git a/configs/zynq_cse_nor_defconfig b/configs/zynq_cse_nor_defconfig
index 54620b2382e..64df1f0b83e 100644
--- a/configs/zynq_cse_nor_defconfig
+++ b/configs/zynq_cse_nor_defconfig
@@ -28,10 +28,10 @@ CONFIG_SPL_BSS_START_ADDR=0x20000
 CONFIG_SPL_BSS_MAX_SIZE=0x8000
 # CONFIG_SPL_SHARES_INIT_SP_ADDR is not set
 CONFIG_SPL_STACK_R=y
-CONFIG_SYS_SPL_MALLOC=y
-CONFIG_HAS_CUSTOM_SPL_MALLOC_START=y
-CONFIG_CUSTOM_SYS_SPL_MALLOC_ADDR=0x200000
-CONFIG_SYS_SPL_MALLOC_SIZE=0x2000000
+CONFIG_SPL_SYS_MALLOC=y
+CONFIG_SPL_HAS_CUSTOM_MALLOC_START=y
+CONFIG_SPL_CUSTOM_SYS_MALLOC_ADDR=0x200000
+CONFIG_SPL_SYS_MALLOC_SIZE=0x2000000
 # CONFIG_CMDLINE_EDITING is not set
 # CONFIG_AUTO_COMPLETE is not set
 # CONFIG_SYS_LONGHELP is not set
diff --git a/configs/zynq_cse_qspi_defconfig b/configs/zynq_cse_qspi_defconfig
index 08c500930fd..8c75b3233d7 100644
--- a/configs/zynq_cse_qspi_defconfig
+++ b/configs/zynq_cse_qspi_defconfig
@@ -35,10 +35,10 @@ CONFIG_SPL_BSS_START_ADDR=0x20000
 CONFIG_SPL_BSS_MAX_SIZE=0x8000
 # CONFIG_SPL_SHARES_INIT_SP_ADDR is not set
 CONFIG_SPL_STACK_R=y
-CONFIG_SYS_SPL_MALLOC=y
-CONFIG_HAS_CUSTOM_SPL_MALLOC_START=y
-CONFIG_CUSTOM_SYS_SPL_MALLOC_ADDR=0x200000
-CONFIG_SYS_SPL_MALLOC_SIZE=0x2000000
+CONFIG_SPL_SYS_MALLOC=y
+CONFIG_SPL_HAS_CUSTOM_MALLOC_START=y
+CONFIG_SPL_CUSTOM_SYS_MALLOC_ADDR=0x200000
+CONFIG_SPL_SYS_MALLOC_SIZE=0x2000000
 CONFIG_SPL_SPI_LOAD=y
 CONFIG_SYS_SPI_U_BOOT_OFFS=0x100000
 # CONFIG_CMDLINE_EDITING is not set
diff --git a/drivers/core/Kconfig b/drivers/core/Kconfig
index f0d848f45d8..4c5a00f6f9c 100644
--- a/drivers/core/Kconfig
+++ b/drivers/core/Kconfig
@@ -14,7 +14,7 @@ config SPL_DM
 	help
 	  Enable driver model in SPL. You will need to provide a
 	  suitable malloc() implementation. If you are not using the
-	  full malloc() enabled by CFG_SYS_SPL_MALLOC_START,
+	  full malloc() enabled by CFG_SPL_SYS_MALLOC_START,
 	  consider using CONFIG_SPL_SYS_MALLOC_SIMPLE. In that case you
 	  must provide CONFIG_SPL_SYS_MALLOC_F_LEN to set the size.
 	  In most cases driver model will only allocate a few uclasses
@@ -27,7 +27,7 @@ config TPL_DM
 	help
 	  Enable driver model in TPL. You will need to provide a
 	  suitable malloc() implementation. If you are not using the
-	  full malloc() enabled by CFG_SYS_SPL_MALLOC_START,
+	  full malloc() enabled by CFG_SPL_SYS_MALLOC_START,
 	  consider using CONFIG_TPL_SYS_MALLOC_SIMPLE. In that case you
 	  must provide CONFIG_SPL_SYS_MALLOC_F_LEN to set the size.
 	  In most cases driver model will only allocate a few uclasses
@@ -42,7 +42,7 @@ config VPL_DM
 	help
 	  Enable driver model in VPL. You will need to provide a
 	  suitable malloc() implementation. If you are not using the
-	  full malloc() enabled by CFG_SYS_SPL_MALLOC_START,
+	  full malloc() enabled by CFG_SPL_SYS_MALLOC_START,
 	  consider using CONFIG_SPL_SYS_MALLOC_SIMPLE.
 
 config DM_WARN
diff --git a/drivers/serial/Kconfig b/drivers/serial/Kconfig
index 7ca42df6a7e..f5478a9ccd0 100644
--- a/drivers/serial/Kconfig
+++ b/drivers/serial/Kconfig
@@ -160,7 +160,7 @@ config SERIAL_PROBE_ALL
 config SPL_DM_SERIAL
 	bool "Enable Driver Model for serial drivers in SPL"
 	depends on DM_SERIAL && SPL_DM
-	select SYS_SPL_MALLOC_F
+	select SPL_SYS_MALLOC_F
 	default y
 	help
 	  Enable driver model for serial in SPL. This replaces
diff --git a/include/configs/socfpga_common.h b/include/configs/socfpga_common.h
index 0c96c9c24fe..4838bfd4f13 100644
--- a/include/configs/socfpga_common.h
+++ b/include/configs/socfpga_common.h
@@ -18,7 +18,7 @@
 #define CFG_SYS_INIT_RAM_ADDR	0xFFE00000
 /* SPL memory allocation configuration, this is for FAT implementation */
 #define CFG_SYS_INIT_RAM_SIZE	(SOCFPGA_PHYS_OCRAM_SIZE - \
-					 CONFIG_SYS_SPL_MALLOC_SIZE)
+					 CONFIG_SPL_SYS_MALLOC_SIZE)
 #endif
 
 /*
diff --git a/include/configs/socfpga_soc64_common.h b/include/configs/socfpga_soc64_common.h
index 66ecb168a0a..820372c28b3 100644
--- a/include/configs/socfpga_soc64_common.h
+++ b/include/configs/socfpga_soc64_common.h
@@ -112,7 +112,7 @@ unsigned int cm_get_l4_sys_free_clk_hz(void);
  * SDRAM
  * 0x0000_0000 ...... Start of SDRAM_1
  * unused / empty space for image loading
- * Size 64MB   ...... MALLOC (size CONFIG_SYS_SPL_MALLOC_SIZE)
+ * Size 64MB   ...... MALLOC (size CONFIG_SPL_SYS_MALLOC_SIZE)
  * Size 1MB    ...... BSS (size CONFIG_SPL_BSS_MAX_SIZE)
  * 0x8000_0000 ...... End of SDRAM_1 (assume 2GB)
  *
diff --git a/include/system-constants.h b/include/system-constants.h
index 0d6b71b35a0..f0a191be590 100644
--- a/include/system-constants.h
+++ b/include/system-constants.h
@@ -22,10 +22,10 @@
 /*
  * Typically, we have the SPL malloc pool at the end of the BSS area.
  */
-#ifdef CONFIG_HAS_CUSTOM_SPL_MALLOC_START
-#define SYS_SPL_MALLOC_START		CONFIG_CUSTOM_SYS_SPL_MALLOC_ADDR
+#ifdef CONFIG_SPL_HAS_CUSTOM_MALLOC_START
+#define SPL_SYS_MALLOC_START		CONFIG_SPL_CUSTOM_SYS_MALLOC_ADDR
 #else
-#define SYS_SPL_MALLOC_START		(CONFIG_SPL_BSS_START_ADDR + \
+#define SPL_SYS_MALLOC_START		(CONFIG_SPL_BSS_START_ADDR + \
 					 CONFIG_SPL_BSS_MAX_SIZE)
 #endif
 
-- 
2.42.0.rc2.253.gd59a3bf2b4-goog


^ permalink raw reply related	[flat|nested] 86+ messages in thread

* [PATCH 03/32] spl: Rename SYS_SPL_ARGS_ADDR to SPL_SYS_ARGS_ADDR
  2023-08-30 18:04 [PATCH 00/32] spl: Preparation for Universal Payload Simon Glass
  2023-08-30 18:04 ` [PATCH 01/32] dm: core: support reading a single indexed u64 value Simon Glass
  2023-08-30 18:04 ` [PATCH 02/32] spl: Use CONFIG_SPL... instead of CONFIG_..._SPL_ Simon Glass
@ 2023-08-30 18:04 ` Simon Glass
  2023-08-30 21:37   ` Tom Rini
  2023-08-30 18:04 ` [PATCH 04/32] spl: Avoid #ifdef with CONFIG_SPL_SYS_MALLOC Simon Glass
                   ` (28 subsequent siblings)
  31 siblings, 1 reply; 86+ messages in thread
From: Simon Glass @ 2023-08-30 18:04 UTC (permalink / raw)
  To: U-Boot Mailing List
  Cc: Tom Rini, Marek Vasut, Simon Glass, Adam Ford, Andre Przywara,
	Elena Popa, Enric Balletbo i Serra, Eric Bénard,
	Heinrich Schuchardt, Ilias Apalodimas, Jagan Teki,
	Leo Yu-Chi Liang, Lukasz Majewski, Mario Kicherer,
	Mayuresh Chitale, Michal Simek, Mingkai Hu,
	Nathan Barrett-Morrison, Nikhil M Jain, Oleksandr Suvorov,
	Patrice Chotard, Raffaele RECALCATI, Roger Quadros,
	Simone CIANNI, Stefan Roese, Thomas Weber, Tim Harvey,
	Tom McLeod, Vikas Manocha, uboot-stm32

Rename this so that SPL is first, as per U-Boot convention.

Signed-off-by: Simon Glass <sjg@chromium.org>
---

 arch/arm/cpu/armv8/fsl-layerscape/doc/README.falcon |  2 +-
 common/spl/Kconfig                                  |  2 +-
 common/spl/spl.c                                    |  8 ++++----
 common/spl/spl_ext.c                                |  4 ++--
 common/spl/spl_fat.c                                |  4 ++--
 common/spl/spl_mmc.c                                |  2 +-
 common/spl/spl_nand.c                               | 10 +++++-----
 common/spl/spl_nor.c                                |  8 ++++----
 common/spl/spl_spi.c                                |  2 +-
 common/spl/spl_ubi.c                                |  2 +-
 common/spl/spl_xip.c                                |  2 +-
 configs/am3517_evm_defconfig                        |  2 +-
 configs/devkit8000_defconfig                        |  2 +-
 configs/display5_defconfig                          |  2 +-
 configs/display5_factory_defconfig                  |  2 +-
 configs/gwventana_emmc_defconfig                    |  2 +-
 configs/gwventana_nand_defconfig                    |  2 +-
 configs/igep00x0_defconfig                          |  2 +-
 configs/imx28_xea_defconfig                         |  2 +-
 configs/imx6dl_mamoj_defconfig                      |  2 +-
 configs/imx6q_logic_defconfig                       |  2 +-
 configs/imx6qdl_icore_mipi_defconfig                |  2 +-
 configs/imx6qdl_icore_mmc_defconfig                 |  2 +-
 configs/imx6qdl_icore_rqs_defconfig                 |  2 +-
 configs/ls1046ardb_qspi_spl_defconfig               |  2 +-
 configs/mccmon6_nor_defconfig                       |  2 +-
 configs/omap35_logic_defconfig                      |  2 +-
 configs/omap35_logic_somlv_defconfig                |  2 +-
 configs/omap3_logic_defconfig                       |  2 +-
 configs/omap3_logic_somlv_defconfig                 |  2 +-
 configs/riotboard_defconfig                         |  2 +-
 configs/stm32746g-eval_spl_defconfig                |  2 +-
 configs/stm32f746-disco_spl_defconfig               |  2 +-
 configs/stm32f769-disco_spl_defconfig               |  2 +-
 configs/syzygy_hub_defconfig                        |  2 +-
 configs/vyasa-rk3288_defconfig                      |  2 +-
 configs/xilinx_zynq_virt_defconfig                  |  2 +-
 configs/xilinx_zynqmp_virt_defconfig                |  2 +-
 doc/develop/falcon.rst                              |  2 +-
 39 files changed, 51 insertions(+), 51 deletions(-)

diff --git a/arch/arm/cpu/armv8/fsl-layerscape/doc/README.falcon b/arch/arm/cpu/armv8/fsl-layerscape/doc/README.falcon
index b3c6693a42c..9380795455b 100644
--- a/arch/arm/cpu/armv8/fsl-layerscape/doc/README.falcon
+++ b/arch/arm/cpu/armv8/fsl-layerscape/doc/README.falcon
@@ -30,7 +30,7 @@ to understand the device tree in FIT image should be the one actually used, or
 leave it absent to favor the stored sectors. It is easier to deploy the FIT
 image with embedded static device tree to multiple boards.
 
-Macro CONFIG_SYS_SPL_ARGS_ADDR serves two purposes. One is the pointer to load
+Macro CONFIG_SPL_SYS_ARGS_ADDR serves two purposes. One is the pointer to load
 the stored sectors to. Normally this is the static device tree. The second
 purpose is the memory location of signature header for secure boot. After the
 FIT image is loaded into memory, it is validated against the signature header
diff --git a/common/spl/Kconfig b/common/spl/Kconfig
index b9d96fbe135..c23a1f7750b 100644
--- a/common/spl/Kconfig
+++ b/common/spl/Kconfig
@@ -1063,7 +1063,7 @@ config SPL_OS_BOOT
 	  Enable booting directly to an OS from SPL.
 	  for more info read doc/README.falcon
 
-config SYS_SPL_ARGS_ADDR
+config SPL_SYS_ARGS_ADDR
 	hex "Address in memory to load 'args' file for Falcon Mode to"
 	depends on SPL_OS_BOOT
 	default 0x88000000 if ARCH_OMAP2PLUS
diff --git a/common/spl/spl.c b/common/spl/spl.c
index 1e50043cf77..27266b393ea 100644
--- a/common/spl/spl.c
+++ b/common/spl/spl.c
@@ -818,8 +818,8 @@ void board_init_r(gd_t *dummy1, ulong dummy2)
 	}
 
 	memset(&spl_image, '\0', sizeof(spl_image));
-#ifdef CONFIG_SYS_SPL_ARGS_ADDR
-	spl_image.arg = (void *)CONFIG_SYS_SPL_ARGS_ADDR;
+#ifdef CONFIG_SPL_SYS_ARGS_ADDR
+	spl_image.arg = (void *)CONFIG_SPL_SYS_ARGS_ADDR;
 #endif
 	spl_image.boot_device = BOOT_DEVICE_NONE;
 	board_boot_order(spl_boot_list);
@@ -877,8 +877,8 @@ void board_init_r(gd_t *dummy1, ulong dummy2)
 #if CONFIG_IS_ENABLED(OS_BOOT)
 	case IH_OS_LINUX:
 		debug("Jumping to Linux\n");
-#if defined(CONFIG_SYS_SPL_ARGS_ADDR)
-		spl_fixup_fdt((void *)CONFIG_SYS_SPL_ARGS_ADDR);
+#if defined(CONFIG_SPL_SYS_ARGS_ADDR)
+		spl_fixup_fdt((void *)CONFIG_SPL_SYS_ARGS_ADDR);
 #endif
 		spl_board_prepare_for_linux();
 		jump_to_image_linux(&spl_image);
diff --git a/common/spl/spl_ext.c b/common/spl/spl_ext.c
index 2bf34344391..98fc790fc64 100644
--- a/common/spl/spl_ext.c
+++ b/common/spl/spl_ext.c
@@ -97,7 +97,7 @@ int spl_load_image_ext_os(struct spl_image_info *spl_image,
 			puts("spl: ext4fs_open failed\n");
 			goto defaults;
 		}
-		err = ext4fs_read((void *)CONFIG_SYS_SPL_ARGS_ADDR, 0, filelen, &actlen);
+		err = ext4fs_read((void *)CONFIG_SPL_SYS_ARGS_ADDR, 0, filelen, &actlen);
 		if (err < 0) {
 			printf("spl: error reading image %s, err - %d, falling back to default\n",
 			       file, err);
@@ -127,7 +127,7 @@ defaults:
 	if (err < 0)
 		puts("spl: ext4fs_open failed\n");
 
-	err = ext4fs_read((void *)CONFIG_SYS_SPL_ARGS_ADDR, 0, filelen, &actlen);
+	err = ext4fs_read((void *)CONFIG_SPL_SYS_ARGS_ADDR, 0, filelen, &actlen);
 	if (err < 0) {
 #ifdef CONFIG_SPL_LIBCOMMON_SUPPORT
 		printf("%s: error reading image %s, err - %d\n",
diff --git a/common/spl/spl_fat.c b/common/spl/spl_fat.c
index f8a5b80a3bd..60187e340de 100644
--- a/common/spl/spl_fat.c
+++ b/common/spl/spl_fat.c
@@ -128,7 +128,7 @@ int spl_load_image_fat_os(struct spl_image_info *spl_image,
 #if defined(CONFIG_SPL_ENV_SUPPORT) && defined(CONFIG_SPL_OS_BOOT)
 	file = env_get("falcon_args_file");
 	if (file) {
-		err = file_fat_read(file, (void *)CONFIG_SYS_SPL_ARGS_ADDR, 0);
+		err = file_fat_read(file, (void *)CONFIG_SPL_SYS_ARGS_ADDR, 0);
 		if (err <= 0) {
 			printf("spl: error reading image %s, err - %d, falling back to default\n",
 			       file, err);
@@ -153,7 +153,7 @@ defaults:
 #endif
 
 	err = file_fat_read(CONFIG_SPL_FS_LOAD_ARGS_NAME,
-			    (void *)CONFIG_SYS_SPL_ARGS_ADDR, 0);
+			    (void *)CONFIG_SPL_SYS_ARGS_ADDR, 0);
 	if (err <= 0) {
 #ifdef CONFIG_SPL_LIBCOMMON_SUPPORT
 		printf("%s: error reading image %s, err - %d\n",
diff --git a/common/spl/spl_mmc.c b/common/spl/spl_mmc.c
index 20f687e1389..689b33af72c 100644
--- a/common/spl/spl_mmc.c
+++ b/common/spl/spl_mmc.c
@@ -235,7 +235,7 @@ static int mmc_load_image_raw_os(struct spl_image_info *spl_image,
 	count = blk_dread(mmc_get_blk_desc(mmc),
 		CONFIG_SYS_MMCSD_RAW_MODE_ARGS_SECTOR,
 		CONFIG_SYS_MMCSD_RAW_MODE_ARGS_SECTORS,
-		(void *) CONFIG_SYS_SPL_ARGS_ADDR);
+		(void *)CONFIG_SPL_SYS_ARGS_ADDR);
 	if (count != CONFIG_SYS_MMCSD_RAW_MODE_ARGS_SECTORS) {
 #ifdef CONFIG_SPL_LIBCOMMON_SUPPORT
 		puts("mmc_load_image_raw_os: mmc block read error\n");
diff --git a/common/spl/spl_nand.c b/common/spl/spl_nand.c
index dc45204fc0e..7687a27a3c7 100644
--- a/common/spl/spl_nand.c
+++ b/common/spl/spl_nand.c
@@ -159,11 +159,11 @@ static int spl_nand_load_image(struct spl_image_info *spl_image,
 			CONFIG_CMD_SPL_WRITE_SIZE,
 			(void *)CONFIG_TEXT_BASE);
 		/* copy to destintion */
-		for (dst = (int *)CONFIG_SYS_SPL_ARGS_ADDR,
-				src = (int *)CONFIG_TEXT_BASE;
-				src < (int *)(CONFIG_TEXT_BASE +
-				CONFIG_CMD_SPL_WRITE_SIZE);
-				src++, dst++) {
+		for (dst = (int *)CONFIG_SPL_SYS_ARGS_ADDR,
+		     src = (int *)CONFIG_TEXT_BASE;
+			src < (int *)(CONFIG_TEXT_BASE +
+				      CONFIG_CMD_SPL_WRITE_SIZE);
+		     src++, dst++) {
 			writel(readl(src), dst);
 		}
 
diff --git a/common/spl/spl_nor.c b/common/spl/spl_nor.c
index 5b65b96a77d..3a0e88a2a59 100644
--- a/common/spl/spl_nor.c
+++ b/common/spl/spl_nor.c
@@ -54,8 +54,8 @@ static int spl_nor_load_image(struct spl_image_info *spl_image,
 						  CONFIG_SYS_OS_BASE,
 						  (void *)header);
 
-#if defined CONFIG_SYS_SPL_ARGS_ADDR && defined CONFIG_CMD_SPL_NOR_OFS
-			memcpy((void *)CONFIG_SYS_SPL_ARGS_ADDR,
+#if defined CONFIG_SPL_SYS_ARGS_ADDR && defined CONFIG_CMD_SPL_NOR_OFS
+			memcpy((void *)CONFIG_SPL_SYS_ARGS_ADDR,
 			       (void *)CONFIG_CMD_SPL_NOR_OFS,
 			       CONFIG_CMD_SPL_WRITE_SIZE);
 #endif
@@ -74,8 +74,8 @@ static int spl_nor_load_image(struct spl_image_info *spl_image,
 			       (void *)(CONFIG_SYS_OS_BASE +
 					sizeof(struct legacy_img_hdr)),
 			       spl_image->size);
-#ifdef CONFIG_SYS_SPL_ARGS_ADDR
-			spl_image->arg = (void *)CONFIG_SYS_SPL_ARGS_ADDR;
+#ifdef CONFIG_SPL_SYS_ARGS_ADDR
+			spl_image->arg = (void *)CONFIG_SPL_SYS_ARGS_ADDR;
 #endif
 
 			return 0;
diff --git a/common/spl/spl_spi.c b/common/spl/spl_spi.c
index 2aff025f76e..7a6861f0661 100644
--- a/common/spl/spl_spi.c
+++ b/common/spl/spl_spi.c
@@ -47,7 +47,7 @@ static int spi_load_image_os(struct spl_image_info *spl_image,
 	/* Read device tree. */
 	spi_flash_read(flash, CFG_SYS_SPI_ARGS_OFFS,
 		       CFG_SYS_SPI_ARGS_SIZE,
-		       (void *)CONFIG_SYS_SPL_ARGS_ADDR);
+		       (void *)CONFIG_SPL_SYS_ARGS_ADDR);
 
 	return 0;
 }
diff --git a/common/spl/spl_ubi.c b/common/spl/spl_ubi.c
index bcac25cd021..b8dcf766636 100644
--- a/common/spl/spl_ubi.c
+++ b/common/spl/spl_ubi.c
@@ -50,7 +50,7 @@ int spl_ubi_load_image(struct spl_image_info *spl_image,
 		volumes[0].vol_id = CONFIG_SPL_UBI_LOAD_KERNEL_ID;
 		volumes[0].load_addr = (void *)CONFIG_SYS_LOAD_ADDR;
 		volumes[1].vol_id = CONFIG_SPL_UBI_LOAD_ARGS_ID;
-		volumes[1].load_addr = (void *)CONFIG_SYS_SPL_ARGS_ADDR;
+		volumes[1].load_addr = (void *)CONFIG_SPL_SYS_ARGS_ADDR;
 
 		ret = ubispl_load_volumes(&info, volumes, 2);
 		if (!ret) {
diff --git a/common/spl/spl_xip.c b/common/spl/spl_xip.c
index 77c23ba0597..2882b97fec5 100644
--- a/common/spl/spl_xip.c
+++ b/common/spl/spl_xip.c
@@ -14,7 +14,7 @@ static int spl_xip(struct spl_image_info *spl_image,
 {
 #if CONFIG_IS_ENABLED(OS_BOOT)
 	if (!spl_start_uboot()) {
-		spl_image->arg = (void *)CONFIG_SYS_SPL_ARGS_ADDR;
+		spl_image->arg = (void *)CONFIG_SPL_SYS_ARGS_ADDR;
 		spl_image->name = "Linux";
 		spl_image->os = IH_OS_LINUX;
 		spl_image->load_addr = CONFIG_SYS_LOAD_ADDR;
diff --git a/configs/am3517_evm_defconfig b/configs/am3517_evm_defconfig
index dda23549278..5286706fea2 100644
--- a/configs/am3517_evm_defconfig
+++ b/configs/am3517_evm_defconfig
@@ -33,7 +33,7 @@ CONFIG_SPL_NAND_ECC=y
 CONFIG_SPL_NAND_SIMPLE=y
 CONFIG_SPL_NAND_BASE=y
 CONFIG_SPL_OS_BOOT=y
-CONFIG_SYS_SPL_ARGS_ADDR=0x84000000
+CONFIG_SPL_SYS_ARGS_ADDR=0x84000000
 CONFIG_SYS_NAND_SPL_KERNEL_OFFS=0x2a0000
 CONFIG_SPL_FALCON_BOOT_MMCSD=y
 CONFIG_SYS_MMCSD_RAW_MODE_KERNEL_SECTOR=0x1700
diff --git a/configs/devkit8000_defconfig b/configs/devkit8000_defconfig
index 1431e54dc95..a4813c6462e 100644
--- a/configs/devkit8000_defconfig
+++ b/configs/devkit8000_defconfig
@@ -28,7 +28,7 @@ CONFIG_SPL_NAND_ECC=y
 CONFIG_SPL_NAND_SIMPLE=y
 CONFIG_SPL_NAND_BASE=y
 CONFIG_SPL_OS_BOOT=y
-CONFIG_SYS_SPL_ARGS_ADDR=0x80000100
+CONFIG_SPL_SYS_ARGS_ADDR=0x80000100
 CONFIG_SYS_NAND_SPL_KERNEL_OFFS=0x280000
 CONFIG_SPL_FALCON_BOOT_MMCSD=y
 CONFIG_SYS_MMCSD_RAW_MODE_KERNEL_SECTOR=0x500
diff --git a/configs/display5_defconfig b/configs/display5_defconfig
index 9c4334af15c..13afe1e2d5c 100644
--- a/configs/display5_defconfig
+++ b/configs/display5_defconfig
@@ -46,7 +46,7 @@ CONFIG_SPL_ENV_SUPPORT=y
 CONFIG_SPL_SAVEENV=y
 CONFIG_SPL_I2C=y
 CONFIG_SPL_OS_BOOT=y
-CONFIG_SYS_SPL_ARGS_ADDR=0x18000000
+CONFIG_SPL_SYS_ARGS_ADDR=0x18000000
 CONFIG_SPL_FALCON_BOOT_MMCSD=y
 CONFIG_SYS_MMCSD_RAW_MODE_KERNEL_SECTOR=0x100
 CONFIG_SYS_MMCSD_RAW_MODE_ARGS_SECTOR=0x3F00
diff --git a/configs/display5_factory_defconfig b/configs/display5_factory_defconfig
index 67ba7658861..78ceecf1c1c 100644
--- a/configs/display5_factory_defconfig
+++ b/configs/display5_factory_defconfig
@@ -41,7 +41,7 @@ CONFIG_SPL_SYS_MALLOC=y
 CONFIG_SPL_DMA=y
 CONFIG_SPL_I2C=y
 CONFIG_SPL_OS_BOOT=y
-CONFIG_SYS_SPL_ARGS_ADDR=0x18000000
+CONFIG_SPL_SYS_ARGS_ADDR=0x18000000
 CONFIG_SPL_FALCON_BOOT_MMCSD=y
 CONFIG_SYS_MMCSD_RAW_MODE_KERNEL_SECTOR=0x100
 CONFIG_SYS_MMCSD_RAW_MODE_ARGS_SECTOR=0x3F00
diff --git a/configs/gwventana_emmc_defconfig b/configs/gwventana_emmc_defconfig
index eb29268c6fa..445e03d818b 100644
--- a/configs/gwventana_emmc_defconfig
+++ b/configs/gwventana_emmc_defconfig
@@ -49,7 +49,7 @@ CONFIG_SPL_FIT_IMAGE_TINY=y
 CONFIG_SPL_DMA=y
 CONFIG_SPL_I2C=y
 CONFIG_SPL_OS_BOOT=y
-CONFIG_SYS_SPL_ARGS_ADDR=0x18000000
+CONFIG_SPL_SYS_ARGS_ADDR=0x18000000
 CONFIG_SPL_FALCON_BOOT_MMCSD=y
 CONFIG_SYS_MMCSD_RAW_MODE_KERNEL_SECTOR=0x1000
 CONFIG_SYS_MMCSD_RAW_MODE_ARGS_SECTOR=0x800
diff --git a/configs/gwventana_nand_defconfig b/configs/gwventana_nand_defconfig
index 17a86d6447d..1bf9ed4bbca 100644
--- a/configs/gwventana_nand_defconfig
+++ b/configs/gwventana_nand_defconfig
@@ -50,7 +50,7 @@ CONFIG_SPL_DMA=y
 CONFIG_SPL_I2C=y
 CONFIG_SPL_NAND_SUPPORT=y
 CONFIG_SPL_OS_BOOT=y
-CONFIG_SYS_SPL_ARGS_ADDR=0x18000000
+CONFIG_SPL_SYS_ARGS_ADDR=0x18000000
 CONFIG_SYS_NAND_SPL_KERNEL_OFFS=0x1200000
 CONFIG_SPL_FALCON_BOOT_MMCSD=y
 CONFIG_SYS_MMCSD_RAW_MODE_KERNEL_SECTOR=0x1000
diff --git a/configs/igep00x0_defconfig b/configs/igep00x0_defconfig
index e0cc3995966..b8aa1abe093 100644
--- a/configs/igep00x0_defconfig
+++ b/configs/igep00x0_defconfig
@@ -42,7 +42,7 @@ CONFIG_SPL_UBI_LOAD_KERNEL_ID=3
 CONFIG_SPL_UBI_LOAD_ARGS_ID=4
 CONFIG_SPL_ONENAND_SUPPORT=y
 CONFIG_SPL_OS_BOOT=y
-CONFIG_SYS_SPL_ARGS_ADDR=0x84000000
+CONFIG_SPL_SYS_ARGS_ADDR=0x84000000
 CONFIG_SYS_NAND_SPL_KERNEL_OFFS=0x280000
 CONFIG_SPL_FALCON_BOOT_MMCSD=y
 CONFIG_SYS_MMCSD_RAW_MODE_KERNEL_SECTOR=0x1700
diff --git a/configs/imx28_xea_defconfig b/configs/imx28_xea_defconfig
index 96d15e89af8..ba071f2293c 100644
--- a/configs/imx28_xea_defconfig
+++ b/configs/imx28_xea_defconfig
@@ -51,7 +51,7 @@ CONFIG_SPL_DMA=y
 CONFIG_SPL_MMC_TINY=y
 CONFIG_SPL_DM_SPI_FLASH=y
 CONFIG_SPL_OS_BOOT=y
-CONFIG_SYS_SPL_ARGS_ADDR=0x44000000
+CONFIG_SPL_SYS_ARGS_ADDR=0x44000000
 CONFIG_SPL_FALCON_BOOT_MMCSD=y
 CONFIG_SYS_MMCSD_RAW_MODE_KERNEL_SECTOR=0x800
 CONFIG_SYS_MMCSD_RAW_MODE_ARGS_SECTOR=0x400
diff --git a/configs/imx6dl_mamoj_defconfig b/configs/imx6dl_mamoj_defconfig
index 933a9d83f34..fdc4bfbe107 100644
--- a/configs/imx6dl_mamoj_defconfig
+++ b/configs/imx6dl_mamoj_defconfig
@@ -20,7 +20,7 @@ CONFIG_DISTRO_DEFAULTS=y
 CONFIG_BOOTDELAY=3
 CONFIG_SPL_SYS_MALLOC=y
 CONFIG_SPL_OS_BOOT=y
-CONFIG_SYS_SPL_ARGS_ADDR=0x13000000
+CONFIG_SPL_SYS_ARGS_ADDR=0x13000000
 CONFIG_SPL_FALCON_BOOT_MMCSD=y
 CONFIG_SYS_MMCSD_RAW_MODE_KERNEL_SECTOR=0x1000
 CONFIG_SYS_MMCSD_RAW_MODE_ARGS_SECTOR=0x800
diff --git a/configs/imx6q_logic_defconfig b/configs/imx6q_logic_defconfig
index b307fea5f25..a75e8a5eb73 100644
--- a/configs/imx6q_logic_defconfig
+++ b/configs/imx6q_logic_defconfig
@@ -36,7 +36,7 @@ CONFIG_SPL_FS_LOAD_PAYLOAD_NAME="u-boot-dtb.img"
 CONFIG_SPL_I2C=y
 CONFIG_SPL_NAND_SUPPORT=y
 CONFIG_SPL_OS_BOOT=y
-CONFIG_SYS_SPL_ARGS_ADDR=0x18000000
+CONFIG_SPL_SYS_ARGS_ADDR=0x18000000
 CONFIG_SYS_NAND_SPL_KERNEL_OFFS=0x500000
 CONFIG_SPL_FALCON_BOOT_MMCSD=y
 CONFIG_SYS_MMCSD_RAW_MODE_KERNEL_SECTOR=0x1000
diff --git a/configs/imx6qdl_icore_mipi_defconfig b/configs/imx6qdl_icore_mipi_defconfig
index ecb8fb2ba57..256cd5ba244 100644
--- a/configs/imx6qdl_icore_mipi_defconfig
+++ b/configs/imx6qdl_icore_mipi_defconfig
@@ -36,7 +36,7 @@ CONFIG_BOOTCOMMAND="run $modeboot"
 CONFIG_SPL_RAW_IMAGE_SUPPORT=y
 CONFIG_SPL_SYS_MALLOC=y
 CONFIG_SPL_OS_BOOT=y
-CONFIG_SYS_SPL_ARGS_ADDR=0x18000000
+CONFIG_SPL_SYS_ARGS_ADDR=0x18000000
 CONFIG_SPL_FALCON_BOOT_MMCSD=y
 CONFIG_SYS_MMCSD_RAW_MODE_KERNEL_SECTOR=0x1000
 CONFIG_SYS_MMCSD_RAW_MODE_ARGS_SECTOR=0x800
diff --git a/configs/imx6qdl_icore_mmc_defconfig b/configs/imx6qdl_icore_mmc_defconfig
index 42889188cc3..f65f648a834 100644
--- a/configs/imx6qdl_icore_mmc_defconfig
+++ b/configs/imx6qdl_icore_mmc_defconfig
@@ -39,7 +39,7 @@ CONFIG_BOOTCOMMAND="run $modeboot"
 CONFIG_SPL_RAW_IMAGE_SUPPORT=y
 CONFIG_SPL_SYS_MALLOC=y
 CONFIG_SPL_OS_BOOT=y
-CONFIG_SYS_SPL_ARGS_ADDR=0x18000000
+CONFIG_SPL_SYS_ARGS_ADDR=0x18000000
 CONFIG_SPL_FALCON_BOOT_MMCSD=y
 CONFIG_SYS_MMCSD_RAW_MODE_KERNEL_SECTOR=0x1000
 CONFIG_SYS_MMCSD_RAW_MODE_ARGS_SECTOR=0x800
diff --git a/configs/imx6qdl_icore_rqs_defconfig b/configs/imx6qdl_icore_rqs_defconfig
index 2ab42979fa6..06438b44649 100644
--- a/configs/imx6qdl_icore_rqs_defconfig
+++ b/configs/imx6qdl_icore_rqs_defconfig
@@ -33,7 +33,7 @@ CONFIG_BOOTCOMMAND="run $modeboot"
 CONFIG_SPL_RAW_IMAGE_SUPPORT=y
 CONFIG_SPL_SYS_MALLOC=y
 CONFIG_SPL_OS_BOOT=y
-CONFIG_SYS_SPL_ARGS_ADDR=0x18000000
+CONFIG_SPL_SYS_ARGS_ADDR=0x18000000
 CONFIG_SPL_FALCON_BOOT_MMCSD=y
 CONFIG_SYS_MMCSD_RAW_MODE_KERNEL_SECTOR=0x1000
 CONFIG_SYS_MMCSD_RAW_MODE_ARGS_SECTOR=0x800
diff --git a/configs/ls1046ardb_qspi_spl_defconfig b/configs/ls1046ardb_qspi_spl_defconfig
index e11a90f09b2..25efda7d0d1 100644
--- a/configs/ls1046ardb_qspi_spl_defconfig
+++ b/configs/ls1046ardb_qspi_spl_defconfig
@@ -61,7 +61,7 @@ CONFIG_SPL_I2C=y
 CONFIG_SPL_MPC8XXX_INIT_DDR=y
 CONFIG_SPL_NOR_SUPPORT=y
 CONFIG_SPL_OS_BOOT=y
-CONFIG_SYS_SPL_ARGS_ADDR=0x90000000
+CONFIG_SPL_SYS_ARGS_ADDR=0x90000000
 CONFIG_SYS_OS_BASE=0x40980000
 CONFIG_SPL_WATCHDOG=y
 CONFIG_SPL_TARGET="spl/u-boot-spl.pbl"
diff --git a/configs/mccmon6_nor_defconfig b/configs/mccmon6_nor_defconfig
index 88a72b39299..aa30bf63a81 100644
--- a/configs/mccmon6_nor_defconfig
+++ b/configs/mccmon6_nor_defconfig
@@ -29,7 +29,7 @@ CONFIG_SPL_FIT_IMAGE_TINY=y
 CONFIG_SPL_ENV_SUPPORT=y
 CONFIG_SPL_NOR_SUPPORT=y
 CONFIG_SPL_OS_BOOT=y
-CONFIG_SYS_SPL_ARGS_ADDR=0x18000000
+CONFIG_SPL_SYS_ARGS_ADDR=0x18000000
 CONFIG_SYS_OS_BASE=0x8180000
 CONFIG_SYS_MAXARGS=32
 CONFIG_SYS_PBSIZE=532
diff --git a/configs/omap35_logic_defconfig b/configs/omap35_logic_defconfig
index 3534753dd3e..62ff875b6a8 100644
--- a/configs/omap35_logic_defconfig
+++ b/configs/omap35_logic_defconfig
@@ -37,7 +37,7 @@ CONFIG_SPL_NAND_ECC=y
 CONFIG_SPL_NAND_SIMPLE=y
 CONFIG_SPL_NAND_BASE=y
 CONFIG_SPL_OS_BOOT=y
-CONFIG_SYS_SPL_ARGS_ADDR=0x84000000
+CONFIG_SPL_SYS_ARGS_ADDR=0x84000000
 CONFIG_SYS_NAND_SPL_KERNEL_OFFS=0x280000
 CONFIG_SPL_FALCON_BOOT_MMCSD=y
 CONFIG_SYS_MMCSD_RAW_MODE_KERNEL_SECTOR=0x1700
diff --git a/configs/omap35_logic_somlv_defconfig b/configs/omap35_logic_somlv_defconfig
index 835252acc9b..556664aa08b 100644
--- a/configs/omap35_logic_somlv_defconfig
+++ b/configs/omap35_logic_somlv_defconfig
@@ -38,7 +38,7 @@ CONFIG_SPL_NAND_ECC=y
 CONFIG_SPL_NAND_SIMPLE=y
 CONFIG_SPL_NAND_BASE=y
 CONFIG_SPL_OS_BOOT=y
-CONFIG_SYS_SPL_ARGS_ADDR=0x84000000
+CONFIG_SPL_SYS_ARGS_ADDR=0x84000000
 CONFIG_SYS_NAND_SPL_KERNEL_OFFS=0x280000
 CONFIG_SPL_FALCON_BOOT_MMCSD=y
 CONFIG_SYS_MMCSD_RAW_MODE_KERNEL_SECTOR=0x1700
diff --git a/configs/omap3_logic_defconfig b/configs/omap3_logic_defconfig
index e747a0c1e93..6b3771803b9 100644
--- a/configs/omap3_logic_defconfig
+++ b/configs/omap3_logic_defconfig
@@ -36,7 +36,7 @@ CONFIG_SPL_NAND_ECC=y
 CONFIG_SPL_NAND_SIMPLE=y
 CONFIG_SPL_NAND_BASE=y
 CONFIG_SPL_OS_BOOT=y
-CONFIG_SYS_SPL_ARGS_ADDR=0x84000000
+CONFIG_SPL_SYS_ARGS_ADDR=0x84000000
 CONFIG_SYS_NAND_SPL_KERNEL_OFFS=0x280000
 CONFIG_SPL_FALCON_BOOT_MMCSD=y
 CONFIG_SYS_MMCSD_RAW_MODE_KERNEL_SECTOR=0x1700
diff --git a/configs/omap3_logic_somlv_defconfig b/configs/omap3_logic_somlv_defconfig
index b9d6284faad..c3c0cde8d16 100644
--- a/configs/omap3_logic_somlv_defconfig
+++ b/configs/omap3_logic_somlv_defconfig
@@ -38,7 +38,7 @@ CONFIG_SPL_NAND_ECC=y
 CONFIG_SPL_NAND_SIMPLE=y
 CONFIG_SPL_NAND_BASE=y
 CONFIG_SPL_OS_BOOT=y
-CONFIG_SYS_SPL_ARGS_ADDR=0x84000000
+CONFIG_SPL_SYS_ARGS_ADDR=0x84000000
 CONFIG_SYS_NAND_SPL_KERNEL_OFFS=0x280000
 CONFIG_SPL_FALCON_BOOT_MMCSD=y
 CONFIG_SYS_MMCSD_RAW_MODE_KERNEL_SECTOR=0x1700
diff --git a/configs/riotboard_defconfig b/configs/riotboard_defconfig
index f8bc8c63969..a8959ce9d7b 100644
--- a/configs/riotboard_defconfig
+++ b/configs/riotboard_defconfig
@@ -35,7 +35,7 @@ CONFIG_SPL_FS_EXT4=y
 CONFIG_SPL_FS_LOAD_PAYLOAD_NAME="u-boot-dtb.img"
 CONFIG_SPL_FS_LOAD_ARGS_NAME="imx6dl-riotboard.dtb"
 CONFIG_SPL_OS_BOOT=y
-CONFIG_SYS_SPL_ARGS_ADDR=0x13000000
+CONFIG_SPL_SYS_ARGS_ADDR=0x13000000
 CONFIG_SYS_MAXARGS=32
 CONFIG_SYS_PBSIZE=532
 CONFIG_CMD_GPIO=y
diff --git a/configs/stm32746g-eval_spl_defconfig b/configs/stm32746g-eval_spl_defconfig
index 03e123e44a2..1d7b8266939 100644
--- a/configs/stm32746g-eval_spl_defconfig
+++ b/configs/stm32746g-eval_spl_defconfig
@@ -37,7 +37,7 @@ CONFIG_SPL_BOARD_INIT=y
 CONFIG_SPL_SYS_MALLOC_SIMPLE=y
 CONFIG_SPL_MTD_SUPPORT=y
 CONFIG_SPL_XIP_SUPPORT=y
-CONFIG_SYS_SPL_ARGS_ADDR=0x80c0000
+CONFIG_SPL_SYS_ARGS_ADDR=0x80c0000
 CONFIG_SPL_DM_RESET=y
 CONFIG_SYS_PBSIZE=1050
 CONFIG_CMD_GPT=y
diff --git a/configs/stm32f746-disco_spl_defconfig b/configs/stm32f746-disco_spl_defconfig
index 84aaec1e339..30357ed282a 100644
--- a/configs/stm32f746-disco_spl_defconfig
+++ b/configs/stm32f746-disco_spl_defconfig
@@ -37,7 +37,7 @@ CONFIG_SPL_BOARD_INIT=y
 CONFIG_SPL_SYS_MALLOC_SIMPLE=y
 CONFIG_SPL_MTD_SUPPORT=y
 CONFIG_SPL_XIP_SUPPORT=y
-CONFIG_SYS_SPL_ARGS_ADDR=0x80c0000
+CONFIG_SPL_SYS_ARGS_ADDR=0x80c0000
 CONFIG_SPL_DM_RESET=y
 CONFIG_SYS_PBSIZE=1050
 CONFIG_CMD_GPT=y
diff --git a/configs/stm32f769-disco_spl_defconfig b/configs/stm32f769-disco_spl_defconfig
index dd17cad7362..755478800be 100644
--- a/configs/stm32f769-disco_spl_defconfig
+++ b/configs/stm32f769-disco_spl_defconfig
@@ -36,7 +36,7 @@ CONFIG_SPL_BOARD_INIT=y
 CONFIG_SPL_SYS_MALLOC_SIMPLE=y
 CONFIG_SPL_MTD_SUPPORT=y
 CONFIG_SPL_XIP_SUPPORT=y
-CONFIG_SYS_SPL_ARGS_ADDR=0x81c0000
+CONFIG_SPL_SYS_ARGS_ADDR=0x81c0000
 CONFIG_SPL_DM_RESET=y
 CONFIG_SYS_PBSIZE=1050
 CONFIG_CMD_GPT=y
diff --git a/configs/syzygy_hub_defconfig b/configs/syzygy_hub_defconfig
index 7bcb3191000..a88568f1c38 100644
--- a/configs/syzygy_hub_defconfig
+++ b/configs/syzygy_hub_defconfig
@@ -32,7 +32,7 @@ CONFIG_SPL_SYS_MALLOC=y
 CONFIG_SPL_SYS_MALLOC_SIZE=0x2000000
 CONFIG_SPL_FS_LOAD_ARGS_NAME="system.dtb"
 CONFIG_SPL_OS_BOOT=y
-CONFIG_SYS_SPL_ARGS_ADDR=0x10000000
+CONFIG_SPL_SYS_ARGS_ADDR=0x10000000
 CONFIG_SYS_MAXARGS=32
 CONFIG_SYS_PBSIZE=2071
 CONFIG_SYS_BOOTM_LEN=0x3c00000
diff --git a/configs/vyasa-rk3288_defconfig b/configs/vyasa-rk3288_defconfig
index 9bca6fe2eea..5e7fd2a7ef2 100644
--- a/configs/vyasa-rk3288_defconfig
+++ b/configs/vyasa-rk3288_defconfig
@@ -32,7 +32,7 @@ CONFIG_SPL_NO_BSS_LIMIT=y
 CONFIG_SPL_STACK_R=y
 CONFIG_SPL_STACK_R_MALLOC_SIMPLE_LEN=0x2000
 CONFIG_SPL_OS_BOOT=y
-CONFIG_SYS_SPL_ARGS_ADDR=0xffe5000
+CONFIG_SPL_SYS_ARGS_ADDR=0xffe5000
 CONFIG_SPL_FALCON_BOOT_MMCSD=y
 CONFIG_SYS_MMCSD_RAW_MODE_KERNEL_SECTOR=0x8800
 CONFIG_SYS_MMCSD_RAW_MODE_ARGS_SECTOR=0x8000
diff --git a/configs/xilinx_zynq_virt_defconfig b/configs/xilinx_zynq_virt_defconfig
index 4ea5caff547..8fa8eb3b83e 100644
--- a/configs/xilinx_zynq_virt_defconfig
+++ b/configs/xilinx_zynq_virt_defconfig
@@ -43,7 +43,7 @@ CONFIG_SPL_FS_LOAD_PAYLOAD_NAME="u-boot.img"
 CONFIG_SPL_FS_LOAD_ARGS_NAME="system.dtb"
 CONFIG_SPL_FPGA=y
 CONFIG_SPL_OS_BOOT=y
-CONFIG_SYS_SPL_ARGS_ADDR=0x10000000
+CONFIG_SPL_SYS_ARGS_ADDR=0x10000000
 CONFIG_SPL_SPI_LOAD=y
 CONFIG_SYS_SPI_U_BOOT_OFFS=0x100000
 CONFIG_SYS_MAXARGS=32
diff --git a/configs/xilinx_zynqmp_virt_defconfig b/configs/xilinx_zynqmp_virt_defconfig
index 59be5f42493..bef59376a37 100644
--- a/configs/xilinx_zynqmp_virt_defconfig
+++ b/configs/xilinx_zynqmp_virt_defconfig
@@ -44,7 +44,7 @@ CONFIG_SPL_FS_LOAD_KERNEL_NAME="atf-uboot.ub"
 CONFIG_SPL_FS_LOAD_ARGS_NAME="u-boot.bin"
 CONFIG_SPL_FPGA=y
 CONFIG_SPL_OS_BOOT=y
-CONFIG_SYS_SPL_ARGS_ADDR=0x8000000
+CONFIG_SPL_SYS_ARGS_ADDR=0x8000000
 CONFIG_SPL_RAM_SUPPORT=y
 CONFIG_SPL_RAM_DEVICE=y
 CONFIG_SPL_SPI_LOAD=y
diff --git a/doc/develop/falcon.rst b/doc/develop/falcon.rst
index a569d1a2951..fbf8c10e47e 100644
--- a/doc/develop/falcon.rst
+++ b/doc/develop/falcon.rst
@@ -63,7 +63,7 @@ CONFIG_CMD_SPL
     Enable the "spl export" command.
     The command "spl export" is then available in U-Boot mode.
 
-CONFIG_SYS_SPL_ARGS_ADDR
+CONFIG_SPL_SYS_ARGS_ADDR
     Address in RAM where the parameters must be copied by SPL.
     In most cases, it is <start_of_ram> + 0x100.
 
-- 
2.42.0.rc2.253.gd59a3bf2b4-goog


^ permalink raw reply related	[flat|nested] 86+ messages in thread

* [PATCH 04/32] spl: Avoid #ifdef with CONFIG_SPL_SYS_MALLOC
  2023-08-30 18:04 [PATCH 00/32] spl: Preparation for Universal Payload Simon Glass
                   ` (2 preceding siblings ...)
  2023-08-30 18:04 ` [PATCH 03/32] spl: Rename SYS_SPL_ARGS_ADDR to SPL_SYS_ARGS_ADDR Simon Glass
@ 2023-08-30 18:04 ` Simon Glass
  2023-08-30 21:32   ` Tom Rini
  2023-08-30 18:04 ` [PATCH 05/32] spl: mx6: powerpc: Drop the condition on timer_init() Simon Glass
                   ` (27 subsequent siblings)
  31 siblings, 1 reply; 86+ messages in thread
From: Simon Glass @ 2023-08-30 18:04 UTC (permalink / raw)
  To: U-Boot Mailing List
  Cc: Tom Rini, Marek Vasut, Simon Glass, Nathan Barrett-Morrison,
	Nikhil M Jain

Use IF_ENABLED_INT() to avoid needing to use the preprocessor.

Signed-off-by: Simon Glass <sjg@chromium.org>
---

 common/spl/spl.c           | 12 ++++++++----
 include/system-constants.h |  5 ++++-
 2 files changed, 12 insertions(+), 5 deletions(-)

diff --git a/common/spl/spl.c b/common/spl/spl.c
index 27266b393ea..78db9ef5318 100644
--- a/common/spl/spl.c
+++ b/common/spl/spl.c
@@ -754,10 +754,14 @@ void board_init_r(gd_t *dummy1, ulong dummy2)
 
 	spl_set_bd();
 
-#if defined(CONFIG_SPL_SYS_MALLOC)
-	mem_malloc_init(SPL_SYS_MALLOC_START, CONFIG_SPL_SYS_MALLOC_SIZE);
-	gd->flags |= GD_FLG_FULL_MALLOC_INIT;
-#endif
+	if (IS_ENABLED(CONFIG_SPL_SYS_MALLOC)) {
+		ulong size;
+
+		size = IF_ENABLED_INT(CONFIG_SPL_SYS_MALLOC,
+				      CONFIG_SPL_SYS_MALLOC_SIZE);
+		mem_malloc_init(SPL_SYS_MALLOC_START, size);
+		gd->flags |= GD_FLG_FULL_MALLOC_INIT;
+	}
 	if (!(gd->flags & GD_FLG_SPL_INIT)) {
 		if (spl_init())
 			hang();
diff --git a/include/system-constants.h b/include/system-constants.h
index f0a191be590..aa02c48f49d 100644
--- a/include/system-constants.h
+++ b/include/system-constants.h
@@ -24,9 +24,12 @@
  */
 #ifdef CONFIG_SPL_HAS_CUSTOM_MALLOC_START
 #define SPL_SYS_MALLOC_START		CONFIG_SPL_CUSTOM_SYS_MALLOC_ADDR
-#else
+#elif defined(CONFIG_SPL_BSS_START_ADDR)
 #define SPL_SYS_MALLOC_START		(CONFIG_SPL_BSS_START_ADDR + \
 					 CONFIG_SPL_BSS_MAX_SIZE)
+#else
+/* feature not enabled: this value avoids compiler errors but is not used */
+#define SPL_SYS_MALLOC_START	0
 #endif
 
 #endif
-- 
2.42.0.rc2.253.gd59a3bf2b4-goog


^ permalink raw reply related	[flat|nested] 86+ messages in thread

* [PATCH 05/32] spl: mx6: powerpc: Drop the condition on timer_init()
  2023-08-30 18:04 [PATCH 00/32] spl: Preparation for Universal Payload Simon Glass
                   ` (3 preceding siblings ...)
  2023-08-30 18:04 ` [PATCH 04/32] spl: Avoid #ifdef with CONFIG_SPL_SYS_MALLOC Simon Glass
@ 2023-08-30 18:04 ` Simon Glass
  2023-08-31 17:50   ` Tom Rini
  2023-08-30 18:04 ` [PATCH 06/32] spl: Drop #ifdefs for BOARD_INIT and watchdog Simon Glass
                   ` (26 subsequent siblings)
  31 siblings, 1 reply; 86+ messages in thread
From: Simon Glass @ 2023-08-30 18:04 UTC (permalink / raw)
  To: U-Boot Mailing List
  Cc: Tom Rini, Marek Vasut, Simon Glass, Andy Fleming, Mario Six,
	Nathan Barrett-Morrison, Nikhil M Jain, Priyanka Jain,
	Stefan Roese, Wolfgang Denk

It doesn't make sense to have some boards do this differently. Drop the
condition in the hope that the maintainers can figure out any run-time
problems.

Signed-off-by: Simon Glass <sjg@chromium.org>
---

 common/spl/spl.c | 6 ------
 1 file changed, 6 deletions(-)

diff --git a/common/spl/spl.c b/common/spl/spl.c
index 78db9ef5318..3f513b0563a 100644
--- a/common/spl/spl.c
+++ b/common/spl/spl.c
@@ -766,13 +766,7 @@ void board_init_r(gd_t *dummy1, ulong dummy2)
 		if (spl_init())
 			hang();
 	}
-#if !defined(CONFIG_PPC) && !defined(CONFIG_ARCH_MX6)
-	/*
-	 * timer_init() does not exist on PPC systems. The timer is initialized
-	 * and enabled (decrementer) in interrupt_init() here.
-	 */
 	timer_init();
-#endif
 	if (CONFIG_IS_ENABLED(BLOBLIST)) {
 		ret = bloblist_init();
 		if (ret) {
-- 
2.42.0.rc2.253.gd59a3bf2b4-goog


^ permalink raw reply related	[flat|nested] 86+ messages in thread

* [PATCH 06/32] spl: Drop #ifdefs for BOARD_INIT and watchdog
  2023-08-30 18:04 [PATCH 00/32] spl: Preparation for Universal Payload Simon Glass
                   ` (4 preceding siblings ...)
  2023-08-30 18:04 ` [PATCH 05/32] spl: mx6: powerpc: Drop the condition on timer_init() Simon Glass
@ 2023-08-30 18:04 ` Simon Glass
  2023-08-30 18:04 ` [PATCH 07/32] spl: Avoid #ifdef with CONFIG_SPL_SYS_ARGS_ADDR Simon Glass
                   ` (25 subsequent siblings)
  31 siblings, 0 replies; 86+ messages in thread
From: Simon Glass @ 2023-08-30 18:04 UTC (permalink / raw)
  To: U-Boot Mailing List
  Cc: Tom Rini, Marek Vasut, Simon Glass, Algapally Santosh Sagar,
	Mayuresh Chitale, Michal Simek, Nathan Barrett-Morrison,
	Nikhil M Jain, Ovidiu Panait, Roger Quadros

Avoid using the preprocessor for these checks.

Signed-off-by: Simon Glass <sjg@chromium.org>
---

 common/spl/spl.c | 10 ++++------
 include/spl.h    |  8 ++++++--
 2 files changed, 10 insertions(+), 8 deletions(-)

diff --git a/common/spl/spl.c b/common/spl/spl.c
index 3f513b0563a..77fe4cdb053 100644
--- a/common/spl/spl.c
+++ b/common/spl/spl.c
@@ -786,13 +786,11 @@ void board_init_r(gd_t *dummy1, ulong dummy2)
 		}
 	}
 
-#if CONFIG_IS_ENABLED(BOARD_INIT)
-	spl_board_init();
-#endif
+	if (CONFIG_IS_ENABLED(BOARD_INIT))
+		spl_board_init();
 
-#if defined(CONFIG_SPL_WATCHDOG) && CONFIG_IS_ENABLED(WDT)
-	initr_watchdog();
-#endif
+	if (IS_ENABLED(CONFIG_SPL_WATCHDOG) && CONFIG_IS_ENABLED(WDT))
+		initr_watchdog();
 
 	if (IS_ENABLED(CONFIG_SPL_OS_BOOT) || CONFIG_IS_ENABLED(HANDOFF) ||
 	    IS_ENABLED(CONFIG_SPL_ATF))
diff --git a/include/spl.h b/include/spl.h
index 92bcaa90a4a..d16cea3ea50 100644
--- a/include/spl.h
+++ b/include/spl.h
@@ -707,9 +707,13 @@ int spl_early_init(void);
  */
 int spl_init(void);
 
-#ifdef CONFIG_SPL_BOARD_INIT
+/*
+ * spl_board_init() - Do board-specific init in SPL
+ *
+ * If xPL_BOARD_INIT is enabled, this is called from board_init_r() before
+ * jumping to the next phase.
+ */
 void spl_board_init(void);
-#endif
 
 /**
  * spl_was_boot_source() - check if U-Boot booted from SPL
-- 
2.42.0.rc2.253.gd59a3bf2b4-goog


^ permalink raw reply related	[flat|nested] 86+ messages in thread

* [PATCH 07/32] spl: Avoid #ifdef with CONFIG_SPL_SYS_ARGS_ADDR
  2023-08-30 18:04 [PATCH 00/32] spl: Preparation for Universal Payload Simon Glass
                   ` (5 preceding siblings ...)
  2023-08-30 18:04 ` [PATCH 06/32] spl: Drop #ifdefs for BOARD_INIT and watchdog Simon Glass
@ 2023-08-30 18:04 ` Simon Glass
  2023-08-30 21:34   ` Tom Rini
  2023-08-30 18:04 ` [PATCH 08/32] spl: Drop the switch() statement for OS selection Simon Glass
                   ` (24 subsequent siblings)
  31 siblings, 1 reply; 86+ messages in thread
From: Simon Glass @ 2023-08-30 18:04 UTC (permalink / raw)
  To: U-Boot Mailing List
  Cc: Tom Rini, Marek Vasut, Simon Glass, Andre Przywara,
	Leo Yu-Chi Liang, Mayuresh Chitale, Nathan Barrett-Morrison,
	Nikhil M Jain, Oleksandr Suvorov, Roger Quadros

Use IF_ENABLED_INT() to avoid needing to use the preprocessor. Give the
Kconfig option a default since we try to avoid hex values without
defaults.

Signed-off-by: Simon Glass <sjg@chromium.org>
---

 common/spl/Kconfig |  1 +
 common/spl/spl.c   | 18 ++++++++++++++----
 2 files changed, 15 insertions(+), 4 deletions(-)

diff --git a/common/spl/Kconfig b/common/spl/Kconfig
index c23a1f7750b..e863aac2b34 100644
--- a/common/spl/Kconfig
+++ b/common/spl/Kconfig
@@ -1067,6 +1067,7 @@ config SPL_SYS_ARGS_ADDR
 	hex "Address in memory to load 'args' file for Falcon Mode to"
 	depends on SPL_OS_BOOT
 	default 0x88000000 if ARCH_OMAP2PLUS
+	default 0
 	help
 	  Address in memory where the 'args' file, typically a device tree
 	  will be loaded in to memory.
diff --git a/common/spl/spl.c b/common/spl/spl.c
index 77fe4cdb053..2da5bc0c4f5 100644
--- a/common/spl/spl.c
+++ b/common/spl/spl.c
@@ -814,9 +814,11 @@ void board_init_r(gd_t *dummy1, ulong dummy2)
 	}
 
 	memset(&spl_image, '\0', sizeof(spl_image));
-#ifdef CONFIG_SPL_SYS_ARGS_ADDR
-	spl_image.arg = (void *)CONFIG_SPL_SYS_ARGS_ADDR;
-#endif
+	if (IS_ENABLED(CONFIG_SPL_SYS_ARGS_ADDR)) {
+		spl_image.arg =
+			map_sysmem(IF_ENABLED_INT(CONFIG_SPL_OS_BOOT,
+						  CONFIG_SPL_SYS_ARGS_ADDR), 0);
+	}
 	spl_image.boot_device = BOOT_DEVICE_NONE;
 	board_boot_order(spl_boot_list);
 
@@ -873,8 +875,16 @@ void board_init_r(gd_t *dummy1, ulong dummy2)
 #if CONFIG_IS_ENABLED(OS_BOOT)
 	case IH_OS_LINUX:
 		debug("Jumping to Linux\n");
+		if (IS_ENABLED(CONFIG_SPL_SYS_ARGS_ADDR)) {
+			ulong addr;
+
+			addr = IF_ENABLED_INT(CONFIG_SPL_OS_BOOT,
+					      CONFIG_SPL_SYS_ARGS_ADDR);
+			spl_fixup_fdt(map_sysmem(addr, 0));
+		}
+	}
+
 #if defined(CONFIG_SPL_SYS_ARGS_ADDR)
-		spl_fixup_fdt((void *)CONFIG_SPL_SYS_ARGS_ADDR);
 #endif
 		spl_board_prepare_for_linux();
 		jump_to_image_linux(&spl_image);
-- 
2.42.0.rc2.253.gd59a3bf2b4-goog


^ permalink raw reply related	[flat|nested] 86+ messages in thread

* [PATCH 08/32] spl: Drop the switch() statement for OS selection
  2023-08-30 18:04 [PATCH 00/32] spl: Preparation for Universal Payload Simon Glass
                   ` (6 preceding siblings ...)
  2023-08-30 18:04 ` [PATCH 07/32] spl: Avoid #ifdef with CONFIG_SPL_SYS_ARGS_ADDR Simon Glass
@ 2023-08-30 18:04 ` Simon Glass
  2023-08-30 18:04 ` [PATCH 09/32] spl: Avoid an #ifdef when printing gd->malloc_ptr Simon Glass
                   ` (23 subsequent siblings)
  31 siblings, 0 replies; 86+ messages in thread
From: Simon Glass @ 2023-08-30 18:04 UTC (permalink / raw)
  To: U-Boot Mailing List
  Cc: Tom Rini, Marek Vasut, Simon Glass, Algapally Santosh Sagar,
	Ashok Reddy Soma, Heinrich Schuchardt, Mayuresh Chitale,
	Nathan Barrett-Morrison, Nikhil M Jain, Ovidiu Panait,
	Roger Quadros

This code is pretty ugly, with many #ifdefs

There are quite a lot of IH_OS_U_BOOT values so the compiler struggles
to create a jump table here. Also, most of the options are normally
disabled.

Change it to an else...if construct instead. Add an accessor for the
spl_image field behind an #ifdef to avoid needing #ifdef in the C code.

Signed-off-by: Simon Glass <sjg@chromium.org>
---

 common/spl/spl.c | 36 ++++++++++--------------------------
 include/spl.h    |  9 +++++++++
 2 files changed, 19 insertions(+), 26 deletions(-)

diff --git a/common/spl/spl.c b/common/spl/spl.c
index 2da5bc0c4f5..f0a90c280da 100644
--- a/common/spl/spl.c
+++ b/common/spl/spl.c
@@ -748,7 +748,7 @@ void board_init_r(gd_t *dummy1, ulong dummy2)
 		BOOT_DEVICE_NONE,
 	};
 	struct spl_image_info spl_image;
-	int ret;
+	int ret, os;
 
 	debug(">>" SPL_TPL_PROMPT "board_init_r()\n");
 
@@ -848,32 +848,21 @@ void board_init_r(gd_t *dummy1, ulong dummy2)
 			       ret);
 	}
 
-	switch (spl_image.os) {
-	case IH_OS_U_BOOT:
+	os = spl_image.os;
+	if (os == IH_OS_U_BOOT) {
 		debug("Jumping to %s...\n", spl_phase_name(spl_next_phase()));
-		break;
-#if CONFIG_IS_ENABLED(ATF)
-	case IH_OS_ARM_TRUSTED_FIRMWARE:
+	} else if (CONFIG_IS_ENABLED(ATF) && os == IH_OS_ARM_TRUSTED_FIRMWARE) {
 		debug("Jumping to U-Boot via ARM Trusted Firmware\n");
-		spl_fixup_fdt(spl_image.fdt_addr);
+		spl_fixup_fdt(spl_image_fdt_addr(&spl_image));
 		spl_invoke_atf(&spl_image);
-		break;
-#endif
-#if CONFIG_IS_ENABLED(OPTEE_IMAGE)
-	case IH_OS_TEE:
+	} else if (CONFIG_IS_ENABLED(OPTEE_IMAGE) && os == IH_OS_TEE) {
 		debug("Jumping to U-Boot via OP-TEE\n");
-		spl_board_prepare_for_optee(spl_image.fdt_addr);
+		spl_board_prepare_for_optee(spl_image_fdt_addr(&spl_image));
 		jump_to_image_optee(&spl_image);
-		break;
-#endif
-#if CONFIG_IS_ENABLED(OPENSBI)
-	case IH_OS_OPENSBI:
+	} else if (CONFIG_IS_ENABLED(OPENSBI) && os == IH_OS_OPENSBI) {
 		debug("Jumping to U-Boot via RISC-V OpenSBI\n");
 		spl_invoke_opensbi(&spl_image);
-		break;
-#endif
-#if CONFIG_IS_ENABLED(OS_BOOT)
-	case IH_OS_LINUX:
+	} else if (CONFIG_IS_ENABLED(OS_BOOT) && os == IH_OS_LINUX) {
 		debug("Jumping to Linux\n");
 		if (IS_ENABLED(CONFIG_SPL_SYS_ARGS_ADDR)) {
 			ulong addr;
@@ -882,14 +871,9 @@ void board_init_r(gd_t *dummy1, ulong dummy2)
 					      CONFIG_SPL_SYS_ARGS_ADDR);
 			spl_fixup_fdt(map_sysmem(addr, 0));
 		}
-	}
-
-#if defined(CONFIG_SPL_SYS_ARGS_ADDR)
-#endif
 		spl_board_prepare_for_linux();
 		jump_to_image_linux(&spl_image);
-#endif
-	default:
+	} else {
 		debug("Unsupported OS image.. Jumping nevertheless..\n");
 	}
 #if CONFIG_VAL(SYS_MALLOC_F_LEN) && !defined(CONFIG_SPL_SYS_MALLOC_SIZE)
diff --git a/include/spl.h b/include/spl.h
index d16cea3ea50..60b55b75195 100644
--- a/include/spl.h
+++ b/include/spl.h
@@ -263,6 +263,15 @@ struct spl_image_info {
 #endif
 };
 
+static inline void *spl_image_fdt_addr(struct spl_image_info *info)
+{
+#if CONFIG_IS_ENABLED(LOAD_FIT) || CONFIG_IS_ENABLED(LOAD_FIT_FULL)
+	return info->fdt_addr;
+#else
+	return 0;
+#endif
+}
+
 /**
  * Information required to load data from a device
  *
-- 
2.42.0.rc2.253.gd59a3bf2b4-goog


^ permalink raw reply related	[flat|nested] 86+ messages in thread

* [PATCH 09/32] spl: Avoid an #ifdef when printing gd->malloc_ptr
  2023-08-30 18:04 [PATCH 00/32] spl: Preparation for Universal Payload Simon Glass
                   ` (7 preceding siblings ...)
  2023-08-30 18:04 ` [PATCH 08/32] spl: Drop the switch() statement for OS selection Simon Glass
@ 2023-08-30 18:04 ` Simon Glass
  2023-08-30 21:39   ` Tom Rini
  2023-08-30 18:04 ` [PATCH 10/32] spl: Remove #ifdefs with BOOTSTAGE Simon Glass
                   ` (22 subsequent siblings)
  31 siblings, 1 reply; 86+ messages in thread
From: Simon Glass @ 2023-08-30 18:04 UTC (permalink / raw)
  To: U-Boot Mailing List
  Cc: Tom Rini, Marek Vasut, Simon Glass, Bin Meng,
	Heinrich Schuchardt, Nathan Barrett-Morrison, Nikhil M Jain,
	Rasmus Villemoes, Stefan Roese

Use an accessor in the header file to avoid this.

Signed-off-by: Simon Glass <sjg@chromium.org>
---

 common/spl/spl.c                  | 9 +++++----
 include/asm-generic/global_data.h | 7 +++++++
 2 files changed, 12 insertions(+), 4 deletions(-)

diff --git a/common/spl/spl.c b/common/spl/spl.c
index f0a90c280da..f5cef81000c 100644
--- a/common/spl/spl.c
+++ b/common/spl/spl.c
@@ -876,10 +876,11 @@ void board_init_r(gd_t *dummy1, ulong dummy2)
 	} else {
 		debug("Unsupported OS image.. Jumping nevertheless..\n");
 	}
-#if CONFIG_VAL(SYS_MALLOC_F_LEN) && !defined(CONFIG_SPL_SYS_MALLOC_SIZE)
-	debug("SPL malloc() used 0x%lx bytes (%ld KB)\n", gd->malloc_ptr,
-	      gd->malloc_ptr / 1024);
-#endif
+	if (IS_ENABLED(CONFIG_SYS_MALLOC_F) &&
+	    !IS_ENABLED(CONFIG_SPL_SYS_MALLOC_SIZE))
+		debug("SPL malloc() used 0x%lx bytes (%ld KB)\n",
+		      gd_malloc_ptr(), gd_malloc_ptr() / 1024);
+
 	bootstage_mark_name(get_bootstage_id(false), "end phase");
 #ifdef CONFIG_BOOTSTAGE_STASH
 	ret = bootstage_stash((void *)CONFIG_BOOTSTAGE_STASH_ADDR,
diff --git a/include/asm-generic/global_data.h b/include/asm-generic/global_data.h
index 8fc205ded1a..edf9ff6823f 100644
--- a/include/asm-generic/global_data.h
+++ b/include/asm-generic/global_data.h
@@ -573,6 +573,13 @@ static_assert(sizeof(struct global_data) == GD_SIZE);
 #define gd_malloc_start()	0
 #define gd_set_malloc_start(val)
 #endif
+
+#if CONFIG_VAL(SYS_MALLOC_F_LEN)
+#define gd_malloc_ptr()		gd->malloc_ptr
+#else
+#define gd_malloc_ptr()		0L
+#endif
+
 /**
  * enum gd_flags - global data flags
  *
-- 
2.42.0.rc2.253.gd59a3bf2b4-goog


^ permalink raw reply related	[flat|nested] 86+ messages in thread

* [PATCH 10/32] spl: Remove #ifdefs with BOOTSTAGE
  2023-08-30 18:04 [PATCH 00/32] spl: Preparation for Universal Payload Simon Glass
                   ` (8 preceding siblings ...)
  2023-08-30 18:04 ` [PATCH 09/32] spl: Avoid an #ifdef when printing gd->malloc_ptr Simon Glass
@ 2023-08-30 18:04 ` Simon Glass
  2023-08-30 18:04 ` [PATCH 11/32] spl: Rename spl_load_fit_image() to load_simple_fit() Simon Glass
                   ` (21 subsequent siblings)
  31 siblings, 0 replies; 86+ messages in thread
From: Simon Glass @ 2023-08-30 18:04 UTC (permalink / raw)
  To: U-Boot Mailing List
  Cc: Tom Rini, Marek Vasut, Simon Glass, Nathan Barrett-Morrison,
	Nikhil M Jain

This feature has some helpers in its header file so that its functions
resolve to nothing when the feature is disabled. Add a few more and use
these to simplify the code.

With this there are no more #ifdefs in board_init_r()

Signed-off-by: Simon Glass <sjg@chromium.org>
---

 common/spl/spl.c    | 15 +++------------
 include/bootstage.h | 26 ++++++++++++++++++++++++++
 2 files changed, 29 insertions(+), 12 deletions(-)

diff --git a/common/spl/spl.c b/common/spl/spl.c
index f5cef81000c..3e3e13057f1 100644
--- a/common/spl/spl.c
+++ b/common/spl/spl.c
@@ -542,17 +542,11 @@ static int spl_common_init(bool setup_malloc)
 		      ret);
 		return ret;
 	}
-#ifdef CONFIG_BOOTSTAGE_STASH
 	if (!u_boot_first_phase()) {
-		const void *stash = map_sysmem(CONFIG_BOOTSTAGE_STASH_ADDR,
-					       CONFIG_BOOTSTAGE_STASH_SIZE);
-
-		ret = bootstage_unstash(stash, CONFIG_BOOTSTAGE_STASH_SIZE);
+		ret = bootstage_unstash_default();
 		if (ret)
-			debug("%s: Failed to unstash bootstage: ret=%d\n",
-			      __func__, ret);
+			log_debug("Failed to unstash bootstage: ret=%d\n", ret);
 	}
-#endif /* CONFIG_BOOTSTAGE_STASH */
 	bootstage_mark_name(get_bootstage_id(true),
 			    spl_phase_name(spl_phase()));
 #if CONFIG_IS_ENABLED(LOG)
@@ -882,12 +876,9 @@ void board_init_r(gd_t *dummy1, ulong dummy2)
 		      gd_malloc_ptr(), gd_malloc_ptr() / 1024);
 
 	bootstage_mark_name(get_bootstage_id(false), "end phase");
-#ifdef CONFIG_BOOTSTAGE_STASH
-	ret = bootstage_stash((void *)CONFIG_BOOTSTAGE_STASH_ADDR,
-			      CONFIG_BOOTSTAGE_STASH_SIZE);
+	ret = bootstage_stash_default();
 	if (ret)
 		debug("Failed to stash bootstage: err=%d\n", ret);
-#endif
 
 	if (IS_ENABLED(CONFIG_SPL_VIDEO_REMOVE)) {
 		struct udevice *dev;
diff --git a/include/bootstage.h b/include/bootstage.h
index 685939ccffc..38388afc259 100644
--- a/include/bootstage.h
+++ b/include/bootstage.h
@@ -244,6 +244,8 @@ void show_boot_progress(int val);
 
 #ifdef ENABLE_BOOTSTAGE
 
+#include <mapmem.h>
+
 /* This is the full bootstage implementation */
 
 /**
@@ -364,6 +366,20 @@ int bootstage_stash(void *base, int size);
  */
 int bootstage_unstash(const void *base, int size);
 
+static inline int bootstage_stash_default(void)
+{
+	return bootstage_stash(map_sysmem(CONFIG_BOOTSTAGE_STASH_ADDR, 0),
+			       CONFIG_BOOTSTAGE_STASH_SIZE);
+}
+
+static inline int bootstage_unstash_default(void)
+{
+	const void *stash = map_sysmem(CONFIG_BOOTSTAGE_STASH_ADDR,
+				       CONFIG_BOOTSTAGE_STASH_SIZE);
+
+	return bootstage_unstash(stash, CONFIG_BOOTSTAGE_STASH_SIZE);
+}
+
 /**
  * bootstage_get_size() - Get the size of the bootstage data
  *
@@ -440,6 +456,16 @@ static inline int bootstage_unstash(const void *base, int size)
 	return 0;	/* Pretend to succeed */
 }
 
+static inline int bootstage_stash_default(void)
+{
+	return 0;	/* Pretend to succeed */
+}
+
+static inline int bootstage_unstash_default(void)
+{
+	return 0;	/* Pretend to succeed */
+}
+
 static inline int bootstage_get_size(void)
 {
 	return 0;
-- 
2.42.0.rc2.253.gd59a3bf2b4-goog


^ permalink raw reply related	[flat|nested] 86+ messages in thread

* [PATCH 11/32] spl: Rename spl_load_fit_image() to load_simple_fit()
  2023-08-30 18:04 [PATCH 00/32] spl: Preparation for Universal Payload Simon Glass
                   ` (9 preceding siblings ...)
  2023-08-30 18:04 ` [PATCH 10/32] spl: Remove #ifdefs with BOOTSTAGE Simon Glass
@ 2023-08-30 18:04 ` Simon Glass
  2023-08-30 18:04 ` [PATCH 12/32] spl: Move the full FIT code to spl_fit.c Simon Glass
                   ` (20 subsequent siblings)
  31 siblings, 0 replies; 86+ messages in thread
From: Simon Glass @ 2023-08-30 18:04 UTC (permalink / raw)
  To: U-Boot Mailing List
  Cc: Tom Rini, Marek Vasut, Simon Glass, Oleksandr Suvorov,
	Stefan Herbrechtsmeier

We have two functions called spl_load_fit_image(), one in spl.c and one in
spl_fit.c

Rename the second one, to indicate that it relates to simple FIT parsing,
rather than the full version.

Signed-off-by: Simon Glass <sjg@chromium.org>
---

 common/spl/spl_fit.c | 21 ++++++++++-----------
 1 file changed, 10 insertions(+), 11 deletions(-)

diff --git a/common/spl/spl_fit.c b/common/spl/spl_fit.c
index 1bfdc0af496..8e7d033dd1a 100644
--- a/common/spl/spl_fit.c
+++ b/common/spl/spl_fit.c
@@ -207,7 +207,7 @@ static int get_aligned_image_size(struct spl_load_info *info, int data_size,
 }
 
 /**
- * spl_load_fit_image(): load the image described in a certain FIT node
+ * load_simple_fit(): load the image described in a certain FIT node
  * @info:	points to information about the device to load data from
  * @sector:	the start sector of the FIT image on the device
  * @ctx:	points to the FIT context structure
@@ -220,9 +220,9 @@ static int get_aligned_image_size(struct spl_load_info *info, int data_size,
  *
  * Return:	0 on success or a negative error number.
  */
-static int spl_load_fit_image(struct spl_load_info *info, ulong sector,
-			      const struct spl_fit_info *ctx, int node,
-			      struct spl_image_info *image_info)
+static int load_simple_fit(struct spl_load_info *info, ulong sector,
+			   const struct spl_fit_info *ctx, int node,
+			   struct spl_image_info *image_info)
 {
 	int offset;
 	size_t length;
@@ -385,8 +385,7 @@ static int spl_fit_append_fdt(struct spl_image_info *spl_image,
 		else
 			return node;
 	} else {
-		ret = spl_load_fit_image(info, sector, ctx, node,
-					 &image_info);
+		ret = load_simple_fit(info, sector, ctx, node, &image_info);
 		if (ret < 0)
 			return ret;
 	}
@@ -425,8 +424,8 @@ static int spl_fit_append_fdt(struct spl_image_info *spl_image,
 					      __func__);
 			}
 			image_info.load_addr = (ulong)tmpbuffer;
-			ret = spl_load_fit_image(info, sector, ctx,
-						 node, &image_info);
+			ret = load_simple_fit(info, sector, ctx, node,
+					      &image_info);
 			if (ret < 0)
 				break;
 
@@ -616,7 +615,7 @@ static int spl_fit_load_fpga(struct spl_fit_info *ctx,
 	warn_deprecated("'fpga' property in config node. Use 'loadables'");
 
 	/* Load the image and set up the fpga_image structure */
-	ret = spl_load_fit_image(info, sector, ctx, node, &fpga_image);
+	ret = load_simple_fit(info, sector, ctx, node, &fpga_image);
 	if (ret) {
 		printf("%s: Cannot load the FPGA: %i\n", __func__, ret);
 		return ret;
@@ -741,7 +740,7 @@ int spl_load_simple_fit(struct spl_image_info *spl_image,
 	}
 
 	/* Load the image and set up the spl_image structure */
-	ret = spl_load_fit_image(info, sector, &ctx, node, spl_image);
+	ret = load_simple_fit(info, sector, &ctx, node, spl_image);
 	if (ret)
 		return ret;
 
@@ -782,7 +781,7 @@ int spl_load_simple_fit(struct spl_image_info *spl_image,
 			continue;
 
 		image_info.load_addr = 0;
-		ret = spl_load_fit_image(info, sector, &ctx, node, &image_info);
+		ret = load_simple_fit(info, sector, &ctx, node, &image_info);
 		if (ret < 0) {
 			printf("%s: can't load image loadables index %d (ret = %d)\n",
 			       __func__, index, ret);
-- 
2.42.0.rc2.253.gd59a3bf2b4-goog


^ permalink raw reply related	[flat|nested] 86+ messages in thread

* [PATCH 12/32] spl: Move the full FIT code to spl_fit.c
  2023-08-30 18:04 [PATCH 00/32] spl: Preparation for Universal Payload Simon Glass
                   ` (10 preceding siblings ...)
  2023-08-30 18:04 ` [PATCH 11/32] spl: Rename spl_load_fit_image() to load_simple_fit() Simon Glass
@ 2023-08-30 18:04 ` Simon Glass
  2023-08-30 18:04 ` [PATCH 13/32] spl: Use the correct FIT_..._PROP constants Simon Glass
                   ` (19 subsequent siblings)
  31 siblings, 0 replies; 86+ messages in thread
From: Simon Glass @ 2023-08-30 18:04 UTC (permalink / raw)
  To: U-Boot Mailing List
  Cc: Tom Rini, Marek Vasut, Simon Glass, Algapally Santosh Sagar,
	Ashok Reddy Soma, Mayuresh Chitale, Nathan Barrett-Morrison,
	Nikhil M Jain, Oleksandr Suvorov, Roger Quadros,
	Stefan Herbrechtsmeier

For some reason this code was put in the main spl.c file. Move it out
to the FIT implementation where it belongs.

Signed-off-by: Simon Glass <sjg@chromium.org>
---

 common/spl/spl.c     | 108 +++----------------------------------------
 common/spl/spl_fit.c |  93 +++++++++++++++++++++++++++++++++++++
 include/spl.h        |  11 +++++
 3 files changed, 111 insertions(+), 101 deletions(-)

diff --git a/common/spl/spl.c b/common/spl/spl.c
index 3e3e13057f1..8f87a27e61f 100644
--- a/common/spl/spl.c
+++ b/common/spl/spl.c
@@ -260,102 +260,6 @@ void spl_set_header_raw_uboot(struct spl_image_info *spl_image)
 }
 #endif
 
-#if CONFIG_IS_ENABLED(LOAD_FIT_FULL)
-/* Parse and load full fitImage in SPL */
-static int spl_load_fit_image(struct spl_image_info *spl_image,
-			      const struct legacy_img_hdr *header)
-{
-	struct bootm_headers images;
-	const char *fit_uname_config = NULL;
-	uintptr_t fdt_hack;
-	const char *uname;
-	ulong fw_data = 0, dt_data = 0, img_data = 0;
-	ulong fw_len = 0, dt_len = 0, img_len = 0;
-	int idx, conf_noffset;
-	int ret;
-
-#ifdef CONFIG_SPL_FIT_SIGNATURE
-	images.verify = 1;
-#endif
-	ret = fit_image_load(&images, (ulong)header,
-			     NULL, &fit_uname_config,
-			     IH_ARCH_DEFAULT, IH_TYPE_STANDALONE, -1,
-			     FIT_LOAD_OPTIONAL, &fw_data, &fw_len);
-	if (ret >= 0) {
-		printf("DEPRECATED: 'standalone = ' property.");
-		printf("Please use either 'firmware =' or 'kernel ='\n");
-	} else {
-		ret = fit_image_load(&images, (ulong)header, NULL,
-				     &fit_uname_config, IH_ARCH_DEFAULT,
-				     IH_TYPE_FIRMWARE, -1, FIT_LOAD_OPTIONAL,
-				     &fw_data, &fw_len);
-	}
-
-	if (ret < 0) {
-		ret = fit_image_load(&images, (ulong)header, NULL,
-				     &fit_uname_config, IH_ARCH_DEFAULT,
-				     IH_TYPE_KERNEL, -1, FIT_LOAD_OPTIONAL,
-				     &fw_data, &fw_len);
-	}
-
-	if (ret < 0)
-		return ret;
-
-	spl_image->size = fw_len;
-	spl_image->entry_point = fw_data;
-	spl_image->load_addr = fw_data;
-	if (fit_image_get_os(header, ret, &spl_image->os))
-		spl_image->os = IH_OS_INVALID;
-	spl_image->name = genimg_get_os_name(spl_image->os);
-
-	debug(SPL_TPL_PROMPT "payload image: %32s load addr: 0x%lx size: %d\n",
-	      spl_image->name, spl_image->load_addr, spl_image->size);
-
-#ifdef CONFIG_SPL_FIT_SIGNATURE
-	images.verify = 1;
-#endif
-	ret = fit_image_load(&images, (ulong)header, NULL, &fit_uname_config,
-		       IH_ARCH_DEFAULT, IH_TYPE_FLATDT, -1,
-		       FIT_LOAD_OPTIONAL, &dt_data, &dt_len);
-	if (ret >= 0) {
-		spl_image->fdt_addr = (void *)dt_data;
-
-		if (spl_image->os == IH_OS_U_BOOT) {
-			/* HACK: U-Boot expects FDT at a specific address */
-			fdt_hack = spl_image->load_addr + spl_image->size;
-			fdt_hack = (fdt_hack + 3) & ~3;
-			debug("Relocating FDT to %p\n", spl_image->fdt_addr);
-			memcpy((void *)fdt_hack, spl_image->fdt_addr, dt_len);
-		}
-	}
-
-	conf_noffset = fit_conf_get_node((const void *)header,
-					 fit_uname_config);
-	if (conf_noffset < 0)
-		return 0;
-
-	for (idx = 0;
-	     uname = fdt_stringlist_get((const void *)header, conf_noffset,
-					FIT_LOADABLE_PROP, idx,
-				NULL), uname;
-	     idx++)
-	{
-#ifdef CONFIG_SPL_FIT_SIGNATURE
-		images.verify = 1;
-#endif
-		ret = fit_image_load(&images, (ulong)header,
-				     &uname, &fit_uname_config,
-				     IH_ARCH_DEFAULT, IH_TYPE_LOADABLE, -1,
-				     FIT_LOAD_OPTIONAL_NON_ZERO,
-				     &img_data, &img_len);
-		if (ret < 0)
-			return ret;
-	}
-
-	return 0;
-}
-#endif
-
 __weak int spl_parse_board_header(struct spl_image_info *spl_image,
 				  const struct spl_boot_device *bootdev,
 				  const void *image_header, size_t size)
@@ -375,12 +279,14 @@ int spl_parse_image_header(struct spl_image_info *spl_image,
 			   const struct spl_boot_device *bootdev,
 			   const struct legacy_img_hdr *header)
 {
-#if CONFIG_IS_ENABLED(LOAD_FIT_FULL)
-	int ret = spl_load_fit_image(spl_image, header);
+	int ret;
 
-	if (!ret)
-		return ret;
-#endif
+	if (CONFIG_IS_ENABLED(LOAD_FIT_FULL)) {
+		ret = spl_load_fit_image(spl_image, header);
+
+		if (!ret)
+			return ret;
+	}
 	if (image_get_magic(header) == IH_MAGIC) {
 		int ret;
 
diff --git a/common/spl/spl_fit.c b/common/spl/spl_fit.c
index 8e7d033dd1a..5b5f6c62045 100644
--- a/common/spl/spl_fit.c
+++ b/common/spl/spl_fit.c
@@ -826,3 +826,96 @@ int spl_load_simple_fit(struct spl_image_info *spl_image,
 
 	return 0;
 }
+
+/* Parse and load full fitImage in SPL */
+int spl_load_fit_image(struct spl_image_info *spl_image,
+		       const struct legacy_img_hdr *header)
+{
+	struct bootm_headers images;
+	const char *fit_uname_config = NULL;
+	uintptr_t fdt_hack;
+	const char *uname;
+	ulong fw_data = 0, dt_data = 0, img_data = 0;
+	ulong fw_len = 0, dt_len = 0, img_len = 0;
+	int idx, conf_noffset;
+	int ret;
+
+#ifdef CONFIG_SPL_FIT_SIGNATURE
+	images.verify = 1;
+#endif
+	ret = fit_image_load(&images, (ulong)header,
+			     NULL, &fit_uname_config,
+			     IH_ARCH_DEFAULT, IH_TYPE_STANDALONE, -1,
+			     FIT_LOAD_OPTIONAL, &fw_data, &fw_len);
+	if (ret >= 0) {
+		printf("DEPRECATED: 'standalone = ' property.");
+		printf("Please use either 'firmware =' or 'kernel ='\n");
+	} else {
+		ret = fit_image_load(&images, (ulong)header, NULL,
+				     &fit_uname_config, IH_ARCH_DEFAULT,
+				     IH_TYPE_FIRMWARE, -1, FIT_LOAD_OPTIONAL,
+				     &fw_data, &fw_len);
+	}
+
+	if (ret < 0) {
+		ret = fit_image_load(&images, (ulong)header, NULL,
+				     &fit_uname_config, IH_ARCH_DEFAULT,
+				     IH_TYPE_KERNEL, -1, FIT_LOAD_OPTIONAL,
+				     &fw_data, &fw_len);
+	}
+
+	if (ret < 0)
+		return ret;
+
+	spl_image->size = fw_len;
+	spl_image->entry_point = fw_data;
+	spl_image->load_addr = fw_data;
+	if (fit_image_get_os(header, ret, &spl_image->os))
+		spl_image->os = IH_OS_INVALID;
+	spl_image->name = genimg_get_os_name(spl_image->os);
+
+	debug(SPL_TPL_PROMPT "payload image: %32s load addr: 0x%lx size: %d\n",
+	      spl_image->name, spl_image->load_addr, spl_image->size);
+
+#ifdef CONFIG_SPL_FIT_SIGNATURE
+	images.verify = 1;
+#endif
+	ret = fit_image_load(&images, (ulong)header, NULL, &fit_uname_config,
+			     IH_ARCH_DEFAULT, IH_TYPE_FLATDT, -1,
+			     FIT_LOAD_OPTIONAL, &dt_data, &dt_len);
+	if (ret >= 0) {
+		spl_image->fdt_addr = (void *)dt_data;
+
+		if (spl_image->os == IH_OS_U_BOOT) {
+			/* HACK: U-Boot expects FDT at a specific address */
+			fdt_hack = spl_image->load_addr + spl_image->size;
+			fdt_hack = (fdt_hack + 3) & ~3;
+			debug("Relocating FDT to %p\n", spl_image->fdt_addr);
+			memcpy((void *)fdt_hack, spl_image->fdt_addr, dt_len);
+		}
+	}
+
+	conf_noffset = fit_conf_get_node((const void *)header,
+					 fit_uname_config);
+	if (conf_noffset < 0)
+		return 0;
+
+	for (idx = 0;
+	     uname = fdt_stringlist_get((const void *)header, conf_noffset,
+					FIT_LOADABLE_PROP, idx,
+				NULL), uname;
+	     idx++) {
+#ifdef CONFIG_SPL_FIT_SIGNATURE
+		images.verify = 1;
+#endif
+		ret = fit_image_load(&images, (ulong)header,
+				     &uname, &fit_uname_config,
+				     IH_ARCH_DEFAULT, IH_TYPE_LOADABLE, -1,
+				     FIT_LOAD_OPTIONAL_NON_ZERO,
+				     &img_data, &img_len);
+		if (ret < 0)
+			return ret;
+	}
+
+	return 0;
+}
diff --git a/include/spl.h b/include/spl.h
index 60b55b75195..e958ace2cc6 100644
--- a/include/spl.h
+++ b/include/spl.h
@@ -910,4 +910,15 @@ struct legacy_img_hdr *spl_get_load_buffer(ssize_t offset, size_t size);
 
 void board_boot_order(u32 *spl_boot_list);
 void spl_save_restore_data(void);
+
+/**
+ * spl_load_fit_image() - Fully parse and a FIT image in SPL
+ *
+ * @spl_image: SPL Image data to fill in
+ * @header: Pointer to FIT image
+ * Return 0 if OK, -ve on error
+ */
+int spl_load_fit_image(struct spl_image_info *spl_image,
+		       const struct legacy_img_hdr *header);
+
 #endif
-- 
2.42.0.rc2.253.gd59a3bf2b4-goog


^ permalink raw reply related	[flat|nested] 86+ messages in thread

* [PATCH 13/32] spl: Use the correct FIT_..._PROP constants
  2023-08-30 18:04 [PATCH 00/32] spl: Preparation for Universal Payload Simon Glass
                   ` (11 preceding siblings ...)
  2023-08-30 18:04 ` [PATCH 12/32] spl: Move the full FIT code to spl_fit.c Simon Glass
@ 2023-08-30 18:04 ` Simon Glass
  2023-08-30 18:04 ` [PATCH 14/32] spl: Move bloblist writing until the image is known Simon Glass
                   ` (18 subsequent siblings)
  31 siblings, 0 replies; 86+ messages in thread
From: Simon Glass @ 2023-08-30 18:04 UTC (permalink / raw)
  To: U-Boot Mailing List
  Cc: Tom Rini, Marek Vasut, Simon Glass, Oleksandr Suvorov,
	Stefan Herbrechtsmeier

Rather than open-coding the property names, use the existing constants
provided for this purpose. This better aligns the simple-FIT code with
the full FIT implementation.

Signed-off-by: Simon Glass <sjg@chromium.org>
---

 common/spl/spl_fit.c | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/common/spl/spl_fit.c b/common/spl/spl_fit.c
index 5b5f6c62045..03ff9a5db9a 100644
--- a/common/spl/spl_fit.c
+++ b/common/spl/spl_fit.c
@@ -43,7 +43,7 @@ static int find_node_from_desc(const void *fit, int node, const char *str)
 	for (child = fdt_first_subnode(fit, node); child >= 0;
 	     child = fdt_next_subnode(fit, child)) {
 		int len;
-		const char *desc = fdt_getprop(fit, child, "description", &len);
+		const char *desc = fdt_getprop(fit, child, FIT_DESC_PROP, &len);
 
 		if (!desc)
 			continue;
@@ -475,10 +475,11 @@ static int spl_fit_record_loadable(const struct spl_fit_info *ctx, int index,
 	node = spl_fit_get_image_node(ctx, "loadables", index);
 
 	ret = fdt_record_loadable(blob, index, name, image->load_addr,
-				  image->size, image->entry_point,
-				  fdt_getprop(ctx->fit, node, "type", NULL),
-				  fdt_getprop(ctx->fit, node, "os", NULL),
-				  fdt_getprop(ctx->fit, node, "arch", NULL));
+			image->size, image->entry_point,
+			fdt_getprop(ctx->fit, node, FIT_TYPE_PROP, NULL),
+			fdt_getprop(ctx->fit, node, FIT_OS_PROP, NULL),
+			fdt_getprop(ctx->fit, node, FIT_ARCH_PROP, NULL));
+
 	return ret;
 }
 
-- 
2.42.0.rc2.253.gd59a3bf2b4-goog


^ permalink raw reply related	[flat|nested] 86+ messages in thread

* [PATCH 14/32] spl: Move bloblist writing until the image is known
  2023-08-30 18:04 [PATCH 00/32] spl: Preparation for Universal Payload Simon Glass
                   ` (12 preceding siblings ...)
  2023-08-30 18:04 ` [PATCH 13/32] spl: Use the correct FIT_..._PROP constants Simon Glass
@ 2023-08-30 18:04 ` Simon Glass
  2023-08-30 18:04 ` [PATCH 15/32] dm: core: Reverse the argument order in ofnode_copy_props() Simon Glass
                   ` (17 subsequent siblings)
  31 siblings, 0 replies; 86+ messages in thread
From: Simon Glass @ 2023-08-30 18:04 UTC (permalink / raw)
  To: U-Boot Mailing List
  Cc: Tom Rini, Marek Vasut, Simon Glass, Nathan Barrett-Morrison,
	Nikhil M Jain

The bloblist should not be finalised until the image is fully set up.
This allows any final handoff information to be included in the bloblist.

Signed-off-by: Simon Glass <sjg@chromium.org>
---

 common/spl/spl.c | 24 ++++++++++++------------
 1 file changed, 12 insertions(+), 12 deletions(-)

diff --git a/common/spl/spl.c b/common/spl/spl.c
index 8f87a27e61f..0a9fea4f22d 100644
--- a/common/spl/spl.c
+++ b/common/spl/spl.c
@@ -735,18 +735,6 @@ void board_init_r(gd_t *dummy1, ulong dummy2)
 	}
 
 	spl_perform_fixups(&spl_image);
-	if (CONFIG_IS_ENABLED(HANDOFF)) {
-		ret = write_spl_handoff();
-		if (ret)
-			printf(SPL_TPL_PROMPT
-			       "SPL hand-off write failed (err=%d)\n", ret);
-	}
-	if (CONFIG_IS_ENABLED(BLOBLIST)) {
-		ret = bloblist_finish();
-		if (ret)
-			printf("Warning: Failed to finish bloblist (ret=%d)\n",
-			       ret);
-	}
 
 	os = spl_image.os;
 	if (os == IH_OS_U_BOOT) {
@@ -798,6 +786,18 @@ void board_init_r(gd_t *dummy1, ulong dummy2)
 				       dev->name, rc);
 		}
 	}
+	if (CONFIG_IS_ENABLED(HANDOFF)) {
+		ret = write_spl_handoff();
+		if (ret)
+			printf(SPL_TPL_PROMPT
+			       "SPL hand-off write failed (err=%d)\n", ret);
+	}
+	if (CONFIG_IS_ENABLED(BLOBLIST)) {
+		ret = bloblist_finish();
+		if (ret)
+			printf("Warning: Failed to finish bloblist (ret=%d)\n",
+			       ret);
+	}
 
 	spl_board_prepare_for_boot();
 	jump_to_image_no_args(&spl_image);
-- 
2.42.0.rc2.253.gd59a3bf2b4-goog


^ permalink raw reply related	[flat|nested] 86+ messages in thread

* [PATCH 15/32] dm: core: Reverse the argument order in ofnode_copy_props()
  2023-08-30 18:04 [PATCH 00/32] spl: Preparation for Universal Payload Simon Glass
                   ` (13 preceding siblings ...)
  2023-08-30 18:04 ` [PATCH 14/32] spl: Move bloblist writing until the image is known Simon Glass
@ 2023-08-30 18:04 ` Simon Glass
  2023-08-30 18:04 ` [PATCH 16/32] dm: core: Ensure we run flattree tests on ofnode Simon Glass
                   ` (16 subsequent siblings)
  31 siblings, 0 replies; 86+ messages in thread
From: Simon Glass @ 2023-08-30 18:04 UTC (permalink / raw)
  To: U-Boot Mailing List; +Cc: Tom Rini, Marek Vasut, Simon Glass, Pavel Herrmann

Follow the order used by memcpy() as it may be less confusing.

Signed-off-by: Simon Glass <sjg@chromium.org>
---

 boot/vbe_request.c    | 2 +-
 boot/vbe_simple_os.c  | 2 +-
 drivers/core/ofnode.c | 2 +-
 include/dm/ofnode.h   | 6 +++---
 test/dm/ofnode.c      | 9 ++++-----
 5 files changed, 10 insertions(+), 11 deletions(-)

diff --git a/boot/vbe_request.c b/boot/vbe_request.c
index 312edfa2bdb..4ee29717ef6 100644
--- a/boot/vbe_request.c
+++ b/boot/vbe_request.c
@@ -187,7 +187,7 @@ static int bootmeth_vbe_ft_fixup(void *ctx, struct event *event)
 		ret = ofnode_add_subnode(dest_parent, name, &dest);
 		if (ret && ret != -EEXIST)
 			return log_msg_ret("add", ret);
-		ret = ofnode_copy_props(node, dest);
+		ret = ofnode_copy_props(dest, node);
 		if (ret)
 			return log_msg_ret("cp", ret);
 
diff --git a/boot/vbe_simple_os.c b/boot/vbe_simple_os.c
index 8c641ec07e2..02d8352ca8f 100644
--- a/boot/vbe_simple_os.c
+++ b/boot/vbe_simple_os.c
@@ -94,7 +94,7 @@ static int bootmeth_vbe_simple_ft_fixup(void *ctx, struct event *event)
 
 		/* Copy over the vbe properties for fwupd */
 		log_debug("Fixing up: %s\n", dev->name);
-		ret = ofnode_copy_props(dev_ofnode(dev), subnode);
+		ret = ofnode_copy_props(subnode, dev_ofnode(dev));
 		if (ret)
 			return log_msg_ret("cp", ret);
 
diff --git a/drivers/core/ofnode.c b/drivers/core/ofnode.c
index 8311282abf6..8227eac1e4f 100644
--- a/drivers/core/ofnode.c
+++ b/drivers/core/ofnode.c
@@ -1672,7 +1672,7 @@ int ofnode_add_subnode(ofnode node, const char *name, ofnode *subnodep)
 	return ret;	/* 0 or -EEXIST */
 }
 
-int ofnode_copy_props(ofnode src, ofnode dst)
+int ofnode_copy_props(ofnode dst, ofnode src)
 {
 	struct ofprop prop;
 
diff --git a/include/dm/ofnode.h b/include/dm/ofnode.h
index 0a85db31f36..abdfa58036d 100644
--- a/include/dm/ofnode.h
+++ b/include/dm/ofnode.h
@@ -1545,7 +1545,7 @@ int ofnode_add_subnode(ofnode parent, const char *name, ofnode *nodep);
 /**
  * ofnode_copy_props() - copy all properties from one node to another
  *
- * Makes a copy of all properties from the source note in the destination node.
+ * Makes a copy of all properties from the source node to the destination node.
  * Existing properties in the destination node remain unchanged, except that
  * any with the same name are overwritten, including changing the size of the
  * property.
@@ -1553,9 +1553,9 @@ int ofnode_add_subnode(ofnode parent, const char *name, ofnode *nodep);
  * For livetree, properties are copied / allocated, so the source tree does not
  * need to be present afterwards.
  *
+ * @dst: Destination node to write properties to
  * @src: Source node to read properties from
- * @dst: Destination node to write properties too
  */
-int ofnode_copy_props(ofnode src, ofnode dst);
+int ofnode_copy_props(ofnode dst, ofnode src);
 
 #endif
diff --git a/test/dm/ofnode.c b/test/dm/ofnode.c
index b74f5c2ebcf..49fa5d27e6e 100644
--- a/test/dm/ofnode.c
+++ b/test/dm/ofnode.c
@@ -1190,12 +1190,11 @@ static int dm_test_ofnode_too_many(struct unit_test_state *uts)
 }
 DM_TEST(dm_test_ofnode_too_many, UT_TESTF_SCAN_FDT);
 
-static int check_copy_props(struct unit_test_state *uts, ofnode src,
-			    ofnode dst)
+static int check_copy_props(struct unit_test_state *uts, ofnode dst, ofnode src)
 {
 	u32 reg[2], val;
 
-	ut_assertok(ofnode_copy_props(src, dst));
+	ut_assertok(ofnode_copy_props(dst, src));
 
 	ut_assertok(ofnode_read_u32(dst, "ping-expect", &val));
 	ut_asserteq(3, val);
@@ -1227,7 +1226,7 @@ static int dm_test_ofnode_copy_props(struct unit_test_state *uts)
 	src = ofnode_path("/b-test");
 	dst = ofnode_path("/some-bus");
 
-	ut_assertok(check_copy_props(uts, src, dst));
+	ut_assertok(check_copy_props(uts, dst, src));
 
 	/* check a property that is in the destination already */
 	ut_asserteq_str("mux0", ofnode_read_string(dst, "mux-control-names"));
@@ -1243,7 +1242,7 @@ static int dm_test_ofnode_copy_props_ot(struct unit_test_state *uts)
 
 	src = ofnode_path("/b-test");
 	dst = oftree_path(otree, "/node/subnode2");
-	ut_assertok(check_copy_props(uts, src, dst));
+	ut_assertok(check_copy_props(uts, dst, src));
 
 	return 0;
 }
-- 
2.42.0.rc2.253.gd59a3bf2b4-goog


^ permalink raw reply related	[flat|nested] 86+ messages in thread

* [PATCH 16/32] dm: core: Ensure we run flattree tests on ofnode
  2023-08-30 18:04 [PATCH 00/32] spl: Preparation for Universal Payload Simon Glass
                   ` (14 preceding siblings ...)
  2023-08-30 18:04 ` [PATCH 15/32] dm: core: Reverse the argument order in ofnode_copy_props() Simon Glass
@ 2023-08-30 18:04 ` Simon Glass
  2023-08-30 18:04 ` [PATCH 17/32] dm: core: Tidy up comments in the ofnode tests Simon Glass
                   ` (15 subsequent siblings)
  31 siblings, 0 replies; 86+ messages in thread
From: Simon Glass @ 2023-08-30 18:04 UTC (permalink / raw)
  To: U-Boot Mailing List; +Cc: Tom Rini, Marek Vasut, Simon Glass, Pavel Herrmann

We need the UT_TESTF_SCAN_FDT flag set for these tests to run with flat
tree. In some cases it is missing, so add it.

Signed-off-by: Simon Glass <sjg@chromium.org>
---

 test/dm/ofnode.c | 33 ++++++++++++++++++---------------
 1 file changed, 18 insertions(+), 15 deletions(-)

diff --git a/test/dm/ofnode.c b/test/dm/ofnode.c
index 49fa5d27e6e..a29c9aae870 100644
--- a/test/dm/ofnode.c
+++ b/test/dm/ofnode.c
@@ -114,7 +114,7 @@ static int dm_test_ofnode_compatible_ot(struct unit_test_state *uts)
 
 	return 0;
 }
-DM_TEST(dm_test_ofnode_compatible_ot, UT_TESTF_OTHER_FDT);
+DM_TEST(dm_test_ofnode_compatible_ot, UT_TESTF_SCAN_FDT | UT_TESTF_OTHER_FDT);
 
 static int dm_test_ofnode_get_by_phandle(struct unit_test_state *uts)
 {
@@ -146,7 +146,8 @@ static int dm_test_ofnode_get_by_phandle_ot(struct unit_test_state *uts)
 
 	return 0;
 }
-DM_TEST(dm_test_ofnode_get_by_phandle_ot, UT_TESTF_OTHER_FDT);
+DM_TEST(dm_test_ofnode_get_by_phandle_ot,
+	UT_TESTF_SCAN_FDT | UT_TESTF_OTHER_FDT);
 
 static int check_prop_values(struct unit_test_state *uts, ofnode start,
 			     const char *propname, const char *propval,
@@ -196,7 +197,8 @@ static int dm_test_ofnode_by_prop_value_ot(struct unit_test_state *uts)
 
 	return 0;
 }
-DM_TEST(dm_test_ofnode_by_prop_value_ot, UT_TESTF_OTHER_FDT);
+DM_TEST(dm_test_ofnode_by_prop_value_ot,
+	UT_TESTF_SCAN_FDT | UT_TESTF_OTHER_FDT);
 
 static int dm_test_ofnode_fmap(struct unit_test_state *uts)
 {
@@ -237,7 +239,7 @@ static int dm_test_ofnode_read(struct unit_test_state *uts)
 
 	return 0;
 }
-DM_TEST(dm_test_ofnode_read, UT_TESTF_SCAN_PDATA | UT_TESTF_SCAN_FDT);
+DM_TEST(dm_test_ofnode_read, UT_TESTF_SCAN_FDT);
 
 static int dm_test_ofnode_read_ot(struct unit_test_state *uts)
 {
@@ -256,7 +258,7 @@ static int dm_test_ofnode_read_ot(struct unit_test_state *uts)
 
 	return 0;
 }
-DM_TEST(dm_test_ofnode_read_ot, UT_TESTF_OTHER_FDT);
+DM_TEST(dm_test_ofnode_read_ot, UT_TESTF_SCAN_FDT | UT_TESTF_OTHER_FDT);
 
 static int dm_test_ofnode_phandle(struct unit_test_state *uts)
 {
@@ -452,7 +454,8 @@ static int dm_test_ofnode_get_child_count_ot(struct unit_test_state *uts)
 
 	return 0;
 }
-DM_TEST(dm_test_ofnode_get_child_count_ot, UT_TESTF_OTHER_FDT);
+DM_TEST(dm_test_ofnode_get_child_count_ot,
+	UT_TESTF_SCAN_FDT | UT_TESTF_OTHER_FDT);
 
 static int dm_test_ofnode_is_enabled(struct unit_test_state *uts)
 {
@@ -526,7 +529,7 @@ static int dm_test_ofnode_get_reg_ot(struct unit_test_state *uts)
 
 	return 0;
 }
-DM_TEST(dm_test_ofnode_get_reg_ot, UT_TESTF_OTHER_FDT);
+DM_TEST(dm_test_ofnode_get_reg_ot, UT_TESTF_SCAN_FDT | UT_TESTF_OTHER_FDT);
 
 static int dm_test_ofnode_get_path(struct unit_test_state *uts)
 {
@@ -566,7 +569,7 @@ static int dm_test_ofnode_get_path_ot(struct unit_test_state *uts)
 
 	return 0;
 }
-DM_TEST(dm_test_ofnode_get_path_ot, UT_TESTF_OTHER_FDT);
+DM_TEST(dm_test_ofnode_get_path_ot, UT_TESTF_SCAN_FDT | UT_TESTF_OTHER_FDT);
 
 static int dm_test_ofnode_conf(struct unit_test_state *uts)
 {
@@ -581,7 +584,7 @@ static int dm_test_ofnode_conf(struct unit_test_state *uts)
 
 	return 0;
 }
-DM_TEST(dm_test_ofnode_conf, 0);
+DM_TEST(dm_test_ofnode_conf, UT_TESTF_SCAN_FDT);
 
 static int dm_test_ofnode_for_each_compatible_node(struct unit_test_state *uts)
 {
@@ -646,7 +649,7 @@ static int dm_test_ofnode_string(struct unit_test_state *uts)
 
 	return 0;
 }
-DM_TEST(dm_test_ofnode_string, 0);
+DM_TEST(dm_test_ofnode_string, UT_TESTF_SCAN_FDT);
 
 static int dm_test_ofnode_string_err(struct unit_test_state *uts)
 {
@@ -717,7 +720,7 @@ static int dm_test_ofnode_get_phy(struct unit_test_state *uts)
 
 	return 0;
 }
-DM_TEST(dm_test_ofnode_get_phy, 0);
+DM_TEST(dm_test_ofnode_get_phy, UT_TESTF_SCAN_FDT);
 
 /**
  * make_ofnode_fdt() - Create an FDT for testing with ofnode
@@ -901,7 +904,7 @@ static int dm_test_ofnode_write_copy_ot(struct unit_test_state *uts)
 
 	return 0;
 }
-DM_TEST(dm_test_ofnode_write_copy_ot, UT_TESTF_OTHER_FDT);
+DM_TEST(dm_test_ofnode_write_copy_ot, UT_TESTF_SCAN_FDT | UT_TESTF_OTHER_FDT);
 
 static int dm_test_ofnode_u32(struct unit_test_state *uts)
 {
@@ -1103,7 +1106,7 @@ static int dm_test_ofnode_by_compatible_ot(struct unit_test_state *uts)
 
 	return 0;
 }
-DM_TEST(dm_test_ofnode_by_compatible_ot, UT_TESTF_OTHER_FDT);
+DM_TEST(dm_test_ofnode_by_compatible_ot, UT_TESTF_SCAN_FDT | UT_TESTF_OTHER_FDT);
 
 static int dm_test_ofnode_find_subnode(struct unit_test_state *uts)
 {
@@ -1272,7 +1275,7 @@ static int dm_test_livetree_align(struct unit_test_state *uts)
 
 	return 0;
 }
-DM_TEST(dm_test_livetree_align, UT_TESTF_LIVE_TREE);
+DM_TEST(dm_test_livetree_align, UT_TESTF_SCAN_FDT | UT_TESTF_LIVE_TREE);
 
 /* check that it is possible to load an arbitrary livetree */
 static int dm_test_livetree_ensure(struct unit_test_state *uts)
@@ -1291,4 +1294,4 @@ static int dm_test_livetree_ensure(struct unit_test_state *uts)
 
 	return 0;
 }
-DM_TEST(dm_test_livetree_ensure, 0);
+DM_TEST(dm_test_livetree_ensure, UT_TESTF_SCAN_FDT);
-- 
2.42.0.rc2.253.gd59a3bf2b4-goog


^ permalink raw reply related	[flat|nested] 86+ messages in thread

* [PATCH 17/32] dm: core: Tidy up comments in the ofnode tests
  2023-08-30 18:04 [PATCH 00/32] spl: Preparation for Universal Payload Simon Glass
                   ` (15 preceding siblings ...)
  2023-08-30 18:04 ` [PATCH 16/32] dm: core: Ensure we run flattree tests on ofnode Simon Glass
@ 2023-08-30 18:04 ` Simon Glass
  2023-08-30 18:04 ` [PATCH 18/32] dm: core: Add a function to create an empty tree Simon Glass
                   ` (14 subsequent siblings)
  31 siblings, 0 replies; 86+ messages in thread
From: Simon Glass @ 2023-08-30 18:04 UTC (permalink / raw)
  To: U-Boot Mailing List; +Cc: Tom Rini, Marek Vasut, Simon Glass, Pavel Herrmann

Add comments to the functions where the test name does not indicate what
is being tested. Rename functions in a few cases, so that a search for the
function will also file its test.

Signed-off-by: Simon Glass <sjg@chromium.org>
---

 test/dm/ofnode.c | 46 +++++++++++++++++++++++++++++++++++++++-------
 1 file changed, 39 insertions(+), 7 deletions(-)

diff --git a/test/dm/ofnode.c b/test/dm/ofnode.c
index a29c9aae870..84ed7f92b23 100644
--- a/test/dm/ofnode.c
+++ b/test/dm/ofnode.c
@@ -91,6 +91,7 @@ void free_oftree(oftree tree)
 		free(tree.np);
 }
 
+/* test ofnode_device_is_compatible() */
 static int dm_test_ofnode_compatible(struct unit_test_state *uts)
 {
 	ofnode root_node = ofnode_path("/");
@@ -134,6 +135,7 @@ static int dm_test_ofnode_get_by_phandle(struct unit_test_state *uts)
 }
 DM_TEST(dm_test_ofnode_get_by_phandle, UT_TESTF_SCAN_PDATA | UT_TESTF_SCAN_FDT);
 
+/* test oftree_get_by_phandle() with a the 'other' oftree */
 static int dm_test_ofnode_get_by_phandle_ot(struct unit_test_state *uts)
 {
 	oftree otree = get_other_oftree(uts);
@@ -188,6 +190,7 @@ static int dm_test_ofnode_by_prop_value(struct unit_test_state *uts)
 }
 DM_TEST(dm_test_ofnode_by_prop_value, UT_TESTF_SCAN_FDT);
 
+/* test ofnode_by_prop_value() with a the 'other' oftree */
 static int dm_test_ofnode_by_prop_value_ot(struct unit_test_state *uts)
 {
 	oftree otree = get_other_oftree(uts);
@@ -200,6 +203,7 @@ static int dm_test_ofnode_by_prop_value_ot(struct unit_test_state *uts)
 DM_TEST(dm_test_ofnode_by_prop_value_ot,
 	UT_TESTF_SCAN_FDT | UT_TESTF_OTHER_FDT);
 
+/* test ofnode_read_fmap_entry() */
 static int dm_test_ofnode_fmap(struct unit_test_state *uts)
 {
 	struct fmap_entry entry;
@@ -215,6 +219,7 @@ static int dm_test_ofnode_fmap(struct unit_test_state *uts)
 }
 DM_TEST(dm_test_ofnode_fmap, UT_TESTF_SCAN_PDATA | UT_TESTF_SCAN_FDT);
 
+/* test ofnode_read_prop() */
 static int dm_test_ofnode_read(struct unit_test_state *uts)
 {
 	const u32 *val;
@@ -241,6 +246,7 @@ static int dm_test_ofnode_read(struct unit_test_state *uts)
 }
 DM_TEST(dm_test_ofnode_read, UT_TESTF_SCAN_FDT);
 
+/* test ofnode_read_prop() with the 'other' tree */
 static int dm_test_ofnode_read_ot(struct unit_test_state *uts)
 {
 	oftree otree = get_other_oftree(uts);
@@ -260,6 +266,7 @@ static int dm_test_ofnode_read_ot(struct unit_test_state *uts)
 }
 DM_TEST(dm_test_ofnode_read_ot, UT_TESTF_SCAN_FDT | UT_TESTF_OTHER_FDT);
 
+/* test ofnode_count_/parse_phandle_with_args() */
 static int dm_test_ofnode_phandle(struct unit_test_state *uts)
 {
 	struct ofnode_phandle_args args;
@@ -335,6 +342,7 @@ static int dm_test_ofnode_phandle(struct unit_test_state *uts)
 }
 DM_TEST(dm_test_ofnode_phandle, UT_TESTF_SCAN_PDATA | UT_TESTF_SCAN_FDT);
 
+/* test ofnode_count_/parse_phandle_with_args() with 'other' tree */
 static int dm_test_ofnode_phandle_ot(struct unit_test_state *uts)
 {
 	oftree otree = get_other_oftree(uts);
@@ -363,6 +371,7 @@ static int dm_test_ofnode_phandle_ot(struct unit_test_state *uts)
 }
 DM_TEST(dm_test_ofnode_phandle_ot, UT_TESTF_OTHER_FDT);
 
+/* test ofnode_read_chosen_string/node/prop() */
 static int dm_test_ofnode_read_chosen(struct unit_test_state *uts)
 {
 	const char *str;
@@ -392,6 +401,7 @@ static int dm_test_ofnode_read_chosen(struct unit_test_state *uts)
 }
 DM_TEST(dm_test_ofnode_read_chosen, UT_TESTF_SCAN_PDATA | UT_TESTF_SCAN_FDT);
 
+/* test ofnode_get_aliases_node/prop() */
 static int dm_test_ofnode_read_aliases(struct unit_test_state *uts)
 {
 	const void *val;
@@ -435,6 +445,7 @@ static int dm_test_ofnode_get_child_count(struct unit_test_state *uts)
 DM_TEST(dm_test_ofnode_get_child_count,
 	UT_TESTF_SCAN_PDATA | UT_TESTF_SCAN_FDT);
 
+/* test ofnode_get_child_count() with 'other' tree */
 static int dm_test_ofnode_get_child_count_ot(struct unit_test_state *uts)
 {
 	oftree otree = get_other_oftree(uts);
@@ -469,6 +480,7 @@ static int dm_test_ofnode_is_enabled(struct unit_test_state *uts)
 }
 DM_TEST(dm_test_ofnode_is_enabled, UT_TESTF_SCAN_PDATA | UT_TESTF_SCAN_FDT);
 
+/* test ofnode_is_enabled() with 'other' tree */
 static int dm_test_ofnode_is_enabled_ot(struct unit_test_state *uts)
 {
 	oftree otree = get_other_oftree(uts);
@@ -482,6 +494,7 @@ static int dm_test_ofnode_is_enabled_ot(struct unit_test_state *uts)
 }
 DM_TEST(dm_test_ofnode_is_enabled_ot, UT_TESTF_OTHER_FDT);
 
+/* test ofnode_get_addr/size() */
 static int dm_test_ofnode_get_reg(struct unit_test_state *uts)
 {
 	ofnode node;
@@ -518,6 +531,7 @@ static int dm_test_ofnode_get_reg(struct unit_test_state *uts)
 }
 DM_TEST(dm_test_ofnode_get_reg, UT_TESTF_SCAN_PDATA | UT_TESTF_SCAN_FDT);
 
+/* test ofnode_get_addr() with 'other' tree */
 static int dm_test_ofnode_get_reg_ot(struct unit_test_state *uts)
 {
 	oftree otree = get_other_oftree(uts);
@@ -552,6 +566,7 @@ static int dm_test_ofnode_get_path(struct unit_test_state *uts)
 }
 DM_TEST(dm_test_ofnode_get_path, UT_TESTF_SCAN_PDATA | UT_TESTF_SCAN_FDT);
 
+/* test ofnode_get_path() with 'other' tree */
 static int dm_test_ofnode_get_path_ot(struct unit_test_state *uts)
 {
 	oftree otree = get_other_oftree(uts);
@@ -571,6 +586,7 @@ static int dm_test_ofnode_get_path_ot(struct unit_test_state *uts)
 }
 DM_TEST(dm_test_ofnode_get_path_ot, UT_TESTF_SCAN_FDT | UT_TESTF_OTHER_FDT);
 
+/* test ofnode_conf_read_bool/int/str() */
 static int dm_test_ofnode_conf(struct unit_test_state *uts)
 {
 	ut_assert(!ofnode_conf_read_bool("missing"));
@@ -604,6 +620,7 @@ static int dm_test_ofnode_for_each_compatible_node(struct unit_test_state *uts)
 }
 DM_TEST(dm_test_ofnode_for_each_compatible_node, UT_TESTF_SCAN_FDT);
 
+/* test dm_test_ofnode_string_count/index/list() */
 static int dm_test_ofnode_string(struct unit_test_state *uts)
 {
 	const char **val;
@@ -651,6 +668,7 @@ static int dm_test_ofnode_string(struct unit_test_state *uts)
 }
 DM_TEST(dm_test_ofnode_string, UT_TESTF_SCAN_FDT);
 
+/* test error returns from ofnode_read_string_count/index/list() */
 static int dm_test_ofnode_string_err(struct unit_test_state *uts)
 {
 	const char **val;
@@ -700,7 +718,7 @@ static int dm_test_ofnode_string_err(struct unit_test_state *uts)
 }
 DM_TEST(dm_test_ofnode_string_err, UT_TESTF_LIVE_TREE);
 
-static int dm_test_ofnode_get_phy(struct unit_test_state *uts)
+static int dm_test_ofnode_read_phy_mode(struct unit_test_state *uts)
 {
 	ofnode eth_node, phy_node;
 	phy_interface_t mode;
@@ -720,7 +738,7 @@ static int dm_test_ofnode_get_phy(struct unit_test_state *uts)
 
 	return 0;
 }
-DM_TEST(dm_test_ofnode_get_phy, UT_TESTF_SCAN_FDT);
+DM_TEST(dm_test_ofnode_read_phy_mode, UT_TESTF_SCAN_FDT);
 
 /**
  * make_ofnode_fdt() - Create an FDT for testing with ofnode
@@ -754,11 +772,11 @@ static int make_ofnode_fdt(struct unit_test_state *uts, void *fdt, int size,
 	return 0;
 }
 
-static int dm_test_ofnode_root(struct unit_test_state *uts)
+/* Check that aliases work on the control FDT */
+static int dm_test_ofnode_aliases(struct unit_test_state *uts)
 {
 	ofnode node;
 
-	/* Check that aliases work on the control FDT */
 	node = ofnode_get_aliases_node("ethernet3");
 	ut_assert(ofnode_valid(node));
 	ut_asserteq_str("sbe5", ofnode_get_name(node));
@@ -767,8 +785,15 @@ static int dm_test_ofnode_root(struct unit_test_state *uts)
 
 	return 0;
 }
-DM_TEST(dm_test_ofnode_root, UT_TESTF_SCAN_FDT);
+DM_TEST(dm_test_ofnode_aliases, UT_TESTF_SCAN_FDT);
 
+/**
+ * dm_test_ofnode_root_mult() - Check aliaes on control and 'other' tree
+ *
+ * Check that aliases work only with the control FDT, not with 'other' tree.
+ * This is not actually the desired behaviour. If aliases are implemented for
+ * any tree, then this test should be changed.
+ */
 static int dm_test_ofnode_root_mult(struct unit_test_state *uts)
 {
 	char fdt[256];
@@ -801,6 +826,7 @@ static int dm_test_ofnode_root_mult(struct unit_test_state *uts)
 }
 DM_TEST(dm_test_ofnode_root_mult, UT_TESTF_SCAN_FDT);
 
+/* test ofnode_set_enabled(), ofnode_write_prop() on a livetree */
 static int dm_test_ofnode_livetree_writing(struct unit_test_state *uts)
 {
 	struct udevice *dev;
@@ -890,6 +916,7 @@ static int dm_test_ofnode_write_copy(struct unit_test_state *uts)
 }
 DM_TEST(dm_test_ofnode_write_copy, UT_TESTF_SCAN_FDT);
 
+/* test writing a property to the 'other' tree */
 static int dm_test_ofnode_write_copy_ot(struct unit_test_state *uts)
 {
 	oftree otree = get_other_oftree(uts);
@@ -906,6 +933,7 @@ static int dm_test_ofnode_write_copy_ot(struct unit_test_state *uts)
 }
 DM_TEST(dm_test_ofnode_write_copy_ot, UT_TESTF_SCAN_FDT | UT_TESTF_OTHER_FDT);
 
+/* test ofnode_read_u32_index/default() */
 static int dm_test_ofnode_u32(struct unit_test_state *uts)
 {
 	ofnode node;
@@ -933,6 +961,7 @@ static int dm_test_ofnode_u32(struct unit_test_state *uts)
 }
 DM_TEST(dm_test_ofnode_u32, UT_TESTF_SCAN_PDATA | UT_TESTF_SCAN_FDT);
 
+/* test ofnode_read_u32_array() */
 static int dm_test_ofnode_u32_array(struct unit_test_state *uts)
 {
 	ofnode node;
@@ -959,7 +988,7 @@ static int dm_test_ofnode_u32_array(struct unit_test_state *uts)
 }
 DM_TEST(dm_test_ofnode_u32_array, UT_TESTF_SCAN_PDATA | UT_TESTF_SCAN_FDT);
 
-static int dm_test_ofnode_u64(struct unit_test_state *uts)
+static int dm_test_ofnode_read_u64(struct unit_test_state *uts)
 {
 	ofnode node;
 	u64 val;
@@ -980,7 +1009,7 @@ static int dm_test_ofnode_u64(struct unit_test_state *uts)
 
 	return 0;
 }
-DM_TEST(dm_test_ofnode_u64, UT_TESTF_SCAN_FDT);
+DM_TEST(dm_test_ofnode_read_u64, UT_TESTF_SCAN_FDT);
 
 static int dm_test_ofnode_add_subnode(struct unit_test_state *uts)
 {
@@ -1091,6 +1120,7 @@ static int dm_test_ofnode_by_compatible(struct unit_test_state *uts)
 }
 DM_TEST(dm_test_ofnode_by_compatible, UT_TESTF_SCAN_FDT);
 
+/* check ofnode_by_compatible() on the 'other' tree */
 static int dm_test_ofnode_by_compatible_ot(struct unit_test_state *uts)
 {
 	const char *compat = "sandbox-other2";
@@ -1125,6 +1155,7 @@ static int dm_test_ofnode_find_subnode(struct unit_test_state *uts)
 }
 DM_TEST(dm_test_ofnode_find_subnode, UT_TESTF_SCAN_FDT);
 
+/* test ofnode_find_subnode() on the 'other' tree */
 static int dm_test_ofnode_find_subnode_ot(struct unit_test_state *uts)
 {
 	oftree otree = get_other_oftree(uts);
@@ -1238,6 +1269,7 @@ static int dm_test_ofnode_copy_props(struct unit_test_state *uts)
 }
 DM_TEST(dm_test_ofnode_copy_props, UT_TESTF_SCAN_FDT);
 
+/* test ofnode_copy_props() with the 'other' tree */
 static int dm_test_ofnode_copy_props_ot(struct unit_test_state *uts)
 {
 	ofnode src, dst;
-- 
2.42.0.rc2.253.gd59a3bf2b4-goog


^ permalink raw reply related	[flat|nested] 86+ messages in thread

* [PATCH 18/32] dm: core: Add a function to create an empty tree
  2023-08-30 18:04 [PATCH 00/32] spl: Preparation for Universal Payload Simon Glass
                   ` (16 preceding siblings ...)
  2023-08-30 18:04 ` [PATCH 17/32] dm: core: Tidy up comments in the ofnode tests Simon Glass
@ 2023-08-30 18:04 ` Simon Glass
  2023-08-30 18:04 ` [PATCH 19/32] dm: core: Add a way to copy a node Simon Glass
                   ` (13 subsequent siblings)
  31 siblings, 0 replies; 86+ messages in thread
From: Simon Glass @ 2023-08-30 18:04 UTC (permalink / raw)
  To: U-Boot Mailing List; +Cc: Tom Rini, Marek Vasut, Simon Glass, Pavel Herrmann

Provide a function to create a new, empty tree.

Signed-off-by: Simon Glass <sjg@chromium.org>
---

 drivers/core/ofnode.c | 56 +++++++++++++++++++++++++++++++++++++++----
 include/dm/ofnode.h   |  9 +++++++
 include/of_live.h     |  8 +++++++
 lib/of_live.c         | 19 +++++++++++++++
 test/dm/ofnode.c      | 16 +++++++++++++
 5 files changed, 104 insertions(+), 4 deletions(-)

diff --git a/drivers/core/ofnode.c b/drivers/core/ofnode.c
index 8227eac1e4f..7100fc63035 100644
--- a/drivers/core/ofnode.c
+++ b/drivers/core/ofnode.c
@@ -47,6 +47,17 @@ static int oftree_find(const void *fdt)
 	return -1;
 }
 
+static int check_tree_count(void)
+{
+	if (oftree_count == CONFIG_OFNODE_MULTI_TREE_MAX) {
+		log_warning("Too many registered device trees (max %d)\n",
+			    CONFIG_OFNODE_MULTI_TREE_MAX);
+		return -E2BIG;
+	}
+
+	return 0;
+}
+
 static oftree oftree_ensure(void *fdt)
 {
 	oftree tree;
@@ -69,11 +80,8 @@ static oftree oftree_ensure(void *fdt)
 	if (gd->flags & GD_FLG_RELOC) {
 		i = oftree_find(fdt);
 		if (i == -1) {
-			if (oftree_count == CONFIG_OFNODE_MULTI_TREE_MAX) {
-				log_warning("Too many registered device trees (max %d)\n",
-					    CONFIG_OFNODE_MULTI_TREE_MAX);
+			if (check_tree_count())
 				return oftree_null();
-			}
 
 			/* register the new tree */
 			i = oftree_count++;
@@ -92,6 +100,41 @@ static oftree oftree_ensure(void *fdt)
 	return tree;
 }
 
+int oftree_new(oftree *treep)
+{
+	oftree tree = oftree_null();
+	int ret;
+
+	if (of_live_active()) {
+		struct device_node *root;
+
+		ret = of_live_create_empty(&root);
+		if (ret)
+			return log_msg_ret("liv", ret);
+		tree = oftree_from_np(root);
+	} else {
+		const int size = 1024;
+		void *fdt;
+
+		ret = check_tree_count();
+		if (ret)
+			return log_msg_ret("fla", ret);
+
+		/* register the new tree with a small size */
+		fdt = malloc(size);
+		if (!fdt)
+			return log_msg_ret("fla", -ENOMEM);
+		ret = fdt_create_empty_tree(fdt, size);
+		if (ret)
+			return log_msg_ret("fla", -EINVAL);
+		oftree_list[oftree_count++] = fdt;
+		tree.fdt = fdt;
+	}
+	*treep = tree;
+
+	return 0;
+}
+
 void oftree_dispose(oftree tree)
 {
 	if (of_live_active())
@@ -193,6 +236,11 @@ static inline int oftree_find(const void *fdt)
 	return 0;
 }
 
+int oftree_new(oftree *treep)
+{
+	return -ENOSYS;
+}
+
 #endif /* OFNODE_MULTI_TREE */
 
 /**
diff --git a/include/dm/ofnode.h b/include/dm/ofnode.h
index abdfa58036d..fa6a8318899 100644
--- a/include/dm/ofnode.h
+++ b/include/dm/ofnode.h
@@ -126,6 +126,15 @@ static inline ofnode noffset_to_ofnode(ofnode other_node, int of_offset)
 
 #endif /* OFNODE_MULTI_TREE */
 
+/**
+ * oftree_new() - Create a new, empty tree
+ *
+ * @treep: Returns a pointer to the tree, on success
+ * Returns: 0 on success, -ENOMEM if out of memory, -E2BIG if !OF_LIVE and
+ * there are too many (flattrees) already
+ */
+int oftree_new(oftree *treep);
+
 /**
  * ofnode_to_np() - convert an ofnode to a live DT node pointer
  *
diff --git a/include/of_live.h b/include/of_live.h
index 05e86ac06b1..81cb9bd13e2 100644
--- a/include/of_live.h
+++ b/include/of_live.h
@@ -46,4 +46,12 @@ int unflatten_device_tree(const void *blob, struct device_node **mynodes);
  */
 void of_live_free(struct device_node *root);
 
+/**
+ * of_live_create_empty() - Create a new, empty tree
+ *
+ * @rootp: Returns the root node of the created tree
+ * Return: 0 if OK, -ENOMEM if out of memory
+ */
+int of_live_create_empty(struct device_node **rootp);
+
 #endif
diff --git a/lib/of_live.c b/lib/of_live.c
index 25f7af61061..e4eee385547 100644
--- a/lib/of_live.c
+++ b/lib/of_live.c
@@ -336,3 +336,22 @@ void of_live_free(struct device_node *root)
 	/* the tree is stored as a contiguous block of memory */
 	free(root);
 }
+
+int of_live_create_empty(struct device_node **rootp)
+{
+	struct device_node *root;
+
+	root = calloc(1, sizeof(struct device_node));
+	if (!root)
+		return -ENOMEM;
+	root->name = strdup("");
+	if (!root->name) {
+		free(root);
+		return -ENOMEM;
+	}
+	root->type = "<NULL>";
+	root->full_name = "";
+	*rootp = root;
+
+	return 0;
+}
diff --git a/test/dm/ofnode.c b/test/dm/ofnode.c
index 84ed7f92b23..63b651df84e 100644
--- a/test/dm/ofnode.c
+++ b/test/dm/ofnode.c
@@ -1327,3 +1327,19 @@ static int dm_test_livetree_ensure(struct unit_test_state *uts)
 	return 0;
 }
 DM_TEST(dm_test_livetree_ensure, UT_TESTF_SCAN_FDT);
+
+static int dm_test_oftree_new(struct unit_test_state *uts)
+{
+	ofnode node, subnode, check;
+	oftree tree;
+
+	ut_assertok(oftree_new(&tree));
+	node = oftree_root(tree);
+	ut_assert(ofnode_valid(node));
+	ut_assertok(ofnode_add_subnode(node, "edmund", &subnode));
+	check = ofnode_find_subnode(node, "edmund");
+	ut_asserteq(check.of_offset, subnode.of_offset);
+
+	return 0;
+}
+DM_TEST(dm_test_oftree_new, UT_TESTF_SCAN_FDT);
-- 
2.42.0.rc2.253.gd59a3bf2b4-goog


^ permalink raw reply related	[flat|nested] 86+ messages in thread

* [PATCH 19/32] dm: core: Add a way to copy a node
  2023-08-30 18:04 [PATCH 00/32] spl: Preparation for Universal Payload Simon Glass
                   ` (17 preceding siblings ...)
  2023-08-30 18:04 ` [PATCH 18/32] dm: core: Add a function to create an empty tree Simon Glass
@ 2023-08-30 18:04 ` Simon Glass
  2023-08-30 18:04 ` [PATCH 20/32] dm: core: Add a way to delete " Simon Glass
                   ` (12 subsequent siblings)
  31 siblings, 0 replies; 86+ messages in thread
From: Simon Glass @ 2023-08-30 18:04 UTC (permalink / raw)
  To: U-Boot Mailing List; +Cc: Tom Rini, Marek Vasut, Simon Glass, Pavel Herrmann

Add a function to copy a node to another place under a new name. This is
useful at least for testing, since copying a test node with existing
properties is easier than writing the code to generate it all afresh.

Signed-off-by: Simon Glass <sjg@chromium.org>
---

 drivers/core/ofnode.c | 20 ++++++++++++++
 include/dm/ofnode.h   | 15 +++++++++++
 test/dm/ofnode.c      | 63 +++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 98 insertions(+)

diff --git a/drivers/core/ofnode.c b/drivers/core/ofnode.c
index 7100fc63035..ba8385af7b4 100644
--- a/drivers/core/ofnode.c
+++ b/drivers/core/ofnode.c
@@ -1743,3 +1743,23 @@ int ofnode_copy_props(ofnode dst, ofnode src)
 
 	return 0;
 }
+
+int ofnode_copy_node(ofnode dst_parent, const char *name, ofnode src,
+		     ofnode *nodep)
+{
+	ofnode node;
+	int ret;
+
+	ret = ofnode_add_subnode(dst_parent, name, &node);
+	if (ret) {
+		if (ret == -EEXIST)
+			*nodep = node;
+		return log_msg_ret("add", ret);
+	}
+	ret = ofnode_copy_props(node, src);
+	if (ret)
+		return log_msg_ret("cpy", ret);
+	*nodep = node;
+
+	return 0;
+}
diff --git a/include/dm/ofnode.h b/include/dm/ofnode.h
index fa6a8318899..80708a3644c 100644
--- a/include/dm/ofnode.h
+++ b/include/dm/ofnode.h
@@ -1567,4 +1567,19 @@ int ofnode_add_subnode(ofnode parent, const char *name, ofnode *nodep);
  */
 int ofnode_copy_props(ofnode dst, ofnode src);
 
+/**
+ * ofnode_copy_node() - Copy a node to another place
+ *
+ * If a node with this name already exists in dst_parent, this returns an
+ * .error
+ *
+ * @dst_parent: Parent of the newly copied node
+ * @name: Name to give the new node
+ * @src: Source node to copy
+ * @nodep: Returns the new node, or the existing node if there is one
+ * Return: 0 if OK, -EEXIST if dst_parent already has a node with this parent
+ */
+int ofnode_copy_node(ofnode dst_parent, const char *name, ofnode src,
+		     ofnode *nodep);
+
 #endif
diff --git a/test/dm/ofnode.c b/test/dm/ofnode.c
index 63b651df84e..fe7916c2722 100644
--- a/test/dm/ofnode.c
+++ b/test/dm/ofnode.c
@@ -1343,3 +1343,66 @@ static int dm_test_oftree_new(struct unit_test_state *uts)
 	return 0;
 }
 DM_TEST(dm_test_oftree_new, UT_TESTF_SCAN_FDT);
+
+static int check_copy_node(struct unit_test_state *uts, ofnode dst, ofnode src,
+			   ofnode *nodep)
+{
+	u32 reg[2], val;
+	ofnode node;
+
+	ut_assertok(ofnode_copy_node(dst, "copy-test", src, &node));
+
+	ut_assertok(ofnode_read_u32(node, "ping-expect", &val));
+	ut_asserteq(3, val);
+
+	ut_asserteq_str("denx,u-boot-fdt-test",
+			ofnode_read_string(node, "compatible"));
+
+	/* check that a property with the same name is overwritten */
+	ut_assertok(ofnode_read_u32_array(node, "reg", reg, ARRAY_SIZE(reg)));
+	ut_asserteq(3, reg[0]);
+	ut_asserteq(1, reg[1]);
+
+	/* reset the compatible so the live tree does not change */
+	ut_assertok(ofnode_write_string(node, "compatible", "nothing"));
+	*nodep = node;
+
+	return 0;
+}
+
+static int dm_test_ofnode_copy_node(struct unit_test_state *uts)
+{
+	ofnode src, dst, node, try;
+
+	/*
+	 * These nodes are chosen so that the src node is before the destination
+	 * node in the tree. This doesn't matter with livetree, but with
+	 * flattree any attempt to insert a property earlier in the tree will
+	 * mess up the offsets after it.
+	 */
+	src = ofnode_path("/b-test");
+	dst = ofnode_path("/some-bus");
+
+	ut_assertok(check_copy_node(uts, dst, src, &node));
+
+	/* check trying to copy over an existing node */
+	ut_asserteq(-EEXIST, ofnode_copy_node(dst, "copy-test", src, &try));
+	ut_asserteq(try.of_offset, node.of_offset);
+
+	return 0;
+}
+DM_TEST(dm_test_ofnode_copy_node, UT_TESTF_SCAN_FDT);
+
+/* test ofnode_copy_node() with the 'other' tree */
+static int dm_test_ofnode_copy_node_ot(struct unit_test_state *uts)
+{
+	oftree otree = get_other_oftree(uts);
+	ofnode src, dst, node;
+
+	src = ofnode_path("/b-test");
+	dst = oftree_path(otree, "/node/subnode2");
+	ut_assertok(check_copy_node(uts, dst, src, &node));
+
+	return 0;
+}
+DM_TEST(dm_test_ofnode_copy_node_ot, UT_TESTF_SCAN_FDT | UT_TESTF_OTHER_FDT);
-- 
2.42.0.rc2.253.gd59a3bf2b4-goog


^ permalink raw reply related	[flat|nested] 86+ messages in thread

* [PATCH 20/32] dm: core: Add a way to delete a node
  2023-08-30 18:04 [PATCH 00/32] spl: Preparation for Universal Payload Simon Glass
                   ` (18 preceding siblings ...)
  2023-08-30 18:04 ` [PATCH 19/32] dm: core: Add a way to copy a node Simon Glass
@ 2023-08-30 18:04 ` Simon Glass
  2023-08-30 18:04 ` [PATCH 21/32] dm: core: Add a way to convert a devicetree to a dtb Simon Glass
                   ` (11 subsequent siblings)
  31 siblings, 0 replies; 86+ messages in thread
From: Simon Glass @ 2023-08-30 18:04 UTC (permalink / raw)
  To: U-Boot Mailing List; +Cc: Tom Rini, Marek Vasut, Simon Glass, Pavel Herrmann

Add a function to delete a node in an existing tree.

Signed-off-by: Simon Glass <sjg@chromium.org>
---

 drivers/core/of_access.c | 65 ++++++++++++++++++++++++++++++++++++++++
 drivers/core/ofnode.c    | 23 ++++++++++++++
 include/dm/of_access.h   | 18 +++++++++++
 include/dm/ofnode.h      | 13 ++++++++
 test/dm/ofnode.c         | 31 +++++++++++++++++++
 5 files changed, 150 insertions(+)

diff --git a/drivers/core/of_access.c b/drivers/core/of_access.c
index 1bb4d8eab70..0df5c867c8b 100644
--- a/drivers/core/of_access.c
+++ b/drivers/core/of_access.c
@@ -1040,3 +1040,68 @@ int of_add_subnode(struct device_node *parent, const char *name, int len,
 
 	return 0;
 }
+
+int __of_remove_property(struct device_node *np, struct property *prop)
+{
+	struct property **next;
+
+	for (next = &np->properties; *next; next = &(*next)->next) {
+		if (*next == prop)
+			break;
+	}
+	if (*next == NULL)
+		return -ENODEV;
+
+	/* found the node */
+	*next = prop->next;
+
+	return 0;
+}
+
+int of_remove_property(struct device_node *np, struct property *prop)
+{
+	int rc;
+
+	mutex_lock(&of_mutex);
+
+	rc = __of_remove_property(np, prop);
+
+	mutex_unlock(&of_mutex);
+
+	return rc;
+}
+
+int of_remove_node(struct device_node *to_remove)
+{
+	struct device_node *parent = to_remove->parent;
+	struct device_node *np, *prev;
+
+	if (!parent)
+		return -EPERM;
+	prev = NULL;
+	__for_each_child_of_node(parent, np) {
+		if (np == to_remove)
+			break;
+		prev = np;
+	}
+	if (!np)
+		return -EFAULT;
+
+	/* if there is a previous node, link it to this one's sibling */
+	if (prev)
+		prev->sibling = np->sibling;
+	else
+		parent->child = np->sibling;
+
+	/*
+	 * don't free it, since if this is an unflattened tree, all the memory
+	 * was alloced in one block; this pointer will be somewhere in the
+	 * middle of that
+	 *
+	 * TODO(sjg@chromium.org): Consider marking nodes as 'allocated'?
+	 *
+	 * free(np);
+	 */
+
+	return 0;
+}
diff --git a/drivers/core/ofnode.c b/drivers/core/ofnode.c
index ba8385af7b4..fe143f99091 100644
--- a/drivers/core/ofnode.c
+++ b/drivers/core/ofnode.c
@@ -1720,6 +1720,29 @@ int ofnode_add_subnode(ofnode node, const char *name, ofnode *subnodep)
 	return ret;	/* 0 or -EEXIST */
 }
 
+int ofnode_delete(ofnode *nodep)
+{
+	ofnode node = *nodep;
+	int ret;
+
+	assert(ofnode_valid(node));
+	if (ofnode_is_np(node)) {
+		ret = of_remove_node(ofnode_to_np(node));
+	} else {
+		void *fdt = ofnode_to_fdt(node);
+		int offset = ofnode_to_offset(node);
+
+		ret = fdt_del_node(fdt, offset);
+		if (ret)
+			ret = -EFAULT;
+	}
+	if (ret)
+		return ret;
+	*nodep = ofnode_null();
+
+	return 0;
+}
+
 int ofnode_copy_props(ofnode dst, ofnode src)
 {
 	struct ofprop prop;
diff --git a/include/dm/of_access.h b/include/dm/of_access.h
index 9361d0a87bf..de740d44674 100644
--- a/include/dm/of_access.h
+++ b/include/dm/of_access.h
@@ -597,4 +597,22 @@ int of_write_prop(struct device_node *np, const char *propname, int len,
 int of_add_subnode(struct device_node *node, const char *name, int len,
 		   struct device_node **subnodep);
 
+/**
+ * of_remove_property() - Remove a property from a node
+ *
+ * @np: Node to remove from
+ * @prop: Pointer to property to remove
+ * Return 0 if OK, -ENODEV if the property could not be found in the node
+ */
+int of_remove_property(struct device_node *np, struct property *prop);
+
+/**
+ * of_remove_node() - Remove a node from the tree
+ *
+ * @to_remove: Node to remove
+ * Return: 0 if OK, -EPERM if it is the root node (wWhich cannot be removed),
+ * -ENOENT if the tree is broken (to_remove is not a child of its parent)
+ */
+int of_remove_node(struct device_node *to_remove);
+
 #endif
diff --git a/include/dm/ofnode.h b/include/dm/ofnode.h
index 80708a3644c..8be617b2104 100644
--- a/include/dm/ofnode.h
+++ b/include/dm/ofnode.h
@@ -1582,4 +1582,17 @@ int ofnode_copy_props(ofnode dst, ofnode src);
 int ofnode_copy_node(ofnode dst_parent, const char *name, ofnode src,
 		     ofnode *nodep);
 
+/**
+ * ofnode_delete() - Delete a node
+ *
+ * Delete a node from the tree
+ *
+ * @nodep: Pointer to node to delete (set to ofnode_null() on success)
+ * Return: 0 if OK, -ENOENT if the node does not exist, -EPERM if it is the root
+ * node (wWhich cannot be removed), -EFAULT if the tree is broken (to_remove is
+ * not a child of its parent),
+ *
+ */
+int ofnode_delete(ofnode *nodep);
+
 #endif
diff --git a/test/dm/ofnode.c b/test/dm/ofnode.c
index fe7916c2722..cb7fc907c82 100644
--- a/test/dm/ofnode.c
+++ b/test/dm/ofnode.c
@@ -1406,3 +1406,34 @@ static int dm_test_ofnode_copy_node_ot(struct unit_test_state *uts)
 	return 0;
 }
 DM_TEST(dm_test_ofnode_copy_node_ot, UT_TESTF_SCAN_FDT | UT_TESTF_OTHER_FDT);
+
+static int dm_test_ofnode_delete(struct unit_test_state *uts)
+{
+	ofnode node;
+
+	/*
+	 * At present the livetree is not restored after changes made in tests.
+	 * See test_pre_run() for how this is done with the other FDT and
+	 * dm_test_pre_run() where it sets up the root-tree pointer. So use
+	 * nodes which don't matter to other tests.
+	 *
+	 * We could fix this by detecting livetree changes and regenerating it
+	 * before the next test if needed.
+	 */
+	node = ofnode_path("/leds/iracibble");
+	ut_assert(ofnode_valid(node));
+	ut_assertok(ofnode_delete(&node));
+	ut_assert(!ofnode_valid(node));
+	ut_assert(!ofnode_valid(ofnode_path("/leds/iracibble")));
+
+	node = ofnode_path("/leds/default_on");
+	ut_assert(ofnode_valid(node));
+	ut_assertok(ofnode_delete(&node));
+	ut_assert(!ofnode_valid(node));
+	ut_assert(!ofnode_valid(ofnode_path("/leds/default_on")));
+
+	ut_asserteq(2, ofnode_get_child_count(ofnode_path("/leds")));
+
+	return 0;
+}
+DM_TEST(dm_test_ofnode_delete, UT_TESTF_SCAN_FDT);
-- 
2.42.0.rc2.253.gd59a3bf2b4-goog


^ permalink raw reply related	[flat|nested] 86+ messages in thread

* [PATCH 21/32] dm: core: Add a way to convert a devicetree to a dtb
  2023-08-30 18:04 [PATCH 00/32] spl: Preparation for Universal Payload Simon Glass
                   ` (19 preceding siblings ...)
  2023-08-30 18:04 ` [PATCH 20/32] dm: core: Add a way to delete " Simon Glass
@ 2023-08-30 18:04 ` Simon Glass
  2023-08-30 18:04 ` [PATCH 22/32] dm: core: Support writing a boolean Simon Glass
                   ` (10 subsequent siblings)
  31 siblings, 0 replies; 86+ messages in thread
From: Simon Glass @ 2023-08-30 18:04 UTC (permalink / raw)
  To: U-Boot Mailing List; +Cc: Tom Rini, Marek Vasut, Simon Glass, Pavel Herrmann

Add a way to flatten a devicetree into binary form. For livetree this
involves generating the devicetree using fdt_property() and other calls.
For flattree it simply involves providing the buffer containing the tree.

Signed-off-by: Simon Glass <sjg@chromium.org>
---

 drivers/core/ofnode.c |  18 +++++++
 include/dm/ofnode.h   |  13 +++++
 include/of_live.h     |  10 ++++
 lib/of_live.c         | 122 ++++++++++++++++++++++++++++++++++++++++++
 test/dm/ofnode.c      |  24 +++++++++
 5 files changed, 187 insertions(+)

diff --git a/drivers/core/ofnode.c b/drivers/core/ofnode.c
index fe143f99091..4dc7589c1d2 100644
--- a/drivers/core/ofnode.c
+++ b/drivers/core/ofnode.c
@@ -243,6 +243,24 @@ int oftree_new(oftree *treep)
 
 #endif /* OFNODE_MULTI_TREE */
 
+int oftree_to_fdt(oftree tree, struct abuf *buf)
+{
+	int ret;
+
+	if (of_live_active()) {
+		ret = of_live_flatten(ofnode_to_np(oftree_root(tree)), buf);
+		if (ret)
+			return log_msg_ret("flt", ret);
+	} else {
+		void *fdt = oftree_lookup_fdt(tree);
+
+		abuf_init(buf);
+		abuf_set(buf, fdt, fdt_totalsize(fdt));
+	}
+
+	return 0;
+}
+
 /**
  * ofnode_from_tree_offset() - get an ofnode from a tree offset (flat tree)
  *
diff --git a/include/dm/ofnode.h b/include/dm/ofnode.h
index 8be617b2104..f3ef1bff6db 100644
--- a/include/dm/ofnode.h
+++ b/include/dm/ofnode.h
@@ -17,6 +17,7 @@
 /* Enable checks to protect against invalid calls */
 #undef OF_CHECKS
 
+struct abuf;
 struct resource;
 
 #include <dm/ofnode_decl.h>
@@ -135,6 +136,18 @@ static inline ofnode noffset_to_ofnode(ofnode other_node, int of_offset)
  */
 int oftree_new(oftree *treep);
 
+/**
+ * oftree_to_fdt() - Convert an oftree to a flat FDT
+ *
+ * @tree: tree to flatten (if livetree) or copy (if not)
+ * @buf: Returns inited buffer containing the newly created flat tree. Note
+ * that for flat tree the buffer is not allocated. In either case the caller
+ * must call abut_uninit() to free any memory used by @buf
+ * Return: 0 on success, -ENOMEM if out of memory, other -ve value for any other
+ * error
+ */
+int oftree_to_fdt(oftree tree, struct abuf *buf);
+
 /**
  * ofnode_to_np() - convert an ofnode to a live DT node pointer
  *
diff --git a/include/of_live.h b/include/of_live.h
index 81cb9bd13e2..67bd5f02c74 100644
--- a/include/of_live.h
+++ b/include/of_live.h
@@ -9,6 +9,7 @@
 #ifndef _OF_LIVE_H
 #define _OF_LIVE_H
 
+struct abuf;
 struct device_node;
 
 /**
@@ -54,4 +55,13 @@ void of_live_free(struct device_node *root);
  */
 int of_live_create_empty(struct device_node **rootp);
 
+/**
+ * of_live_flatten() - Create an FDT from a hierarchical tree
+ *
+ * @root: Root node of tree to convert
+ * @buf: Buffer to return the tree (inited by this function)
+ * Return: 0 if OK, -ENOMEM if out of memory
+ */
+int of_live_flatten(const struct device_node *root, struct abuf *buf);
+
 #endif
diff --git a/lib/of_live.c b/lib/of_live.c
index e4eee385547..812c488f606 100644
--- a/lib/of_live.c
+++ b/lib/of_live.c
@@ -8,13 +8,21 @@
  * Copyright (c) 2017 Google, Inc
  */
 
+#define LOG_CATEGORY	LOGC_DT
+
 #include <common.h>
+#include <abuf.h>
 #include <log.h>
 #include <linux/libfdt.h>
 #include <of_live.h>
 #include <malloc.h>
 #include <dm/of_access.h>
 #include <linux/err.h>
+#include <linux/sizes.h>
+
+enum {
+	BUF_STEP	= SZ_64K,
+};
 
 static void *unflatten_dt_alloc(void **mem, unsigned long size,
 				unsigned long align)
@@ -355,3 +363,117 @@ int of_live_create_empty(struct device_node **rootp)
 
 	return 0;
 }
+
+static int check_space(int ret, struct abuf *buf)
+{
+	if (ret == -FDT_ERR_NOSPACE) {
+		if (!abuf_realloc_inc(buf, BUF_STEP))
+			return log_msg_ret("spc", -ENOMEM);
+		ret = fdt_resize(abuf_data(buf), abuf_data(buf),
+				 abuf_size(buf));
+		if (ret)
+			return log_msg_ret("res", -EFAULT);
+
+		return -EAGAIN;
+	}
+
+	return 0;
+}
+
+/**
+ * flatten_node() - Write out the node and its properties into a flat tree
+ */
+static int flatten_node(struct abuf *buf, const struct device_node *node)
+{
+	const struct device_node *np;
+	const struct property *pp;
+	int ret;
+
+	ret = fdt_begin_node(abuf_data(buf), node->name);
+	ret = check_space(ret, buf);
+	if (ret == -EAGAIN) {
+		ret = fdt_begin_node(abuf_data(buf), node->name);
+		if (ret) {
+			log_debug("Internal error a %d\n", ret);
+			return -EFAULT;
+		}
+	}
+	if (ret)
+		return log_msg_ret("beg", ret);
+
+	/* First write out the properties */
+	for (pp = node->properties; !ret && pp; pp = pp->next) {
+		ret = fdt_property(abuf_data(buf), pp->name, pp->value,
+				   pp->length);
+		ret = check_space(ret, buf);
+		if (ret == -EAGAIN) {
+			ret = fdt_property(abuf_data(buf), pp->name, pp->value,
+					   pp->length);
+		}
+	}
+
+	/* Next write out the subnodes */
+	for (np = node->child; np; np = np->sibling) {
+		ret = flatten_node(buf, np);
+		if (ret)
+			return log_msg_ret("sub", ret);
+	}
+
+	ret = fdt_end_node(abuf_data(buf));
+	ret = check_space(ret, buf);
+	if (ret == -EAGAIN) {
+		ret = fdt_end_node(abuf_data(buf));
+		if (ret) {
+			log_debug("Internal error b %d\n", ret);
+			return -EFAULT;
+		}
+	}
+	if (ret)
+		return log_msg_ret("end", ret);
+
+	return 0;
+}
+
+int of_live_flatten(const struct device_node *root, struct abuf *buf)
+{
+	int ret;
+
+	abuf_init(buf);
+	if (!abuf_realloc(buf, BUF_STEP))
+		return log_msg_ret("ini", -ENOMEM);
+
+	ret = fdt_create(abuf_data(buf), abuf_size(buf));
+	if (!ret)
+		ret = fdt_finish_reservemap(abuf_data(buf));
+	if (ret) {
+		log_debug("Failed to start FDT (err=%d)\n", ret);
+		return log_msg_ret("sta", -EINVAL);
+	}
+
+	ret = flatten_node(buf, root);
+	if (ret)
+		return log_msg_ret("flt", ret);
+
+	ret = fdt_finish(abuf_data(buf));
+	ret = check_space(ret, buf);
+	if (ret == -EAGAIN) {
+		ret = fdt_finish(abuf_data(buf));
+		if (ret) {
+			log_debug("Internal error c %d\n", ret);
+			return -EFAULT;
+		}
+	}
+	if (ret)
+		return log_msg_ret("fin", ret);
+
+	ret = fdt_pack(abuf_data(buf));
+	if (ret) {
+		log_debug("Failed to pack (err=%d)\n", ret);
+		return log_msg_ret("pac", -EFAULT);
+	}
+
+	if (!abuf_realloc(buf, fdt_totalsize(abuf_data(buf))))
+		return log_msg_ret("abu", -EFAULT);
+
+	return 0;
+}
diff --git a/test/dm/ofnode.c b/test/dm/ofnode.c
index cb7fc907c82..d2b393750ff 100644
--- a/test/dm/ofnode.c
+++ b/test/dm/ofnode.c
@@ -17,6 +17,7 @@
  */
 
 #include <common.h>
+#include <abuf.h>
 #include <dm.h>
 #include <log.h>
 #include <of_live.h>
@@ -26,6 +27,7 @@
 #include <dm/root.h>
 #include <dm/test.h>
 #include <dm/uclass-internal.h>
+#include <linux/sizes.h>
 #include <test/test.h>
 #include <test/ut.h>
 
@@ -1437,3 +1439,25 @@ static int dm_test_ofnode_delete(struct unit_test_state *uts)
 	return 0;
 }
 DM_TEST(dm_test_ofnode_delete, UT_TESTF_SCAN_FDT);
+
+static int dm_test_oftree_to_fdt(struct unit_test_state *uts)
+{
+	oftree tree, check;
+	struct abuf buf, buf2;
+
+	tree = oftree_default();
+	ut_assertok(oftree_to_fdt(tree, &buf));
+	ut_assert(abuf_size(&buf) > SZ_16K);
+
+	/* convert it back to a tree and see if it looks OK */
+	check = oftree_from_fdt(abuf_data(&buf));
+	ut_assert(oftree_valid(check));
+
+	ut_assertok(oftree_to_fdt(check, &buf2));
+	ut_assert(abuf_size(&buf2) > SZ_16K);
+	ut_asserteq(abuf_size(&buf), abuf_size(&buf2));
+	ut_asserteq_mem(abuf_data(&buf), abuf_data(&buf2), abuf_size(&buf));
+
+	return 0;
+}
+DM_TEST(dm_test_oftree_to_fdt, UT_TESTF_SCAN_FDT);
-- 
2.42.0.rc2.253.gd59a3bf2b4-goog


^ permalink raw reply related	[flat|nested] 86+ messages in thread

* [PATCH 22/32] dm: core: Support writing a boolean
  2023-08-30 18:04 [PATCH 00/32] spl: Preparation for Universal Payload Simon Glass
                   ` (20 preceding siblings ...)
  2023-08-30 18:04 ` [PATCH 21/32] dm: core: Add a way to convert a devicetree to a dtb Simon Glass
@ 2023-08-30 18:04 ` Simon Glass
  2023-08-30 18:04 ` [PATCH 23/32] dm: core: Support writing a 64-bit value Simon Glass
                   ` (9 subsequent siblings)
  31 siblings, 0 replies; 86+ messages in thread
From: Simon Glass @ 2023-08-30 18:04 UTC (permalink / raw)
  To: U-Boot Mailing List; +Cc: Tom Rini, Marek Vasut, Simon Glass, Pavel Herrmann

Add functions to write a boolean property. This involves deleting it if
the value is false.

Add a new ofnode_has_property() as well. Add a comment about the behaviour
of of_read_property() when the property value is empty.

Signed-off-by: Simon Glass <sjg@chromium.org>
---

 drivers/core/ofnode.c | 36 ++++++++++++++++++++++++++++++++++--
 include/dm/ofnode.h   | 32 +++++++++++++++++++++++++++++++-
 test/dm/ofnode.c      | 25 +++++++++++++++++++++++++
 3 files changed, 90 insertions(+), 3 deletions(-)

diff --git a/drivers/core/ofnode.c b/drivers/core/ofnode.c
index 4dc7589c1d2..0229695dba1 100644
--- a/drivers/core/ofnode.c
+++ b/drivers/core/ofnode.c
@@ -491,12 +491,12 @@ u64 ofnode_read_u64_default(ofnode node, const char *propname, u64 def)
 
 bool ofnode_read_bool(ofnode node, const char *propname)
 {
-	const void *prop;
+	bool prop;
 
 	assert(ofnode_valid(node));
 	debug("%s: %s: ", __func__, propname);
 
-	prop = ofnode_get_property(node, propname, NULL);
+	prop = ofnode_has_property(node, propname);
 
 	debug("%s\n", prop ? "true" : "false");
 
@@ -1168,6 +1168,14 @@ const void *ofnode_get_property(ofnode node, const char *propname, int *lenp)
 				   propname, lenp);
 }
 
+bool ofnode_has_property(ofnode node, const char *propname)
+{
+	if (ofnode_is_np(node))
+		return of_find_property(ofnode_to_np(node), propname, NULL);
+	else
+		return ofnode_get_property(node, propname, NULL);
+}
+
 int ofnode_first_property(ofnode node, struct ofprop *prop)
 {
 	prop->node = node;
@@ -1616,6 +1624,30 @@ int ofnode_write_u32(ofnode node, const char *propname, u32 value)
 	return ofnode_write_prop(node, propname, val, sizeof(value), false);
 }
 
+int ofnode_write_bool(ofnode node, const char *propname, bool value)
+{
+	if (value)
+		return ofnode_write_prop(node, propname, NULL, 0, false);
+	else
+		return ofnode_delete_prop(node, propname);
+}
+
+int ofnode_delete_prop(ofnode node, const char *propname)
+{
+	if (ofnode_is_np(node)) {
+		struct property *prop;
+		int len;
+
+		prop = of_find_property(ofnode_to_np(node), propname, &len);
+		if (prop)
+			return of_remove_property(ofnode_to_np(node), prop);
+		return 0;
+	} else {
+		return fdt_delprop(ofnode_to_fdt(node), ofnode_to_offset(node),
+				   propname);
+	}
+}
+
 int ofnode_set_enabled(ofnode node, bool value)
 {
 	assert(ofnode_valid(node));
diff --git a/include/dm/ofnode.h b/include/dm/ofnode.h
index f3ef1bff6db..58c6849534e 100644
--- a/include/dm/ofnode.h
+++ b/include/dm/ofnode.h
@@ -1036,10 +1036,19 @@ int ofnode_decode_panel_timing(ofnode node,
  * @node: node to read
  * @propname: property to read
  * @lenp: place to put length on success
- * Return: pointer to property, or NULL if not found
+ * Return: pointer to property value, or NULL if not found or empty
  */
 const void *ofnode_get_property(ofnode node, const char *propname, int *lenp);
 
+/**
+ * ofnode_has_property() - check if a node has a named property
+ *
+ * @node: node to read
+ * @propname: property to read
+ * Return: true if the property exists in the node, false if not
+ */
+bool ofnode_has_property(ofnode node, const char *propname);
+
 /**
  * ofnode_first_property()- get the reference of the first property
  *
@@ -1451,6 +1460,27 @@ int ofnode_write_string(ofnode node, const char *propname, const char *value);
  */
 int ofnode_write_u32(ofnode node, const char *propname, u32 value);
 
+/**
+ * ofnode_write_bool() - Set a boolean property of an ofnode
+ *
+ * This either adds or deleted a property with a zero-length value
+ *
+ * @node:	The node for whose string property should be set
+ * @propname:	The name of the string property to set
+ * @value:	The new value of the boolean property
+ * Return: 0 if successful, -ve on error
+ */
+int ofnode_write_bool(ofnode node, const char *propname, bool value);
+
+/**
+ * ofnode_delete_prop() - Delete a property
+ *
+ * @node:	Node containing the property to delete
+ * @propname:	Name of property to delete
+ * Return: 0 if successful, -ve on error
+ */
+int ofnode_delete_prop(ofnode node, const char *propname);
+
 /**
  * ofnode_set_enabled() - Enable or disable a device tree node given by its
  *			  ofnode
diff --git a/test/dm/ofnode.c b/test/dm/ofnode.c
index d2b393750ff..af844a50308 100644
--- a/test/dm/ofnode.c
+++ b/test/dm/ofnode.c
@@ -1461,3 +1461,28 @@ static int dm_test_oftree_to_fdt(struct unit_test_state *uts)
 	return 0;
 }
 DM_TEST(dm_test_oftree_to_fdt, UT_TESTF_SCAN_FDT);
+
+/* test ofnode_read_bool() and ofnode_write_bool() */
+static int dm_test_bool(struct unit_test_state *uts)
+{
+	const char *propname = "missing-bool-value";
+	ofnode node;
+
+	node = ofnode_path("/a-test");
+	ut_assert(ofnode_read_bool(node, "bool-value"));
+	ut_assert(!ofnode_read_bool(node, propname));
+	ut_assert(!ofnode_has_property(node, propname));
+
+	ut_assertok(ofnode_write_bool(node, propname, true));
+	ut_assert(ofnode_read_bool(node, propname));
+	ut_assert(ofnode_has_property(node, propname));
+	ut_assert(ofnode_read_bool(node, "bool-value"));
+
+	ut_assertok(ofnode_write_bool(node, propname, false));
+	ut_assert(!ofnode_read_bool(node, propname));
+	ut_assert(!ofnode_has_property(node, propname));
+	ut_assert(ofnode_read_bool(node, "bool-value"));
+
+	return 0;
+}
+DM_TEST(dm_test_bool, UT_TESTF_SCAN_FDT);
-- 
2.42.0.rc2.253.gd59a3bf2b4-goog


^ permalink raw reply related	[flat|nested] 86+ messages in thread

* [PATCH 23/32] dm: core: Support writing a 64-bit value
  2023-08-30 18:04 [PATCH 00/32] spl: Preparation for Universal Payload Simon Glass
                   ` (21 preceding siblings ...)
  2023-08-30 18:04 ` [PATCH 22/32] dm: core: Support writing a boolean Simon Glass
@ 2023-08-30 18:04 ` Simon Glass
  2023-08-30 18:04 ` [PATCH 24/32] dm: core: Add tests for oftree_path() Simon Glass
                   ` (8 subsequent siblings)
  31 siblings, 0 replies; 86+ messages in thread
From: Simon Glass @ 2023-08-30 18:04 UTC (permalink / raw)
  To: U-Boot Mailing List; +Cc: Tom Rini, Marek Vasut, Simon Glass, Pavel Herrmann

Add support for writing a single 64-bit value into a property.

Repurpose the existing tests to handle this case too.

Signed-off-by: Simon Glass <sjg@chromium.org>
---

 drivers/core/ofnode.c | 17 ++++++++++++++++-
 include/dm/ofnode.h   | 10 ++++++++++
 test/dm/ofnode.c      | 15 +++++++++++++--
 3 files changed, 39 insertions(+), 3 deletions(-)

diff --git a/drivers/core/ofnode.c b/drivers/core/ofnode.c
index 0229695dba1..2ef4114cb6f 100644
--- a/drivers/core/ofnode.c
+++ b/drivers/core/ofnode.c
@@ -1621,7 +1621,22 @@ int ofnode_write_u32(ofnode node, const char *propname, u32 value)
 		return -ENOMEM;
 	*val = cpu_to_fdt32(value);
 
-	return ofnode_write_prop(node, propname, val, sizeof(value), false);
+	return ofnode_write_prop(node, propname, val, sizeof(value), true);
+}
+
+int ofnode_write_u64(ofnode node, const char *propname, u64 value)
+{
+	fdt64_t *val;
+
+	assert(ofnode_valid(node));
+
+	log_debug("%s = %llx", propname, (unsigned long long)value);
+	val = malloc(sizeof(*val));
+	if (!val)
+		return -ENOMEM;
+	*val = cpu_to_fdt64(value);
+
+	return ofnode_write_prop(node, propname, val, sizeof(value), true);
 }
 
 int ofnode_write_bool(ofnode node, const char *propname, bool value)
diff --git a/include/dm/ofnode.h b/include/dm/ofnode.h
index 58c6849534e..726d8f82ddf 100644
--- a/include/dm/ofnode.h
+++ b/include/dm/ofnode.h
@@ -1460,6 +1460,16 @@ int ofnode_write_string(ofnode node, const char *propname, const char *value);
  */
 int ofnode_write_u32(ofnode node, const char *propname, u32 value);
 
+/**
+ * ofnode_write_u64() - Set an integer property of an ofnode
+ *
+ * @node:	The node for whose string property should be set
+ * @propname:	The name of the string property to set
+ * @value:	The new value of the 64-bit integer property
+ * Return: 0 if successful, -ve on error
+ */
+int ofnode_write_u64(ofnode node, const char *propname, u64 value);
+
 /**
  * ofnode_write_bool() - Set a boolean property of an ofnode
  *
diff --git a/test/dm/ofnode.c b/test/dm/ofnode.c
index af844a50308..5e63efdfa89 100644
--- a/test/dm/ofnode.c
+++ b/test/dm/ofnode.c
@@ -990,7 +990,8 @@ static int dm_test_ofnode_u32_array(struct unit_test_state *uts)
 }
 DM_TEST(dm_test_ofnode_u32_array, UT_TESTF_SCAN_PDATA | UT_TESTF_SCAN_FDT);
 
-static int dm_test_ofnode_read_u64(struct unit_test_state *uts)
+/* test ofnode_read_u64() and ofnode_write_u64() */
+static int dm_test_ofnode_u64(struct unit_test_state *uts)
 {
 	ofnode node;
 	u64 val;
@@ -999,6 +1000,10 @@ static int dm_test_ofnode_read_u64(struct unit_test_state *uts)
 	ut_assert(ofnode_valid(node));
 	ut_assertok(ofnode_read_u64(node, "int64-value", &val));
 	ut_asserteq_64(0x1111222233334444, val);
+	ut_assertok(ofnode_write_u64(node, "new-int64-value", 0x9876543210));
+	ut_assertok(ofnode_read_u64(node, "new-int64-value", &val));
+	ut_asserteq_64(0x9876543210, val);
+
 	ut_asserteq(-EINVAL, ofnode_read_u64(node, "missing", &val));
 
 	ut_assertok(ofnode_read_u64_index(node, "int64-array", 0, &val));
@@ -1009,9 +1014,15 @@ static int dm_test_ofnode_read_u64(struct unit_test_state *uts)
 		    ofnode_read_u64_index(node, "int64-array", 2, &val));
 	ut_asserteq(-EINVAL, ofnode_read_u64_index(node, "missing", 0, &val));
 
+	ut_assertok(ofnode_write_u64(node, "int64-array", 0x9876543210));
+	ut_assertok(ofnode_read_u64_index(node, "int64-array", 0, &val));
+	ut_asserteq_64(0x9876543210, val);
+	ut_asserteq(-EOVERFLOW,
+		    ofnode_read_u64_index(node, "int64-array", 1, &val));
+
 	return 0;
 }
-DM_TEST(dm_test_ofnode_read_u64, UT_TESTF_SCAN_FDT);
+DM_TEST(dm_test_ofnode_u64, UT_TESTF_SCAN_FDT);
 
 static int dm_test_ofnode_add_subnode(struct unit_test_state *uts)
 {
-- 
2.42.0.rc2.253.gd59a3bf2b4-goog


^ permalink raw reply related	[flat|nested] 86+ messages in thread

* [PATCH 24/32] dm: core: Add tests for oftree_path()
  2023-08-30 18:04 [PATCH 00/32] spl: Preparation for Universal Payload Simon Glass
                   ` (22 preceding siblings ...)
  2023-08-30 18:04 ` [PATCH 23/32] dm: core: Support writing a 64-bit value Simon Glass
@ 2023-08-30 18:04 ` Simon Glass
  2023-08-30 18:04 ` [PATCH 25/32] sandbox: Move reading the RAM buffer into a better place Simon Glass
                   ` (7 subsequent siblings)
  31 siblings, 0 replies; 86+ messages in thread
From: Simon Glass @ 2023-08-30 18:04 UTC (permalink / raw)
  To: U-Boot Mailing List; +Cc: Tom Rini, Marek Vasut, Simon Glass, Pavel Herrmann

Add a few simple tests for getting the root node, since this is handled
as a special case in the implementation.

Signed-off-by: Simon Glass <sjg@chromium.org>
---

 test/dm/ofnode.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/test/dm/ofnode.c b/test/dm/ofnode.c
index 5e63efdfa89..af3aa1e2ec5 100644
--- a/test/dm/ofnode.c
+++ b/test/dm/ofnode.c
@@ -228,6 +228,9 @@ static int dm_test_ofnode_read(struct unit_test_state *uts)
 	ofnode node;
 	int size;
 
+	node = oftree_path(oftree_default(), "/");
+	ut_assert(ofnode_valid(node));
+
 	node = ofnode_path("/a-test");
 	ut_assert(ofnode_valid(node));
 
@@ -256,6 +259,9 @@ static int dm_test_ofnode_read_ot(struct unit_test_state *uts)
 	ofnode node;
 	int size;
 
+	node = oftree_path(otree, "/");
+	ut_assert(ofnode_valid(node));
+
 	node = oftree_path(otree, "/node/subnode");
 	ut_assert(ofnode_valid(node));
 
-- 
2.42.0.rc2.253.gd59a3bf2b4-goog


^ permalink raw reply related	[flat|nested] 86+ messages in thread

* [PATCH 25/32] sandbox: Move reading the RAM buffer into a better place
  2023-08-30 18:04 [PATCH 00/32] spl: Preparation for Universal Payload Simon Glass
                   ` (23 preceding siblings ...)
  2023-08-30 18:04 ` [PATCH 24/32] dm: core: Add tests for oftree_path() Simon Glass
@ 2023-08-30 18:04 ` Simon Glass
  2023-08-30 18:04 ` [PATCH 26/32] sandbox: Init the EC properly even if no state file is available Simon Glass
                   ` (6 subsequent siblings)
  31 siblings, 0 replies; 86+ messages in thread
From: Simon Glass @ 2023-08-30 18:04 UTC (permalink / raw)
  To: U-Boot Mailing List
  Cc: Tom Rini, Marek Vasut, Simon Glass, Heinrich Schuchardt, Pavel Skripkin

This should not happen in the argument-parsing function. Move it to the
main program.

Add some debugging for reading/writing.

Signed-off-by: Simon Glass <sjg@chromium.org>
---

 arch/sandbox/cpu/start.c | 19 +++++++++++--------
 arch/sandbox/cpu/state.c |  1 +
 2 files changed, 12 insertions(+), 8 deletions(-)

diff --git a/arch/sandbox/cpu/start.c b/arch/sandbox/cpu/start.c
index 234652872ec..d4c4d071aef 100644
--- a/arch/sandbox/cpu/start.c
+++ b/arch/sandbox/cpu/start.c
@@ -277,17 +277,9 @@ SANDBOX_CMDLINE_OPT_SHORT(program, 'p', 1, "U-Boot program name");
 static int sandbox_cmdline_cb_memory(struct sandbox_state *state,
 				     const char *arg)
 {
-	int err;
-
 	/* For now assume we always want to write it */
 	state->write_ram_buf = true;
 	state->ram_buf_fname = arg;
-
-	err = os_read_ram_buf(arg);
-	if (err) {
-		printf("Failed to read RAM buffer '%s': %d\n", arg, err);
-		return err;
-	}
 	state->ram_buf_read = true;
 
 	return 0;
@@ -517,6 +509,17 @@ int sandbox_main(int argc, char *argv[])
 	if (os_parse_args(state, argc, argv))
 		return 1;
 
+	if (state->ram_buf_fname) {
+		ret = os_read_ram_buf(state->ram_buf_fname);
+		if (ret) {
+			printf("Failed to read RAM buffer '%s': %d\n",
+			       state->ram_buf_fname, ret);
+		} else {
+			state->ram_buf_read = true;
+			log_debug("Read RAM buffer from '%s'\n", state->ram_buf_fname);
+		}
+	}
+
 	/* Remove old memory file if required */
 	if (state->ram_buf_rm && state->ram_buf_fname) {
 		os_unlink(state->ram_buf_fname);
diff --git a/arch/sandbox/cpu/state.c b/arch/sandbox/cpu/state.c
index d67834988fd..fcc0028ff4a 100644
--- a/arch/sandbox/cpu/state.c
+++ b/arch/sandbox/cpu/state.c
@@ -513,6 +513,7 @@ int state_uninit(void)
 			printf("Failed to write RAM buffer\n");
 			return err;
 		}
+		log_debug("Wrote RAM to file '%s'\n", state->ram_buf_fname);
 	}
 
 	if (state->write_state) {
-- 
2.42.0.rc2.253.gd59a3bf2b4-goog


^ permalink raw reply related	[flat|nested] 86+ messages in thread

* [PATCH 26/32] sandbox: Init the EC properly even if no state file is available
  2023-08-30 18:04 [PATCH 00/32] spl: Preparation for Universal Payload Simon Glass
                   ` (24 preceding siblings ...)
  2023-08-30 18:04 ` [PATCH 25/32] sandbox: Move reading the RAM buffer into a better place Simon Glass
@ 2023-08-30 18:04 ` Simon Glass
  2023-08-30 18:04 ` [PATCH 27/32] sandbox: Only read the state if we have a state file Simon Glass
                   ` (5 subsequent siblings)
  31 siblings, 0 replies; 86+ messages in thread
From: Simon Glass @ 2023-08-30 18:04 UTC (permalink / raw)
  To: U-Boot Mailing List; +Cc: Tom Rini, Marek Vasut, Simon Glass

This currently relies on sandbox attempting to read a state file. At
present it always does, even when there is no state file, in which case it
fails, but still inits the EC.

That is a bug, so update this driver to set the current image always, even
if no state is read.

Signed-off-by: Simon Glass <sjg@chromium.org>
---

 drivers/misc/cros_ec_sandbox.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/drivers/misc/cros_ec_sandbox.c b/drivers/misc/cros_ec_sandbox.c
index 8dbe0b188a4..1201535f4af 100644
--- a/drivers/misc/cros_ec_sandbox.c
+++ b/drivers/misc/cros_ec_sandbox.c
@@ -81,6 +81,7 @@ struct ec_pwm_channel {
 /**
  * struct ec_state - Information about the EC state
  *
+ * @valid: true if this struct contains valid state data
  * @vbnv_context: Vboot context data stored by EC
  * @ec_config: FDT config information about the EC (e.g. flashmap)
  * @flash_data: Contents of flash memory
@@ -95,6 +96,7 @@ struct ec_pwm_channel {
  * @pwm: Information per PWM channel
  */
 struct ec_state {
+	bool valid;
 	u8 vbnv_context[EC_VBNV_BLOCK_SIZE_V2];
 	struct fdt_cros_ec ec_config;
 	uint8_t *flash_data;
@@ -145,6 +147,7 @@ static int cros_ec_read_state(const void *blob, int node)
 		memcpy(ec->flash_data, prop, len);
 		debug("%s: Loaded EC flash data size %#x\n", __func__, len);
 	}
+	ec->valid = true;
 
 	return 0;
 }
@@ -589,6 +592,7 @@ static int process_cmd(struct ec_state *ec,
 		printf("   ** Unknown EC command %#02x\n", req_hdr->command);
 		return -1;
 	}
+	debug(" - EC command %#0x, result %d\n", req_hdr->command, len);
 
 	return len;
 }
@@ -675,7 +679,10 @@ int cros_ec_probe(struct udevice *dev)
 	ofnode node;
 	int err;
 
-	memcpy(ec, &s_state, sizeof(*ec));
+	if (s_state.valid)
+		memcpy(ec, &s_state, sizeof(*ec));
+	else
+		ec->current_image = EC_IMAGE_RO;
 	err = cros_ec_decode_ec_flash(dev, &ec->ec_config);
 	if (err) {
 		debug("%s: Cannot device EC flash\n", __func__);
-- 
2.42.0.rc2.253.gd59a3bf2b4-goog


^ permalink raw reply related	[flat|nested] 86+ messages in thread

* [PATCH 27/32] sandbox: Only read the state if we have a state file
  2023-08-30 18:04 [PATCH 00/32] spl: Preparation for Universal Payload Simon Glass
                   ` (25 preceding siblings ...)
  2023-08-30 18:04 ` [PATCH 26/32] sandbox: Init the EC properly even if no state file is available Simon Glass
@ 2023-08-30 18:04 ` Simon Glass
  2023-08-30 18:04 ` [PATCH 28/32] sandbox: Move the bloblist down a little in memory Simon Glass
                   ` (4 subsequent siblings)
  31 siblings, 0 replies; 86+ messages in thread
From: Simon Glass @ 2023-08-30 18:04 UTC (permalink / raw)
  To: U-Boot Mailing List
  Cc: Tom Rini, Marek Vasut, Simon Glass, Heinrich Schuchardt, Pavel Skripkin

We should not read this unless requested. Make it conditional on the
option being provided.

Add some debugging to show the state being written.

Signed-off-by: Simon Glass <sjg@chromium.org>
---

 arch/sandbox/cpu/start.c | 8 +++++---
 arch/sandbox/cpu/state.c | 1 +
 2 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/arch/sandbox/cpu/start.c b/arch/sandbox/cpu/start.c
index d4c4d071aef..5a70ec9ecb1 100644
--- a/arch/sandbox/cpu/start.c
+++ b/arch/sandbox/cpu/start.c
@@ -527,9 +527,11 @@ int sandbox_main(int argc, char *argv[])
 		state->ram_buf_fname = NULL;
 	}
 
-	ret = sandbox_read_state(state, state->state_fname);
-	if (ret)
-		goto err;
+	if (state->read_state && state->state_fname) {
+		ret = sandbox_read_state(state, state->state_fname);
+		if (ret)
+			goto err;
+	}
 
 	if (state->handle_signals) {
 		ret = os_setup_signal_handlers();
diff --git a/arch/sandbox/cpu/state.c b/arch/sandbox/cpu/state.c
index fcc0028ff4a..e38bb248b7f 100644
--- a/arch/sandbox/cpu/state.c
+++ b/arch/sandbox/cpu/state.c
@@ -521,6 +521,7 @@ int state_uninit(void)
 			printf("Failed to write sandbox state\n");
 			return -1;
 		}
+		log_debug("Wrote state to file '%s'\n", state->ram_buf_fname);
 	}
 
 	/* Delete this at the last moment so as not to upset gdb too much */
-- 
2.42.0.rc2.253.gd59a3bf2b4-goog


^ permalink raw reply related	[flat|nested] 86+ messages in thread

* [PATCH 28/32] sandbox: Move the bloblist down a little in memory
  2023-08-30 18:04 [PATCH 00/32] spl: Preparation for Universal Payload Simon Glass
                   ` (26 preceding siblings ...)
  2023-08-30 18:04 ` [PATCH 27/32] sandbox: Only read the state if we have a state file Simon Glass
@ 2023-08-30 18:04 ` Simon Glass
  2023-08-30 18:05 ` [PATCH 29/32] bloblist: Support initing from multiple places Simon Glass
                   ` (3 subsequent siblings)
  31 siblings, 0 replies; 86+ messages in thread
From: Simon Glass @ 2023-08-30 18:04 UTC (permalink / raw)
  To: U-Boot Mailing List
  Cc: Tom Rini, Marek Vasut, Simon Glass, Abdellatif El Khlifi,
	Corentin Guillevic, Heinrich Schuchardt, Nikhil M Jain,
	Patrick Delaunay, Rasmus Villemoes, Stefan Roese

Move this down by 4KB so that it is large enough to hold the devicetree.

Also fix up the devicetree address in the documetation while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>
---

 common/Kconfig               | 2 +-
 doc/arch/sandbox/sandbox.rst | 4 ++--
 test/lib/kconfig.c           | 4 ++--
 3 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/common/Kconfig b/common/Kconfig
index 0b09bd68bd1..7f8ccc2ed85 100644
--- a/common/Kconfig
+++ b/common/Kconfig
@@ -1011,7 +1011,7 @@ endchoice
 
 config BLOBLIST_ADDR
 	hex "Address of bloblist"
-	default 0xc000 if SANDBOX
+	default 0xb000 if SANDBOX
 	depends on BLOBLIST_FIXED
 	help
 	  Sets the address of the bloblist, set up by the first part of U-Boot
diff --git a/doc/arch/sandbox/sandbox.rst b/doc/arch/sandbox/sandbox.rst
index a3631de7493..23902dee89e 100644
--- a/doc/arch/sandbox/sandbox.rst
+++ b/doc/arch/sandbox/sandbox.rst
@@ -614,8 +614,8 @@ that are mapped into that memory:
 =======   ========================   ===============================
 Addr      Config                     Usage
 =======   ========================   ===============================
-      0   CONFIG_SYS_FDT_LOAD_ADDR   Device tree
-   c000   CONFIG_BLOBLIST_ADDR       Blob list
+    100   CONFIG_SYS_FDT_LOAD_ADDR   Device tree
+   b000   CONFIG_BLOBLIST_ADDR       Blob list
   10000   CFG_MALLOC_F_ADDR          Early memory allocation
   f0000   CONFIG_PRE_CON_BUF_ADDR    Pre-console buffer
  100000   CONFIG_TRACE_EARLY_ADDR    Early trace buffer (if enabled). Also used
diff --git a/test/lib/kconfig.c b/test/lib/kconfig.c
index 76225ba8ffa..3914f699659 100644
--- a/test/lib/kconfig.c
+++ b/test/lib/kconfig.c
@@ -22,9 +22,9 @@ static int lib_test_is_enabled(struct unit_test_state *uts)
 	ut_asserteq(0, CONFIG_IS_ENABLED(OF_PLATDATA));
 	ut_asserteq(0, CONFIG_IS_ENABLED(_UNDEFINED));
 
-	ut_asserteq(0xc000,
+	ut_asserteq(0xb000,
 		    IF_ENABLED_INT(CONFIG_BLOBLIST_FIXED, CONFIG_BLOBLIST_ADDR));
-	ut_asserteq(0xc000,
+	ut_asserteq(0xb000,
 		    CONFIG_IF_ENABLED_INT(BLOBLIST_FIXED, BLOBLIST_ADDR));
 
 	/*
-- 
2.42.0.rc2.253.gd59a3bf2b4-goog


^ permalink raw reply related	[flat|nested] 86+ messages in thread

* [PATCH 29/32] bloblist: Support initing from multiple places
  2023-08-30 18:04 [PATCH 00/32] spl: Preparation for Universal Payload Simon Glass
                   ` (27 preceding siblings ...)
  2023-08-30 18:04 ` [PATCH 28/32] sandbox: Move the bloblist down a little in memory Simon Glass
@ 2023-08-30 18:05 ` Simon Glass
  2023-08-30 18:05 ` [PATCH 30/32] fdt: Allow the devicetree to come from a bloblist Simon Glass
                   ` (2 subsequent siblings)
  31 siblings, 0 replies; 86+ messages in thread
From: Simon Glass @ 2023-08-30 18:05 UTC (permalink / raw)
  To: U-Boot Mailing List
  Cc: Tom Rini, Marek Vasut, Simon Glass, Bin Meng,
	Heinrich Schuchardt, Michal Suchanek, Nikhil M Jain,
	Ovidiu Panait, Rasmus Villemoes, Shiji Yang, Stefan Roese

Typically the bloblist is set up after the devicetree is present. This
makes sense because bloblist may use malloc() to allocate the space it
needs.

However sometimes the devicetree itself may be present in the bloblist.
In that case it is at a known location in memory so we can init the
bloblist very early, before devicetree.

Add a flag to indicate whether the bloblist has been inited. Add a
function to init it only if needed. Use that in the init sequence.

Signed-off-by: Simon Glass <sjg@chromium.org>
---

 common/bloblist.c                 | 13 ++++++++++++-
 common/board_f.c                  |  4 +---
 include/asm-generic/global_data.h |  4 ++++
 include/bloblist.h                | 18 ++++++++++++++++++
 4 files changed, 35 insertions(+), 4 deletions(-)

diff --git a/common/bloblist.c b/common/bloblist.c
index 2144b10e1d0..6f2a4577708 100644
--- a/common/bloblist.c
+++ b/common/bloblist.c
@@ -476,6 +476,17 @@ int bloblist_init(void)
 		log_debug("Found existing bloblist size %lx at %lx\n", size,
 			  addr);
 	}
+	if (ret)
+		return log_msg_ret("ini", ret);
+	gd->flags |= GD_FLG_BLOBLIST_READY;
+
+	return 0;
+}
 
-	return ret;
+int bloblist_maybe_init(void)
+{
+	if (CONFIG_IS_ENABLED(BLOBLIST) && !(gd->flags & GD_FLG_BLOBLIST_READY))
+		return bloblist_init();
+
+	return 0;
 }
diff --git a/common/board_f.c b/common/board_f.c
index 2f986d9b289..76ae415487d 100644
--- a/common/board_f.c
+++ b/common/board_f.c
@@ -853,9 +853,7 @@ static const init_fnc_t init_sequence_f[] = {
 	log_init,
 	initf_bootstage,	/* uses its own timer, so does not need DM */
 	event_init,
-#ifdef CONFIG_BLOBLIST
-	bloblist_init,
-#endif
+	bloblist_maybe_init,
 	setup_spl_handoff,
 #if defined(CONFIG_CONSOLE_RECORD_INIT_F)
 	console_record_init,
diff --git a/include/asm-generic/global_data.h b/include/asm-generic/global_data.h
index edf9ff6823f..b0485f3dd2a 100644
--- a/include/asm-generic/global_data.h
+++ b/include/asm-generic/global_data.h
@@ -674,6 +674,10 @@ enum gd_flags {
 	 * @GD_FLG_OF_TAG_MIGRATE: Device tree has old u-boot,dm- tags
 	 */
 	GD_FLG_OF_TAG_MIGRATE = 0x200000,
+	/**
+	 * @GD_FLG_BLOBLIST_READY: bloblist is ready for use
+	 */
+	GD_FLG_BLOBLIST_READY = 0x400000,
 };
 
 #endif /* __ASSEMBLY__ */
diff --git a/include/bloblist.h b/include/bloblist.h
index 7ea72c6bd46..080cc46a126 100644
--- a/include/bloblist.h
+++ b/include/bloblist.h
@@ -413,8 +413,26 @@ void bloblist_reloc(void *to, uint to_size, void *from, uint from_size);
  * standard passage. The size is detected automatically so CONFIG_BLOBLIST_SIZE
  * can be 0.
  *
+ * Sets GD_FLG_BLOBLIST_READY in global_data flags on success
+ *
  * Return: 0 if OK, -ve on error
  */
 int bloblist_init(void);
 
+#if CONFIG_IS_ENABLED(BLOBLIST)
+/**
+ * bloblist_maybe_init() - Init the bloblist system if not already done
+ *
+ * Calls bloblist_init() if the GD_FLG_BLOBLIST_READY flag is not et
+ *
+ * Return: 0 if OK, -ve on error
+ */
+int bloblist_maybe_init(void);
+#else
+static inline int bloblist_maybe_init(void)
+{
+	return 0;
+}
+#endif /* BLOBLIST */
+
 #endif /* __BLOBLIST_H */
-- 
2.42.0.rc2.253.gd59a3bf2b4-goog


^ permalink raw reply related	[flat|nested] 86+ messages in thread

* [PATCH 30/32] fdt: Allow the devicetree to come from a bloblist
  2023-08-30 18:04 [PATCH 00/32] spl: Preparation for Universal Payload Simon Glass
                   ` (28 preceding siblings ...)
  2023-08-30 18:05 ` [PATCH 29/32] bloblist: Support initing from multiple places Simon Glass
@ 2023-08-30 18:05 ` Simon Glass
  2023-08-31  7:06   ` Ilias Apalodimas
  2023-08-30 18:05 ` [PATCH 31/32] command: Include a required header in command.h Simon Glass
  2023-08-30 18:05 ` [PATCH 32/32] pci: serial: Support reading PCI-register size with base Simon Glass
  31 siblings, 1 reply; 86+ messages in thread
From: Simon Glass @ 2023-08-30 18:05 UTC (permalink / raw)
  To: U-Boot Mailing List
  Cc: Tom Rini, Marek Vasut, Simon Glass, Baruch Siach, Bin Meng,
	Heinrich Schuchardt, Ilias Apalodimas, Jerry Van Baren,
	Michal Simek, Nikhil M Jain, Qu Wenruo, Stefan Roese

Standard passage provides for a bloblist to be passed from one firmware
phase to the next. That can be used to pass the devicetree along as well.
Add an option to support this.

Tests for this will be added as part of the Universal Payload work.

Signed-off-by: Simon Glass <sjg@chromium.org>
---

 common/bloblist.c                  |  2 ++
 doc/develop/devicetree/control.rst |  3 ++
 dts/Kconfig                        |  8 ++++++
 include/bloblist.h                 |  5 ++++
 include/fdtdec.h                   |  3 +-
 lib/fdtdec.c                       | 44 ++++++++++++++++++++++--------
 6 files changed, 52 insertions(+), 13 deletions(-)

diff --git a/common/bloblist.c b/common/bloblist.c
index 6f2a4577708..b07ede11cfe 100644
--- a/common/bloblist.c
+++ b/common/bloblist.c
@@ -48,9 +48,11 @@ static struct tag_name {
 	{ BLOBLISTT_ACPI_TABLES, "ACPI tables for x86" },
 	{ BLOBLISTT_SMBIOS_TABLES, "SMBIOS tables for x86" },
 	{ BLOBLISTT_VBOOT_CTX, "Chrome OS vboot context" },
+	{ BLOBLISTT_CONTROL_FDT, "Control FDT" },
 
 	/* BLOBLISTT_PROJECT_AREA */
 	{ BLOBLISTT_U_BOOT_SPL_HANDOFF, "SPL hand-off" },
+	{ BLOBLISTT_VBE, "VBE" },
 	{ BLOBLISTT_U_BOOT_VIDEO, "SPL video handoff" },
 
 	/* BLOBLISTT_VENDOR_AREA */
diff --git a/doc/develop/devicetree/control.rst b/doc/develop/devicetree/control.rst
index cbb65c9b177..56e00090166 100644
--- a/doc/develop/devicetree/control.rst
+++ b/doc/develop/devicetree/control.rst
@@ -108,6 +108,9 @@ If CONFIG_OF_BOARD is defined, a board-specific routine will provide the
 devicetree at runtime, for example if an earlier bootloader stage creates
 it and passes it to U-Boot.
 
+If CONFIG_OF_BLOBLIST is defined, the devicetree comes from a bloblist passed
+from a previous stage.
+
 If CONFIG_SANDBOX is defined, then it will be read from a file on
 startup. Use the -d flag to U-Boot to specify the file to read, -D for the
 default and -T for the test devicetree, used to run sandbox unit tests.
diff --git a/dts/Kconfig b/dts/Kconfig
index 9152f5885e9..6c1edbddb57 100644
--- a/dts/Kconfig
+++ b/dts/Kconfig
@@ -105,6 +105,14 @@ config OF_EMBED
 
 endchoice
 
+config OF_BLOBLIST
+	bool "DTB is provided by a bloblist"
+	help
+	  Select this to read the devicetree from the bloblist. This allows
+	  using a bloblist to transfer the devicetree between  U-Boot phases.
+	  The devicetree is stored in the bloblist by an early phase so that
+	  U-Boot can read it.
+
 config OF_BOARD
 	bool "Provided by the board (e.g a previous loader) at runtime"
 	default y if SANDBOX || OF_HAS_PRIOR_STAGE
diff --git a/include/bloblist.h b/include/bloblist.h
index 080cc46a126..e16d122f4fb 100644
--- a/include/bloblist.h
+++ b/include/bloblist.h
@@ -103,6 +103,11 @@ enum bloblist_tag_t {
 	BLOBLISTT_ACPI_TABLES = 0x104,	/* ACPI tables for x86 */
 	BLOBLISTT_SMBIOS_TABLES = 0x105, /* SMBIOS tables for x86 */
 	BLOBLISTT_VBOOT_CTX = 0x106,	/* Chromium OS verified boot context */
+	/*
+	 * Devicetree for use by firmware. On some platforms this is passed to
+	 * the OS also
+	 */
+	BLOBLISTT_CONTROL_FDT = 0x107,
 
 	/*
 	 * Project-specific tags are permitted here. Projects can be open source
diff --git a/include/fdtdec.h b/include/fdtdec.h
index bd1149f46d0..1888c464561 100644
--- a/include/fdtdec.h
+++ b/include/fdtdec.h
@@ -72,7 +72,7 @@ struct bd_info;
  *	U-Boot is packaged as an ELF file, e.g. for debugging purposes
  * @FDTSRC_ENV: Provided by the fdtcontroladdr environment variable. This should
  *	be used for debugging/development only
- * @FDTSRC_NONE: No devicetree at all
+ * @FDTSRC_BLOBLIST: Provided by a bloblist from an earlier phase
  */
 enum fdt_source_t {
 	FDTSRC_SEPARATE,
@@ -80,6 +80,7 @@ enum fdt_source_t {
 	FDTSRC_BOARD,
 	FDTSRC_EMBED,
 	FDTSRC_ENV,
+	FDTSRC_BLOBLIST,
 };
 
 /*
diff --git a/lib/fdtdec.c b/lib/fdtdec.c
index 7a691676483..bd88e6a418e 100644
--- a/lib/fdtdec.c
+++ b/lib/fdtdec.c
@@ -7,7 +7,11 @@
  */
 
 #ifndef USE_HOSTCC
+
+#define LOG_CATEGORY	LOGC_DT
+
 #include <common.h>
+#include <bloblist.h>
 #include <boot_fit.h>
 #include <display_options.h>
 #include <dm.h>
@@ -87,6 +91,7 @@ static const char *const fdt_src_name[] = {
 	[FDTSRC_BOARD] = "board",
 	[FDTSRC_EMBED] = "embed",
 	[FDTSRC_ENV] = "env",
+	[FDTSRC_BLOBLIST] = "bloblist",
 };
 
 const char *fdtdec_get_srcname(void)
@@ -1666,20 +1671,35 @@ int fdtdec_setup(void)
 	int ret;
 
 	/* The devicetree is typically appended to U-Boot */
-	if (IS_ENABLED(CONFIG_OF_SEPARATE)) {
-		gd->fdt_blob = fdt_find_separate();
-		gd->fdt_src = FDTSRC_SEPARATE;
-	} else { /* embed dtb in ELF file for testing / development */
-		gd->fdt_blob = dtb_dt_embedded();
-		gd->fdt_src = FDTSRC_EMBED;
-	}
-
-	/* Allow the board to override the fdt address. */
-	if (IS_ENABLED(CONFIG_OF_BOARD)) {
-		gd->fdt_blob = board_fdt_blob_setup(&ret);
+	if (CONFIG_IS_ENABLED(OF_BLOBLIST)) {
+		ret = bloblist_maybe_init();
 		if (ret)
 			return ret;
-		gd->fdt_src = FDTSRC_BOARD;
+		gd->fdt_blob = bloblist_find(BLOBLISTT_CONTROL_FDT, 0);
+		if (!gd->fdt_blob) {
+			printf("Not FDT found in bloblist\n");
+			bloblist_show_list();
+			return -ENOENT;
+		}
+		gd->fdt_src = FDTSRC_BLOBLIST;
+		bloblist_show_list();
+		log_debug("Devicetree is in bloblist at %p\n", gd->fdt_blob);
+	} else {
+		if (IS_ENABLED(CONFIG_OF_SEPARATE)) {
+			gd->fdt_blob = fdt_find_separate();
+			gd->fdt_src = FDTSRC_SEPARATE;
+		} else { /* embed dtb in ELF file for testing / development */
+			gd->fdt_blob = dtb_dt_embedded();
+			gd->fdt_src = FDTSRC_EMBED;
+		}
+
+		/* Allow the board to override the fdt address. */
+		if (IS_ENABLED(CONFIG_OF_BOARD)) {
+			gd->fdt_blob = board_fdt_blob_setup(&ret);
+			if (ret)
+				return ret;
+			gd->fdt_src = FDTSRC_BOARD;
+		}
 	}
 
 	/* Allow the early environment to override the fdt address */
-- 
2.42.0.rc2.253.gd59a3bf2b4-goog


^ permalink raw reply related	[flat|nested] 86+ messages in thread

* [PATCH 31/32] command: Include a required header in command.h
  2023-08-30 18:04 [PATCH 00/32] spl: Preparation for Universal Payload Simon Glass
                   ` (29 preceding siblings ...)
  2023-08-30 18:05 ` [PATCH 30/32] fdt: Allow the devicetree to come from a bloblist Simon Glass
@ 2023-08-30 18:05 ` Simon Glass
  2023-08-30 18:05 ` [PATCH 32/32] pci: serial: Support reading PCI-register size with base Simon Glass
  31 siblings, 0 replies; 86+ messages in thread
From: Simon Glass @ 2023-08-30 18:05 UTC (permalink / raw)
  To: U-Boot Mailing List; +Cc: Tom Rini, Marek Vasut, Simon Glass, Evgeny Bachinin

This uses ARRAY_SIZE() but does not include the header file which declares
it. Fix this, so that command.h can be included without common.h

Signed-off-by: Simon Glass <sjg@chromium.org>
---

 include/command.h | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/include/command.h b/include/command.h
index c4e3170967d..7a0ab8c90b1 100644
--- a/include/command.h
+++ b/include/command.h
@@ -15,6 +15,9 @@
 
 #include <linux/compiler_attributes.h>
 
+/* For ARRAY_SIZE() */
+#include <linux/kernel.h>
+
 #ifndef NULL
 #define NULL	0
 #endif
-- 
2.42.0.rc2.253.gd59a3bf2b4-goog


^ permalink raw reply related	[flat|nested] 86+ messages in thread

* [PATCH 32/32] pci: serial: Support reading PCI-register size with base
  2023-08-30 18:04 [PATCH 00/32] spl: Preparation for Universal Payload Simon Glass
                   ` (30 preceding siblings ...)
  2023-08-30 18:05 ` [PATCH 31/32] command: Include a required header in command.h Simon Glass
@ 2023-08-30 18:05 ` Simon Glass
  2023-08-30 18:14   ` Pali Rohár
  31 siblings, 1 reply; 86+ messages in thread
From: Simon Glass @ 2023-08-30 18:05 UTC (permalink / raw)
  To: U-Boot Mailing List
  Cc: Tom Rini, Marek Vasut, Simon Glass, Abdellatif El Khlifi,
	Andre Przywara, Bin Meng, Chunfeng Yun, Dzmitry Sankouski,
	GSS_MTK_Uboot_upstream, Heinrich Schuchardt, Ilias Apalodimas,
	Michal Simek, Michal Suchanek, Nikhil M Jain, Pali Rohár,
	Ryder Lee, Stefan Roese, Weijie Gao

The PCI helpers read only the base address for a PCI region. In some cases
the size is needed as well, e.g. to pass along to a driver which needs to
know the size of its register area.

Update the functions to allow the size to be returned. For serial, record
the information and provided it with the serial_info() call.

A limitation still exists in that the size is not available when OF_LIVE
is enabled, so take account of that in the tests.

Signed-off-by: Simon Glass <sjg@chromium.org>
---

 arch/sandbox/dts/test.dts   |  6 +++---
 drivers/core/fdtaddr.c      |  6 +++---
 drivers/core/ofnode.c       | 11 ++++++++---
 drivers/core/read.c         |  6 ++++--
 drivers/core/util.c         |  2 +-
 drivers/pci/pci-uclass.c    |  2 +-
 drivers/pci/pci_mvebu.c     |  3 ++-
 drivers/pci/pci_tegra.c     |  2 +-
 drivers/pci/pcie_mediatek.c |  4 ++--
 drivers/serial/ns16550.c    | 15 ++++++++++-----
 include/dm/fdtaddr.h        |  3 ++-
 include/dm/ofnode.h         |  4 +++-
 include/dm/read.h           |  8 +++++---
 include/ns16550.h           |  4 +++-
 include/serial.h            |  2 ++
 test/dm/pci.c               | 14 ++++++++++----
 16 files changed, 60 insertions(+), 32 deletions(-)

diff --git a/arch/sandbox/dts/test.dts b/arch/sandbox/dts/test.dts
index a413cbe4989..961e8895a49 100644
--- a/arch/sandbox/dts/test.dts
+++ b/arch/sandbox/dts/test.dts
@@ -1087,8 +1087,8 @@
 		pci@1,0 {
 			compatible = "pci-generic";
 			/* reg 0 is at 0x14, using FDT_PCI_SPACE_MEM32 */
-			reg = <0x02000814 0 0 0 0
-			       0x01000810 0 0 0 0>;
+			reg = <0x02000814 0 0 0x80 0
+			       0x01000810 0 0 0xc0 0>;
 			sandbox,emul = <&swap_case_emul0_1>;
 		};
 		p2sb-pci@2,0 {
@@ -1115,7 +1115,7 @@
 		pci@1f,0 {
 			compatible = "pci-generic";
 			/* reg 0 is at 0x10, using FDT_PCI_SPACE_IO */
-			reg = <0x0100f810 0 0 0 0>;
+			reg = <0x0100f810 0 0 0x100 0>;
 			sandbox,emul = <&swap_case_emul0_1f>;
 		};
 	};
diff --git a/drivers/core/fdtaddr.c b/drivers/core/fdtaddr.c
index 546db675aaf..b79d138c419 100644
--- a/drivers/core/fdtaddr.c
+++ b/drivers/core/fdtaddr.c
@@ -215,7 +215,7 @@ void *devfdt_map_physmem(const struct udevice *dev, unsigned long size)
 	return map_physmem(addr, size, MAP_NOCACHE);
 }
 
-fdt_addr_t devfdt_get_addr_pci(const struct udevice *dev)
+fdt_addr_t devfdt_get_addr_pci(const struct udevice *dev, fdt_size_t *sizep)
 {
 	ulong addr;
 
@@ -226,12 +226,12 @@ fdt_addr_t devfdt_get_addr_pci(const struct udevice *dev)
 		int ret;
 
 		ret = ofnode_read_pci_addr(dev_ofnode(dev), FDT_PCI_SPACE_MEM32,
-					   "reg", &pci_addr);
+					   "reg", &pci_addr, sizep);
 		if (ret) {
 			/* try if there is any i/o-mapped register */
 			ret = ofnode_read_pci_addr(dev_ofnode(dev),
 						   FDT_PCI_SPACE_IO, "reg",
-						   &pci_addr);
+						   &pci_addr, sizep);
 			if (ret)
 				return FDT_ADDR_T_NONE;
 		}
diff --git a/drivers/core/ofnode.c b/drivers/core/ofnode.c
index 2ef4114cb6f..c9cec456f43 100644
--- a/drivers/core/ofnode.c
+++ b/drivers/core/ofnode.c
@@ -1270,7 +1270,8 @@ const uint8_t *ofnode_read_u8_array_ptr(ofnode node, const char *propname,
 }
 
 int ofnode_read_pci_addr(ofnode node, enum fdt_pci_space type,
-			 const char *propname, struct fdt_pci_addr *addr)
+			 const char *propname, struct fdt_pci_addr *addr,
+			 fdt_size_t *size)
 {
 	const fdt32_t *cell;
 	int len;
@@ -1298,14 +1299,18 @@ int ofnode_read_pci_addr(ofnode node, enum fdt_pci_space type,
 			      (ulong)fdt32_to_cpu(cell[1]),
 			      (ulong)fdt32_to_cpu(cell[2]));
 			if ((fdt32_to_cpu(*cell) & type) == type) {
+				const unaligned_fdt64_t *ptr;
+
 				addr->phys_hi = fdt32_to_cpu(cell[0]);
 				addr->phys_mid = fdt32_to_cpu(cell[1]);
 				addr->phys_lo = fdt32_to_cpu(cell[2]);
+				ptr = (const unaligned_fdt64_t *)(cell + 3);
+				if (size)
+					*size = fdt64_to_cpu(*ptr);
 				break;
 			}
 
-			cell += (FDT_PCI_ADDR_CELLS +
-				 FDT_PCI_SIZE_CELLS);
+			cell += FDT_PCI_ADDR_CELLS + FDT_PCI_SIZE_CELLS;
 		}
 
 		if (i == num) {
diff --git a/drivers/core/read.c b/drivers/core/read.c
index 49066b59cda..419013451f0 100644
--- a/drivers/core/read.c
+++ b/drivers/core/read.c
@@ -405,13 +405,15 @@ int dev_read_alias_highest_id(const char *stem)
 	return fdtdec_get_alias_highest_id(gd->fdt_blob, stem);
 }
 
-fdt_addr_t dev_read_addr_pci(const struct udevice *dev)
+fdt_addr_t dev_read_addr_pci(const struct udevice *dev, fdt_size_t *sizep)
 {
 	ulong addr;
 
 	addr = dev_read_addr(dev);
+	if (sizep)
+		*sizep = 0;
 	if (addr == FDT_ADDR_T_NONE && !of_live_active())
-		addr = devfdt_get_addr_pci(dev);
+		addr = devfdt_get_addr_pci(dev, sizep);
 
 	return addr;
 }
diff --git a/drivers/core/util.c b/drivers/core/util.c
index aa60fdd15bc..81497df85ff 100644
--- a/drivers/core/util.c
+++ b/drivers/core/util.c
@@ -30,7 +30,7 @@ int pci_get_devfn(struct udevice *dev)
 
 	/* Extract the devfn from fdt_pci_addr */
 	ret = ofnode_read_pci_addr(dev_ofnode(dev), FDT_PCI_SPACE_CONFIG,
-				   "reg", &addr);
+				   "reg", &addr, NULL);
 	if (ret) {
 		if (ret != -ENOENT)
 			return -EINVAL;
diff --git a/drivers/pci/pci-uclass.c b/drivers/pci/pci-uclass.c
index 0adcdceb1d3..c670f8754e8 100644
--- a/drivers/pci/pci-uclass.c
+++ b/drivers/pci/pci-uclass.c
@@ -122,7 +122,7 @@ static void pci_dev_find_ofnode(struct udevice *bus, phys_addr_t bdf,
 
 	dev_for_each_subnode(node, bus) {
 		ret = ofnode_read_pci_addr(node, FDT_PCI_SPACE_CONFIG, "reg",
-					   &addr);
+					   &addr, NULL);
 		if (ret)
 			continue;
 
diff --git a/drivers/pci/pci_mvebu.c b/drivers/pci/pci_mvebu.c
index 93a7508d8a2..25878bde534 100644
--- a/drivers/pci/pci_mvebu.c
+++ b/drivers/pci/pci_mvebu.c
@@ -640,7 +640,8 @@ static int mvebu_pcie_port_parse_dt(ofnode node, ofnode parent, struct mvebu_pci
 		pcie->is_x4 = true;
 
 	/* devfn is in bits [15:8], see PCI_DEV usage */
-	ret = ofnode_read_pci_addr(node, FDT_PCI_SPACE_CONFIG, "reg", &pci_addr);
+	ret = ofnode_read_pci_addr(node, FDT_PCI_SPACE_CONFIG, "reg", &pci_addr,
+				   NULL);
 	if (ret < 0) {
 		printf("%s: property \"reg\" is invalid\n", pcie->name);
 		goto err;
diff --git a/drivers/pci/pci_tegra.c b/drivers/pci/pci_tegra.c
index 29d54117e93..ae90bd2fbf1 100644
--- a/drivers/pci/pci_tegra.c
+++ b/drivers/pci/pci_tegra.c
@@ -461,7 +461,7 @@ static int tegra_pcie_parse_port_info(ofnode node, uint *index, uint *lanes)
 
 	*lanes = err;
 
-	err = ofnode_read_pci_addr(node, 0, "reg", &addr);
+	err = ofnode_read_pci_addr(node, 0, "reg", &addr, NULL);
 	if (err < 0) {
 		pr_err("failed to parse \"reg\" property\n");
 		return err;
diff --git a/drivers/pci/pcie_mediatek.c b/drivers/pci/pcie_mediatek.c
index c6e30e24622..e59ebd13ad0 100644
--- a/drivers/pci/pcie_mediatek.c
+++ b/drivers/pci/pcie_mediatek.c
@@ -660,7 +660,7 @@ static int mtk_pcie_probe(struct udevice *dev)
 		if (!ofnode_is_enabled(subnode))
 			continue;
 
-		err = ofnode_read_pci_addr(subnode, 0, "reg", &addr);
+		err = ofnode_read_pci_addr(subnode, 0, "reg", &addr, NULL);
 		if (err)
 			return err;
 
@@ -699,7 +699,7 @@ static int mtk_pcie_probe_v2(struct udevice *dev)
 		if (!ofnode_is_enabled(subnode))
 			continue;
 
-		err = ofnode_read_pci_addr(subnode, 0, "reg", &addr);
+		err = ofnode_read_pci_addr(subnode, 0, "reg", &addr, NULL);
 		if (err)
 			return err;
 
diff --git a/drivers/serial/ns16550.c b/drivers/serial/ns16550.c
index eab9537fbae..a349e5e132a 100644
--- a/drivers/serial/ns16550.c
+++ b/drivers/serial/ns16550.c
@@ -479,6 +479,7 @@ static int ns16550_serial_getinfo(struct udevice *dev,
 	info->addr_space = SERIAL_ADDRESS_SPACE_MEMORY;
 #endif
 	info->addr = plat->base;
+	info->size = plat->size;
 	info->reg_width = plat->reg_width;
 	info->reg_shift = plat->reg_shift;
 	info->reg_offset = plat->reg_offset;
@@ -487,7 +488,8 @@ static int ns16550_serial_getinfo(struct udevice *dev,
 	return 0;
 }
 
-static int ns16550_serial_assign_base(struct ns16550_plat *plat, fdt_addr_t base)
+static int ns16550_serial_assign_base(struct ns16550_plat *plat,
+				      fdt_addr_t base, fdt_size_t size)
 {
 	if (base == FDT_ADDR_T_NONE)
 		return -EINVAL;
@@ -497,6 +499,7 @@ static int ns16550_serial_assign_base(struct ns16550_plat *plat, fdt_addr_t base
 #else
 	plat->base = (unsigned long)map_physmem(base, 0, MAP_NOCACHE);
 #endif
+	plat->size = size;
 
 	return 0;
 }
@@ -507,6 +510,7 @@ int ns16550_serial_probe(struct udevice *dev)
 	struct ns16550 *const com_port = dev_get_priv(dev);
 	struct reset_ctl_bulk reset_bulk;
 	fdt_addr_t addr;
+	fdt_addr_t size;
 	int ret;
 
 	/*
@@ -514,8 +518,8 @@ int ns16550_serial_probe(struct udevice *dev)
 	 * or via a PCI bridge, assign plat->base before probing hardware.
 	 */
 	if (device_is_on_pci_bus(dev)) {
-		addr = devfdt_get_addr_pci(dev);
-		ret = ns16550_serial_assign_base(plat, addr);
+		addr = devfdt_get_addr_pci(dev, &size);
+		ret = ns16550_serial_assign_base(plat, addr, size);
 		if (ret)
 			return ret;
 	}
@@ -543,11 +547,12 @@ int ns16550_serial_of_to_plat(struct udevice *dev)
 	struct ns16550_plat *plat = dev_get_plat(dev);
 	const u32 port_type = dev_get_driver_data(dev);
 	fdt_addr_t addr;
+	fdt_size_t size;
 	struct clk clk;
 	int err;
 
-	addr = dev_read_addr(dev);
-	err = ns16550_serial_assign_base(plat, addr);
+	addr = dev_read_addr_size(dev, &size);
+	err = ns16550_serial_assign_base(plat, addr, size);
 	if (err && !device_is_on_pci_bus(dev))
 		return err;
 
diff --git a/include/dm/fdtaddr.h b/include/dm/fdtaddr.h
index dcdc19137cc..6d2fa8f1044 100644
--- a/include/dm/fdtaddr.h
+++ b/include/dm/fdtaddr.h
@@ -168,8 +168,9 @@ fdt_addr_t devfdt_get_addr_size_name(const struct udevice *dev,
  * devfdt_get_addr_pci() - Read an address and handle PCI address translation
  *
  * @dev: Device to read from
+ * @sizep: If non-NULL, returns size of address space
  * Return: address or FDT_ADDR_T_NONE if not found
  */
-fdt_addr_t devfdt_get_addr_pci(const struct udevice *dev);
+fdt_addr_t devfdt_get_addr_pci(const struct udevice *dev, fdt_size_t *sizep);
 
 #endif
diff --git a/include/dm/ofnode.h b/include/dm/ofnode.h
index 726d8f82ddf..97cad971611 100644
--- a/include/dm/ofnode.h
+++ b/include/dm/ofnode.h
@@ -1152,13 +1152,15 @@ const uint8_t *ofnode_read_u8_array_ptr(ofnode node, const char *propname,
  * @type:	pci address type (FDT_PCI_SPACE_xxx)
  * @propname:	name of property to find
  * @addr:	returns pci address in the form of fdt_pci_addr
+ * @size:	if non-null, returns register-space size
  * Return:
  * 0 if ok, -ENOENT if the property did not exist, -EINVAL if the
  * format of the property was invalid, -ENXIO if the requested
  * address type was not found
  */
 int ofnode_read_pci_addr(ofnode node, enum fdt_pci_space type,
-			 const char *propname, struct fdt_pci_addr *addr);
+			 const char *propname, struct fdt_pci_addr *addr,
+			 fdt_size_t *size);
 
 /**
  * ofnode_read_pci_vendev() - look up PCI vendor and device id
diff --git a/include/dm/read.h b/include/dm/read.h
index c2615f72f40..3c2eea6f0c4 100644
--- a/include/dm/read.h
+++ b/include/dm/read.h
@@ -346,9 +346,10 @@ void *dev_read_addr_ptr(const struct udevice *dev);
  *    fdtdec_get_addr() and friends.
  *
  * @dev: Device to read from
+ * @sizep: If non-NULL, returns size of address space found
  * Return: address or FDT_ADDR_T_NONE if not found
  */
-fdt_addr_t dev_read_addr_pci(const struct udevice *dev);
+fdt_addr_t dev_read_addr_pci(const struct udevice *dev, fdt_size_t *sizep);
 
 /**
  * dev_remap_addr() - Get the reg property of a device as a
@@ -996,9 +997,10 @@ static inline void *dev_read_addr_ptr(const struct udevice *dev)
 	return devfdt_get_addr_ptr(dev);
 }
 
-static inline fdt_addr_t dev_read_addr_pci(const struct udevice *dev)
+static inline fdt_addr_t dev_read_addr_pci(const struct udevice *dev,
+					   fdt_size_t *sizep)
 {
-	return devfdt_get_addr_pci(dev);
+	return devfdt_get_addr_pci(dev, sizep);
 }
 
 static inline void *dev_remap_addr(const struct udevice *dev)
diff --git a/include/ns16550.h b/include/ns16550.h
index e7e68663d03..7f481300083 100644
--- a/include/ns16550.h
+++ b/include/ns16550.h
@@ -58,6 +58,7 @@ enum ns16550_flags {
  * struct ns16550_plat - information about a NS16550 port
  *
  * @base:		Base register address
+ * @size:		Size of register area in bytes
  * @reg_width:		IO accesses size of registers (in bytes, 1 or 4)
  * @reg_shift:		Shift size of registers (0=byte, 1=16bit, 2=32bit...)
  * @reg_offset:		Offset to start of registers (normally 0)
@@ -67,7 +68,8 @@ enum ns16550_flags {
  * @bdf:		PCI slot/function (pci_dev_t)
  */
 struct ns16550_plat {
-	unsigned long base;
+	ulong base;
+	ulong size;
 	int reg_width;
 	int reg_shift;
 	int reg_offset;
diff --git a/include/serial.h b/include/serial.h
index 42bdf3759c0..205889d28be 100644
--- a/include/serial.h
+++ b/include/serial.h
@@ -137,6 +137,7 @@ enum adr_space_type {
  * @type:	type of the UART chip
  * @addr_space:	address space to access the registers
  * @addr:	physical address of the registers
+ * @size:	size of the register area in bytes
  * @reg_width:	size (in bytes) of the IO accesses to the registers
  * @reg_offset:	offset to apply to the @addr from the start of the registers
  * @reg_shift:	quantity to shift the register offsets by
@@ -147,6 +148,7 @@ struct serial_device_info {
 	enum serial_chip_type type;
 	enum adr_space_type addr_space;
 	ulong addr;
+	ulong size;
 	u8 reg_width;
 	u8 reg_offset;
 	u8 reg_shift;
diff --git a/test/dm/pci.c b/test/dm/pci.c
index 70a736cfdb8..8c5e7da9e62 100644
--- a/test/dm/pci.c
+++ b/test/dm/pci.c
@@ -301,10 +301,12 @@ static int dm_test_pci_addr_flat(struct unit_test_state *uts)
 {
 	struct udevice *swap1f, *swap1;
 	ulong io_addr, mem_addr;
+	fdt_addr_t size;
 
 	ut_assertok(dm_pci_bus_find_bdf(PCI_BDF(0, 0x1f, 0), &swap1f));
 	io_addr = dm_pci_read_bar32(swap1f, 0);
-	ut_asserteq(io_addr, dev_read_addr_pci(swap1f));
+	ut_asserteq(io_addr, dev_read_addr_pci(swap1f, &size));
+	ut_asserteq(0, size);
 
 	/*
 	 * This device has both I/O and MEM spaces but the MEM space appears
@@ -312,7 +314,8 @@ static int dm_test_pci_addr_flat(struct unit_test_state *uts)
 	 */
 	ut_assertok(dm_pci_bus_find_bdf(PCI_BDF(0, 0x1, 0), &swap1));
 	mem_addr = dm_pci_read_bar32(swap1, 1);
-	ut_asserteq(mem_addr, dev_read_addr_pci(swap1));
+	ut_asserteq(mem_addr, dev_read_addr_pci(swap1, &size));
+	ut_asserteq(0, size);
 
 	return 0;
 }
@@ -329,12 +332,15 @@ DM_TEST(dm_test_pci_addr_flat, UT_TESTF_SCAN_PDATA | UT_TESTF_SCAN_FDT |
 static int dm_test_pci_addr_live(struct unit_test_state *uts)
 {
 	struct udevice *swap1f, *swap1;
+	fdt_size_t size;
 
 	ut_assertok(dm_pci_bus_find_bdf(PCI_BDF(0, 0x1f, 0), &swap1f));
-	ut_asserteq_64(FDT_ADDR_T_NONE, dev_read_addr_pci(swap1f));
+	ut_asserteq_64(FDT_ADDR_T_NONE, dev_read_addr_pci(swap1f, &size));
+	ut_asserteq(0, size);
 
 	ut_assertok(dm_pci_bus_find_bdf(PCI_BDF(0, 0x1, 0), &swap1));
-	ut_asserteq_64(FDT_ADDR_T_NONE, dev_read_addr_pci(swap1));
+	ut_asserteq_64(FDT_ADDR_T_NONE, dev_read_addr_pci(swap1, &size));
+	ut_asserteq(0, size);
 
 	return 0;
 }
-- 
2.42.0.rc2.253.gd59a3bf2b4-goog


^ permalink raw reply related	[flat|nested] 86+ messages in thread

* Re: [PATCH 32/32] pci: serial: Support reading PCI-register size with base
  2023-08-30 18:05 ` [PATCH 32/32] pci: serial: Support reading PCI-register size with base Simon Glass
@ 2023-08-30 18:14   ` Pali Rohár
  2023-08-30 18:17     ` Tom Rini
  2023-09-03 20:39     ` Pali Rohár
  0 siblings, 2 replies; 86+ messages in thread
From: Pali Rohár @ 2023-08-30 18:14 UTC (permalink / raw)
  To: Simon Glass
  Cc: U-Boot Mailing List, Tom Rini, Marek Vasut, Abdellatif El Khlifi,
	Andre Przywara, Bin Meng, Chunfeng Yun, Dzmitry Sankouski,
	GSS_MTK_Uboot_upstream, Heinrich Schuchardt, Ilias Apalodimas,
	Michal Simek, Michal Suchanek, Nikhil M Jain, Ryder Lee,
	Stefan Roese, Weijie Gao

Simon, why you are contacting me? You have wrote to me that you would
ignore my reviews here, so what you want now? Could you please explain
what you are trying to achieve? I'm not going to review this or any
other your changes.

On Wednesday 30 August 2023 12:05:03 Simon Glass wrote:
> The PCI helpers read only the base address for a PCI region. In some cases
> the size is needed as well, e.g. to pass along to a driver which needs to
> know the size of its register area.
> 
> Update the functions to allow the size to be returned. For serial, record
> the information and provided it with the serial_info() call.
> 
> A limitation still exists in that the size is not available when OF_LIVE
> is enabled, so take account of that in the tests.
> 
> Signed-off-by: Simon Glass <sjg@chromium.org>
> ---
> 
>  arch/sandbox/dts/test.dts   |  6 +++---
>  drivers/core/fdtaddr.c      |  6 +++---
>  drivers/core/ofnode.c       | 11 ++++++++---
>  drivers/core/read.c         |  6 ++++--
>  drivers/core/util.c         |  2 +-
>  drivers/pci/pci-uclass.c    |  2 +-
>  drivers/pci/pci_mvebu.c     |  3 ++-
>  drivers/pci/pci_tegra.c     |  2 +-
>  drivers/pci/pcie_mediatek.c |  4 ++--
>  drivers/serial/ns16550.c    | 15 ++++++++++-----
>  include/dm/fdtaddr.h        |  3 ++-
>  include/dm/ofnode.h         |  4 +++-
>  include/dm/read.h           |  8 +++++---
>  include/ns16550.h           |  4 +++-
>  include/serial.h            |  2 ++
>  test/dm/pci.c               | 14 ++++++++++----
>  16 files changed, 60 insertions(+), 32 deletions(-)
> 
> diff --git a/arch/sandbox/dts/test.dts b/arch/sandbox/dts/test.dts
> index a413cbe4989..961e8895a49 100644
> --- a/arch/sandbox/dts/test.dts
> +++ b/arch/sandbox/dts/test.dts
> @@ -1087,8 +1087,8 @@
>  		pci@1,0 {
>  			compatible = "pci-generic";
>  			/* reg 0 is at 0x14, using FDT_PCI_SPACE_MEM32 */
> -			reg = <0x02000814 0 0 0 0
> -			       0x01000810 0 0 0 0>;
> +			reg = <0x02000814 0 0 0x80 0
> +			       0x01000810 0 0 0xc0 0>;
>  			sandbox,emul = <&swap_case_emul0_1>;
>  		};
>  		p2sb-pci@2,0 {
> @@ -1115,7 +1115,7 @@
>  		pci@1f,0 {
>  			compatible = "pci-generic";
>  			/* reg 0 is at 0x10, using FDT_PCI_SPACE_IO */
> -			reg = <0x0100f810 0 0 0 0>;
> +			reg = <0x0100f810 0 0 0x100 0>;
>  			sandbox,emul = <&swap_case_emul0_1f>;
>  		};
>  	};
> diff --git a/drivers/core/fdtaddr.c b/drivers/core/fdtaddr.c
> index 546db675aaf..b79d138c419 100644
> --- a/drivers/core/fdtaddr.c
> +++ b/drivers/core/fdtaddr.c
> @@ -215,7 +215,7 @@ void *devfdt_map_physmem(const struct udevice *dev, unsigned long size)
>  	return map_physmem(addr, size, MAP_NOCACHE);
>  }
>  
> -fdt_addr_t devfdt_get_addr_pci(const struct udevice *dev)
> +fdt_addr_t devfdt_get_addr_pci(const struct udevice *dev, fdt_size_t *sizep)
>  {
>  	ulong addr;
>  
> @@ -226,12 +226,12 @@ fdt_addr_t devfdt_get_addr_pci(const struct udevice *dev)
>  		int ret;
>  
>  		ret = ofnode_read_pci_addr(dev_ofnode(dev), FDT_PCI_SPACE_MEM32,
> -					   "reg", &pci_addr);
> +					   "reg", &pci_addr, sizep);
>  		if (ret) {
>  			/* try if there is any i/o-mapped register */
>  			ret = ofnode_read_pci_addr(dev_ofnode(dev),
>  						   FDT_PCI_SPACE_IO, "reg",
> -						   &pci_addr);
> +						   &pci_addr, sizep);
>  			if (ret)
>  				return FDT_ADDR_T_NONE;
>  		}
> diff --git a/drivers/core/ofnode.c b/drivers/core/ofnode.c
> index 2ef4114cb6f..c9cec456f43 100644
> --- a/drivers/core/ofnode.c
> +++ b/drivers/core/ofnode.c
> @@ -1270,7 +1270,8 @@ const uint8_t *ofnode_read_u8_array_ptr(ofnode node, const char *propname,
>  }
>  
>  int ofnode_read_pci_addr(ofnode node, enum fdt_pci_space type,
> -			 const char *propname, struct fdt_pci_addr *addr)
> +			 const char *propname, struct fdt_pci_addr *addr,
> +			 fdt_size_t *size)
>  {
>  	const fdt32_t *cell;
>  	int len;
> @@ -1298,14 +1299,18 @@ int ofnode_read_pci_addr(ofnode node, enum fdt_pci_space type,
>  			      (ulong)fdt32_to_cpu(cell[1]),
>  			      (ulong)fdt32_to_cpu(cell[2]));
>  			if ((fdt32_to_cpu(*cell) & type) == type) {
> +				const unaligned_fdt64_t *ptr;
> +
>  				addr->phys_hi = fdt32_to_cpu(cell[0]);
>  				addr->phys_mid = fdt32_to_cpu(cell[1]);
>  				addr->phys_lo = fdt32_to_cpu(cell[2]);
> +				ptr = (const unaligned_fdt64_t *)(cell + 3);
> +				if (size)
> +					*size = fdt64_to_cpu(*ptr);
>  				break;
>  			}
>  
> -			cell += (FDT_PCI_ADDR_CELLS +
> -				 FDT_PCI_SIZE_CELLS);
> +			cell += FDT_PCI_ADDR_CELLS + FDT_PCI_SIZE_CELLS;
>  		}
>  
>  		if (i == num) {
> diff --git a/drivers/core/read.c b/drivers/core/read.c
> index 49066b59cda..419013451f0 100644
> --- a/drivers/core/read.c
> +++ b/drivers/core/read.c
> @@ -405,13 +405,15 @@ int dev_read_alias_highest_id(const char *stem)
>  	return fdtdec_get_alias_highest_id(gd->fdt_blob, stem);
>  }
>  
> -fdt_addr_t dev_read_addr_pci(const struct udevice *dev)
> +fdt_addr_t dev_read_addr_pci(const struct udevice *dev, fdt_size_t *sizep)
>  {
>  	ulong addr;
>  
>  	addr = dev_read_addr(dev);
> +	if (sizep)
> +		*sizep = 0;
>  	if (addr == FDT_ADDR_T_NONE && !of_live_active())
> -		addr = devfdt_get_addr_pci(dev);
> +		addr = devfdt_get_addr_pci(dev, sizep);
>  
>  	return addr;
>  }
> diff --git a/drivers/core/util.c b/drivers/core/util.c
> index aa60fdd15bc..81497df85ff 100644
> --- a/drivers/core/util.c
> +++ b/drivers/core/util.c
> @@ -30,7 +30,7 @@ int pci_get_devfn(struct udevice *dev)
>  
>  	/* Extract the devfn from fdt_pci_addr */
>  	ret = ofnode_read_pci_addr(dev_ofnode(dev), FDT_PCI_SPACE_CONFIG,
> -				   "reg", &addr);
> +				   "reg", &addr, NULL);
>  	if (ret) {
>  		if (ret != -ENOENT)
>  			return -EINVAL;
> diff --git a/drivers/pci/pci-uclass.c b/drivers/pci/pci-uclass.c
> index 0adcdceb1d3..c670f8754e8 100644
> --- a/drivers/pci/pci-uclass.c
> +++ b/drivers/pci/pci-uclass.c
> @@ -122,7 +122,7 @@ static void pci_dev_find_ofnode(struct udevice *bus, phys_addr_t bdf,
>  
>  	dev_for_each_subnode(node, bus) {
>  		ret = ofnode_read_pci_addr(node, FDT_PCI_SPACE_CONFIG, "reg",
> -					   &addr);
> +					   &addr, NULL);
>  		if (ret)
>  			continue;
>  
> diff --git a/drivers/pci/pci_mvebu.c b/drivers/pci/pci_mvebu.c
> index 93a7508d8a2..25878bde534 100644
> --- a/drivers/pci/pci_mvebu.c
> +++ b/drivers/pci/pci_mvebu.c
> @@ -640,7 +640,8 @@ static int mvebu_pcie_port_parse_dt(ofnode node, ofnode parent, struct mvebu_pci
>  		pcie->is_x4 = true;
>  
>  	/* devfn is in bits [15:8], see PCI_DEV usage */
> -	ret = ofnode_read_pci_addr(node, FDT_PCI_SPACE_CONFIG, "reg", &pci_addr);
> +	ret = ofnode_read_pci_addr(node, FDT_PCI_SPACE_CONFIG, "reg", &pci_addr,
> +				   NULL);
>  	if (ret < 0) {
>  		printf("%s: property \"reg\" is invalid\n", pcie->name);
>  		goto err;
> diff --git a/drivers/pci/pci_tegra.c b/drivers/pci/pci_tegra.c
> index 29d54117e93..ae90bd2fbf1 100644
> --- a/drivers/pci/pci_tegra.c
> +++ b/drivers/pci/pci_tegra.c
> @@ -461,7 +461,7 @@ static int tegra_pcie_parse_port_info(ofnode node, uint *index, uint *lanes)
>  
>  	*lanes = err;
>  
> -	err = ofnode_read_pci_addr(node, 0, "reg", &addr);
> +	err = ofnode_read_pci_addr(node, 0, "reg", &addr, NULL);
>  	if (err < 0) {
>  		pr_err("failed to parse \"reg\" property\n");
>  		return err;
> diff --git a/drivers/pci/pcie_mediatek.c b/drivers/pci/pcie_mediatek.c
> index c6e30e24622..e59ebd13ad0 100644
> --- a/drivers/pci/pcie_mediatek.c
> +++ b/drivers/pci/pcie_mediatek.c
> @@ -660,7 +660,7 @@ static int mtk_pcie_probe(struct udevice *dev)
>  		if (!ofnode_is_enabled(subnode))
>  			continue;
>  
> -		err = ofnode_read_pci_addr(subnode, 0, "reg", &addr);
> +		err = ofnode_read_pci_addr(subnode, 0, "reg", &addr, NULL);
>  		if (err)
>  			return err;
>  
> @@ -699,7 +699,7 @@ static int mtk_pcie_probe_v2(struct udevice *dev)
>  		if (!ofnode_is_enabled(subnode))
>  			continue;
>  
> -		err = ofnode_read_pci_addr(subnode, 0, "reg", &addr);
> +		err = ofnode_read_pci_addr(subnode, 0, "reg", &addr, NULL);
>  		if (err)
>  			return err;
>  
> diff --git a/drivers/serial/ns16550.c b/drivers/serial/ns16550.c
> index eab9537fbae..a349e5e132a 100644
> --- a/drivers/serial/ns16550.c
> +++ b/drivers/serial/ns16550.c
> @@ -479,6 +479,7 @@ static int ns16550_serial_getinfo(struct udevice *dev,
>  	info->addr_space = SERIAL_ADDRESS_SPACE_MEMORY;
>  #endif
>  	info->addr = plat->base;
> +	info->size = plat->size;
>  	info->reg_width = plat->reg_width;
>  	info->reg_shift = plat->reg_shift;
>  	info->reg_offset = plat->reg_offset;
> @@ -487,7 +488,8 @@ static int ns16550_serial_getinfo(struct udevice *dev,
>  	return 0;
>  }
>  
> -static int ns16550_serial_assign_base(struct ns16550_plat *plat, fdt_addr_t base)
> +static int ns16550_serial_assign_base(struct ns16550_plat *plat,
> +				      fdt_addr_t base, fdt_size_t size)
>  {
>  	if (base == FDT_ADDR_T_NONE)
>  		return -EINVAL;
> @@ -497,6 +499,7 @@ static int ns16550_serial_assign_base(struct ns16550_plat *plat, fdt_addr_t base
>  #else
>  	plat->base = (unsigned long)map_physmem(base, 0, MAP_NOCACHE);
>  #endif
> +	plat->size = size;
>  
>  	return 0;
>  }
> @@ -507,6 +510,7 @@ int ns16550_serial_probe(struct udevice *dev)
>  	struct ns16550 *const com_port = dev_get_priv(dev);
>  	struct reset_ctl_bulk reset_bulk;
>  	fdt_addr_t addr;
> +	fdt_addr_t size;
>  	int ret;
>  
>  	/*
> @@ -514,8 +518,8 @@ int ns16550_serial_probe(struct udevice *dev)
>  	 * or via a PCI bridge, assign plat->base before probing hardware.
>  	 */
>  	if (device_is_on_pci_bus(dev)) {
> -		addr = devfdt_get_addr_pci(dev);
> -		ret = ns16550_serial_assign_base(plat, addr);
> +		addr = devfdt_get_addr_pci(dev, &size);
> +		ret = ns16550_serial_assign_base(plat, addr, size);
>  		if (ret)
>  			return ret;
>  	}
> @@ -543,11 +547,12 @@ int ns16550_serial_of_to_plat(struct udevice *dev)
>  	struct ns16550_plat *plat = dev_get_plat(dev);
>  	const u32 port_type = dev_get_driver_data(dev);
>  	fdt_addr_t addr;
> +	fdt_size_t size;
>  	struct clk clk;
>  	int err;
>  
> -	addr = dev_read_addr(dev);
> -	err = ns16550_serial_assign_base(plat, addr);
> +	addr = dev_read_addr_size(dev, &size);
> +	err = ns16550_serial_assign_base(plat, addr, size);
>  	if (err && !device_is_on_pci_bus(dev))
>  		return err;
>  
> diff --git a/include/dm/fdtaddr.h b/include/dm/fdtaddr.h
> index dcdc19137cc..6d2fa8f1044 100644
> --- a/include/dm/fdtaddr.h
> +++ b/include/dm/fdtaddr.h
> @@ -168,8 +168,9 @@ fdt_addr_t devfdt_get_addr_size_name(const struct udevice *dev,
>   * devfdt_get_addr_pci() - Read an address and handle PCI address translation
>   *
>   * @dev: Device to read from
> + * @sizep: If non-NULL, returns size of address space
>   * Return: address or FDT_ADDR_T_NONE if not found
>   */
> -fdt_addr_t devfdt_get_addr_pci(const struct udevice *dev);
> +fdt_addr_t devfdt_get_addr_pci(const struct udevice *dev, fdt_size_t *sizep);
>  
>  #endif
> diff --git a/include/dm/ofnode.h b/include/dm/ofnode.h
> index 726d8f82ddf..97cad971611 100644
> --- a/include/dm/ofnode.h
> +++ b/include/dm/ofnode.h
> @@ -1152,13 +1152,15 @@ const uint8_t *ofnode_read_u8_array_ptr(ofnode node, const char *propname,
>   * @type:	pci address type (FDT_PCI_SPACE_xxx)
>   * @propname:	name of property to find
>   * @addr:	returns pci address in the form of fdt_pci_addr
> + * @size:	if non-null, returns register-space size
>   * Return:
>   * 0 if ok, -ENOENT if the property did not exist, -EINVAL if the
>   * format of the property was invalid, -ENXIO if the requested
>   * address type was not found
>   */
>  int ofnode_read_pci_addr(ofnode node, enum fdt_pci_space type,
> -			 const char *propname, struct fdt_pci_addr *addr);
> +			 const char *propname, struct fdt_pci_addr *addr,
> +			 fdt_size_t *size);
>  
>  /**
>   * ofnode_read_pci_vendev() - look up PCI vendor and device id
> diff --git a/include/dm/read.h b/include/dm/read.h
> index c2615f72f40..3c2eea6f0c4 100644
> --- a/include/dm/read.h
> +++ b/include/dm/read.h
> @@ -346,9 +346,10 @@ void *dev_read_addr_ptr(const struct udevice *dev);
>   *    fdtdec_get_addr() and friends.
>   *
>   * @dev: Device to read from
> + * @sizep: If non-NULL, returns size of address space found
>   * Return: address or FDT_ADDR_T_NONE if not found
>   */
> -fdt_addr_t dev_read_addr_pci(const struct udevice *dev);
> +fdt_addr_t dev_read_addr_pci(const struct udevice *dev, fdt_size_t *sizep);
>  
>  /**
>   * dev_remap_addr() - Get the reg property of a device as a
> @@ -996,9 +997,10 @@ static inline void *dev_read_addr_ptr(const struct udevice *dev)
>  	return devfdt_get_addr_ptr(dev);
>  }
>  
> -static inline fdt_addr_t dev_read_addr_pci(const struct udevice *dev)
> +static inline fdt_addr_t dev_read_addr_pci(const struct udevice *dev,
> +					   fdt_size_t *sizep)
>  {
> -	return devfdt_get_addr_pci(dev);
> +	return devfdt_get_addr_pci(dev, sizep);
>  }
>  
>  static inline void *dev_remap_addr(const struct udevice *dev)
> diff --git a/include/ns16550.h b/include/ns16550.h
> index e7e68663d03..7f481300083 100644
> --- a/include/ns16550.h
> +++ b/include/ns16550.h
> @@ -58,6 +58,7 @@ enum ns16550_flags {
>   * struct ns16550_plat - information about a NS16550 port
>   *
>   * @base:		Base register address
> + * @size:		Size of register area in bytes
>   * @reg_width:		IO accesses size of registers (in bytes, 1 or 4)
>   * @reg_shift:		Shift size of registers (0=byte, 1=16bit, 2=32bit...)
>   * @reg_offset:		Offset to start of registers (normally 0)
> @@ -67,7 +68,8 @@ enum ns16550_flags {
>   * @bdf:		PCI slot/function (pci_dev_t)
>   */
>  struct ns16550_plat {
> -	unsigned long base;
> +	ulong base;
> +	ulong size;
>  	int reg_width;
>  	int reg_shift;
>  	int reg_offset;
> diff --git a/include/serial.h b/include/serial.h
> index 42bdf3759c0..205889d28be 100644
> --- a/include/serial.h
> +++ b/include/serial.h
> @@ -137,6 +137,7 @@ enum adr_space_type {
>   * @type:	type of the UART chip
>   * @addr_space:	address space to access the registers
>   * @addr:	physical address of the registers
> + * @size:	size of the register area in bytes
>   * @reg_width:	size (in bytes) of the IO accesses to the registers
>   * @reg_offset:	offset to apply to the @addr from the start of the registers
>   * @reg_shift:	quantity to shift the register offsets by
> @@ -147,6 +148,7 @@ struct serial_device_info {
>  	enum serial_chip_type type;
>  	enum adr_space_type addr_space;
>  	ulong addr;
> +	ulong size;
>  	u8 reg_width;
>  	u8 reg_offset;
>  	u8 reg_shift;
> diff --git a/test/dm/pci.c b/test/dm/pci.c
> index 70a736cfdb8..8c5e7da9e62 100644
> --- a/test/dm/pci.c
> +++ b/test/dm/pci.c
> @@ -301,10 +301,12 @@ static int dm_test_pci_addr_flat(struct unit_test_state *uts)
>  {
>  	struct udevice *swap1f, *swap1;
>  	ulong io_addr, mem_addr;
> +	fdt_addr_t size;
>  
>  	ut_assertok(dm_pci_bus_find_bdf(PCI_BDF(0, 0x1f, 0), &swap1f));
>  	io_addr = dm_pci_read_bar32(swap1f, 0);
> -	ut_asserteq(io_addr, dev_read_addr_pci(swap1f));
> +	ut_asserteq(io_addr, dev_read_addr_pci(swap1f, &size));
> +	ut_asserteq(0, size);
>  
>  	/*
>  	 * This device has both I/O and MEM spaces but the MEM space appears
> @@ -312,7 +314,8 @@ static int dm_test_pci_addr_flat(struct unit_test_state *uts)
>  	 */
>  	ut_assertok(dm_pci_bus_find_bdf(PCI_BDF(0, 0x1, 0), &swap1));
>  	mem_addr = dm_pci_read_bar32(swap1, 1);
> -	ut_asserteq(mem_addr, dev_read_addr_pci(swap1));
> +	ut_asserteq(mem_addr, dev_read_addr_pci(swap1, &size));
> +	ut_asserteq(0, size);
>  
>  	return 0;
>  }
> @@ -329,12 +332,15 @@ DM_TEST(dm_test_pci_addr_flat, UT_TESTF_SCAN_PDATA | UT_TESTF_SCAN_FDT |
>  static int dm_test_pci_addr_live(struct unit_test_state *uts)
>  {
>  	struct udevice *swap1f, *swap1;
> +	fdt_size_t size;
>  
>  	ut_assertok(dm_pci_bus_find_bdf(PCI_BDF(0, 0x1f, 0), &swap1f));
> -	ut_asserteq_64(FDT_ADDR_T_NONE, dev_read_addr_pci(swap1f));
> +	ut_asserteq_64(FDT_ADDR_T_NONE, dev_read_addr_pci(swap1f, &size));
> +	ut_asserteq(0, size);
>  
>  	ut_assertok(dm_pci_bus_find_bdf(PCI_BDF(0, 0x1, 0), &swap1));
> -	ut_asserteq_64(FDT_ADDR_T_NONE, dev_read_addr_pci(swap1));
> +	ut_asserteq_64(FDT_ADDR_T_NONE, dev_read_addr_pci(swap1, &size));
> +	ut_asserteq(0, size);
>  
>  	return 0;
>  }
> -- 
> 2.42.0.rc2.253.gd59a3bf2b4-goog
> 

^ permalink raw reply	[flat|nested] 86+ messages in thread

* Re: [PATCH 32/32] pci: serial: Support reading PCI-register size with base
  2023-08-30 18:14   ` Pali Rohár
@ 2023-08-30 18:17     ` Tom Rini
  2023-08-30 18:39       ` Pali Rohár
  2023-09-03 20:39     ` Pali Rohár
  1 sibling, 1 reply; 86+ messages in thread
From: Tom Rini @ 2023-08-30 18:17 UTC (permalink / raw)
  To: Pali Rohár
  Cc: Simon Glass, U-Boot Mailing List, Marek Vasut,
	Abdellatif El Khlifi, Andre Przywara, Bin Meng, Chunfeng Yun,
	Dzmitry Sankouski, GSS_MTK_Uboot_upstream, Heinrich Schuchardt,
	Ilias Apalodimas, Michal Simek, Michal Suchanek, Nikhil M Jain,
	Ryder Lee, Stefan Roese, Weijie Gao

[-- Attachment #1: Type: text/plain, Size: 17704 bytes --]

Pali,

You are specifically listed as a maintainer for drivers/pci/pci_mvebu.c
and that is changed by this patch.

On Wed, Aug 30, 2023 at 08:14:59PM +0200, Pali Rohár wrote:
> Simon, why you are contacting me? You have wrote to me that you would
> ignore my reviews here, so what you want now? Could you please explain
> what you are trying to achieve? I'm not going to review this or any
> other your changes.
> 
> On Wednesday 30 August 2023 12:05:03 Simon Glass wrote:
> > The PCI helpers read only the base address for a PCI region. In some cases
> > the size is needed as well, e.g. to pass along to a driver which needs to
> > know the size of its register area.
> > 
> > Update the functions to allow the size to be returned. For serial, record
> > the information and provided it with the serial_info() call.
> > 
> > A limitation still exists in that the size is not available when OF_LIVE
> > is enabled, so take account of that in the tests.
> > 
> > Signed-off-by: Simon Glass <sjg@chromium.org>
> > ---
> > 
> >  arch/sandbox/dts/test.dts   |  6 +++---
> >  drivers/core/fdtaddr.c      |  6 +++---
> >  drivers/core/ofnode.c       | 11 ++++++++---
> >  drivers/core/read.c         |  6 ++++--
> >  drivers/core/util.c         |  2 +-
> >  drivers/pci/pci-uclass.c    |  2 +-
> >  drivers/pci/pci_mvebu.c     |  3 ++-
> >  drivers/pci/pci_tegra.c     |  2 +-
> >  drivers/pci/pcie_mediatek.c |  4 ++--
> >  drivers/serial/ns16550.c    | 15 ++++++++++-----
> >  include/dm/fdtaddr.h        |  3 ++-
> >  include/dm/ofnode.h         |  4 +++-
> >  include/dm/read.h           |  8 +++++---
> >  include/ns16550.h           |  4 +++-
> >  include/serial.h            |  2 ++
> >  test/dm/pci.c               | 14 ++++++++++----
> >  16 files changed, 60 insertions(+), 32 deletions(-)
> > 
> > diff --git a/arch/sandbox/dts/test.dts b/arch/sandbox/dts/test.dts
> > index a413cbe4989..961e8895a49 100644
> > --- a/arch/sandbox/dts/test.dts
> > +++ b/arch/sandbox/dts/test.dts
> > @@ -1087,8 +1087,8 @@
> >  		pci@1,0 {
> >  			compatible = "pci-generic";
> >  			/* reg 0 is at 0x14, using FDT_PCI_SPACE_MEM32 */
> > -			reg = <0x02000814 0 0 0 0
> > -			       0x01000810 0 0 0 0>;
> > +			reg = <0x02000814 0 0 0x80 0
> > +			       0x01000810 0 0 0xc0 0>;
> >  			sandbox,emul = <&swap_case_emul0_1>;
> >  		};
> >  		p2sb-pci@2,0 {
> > @@ -1115,7 +1115,7 @@
> >  		pci@1f,0 {
> >  			compatible = "pci-generic";
> >  			/* reg 0 is at 0x10, using FDT_PCI_SPACE_IO */
> > -			reg = <0x0100f810 0 0 0 0>;
> > +			reg = <0x0100f810 0 0 0x100 0>;
> >  			sandbox,emul = <&swap_case_emul0_1f>;
> >  		};
> >  	};
> > diff --git a/drivers/core/fdtaddr.c b/drivers/core/fdtaddr.c
> > index 546db675aaf..b79d138c419 100644
> > --- a/drivers/core/fdtaddr.c
> > +++ b/drivers/core/fdtaddr.c
> > @@ -215,7 +215,7 @@ void *devfdt_map_physmem(const struct udevice *dev, unsigned long size)
> >  	return map_physmem(addr, size, MAP_NOCACHE);
> >  }
> >  
> > -fdt_addr_t devfdt_get_addr_pci(const struct udevice *dev)
> > +fdt_addr_t devfdt_get_addr_pci(const struct udevice *dev, fdt_size_t *sizep)
> >  {
> >  	ulong addr;
> >  
> > @@ -226,12 +226,12 @@ fdt_addr_t devfdt_get_addr_pci(const struct udevice *dev)
> >  		int ret;
> >  
> >  		ret = ofnode_read_pci_addr(dev_ofnode(dev), FDT_PCI_SPACE_MEM32,
> > -					   "reg", &pci_addr);
> > +					   "reg", &pci_addr, sizep);
> >  		if (ret) {
> >  			/* try if there is any i/o-mapped register */
> >  			ret = ofnode_read_pci_addr(dev_ofnode(dev),
> >  						   FDT_PCI_SPACE_IO, "reg",
> > -						   &pci_addr);
> > +						   &pci_addr, sizep);
> >  			if (ret)
> >  				return FDT_ADDR_T_NONE;
> >  		}
> > diff --git a/drivers/core/ofnode.c b/drivers/core/ofnode.c
> > index 2ef4114cb6f..c9cec456f43 100644
> > --- a/drivers/core/ofnode.c
> > +++ b/drivers/core/ofnode.c
> > @@ -1270,7 +1270,8 @@ const uint8_t *ofnode_read_u8_array_ptr(ofnode node, const char *propname,
> >  }
> >  
> >  int ofnode_read_pci_addr(ofnode node, enum fdt_pci_space type,
> > -			 const char *propname, struct fdt_pci_addr *addr)
> > +			 const char *propname, struct fdt_pci_addr *addr,
> > +			 fdt_size_t *size)
> >  {
> >  	const fdt32_t *cell;
> >  	int len;
> > @@ -1298,14 +1299,18 @@ int ofnode_read_pci_addr(ofnode node, enum fdt_pci_space type,
> >  			      (ulong)fdt32_to_cpu(cell[1]),
> >  			      (ulong)fdt32_to_cpu(cell[2]));
> >  			if ((fdt32_to_cpu(*cell) & type) == type) {
> > +				const unaligned_fdt64_t *ptr;
> > +
> >  				addr->phys_hi = fdt32_to_cpu(cell[0]);
> >  				addr->phys_mid = fdt32_to_cpu(cell[1]);
> >  				addr->phys_lo = fdt32_to_cpu(cell[2]);
> > +				ptr = (const unaligned_fdt64_t *)(cell + 3);
> > +				if (size)
> > +					*size = fdt64_to_cpu(*ptr);
> >  				break;
> >  			}
> >  
> > -			cell += (FDT_PCI_ADDR_CELLS +
> > -				 FDT_PCI_SIZE_CELLS);
> > +			cell += FDT_PCI_ADDR_CELLS + FDT_PCI_SIZE_CELLS;
> >  		}
> >  
> >  		if (i == num) {
> > diff --git a/drivers/core/read.c b/drivers/core/read.c
> > index 49066b59cda..419013451f0 100644
> > --- a/drivers/core/read.c
> > +++ b/drivers/core/read.c
> > @@ -405,13 +405,15 @@ int dev_read_alias_highest_id(const char *stem)
> >  	return fdtdec_get_alias_highest_id(gd->fdt_blob, stem);
> >  }
> >  
> > -fdt_addr_t dev_read_addr_pci(const struct udevice *dev)
> > +fdt_addr_t dev_read_addr_pci(const struct udevice *dev, fdt_size_t *sizep)
> >  {
> >  	ulong addr;
> >  
> >  	addr = dev_read_addr(dev);
> > +	if (sizep)
> > +		*sizep = 0;
> >  	if (addr == FDT_ADDR_T_NONE && !of_live_active())
> > -		addr = devfdt_get_addr_pci(dev);
> > +		addr = devfdt_get_addr_pci(dev, sizep);
> >  
> >  	return addr;
> >  }
> > diff --git a/drivers/core/util.c b/drivers/core/util.c
> > index aa60fdd15bc..81497df85ff 100644
> > --- a/drivers/core/util.c
> > +++ b/drivers/core/util.c
> > @@ -30,7 +30,7 @@ int pci_get_devfn(struct udevice *dev)
> >  
> >  	/* Extract the devfn from fdt_pci_addr */
> >  	ret = ofnode_read_pci_addr(dev_ofnode(dev), FDT_PCI_SPACE_CONFIG,
> > -				   "reg", &addr);
> > +				   "reg", &addr, NULL);
> >  	if (ret) {
> >  		if (ret != -ENOENT)
> >  			return -EINVAL;
> > diff --git a/drivers/pci/pci-uclass.c b/drivers/pci/pci-uclass.c
> > index 0adcdceb1d3..c670f8754e8 100644
> > --- a/drivers/pci/pci-uclass.c
> > +++ b/drivers/pci/pci-uclass.c
> > @@ -122,7 +122,7 @@ static void pci_dev_find_ofnode(struct udevice *bus, phys_addr_t bdf,
> >  
> >  	dev_for_each_subnode(node, bus) {
> >  		ret = ofnode_read_pci_addr(node, FDT_PCI_SPACE_CONFIG, "reg",
> > -					   &addr);
> > +					   &addr, NULL);
> >  		if (ret)
> >  			continue;
> >  
> > diff --git a/drivers/pci/pci_mvebu.c b/drivers/pci/pci_mvebu.c
> > index 93a7508d8a2..25878bde534 100644
> > --- a/drivers/pci/pci_mvebu.c
> > +++ b/drivers/pci/pci_mvebu.c
> > @@ -640,7 +640,8 @@ static int mvebu_pcie_port_parse_dt(ofnode node, ofnode parent, struct mvebu_pci
> >  		pcie->is_x4 = true;
> >  
> >  	/* devfn is in bits [15:8], see PCI_DEV usage */
> > -	ret = ofnode_read_pci_addr(node, FDT_PCI_SPACE_CONFIG, "reg", &pci_addr);
> > +	ret = ofnode_read_pci_addr(node, FDT_PCI_SPACE_CONFIG, "reg", &pci_addr,
> > +				   NULL);
> >  	if (ret < 0) {
> >  		printf("%s: property \"reg\" is invalid\n", pcie->name);
> >  		goto err;
> > diff --git a/drivers/pci/pci_tegra.c b/drivers/pci/pci_tegra.c
> > index 29d54117e93..ae90bd2fbf1 100644
> > --- a/drivers/pci/pci_tegra.c
> > +++ b/drivers/pci/pci_tegra.c
> > @@ -461,7 +461,7 @@ static int tegra_pcie_parse_port_info(ofnode node, uint *index, uint *lanes)
> >  
> >  	*lanes = err;
> >  
> > -	err = ofnode_read_pci_addr(node, 0, "reg", &addr);
> > +	err = ofnode_read_pci_addr(node, 0, "reg", &addr, NULL);
> >  	if (err < 0) {
> >  		pr_err("failed to parse \"reg\" property\n");
> >  		return err;
> > diff --git a/drivers/pci/pcie_mediatek.c b/drivers/pci/pcie_mediatek.c
> > index c6e30e24622..e59ebd13ad0 100644
> > --- a/drivers/pci/pcie_mediatek.c
> > +++ b/drivers/pci/pcie_mediatek.c
> > @@ -660,7 +660,7 @@ static int mtk_pcie_probe(struct udevice *dev)
> >  		if (!ofnode_is_enabled(subnode))
> >  			continue;
> >  
> > -		err = ofnode_read_pci_addr(subnode, 0, "reg", &addr);
> > +		err = ofnode_read_pci_addr(subnode, 0, "reg", &addr, NULL);
> >  		if (err)
> >  			return err;
> >  
> > @@ -699,7 +699,7 @@ static int mtk_pcie_probe_v2(struct udevice *dev)
> >  		if (!ofnode_is_enabled(subnode))
> >  			continue;
> >  
> > -		err = ofnode_read_pci_addr(subnode, 0, "reg", &addr);
> > +		err = ofnode_read_pci_addr(subnode, 0, "reg", &addr, NULL);
> >  		if (err)
> >  			return err;
> >  
> > diff --git a/drivers/serial/ns16550.c b/drivers/serial/ns16550.c
> > index eab9537fbae..a349e5e132a 100644
> > --- a/drivers/serial/ns16550.c
> > +++ b/drivers/serial/ns16550.c
> > @@ -479,6 +479,7 @@ static int ns16550_serial_getinfo(struct udevice *dev,
> >  	info->addr_space = SERIAL_ADDRESS_SPACE_MEMORY;
> >  #endif
> >  	info->addr = plat->base;
> > +	info->size = plat->size;
> >  	info->reg_width = plat->reg_width;
> >  	info->reg_shift = plat->reg_shift;
> >  	info->reg_offset = plat->reg_offset;
> > @@ -487,7 +488,8 @@ static int ns16550_serial_getinfo(struct udevice *dev,
> >  	return 0;
> >  }
> >  
> > -static int ns16550_serial_assign_base(struct ns16550_plat *plat, fdt_addr_t base)
> > +static int ns16550_serial_assign_base(struct ns16550_plat *plat,
> > +				      fdt_addr_t base, fdt_size_t size)
> >  {
> >  	if (base == FDT_ADDR_T_NONE)
> >  		return -EINVAL;
> > @@ -497,6 +499,7 @@ static int ns16550_serial_assign_base(struct ns16550_plat *plat, fdt_addr_t base
> >  #else
> >  	plat->base = (unsigned long)map_physmem(base, 0, MAP_NOCACHE);
> >  #endif
> > +	plat->size = size;
> >  
> >  	return 0;
> >  }
> > @@ -507,6 +510,7 @@ int ns16550_serial_probe(struct udevice *dev)
> >  	struct ns16550 *const com_port = dev_get_priv(dev);
> >  	struct reset_ctl_bulk reset_bulk;
> >  	fdt_addr_t addr;
> > +	fdt_addr_t size;
> >  	int ret;
> >  
> >  	/*
> > @@ -514,8 +518,8 @@ int ns16550_serial_probe(struct udevice *dev)
> >  	 * or via a PCI bridge, assign plat->base before probing hardware.
> >  	 */
> >  	if (device_is_on_pci_bus(dev)) {
> > -		addr = devfdt_get_addr_pci(dev);
> > -		ret = ns16550_serial_assign_base(plat, addr);
> > +		addr = devfdt_get_addr_pci(dev, &size);
> > +		ret = ns16550_serial_assign_base(plat, addr, size);
> >  		if (ret)
> >  			return ret;
> >  	}
> > @@ -543,11 +547,12 @@ int ns16550_serial_of_to_plat(struct udevice *dev)
> >  	struct ns16550_plat *plat = dev_get_plat(dev);
> >  	const u32 port_type = dev_get_driver_data(dev);
> >  	fdt_addr_t addr;
> > +	fdt_size_t size;
> >  	struct clk clk;
> >  	int err;
> >  
> > -	addr = dev_read_addr(dev);
> > -	err = ns16550_serial_assign_base(plat, addr);
> > +	addr = dev_read_addr_size(dev, &size);
> > +	err = ns16550_serial_assign_base(plat, addr, size);
> >  	if (err && !device_is_on_pci_bus(dev))
> >  		return err;
> >  
> > diff --git a/include/dm/fdtaddr.h b/include/dm/fdtaddr.h
> > index dcdc19137cc..6d2fa8f1044 100644
> > --- a/include/dm/fdtaddr.h
> > +++ b/include/dm/fdtaddr.h
> > @@ -168,8 +168,9 @@ fdt_addr_t devfdt_get_addr_size_name(const struct udevice *dev,
> >   * devfdt_get_addr_pci() - Read an address and handle PCI address translation
> >   *
> >   * @dev: Device to read from
> > + * @sizep: If non-NULL, returns size of address space
> >   * Return: address or FDT_ADDR_T_NONE if not found
> >   */
> > -fdt_addr_t devfdt_get_addr_pci(const struct udevice *dev);
> > +fdt_addr_t devfdt_get_addr_pci(const struct udevice *dev, fdt_size_t *sizep);
> >  
> >  #endif
> > diff --git a/include/dm/ofnode.h b/include/dm/ofnode.h
> > index 726d8f82ddf..97cad971611 100644
> > --- a/include/dm/ofnode.h
> > +++ b/include/dm/ofnode.h
> > @@ -1152,13 +1152,15 @@ const uint8_t *ofnode_read_u8_array_ptr(ofnode node, const char *propname,
> >   * @type:	pci address type (FDT_PCI_SPACE_xxx)
> >   * @propname:	name of property to find
> >   * @addr:	returns pci address in the form of fdt_pci_addr
> > + * @size:	if non-null, returns register-space size
> >   * Return:
> >   * 0 if ok, -ENOENT if the property did not exist, -EINVAL if the
> >   * format of the property was invalid, -ENXIO if the requested
> >   * address type was not found
> >   */
> >  int ofnode_read_pci_addr(ofnode node, enum fdt_pci_space type,
> > -			 const char *propname, struct fdt_pci_addr *addr);
> > +			 const char *propname, struct fdt_pci_addr *addr,
> > +			 fdt_size_t *size);
> >  
> >  /**
> >   * ofnode_read_pci_vendev() - look up PCI vendor and device id
> > diff --git a/include/dm/read.h b/include/dm/read.h
> > index c2615f72f40..3c2eea6f0c4 100644
> > --- a/include/dm/read.h
> > +++ b/include/dm/read.h
> > @@ -346,9 +346,10 @@ void *dev_read_addr_ptr(const struct udevice *dev);
> >   *    fdtdec_get_addr() and friends.
> >   *
> >   * @dev: Device to read from
> > + * @sizep: If non-NULL, returns size of address space found
> >   * Return: address or FDT_ADDR_T_NONE if not found
> >   */
> > -fdt_addr_t dev_read_addr_pci(const struct udevice *dev);
> > +fdt_addr_t dev_read_addr_pci(const struct udevice *dev, fdt_size_t *sizep);
> >  
> >  /**
> >   * dev_remap_addr() - Get the reg property of a device as a
> > @@ -996,9 +997,10 @@ static inline void *dev_read_addr_ptr(const struct udevice *dev)
> >  	return devfdt_get_addr_ptr(dev);
> >  }
> >  
> > -static inline fdt_addr_t dev_read_addr_pci(const struct udevice *dev)
> > +static inline fdt_addr_t dev_read_addr_pci(const struct udevice *dev,
> > +					   fdt_size_t *sizep)
> >  {
> > -	return devfdt_get_addr_pci(dev);
> > +	return devfdt_get_addr_pci(dev, sizep);
> >  }
> >  
> >  static inline void *dev_remap_addr(const struct udevice *dev)
> > diff --git a/include/ns16550.h b/include/ns16550.h
> > index e7e68663d03..7f481300083 100644
> > --- a/include/ns16550.h
> > +++ b/include/ns16550.h
> > @@ -58,6 +58,7 @@ enum ns16550_flags {
> >   * struct ns16550_plat - information about a NS16550 port
> >   *
> >   * @base:		Base register address
> > + * @size:		Size of register area in bytes
> >   * @reg_width:		IO accesses size of registers (in bytes, 1 or 4)
> >   * @reg_shift:		Shift size of registers (0=byte, 1=16bit, 2=32bit...)
> >   * @reg_offset:		Offset to start of registers (normally 0)
> > @@ -67,7 +68,8 @@ enum ns16550_flags {
> >   * @bdf:		PCI slot/function (pci_dev_t)
> >   */
> >  struct ns16550_plat {
> > -	unsigned long base;
> > +	ulong base;
> > +	ulong size;
> >  	int reg_width;
> >  	int reg_shift;
> >  	int reg_offset;
> > diff --git a/include/serial.h b/include/serial.h
> > index 42bdf3759c0..205889d28be 100644
> > --- a/include/serial.h
> > +++ b/include/serial.h
> > @@ -137,6 +137,7 @@ enum adr_space_type {
> >   * @type:	type of the UART chip
> >   * @addr_space:	address space to access the registers
> >   * @addr:	physical address of the registers
> > + * @size:	size of the register area in bytes
> >   * @reg_width:	size (in bytes) of the IO accesses to the registers
> >   * @reg_offset:	offset to apply to the @addr from the start of the registers
> >   * @reg_shift:	quantity to shift the register offsets by
> > @@ -147,6 +148,7 @@ struct serial_device_info {
> >  	enum serial_chip_type type;
> >  	enum adr_space_type addr_space;
> >  	ulong addr;
> > +	ulong size;
> >  	u8 reg_width;
> >  	u8 reg_offset;
> >  	u8 reg_shift;
> > diff --git a/test/dm/pci.c b/test/dm/pci.c
> > index 70a736cfdb8..8c5e7da9e62 100644
> > --- a/test/dm/pci.c
> > +++ b/test/dm/pci.c
> > @@ -301,10 +301,12 @@ static int dm_test_pci_addr_flat(struct unit_test_state *uts)
> >  {
> >  	struct udevice *swap1f, *swap1;
> >  	ulong io_addr, mem_addr;
> > +	fdt_addr_t size;
> >  
> >  	ut_assertok(dm_pci_bus_find_bdf(PCI_BDF(0, 0x1f, 0), &swap1f));
> >  	io_addr = dm_pci_read_bar32(swap1f, 0);
> > -	ut_asserteq(io_addr, dev_read_addr_pci(swap1f));
> > +	ut_asserteq(io_addr, dev_read_addr_pci(swap1f, &size));
> > +	ut_asserteq(0, size);
> >  
> >  	/*
> >  	 * This device has both I/O and MEM spaces but the MEM space appears
> > @@ -312,7 +314,8 @@ static int dm_test_pci_addr_flat(struct unit_test_state *uts)
> >  	 */
> >  	ut_assertok(dm_pci_bus_find_bdf(PCI_BDF(0, 0x1, 0), &swap1));
> >  	mem_addr = dm_pci_read_bar32(swap1, 1);
> > -	ut_asserteq(mem_addr, dev_read_addr_pci(swap1));
> > +	ut_asserteq(mem_addr, dev_read_addr_pci(swap1, &size));
> > +	ut_asserteq(0, size);
> >  
> >  	return 0;
> >  }
> > @@ -329,12 +332,15 @@ DM_TEST(dm_test_pci_addr_flat, UT_TESTF_SCAN_PDATA | UT_TESTF_SCAN_FDT |
> >  static int dm_test_pci_addr_live(struct unit_test_state *uts)
> >  {
> >  	struct udevice *swap1f, *swap1;
> > +	fdt_size_t size;
> >  
> >  	ut_assertok(dm_pci_bus_find_bdf(PCI_BDF(0, 0x1f, 0), &swap1f));
> > -	ut_asserteq_64(FDT_ADDR_T_NONE, dev_read_addr_pci(swap1f));
> > +	ut_asserteq_64(FDT_ADDR_T_NONE, dev_read_addr_pci(swap1f, &size));
> > +	ut_asserteq(0, size);
> >  
> >  	ut_assertok(dm_pci_bus_find_bdf(PCI_BDF(0, 0x1, 0), &swap1));
> > -	ut_asserteq_64(FDT_ADDR_T_NONE, dev_read_addr_pci(swap1));
> > +	ut_asserteq_64(FDT_ADDR_T_NONE, dev_read_addr_pci(swap1, &size));
> > +	ut_asserteq(0, size);
> >  
> >  	return 0;
> >  }
> > -- 
> > 2.42.0.rc2.253.gd59a3bf2b4-goog
> > 

-- 
Tom

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 659 bytes --]

^ permalink raw reply	[flat|nested] 86+ messages in thread

* Re: [PATCH 32/32] pci: serial: Support reading PCI-register size with base
  2023-08-30 18:17     ` Tom Rini
@ 2023-08-30 18:39       ` Pali Rohár
  2023-08-30 19:04         ` Tom Rini
  0 siblings, 1 reply; 86+ messages in thread
From: Pali Rohár @ 2023-08-30 18:39 UTC (permalink / raw)
  To: Tom Rini
  Cc: Simon Glass, U-Boot Mailing List, Marek Vasut,
	Abdellatif El Khlifi, Andre Przywara, Bin Meng, Chunfeng Yun,
	Dzmitry Sankouski, GSS_MTK_Uboot_upstream, Heinrich Schuchardt,
	Ilias Apalodimas, Michal Simek, Michal Suchanek, Nikhil M Jain,
	Ryder Lee, Stefan Roese, Weijie Gao

And what? How it is related to the statements that my reviews would also
ignored? And what you want from me now?

On Wednesday 30 August 2023 14:17:50 Tom Rini wrote:
> Pali,
> 
> You are specifically listed as a maintainer for drivers/pci/pci_mvebu.c
> and that is changed by this patch.
> 
> On Wed, Aug 30, 2023 at 08:14:59PM +0200, Pali Rohár wrote:
> > Simon, why you are contacting me? You have wrote to me that you would
> > ignore my reviews here, so what you want now? Could you please explain
> > what you are trying to achieve? I'm not going to review this or any
> > other your changes.
> > 
> > On Wednesday 30 August 2023 12:05:03 Simon Glass wrote:
> > > The PCI helpers read only the base address for a PCI region. In some cases
> > > the size is needed as well, e.g. to pass along to a driver which needs to
> > > know the size of its register area.
> > > 
> > > Update the functions to allow the size to be returned. For serial, record
> > > the information and provided it with the serial_info() call.
> > > 
> > > A limitation still exists in that the size is not available when OF_LIVE
> > > is enabled, so take account of that in the tests.
> > > 
> > > Signed-off-by: Simon Glass <sjg@chromium.org>
> > > ---
> > > 
> > >  arch/sandbox/dts/test.dts   |  6 +++---
> > >  drivers/core/fdtaddr.c      |  6 +++---
> > >  drivers/core/ofnode.c       | 11 ++++++++---
> > >  drivers/core/read.c         |  6 ++++--
> > >  drivers/core/util.c         |  2 +-
> > >  drivers/pci/pci-uclass.c    |  2 +-
> > >  drivers/pci/pci_mvebu.c     |  3 ++-
> > >  drivers/pci/pci_tegra.c     |  2 +-
> > >  drivers/pci/pcie_mediatek.c |  4 ++--
> > >  drivers/serial/ns16550.c    | 15 ++++++++++-----
> > >  include/dm/fdtaddr.h        |  3 ++-
> > >  include/dm/ofnode.h         |  4 +++-
> > >  include/dm/read.h           |  8 +++++---
> > >  include/ns16550.h           |  4 +++-
> > >  include/serial.h            |  2 ++
> > >  test/dm/pci.c               | 14 ++++++++++----
> > >  16 files changed, 60 insertions(+), 32 deletions(-)
> > > 
> > > diff --git a/arch/sandbox/dts/test.dts b/arch/sandbox/dts/test.dts
> > > index a413cbe4989..961e8895a49 100644
> > > --- a/arch/sandbox/dts/test.dts
> > > +++ b/arch/sandbox/dts/test.dts
> > > @@ -1087,8 +1087,8 @@
> > >  		pci@1,0 {
> > >  			compatible = "pci-generic";
> > >  			/* reg 0 is at 0x14, using FDT_PCI_SPACE_MEM32 */
> > > -			reg = <0x02000814 0 0 0 0
> > > -			       0x01000810 0 0 0 0>;
> > > +			reg = <0x02000814 0 0 0x80 0
> > > +			       0x01000810 0 0 0xc0 0>;
> > >  			sandbox,emul = <&swap_case_emul0_1>;
> > >  		};
> > >  		p2sb-pci@2,0 {
> > > @@ -1115,7 +1115,7 @@
> > >  		pci@1f,0 {
> > >  			compatible = "pci-generic";
> > >  			/* reg 0 is at 0x10, using FDT_PCI_SPACE_IO */
> > > -			reg = <0x0100f810 0 0 0 0>;
> > > +			reg = <0x0100f810 0 0 0x100 0>;
> > >  			sandbox,emul = <&swap_case_emul0_1f>;
> > >  		};
> > >  	};
> > > diff --git a/drivers/core/fdtaddr.c b/drivers/core/fdtaddr.c
> > > index 546db675aaf..b79d138c419 100644
> > > --- a/drivers/core/fdtaddr.c
> > > +++ b/drivers/core/fdtaddr.c
> > > @@ -215,7 +215,7 @@ void *devfdt_map_physmem(const struct udevice *dev, unsigned long size)
> > >  	return map_physmem(addr, size, MAP_NOCACHE);
> > >  }
> > >  
> > > -fdt_addr_t devfdt_get_addr_pci(const struct udevice *dev)
> > > +fdt_addr_t devfdt_get_addr_pci(const struct udevice *dev, fdt_size_t *sizep)
> > >  {
> > >  	ulong addr;
> > >  
> > > @@ -226,12 +226,12 @@ fdt_addr_t devfdt_get_addr_pci(const struct udevice *dev)
> > >  		int ret;
> > >  
> > >  		ret = ofnode_read_pci_addr(dev_ofnode(dev), FDT_PCI_SPACE_MEM32,
> > > -					   "reg", &pci_addr);
> > > +					   "reg", &pci_addr, sizep);
> > >  		if (ret) {
> > >  			/* try if there is any i/o-mapped register */
> > >  			ret = ofnode_read_pci_addr(dev_ofnode(dev),
> > >  						   FDT_PCI_SPACE_IO, "reg",
> > > -						   &pci_addr);
> > > +						   &pci_addr, sizep);
> > >  			if (ret)
> > >  				return FDT_ADDR_T_NONE;
> > >  		}
> > > diff --git a/drivers/core/ofnode.c b/drivers/core/ofnode.c
> > > index 2ef4114cb6f..c9cec456f43 100644
> > > --- a/drivers/core/ofnode.c
> > > +++ b/drivers/core/ofnode.c
> > > @@ -1270,7 +1270,8 @@ const uint8_t *ofnode_read_u8_array_ptr(ofnode node, const char *propname,
> > >  }
> > >  
> > >  int ofnode_read_pci_addr(ofnode node, enum fdt_pci_space type,
> > > -			 const char *propname, struct fdt_pci_addr *addr)
> > > +			 const char *propname, struct fdt_pci_addr *addr,
> > > +			 fdt_size_t *size)
> > >  {
> > >  	const fdt32_t *cell;
> > >  	int len;
> > > @@ -1298,14 +1299,18 @@ int ofnode_read_pci_addr(ofnode node, enum fdt_pci_space type,
> > >  			      (ulong)fdt32_to_cpu(cell[1]),
> > >  			      (ulong)fdt32_to_cpu(cell[2]));
> > >  			if ((fdt32_to_cpu(*cell) & type) == type) {
> > > +				const unaligned_fdt64_t *ptr;
> > > +
> > >  				addr->phys_hi = fdt32_to_cpu(cell[0]);
> > >  				addr->phys_mid = fdt32_to_cpu(cell[1]);
> > >  				addr->phys_lo = fdt32_to_cpu(cell[2]);
> > > +				ptr = (const unaligned_fdt64_t *)(cell + 3);
> > > +				if (size)
> > > +					*size = fdt64_to_cpu(*ptr);
> > >  				break;
> > >  			}
> > >  
> > > -			cell += (FDT_PCI_ADDR_CELLS +
> > > -				 FDT_PCI_SIZE_CELLS);
> > > +			cell += FDT_PCI_ADDR_CELLS + FDT_PCI_SIZE_CELLS;
> > >  		}
> > >  
> > >  		if (i == num) {
> > > diff --git a/drivers/core/read.c b/drivers/core/read.c
> > > index 49066b59cda..419013451f0 100644
> > > --- a/drivers/core/read.c
> > > +++ b/drivers/core/read.c
> > > @@ -405,13 +405,15 @@ int dev_read_alias_highest_id(const char *stem)
> > >  	return fdtdec_get_alias_highest_id(gd->fdt_blob, stem);
> > >  }
> > >  
> > > -fdt_addr_t dev_read_addr_pci(const struct udevice *dev)
> > > +fdt_addr_t dev_read_addr_pci(const struct udevice *dev, fdt_size_t *sizep)
> > >  {
> > >  	ulong addr;
> > >  
> > >  	addr = dev_read_addr(dev);
> > > +	if (sizep)
> > > +		*sizep = 0;
> > >  	if (addr == FDT_ADDR_T_NONE && !of_live_active())
> > > -		addr = devfdt_get_addr_pci(dev);
> > > +		addr = devfdt_get_addr_pci(dev, sizep);
> > >  
> > >  	return addr;
> > >  }
> > > diff --git a/drivers/core/util.c b/drivers/core/util.c
> > > index aa60fdd15bc..81497df85ff 100644
> > > --- a/drivers/core/util.c
> > > +++ b/drivers/core/util.c
> > > @@ -30,7 +30,7 @@ int pci_get_devfn(struct udevice *dev)
> > >  
> > >  	/* Extract the devfn from fdt_pci_addr */
> > >  	ret = ofnode_read_pci_addr(dev_ofnode(dev), FDT_PCI_SPACE_CONFIG,
> > > -				   "reg", &addr);
> > > +				   "reg", &addr, NULL);
> > >  	if (ret) {
> > >  		if (ret != -ENOENT)
> > >  			return -EINVAL;
> > > diff --git a/drivers/pci/pci-uclass.c b/drivers/pci/pci-uclass.c
> > > index 0adcdceb1d3..c670f8754e8 100644
> > > --- a/drivers/pci/pci-uclass.c
> > > +++ b/drivers/pci/pci-uclass.c
> > > @@ -122,7 +122,7 @@ static void pci_dev_find_ofnode(struct udevice *bus, phys_addr_t bdf,
> > >  
> > >  	dev_for_each_subnode(node, bus) {
> > >  		ret = ofnode_read_pci_addr(node, FDT_PCI_SPACE_CONFIG, "reg",
> > > -					   &addr);
> > > +					   &addr, NULL);
> > >  		if (ret)
> > >  			continue;
> > >  
> > > diff --git a/drivers/pci/pci_mvebu.c b/drivers/pci/pci_mvebu.c
> > > index 93a7508d8a2..25878bde534 100644
> > > --- a/drivers/pci/pci_mvebu.c
> > > +++ b/drivers/pci/pci_mvebu.c
> > > @@ -640,7 +640,8 @@ static int mvebu_pcie_port_parse_dt(ofnode node, ofnode parent, struct mvebu_pci
> > >  		pcie->is_x4 = true;
> > >  
> > >  	/* devfn is in bits [15:8], see PCI_DEV usage */
> > > -	ret = ofnode_read_pci_addr(node, FDT_PCI_SPACE_CONFIG, "reg", &pci_addr);
> > > +	ret = ofnode_read_pci_addr(node, FDT_PCI_SPACE_CONFIG, "reg", &pci_addr,
> > > +				   NULL);
> > >  	if (ret < 0) {
> > >  		printf("%s: property \"reg\" is invalid\n", pcie->name);
> > >  		goto err;
> > > diff --git a/drivers/pci/pci_tegra.c b/drivers/pci/pci_tegra.c
> > > index 29d54117e93..ae90bd2fbf1 100644
> > > --- a/drivers/pci/pci_tegra.c
> > > +++ b/drivers/pci/pci_tegra.c
> > > @@ -461,7 +461,7 @@ static int tegra_pcie_parse_port_info(ofnode node, uint *index, uint *lanes)
> > >  
> > >  	*lanes = err;
> > >  
> > > -	err = ofnode_read_pci_addr(node, 0, "reg", &addr);
> > > +	err = ofnode_read_pci_addr(node, 0, "reg", &addr, NULL);
> > >  	if (err < 0) {
> > >  		pr_err("failed to parse \"reg\" property\n");
> > >  		return err;
> > > diff --git a/drivers/pci/pcie_mediatek.c b/drivers/pci/pcie_mediatek.c
> > > index c6e30e24622..e59ebd13ad0 100644
> > > --- a/drivers/pci/pcie_mediatek.c
> > > +++ b/drivers/pci/pcie_mediatek.c
> > > @@ -660,7 +660,7 @@ static int mtk_pcie_probe(struct udevice *dev)
> > >  		if (!ofnode_is_enabled(subnode))
> > >  			continue;
> > >  
> > > -		err = ofnode_read_pci_addr(subnode, 0, "reg", &addr);
> > > +		err = ofnode_read_pci_addr(subnode, 0, "reg", &addr, NULL);
> > >  		if (err)
> > >  			return err;
> > >  
> > > @@ -699,7 +699,7 @@ static int mtk_pcie_probe_v2(struct udevice *dev)
> > >  		if (!ofnode_is_enabled(subnode))
> > >  			continue;
> > >  
> > > -		err = ofnode_read_pci_addr(subnode, 0, "reg", &addr);
> > > +		err = ofnode_read_pci_addr(subnode, 0, "reg", &addr, NULL);
> > >  		if (err)
> > >  			return err;
> > >  
> > > diff --git a/drivers/serial/ns16550.c b/drivers/serial/ns16550.c
> > > index eab9537fbae..a349e5e132a 100644
> > > --- a/drivers/serial/ns16550.c
> > > +++ b/drivers/serial/ns16550.c
> > > @@ -479,6 +479,7 @@ static int ns16550_serial_getinfo(struct udevice *dev,
> > >  	info->addr_space = SERIAL_ADDRESS_SPACE_MEMORY;
> > >  #endif
> > >  	info->addr = plat->base;
> > > +	info->size = plat->size;
> > >  	info->reg_width = plat->reg_width;
> > >  	info->reg_shift = plat->reg_shift;
> > >  	info->reg_offset = plat->reg_offset;
> > > @@ -487,7 +488,8 @@ static int ns16550_serial_getinfo(struct udevice *dev,
> > >  	return 0;
> > >  }
> > >  
> > > -static int ns16550_serial_assign_base(struct ns16550_plat *plat, fdt_addr_t base)
> > > +static int ns16550_serial_assign_base(struct ns16550_plat *plat,
> > > +				      fdt_addr_t base, fdt_size_t size)
> > >  {
> > >  	if (base == FDT_ADDR_T_NONE)
> > >  		return -EINVAL;
> > > @@ -497,6 +499,7 @@ static int ns16550_serial_assign_base(struct ns16550_plat *plat, fdt_addr_t base
> > >  #else
> > >  	plat->base = (unsigned long)map_physmem(base, 0, MAP_NOCACHE);
> > >  #endif
> > > +	plat->size = size;
> > >  
> > >  	return 0;
> > >  }
> > > @@ -507,6 +510,7 @@ int ns16550_serial_probe(struct udevice *dev)
> > >  	struct ns16550 *const com_port = dev_get_priv(dev);
> > >  	struct reset_ctl_bulk reset_bulk;
> > >  	fdt_addr_t addr;
> > > +	fdt_addr_t size;
> > >  	int ret;
> > >  
> > >  	/*
> > > @@ -514,8 +518,8 @@ int ns16550_serial_probe(struct udevice *dev)
> > >  	 * or via a PCI bridge, assign plat->base before probing hardware.
> > >  	 */
> > >  	if (device_is_on_pci_bus(dev)) {
> > > -		addr = devfdt_get_addr_pci(dev);
> > > -		ret = ns16550_serial_assign_base(plat, addr);
> > > +		addr = devfdt_get_addr_pci(dev, &size);
> > > +		ret = ns16550_serial_assign_base(plat, addr, size);
> > >  		if (ret)
> > >  			return ret;
> > >  	}
> > > @@ -543,11 +547,12 @@ int ns16550_serial_of_to_plat(struct udevice *dev)
> > >  	struct ns16550_plat *plat = dev_get_plat(dev);
> > >  	const u32 port_type = dev_get_driver_data(dev);
> > >  	fdt_addr_t addr;
> > > +	fdt_size_t size;
> > >  	struct clk clk;
> > >  	int err;
> > >  
> > > -	addr = dev_read_addr(dev);
> > > -	err = ns16550_serial_assign_base(plat, addr);
> > > +	addr = dev_read_addr_size(dev, &size);
> > > +	err = ns16550_serial_assign_base(plat, addr, size);
> > >  	if (err && !device_is_on_pci_bus(dev))
> > >  		return err;
> > >  
> > > diff --git a/include/dm/fdtaddr.h b/include/dm/fdtaddr.h
> > > index dcdc19137cc..6d2fa8f1044 100644
> > > --- a/include/dm/fdtaddr.h
> > > +++ b/include/dm/fdtaddr.h
> > > @@ -168,8 +168,9 @@ fdt_addr_t devfdt_get_addr_size_name(const struct udevice *dev,
> > >   * devfdt_get_addr_pci() - Read an address and handle PCI address translation
> > >   *
> > >   * @dev: Device to read from
> > > + * @sizep: If non-NULL, returns size of address space
> > >   * Return: address or FDT_ADDR_T_NONE if not found
> > >   */
> > > -fdt_addr_t devfdt_get_addr_pci(const struct udevice *dev);
> > > +fdt_addr_t devfdt_get_addr_pci(const struct udevice *dev, fdt_size_t *sizep);
> > >  
> > >  #endif
> > > diff --git a/include/dm/ofnode.h b/include/dm/ofnode.h
> > > index 726d8f82ddf..97cad971611 100644
> > > --- a/include/dm/ofnode.h
> > > +++ b/include/dm/ofnode.h
> > > @@ -1152,13 +1152,15 @@ const uint8_t *ofnode_read_u8_array_ptr(ofnode node, const char *propname,
> > >   * @type:	pci address type (FDT_PCI_SPACE_xxx)
> > >   * @propname:	name of property to find
> > >   * @addr:	returns pci address in the form of fdt_pci_addr
> > > + * @size:	if non-null, returns register-space size
> > >   * Return:
> > >   * 0 if ok, -ENOENT if the property did not exist, -EINVAL if the
> > >   * format of the property was invalid, -ENXIO if the requested
> > >   * address type was not found
> > >   */
> > >  int ofnode_read_pci_addr(ofnode node, enum fdt_pci_space type,
> > > -			 const char *propname, struct fdt_pci_addr *addr);
> > > +			 const char *propname, struct fdt_pci_addr *addr,
> > > +			 fdt_size_t *size);
> > >  
> > >  /**
> > >   * ofnode_read_pci_vendev() - look up PCI vendor and device id
> > > diff --git a/include/dm/read.h b/include/dm/read.h
> > > index c2615f72f40..3c2eea6f0c4 100644
> > > --- a/include/dm/read.h
> > > +++ b/include/dm/read.h
> > > @@ -346,9 +346,10 @@ void *dev_read_addr_ptr(const struct udevice *dev);
> > >   *    fdtdec_get_addr() and friends.
> > >   *
> > >   * @dev: Device to read from
> > > + * @sizep: If non-NULL, returns size of address space found
> > >   * Return: address or FDT_ADDR_T_NONE if not found
> > >   */
> > > -fdt_addr_t dev_read_addr_pci(const struct udevice *dev);
> > > +fdt_addr_t dev_read_addr_pci(const struct udevice *dev, fdt_size_t *sizep);
> > >  
> > >  /**
> > >   * dev_remap_addr() - Get the reg property of a device as a
> > > @@ -996,9 +997,10 @@ static inline void *dev_read_addr_ptr(const struct udevice *dev)
> > >  	return devfdt_get_addr_ptr(dev);
> > >  }
> > >  
> > > -static inline fdt_addr_t dev_read_addr_pci(const struct udevice *dev)
> > > +static inline fdt_addr_t dev_read_addr_pci(const struct udevice *dev,
> > > +					   fdt_size_t *sizep)
> > >  {
> > > -	return devfdt_get_addr_pci(dev);
> > > +	return devfdt_get_addr_pci(dev, sizep);
> > >  }
> > >  
> > >  static inline void *dev_remap_addr(const struct udevice *dev)
> > > diff --git a/include/ns16550.h b/include/ns16550.h
> > > index e7e68663d03..7f481300083 100644
> > > --- a/include/ns16550.h
> > > +++ b/include/ns16550.h
> > > @@ -58,6 +58,7 @@ enum ns16550_flags {
> > >   * struct ns16550_plat - information about a NS16550 port
> > >   *
> > >   * @base:		Base register address
> > > + * @size:		Size of register area in bytes
> > >   * @reg_width:		IO accesses size of registers (in bytes, 1 or 4)
> > >   * @reg_shift:		Shift size of registers (0=byte, 1=16bit, 2=32bit...)
> > >   * @reg_offset:		Offset to start of registers (normally 0)
> > > @@ -67,7 +68,8 @@ enum ns16550_flags {
> > >   * @bdf:		PCI slot/function (pci_dev_t)
> > >   */
> > >  struct ns16550_plat {
> > > -	unsigned long base;
> > > +	ulong base;
> > > +	ulong size;
> > >  	int reg_width;
> > >  	int reg_shift;
> > >  	int reg_offset;
> > > diff --git a/include/serial.h b/include/serial.h
> > > index 42bdf3759c0..205889d28be 100644
> > > --- a/include/serial.h
> > > +++ b/include/serial.h
> > > @@ -137,6 +137,7 @@ enum adr_space_type {
> > >   * @type:	type of the UART chip
> > >   * @addr_space:	address space to access the registers
> > >   * @addr:	physical address of the registers
> > > + * @size:	size of the register area in bytes
> > >   * @reg_width:	size (in bytes) of the IO accesses to the registers
> > >   * @reg_offset:	offset to apply to the @addr from the start of the registers
> > >   * @reg_shift:	quantity to shift the register offsets by
> > > @@ -147,6 +148,7 @@ struct serial_device_info {
> > >  	enum serial_chip_type type;
> > >  	enum adr_space_type addr_space;
> > >  	ulong addr;
> > > +	ulong size;
> > >  	u8 reg_width;
> > >  	u8 reg_offset;
> > >  	u8 reg_shift;
> > > diff --git a/test/dm/pci.c b/test/dm/pci.c
> > > index 70a736cfdb8..8c5e7da9e62 100644
> > > --- a/test/dm/pci.c
> > > +++ b/test/dm/pci.c
> > > @@ -301,10 +301,12 @@ static int dm_test_pci_addr_flat(struct unit_test_state *uts)
> > >  {
> > >  	struct udevice *swap1f, *swap1;
> > >  	ulong io_addr, mem_addr;
> > > +	fdt_addr_t size;
> > >  
> > >  	ut_assertok(dm_pci_bus_find_bdf(PCI_BDF(0, 0x1f, 0), &swap1f));
> > >  	io_addr = dm_pci_read_bar32(swap1f, 0);
> > > -	ut_asserteq(io_addr, dev_read_addr_pci(swap1f));
> > > +	ut_asserteq(io_addr, dev_read_addr_pci(swap1f, &size));
> > > +	ut_asserteq(0, size);
> > >  
> > >  	/*
> > >  	 * This device has both I/O and MEM spaces but the MEM space appears
> > > @@ -312,7 +314,8 @@ static int dm_test_pci_addr_flat(struct unit_test_state *uts)
> > >  	 */
> > >  	ut_assertok(dm_pci_bus_find_bdf(PCI_BDF(0, 0x1, 0), &swap1));
> > >  	mem_addr = dm_pci_read_bar32(swap1, 1);
> > > -	ut_asserteq(mem_addr, dev_read_addr_pci(swap1));
> > > +	ut_asserteq(mem_addr, dev_read_addr_pci(swap1, &size));
> > > +	ut_asserteq(0, size);
> > >  
> > >  	return 0;
> > >  }
> > > @@ -329,12 +332,15 @@ DM_TEST(dm_test_pci_addr_flat, UT_TESTF_SCAN_PDATA | UT_TESTF_SCAN_FDT |
> > >  static int dm_test_pci_addr_live(struct unit_test_state *uts)
> > >  {
> > >  	struct udevice *swap1f, *swap1;
> > > +	fdt_size_t size;
> > >  
> > >  	ut_assertok(dm_pci_bus_find_bdf(PCI_BDF(0, 0x1f, 0), &swap1f));
> > > -	ut_asserteq_64(FDT_ADDR_T_NONE, dev_read_addr_pci(swap1f));
> > > +	ut_asserteq_64(FDT_ADDR_T_NONE, dev_read_addr_pci(swap1f, &size));
> > > +	ut_asserteq(0, size);
> > >  
> > >  	ut_assertok(dm_pci_bus_find_bdf(PCI_BDF(0, 0x1, 0), &swap1));
> > > -	ut_asserteq_64(FDT_ADDR_T_NONE, dev_read_addr_pci(swap1));
> > > +	ut_asserteq_64(FDT_ADDR_T_NONE, dev_read_addr_pci(swap1, &size));
> > > +	ut_asserteq(0, size);
> > >  
> > >  	return 0;
> > >  }
> > > -- 
> > > 2.42.0.rc2.253.gd59a3bf2b4-goog
> > > 
> 
> -- 
> Tom



^ permalink raw reply	[flat|nested] 86+ messages in thread

* Re: [PATCH 32/32] pci: serial: Support reading PCI-register size with base
  2023-08-30 18:39       ` Pali Rohár
@ 2023-08-30 19:04         ` Tom Rini
  2023-08-30 19:10           ` Pali Rohár
  0 siblings, 1 reply; 86+ messages in thread
From: Tom Rini @ 2023-08-30 19:04 UTC (permalink / raw)
  To: Pali Rohár
  Cc: Simon Glass, U-Boot Mailing List, Marek Vasut,
	Abdellatif El Khlifi, Andre Przywara, Bin Meng, Chunfeng Yun,
	Dzmitry Sankouski, GSS_MTK_Uboot_upstream, Heinrich Schuchardt,
	Ilias Apalodimas, Michal Simek, Michal Suchanek, Nikhil M Jain,
	Ryder Lee, Stefan Roese, Weijie Gao

[-- Attachment #1: Type: text/plain, Size: 20047 bytes --]

You're a listed maintainer for a file being changed. If you objected to
the changes, your objection would matter.  If you don't object, you can
just ignore it, or review it, whatever you like.  You need to decide
what you want to do about code you're volunteering to maintain.

On Wed, Aug 30, 2023 at 08:39:13PM +0200, Pali Rohár wrote:
> And what? How it is related to the statements that my reviews would also
> ignored? And what you want from me now?
> 
> On Wednesday 30 August 2023 14:17:50 Tom Rini wrote:
> > Pali,
> > 
> > You are specifically listed as a maintainer for drivers/pci/pci_mvebu.c
> > and that is changed by this patch.
> > 
> > On Wed, Aug 30, 2023 at 08:14:59PM +0200, Pali Rohár wrote:
> > > Simon, why you are contacting me? You have wrote to me that you would
> > > ignore my reviews here, so what you want now? Could you please explain
> > > what you are trying to achieve? I'm not going to review this or any
> > > other your changes.
> > > 
> > > On Wednesday 30 August 2023 12:05:03 Simon Glass wrote:
> > > > The PCI helpers read only the base address for a PCI region. In some cases
> > > > the size is needed as well, e.g. to pass along to a driver which needs to
> > > > know the size of its register area.
> > > > 
> > > > Update the functions to allow the size to be returned. For serial, record
> > > > the information and provided it with the serial_info() call.
> > > > 
> > > > A limitation still exists in that the size is not available when OF_LIVE
> > > > is enabled, so take account of that in the tests.
> > > > 
> > > > Signed-off-by: Simon Glass <sjg@chromium.org>
> > > > ---
> > > > 
> > > >  arch/sandbox/dts/test.dts   |  6 +++---
> > > >  drivers/core/fdtaddr.c      |  6 +++---
> > > >  drivers/core/ofnode.c       | 11 ++++++++---
> > > >  drivers/core/read.c         |  6 ++++--
> > > >  drivers/core/util.c         |  2 +-
> > > >  drivers/pci/pci-uclass.c    |  2 +-
> > > >  drivers/pci/pci_mvebu.c     |  3 ++-
> > > >  drivers/pci/pci_tegra.c     |  2 +-
> > > >  drivers/pci/pcie_mediatek.c |  4 ++--
> > > >  drivers/serial/ns16550.c    | 15 ++++++++++-----
> > > >  include/dm/fdtaddr.h        |  3 ++-
> > > >  include/dm/ofnode.h         |  4 +++-
> > > >  include/dm/read.h           |  8 +++++---
> > > >  include/ns16550.h           |  4 +++-
> > > >  include/serial.h            |  2 ++
> > > >  test/dm/pci.c               | 14 ++++++++++----
> > > >  16 files changed, 60 insertions(+), 32 deletions(-)
> > > > 
> > > > diff --git a/arch/sandbox/dts/test.dts b/arch/sandbox/dts/test.dts
> > > > index a413cbe4989..961e8895a49 100644
> > > > --- a/arch/sandbox/dts/test.dts
> > > > +++ b/arch/sandbox/dts/test.dts
> > > > @@ -1087,8 +1087,8 @@
> > > >  		pci@1,0 {
> > > >  			compatible = "pci-generic";
> > > >  			/* reg 0 is at 0x14, using FDT_PCI_SPACE_MEM32 */
> > > > -			reg = <0x02000814 0 0 0 0
> > > > -			       0x01000810 0 0 0 0>;
> > > > +			reg = <0x02000814 0 0 0x80 0
> > > > +			       0x01000810 0 0 0xc0 0>;
> > > >  			sandbox,emul = <&swap_case_emul0_1>;
> > > >  		};
> > > >  		p2sb-pci@2,0 {
> > > > @@ -1115,7 +1115,7 @@
> > > >  		pci@1f,0 {
> > > >  			compatible = "pci-generic";
> > > >  			/* reg 0 is at 0x10, using FDT_PCI_SPACE_IO */
> > > > -			reg = <0x0100f810 0 0 0 0>;
> > > > +			reg = <0x0100f810 0 0 0x100 0>;
> > > >  			sandbox,emul = <&swap_case_emul0_1f>;
> > > >  		};
> > > >  	};
> > > > diff --git a/drivers/core/fdtaddr.c b/drivers/core/fdtaddr.c
> > > > index 546db675aaf..b79d138c419 100644
> > > > --- a/drivers/core/fdtaddr.c
> > > > +++ b/drivers/core/fdtaddr.c
> > > > @@ -215,7 +215,7 @@ void *devfdt_map_physmem(const struct udevice *dev, unsigned long size)
> > > >  	return map_physmem(addr, size, MAP_NOCACHE);
> > > >  }
> > > >  
> > > > -fdt_addr_t devfdt_get_addr_pci(const struct udevice *dev)
> > > > +fdt_addr_t devfdt_get_addr_pci(const struct udevice *dev, fdt_size_t *sizep)
> > > >  {
> > > >  	ulong addr;
> > > >  
> > > > @@ -226,12 +226,12 @@ fdt_addr_t devfdt_get_addr_pci(const struct udevice *dev)
> > > >  		int ret;
> > > >  
> > > >  		ret = ofnode_read_pci_addr(dev_ofnode(dev), FDT_PCI_SPACE_MEM32,
> > > > -					   "reg", &pci_addr);
> > > > +					   "reg", &pci_addr, sizep);
> > > >  		if (ret) {
> > > >  			/* try if there is any i/o-mapped register */
> > > >  			ret = ofnode_read_pci_addr(dev_ofnode(dev),
> > > >  						   FDT_PCI_SPACE_IO, "reg",
> > > > -						   &pci_addr);
> > > > +						   &pci_addr, sizep);
> > > >  			if (ret)
> > > >  				return FDT_ADDR_T_NONE;
> > > >  		}
> > > > diff --git a/drivers/core/ofnode.c b/drivers/core/ofnode.c
> > > > index 2ef4114cb6f..c9cec456f43 100644
> > > > --- a/drivers/core/ofnode.c
> > > > +++ b/drivers/core/ofnode.c
> > > > @@ -1270,7 +1270,8 @@ const uint8_t *ofnode_read_u8_array_ptr(ofnode node, const char *propname,
> > > >  }
> > > >  
> > > >  int ofnode_read_pci_addr(ofnode node, enum fdt_pci_space type,
> > > > -			 const char *propname, struct fdt_pci_addr *addr)
> > > > +			 const char *propname, struct fdt_pci_addr *addr,
> > > > +			 fdt_size_t *size)
> > > >  {
> > > >  	const fdt32_t *cell;
> > > >  	int len;
> > > > @@ -1298,14 +1299,18 @@ int ofnode_read_pci_addr(ofnode node, enum fdt_pci_space type,
> > > >  			      (ulong)fdt32_to_cpu(cell[1]),
> > > >  			      (ulong)fdt32_to_cpu(cell[2]));
> > > >  			if ((fdt32_to_cpu(*cell) & type) == type) {
> > > > +				const unaligned_fdt64_t *ptr;
> > > > +
> > > >  				addr->phys_hi = fdt32_to_cpu(cell[0]);
> > > >  				addr->phys_mid = fdt32_to_cpu(cell[1]);
> > > >  				addr->phys_lo = fdt32_to_cpu(cell[2]);
> > > > +				ptr = (const unaligned_fdt64_t *)(cell + 3);
> > > > +				if (size)
> > > > +					*size = fdt64_to_cpu(*ptr);
> > > >  				break;
> > > >  			}
> > > >  
> > > > -			cell += (FDT_PCI_ADDR_CELLS +
> > > > -				 FDT_PCI_SIZE_CELLS);
> > > > +			cell += FDT_PCI_ADDR_CELLS + FDT_PCI_SIZE_CELLS;
> > > >  		}
> > > >  
> > > >  		if (i == num) {
> > > > diff --git a/drivers/core/read.c b/drivers/core/read.c
> > > > index 49066b59cda..419013451f0 100644
> > > > --- a/drivers/core/read.c
> > > > +++ b/drivers/core/read.c
> > > > @@ -405,13 +405,15 @@ int dev_read_alias_highest_id(const char *stem)
> > > >  	return fdtdec_get_alias_highest_id(gd->fdt_blob, stem);
> > > >  }
> > > >  
> > > > -fdt_addr_t dev_read_addr_pci(const struct udevice *dev)
> > > > +fdt_addr_t dev_read_addr_pci(const struct udevice *dev, fdt_size_t *sizep)
> > > >  {
> > > >  	ulong addr;
> > > >  
> > > >  	addr = dev_read_addr(dev);
> > > > +	if (sizep)
> > > > +		*sizep = 0;
> > > >  	if (addr == FDT_ADDR_T_NONE && !of_live_active())
> > > > -		addr = devfdt_get_addr_pci(dev);
> > > > +		addr = devfdt_get_addr_pci(dev, sizep);
> > > >  
> > > >  	return addr;
> > > >  }
> > > > diff --git a/drivers/core/util.c b/drivers/core/util.c
> > > > index aa60fdd15bc..81497df85ff 100644
> > > > --- a/drivers/core/util.c
> > > > +++ b/drivers/core/util.c
> > > > @@ -30,7 +30,7 @@ int pci_get_devfn(struct udevice *dev)
> > > >  
> > > >  	/* Extract the devfn from fdt_pci_addr */
> > > >  	ret = ofnode_read_pci_addr(dev_ofnode(dev), FDT_PCI_SPACE_CONFIG,
> > > > -				   "reg", &addr);
> > > > +				   "reg", &addr, NULL);
> > > >  	if (ret) {
> > > >  		if (ret != -ENOENT)
> > > >  			return -EINVAL;
> > > > diff --git a/drivers/pci/pci-uclass.c b/drivers/pci/pci-uclass.c
> > > > index 0adcdceb1d3..c670f8754e8 100644
> > > > --- a/drivers/pci/pci-uclass.c
> > > > +++ b/drivers/pci/pci-uclass.c
> > > > @@ -122,7 +122,7 @@ static void pci_dev_find_ofnode(struct udevice *bus, phys_addr_t bdf,
> > > >  
> > > >  	dev_for_each_subnode(node, bus) {
> > > >  		ret = ofnode_read_pci_addr(node, FDT_PCI_SPACE_CONFIG, "reg",
> > > > -					   &addr);
> > > > +					   &addr, NULL);
> > > >  		if (ret)
> > > >  			continue;
> > > >  
> > > > diff --git a/drivers/pci/pci_mvebu.c b/drivers/pci/pci_mvebu.c
> > > > index 93a7508d8a2..25878bde534 100644
> > > > --- a/drivers/pci/pci_mvebu.c
> > > > +++ b/drivers/pci/pci_mvebu.c
> > > > @@ -640,7 +640,8 @@ static int mvebu_pcie_port_parse_dt(ofnode node, ofnode parent, struct mvebu_pci
> > > >  		pcie->is_x4 = true;
> > > >  
> > > >  	/* devfn is in bits [15:8], see PCI_DEV usage */
> > > > -	ret = ofnode_read_pci_addr(node, FDT_PCI_SPACE_CONFIG, "reg", &pci_addr);
> > > > +	ret = ofnode_read_pci_addr(node, FDT_PCI_SPACE_CONFIG, "reg", &pci_addr,
> > > > +				   NULL);
> > > >  	if (ret < 0) {
> > > >  		printf("%s: property \"reg\" is invalid\n", pcie->name);
> > > >  		goto err;
> > > > diff --git a/drivers/pci/pci_tegra.c b/drivers/pci/pci_tegra.c
> > > > index 29d54117e93..ae90bd2fbf1 100644
> > > > --- a/drivers/pci/pci_tegra.c
> > > > +++ b/drivers/pci/pci_tegra.c
> > > > @@ -461,7 +461,7 @@ static int tegra_pcie_parse_port_info(ofnode node, uint *index, uint *lanes)
> > > >  
> > > >  	*lanes = err;
> > > >  
> > > > -	err = ofnode_read_pci_addr(node, 0, "reg", &addr);
> > > > +	err = ofnode_read_pci_addr(node, 0, "reg", &addr, NULL);
> > > >  	if (err < 0) {
> > > >  		pr_err("failed to parse \"reg\" property\n");
> > > >  		return err;
> > > > diff --git a/drivers/pci/pcie_mediatek.c b/drivers/pci/pcie_mediatek.c
> > > > index c6e30e24622..e59ebd13ad0 100644
> > > > --- a/drivers/pci/pcie_mediatek.c
> > > > +++ b/drivers/pci/pcie_mediatek.c
> > > > @@ -660,7 +660,7 @@ static int mtk_pcie_probe(struct udevice *dev)
> > > >  		if (!ofnode_is_enabled(subnode))
> > > >  			continue;
> > > >  
> > > > -		err = ofnode_read_pci_addr(subnode, 0, "reg", &addr);
> > > > +		err = ofnode_read_pci_addr(subnode, 0, "reg", &addr, NULL);
> > > >  		if (err)
> > > >  			return err;
> > > >  
> > > > @@ -699,7 +699,7 @@ static int mtk_pcie_probe_v2(struct udevice *dev)
> > > >  		if (!ofnode_is_enabled(subnode))
> > > >  			continue;
> > > >  
> > > > -		err = ofnode_read_pci_addr(subnode, 0, "reg", &addr);
> > > > +		err = ofnode_read_pci_addr(subnode, 0, "reg", &addr, NULL);
> > > >  		if (err)
> > > >  			return err;
> > > >  
> > > > diff --git a/drivers/serial/ns16550.c b/drivers/serial/ns16550.c
> > > > index eab9537fbae..a349e5e132a 100644
> > > > --- a/drivers/serial/ns16550.c
> > > > +++ b/drivers/serial/ns16550.c
> > > > @@ -479,6 +479,7 @@ static int ns16550_serial_getinfo(struct udevice *dev,
> > > >  	info->addr_space = SERIAL_ADDRESS_SPACE_MEMORY;
> > > >  #endif
> > > >  	info->addr = plat->base;
> > > > +	info->size = plat->size;
> > > >  	info->reg_width = plat->reg_width;
> > > >  	info->reg_shift = plat->reg_shift;
> > > >  	info->reg_offset = plat->reg_offset;
> > > > @@ -487,7 +488,8 @@ static int ns16550_serial_getinfo(struct udevice *dev,
> > > >  	return 0;
> > > >  }
> > > >  
> > > > -static int ns16550_serial_assign_base(struct ns16550_plat *plat, fdt_addr_t base)
> > > > +static int ns16550_serial_assign_base(struct ns16550_plat *plat,
> > > > +				      fdt_addr_t base, fdt_size_t size)
> > > >  {
> > > >  	if (base == FDT_ADDR_T_NONE)
> > > >  		return -EINVAL;
> > > > @@ -497,6 +499,7 @@ static int ns16550_serial_assign_base(struct ns16550_plat *plat, fdt_addr_t base
> > > >  #else
> > > >  	plat->base = (unsigned long)map_physmem(base, 0, MAP_NOCACHE);
> > > >  #endif
> > > > +	plat->size = size;
> > > >  
> > > >  	return 0;
> > > >  }
> > > > @@ -507,6 +510,7 @@ int ns16550_serial_probe(struct udevice *dev)
> > > >  	struct ns16550 *const com_port = dev_get_priv(dev);
> > > >  	struct reset_ctl_bulk reset_bulk;
> > > >  	fdt_addr_t addr;
> > > > +	fdt_addr_t size;
> > > >  	int ret;
> > > >  
> > > >  	/*
> > > > @@ -514,8 +518,8 @@ int ns16550_serial_probe(struct udevice *dev)
> > > >  	 * or via a PCI bridge, assign plat->base before probing hardware.
> > > >  	 */
> > > >  	if (device_is_on_pci_bus(dev)) {
> > > > -		addr = devfdt_get_addr_pci(dev);
> > > > -		ret = ns16550_serial_assign_base(plat, addr);
> > > > +		addr = devfdt_get_addr_pci(dev, &size);
> > > > +		ret = ns16550_serial_assign_base(plat, addr, size);
> > > >  		if (ret)
> > > >  			return ret;
> > > >  	}
> > > > @@ -543,11 +547,12 @@ int ns16550_serial_of_to_plat(struct udevice *dev)
> > > >  	struct ns16550_plat *plat = dev_get_plat(dev);
> > > >  	const u32 port_type = dev_get_driver_data(dev);
> > > >  	fdt_addr_t addr;
> > > > +	fdt_size_t size;
> > > >  	struct clk clk;
> > > >  	int err;
> > > >  
> > > > -	addr = dev_read_addr(dev);
> > > > -	err = ns16550_serial_assign_base(plat, addr);
> > > > +	addr = dev_read_addr_size(dev, &size);
> > > > +	err = ns16550_serial_assign_base(plat, addr, size);
> > > >  	if (err && !device_is_on_pci_bus(dev))
> > > >  		return err;
> > > >  
> > > > diff --git a/include/dm/fdtaddr.h b/include/dm/fdtaddr.h
> > > > index dcdc19137cc..6d2fa8f1044 100644
> > > > --- a/include/dm/fdtaddr.h
> > > > +++ b/include/dm/fdtaddr.h
> > > > @@ -168,8 +168,9 @@ fdt_addr_t devfdt_get_addr_size_name(const struct udevice *dev,
> > > >   * devfdt_get_addr_pci() - Read an address and handle PCI address translation
> > > >   *
> > > >   * @dev: Device to read from
> > > > + * @sizep: If non-NULL, returns size of address space
> > > >   * Return: address or FDT_ADDR_T_NONE if not found
> > > >   */
> > > > -fdt_addr_t devfdt_get_addr_pci(const struct udevice *dev);
> > > > +fdt_addr_t devfdt_get_addr_pci(const struct udevice *dev, fdt_size_t *sizep);
> > > >  
> > > >  #endif
> > > > diff --git a/include/dm/ofnode.h b/include/dm/ofnode.h
> > > > index 726d8f82ddf..97cad971611 100644
> > > > --- a/include/dm/ofnode.h
> > > > +++ b/include/dm/ofnode.h
> > > > @@ -1152,13 +1152,15 @@ const uint8_t *ofnode_read_u8_array_ptr(ofnode node, const char *propname,
> > > >   * @type:	pci address type (FDT_PCI_SPACE_xxx)
> > > >   * @propname:	name of property to find
> > > >   * @addr:	returns pci address in the form of fdt_pci_addr
> > > > + * @size:	if non-null, returns register-space size
> > > >   * Return:
> > > >   * 0 if ok, -ENOENT if the property did not exist, -EINVAL if the
> > > >   * format of the property was invalid, -ENXIO if the requested
> > > >   * address type was not found
> > > >   */
> > > >  int ofnode_read_pci_addr(ofnode node, enum fdt_pci_space type,
> > > > -			 const char *propname, struct fdt_pci_addr *addr);
> > > > +			 const char *propname, struct fdt_pci_addr *addr,
> > > > +			 fdt_size_t *size);
> > > >  
> > > >  /**
> > > >   * ofnode_read_pci_vendev() - look up PCI vendor and device id
> > > > diff --git a/include/dm/read.h b/include/dm/read.h
> > > > index c2615f72f40..3c2eea6f0c4 100644
> > > > --- a/include/dm/read.h
> > > > +++ b/include/dm/read.h
> > > > @@ -346,9 +346,10 @@ void *dev_read_addr_ptr(const struct udevice *dev);
> > > >   *    fdtdec_get_addr() and friends.
> > > >   *
> > > >   * @dev: Device to read from
> > > > + * @sizep: If non-NULL, returns size of address space found
> > > >   * Return: address or FDT_ADDR_T_NONE if not found
> > > >   */
> > > > -fdt_addr_t dev_read_addr_pci(const struct udevice *dev);
> > > > +fdt_addr_t dev_read_addr_pci(const struct udevice *dev, fdt_size_t *sizep);
> > > >  
> > > >  /**
> > > >   * dev_remap_addr() - Get the reg property of a device as a
> > > > @@ -996,9 +997,10 @@ static inline void *dev_read_addr_ptr(const struct udevice *dev)
> > > >  	return devfdt_get_addr_ptr(dev);
> > > >  }
> > > >  
> > > > -static inline fdt_addr_t dev_read_addr_pci(const struct udevice *dev)
> > > > +static inline fdt_addr_t dev_read_addr_pci(const struct udevice *dev,
> > > > +					   fdt_size_t *sizep)
> > > >  {
> > > > -	return devfdt_get_addr_pci(dev);
> > > > +	return devfdt_get_addr_pci(dev, sizep);
> > > >  }
> > > >  
> > > >  static inline void *dev_remap_addr(const struct udevice *dev)
> > > > diff --git a/include/ns16550.h b/include/ns16550.h
> > > > index e7e68663d03..7f481300083 100644
> > > > --- a/include/ns16550.h
> > > > +++ b/include/ns16550.h
> > > > @@ -58,6 +58,7 @@ enum ns16550_flags {
> > > >   * struct ns16550_plat - information about a NS16550 port
> > > >   *
> > > >   * @base:		Base register address
> > > > + * @size:		Size of register area in bytes
> > > >   * @reg_width:		IO accesses size of registers (in bytes, 1 or 4)
> > > >   * @reg_shift:		Shift size of registers (0=byte, 1=16bit, 2=32bit...)
> > > >   * @reg_offset:		Offset to start of registers (normally 0)
> > > > @@ -67,7 +68,8 @@ enum ns16550_flags {
> > > >   * @bdf:		PCI slot/function (pci_dev_t)
> > > >   */
> > > >  struct ns16550_plat {
> > > > -	unsigned long base;
> > > > +	ulong base;
> > > > +	ulong size;
> > > >  	int reg_width;
> > > >  	int reg_shift;
> > > >  	int reg_offset;
> > > > diff --git a/include/serial.h b/include/serial.h
> > > > index 42bdf3759c0..205889d28be 100644
> > > > --- a/include/serial.h
> > > > +++ b/include/serial.h
> > > > @@ -137,6 +137,7 @@ enum adr_space_type {
> > > >   * @type:	type of the UART chip
> > > >   * @addr_space:	address space to access the registers
> > > >   * @addr:	physical address of the registers
> > > > + * @size:	size of the register area in bytes
> > > >   * @reg_width:	size (in bytes) of the IO accesses to the registers
> > > >   * @reg_offset:	offset to apply to the @addr from the start of the registers
> > > >   * @reg_shift:	quantity to shift the register offsets by
> > > > @@ -147,6 +148,7 @@ struct serial_device_info {
> > > >  	enum serial_chip_type type;
> > > >  	enum adr_space_type addr_space;
> > > >  	ulong addr;
> > > > +	ulong size;
> > > >  	u8 reg_width;
> > > >  	u8 reg_offset;
> > > >  	u8 reg_shift;
> > > > diff --git a/test/dm/pci.c b/test/dm/pci.c
> > > > index 70a736cfdb8..8c5e7da9e62 100644
> > > > --- a/test/dm/pci.c
> > > > +++ b/test/dm/pci.c
> > > > @@ -301,10 +301,12 @@ static int dm_test_pci_addr_flat(struct unit_test_state *uts)
> > > >  {
> > > >  	struct udevice *swap1f, *swap1;
> > > >  	ulong io_addr, mem_addr;
> > > > +	fdt_addr_t size;
> > > >  
> > > >  	ut_assertok(dm_pci_bus_find_bdf(PCI_BDF(0, 0x1f, 0), &swap1f));
> > > >  	io_addr = dm_pci_read_bar32(swap1f, 0);
> > > > -	ut_asserteq(io_addr, dev_read_addr_pci(swap1f));
> > > > +	ut_asserteq(io_addr, dev_read_addr_pci(swap1f, &size));
> > > > +	ut_asserteq(0, size);
> > > >  
> > > >  	/*
> > > >  	 * This device has both I/O and MEM spaces but the MEM space appears
> > > > @@ -312,7 +314,8 @@ static int dm_test_pci_addr_flat(struct unit_test_state *uts)
> > > >  	 */
> > > >  	ut_assertok(dm_pci_bus_find_bdf(PCI_BDF(0, 0x1, 0), &swap1));
> > > >  	mem_addr = dm_pci_read_bar32(swap1, 1);
> > > > -	ut_asserteq(mem_addr, dev_read_addr_pci(swap1));
> > > > +	ut_asserteq(mem_addr, dev_read_addr_pci(swap1, &size));
> > > > +	ut_asserteq(0, size);
> > > >  
> > > >  	return 0;
> > > >  }
> > > > @@ -329,12 +332,15 @@ DM_TEST(dm_test_pci_addr_flat, UT_TESTF_SCAN_PDATA | UT_TESTF_SCAN_FDT |
> > > >  static int dm_test_pci_addr_live(struct unit_test_state *uts)
> > > >  {
> > > >  	struct udevice *swap1f, *swap1;
> > > > +	fdt_size_t size;
> > > >  
> > > >  	ut_assertok(dm_pci_bus_find_bdf(PCI_BDF(0, 0x1f, 0), &swap1f));
> > > > -	ut_asserteq_64(FDT_ADDR_T_NONE, dev_read_addr_pci(swap1f));
> > > > +	ut_asserteq_64(FDT_ADDR_T_NONE, dev_read_addr_pci(swap1f, &size));
> > > > +	ut_asserteq(0, size);
> > > >  
> > > >  	ut_assertok(dm_pci_bus_find_bdf(PCI_BDF(0, 0x1, 0), &swap1));
> > > > -	ut_asserteq_64(FDT_ADDR_T_NONE, dev_read_addr_pci(swap1));
> > > > +	ut_asserteq_64(FDT_ADDR_T_NONE, dev_read_addr_pci(swap1, &size));
> > > > +	ut_asserteq(0, size);
> > > >  
> > > >  	return 0;
> > > >  }
> > > > -- 
> > > > 2.42.0.rc2.253.gd59a3bf2b4-goog
> > > > 
> > 
> > -- 
> > Tom
> 
> 

-- 
Tom

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 659 bytes --]

^ permalink raw reply	[flat|nested] 86+ messages in thread

* Re: [PATCH 32/32] pci: serial: Support reading PCI-register size with base
  2023-08-30 19:04         ` Tom Rini
@ 2023-08-30 19:10           ` Pali Rohár
  2023-08-30 19:41             ` Tom Rini
  0 siblings, 1 reply; 86+ messages in thread
From: Pali Rohár @ 2023-08-30 19:10 UTC (permalink / raw)
  To: Tom Rini
  Cc: Simon Glass, U-Boot Mailing List, Marek Vasut,
	Abdellatif El Khlifi, Andre Przywara, Bin Meng, Chunfeng Yun,
	Dzmitry Sankouski, GSS_MTK_Uboot_upstream, Heinrich Schuchardt,
	Ilias Apalodimas, Michal Simek, Michal Suchanek, Nikhil M Jain,
	Ryder Lee, Stefan Roese, Weijie Gao

You have already decided, what is the point? You are not taking any my
objections into account, so stop writing to me and to others these your
stupids bullshits. I'm not an idiot who is interesting for them.

On Wednesday 30 August 2023 15:04:22 Tom Rini wrote:
> You're a listed maintainer for a file being changed. If you objected to
> the changes, your objection would matter.  If you don't object, you can
> just ignore it, or review it, whatever you like.  You need to decide
> what you want to do about code you're volunteering to maintain.
> 
> On Wed, Aug 30, 2023 at 08:39:13PM +0200, Pali Rohár wrote:
> > And what? How it is related to the statements that my reviews would also
> > ignored? And what you want from me now?
> > 
> > On Wednesday 30 August 2023 14:17:50 Tom Rini wrote:
> > > Pali,
> > > 
> > > You are specifically listed as a maintainer for drivers/pci/pci_mvebu.c
> > > and that is changed by this patch.
> > > 
> > > On Wed, Aug 30, 2023 at 08:14:59PM +0200, Pali Rohár wrote:
> > > > Simon, why you are contacting me? You have wrote to me that you would
> > > > ignore my reviews here, so what you want now? Could you please explain
> > > > what you are trying to achieve? I'm not going to review this or any
> > > > other your changes.
> > > > 
> > > > On Wednesday 30 August 2023 12:05:03 Simon Glass wrote:
> > > > > The PCI helpers read only the base address for a PCI region. In some cases
> > > > > the size is needed as well, e.g. to pass along to a driver which needs to
> > > > > know the size of its register area.
> > > > > 
> > > > > Update the functions to allow the size to be returned. For serial, record
> > > > > the information and provided it with the serial_info() call.
> > > > > 
> > > > > A limitation still exists in that the size is not available when OF_LIVE
> > > > > is enabled, so take account of that in the tests.
> > > > > 
> > > > > Signed-off-by: Simon Glass <sjg@chromium.org>
> > > > > ---
> > > > > 
> > > > >  arch/sandbox/dts/test.dts   |  6 +++---
> > > > >  drivers/core/fdtaddr.c      |  6 +++---
> > > > >  drivers/core/ofnode.c       | 11 ++++++++---
> > > > >  drivers/core/read.c         |  6 ++++--
> > > > >  drivers/core/util.c         |  2 +-
> > > > >  drivers/pci/pci-uclass.c    |  2 +-
> > > > >  drivers/pci/pci_mvebu.c     |  3 ++-
> > > > >  drivers/pci/pci_tegra.c     |  2 +-
> > > > >  drivers/pci/pcie_mediatek.c |  4 ++--
> > > > >  drivers/serial/ns16550.c    | 15 ++++++++++-----
> > > > >  include/dm/fdtaddr.h        |  3 ++-
> > > > >  include/dm/ofnode.h         |  4 +++-
> > > > >  include/dm/read.h           |  8 +++++---
> > > > >  include/ns16550.h           |  4 +++-
> > > > >  include/serial.h            |  2 ++
> > > > >  test/dm/pci.c               | 14 ++++++++++----
> > > > >  16 files changed, 60 insertions(+), 32 deletions(-)
> > > > > 
> > > > > diff --git a/arch/sandbox/dts/test.dts b/arch/sandbox/dts/test.dts
> > > > > index a413cbe4989..961e8895a49 100644
> > > > > --- a/arch/sandbox/dts/test.dts
> > > > > +++ b/arch/sandbox/dts/test.dts
> > > > > @@ -1087,8 +1087,8 @@
> > > > >  		pci@1,0 {
> > > > >  			compatible = "pci-generic";
> > > > >  			/* reg 0 is at 0x14, using FDT_PCI_SPACE_MEM32 */
> > > > > -			reg = <0x02000814 0 0 0 0
> > > > > -			       0x01000810 0 0 0 0>;
> > > > > +			reg = <0x02000814 0 0 0x80 0
> > > > > +			       0x01000810 0 0 0xc0 0>;
> > > > >  			sandbox,emul = <&swap_case_emul0_1>;
> > > > >  		};
> > > > >  		p2sb-pci@2,0 {
> > > > > @@ -1115,7 +1115,7 @@
> > > > >  		pci@1f,0 {
> > > > >  			compatible = "pci-generic";
> > > > >  			/* reg 0 is at 0x10, using FDT_PCI_SPACE_IO */
> > > > > -			reg = <0x0100f810 0 0 0 0>;
> > > > > +			reg = <0x0100f810 0 0 0x100 0>;
> > > > >  			sandbox,emul = <&swap_case_emul0_1f>;
> > > > >  		};
> > > > >  	};
> > > > > diff --git a/drivers/core/fdtaddr.c b/drivers/core/fdtaddr.c
> > > > > index 546db675aaf..b79d138c419 100644
> > > > > --- a/drivers/core/fdtaddr.c
> > > > > +++ b/drivers/core/fdtaddr.c
> > > > > @@ -215,7 +215,7 @@ void *devfdt_map_physmem(const struct udevice *dev, unsigned long size)
> > > > >  	return map_physmem(addr, size, MAP_NOCACHE);
> > > > >  }
> > > > >  
> > > > > -fdt_addr_t devfdt_get_addr_pci(const struct udevice *dev)
> > > > > +fdt_addr_t devfdt_get_addr_pci(const struct udevice *dev, fdt_size_t *sizep)
> > > > >  {
> > > > >  	ulong addr;
> > > > >  
> > > > > @@ -226,12 +226,12 @@ fdt_addr_t devfdt_get_addr_pci(const struct udevice *dev)
> > > > >  		int ret;
> > > > >  
> > > > >  		ret = ofnode_read_pci_addr(dev_ofnode(dev), FDT_PCI_SPACE_MEM32,
> > > > > -					   "reg", &pci_addr);
> > > > > +					   "reg", &pci_addr, sizep);
> > > > >  		if (ret) {
> > > > >  			/* try if there is any i/o-mapped register */
> > > > >  			ret = ofnode_read_pci_addr(dev_ofnode(dev),
> > > > >  						   FDT_PCI_SPACE_IO, "reg",
> > > > > -						   &pci_addr);
> > > > > +						   &pci_addr, sizep);
> > > > >  			if (ret)
> > > > >  				return FDT_ADDR_T_NONE;
> > > > >  		}
> > > > > diff --git a/drivers/core/ofnode.c b/drivers/core/ofnode.c
> > > > > index 2ef4114cb6f..c9cec456f43 100644
> > > > > --- a/drivers/core/ofnode.c
> > > > > +++ b/drivers/core/ofnode.c
> > > > > @@ -1270,7 +1270,8 @@ const uint8_t *ofnode_read_u8_array_ptr(ofnode node, const char *propname,
> > > > >  }
> > > > >  
> > > > >  int ofnode_read_pci_addr(ofnode node, enum fdt_pci_space type,
> > > > > -			 const char *propname, struct fdt_pci_addr *addr)
> > > > > +			 const char *propname, struct fdt_pci_addr *addr,
> > > > > +			 fdt_size_t *size)
> > > > >  {
> > > > >  	const fdt32_t *cell;
> > > > >  	int len;
> > > > > @@ -1298,14 +1299,18 @@ int ofnode_read_pci_addr(ofnode node, enum fdt_pci_space type,
> > > > >  			      (ulong)fdt32_to_cpu(cell[1]),
> > > > >  			      (ulong)fdt32_to_cpu(cell[2]));
> > > > >  			if ((fdt32_to_cpu(*cell) & type) == type) {
> > > > > +				const unaligned_fdt64_t *ptr;
> > > > > +
> > > > >  				addr->phys_hi = fdt32_to_cpu(cell[0]);
> > > > >  				addr->phys_mid = fdt32_to_cpu(cell[1]);
> > > > >  				addr->phys_lo = fdt32_to_cpu(cell[2]);
> > > > > +				ptr = (const unaligned_fdt64_t *)(cell + 3);
> > > > > +				if (size)
> > > > > +					*size = fdt64_to_cpu(*ptr);
> > > > >  				break;
> > > > >  			}
> > > > >  
> > > > > -			cell += (FDT_PCI_ADDR_CELLS +
> > > > > -				 FDT_PCI_SIZE_CELLS);
> > > > > +			cell += FDT_PCI_ADDR_CELLS + FDT_PCI_SIZE_CELLS;
> > > > >  		}
> > > > >  
> > > > >  		if (i == num) {
> > > > > diff --git a/drivers/core/read.c b/drivers/core/read.c
> > > > > index 49066b59cda..419013451f0 100644
> > > > > --- a/drivers/core/read.c
> > > > > +++ b/drivers/core/read.c
> > > > > @@ -405,13 +405,15 @@ int dev_read_alias_highest_id(const char *stem)
> > > > >  	return fdtdec_get_alias_highest_id(gd->fdt_blob, stem);
> > > > >  }
> > > > >  
> > > > > -fdt_addr_t dev_read_addr_pci(const struct udevice *dev)
> > > > > +fdt_addr_t dev_read_addr_pci(const struct udevice *dev, fdt_size_t *sizep)
> > > > >  {
> > > > >  	ulong addr;
> > > > >  
> > > > >  	addr = dev_read_addr(dev);
> > > > > +	if (sizep)
> > > > > +		*sizep = 0;
> > > > >  	if (addr == FDT_ADDR_T_NONE && !of_live_active())
> > > > > -		addr = devfdt_get_addr_pci(dev);
> > > > > +		addr = devfdt_get_addr_pci(dev, sizep);
> > > > >  
> > > > >  	return addr;
> > > > >  }
> > > > > diff --git a/drivers/core/util.c b/drivers/core/util.c
> > > > > index aa60fdd15bc..81497df85ff 100644
> > > > > --- a/drivers/core/util.c
> > > > > +++ b/drivers/core/util.c
> > > > > @@ -30,7 +30,7 @@ int pci_get_devfn(struct udevice *dev)
> > > > >  
> > > > >  	/* Extract the devfn from fdt_pci_addr */
> > > > >  	ret = ofnode_read_pci_addr(dev_ofnode(dev), FDT_PCI_SPACE_CONFIG,
> > > > > -				   "reg", &addr);
> > > > > +				   "reg", &addr, NULL);
> > > > >  	if (ret) {
> > > > >  		if (ret != -ENOENT)
> > > > >  			return -EINVAL;
> > > > > diff --git a/drivers/pci/pci-uclass.c b/drivers/pci/pci-uclass.c
> > > > > index 0adcdceb1d3..c670f8754e8 100644
> > > > > --- a/drivers/pci/pci-uclass.c
> > > > > +++ b/drivers/pci/pci-uclass.c
> > > > > @@ -122,7 +122,7 @@ static void pci_dev_find_ofnode(struct udevice *bus, phys_addr_t bdf,
> > > > >  
> > > > >  	dev_for_each_subnode(node, bus) {
> > > > >  		ret = ofnode_read_pci_addr(node, FDT_PCI_SPACE_CONFIG, "reg",
> > > > > -					   &addr);
> > > > > +					   &addr, NULL);
> > > > >  		if (ret)
> > > > >  			continue;
> > > > >  
> > > > > diff --git a/drivers/pci/pci_mvebu.c b/drivers/pci/pci_mvebu.c
> > > > > index 93a7508d8a2..25878bde534 100644
> > > > > --- a/drivers/pci/pci_mvebu.c
> > > > > +++ b/drivers/pci/pci_mvebu.c
> > > > > @@ -640,7 +640,8 @@ static int mvebu_pcie_port_parse_dt(ofnode node, ofnode parent, struct mvebu_pci
> > > > >  		pcie->is_x4 = true;
> > > > >  
> > > > >  	/* devfn is in bits [15:8], see PCI_DEV usage */
> > > > > -	ret = ofnode_read_pci_addr(node, FDT_PCI_SPACE_CONFIG, "reg", &pci_addr);
> > > > > +	ret = ofnode_read_pci_addr(node, FDT_PCI_SPACE_CONFIG, "reg", &pci_addr,
> > > > > +				   NULL);
> > > > >  	if (ret < 0) {
> > > > >  		printf("%s: property \"reg\" is invalid\n", pcie->name);
> > > > >  		goto err;
> > > > > diff --git a/drivers/pci/pci_tegra.c b/drivers/pci/pci_tegra.c
> > > > > index 29d54117e93..ae90bd2fbf1 100644
> > > > > --- a/drivers/pci/pci_tegra.c
> > > > > +++ b/drivers/pci/pci_tegra.c
> > > > > @@ -461,7 +461,7 @@ static int tegra_pcie_parse_port_info(ofnode node, uint *index, uint *lanes)
> > > > >  
> > > > >  	*lanes = err;
> > > > >  
> > > > > -	err = ofnode_read_pci_addr(node, 0, "reg", &addr);
> > > > > +	err = ofnode_read_pci_addr(node, 0, "reg", &addr, NULL);
> > > > >  	if (err < 0) {
> > > > >  		pr_err("failed to parse \"reg\" property\n");
> > > > >  		return err;
> > > > > diff --git a/drivers/pci/pcie_mediatek.c b/drivers/pci/pcie_mediatek.c
> > > > > index c6e30e24622..e59ebd13ad0 100644
> > > > > --- a/drivers/pci/pcie_mediatek.c
> > > > > +++ b/drivers/pci/pcie_mediatek.c
> > > > > @@ -660,7 +660,7 @@ static int mtk_pcie_probe(struct udevice *dev)
> > > > >  		if (!ofnode_is_enabled(subnode))
> > > > >  			continue;
> > > > >  
> > > > > -		err = ofnode_read_pci_addr(subnode, 0, "reg", &addr);
> > > > > +		err = ofnode_read_pci_addr(subnode, 0, "reg", &addr, NULL);
> > > > >  		if (err)
> > > > >  			return err;
> > > > >  
> > > > > @@ -699,7 +699,7 @@ static int mtk_pcie_probe_v2(struct udevice *dev)
> > > > >  		if (!ofnode_is_enabled(subnode))
> > > > >  			continue;
> > > > >  
> > > > > -		err = ofnode_read_pci_addr(subnode, 0, "reg", &addr);
> > > > > +		err = ofnode_read_pci_addr(subnode, 0, "reg", &addr, NULL);
> > > > >  		if (err)
> > > > >  			return err;
> > > > >  
> > > > > diff --git a/drivers/serial/ns16550.c b/drivers/serial/ns16550.c
> > > > > index eab9537fbae..a349e5e132a 100644
> > > > > --- a/drivers/serial/ns16550.c
> > > > > +++ b/drivers/serial/ns16550.c
> > > > > @@ -479,6 +479,7 @@ static int ns16550_serial_getinfo(struct udevice *dev,
> > > > >  	info->addr_space = SERIAL_ADDRESS_SPACE_MEMORY;
> > > > >  #endif
> > > > >  	info->addr = plat->base;
> > > > > +	info->size = plat->size;
> > > > >  	info->reg_width = plat->reg_width;
> > > > >  	info->reg_shift = plat->reg_shift;
> > > > >  	info->reg_offset = plat->reg_offset;
> > > > > @@ -487,7 +488,8 @@ static int ns16550_serial_getinfo(struct udevice *dev,
> > > > >  	return 0;
> > > > >  }
> > > > >  
> > > > > -static int ns16550_serial_assign_base(struct ns16550_plat *plat, fdt_addr_t base)
> > > > > +static int ns16550_serial_assign_base(struct ns16550_plat *plat,
> > > > > +				      fdt_addr_t base, fdt_size_t size)
> > > > >  {
> > > > >  	if (base == FDT_ADDR_T_NONE)
> > > > >  		return -EINVAL;
> > > > > @@ -497,6 +499,7 @@ static int ns16550_serial_assign_base(struct ns16550_plat *plat, fdt_addr_t base
> > > > >  #else
> > > > >  	plat->base = (unsigned long)map_physmem(base, 0, MAP_NOCACHE);
> > > > >  #endif
> > > > > +	plat->size = size;
> > > > >  
> > > > >  	return 0;
> > > > >  }
> > > > > @@ -507,6 +510,7 @@ int ns16550_serial_probe(struct udevice *dev)
> > > > >  	struct ns16550 *const com_port = dev_get_priv(dev);
> > > > >  	struct reset_ctl_bulk reset_bulk;
> > > > >  	fdt_addr_t addr;
> > > > > +	fdt_addr_t size;
> > > > >  	int ret;
> > > > >  
> > > > >  	/*
> > > > > @@ -514,8 +518,8 @@ int ns16550_serial_probe(struct udevice *dev)
> > > > >  	 * or via a PCI bridge, assign plat->base before probing hardware.
> > > > >  	 */
> > > > >  	if (device_is_on_pci_bus(dev)) {
> > > > > -		addr = devfdt_get_addr_pci(dev);
> > > > > -		ret = ns16550_serial_assign_base(plat, addr);
> > > > > +		addr = devfdt_get_addr_pci(dev, &size);
> > > > > +		ret = ns16550_serial_assign_base(plat, addr, size);
> > > > >  		if (ret)
> > > > >  			return ret;
> > > > >  	}
> > > > > @@ -543,11 +547,12 @@ int ns16550_serial_of_to_plat(struct udevice *dev)
> > > > >  	struct ns16550_plat *plat = dev_get_plat(dev);
> > > > >  	const u32 port_type = dev_get_driver_data(dev);
> > > > >  	fdt_addr_t addr;
> > > > > +	fdt_size_t size;
> > > > >  	struct clk clk;
> > > > >  	int err;
> > > > >  
> > > > > -	addr = dev_read_addr(dev);
> > > > > -	err = ns16550_serial_assign_base(plat, addr);
> > > > > +	addr = dev_read_addr_size(dev, &size);
> > > > > +	err = ns16550_serial_assign_base(plat, addr, size);
> > > > >  	if (err && !device_is_on_pci_bus(dev))
> > > > >  		return err;
> > > > >  
> > > > > diff --git a/include/dm/fdtaddr.h b/include/dm/fdtaddr.h
> > > > > index dcdc19137cc..6d2fa8f1044 100644
> > > > > --- a/include/dm/fdtaddr.h
> > > > > +++ b/include/dm/fdtaddr.h
> > > > > @@ -168,8 +168,9 @@ fdt_addr_t devfdt_get_addr_size_name(const struct udevice *dev,
> > > > >   * devfdt_get_addr_pci() - Read an address and handle PCI address translation
> > > > >   *
> > > > >   * @dev: Device to read from
> > > > > + * @sizep: If non-NULL, returns size of address space
> > > > >   * Return: address or FDT_ADDR_T_NONE if not found
> > > > >   */
> > > > > -fdt_addr_t devfdt_get_addr_pci(const struct udevice *dev);
> > > > > +fdt_addr_t devfdt_get_addr_pci(const struct udevice *dev, fdt_size_t *sizep);
> > > > >  
> > > > >  #endif
> > > > > diff --git a/include/dm/ofnode.h b/include/dm/ofnode.h
> > > > > index 726d8f82ddf..97cad971611 100644
> > > > > --- a/include/dm/ofnode.h
> > > > > +++ b/include/dm/ofnode.h
> > > > > @@ -1152,13 +1152,15 @@ const uint8_t *ofnode_read_u8_array_ptr(ofnode node, const char *propname,
> > > > >   * @type:	pci address type (FDT_PCI_SPACE_xxx)
> > > > >   * @propname:	name of property to find
> > > > >   * @addr:	returns pci address in the form of fdt_pci_addr
> > > > > + * @size:	if non-null, returns register-space size
> > > > >   * Return:
> > > > >   * 0 if ok, -ENOENT if the property did not exist, -EINVAL if the
> > > > >   * format of the property was invalid, -ENXIO if the requested
> > > > >   * address type was not found
> > > > >   */
> > > > >  int ofnode_read_pci_addr(ofnode node, enum fdt_pci_space type,
> > > > > -			 const char *propname, struct fdt_pci_addr *addr);
> > > > > +			 const char *propname, struct fdt_pci_addr *addr,
> > > > > +			 fdt_size_t *size);
> > > > >  
> > > > >  /**
> > > > >   * ofnode_read_pci_vendev() - look up PCI vendor and device id
> > > > > diff --git a/include/dm/read.h b/include/dm/read.h
> > > > > index c2615f72f40..3c2eea6f0c4 100644
> > > > > --- a/include/dm/read.h
> > > > > +++ b/include/dm/read.h
> > > > > @@ -346,9 +346,10 @@ void *dev_read_addr_ptr(const struct udevice *dev);
> > > > >   *    fdtdec_get_addr() and friends.
> > > > >   *
> > > > >   * @dev: Device to read from
> > > > > + * @sizep: If non-NULL, returns size of address space found
> > > > >   * Return: address or FDT_ADDR_T_NONE if not found
> > > > >   */
> > > > > -fdt_addr_t dev_read_addr_pci(const struct udevice *dev);
> > > > > +fdt_addr_t dev_read_addr_pci(const struct udevice *dev, fdt_size_t *sizep);
> > > > >  
> > > > >  /**
> > > > >   * dev_remap_addr() - Get the reg property of a device as a
> > > > > @@ -996,9 +997,10 @@ static inline void *dev_read_addr_ptr(const struct udevice *dev)
> > > > >  	return devfdt_get_addr_ptr(dev);
> > > > >  }
> > > > >  
> > > > > -static inline fdt_addr_t dev_read_addr_pci(const struct udevice *dev)
> > > > > +static inline fdt_addr_t dev_read_addr_pci(const struct udevice *dev,
> > > > > +					   fdt_size_t *sizep)
> > > > >  {
> > > > > -	return devfdt_get_addr_pci(dev);
> > > > > +	return devfdt_get_addr_pci(dev, sizep);
> > > > >  }
> > > > >  
> > > > >  static inline void *dev_remap_addr(const struct udevice *dev)
> > > > > diff --git a/include/ns16550.h b/include/ns16550.h
> > > > > index e7e68663d03..7f481300083 100644
> > > > > --- a/include/ns16550.h
> > > > > +++ b/include/ns16550.h
> > > > > @@ -58,6 +58,7 @@ enum ns16550_flags {
> > > > >   * struct ns16550_plat - information about a NS16550 port
> > > > >   *
> > > > >   * @base:		Base register address
> > > > > + * @size:		Size of register area in bytes
> > > > >   * @reg_width:		IO accesses size of registers (in bytes, 1 or 4)
> > > > >   * @reg_shift:		Shift size of registers (0=byte, 1=16bit, 2=32bit...)
> > > > >   * @reg_offset:		Offset to start of registers (normally 0)
> > > > > @@ -67,7 +68,8 @@ enum ns16550_flags {
> > > > >   * @bdf:		PCI slot/function (pci_dev_t)
> > > > >   */
> > > > >  struct ns16550_plat {
> > > > > -	unsigned long base;
> > > > > +	ulong base;
> > > > > +	ulong size;
> > > > >  	int reg_width;
> > > > >  	int reg_shift;
> > > > >  	int reg_offset;
> > > > > diff --git a/include/serial.h b/include/serial.h
> > > > > index 42bdf3759c0..205889d28be 100644
> > > > > --- a/include/serial.h
> > > > > +++ b/include/serial.h
> > > > > @@ -137,6 +137,7 @@ enum adr_space_type {
> > > > >   * @type:	type of the UART chip
> > > > >   * @addr_space:	address space to access the registers
> > > > >   * @addr:	physical address of the registers
> > > > > + * @size:	size of the register area in bytes
> > > > >   * @reg_width:	size (in bytes) of the IO accesses to the registers
> > > > >   * @reg_offset:	offset to apply to the @addr from the start of the registers
> > > > >   * @reg_shift:	quantity to shift the register offsets by
> > > > > @@ -147,6 +148,7 @@ struct serial_device_info {
> > > > >  	enum serial_chip_type type;
> > > > >  	enum adr_space_type addr_space;
> > > > >  	ulong addr;
> > > > > +	ulong size;
> > > > >  	u8 reg_width;
> > > > >  	u8 reg_offset;
> > > > >  	u8 reg_shift;
> > > > > diff --git a/test/dm/pci.c b/test/dm/pci.c
> > > > > index 70a736cfdb8..8c5e7da9e62 100644
> > > > > --- a/test/dm/pci.c
> > > > > +++ b/test/dm/pci.c
> > > > > @@ -301,10 +301,12 @@ static int dm_test_pci_addr_flat(struct unit_test_state *uts)
> > > > >  {
> > > > >  	struct udevice *swap1f, *swap1;
> > > > >  	ulong io_addr, mem_addr;
> > > > > +	fdt_addr_t size;
> > > > >  
> > > > >  	ut_assertok(dm_pci_bus_find_bdf(PCI_BDF(0, 0x1f, 0), &swap1f));
> > > > >  	io_addr = dm_pci_read_bar32(swap1f, 0);
> > > > > -	ut_asserteq(io_addr, dev_read_addr_pci(swap1f));
> > > > > +	ut_asserteq(io_addr, dev_read_addr_pci(swap1f, &size));
> > > > > +	ut_asserteq(0, size);
> > > > >  
> > > > >  	/*
> > > > >  	 * This device has both I/O and MEM spaces but the MEM space appears
> > > > > @@ -312,7 +314,8 @@ static int dm_test_pci_addr_flat(struct unit_test_state *uts)
> > > > >  	 */
> > > > >  	ut_assertok(dm_pci_bus_find_bdf(PCI_BDF(0, 0x1, 0), &swap1));
> > > > >  	mem_addr = dm_pci_read_bar32(swap1, 1);
> > > > > -	ut_asserteq(mem_addr, dev_read_addr_pci(swap1));
> > > > > +	ut_asserteq(mem_addr, dev_read_addr_pci(swap1, &size));
> > > > > +	ut_asserteq(0, size);
> > > > >  
> > > > >  	return 0;
> > > > >  }
> > > > > @@ -329,12 +332,15 @@ DM_TEST(dm_test_pci_addr_flat, UT_TESTF_SCAN_PDATA | UT_TESTF_SCAN_FDT |
> > > > >  static int dm_test_pci_addr_live(struct unit_test_state *uts)
> > > > >  {
> > > > >  	struct udevice *swap1f, *swap1;
> > > > > +	fdt_size_t size;
> > > > >  
> > > > >  	ut_assertok(dm_pci_bus_find_bdf(PCI_BDF(0, 0x1f, 0), &swap1f));
> > > > > -	ut_asserteq_64(FDT_ADDR_T_NONE, dev_read_addr_pci(swap1f));
> > > > > +	ut_asserteq_64(FDT_ADDR_T_NONE, dev_read_addr_pci(swap1f, &size));
> > > > > +	ut_asserteq(0, size);
> > > > >  
> > > > >  	ut_assertok(dm_pci_bus_find_bdf(PCI_BDF(0, 0x1, 0), &swap1));
> > > > > -	ut_asserteq_64(FDT_ADDR_T_NONE, dev_read_addr_pci(swap1));
> > > > > +	ut_asserteq_64(FDT_ADDR_T_NONE, dev_read_addr_pci(swap1, &size));
> > > > > +	ut_asserteq(0, size);
> > > > >  
> > > > >  	return 0;
> > > > >  }
> > > > > -- 
> > > > > 2.42.0.rc2.253.gd59a3bf2b4-goog
> > > > > 
> > > 
> > > -- 
> > > Tom
> > 
> > 
> 
> -- 
> Tom



^ permalink raw reply	[flat|nested] 86+ messages in thread

* Re: [PATCH 32/32] pci: serial: Support reading PCI-register size with base
  2023-08-30 19:10           ` Pali Rohár
@ 2023-08-30 19:41             ` Tom Rini
  2023-08-30 19:44               ` Pali Rohár
  0 siblings, 1 reply; 86+ messages in thread
From: Tom Rini @ 2023-08-30 19:41 UTC (permalink / raw)
  To: Pali Rohár
  Cc: Simon Glass, U-Boot Mailing List, Marek Vasut,
	Abdellatif El Khlifi, Andre Przywara, Bin Meng, Chunfeng Yun,
	Dzmitry Sankouski, GSS_MTK_Uboot_upstream, Heinrich Schuchardt,
	Ilias Apalodimas, Michal Simek, Michal Suchanek, Nikhil M Jain,
	Ryder Lee, Stefan Roese, Weijie Gao

[-- Attachment #1: Type: text/plain, Size: 22386 bytes --]

Then you should probably remove yourself from the places you've listed
yourself as an interested maintainer, thanks.

On Wed, Aug 30, 2023 at 09:10:36PM +0200, Pali Rohár wrote:
> You have already decided, what is the point? You are not taking any my
> objections into account, so stop writing to me and to others these your
> stupids bullshits. I'm not an idiot who is interesting for them.
> 
> On Wednesday 30 August 2023 15:04:22 Tom Rini wrote:
> > You're a listed maintainer for a file being changed. If you objected to
> > the changes, your objection would matter.  If you don't object, you can
> > just ignore it, or review it, whatever you like.  You need to decide
> > what you want to do about code you're volunteering to maintain.
> > 
> > On Wed, Aug 30, 2023 at 08:39:13PM +0200, Pali Rohár wrote:
> > > And what? How it is related to the statements that my reviews would also
> > > ignored? And what you want from me now?
> > > 
> > > On Wednesday 30 August 2023 14:17:50 Tom Rini wrote:
> > > > Pali,
> > > > 
> > > > You are specifically listed as a maintainer for drivers/pci/pci_mvebu.c
> > > > and that is changed by this patch.
> > > > 
> > > > On Wed, Aug 30, 2023 at 08:14:59PM +0200, Pali Rohár wrote:
> > > > > Simon, why you are contacting me? You have wrote to me that you would
> > > > > ignore my reviews here, so what you want now? Could you please explain
> > > > > what you are trying to achieve? I'm not going to review this or any
> > > > > other your changes.
> > > > > 
> > > > > On Wednesday 30 August 2023 12:05:03 Simon Glass wrote:
> > > > > > The PCI helpers read only the base address for a PCI region. In some cases
> > > > > > the size is needed as well, e.g. to pass along to a driver which needs to
> > > > > > know the size of its register area.
> > > > > > 
> > > > > > Update the functions to allow the size to be returned. For serial, record
> > > > > > the information and provided it with the serial_info() call.
> > > > > > 
> > > > > > A limitation still exists in that the size is not available when OF_LIVE
> > > > > > is enabled, so take account of that in the tests.
> > > > > > 
> > > > > > Signed-off-by: Simon Glass <sjg@chromium.org>
> > > > > > ---
> > > > > > 
> > > > > >  arch/sandbox/dts/test.dts   |  6 +++---
> > > > > >  drivers/core/fdtaddr.c      |  6 +++---
> > > > > >  drivers/core/ofnode.c       | 11 ++++++++---
> > > > > >  drivers/core/read.c         |  6 ++++--
> > > > > >  drivers/core/util.c         |  2 +-
> > > > > >  drivers/pci/pci-uclass.c    |  2 +-
> > > > > >  drivers/pci/pci_mvebu.c     |  3 ++-
> > > > > >  drivers/pci/pci_tegra.c     |  2 +-
> > > > > >  drivers/pci/pcie_mediatek.c |  4 ++--
> > > > > >  drivers/serial/ns16550.c    | 15 ++++++++++-----
> > > > > >  include/dm/fdtaddr.h        |  3 ++-
> > > > > >  include/dm/ofnode.h         |  4 +++-
> > > > > >  include/dm/read.h           |  8 +++++---
> > > > > >  include/ns16550.h           |  4 +++-
> > > > > >  include/serial.h            |  2 ++
> > > > > >  test/dm/pci.c               | 14 ++++++++++----
> > > > > >  16 files changed, 60 insertions(+), 32 deletions(-)
> > > > > > 
> > > > > > diff --git a/arch/sandbox/dts/test.dts b/arch/sandbox/dts/test.dts
> > > > > > index a413cbe4989..961e8895a49 100644
> > > > > > --- a/arch/sandbox/dts/test.dts
> > > > > > +++ b/arch/sandbox/dts/test.dts
> > > > > > @@ -1087,8 +1087,8 @@
> > > > > >  		pci@1,0 {
> > > > > >  			compatible = "pci-generic";
> > > > > >  			/* reg 0 is at 0x14, using FDT_PCI_SPACE_MEM32 */
> > > > > > -			reg = <0x02000814 0 0 0 0
> > > > > > -			       0x01000810 0 0 0 0>;
> > > > > > +			reg = <0x02000814 0 0 0x80 0
> > > > > > +			       0x01000810 0 0 0xc0 0>;
> > > > > >  			sandbox,emul = <&swap_case_emul0_1>;
> > > > > >  		};
> > > > > >  		p2sb-pci@2,0 {
> > > > > > @@ -1115,7 +1115,7 @@
> > > > > >  		pci@1f,0 {
> > > > > >  			compatible = "pci-generic";
> > > > > >  			/* reg 0 is at 0x10, using FDT_PCI_SPACE_IO */
> > > > > > -			reg = <0x0100f810 0 0 0 0>;
> > > > > > +			reg = <0x0100f810 0 0 0x100 0>;
> > > > > >  			sandbox,emul = <&swap_case_emul0_1f>;
> > > > > >  		};
> > > > > >  	};
> > > > > > diff --git a/drivers/core/fdtaddr.c b/drivers/core/fdtaddr.c
> > > > > > index 546db675aaf..b79d138c419 100644
> > > > > > --- a/drivers/core/fdtaddr.c
> > > > > > +++ b/drivers/core/fdtaddr.c
> > > > > > @@ -215,7 +215,7 @@ void *devfdt_map_physmem(const struct udevice *dev, unsigned long size)
> > > > > >  	return map_physmem(addr, size, MAP_NOCACHE);
> > > > > >  }
> > > > > >  
> > > > > > -fdt_addr_t devfdt_get_addr_pci(const struct udevice *dev)
> > > > > > +fdt_addr_t devfdt_get_addr_pci(const struct udevice *dev, fdt_size_t *sizep)
> > > > > >  {
> > > > > >  	ulong addr;
> > > > > >  
> > > > > > @@ -226,12 +226,12 @@ fdt_addr_t devfdt_get_addr_pci(const struct udevice *dev)
> > > > > >  		int ret;
> > > > > >  
> > > > > >  		ret = ofnode_read_pci_addr(dev_ofnode(dev), FDT_PCI_SPACE_MEM32,
> > > > > > -					   "reg", &pci_addr);
> > > > > > +					   "reg", &pci_addr, sizep);
> > > > > >  		if (ret) {
> > > > > >  			/* try if there is any i/o-mapped register */
> > > > > >  			ret = ofnode_read_pci_addr(dev_ofnode(dev),
> > > > > >  						   FDT_PCI_SPACE_IO, "reg",
> > > > > > -						   &pci_addr);
> > > > > > +						   &pci_addr, sizep);
> > > > > >  			if (ret)
> > > > > >  				return FDT_ADDR_T_NONE;
> > > > > >  		}
> > > > > > diff --git a/drivers/core/ofnode.c b/drivers/core/ofnode.c
> > > > > > index 2ef4114cb6f..c9cec456f43 100644
> > > > > > --- a/drivers/core/ofnode.c
> > > > > > +++ b/drivers/core/ofnode.c
> > > > > > @@ -1270,7 +1270,8 @@ const uint8_t *ofnode_read_u8_array_ptr(ofnode node, const char *propname,
> > > > > >  }
> > > > > >  
> > > > > >  int ofnode_read_pci_addr(ofnode node, enum fdt_pci_space type,
> > > > > > -			 const char *propname, struct fdt_pci_addr *addr)
> > > > > > +			 const char *propname, struct fdt_pci_addr *addr,
> > > > > > +			 fdt_size_t *size)
> > > > > >  {
> > > > > >  	const fdt32_t *cell;
> > > > > >  	int len;
> > > > > > @@ -1298,14 +1299,18 @@ int ofnode_read_pci_addr(ofnode node, enum fdt_pci_space type,
> > > > > >  			      (ulong)fdt32_to_cpu(cell[1]),
> > > > > >  			      (ulong)fdt32_to_cpu(cell[2]));
> > > > > >  			if ((fdt32_to_cpu(*cell) & type) == type) {
> > > > > > +				const unaligned_fdt64_t *ptr;
> > > > > > +
> > > > > >  				addr->phys_hi = fdt32_to_cpu(cell[0]);
> > > > > >  				addr->phys_mid = fdt32_to_cpu(cell[1]);
> > > > > >  				addr->phys_lo = fdt32_to_cpu(cell[2]);
> > > > > > +				ptr = (const unaligned_fdt64_t *)(cell + 3);
> > > > > > +				if (size)
> > > > > > +					*size = fdt64_to_cpu(*ptr);
> > > > > >  				break;
> > > > > >  			}
> > > > > >  
> > > > > > -			cell += (FDT_PCI_ADDR_CELLS +
> > > > > > -				 FDT_PCI_SIZE_CELLS);
> > > > > > +			cell += FDT_PCI_ADDR_CELLS + FDT_PCI_SIZE_CELLS;
> > > > > >  		}
> > > > > >  
> > > > > >  		if (i == num) {
> > > > > > diff --git a/drivers/core/read.c b/drivers/core/read.c
> > > > > > index 49066b59cda..419013451f0 100644
> > > > > > --- a/drivers/core/read.c
> > > > > > +++ b/drivers/core/read.c
> > > > > > @@ -405,13 +405,15 @@ int dev_read_alias_highest_id(const char *stem)
> > > > > >  	return fdtdec_get_alias_highest_id(gd->fdt_blob, stem);
> > > > > >  }
> > > > > >  
> > > > > > -fdt_addr_t dev_read_addr_pci(const struct udevice *dev)
> > > > > > +fdt_addr_t dev_read_addr_pci(const struct udevice *dev, fdt_size_t *sizep)
> > > > > >  {
> > > > > >  	ulong addr;
> > > > > >  
> > > > > >  	addr = dev_read_addr(dev);
> > > > > > +	if (sizep)
> > > > > > +		*sizep = 0;
> > > > > >  	if (addr == FDT_ADDR_T_NONE && !of_live_active())
> > > > > > -		addr = devfdt_get_addr_pci(dev);
> > > > > > +		addr = devfdt_get_addr_pci(dev, sizep);
> > > > > >  
> > > > > >  	return addr;
> > > > > >  }
> > > > > > diff --git a/drivers/core/util.c b/drivers/core/util.c
> > > > > > index aa60fdd15bc..81497df85ff 100644
> > > > > > --- a/drivers/core/util.c
> > > > > > +++ b/drivers/core/util.c
> > > > > > @@ -30,7 +30,7 @@ int pci_get_devfn(struct udevice *dev)
> > > > > >  
> > > > > >  	/* Extract the devfn from fdt_pci_addr */
> > > > > >  	ret = ofnode_read_pci_addr(dev_ofnode(dev), FDT_PCI_SPACE_CONFIG,
> > > > > > -				   "reg", &addr);
> > > > > > +				   "reg", &addr, NULL);
> > > > > >  	if (ret) {
> > > > > >  		if (ret != -ENOENT)
> > > > > >  			return -EINVAL;
> > > > > > diff --git a/drivers/pci/pci-uclass.c b/drivers/pci/pci-uclass.c
> > > > > > index 0adcdceb1d3..c670f8754e8 100644
> > > > > > --- a/drivers/pci/pci-uclass.c
> > > > > > +++ b/drivers/pci/pci-uclass.c
> > > > > > @@ -122,7 +122,7 @@ static void pci_dev_find_ofnode(struct udevice *bus, phys_addr_t bdf,
> > > > > >  
> > > > > >  	dev_for_each_subnode(node, bus) {
> > > > > >  		ret = ofnode_read_pci_addr(node, FDT_PCI_SPACE_CONFIG, "reg",
> > > > > > -					   &addr);
> > > > > > +					   &addr, NULL);
> > > > > >  		if (ret)
> > > > > >  			continue;
> > > > > >  
> > > > > > diff --git a/drivers/pci/pci_mvebu.c b/drivers/pci/pci_mvebu.c
> > > > > > index 93a7508d8a2..25878bde534 100644
> > > > > > --- a/drivers/pci/pci_mvebu.c
> > > > > > +++ b/drivers/pci/pci_mvebu.c
> > > > > > @@ -640,7 +640,8 @@ static int mvebu_pcie_port_parse_dt(ofnode node, ofnode parent, struct mvebu_pci
> > > > > >  		pcie->is_x4 = true;
> > > > > >  
> > > > > >  	/* devfn is in bits [15:8], see PCI_DEV usage */
> > > > > > -	ret = ofnode_read_pci_addr(node, FDT_PCI_SPACE_CONFIG, "reg", &pci_addr);
> > > > > > +	ret = ofnode_read_pci_addr(node, FDT_PCI_SPACE_CONFIG, "reg", &pci_addr,
> > > > > > +				   NULL);
> > > > > >  	if (ret < 0) {
> > > > > >  		printf("%s: property \"reg\" is invalid\n", pcie->name);
> > > > > >  		goto err;
> > > > > > diff --git a/drivers/pci/pci_tegra.c b/drivers/pci/pci_tegra.c
> > > > > > index 29d54117e93..ae90bd2fbf1 100644
> > > > > > --- a/drivers/pci/pci_tegra.c
> > > > > > +++ b/drivers/pci/pci_tegra.c
> > > > > > @@ -461,7 +461,7 @@ static int tegra_pcie_parse_port_info(ofnode node, uint *index, uint *lanes)
> > > > > >  
> > > > > >  	*lanes = err;
> > > > > >  
> > > > > > -	err = ofnode_read_pci_addr(node, 0, "reg", &addr);
> > > > > > +	err = ofnode_read_pci_addr(node, 0, "reg", &addr, NULL);
> > > > > >  	if (err < 0) {
> > > > > >  		pr_err("failed to parse \"reg\" property\n");
> > > > > >  		return err;
> > > > > > diff --git a/drivers/pci/pcie_mediatek.c b/drivers/pci/pcie_mediatek.c
> > > > > > index c6e30e24622..e59ebd13ad0 100644
> > > > > > --- a/drivers/pci/pcie_mediatek.c
> > > > > > +++ b/drivers/pci/pcie_mediatek.c
> > > > > > @@ -660,7 +660,7 @@ static int mtk_pcie_probe(struct udevice *dev)
> > > > > >  		if (!ofnode_is_enabled(subnode))
> > > > > >  			continue;
> > > > > >  
> > > > > > -		err = ofnode_read_pci_addr(subnode, 0, "reg", &addr);
> > > > > > +		err = ofnode_read_pci_addr(subnode, 0, "reg", &addr, NULL);
> > > > > >  		if (err)
> > > > > >  			return err;
> > > > > >  
> > > > > > @@ -699,7 +699,7 @@ static int mtk_pcie_probe_v2(struct udevice *dev)
> > > > > >  		if (!ofnode_is_enabled(subnode))
> > > > > >  			continue;
> > > > > >  
> > > > > > -		err = ofnode_read_pci_addr(subnode, 0, "reg", &addr);
> > > > > > +		err = ofnode_read_pci_addr(subnode, 0, "reg", &addr, NULL);
> > > > > >  		if (err)
> > > > > >  			return err;
> > > > > >  
> > > > > > diff --git a/drivers/serial/ns16550.c b/drivers/serial/ns16550.c
> > > > > > index eab9537fbae..a349e5e132a 100644
> > > > > > --- a/drivers/serial/ns16550.c
> > > > > > +++ b/drivers/serial/ns16550.c
> > > > > > @@ -479,6 +479,7 @@ static int ns16550_serial_getinfo(struct udevice *dev,
> > > > > >  	info->addr_space = SERIAL_ADDRESS_SPACE_MEMORY;
> > > > > >  #endif
> > > > > >  	info->addr = plat->base;
> > > > > > +	info->size = plat->size;
> > > > > >  	info->reg_width = plat->reg_width;
> > > > > >  	info->reg_shift = plat->reg_shift;
> > > > > >  	info->reg_offset = plat->reg_offset;
> > > > > > @@ -487,7 +488,8 @@ static int ns16550_serial_getinfo(struct udevice *dev,
> > > > > >  	return 0;
> > > > > >  }
> > > > > >  
> > > > > > -static int ns16550_serial_assign_base(struct ns16550_plat *plat, fdt_addr_t base)
> > > > > > +static int ns16550_serial_assign_base(struct ns16550_plat *plat,
> > > > > > +				      fdt_addr_t base, fdt_size_t size)
> > > > > >  {
> > > > > >  	if (base == FDT_ADDR_T_NONE)
> > > > > >  		return -EINVAL;
> > > > > > @@ -497,6 +499,7 @@ static int ns16550_serial_assign_base(struct ns16550_plat *plat, fdt_addr_t base
> > > > > >  #else
> > > > > >  	plat->base = (unsigned long)map_physmem(base, 0, MAP_NOCACHE);
> > > > > >  #endif
> > > > > > +	plat->size = size;
> > > > > >  
> > > > > >  	return 0;
> > > > > >  }
> > > > > > @@ -507,6 +510,7 @@ int ns16550_serial_probe(struct udevice *dev)
> > > > > >  	struct ns16550 *const com_port = dev_get_priv(dev);
> > > > > >  	struct reset_ctl_bulk reset_bulk;
> > > > > >  	fdt_addr_t addr;
> > > > > > +	fdt_addr_t size;
> > > > > >  	int ret;
> > > > > >  
> > > > > >  	/*
> > > > > > @@ -514,8 +518,8 @@ int ns16550_serial_probe(struct udevice *dev)
> > > > > >  	 * or via a PCI bridge, assign plat->base before probing hardware.
> > > > > >  	 */
> > > > > >  	if (device_is_on_pci_bus(dev)) {
> > > > > > -		addr = devfdt_get_addr_pci(dev);
> > > > > > -		ret = ns16550_serial_assign_base(plat, addr);
> > > > > > +		addr = devfdt_get_addr_pci(dev, &size);
> > > > > > +		ret = ns16550_serial_assign_base(plat, addr, size);
> > > > > >  		if (ret)
> > > > > >  			return ret;
> > > > > >  	}
> > > > > > @@ -543,11 +547,12 @@ int ns16550_serial_of_to_plat(struct udevice *dev)
> > > > > >  	struct ns16550_plat *plat = dev_get_plat(dev);
> > > > > >  	const u32 port_type = dev_get_driver_data(dev);
> > > > > >  	fdt_addr_t addr;
> > > > > > +	fdt_size_t size;
> > > > > >  	struct clk clk;
> > > > > >  	int err;
> > > > > >  
> > > > > > -	addr = dev_read_addr(dev);
> > > > > > -	err = ns16550_serial_assign_base(plat, addr);
> > > > > > +	addr = dev_read_addr_size(dev, &size);
> > > > > > +	err = ns16550_serial_assign_base(plat, addr, size);
> > > > > >  	if (err && !device_is_on_pci_bus(dev))
> > > > > >  		return err;
> > > > > >  
> > > > > > diff --git a/include/dm/fdtaddr.h b/include/dm/fdtaddr.h
> > > > > > index dcdc19137cc..6d2fa8f1044 100644
> > > > > > --- a/include/dm/fdtaddr.h
> > > > > > +++ b/include/dm/fdtaddr.h
> > > > > > @@ -168,8 +168,9 @@ fdt_addr_t devfdt_get_addr_size_name(const struct udevice *dev,
> > > > > >   * devfdt_get_addr_pci() - Read an address and handle PCI address translation
> > > > > >   *
> > > > > >   * @dev: Device to read from
> > > > > > + * @sizep: If non-NULL, returns size of address space
> > > > > >   * Return: address or FDT_ADDR_T_NONE if not found
> > > > > >   */
> > > > > > -fdt_addr_t devfdt_get_addr_pci(const struct udevice *dev);
> > > > > > +fdt_addr_t devfdt_get_addr_pci(const struct udevice *dev, fdt_size_t *sizep);
> > > > > >  
> > > > > >  #endif
> > > > > > diff --git a/include/dm/ofnode.h b/include/dm/ofnode.h
> > > > > > index 726d8f82ddf..97cad971611 100644
> > > > > > --- a/include/dm/ofnode.h
> > > > > > +++ b/include/dm/ofnode.h
> > > > > > @@ -1152,13 +1152,15 @@ const uint8_t *ofnode_read_u8_array_ptr(ofnode node, const char *propname,
> > > > > >   * @type:	pci address type (FDT_PCI_SPACE_xxx)
> > > > > >   * @propname:	name of property to find
> > > > > >   * @addr:	returns pci address in the form of fdt_pci_addr
> > > > > > + * @size:	if non-null, returns register-space size
> > > > > >   * Return:
> > > > > >   * 0 if ok, -ENOENT if the property did not exist, -EINVAL if the
> > > > > >   * format of the property was invalid, -ENXIO if the requested
> > > > > >   * address type was not found
> > > > > >   */
> > > > > >  int ofnode_read_pci_addr(ofnode node, enum fdt_pci_space type,
> > > > > > -			 const char *propname, struct fdt_pci_addr *addr);
> > > > > > +			 const char *propname, struct fdt_pci_addr *addr,
> > > > > > +			 fdt_size_t *size);
> > > > > >  
> > > > > >  /**
> > > > > >   * ofnode_read_pci_vendev() - look up PCI vendor and device id
> > > > > > diff --git a/include/dm/read.h b/include/dm/read.h
> > > > > > index c2615f72f40..3c2eea6f0c4 100644
> > > > > > --- a/include/dm/read.h
> > > > > > +++ b/include/dm/read.h
> > > > > > @@ -346,9 +346,10 @@ void *dev_read_addr_ptr(const struct udevice *dev);
> > > > > >   *    fdtdec_get_addr() and friends.
> > > > > >   *
> > > > > >   * @dev: Device to read from
> > > > > > + * @sizep: If non-NULL, returns size of address space found
> > > > > >   * Return: address or FDT_ADDR_T_NONE if not found
> > > > > >   */
> > > > > > -fdt_addr_t dev_read_addr_pci(const struct udevice *dev);
> > > > > > +fdt_addr_t dev_read_addr_pci(const struct udevice *dev, fdt_size_t *sizep);
> > > > > >  
> > > > > >  /**
> > > > > >   * dev_remap_addr() - Get the reg property of a device as a
> > > > > > @@ -996,9 +997,10 @@ static inline void *dev_read_addr_ptr(const struct udevice *dev)
> > > > > >  	return devfdt_get_addr_ptr(dev);
> > > > > >  }
> > > > > >  
> > > > > > -static inline fdt_addr_t dev_read_addr_pci(const struct udevice *dev)
> > > > > > +static inline fdt_addr_t dev_read_addr_pci(const struct udevice *dev,
> > > > > > +					   fdt_size_t *sizep)
> > > > > >  {
> > > > > > -	return devfdt_get_addr_pci(dev);
> > > > > > +	return devfdt_get_addr_pci(dev, sizep);
> > > > > >  }
> > > > > >  
> > > > > >  static inline void *dev_remap_addr(const struct udevice *dev)
> > > > > > diff --git a/include/ns16550.h b/include/ns16550.h
> > > > > > index e7e68663d03..7f481300083 100644
> > > > > > --- a/include/ns16550.h
> > > > > > +++ b/include/ns16550.h
> > > > > > @@ -58,6 +58,7 @@ enum ns16550_flags {
> > > > > >   * struct ns16550_plat - information about a NS16550 port
> > > > > >   *
> > > > > >   * @base:		Base register address
> > > > > > + * @size:		Size of register area in bytes
> > > > > >   * @reg_width:		IO accesses size of registers (in bytes, 1 or 4)
> > > > > >   * @reg_shift:		Shift size of registers (0=byte, 1=16bit, 2=32bit...)
> > > > > >   * @reg_offset:		Offset to start of registers (normally 0)
> > > > > > @@ -67,7 +68,8 @@ enum ns16550_flags {
> > > > > >   * @bdf:		PCI slot/function (pci_dev_t)
> > > > > >   */
> > > > > >  struct ns16550_plat {
> > > > > > -	unsigned long base;
> > > > > > +	ulong base;
> > > > > > +	ulong size;
> > > > > >  	int reg_width;
> > > > > >  	int reg_shift;
> > > > > >  	int reg_offset;
> > > > > > diff --git a/include/serial.h b/include/serial.h
> > > > > > index 42bdf3759c0..205889d28be 100644
> > > > > > --- a/include/serial.h
> > > > > > +++ b/include/serial.h
> > > > > > @@ -137,6 +137,7 @@ enum adr_space_type {
> > > > > >   * @type:	type of the UART chip
> > > > > >   * @addr_space:	address space to access the registers
> > > > > >   * @addr:	physical address of the registers
> > > > > > + * @size:	size of the register area in bytes
> > > > > >   * @reg_width:	size (in bytes) of the IO accesses to the registers
> > > > > >   * @reg_offset:	offset to apply to the @addr from the start of the registers
> > > > > >   * @reg_shift:	quantity to shift the register offsets by
> > > > > > @@ -147,6 +148,7 @@ struct serial_device_info {
> > > > > >  	enum serial_chip_type type;
> > > > > >  	enum adr_space_type addr_space;
> > > > > >  	ulong addr;
> > > > > > +	ulong size;
> > > > > >  	u8 reg_width;
> > > > > >  	u8 reg_offset;
> > > > > >  	u8 reg_shift;
> > > > > > diff --git a/test/dm/pci.c b/test/dm/pci.c
> > > > > > index 70a736cfdb8..8c5e7da9e62 100644
> > > > > > --- a/test/dm/pci.c
> > > > > > +++ b/test/dm/pci.c
> > > > > > @@ -301,10 +301,12 @@ static int dm_test_pci_addr_flat(struct unit_test_state *uts)
> > > > > >  {
> > > > > >  	struct udevice *swap1f, *swap1;
> > > > > >  	ulong io_addr, mem_addr;
> > > > > > +	fdt_addr_t size;
> > > > > >  
> > > > > >  	ut_assertok(dm_pci_bus_find_bdf(PCI_BDF(0, 0x1f, 0), &swap1f));
> > > > > >  	io_addr = dm_pci_read_bar32(swap1f, 0);
> > > > > > -	ut_asserteq(io_addr, dev_read_addr_pci(swap1f));
> > > > > > +	ut_asserteq(io_addr, dev_read_addr_pci(swap1f, &size));
> > > > > > +	ut_asserteq(0, size);
> > > > > >  
> > > > > >  	/*
> > > > > >  	 * This device has both I/O and MEM spaces but the MEM space appears
> > > > > > @@ -312,7 +314,8 @@ static int dm_test_pci_addr_flat(struct unit_test_state *uts)
> > > > > >  	 */
> > > > > >  	ut_assertok(dm_pci_bus_find_bdf(PCI_BDF(0, 0x1, 0), &swap1));
> > > > > >  	mem_addr = dm_pci_read_bar32(swap1, 1);
> > > > > > -	ut_asserteq(mem_addr, dev_read_addr_pci(swap1));
> > > > > > +	ut_asserteq(mem_addr, dev_read_addr_pci(swap1, &size));
> > > > > > +	ut_asserteq(0, size);
> > > > > >  
> > > > > >  	return 0;
> > > > > >  }
> > > > > > @@ -329,12 +332,15 @@ DM_TEST(dm_test_pci_addr_flat, UT_TESTF_SCAN_PDATA | UT_TESTF_SCAN_FDT |
> > > > > >  static int dm_test_pci_addr_live(struct unit_test_state *uts)
> > > > > >  {
> > > > > >  	struct udevice *swap1f, *swap1;
> > > > > > +	fdt_size_t size;
> > > > > >  
> > > > > >  	ut_assertok(dm_pci_bus_find_bdf(PCI_BDF(0, 0x1f, 0), &swap1f));
> > > > > > -	ut_asserteq_64(FDT_ADDR_T_NONE, dev_read_addr_pci(swap1f));
> > > > > > +	ut_asserteq_64(FDT_ADDR_T_NONE, dev_read_addr_pci(swap1f, &size));
> > > > > > +	ut_asserteq(0, size);
> > > > > >  
> > > > > >  	ut_assertok(dm_pci_bus_find_bdf(PCI_BDF(0, 0x1, 0), &swap1));
> > > > > > -	ut_asserteq_64(FDT_ADDR_T_NONE, dev_read_addr_pci(swap1));
> > > > > > +	ut_asserteq_64(FDT_ADDR_T_NONE, dev_read_addr_pci(swap1, &size));
> > > > > > +	ut_asserteq(0, size);
> > > > > >  
> > > > > >  	return 0;
> > > > > >  }
> > > > > > -- 
> > > > > > 2.42.0.rc2.253.gd59a3bf2b4-goog
> > > > > > 
> > > > 
> > > > -- 
> > > > Tom
> > > 
> > > 
> > 
> > -- 
> > Tom
> 
> 

-- 
Tom

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 659 bytes --]

^ permalink raw reply	[flat|nested] 86+ messages in thread

* Re: [PATCH 32/32] pci: serial: Support reading PCI-register size with base
  2023-08-30 19:41             ` Tom Rini
@ 2023-08-30 19:44               ` Pali Rohár
  2023-08-30 20:51                 ` Pali Rohár
  0 siblings, 1 reply; 86+ messages in thread
From: Pali Rohár @ 2023-08-30 19:44 UTC (permalink / raw)
  To: Tom Rini
  Cc: Simon Glass, U-Boot Mailing List, Marek Vasut,
	Abdellatif El Khlifi, Andre Przywara, Bin Meng, Chunfeng Yun,
	Dzmitry Sankouski, GSS_MTK_Uboot_upstream, Heinrich Schuchardt,
	Ilias Apalodimas, Michal Simek, Michal Suchanek, Nikhil M Jain,
	Ryder Lee, Stefan Roese, Weijie Gao

And you too. That was at the time when you and your people were
interested in reviews from others.

On Wednesday 30 August 2023 15:41:57 Tom Rini wrote:
> Then you should probably remove yourself from the places you've listed
> yourself as an interested maintainer, thanks.
> 
> On Wed, Aug 30, 2023 at 09:10:36PM +0200, Pali Rohár wrote:
> > You have already decided, what is the point? You are not taking any my
> > objections into account, so stop writing to me and to others these your
> > stupids bullshits. I'm not an idiot who is interesting for them.
> > 
> > On Wednesday 30 August 2023 15:04:22 Tom Rini wrote:
> > > You're a listed maintainer for a file being changed. If you objected to
> > > the changes, your objection would matter.  If you don't object, you can
> > > just ignore it, or review it, whatever you like.  You need to decide
> > > what you want to do about code you're volunteering to maintain.
> > > 
> > > On Wed, Aug 30, 2023 at 08:39:13PM +0200, Pali Rohár wrote:
> > > > And what? How it is related to the statements that my reviews would also
> > > > ignored? And what you want from me now?
> > > > 
> > > > On Wednesday 30 August 2023 14:17:50 Tom Rini wrote:
> > > > > Pali,
> > > > > 
> > > > > You are specifically listed as a maintainer for drivers/pci/pci_mvebu.c
> > > > > and that is changed by this patch.
> > > > > 
> > > > > On Wed, Aug 30, 2023 at 08:14:59PM +0200, Pali Rohár wrote:
> > > > > > Simon, why you are contacting me? You have wrote to me that you would
> > > > > > ignore my reviews here, so what you want now? Could you please explain
> > > > > > what you are trying to achieve? I'm not going to review this or any
> > > > > > other your changes.
> > > > > > 
> > > > > > On Wednesday 30 August 2023 12:05:03 Simon Glass wrote:
> > > > > > > The PCI helpers read only the base address for a PCI region. In some cases
> > > > > > > the size is needed as well, e.g. to pass along to a driver which needs to
> > > > > > > know the size of its register area.
> > > > > > > 
> > > > > > > Update the functions to allow the size to be returned. For serial, record
> > > > > > > the information and provided it with the serial_info() call.
> > > > > > > 
> > > > > > > A limitation still exists in that the size is not available when OF_LIVE
> > > > > > > is enabled, so take account of that in the tests.
> > > > > > > 
> > > > > > > Signed-off-by: Simon Glass <sjg@chromium.org>
> > > > > > > ---
> > > > > > > 
> > > > > > >  arch/sandbox/dts/test.dts   |  6 +++---
> > > > > > >  drivers/core/fdtaddr.c      |  6 +++---
> > > > > > >  drivers/core/ofnode.c       | 11 ++++++++---
> > > > > > >  drivers/core/read.c         |  6 ++++--
> > > > > > >  drivers/core/util.c         |  2 +-
> > > > > > >  drivers/pci/pci-uclass.c    |  2 +-
> > > > > > >  drivers/pci/pci_mvebu.c     |  3 ++-
> > > > > > >  drivers/pci/pci_tegra.c     |  2 +-
> > > > > > >  drivers/pci/pcie_mediatek.c |  4 ++--
> > > > > > >  drivers/serial/ns16550.c    | 15 ++++++++++-----
> > > > > > >  include/dm/fdtaddr.h        |  3 ++-
> > > > > > >  include/dm/ofnode.h         |  4 +++-
> > > > > > >  include/dm/read.h           |  8 +++++---
> > > > > > >  include/ns16550.h           |  4 +++-
> > > > > > >  include/serial.h            |  2 ++
> > > > > > >  test/dm/pci.c               | 14 ++++++++++----
> > > > > > >  16 files changed, 60 insertions(+), 32 deletions(-)
> > > > > > > 
> > > > > > > diff --git a/arch/sandbox/dts/test.dts b/arch/sandbox/dts/test.dts
> > > > > > > index a413cbe4989..961e8895a49 100644
> > > > > > > --- a/arch/sandbox/dts/test.dts
> > > > > > > +++ b/arch/sandbox/dts/test.dts
> > > > > > > @@ -1087,8 +1087,8 @@
> > > > > > >  		pci@1,0 {
> > > > > > >  			compatible = "pci-generic";
> > > > > > >  			/* reg 0 is at 0x14, using FDT_PCI_SPACE_MEM32 */
> > > > > > > -			reg = <0x02000814 0 0 0 0
> > > > > > > -			       0x01000810 0 0 0 0>;
> > > > > > > +			reg = <0x02000814 0 0 0x80 0
> > > > > > > +			       0x01000810 0 0 0xc0 0>;
> > > > > > >  			sandbox,emul = <&swap_case_emul0_1>;
> > > > > > >  		};
> > > > > > >  		p2sb-pci@2,0 {
> > > > > > > @@ -1115,7 +1115,7 @@
> > > > > > >  		pci@1f,0 {
> > > > > > >  			compatible = "pci-generic";
> > > > > > >  			/* reg 0 is at 0x10, using FDT_PCI_SPACE_IO */
> > > > > > > -			reg = <0x0100f810 0 0 0 0>;
> > > > > > > +			reg = <0x0100f810 0 0 0x100 0>;
> > > > > > >  			sandbox,emul = <&swap_case_emul0_1f>;
> > > > > > >  		};
> > > > > > >  	};
> > > > > > > diff --git a/drivers/core/fdtaddr.c b/drivers/core/fdtaddr.c
> > > > > > > index 546db675aaf..b79d138c419 100644
> > > > > > > --- a/drivers/core/fdtaddr.c
> > > > > > > +++ b/drivers/core/fdtaddr.c
> > > > > > > @@ -215,7 +215,7 @@ void *devfdt_map_physmem(const struct udevice *dev, unsigned long size)
> > > > > > >  	return map_physmem(addr, size, MAP_NOCACHE);
> > > > > > >  }
> > > > > > >  
> > > > > > > -fdt_addr_t devfdt_get_addr_pci(const struct udevice *dev)
> > > > > > > +fdt_addr_t devfdt_get_addr_pci(const struct udevice *dev, fdt_size_t *sizep)
> > > > > > >  {
> > > > > > >  	ulong addr;
> > > > > > >  
> > > > > > > @@ -226,12 +226,12 @@ fdt_addr_t devfdt_get_addr_pci(const struct udevice *dev)
> > > > > > >  		int ret;
> > > > > > >  
> > > > > > >  		ret = ofnode_read_pci_addr(dev_ofnode(dev), FDT_PCI_SPACE_MEM32,
> > > > > > > -					   "reg", &pci_addr);
> > > > > > > +					   "reg", &pci_addr, sizep);
> > > > > > >  		if (ret) {
> > > > > > >  			/* try if there is any i/o-mapped register */
> > > > > > >  			ret = ofnode_read_pci_addr(dev_ofnode(dev),
> > > > > > >  						   FDT_PCI_SPACE_IO, "reg",
> > > > > > > -						   &pci_addr);
> > > > > > > +						   &pci_addr, sizep);
> > > > > > >  			if (ret)
> > > > > > >  				return FDT_ADDR_T_NONE;
> > > > > > >  		}
> > > > > > > diff --git a/drivers/core/ofnode.c b/drivers/core/ofnode.c
> > > > > > > index 2ef4114cb6f..c9cec456f43 100644
> > > > > > > --- a/drivers/core/ofnode.c
> > > > > > > +++ b/drivers/core/ofnode.c
> > > > > > > @@ -1270,7 +1270,8 @@ const uint8_t *ofnode_read_u8_array_ptr(ofnode node, const char *propname,
> > > > > > >  }
> > > > > > >  
> > > > > > >  int ofnode_read_pci_addr(ofnode node, enum fdt_pci_space type,
> > > > > > > -			 const char *propname, struct fdt_pci_addr *addr)
> > > > > > > +			 const char *propname, struct fdt_pci_addr *addr,
> > > > > > > +			 fdt_size_t *size)
> > > > > > >  {
> > > > > > >  	const fdt32_t *cell;
> > > > > > >  	int len;
> > > > > > > @@ -1298,14 +1299,18 @@ int ofnode_read_pci_addr(ofnode node, enum fdt_pci_space type,
> > > > > > >  			      (ulong)fdt32_to_cpu(cell[1]),
> > > > > > >  			      (ulong)fdt32_to_cpu(cell[2]));
> > > > > > >  			if ((fdt32_to_cpu(*cell) & type) == type) {
> > > > > > > +				const unaligned_fdt64_t *ptr;
> > > > > > > +
> > > > > > >  				addr->phys_hi = fdt32_to_cpu(cell[0]);
> > > > > > >  				addr->phys_mid = fdt32_to_cpu(cell[1]);
> > > > > > >  				addr->phys_lo = fdt32_to_cpu(cell[2]);
> > > > > > > +				ptr = (const unaligned_fdt64_t *)(cell + 3);
> > > > > > > +				if (size)
> > > > > > > +					*size = fdt64_to_cpu(*ptr);
> > > > > > >  				break;
> > > > > > >  			}
> > > > > > >  
> > > > > > > -			cell += (FDT_PCI_ADDR_CELLS +
> > > > > > > -				 FDT_PCI_SIZE_CELLS);
> > > > > > > +			cell += FDT_PCI_ADDR_CELLS + FDT_PCI_SIZE_CELLS;
> > > > > > >  		}
> > > > > > >  
> > > > > > >  		if (i == num) {
> > > > > > > diff --git a/drivers/core/read.c b/drivers/core/read.c
> > > > > > > index 49066b59cda..419013451f0 100644
> > > > > > > --- a/drivers/core/read.c
> > > > > > > +++ b/drivers/core/read.c
> > > > > > > @@ -405,13 +405,15 @@ int dev_read_alias_highest_id(const char *stem)
> > > > > > >  	return fdtdec_get_alias_highest_id(gd->fdt_blob, stem);
> > > > > > >  }
> > > > > > >  
> > > > > > > -fdt_addr_t dev_read_addr_pci(const struct udevice *dev)
> > > > > > > +fdt_addr_t dev_read_addr_pci(const struct udevice *dev, fdt_size_t *sizep)
> > > > > > >  {
> > > > > > >  	ulong addr;
> > > > > > >  
> > > > > > >  	addr = dev_read_addr(dev);
> > > > > > > +	if (sizep)
> > > > > > > +		*sizep = 0;
> > > > > > >  	if (addr == FDT_ADDR_T_NONE && !of_live_active())
> > > > > > > -		addr = devfdt_get_addr_pci(dev);
> > > > > > > +		addr = devfdt_get_addr_pci(dev, sizep);
> > > > > > >  
> > > > > > >  	return addr;
> > > > > > >  }
> > > > > > > diff --git a/drivers/core/util.c b/drivers/core/util.c
> > > > > > > index aa60fdd15bc..81497df85ff 100644
> > > > > > > --- a/drivers/core/util.c
> > > > > > > +++ b/drivers/core/util.c
> > > > > > > @@ -30,7 +30,7 @@ int pci_get_devfn(struct udevice *dev)
> > > > > > >  
> > > > > > >  	/* Extract the devfn from fdt_pci_addr */
> > > > > > >  	ret = ofnode_read_pci_addr(dev_ofnode(dev), FDT_PCI_SPACE_CONFIG,
> > > > > > > -				   "reg", &addr);
> > > > > > > +				   "reg", &addr, NULL);
> > > > > > >  	if (ret) {
> > > > > > >  		if (ret != -ENOENT)
> > > > > > >  			return -EINVAL;
> > > > > > > diff --git a/drivers/pci/pci-uclass.c b/drivers/pci/pci-uclass.c
> > > > > > > index 0adcdceb1d3..c670f8754e8 100644
> > > > > > > --- a/drivers/pci/pci-uclass.c
> > > > > > > +++ b/drivers/pci/pci-uclass.c
> > > > > > > @@ -122,7 +122,7 @@ static void pci_dev_find_ofnode(struct udevice *bus, phys_addr_t bdf,
> > > > > > >  
> > > > > > >  	dev_for_each_subnode(node, bus) {
> > > > > > >  		ret = ofnode_read_pci_addr(node, FDT_PCI_SPACE_CONFIG, "reg",
> > > > > > > -					   &addr);
> > > > > > > +					   &addr, NULL);
> > > > > > >  		if (ret)
> > > > > > >  			continue;
> > > > > > >  
> > > > > > > diff --git a/drivers/pci/pci_mvebu.c b/drivers/pci/pci_mvebu.c
> > > > > > > index 93a7508d8a2..25878bde534 100644
> > > > > > > --- a/drivers/pci/pci_mvebu.c
> > > > > > > +++ b/drivers/pci/pci_mvebu.c
> > > > > > > @@ -640,7 +640,8 @@ static int mvebu_pcie_port_parse_dt(ofnode node, ofnode parent, struct mvebu_pci
> > > > > > >  		pcie->is_x4 = true;
> > > > > > >  
> > > > > > >  	/* devfn is in bits [15:8], see PCI_DEV usage */
> > > > > > > -	ret = ofnode_read_pci_addr(node, FDT_PCI_SPACE_CONFIG, "reg", &pci_addr);
> > > > > > > +	ret = ofnode_read_pci_addr(node, FDT_PCI_SPACE_CONFIG, "reg", &pci_addr,
> > > > > > > +				   NULL);
> > > > > > >  	if (ret < 0) {
> > > > > > >  		printf("%s: property \"reg\" is invalid\n", pcie->name);
> > > > > > >  		goto err;
> > > > > > > diff --git a/drivers/pci/pci_tegra.c b/drivers/pci/pci_tegra.c
> > > > > > > index 29d54117e93..ae90bd2fbf1 100644
> > > > > > > --- a/drivers/pci/pci_tegra.c
> > > > > > > +++ b/drivers/pci/pci_tegra.c
> > > > > > > @@ -461,7 +461,7 @@ static int tegra_pcie_parse_port_info(ofnode node, uint *index, uint *lanes)
> > > > > > >  
> > > > > > >  	*lanes = err;
> > > > > > >  
> > > > > > > -	err = ofnode_read_pci_addr(node, 0, "reg", &addr);
> > > > > > > +	err = ofnode_read_pci_addr(node, 0, "reg", &addr, NULL);
> > > > > > >  	if (err < 0) {
> > > > > > >  		pr_err("failed to parse \"reg\" property\n");
> > > > > > >  		return err;
> > > > > > > diff --git a/drivers/pci/pcie_mediatek.c b/drivers/pci/pcie_mediatek.c
> > > > > > > index c6e30e24622..e59ebd13ad0 100644
> > > > > > > --- a/drivers/pci/pcie_mediatek.c
> > > > > > > +++ b/drivers/pci/pcie_mediatek.c
> > > > > > > @@ -660,7 +660,7 @@ static int mtk_pcie_probe(struct udevice *dev)
> > > > > > >  		if (!ofnode_is_enabled(subnode))
> > > > > > >  			continue;
> > > > > > >  
> > > > > > > -		err = ofnode_read_pci_addr(subnode, 0, "reg", &addr);
> > > > > > > +		err = ofnode_read_pci_addr(subnode, 0, "reg", &addr, NULL);
> > > > > > >  		if (err)
> > > > > > >  			return err;
> > > > > > >  
> > > > > > > @@ -699,7 +699,7 @@ static int mtk_pcie_probe_v2(struct udevice *dev)
> > > > > > >  		if (!ofnode_is_enabled(subnode))
> > > > > > >  			continue;
> > > > > > >  
> > > > > > > -		err = ofnode_read_pci_addr(subnode, 0, "reg", &addr);
> > > > > > > +		err = ofnode_read_pci_addr(subnode, 0, "reg", &addr, NULL);
> > > > > > >  		if (err)
> > > > > > >  			return err;
> > > > > > >  
> > > > > > > diff --git a/drivers/serial/ns16550.c b/drivers/serial/ns16550.c
> > > > > > > index eab9537fbae..a349e5e132a 100644
> > > > > > > --- a/drivers/serial/ns16550.c
> > > > > > > +++ b/drivers/serial/ns16550.c
> > > > > > > @@ -479,6 +479,7 @@ static int ns16550_serial_getinfo(struct udevice *dev,
> > > > > > >  	info->addr_space = SERIAL_ADDRESS_SPACE_MEMORY;
> > > > > > >  #endif
> > > > > > >  	info->addr = plat->base;
> > > > > > > +	info->size = plat->size;
> > > > > > >  	info->reg_width = plat->reg_width;
> > > > > > >  	info->reg_shift = plat->reg_shift;
> > > > > > >  	info->reg_offset = plat->reg_offset;
> > > > > > > @@ -487,7 +488,8 @@ static int ns16550_serial_getinfo(struct udevice *dev,
> > > > > > >  	return 0;
> > > > > > >  }
> > > > > > >  
> > > > > > > -static int ns16550_serial_assign_base(struct ns16550_plat *plat, fdt_addr_t base)
> > > > > > > +static int ns16550_serial_assign_base(struct ns16550_plat *plat,
> > > > > > > +				      fdt_addr_t base, fdt_size_t size)
> > > > > > >  {
> > > > > > >  	if (base == FDT_ADDR_T_NONE)
> > > > > > >  		return -EINVAL;
> > > > > > > @@ -497,6 +499,7 @@ static int ns16550_serial_assign_base(struct ns16550_plat *plat, fdt_addr_t base
> > > > > > >  #else
> > > > > > >  	plat->base = (unsigned long)map_physmem(base, 0, MAP_NOCACHE);
> > > > > > >  #endif
> > > > > > > +	plat->size = size;
> > > > > > >  
> > > > > > >  	return 0;
> > > > > > >  }
> > > > > > > @@ -507,6 +510,7 @@ int ns16550_serial_probe(struct udevice *dev)
> > > > > > >  	struct ns16550 *const com_port = dev_get_priv(dev);
> > > > > > >  	struct reset_ctl_bulk reset_bulk;
> > > > > > >  	fdt_addr_t addr;
> > > > > > > +	fdt_addr_t size;
> > > > > > >  	int ret;
> > > > > > >  
> > > > > > >  	/*
> > > > > > > @@ -514,8 +518,8 @@ int ns16550_serial_probe(struct udevice *dev)
> > > > > > >  	 * or via a PCI bridge, assign plat->base before probing hardware.
> > > > > > >  	 */
> > > > > > >  	if (device_is_on_pci_bus(dev)) {
> > > > > > > -		addr = devfdt_get_addr_pci(dev);
> > > > > > > -		ret = ns16550_serial_assign_base(plat, addr);
> > > > > > > +		addr = devfdt_get_addr_pci(dev, &size);
> > > > > > > +		ret = ns16550_serial_assign_base(plat, addr, size);
> > > > > > >  		if (ret)
> > > > > > >  			return ret;
> > > > > > >  	}
> > > > > > > @@ -543,11 +547,12 @@ int ns16550_serial_of_to_plat(struct udevice *dev)
> > > > > > >  	struct ns16550_plat *plat = dev_get_plat(dev);
> > > > > > >  	const u32 port_type = dev_get_driver_data(dev);
> > > > > > >  	fdt_addr_t addr;
> > > > > > > +	fdt_size_t size;
> > > > > > >  	struct clk clk;
> > > > > > >  	int err;
> > > > > > >  
> > > > > > > -	addr = dev_read_addr(dev);
> > > > > > > -	err = ns16550_serial_assign_base(plat, addr);
> > > > > > > +	addr = dev_read_addr_size(dev, &size);
> > > > > > > +	err = ns16550_serial_assign_base(plat, addr, size);
> > > > > > >  	if (err && !device_is_on_pci_bus(dev))
> > > > > > >  		return err;
> > > > > > >  
> > > > > > > diff --git a/include/dm/fdtaddr.h b/include/dm/fdtaddr.h
> > > > > > > index dcdc19137cc..6d2fa8f1044 100644
> > > > > > > --- a/include/dm/fdtaddr.h
> > > > > > > +++ b/include/dm/fdtaddr.h
> > > > > > > @@ -168,8 +168,9 @@ fdt_addr_t devfdt_get_addr_size_name(const struct udevice *dev,
> > > > > > >   * devfdt_get_addr_pci() - Read an address and handle PCI address translation
> > > > > > >   *
> > > > > > >   * @dev: Device to read from
> > > > > > > + * @sizep: If non-NULL, returns size of address space
> > > > > > >   * Return: address or FDT_ADDR_T_NONE if not found
> > > > > > >   */
> > > > > > > -fdt_addr_t devfdt_get_addr_pci(const struct udevice *dev);
> > > > > > > +fdt_addr_t devfdt_get_addr_pci(const struct udevice *dev, fdt_size_t *sizep);
> > > > > > >  
> > > > > > >  #endif
> > > > > > > diff --git a/include/dm/ofnode.h b/include/dm/ofnode.h
> > > > > > > index 726d8f82ddf..97cad971611 100644
> > > > > > > --- a/include/dm/ofnode.h
> > > > > > > +++ b/include/dm/ofnode.h
> > > > > > > @@ -1152,13 +1152,15 @@ const uint8_t *ofnode_read_u8_array_ptr(ofnode node, const char *propname,
> > > > > > >   * @type:	pci address type (FDT_PCI_SPACE_xxx)
> > > > > > >   * @propname:	name of property to find
> > > > > > >   * @addr:	returns pci address in the form of fdt_pci_addr
> > > > > > > + * @size:	if non-null, returns register-space size
> > > > > > >   * Return:
> > > > > > >   * 0 if ok, -ENOENT if the property did not exist, -EINVAL if the
> > > > > > >   * format of the property was invalid, -ENXIO if the requested
> > > > > > >   * address type was not found
> > > > > > >   */
> > > > > > >  int ofnode_read_pci_addr(ofnode node, enum fdt_pci_space type,
> > > > > > > -			 const char *propname, struct fdt_pci_addr *addr);
> > > > > > > +			 const char *propname, struct fdt_pci_addr *addr,
> > > > > > > +			 fdt_size_t *size);
> > > > > > >  
> > > > > > >  /**
> > > > > > >   * ofnode_read_pci_vendev() - look up PCI vendor and device id
> > > > > > > diff --git a/include/dm/read.h b/include/dm/read.h
> > > > > > > index c2615f72f40..3c2eea6f0c4 100644
> > > > > > > --- a/include/dm/read.h
> > > > > > > +++ b/include/dm/read.h
> > > > > > > @@ -346,9 +346,10 @@ void *dev_read_addr_ptr(const struct udevice *dev);
> > > > > > >   *    fdtdec_get_addr() and friends.
> > > > > > >   *
> > > > > > >   * @dev: Device to read from
> > > > > > > + * @sizep: If non-NULL, returns size of address space found
> > > > > > >   * Return: address or FDT_ADDR_T_NONE if not found
> > > > > > >   */
> > > > > > > -fdt_addr_t dev_read_addr_pci(const struct udevice *dev);
> > > > > > > +fdt_addr_t dev_read_addr_pci(const struct udevice *dev, fdt_size_t *sizep);
> > > > > > >  
> > > > > > >  /**
> > > > > > >   * dev_remap_addr() - Get the reg property of a device as a
> > > > > > > @@ -996,9 +997,10 @@ static inline void *dev_read_addr_ptr(const struct udevice *dev)
> > > > > > >  	return devfdt_get_addr_ptr(dev);
> > > > > > >  }
> > > > > > >  
> > > > > > > -static inline fdt_addr_t dev_read_addr_pci(const struct udevice *dev)
> > > > > > > +static inline fdt_addr_t dev_read_addr_pci(const struct udevice *dev,
> > > > > > > +					   fdt_size_t *sizep)
> > > > > > >  {
> > > > > > > -	return devfdt_get_addr_pci(dev);
> > > > > > > +	return devfdt_get_addr_pci(dev, sizep);
> > > > > > >  }
> > > > > > >  
> > > > > > >  static inline void *dev_remap_addr(const struct udevice *dev)
> > > > > > > diff --git a/include/ns16550.h b/include/ns16550.h
> > > > > > > index e7e68663d03..7f481300083 100644
> > > > > > > --- a/include/ns16550.h
> > > > > > > +++ b/include/ns16550.h
> > > > > > > @@ -58,6 +58,7 @@ enum ns16550_flags {
> > > > > > >   * struct ns16550_plat - information about a NS16550 port
> > > > > > >   *
> > > > > > >   * @base:		Base register address
> > > > > > > + * @size:		Size of register area in bytes
> > > > > > >   * @reg_width:		IO accesses size of registers (in bytes, 1 or 4)
> > > > > > >   * @reg_shift:		Shift size of registers (0=byte, 1=16bit, 2=32bit...)
> > > > > > >   * @reg_offset:		Offset to start of registers (normally 0)
> > > > > > > @@ -67,7 +68,8 @@ enum ns16550_flags {
> > > > > > >   * @bdf:		PCI slot/function (pci_dev_t)
> > > > > > >   */
> > > > > > >  struct ns16550_plat {
> > > > > > > -	unsigned long base;
> > > > > > > +	ulong base;
> > > > > > > +	ulong size;
> > > > > > >  	int reg_width;
> > > > > > >  	int reg_shift;
> > > > > > >  	int reg_offset;
> > > > > > > diff --git a/include/serial.h b/include/serial.h
> > > > > > > index 42bdf3759c0..205889d28be 100644
> > > > > > > --- a/include/serial.h
> > > > > > > +++ b/include/serial.h
> > > > > > > @@ -137,6 +137,7 @@ enum adr_space_type {
> > > > > > >   * @type:	type of the UART chip
> > > > > > >   * @addr_space:	address space to access the registers
> > > > > > >   * @addr:	physical address of the registers
> > > > > > > + * @size:	size of the register area in bytes
> > > > > > >   * @reg_width:	size (in bytes) of the IO accesses to the registers
> > > > > > >   * @reg_offset:	offset to apply to the @addr from the start of the registers
> > > > > > >   * @reg_shift:	quantity to shift the register offsets by
> > > > > > > @@ -147,6 +148,7 @@ struct serial_device_info {
> > > > > > >  	enum serial_chip_type type;
> > > > > > >  	enum adr_space_type addr_space;
> > > > > > >  	ulong addr;
> > > > > > > +	ulong size;
> > > > > > >  	u8 reg_width;
> > > > > > >  	u8 reg_offset;
> > > > > > >  	u8 reg_shift;
> > > > > > > diff --git a/test/dm/pci.c b/test/dm/pci.c
> > > > > > > index 70a736cfdb8..8c5e7da9e62 100644
> > > > > > > --- a/test/dm/pci.c
> > > > > > > +++ b/test/dm/pci.c
> > > > > > > @@ -301,10 +301,12 @@ static int dm_test_pci_addr_flat(struct unit_test_state *uts)
> > > > > > >  {
> > > > > > >  	struct udevice *swap1f, *swap1;
> > > > > > >  	ulong io_addr, mem_addr;
> > > > > > > +	fdt_addr_t size;
> > > > > > >  
> > > > > > >  	ut_assertok(dm_pci_bus_find_bdf(PCI_BDF(0, 0x1f, 0), &swap1f));
> > > > > > >  	io_addr = dm_pci_read_bar32(swap1f, 0);
> > > > > > > -	ut_asserteq(io_addr, dev_read_addr_pci(swap1f));
> > > > > > > +	ut_asserteq(io_addr, dev_read_addr_pci(swap1f, &size));
> > > > > > > +	ut_asserteq(0, size);
> > > > > > >  
> > > > > > >  	/*
> > > > > > >  	 * This device has both I/O and MEM spaces but the MEM space appears
> > > > > > > @@ -312,7 +314,8 @@ static int dm_test_pci_addr_flat(struct unit_test_state *uts)
> > > > > > >  	 */
> > > > > > >  	ut_assertok(dm_pci_bus_find_bdf(PCI_BDF(0, 0x1, 0), &swap1));
> > > > > > >  	mem_addr = dm_pci_read_bar32(swap1, 1);
> > > > > > > -	ut_asserteq(mem_addr, dev_read_addr_pci(swap1));
> > > > > > > +	ut_asserteq(mem_addr, dev_read_addr_pci(swap1, &size));
> > > > > > > +	ut_asserteq(0, size);
> > > > > > >  
> > > > > > >  	return 0;
> > > > > > >  }
> > > > > > > @@ -329,12 +332,15 @@ DM_TEST(dm_test_pci_addr_flat, UT_TESTF_SCAN_PDATA | UT_TESTF_SCAN_FDT |
> > > > > > >  static int dm_test_pci_addr_live(struct unit_test_state *uts)
> > > > > > >  {
> > > > > > >  	struct udevice *swap1f, *swap1;
> > > > > > > +	fdt_size_t size;
> > > > > > >  
> > > > > > >  	ut_assertok(dm_pci_bus_find_bdf(PCI_BDF(0, 0x1f, 0), &swap1f));
> > > > > > > -	ut_asserteq_64(FDT_ADDR_T_NONE, dev_read_addr_pci(swap1f));
> > > > > > > +	ut_asserteq_64(FDT_ADDR_T_NONE, dev_read_addr_pci(swap1f, &size));
> > > > > > > +	ut_asserteq(0, size);
> > > > > > >  
> > > > > > >  	ut_assertok(dm_pci_bus_find_bdf(PCI_BDF(0, 0x1, 0), &swap1));
> > > > > > > -	ut_asserteq_64(FDT_ADDR_T_NONE, dev_read_addr_pci(swap1));
> > > > > > > +	ut_asserteq_64(FDT_ADDR_T_NONE, dev_read_addr_pci(swap1, &size));
> > > > > > > +	ut_asserteq(0, size);
> > > > > > >  
> > > > > > >  	return 0;
> > > > > > >  }
> > > > > > > -- 
> > > > > > > 2.42.0.rc2.253.gd59a3bf2b4-goog
> > > > > > > 
> > > > > 
> > > > > -- 
> > > > > Tom
> > > > 
> > > > 
> > > 
> > > -- 
> > > Tom
> > 
> > 
> 
> -- 
> Tom



^ permalink raw reply	[flat|nested] 86+ messages in thread

* Re: [PATCH 32/32] pci: serial: Support reading PCI-register size with base
  2023-08-30 19:44               ` Pali Rohár
@ 2023-08-30 20:51                 ` Pali Rohár
  2023-08-30 21:08                   ` Tom Rini
  0 siblings, 1 reply; 86+ messages in thread
From: Pali Rohár @ 2023-08-30 20:51 UTC (permalink / raw)
  To: Tom Rini
  Cc: Simon Glass, U-Boot Mailing List, Marek Vasut,
	Abdellatif El Khlifi, Andre Przywara, Bin Meng, Chunfeng Yun,
	Dzmitry Sankouski, GSS_MTK_Uboot_upstream, Heinrich Schuchardt,
	Ilias Apalodimas, Michal Simek, Michal Suchanek, Nikhil M Jain,
	Ryder Lee, Stefan Roese, Weijie Gao

So lets recap what you and your persons have done in last 6 months:

* Ignored my changes
* Ignored my reviews
* Ignored my regression reports
* Ignored my reminders

And now you complaining that I'm not going to do another review? Then
you should be the first who step down there as incompetent person. I was
interesting in developing there for a very long time (10+ years I was
active there?).

I think I have already wrote many times that I would not do any new
stuff here for you until you start processing existing reports. Seems
that you have been ignoring these my warnings. And when I starting
applying my statements, you are not happy with it? You should have been
thinking about it year ago.

On Wednesday 30 August 2023 21:44:09 Pali Rohár wrote:
> And you too. That was at the time when you and your people were
> interested in reviews from others.
> 
> On Wednesday 30 August 2023 15:41:57 Tom Rini wrote:
> > Then you should probably remove yourself from the places you've listed
> > yourself as an interested maintainer, thanks.
> > 
> > On Wed, Aug 30, 2023 at 09:10:36PM +0200, Pali Rohár wrote:
> > > You have already decided, what is the point? You are not taking any my
> > > objections into account, so stop writing to me and to others these your
> > > stupids bullshits. I'm not an idiot who is interesting for them.
> > > 
> > > On Wednesday 30 August 2023 15:04:22 Tom Rini wrote:
> > > > You're a listed maintainer for a file being changed. If you objected to
> > > > the changes, your objection would matter.  If you don't object, you can
> > > > just ignore it, or review it, whatever you like.  You need to decide
> > > > what you want to do about code you're volunteering to maintain.
> > > > 
> > > > On Wed, Aug 30, 2023 at 08:39:13PM +0200, Pali Rohár wrote:
> > > > > And what? How it is related to the statements that my reviews would also
> > > > > ignored? And what you want from me now?
> > > > > 
> > > > > On Wednesday 30 August 2023 14:17:50 Tom Rini wrote:
> > > > > > Pali,
> > > > > > 
> > > > > > You are specifically listed as a maintainer for drivers/pci/pci_mvebu.c
> > > > > > and that is changed by this patch.
> > > > > > 
> > > > > > On Wed, Aug 30, 2023 at 08:14:59PM +0200, Pali Rohár wrote:
> > > > > > > Simon, why you are contacting me? You have wrote to me that you would
> > > > > > > ignore my reviews here, so what you want now? Could you please explain
> > > > > > > what you are trying to achieve? I'm not going to review this or any
> > > > > > > other your changes.
> > > > > > > 
> > > > > > > On Wednesday 30 August 2023 12:05:03 Simon Glass wrote:
> > > > > > > > The PCI helpers read only the base address for a PCI region. In some cases
> > > > > > > > the size is needed as well, e.g. to pass along to a driver which needs to
> > > > > > > > know the size of its register area.
> > > > > > > > 
> > > > > > > > Update the functions to allow the size to be returned. For serial, record
> > > > > > > > the information and provided it with the serial_info() call.
> > > > > > > > 
> > > > > > > > A limitation still exists in that the size is not available when OF_LIVE
> > > > > > > > is enabled, so take account of that in the tests.
> > > > > > > > 
> > > > > > > > Signed-off-by: Simon Glass <sjg@chromium.org>
> > > > > > > > ---
> > > > > > > > 
> > > > > > > >  arch/sandbox/dts/test.dts   |  6 +++---
> > > > > > > >  drivers/core/fdtaddr.c      |  6 +++---
> > > > > > > >  drivers/core/ofnode.c       | 11 ++++++++---
> > > > > > > >  drivers/core/read.c         |  6 ++++--
> > > > > > > >  drivers/core/util.c         |  2 +-
> > > > > > > >  drivers/pci/pci-uclass.c    |  2 +-
> > > > > > > >  drivers/pci/pci_mvebu.c     |  3 ++-
> > > > > > > >  drivers/pci/pci_tegra.c     |  2 +-
> > > > > > > >  drivers/pci/pcie_mediatek.c |  4 ++--
> > > > > > > >  drivers/serial/ns16550.c    | 15 ++++++++++-----
> > > > > > > >  include/dm/fdtaddr.h        |  3 ++-
> > > > > > > >  include/dm/ofnode.h         |  4 +++-
> > > > > > > >  include/dm/read.h           |  8 +++++---
> > > > > > > >  include/ns16550.h           |  4 +++-
> > > > > > > >  include/serial.h            |  2 ++
> > > > > > > >  test/dm/pci.c               | 14 ++++++++++----
> > > > > > > >  16 files changed, 60 insertions(+), 32 deletions(-)
> > > > > > > > 
> > > > > > > > diff --git a/arch/sandbox/dts/test.dts b/arch/sandbox/dts/test.dts
> > > > > > > > index a413cbe4989..961e8895a49 100644
> > > > > > > > --- a/arch/sandbox/dts/test.dts
> > > > > > > > +++ b/arch/sandbox/dts/test.dts
> > > > > > > > @@ -1087,8 +1087,8 @@
> > > > > > > >  		pci@1,0 {
> > > > > > > >  			compatible = "pci-generic";
> > > > > > > >  			/* reg 0 is at 0x14, using FDT_PCI_SPACE_MEM32 */
> > > > > > > > -			reg = <0x02000814 0 0 0 0
> > > > > > > > -			       0x01000810 0 0 0 0>;
> > > > > > > > +			reg = <0x02000814 0 0 0x80 0
> > > > > > > > +			       0x01000810 0 0 0xc0 0>;
> > > > > > > >  			sandbox,emul = <&swap_case_emul0_1>;
> > > > > > > >  		};
> > > > > > > >  		p2sb-pci@2,0 {
> > > > > > > > @@ -1115,7 +1115,7 @@
> > > > > > > >  		pci@1f,0 {
> > > > > > > >  			compatible = "pci-generic";
> > > > > > > >  			/* reg 0 is at 0x10, using FDT_PCI_SPACE_IO */
> > > > > > > > -			reg = <0x0100f810 0 0 0 0>;
> > > > > > > > +			reg = <0x0100f810 0 0 0x100 0>;
> > > > > > > >  			sandbox,emul = <&swap_case_emul0_1f>;
> > > > > > > >  		};
> > > > > > > >  	};
> > > > > > > > diff --git a/drivers/core/fdtaddr.c b/drivers/core/fdtaddr.c
> > > > > > > > index 546db675aaf..b79d138c419 100644
> > > > > > > > --- a/drivers/core/fdtaddr.c
> > > > > > > > +++ b/drivers/core/fdtaddr.c
> > > > > > > > @@ -215,7 +215,7 @@ void *devfdt_map_physmem(const struct udevice *dev, unsigned long size)
> > > > > > > >  	return map_physmem(addr, size, MAP_NOCACHE);
> > > > > > > >  }
> > > > > > > >  
> > > > > > > > -fdt_addr_t devfdt_get_addr_pci(const struct udevice *dev)
> > > > > > > > +fdt_addr_t devfdt_get_addr_pci(const struct udevice *dev, fdt_size_t *sizep)
> > > > > > > >  {
> > > > > > > >  	ulong addr;
> > > > > > > >  
> > > > > > > > @@ -226,12 +226,12 @@ fdt_addr_t devfdt_get_addr_pci(const struct udevice *dev)
> > > > > > > >  		int ret;
> > > > > > > >  
> > > > > > > >  		ret = ofnode_read_pci_addr(dev_ofnode(dev), FDT_PCI_SPACE_MEM32,
> > > > > > > > -					   "reg", &pci_addr);
> > > > > > > > +					   "reg", &pci_addr, sizep);
> > > > > > > >  		if (ret) {
> > > > > > > >  			/* try if there is any i/o-mapped register */
> > > > > > > >  			ret = ofnode_read_pci_addr(dev_ofnode(dev),
> > > > > > > >  						   FDT_PCI_SPACE_IO, "reg",
> > > > > > > > -						   &pci_addr);
> > > > > > > > +						   &pci_addr, sizep);
> > > > > > > >  			if (ret)
> > > > > > > >  				return FDT_ADDR_T_NONE;
> > > > > > > >  		}
> > > > > > > > diff --git a/drivers/core/ofnode.c b/drivers/core/ofnode.c
> > > > > > > > index 2ef4114cb6f..c9cec456f43 100644
> > > > > > > > --- a/drivers/core/ofnode.c
> > > > > > > > +++ b/drivers/core/ofnode.c
> > > > > > > > @@ -1270,7 +1270,8 @@ const uint8_t *ofnode_read_u8_array_ptr(ofnode node, const char *propname,
> > > > > > > >  }
> > > > > > > >  
> > > > > > > >  int ofnode_read_pci_addr(ofnode node, enum fdt_pci_space type,
> > > > > > > > -			 const char *propname, struct fdt_pci_addr *addr)
> > > > > > > > +			 const char *propname, struct fdt_pci_addr *addr,
> > > > > > > > +			 fdt_size_t *size)
> > > > > > > >  {
> > > > > > > >  	const fdt32_t *cell;
> > > > > > > >  	int len;
> > > > > > > > @@ -1298,14 +1299,18 @@ int ofnode_read_pci_addr(ofnode node, enum fdt_pci_space type,
> > > > > > > >  			      (ulong)fdt32_to_cpu(cell[1]),
> > > > > > > >  			      (ulong)fdt32_to_cpu(cell[2]));
> > > > > > > >  			if ((fdt32_to_cpu(*cell) & type) == type) {
> > > > > > > > +				const unaligned_fdt64_t *ptr;
> > > > > > > > +
> > > > > > > >  				addr->phys_hi = fdt32_to_cpu(cell[0]);
> > > > > > > >  				addr->phys_mid = fdt32_to_cpu(cell[1]);
> > > > > > > >  				addr->phys_lo = fdt32_to_cpu(cell[2]);
> > > > > > > > +				ptr = (const unaligned_fdt64_t *)(cell + 3);
> > > > > > > > +				if (size)
> > > > > > > > +					*size = fdt64_to_cpu(*ptr);
> > > > > > > >  				break;
> > > > > > > >  			}
> > > > > > > >  
> > > > > > > > -			cell += (FDT_PCI_ADDR_CELLS +
> > > > > > > > -				 FDT_PCI_SIZE_CELLS);
> > > > > > > > +			cell += FDT_PCI_ADDR_CELLS + FDT_PCI_SIZE_CELLS;
> > > > > > > >  		}
> > > > > > > >  
> > > > > > > >  		if (i == num) {
> > > > > > > > diff --git a/drivers/core/read.c b/drivers/core/read.c
> > > > > > > > index 49066b59cda..419013451f0 100644
> > > > > > > > --- a/drivers/core/read.c
> > > > > > > > +++ b/drivers/core/read.c
> > > > > > > > @@ -405,13 +405,15 @@ int dev_read_alias_highest_id(const char *stem)
> > > > > > > >  	return fdtdec_get_alias_highest_id(gd->fdt_blob, stem);
> > > > > > > >  }
> > > > > > > >  
> > > > > > > > -fdt_addr_t dev_read_addr_pci(const struct udevice *dev)
> > > > > > > > +fdt_addr_t dev_read_addr_pci(const struct udevice *dev, fdt_size_t *sizep)
> > > > > > > >  {
> > > > > > > >  	ulong addr;
> > > > > > > >  
> > > > > > > >  	addr = dev_read_addr(dev);
> > > > > > > > +	if (sizep)
> > > > > > > > +		*sizep = 0;
> > > > > > > >  	if (addr == FDT_ADDR_T_NONE && !of_live_active())
> > > > > > > > -		addr = devfdt_get_addr_pci(dev);
> > > > > > > > +		addr = devfdt_get_addr_pci(dev, sizep);
> > > > > > > >  
> > > > > > > >  	return addr;
> > > > > > > >  }
> > > > > > > > diff --git a/drivers/core/util.c b/drivers/core/util.c
> > > > > > > > index aa60fdd15bc..81497df85ff 100644
> > > > > > > > --- a/drivers/core/util.c
> > > > > > > > +++ b/drivers/core/util.c
> > > > > > > > @@ -30,7 +30,7 @@ int pci_get_devfn(struct udevice *dev)
> > > > > > > >  
> > > > > > > >  	/* Extract the devfn from fdt_pci_addr */
> > > > > > > >  	ret = ofnode_read_pci_addr(dev_ofnode(dev), FDT_PCI_SPACE_CONFIG,
> > > > > > > > -				   "reg", &addr);
> > > > > > > > +				   "reg", &addr, NULL);
> > > > > > > >  	if (ret) {
> > > > > > > >  		if (ret != -ENOENT)
> > > > > > > >  			return -EINVAL;
> > > > > > > > diff --git a/drivers/pci/pci-uclass.c b/drivers/pci/pci-uclass.c
> > > > > > > > index 0adcdceb1d3..c670f8754e8 100644
> > > > > > > > --- a/drivers/pci/pci-uclass.c
> > > > > > > > +++ b/drivers/pci/pci-uclass.c
> > > > > > > > @@ -122,7 +122,7 @@ static void pci_dev_find_ofnode(struct udevice *bus, phys_addr_t bdf,
> > > > > > > >  
> > > > > > > >  	dev_for_each_subnode(node, bus) {
> > > > > > > >  		ret = ofnode_read_pci_addr(node, FDT_PCI_SPACE_CONFIG, "reg",
> > > > > > > > -					   &addr);
> > > > > > > > +					   &addr, NULL);
> > > > > > > >  		if (ret)
> > > > > > > >  			continue;
> > > > > > > >  
> > > > > > > > diff --git a/drivers/pci/pci_mvebu.c b/drivers/pci/pci_mvebu.c
> > > > > > > > index 93a7508d8a2..25878bde534 100644
> > > > > > > > --- a/drivers/pci/pci_mvebu.c
> > > > > > > > +++ b/drivers/pci/pci_mvebu.c
> > > > > > > > @@ -640,7 +640,8 @@ static int mvebu_pcie_port_parse_dt(ofnode node, ofnode parent, struct mvebu_pci
> > > > > > > >  		pcie->is_x4 = true;
> > > > > > > >  
> > > > > > > >  	/* devfn is in bits [15:8], see PCI_DEV usage */
> > > > > > > > -	ret = ofnode_read_pci_addr(node, FDT_PCI_SPACE_CONFIG, "reg", &pci_addr);
> > > > > > > > +	ret = ofnode_read_pci_addr(node, FDT_PCI_SPACE_CONFIG, "reg", &pci_addr,
> > > > > > > > +				   NULL);
> > > > > > > >  	if (ret < 0) {
> > > > > > > >  		printf("%s: property \"reg\" is invalid\n", pcie->name);
> > > > > > > >  		goto err;
> > > > > > > > diff --git a/drivers/pci/pci_tegra.c b/drivers/pci/pci_tegra.c
> > > > > > > > index 29d54117e93..ae90bd2fbf1 100644
> > > > > > > > --- a/drivers/pci/pci_tegra.c
> > > > > > > > +++ b/drivers/pci/pci_tegra.c
> > > > > > > > @@ -461,7 +461,7 @@ static int tegra_pcie_parse_port_info(ofnode node, uint *index, uint *lanes)
> > > > > > > >  
> > > > > > > >  	*lanes = err;
> > > > > > > >  
> > > > > > > > -	err = ofnode_read_pci_addr(node, 0, "reg", &addr);
> > > > > > > > +	err = ofnode_read_pci_addr(node, 0, "reg", &addr, NULL);
> > > > > > > >  	if (err < 0) {
> > > > > > > >  		pr_err("failed to parse \"reg\" property\n");
> > > > > > > >  		return err;
> > > > > > > > diff --git a/drivers/pci/pcie_mediatek.c b/drivers/pci/pcie_mediatek.c
> > > > > > > > index c6e30e24622..e59ebd13ad0 100644
> > > > > > > > --- a/drivers/pci/pcie_mediatek.c
> > > > > > > > +++ b/drivers/pci/pcie_mediatek.c
> > > > > > > > @@ -660,7 +660,7 @@ static int mtk_pcie_probe(struct udevice *dev)
> > > > > > > >  		if (!ofnode_is_enabled(subnode))
> > > > > > > >  			continue;
> > > > > > > >  
> > > > > > > > -		err = ofnode_read_pci_addr(subnode, 0, "reg", &addr);
> > > > > > > > +		err = ofnode_read_pci_addr(subnode, 0, "reg", &addr, NULL);
> > > > > > > >  		if (err)
> > > > > > > >  			return err;
> > > > > > > >  
> > > > > > > > @@ -699,7 +699,7 @@ static int mtk_pcie_probe_v2(struct udevice *dev)
> > > > > > > >  		if (!ofnode_is_enabled(subnode))
> > > > > > > >  			continue;
> > > > > > > >  
> > > > > > > > -		err = ofnode_read_pci_addr(subnode, 0, "reg", &addr);
> > > > > > > > +		err = ofnode_read_pci_addr(subnode, 0, "reg", &addr, NULL);
> > > > > > > >  		if (err)
> > > > > > > >  			return err;
> > > > > > > >  
> > > > > > > > diff --git a/drivers/serial/ns16550.c b/drivers/serial/ns16550.c
> > > > > > > > index eab9537fbae..a349e5e132a 100644
> > > > > > > > --- a/drivers/serial/ns16550.c
> > > > > > > > +++ b/drivers/serial/ns16550.c
> > > > > > > > @@ -479,6 +479,7 @@ static int ns16550_serial_getinfo(struct udevice *dev,
> > > > > > > >  	info->addr_space = SERIAL_ADDRESS_SPACE_MEMORY;
> > > > > > > >  #endif
> > > > > > > >  	info->addr = plat->base;
> > > > > > > > +	info->size = plat->size;
> > > > > > > >  	info->reg_width = plat->reg_width;
> > > > > > > >  	info->reg_shift = plat->reg_shift;
> > > > > > > >  	info->reg_offset = plat->reg_offset;
> > > > > > > > @@ -487,7 +488,8 @@ static int ns16550_serial_getinfo(struct udevice *dev,
> > > > > > > >  	return 0;
> > > > > > > >  }
> > > > > > > >  
> > > > > > > > -static int ns16550_serial_assign_base(struct ns16550_plat *plat, fdt_addr_t base)
> > > > > > > > +static int ns16550_serial_assign_base(struct ns16550_plat *plat,
> > > > > > > > +				      fdt_addr_t base, fdt_size_t size)
> > > > > > > >  {
> > > > > > > >  	if (base == FDT_ADDR_T_NONE)
> > > > > > > >  		return -EINVAL;
> > > > > > > > @@ -497,6 +499,7 @@ static int ns16550_serial_assign_base(struct ns16550_plat *plat, fdt_addr_t base
> > > > > > > >  #else
> > > > > > > >  	plat->base = (unsigned long)map_physmem(base, 0, MAP_NOCACHE);
> > > > > > > >  #endif
> > > > > > > > +	plat->size = size;
> > > > > > > >  
> > > > > > > >  	return 0;
> > > > > > > >  }
> > > > > > > > @@ -507,6 +510,7 @@ int ns16550_serial_probe(struct udevice *dev)
> > > > > > > >  	struct ns16550 *const com_port = dev_get_priv(dev);
> > > > > > > >  	struct reset_ctl_bulk reset_bulk;
> > > > > > > >  	fdt_addr_t addr;
> > > > > > > > +	fdt_addr_t size;
> > > > > > > >  	int ret;
> > > > > > > >  
> > > > > > > >  	/*
> > > > > > > > @@ -514,8 +518,8 @@ int ns16550_serial_probe(struct udevice *dev)
> > > > > > > >  	 * or via a PCI bridge, assign plat->base before probing hardware.
> > > > > > > >  	 */
> > > > > > > >  	if (device_is_on_pci_bus(dev)) {
> > > > > > > > -		addr = devfdt_get_addr_pci(dev);
> > > > > > > > -		ret = ns16550_serial_assign_base(plat, addr);
> > > > > > > > +		addr = devfdt_get_addr_pci(dev, &size);
> > > > > > > > +		ret = ns16550_serial_assign_base(plat, addr, size);
> > > > > > > >  		if (ret)
> > > > > > > >  			return ret;
> > > > > > > >  	}
> > > > > > > > @@ -543,11 +547,12 @@ int ns16550_serial_of_to_plat(struct udevice *dev)
> > > > > > > >  	struct ns16550_plat *plat = dev_get_plat(dev);
> > > > > > > >  	const u32 port_type = dev_get_driver_data(dev);
> > > > > > > >  	fdt_addr_t addr;
> > > > > > > > +	fdt_size_t size;
> > > > > > > >  	struct clk clk;
> > > > > > > >  	int err;
> > > > > > > >  
> > > > > > > > -	addr = dev_read_addr(dev);
> > > > > > > > -	err = ns16550_serial_assign_base(plat, addr);
> > > > > > > > +	addr = dev_read_addr_size(dev, &size);
> > > > > > > > +	err = ns16550_serial_assign_base(plat, addr, size);
> > > > > > > >  	if (err && !device_is_on_pci_bus(dev))
> > > > > > > >  		return err;
> > > > > > > >  
> > > > > > > > diff --git a/include/dm/fdtaddr.h b/include/dm/fdtaddr.h
> > > > > > > > index dcdc19137cc..6d2fa8f1044 100644
> > > > > > > > --- a/include/dm/fdtaddr.h
> > > > > > > > +++ b/include/dm/fdtaddr.h
> > > > > > > > @@ -168,8 +168,9 @@ fdt_addr_t devfdt_get_addr_size_name(const struct udevice *dev,
> > > > > > > >   * devfdt_get_addr_pci() - Read an address and handle PCI address translation
> > > > > > > >   *
> > > > > > > >   * @dev: Device to read from
> > > > > > > > + * @sizep: If non-NULL, returns size of address space
> > > > > > > >   * Return: address or FDT_ADDR_T_NONE if not found
> > > > > > > >   */
> > > > > > > > -fdt_addr_t devfdt_get_addr_pci(const struct udevice *dev);
> > > > > > > > +fdt_addr_t devfdt_get_addr_pci(const struct udevice *dev, fdt_size_t *sizep);
> > > > > > > >  
> > > > > > > >  #endif
> > > > > > > > diff --git a/include/dm/ofnode.h b/include/dm/ofnode.h
> > > > > > > > index 726d8f82ddf..97cad971611 100644
> > > > > > > > --- a/include/dm/ofnode.h
> > > > > > > > +++ b/include/dm/ofnode.h
> > > > > > > > @@ -1152,13 +1152,15 @@ const uint8_t *ofnode_read_u8_array_ptr(ofnode node, const char *propname,
> > > > > > > >   * @type:	pci address type (FDT_PCI_SPACE_xxx)
> > > > > > > >   * @propname:	name of property to find
> > > > > > > >   * @addr:	returns pci address in the form of fdt_pci_addr
> > > > > > > > + * @size:	if non-null, returns register-space size
> > > > > > > >   * Return:
> > > > > > > >   * 0 if ok, -ENOENT if the property did not exist, -EINVAL if the
> > > > > > > >   * format of the property was invalid, -ENXIO if the requested
> > > > > > > >   * address type was not found
> > > > > > > >   */
> > > > > > > >  int ofnode_read_pci_addr(ofnode node, enum fdt_pci_space type,
> > > > > > > > -			 const char *propname, struct fdt_pci_addr *addr);
> > > > > > > > +			 const char *propname, struct fdt_pci_addr *addr,
> > > > > > > > +			 fdt_size_t *size);
> > > > > > > >  
> > > > > > > >  /**
> > > > > > > >   * ofnode_read_pci_vendev() - look up PCI vendor and device id
> > > > > > > > diff --git a/include/dm/read.h b/include/dm/read.h
> > > > > > > > index c2615f72f40..3c2eea6f0c4 100644
> > > > > > > > --- a/include/dm/read.h
> > > > > > > > +++ b/include/dm/read.h
> > > > > > > > @@ -346,9 +346,10 @@ void *dev_read_addr_ptr(const struct udevice *dev);
> > > > > > > >   *    fdtdec_get_addr() and friends.
> > > > > > > >   *
> > > > > > > >   * @dev: Device to read from
> > > > > > > > + * @sizep: If non-NULL, returns size of address space found
> > > > > > > >   * Return: address or FDT_ADDR_T_NONE if not found
> > > > > > > >   */
> > > > > > > > -fdt_addr_t dev_read_addr_pci(const struct udevice *dev);
> > > > > > > > +fdt_addr_t dev_read_addr_pci(const struct udevice *dev, fdt_size_t *sizep);
> > > > > > > >  
> > > > > > > >  /**
> > > > > > > >   * dev_remap_addr() - Get the reg property of a device as a
> > > > > > > > @@ -996,9 +997,10 @@ static inline void *dev_read_addr_ptr(const struct udevice *dev)
> > > > > > > >  	return devfdt_get_addr_ptr(dev);
> > > > > > > >  }
> > > > > > > >  
> > > > > > > > -static inline fdt_addr_t dev_read_addr_pci(const struct udevice *dev)
> > > > > > > > +static inline fdt_addr_t dev_read_addr_pci(const struct udevice *dev,
> > > > > > > > +					   fdt_size_t *sizep)
> > > > > > > >  {
> > > > > > > > -	return devfdt_get_addr_pci(dev);
> > > > > > > > +	return devfdt_get_addr_pci(dev, sizep);
> > > > > > > >  }
> > > > > > > >  
> > > > > > > >  static inline void *dev_remap_addr(const struct udevice *dev)
> > > > > > > > diff --git a/include/ns16550.h b/include/ns16550.h
> > > > > > > > index e7e68663d03..7f481300083 100644
> > > > > > > > --- a/include/ns16550.h
> > > > > > > > +++ b/include/ns16550.h
> > > > > > > > @@ -58,6 +58,7 @@ enum ns16550_flags {
> > > > > > > >   * struct ns16550_plat - information about a NS16550 port
> > > > > > > >   *
> > > > > > > >   * @base:		Base register address
> > > > > > > > + * @size:		Size of register area in bytes
> > > > > > > >   * @reg_width:		IO accesses size of registers (in bytes, 1 or 4)
> > > > > > > >   * @reg_shift:		Shift size of registers (0=byte, 1=16bit, 2=32bit...)
> > > > > > > >   * @reg_offset:		Offset to start of registers (normally 0)
> > > > > > > > @@ -67,7 +68,8 @@ enum ns16550_flags {
> > > > > > > >   * @bdf:		PCI slot/function (pci_dev_t)
> > > > > > > >   */
> > > > > > > >  struct ns16550_plat {
> > > > > > > > -	unsigned long base;
> > > > > > > > +	ulong base;
> > > > > > > > +	ulong size;
> > > > > > > >  	int reg_width;
> > > > > > > >  	int reg_shift;
> > > > > > > >  	int reg_offset;
> > > > > > > > diff --git a/include/serial.h b/include/serial.h
> > > > > > > > index 42bdf3759c0..205889d28be 100644
> > > > > > > > --- a/include/serial.h
> > > > > > > > +++ b/include/serial.h
> > > > > > > > @@ -137,6 +137,7 @@ enum adr_space_type {
> > > > > > > >   * @type:	type of the UART chip
> > > > > > > >   * @addr_space:	address space to access the registers
> > > > > > > >   * @addr:	physical address of the registers
> > > > > > > > + * @size:	size of the register area in bytes
> > > > > > > >   * @reg_width:	size (in bytes) of the IO accesses to the registers
> > > > > > > >   * @reg_offset:	offset to apply to the @addr from the start of the registers
> > > > > > > >   * @reg_shift:	quantity to shift the register offsets by
> > > > > > > > @@ -147,6 +148,7 @@ struct serial_device_info {
> > > > > > > >  	enum serial_chip_type type;
> > > > > > > >  	enum adr_space_type addr_space;
> > > > > > > >  	ulong addr;
> > > > > > > > +	ulong size;
> > > > > > > >  	u8 reg_width;
> > > > > > > >  	u8 reg_offset;
> > > > > > > >  	u8 reg_shift;
> > > > > > > > diff --git a/test/dm/pci.c b/test/dm/pci.c
> > > > > > > > index 70a736cfdb8..8c5e7da9e62 100644
> > > > > > > > --- a/test/dm/pci.c
> > > > > > > > +++ b/test/dm/pci.c
> > > > > > > > @@ -301,10 +301,12 @@ static int dm_test_pci_addr_flat(struct unit_test_state *uts)
> > > > > > > >  {
> > > > > > > >  	struct udevice *swap1f, *swap1;
> > > > > > > >  	ulong io_addr, mem_addr;
> > > > > > > > +	fdt_addr_t size;
> > > > > > > >  
> > > > > > > >  	ut_assertok(dm_pci_bus_find_bdf(PCI_BDF(0, 0x1f, 0), &swap1f));
> > > > > > > >  	io_addr = dm_pci_read_bar32(swap1f, 0);
> > > > > > > > -	ut_asserteq(io_addr, dev_read_addr_pci(swap1f));
> > > > > > > > +	ut_asserteq(io_addr, dev_read_addr_pci(swap1f, &size));
> > > > > > > > +	ut_asserteq(0, size);
> > > > > > > >  
> > > > > > > >  	/*
> > > > > > > >  	 * This device has both I/O and MEM spaces but the MEM space appears
> > > > > > > > @@ -312,7 +314,8 @@ static int dm_test_pci_addr_flat(struct unit_test_state *uts)
> > > > > > > >  	 */
> > > > > > > >  	ut_assertok(dm_pci_bus_find_bdf(PCI_BDF(0, 0x1, 0), &swap1));
> > > > > > > >  	mem_addr = dm_pci_read_bar32(swap1, 1);
> > > > > > > > -	ut_asserteq(mem_addr, dev_read_addr_pci(swap1));
> > > > > > > > +	ut_asserteq(mem_addr, dev_read_addr_pci(swap1, &size));
> > > > > > > > +	ut_asserteq(0, size);
> > > > > > > >  
> > > > > > > >  	return 0;
> > > > > > > >  }
> > > > > > > > @@ -329,12 +332,15 @@ DM_TEST(dm_test_pci_addr_flat, UT_TESTF_SCAN_PDATA | UT_TESTF_SCAN_FDT |
> > > > > > > >  static int dm_test_pci_addr_live(struct unit_test_state *uts)
> > > > > > > >  {
> > > > > > > >  	struct udevice *swap1f, *swap1;
> > > > > > > > +	fdt_size_t size;
> > > > > > > >  
> > > > > > > >  	ut_assertok(dm_pci_bus_find_bdf(PCI_BDF(0, 0x1f, 0), &swap1f));
> > > > > > > > -	ut_asserteq_64(FDT_ADDR_T_NONE, dev_read_addr_pci(swap1f));
> > > > > > > > +	ut_asserteq_64(FDT_ADDR_T_NONE, dev_read_addr_pci(swap1f, &size));
> > > > > > > > +	ut_asserteq(0, size);
> > > > > > > >  
> > > > > > > >  	ut_assertok(dm_pci_bus_find_bdf(PCI_BDF(0, 0x1, 0), &swap1));
> > > > > > > > -	ut_asserteq_64(FDT_ADDR_T_NONE, dev_read_addr_pci(swap1));
> > > > > > > > +	ut_asserteq_64(FDT_ADDR_T_NONE, dev_read_addr_pci(swap1, &size));
> > > > > > > > +	ut_asserteq(0, size);
> > > > > > > >  
> > > > > > > >  	return 0;
> > > > > > > >  }
> > > > > > > > -- 
> > > > > > > > 2.42.0.rc2.253.gd59a3bf2b4-goog
> > > > > > > > 
> > > > > > 
> > > > > > -- 
> > > > > > Tom
> > > > > 
> > > > > 
> > > > 
> > > > -- 
> > > > Tom
> > > 
> > > 
> > 
> > -- 
> > Tom
> 
> 

^ permalink raw reply	[flat|nested] 86+ messages in thread

* Re: [PATCH 32/32] pci: serial: Support reading PCI-register size with base
  2023-08-30 20:51                 ` Pali Rohár
@ 2023-08-30 21:08                   ` Tom Rini
  2023-08-30 21:13                     ` Pali Rohár
  0 siblings, 1 reply; 86+ messages in thread
From: Tom Rini @ 2023-08-30 21:08 UTC (permalink / raw)
  To: Pali Rohár
  Cc: Simon Glass, U-Boot Mailing List, Marek Vasut,
	Abdellatif El Khlifi, Andre Przywara, Bin Meng, Chunfeng Yun,
	Dzmitry Sankouski, GSS_MTK_Uboot_upstream, Heinrich Schuchardt,
	Ilias Apalodimas, Michal Simek, Michal Suchanek, Nikhil M Jain,
	Ryder Lee, Stefan Roese, Weijie Gao

[-- Attachment #1: Type: text/plain, Size: 26696 bytes --]

I don't think it's worth re-hashing the same arguments over and over.
There is no "my persons", there is the public community.  If you no
longer wish to participate, I can remove you from the maintainers
entries you're listed in.  But please stop with the long arguments
unrelated to the patches at hand when there's a dozen people and other
lists on CC.

On Wed, Aug 30, 2023 at 10:51:45PM +0200, Pali Rohár wrote:
> So lets recap what you and your persons have done in last 6 months:
> 
> * Ignored my changes
> * Ignored my reviews
> * Ignored my regression reports
> * Ignored my reminders
> 
> And now you complaining that I'm not going to do another review? Then
> you should be the first who step down there as incompetent person. I was
> interesting in developing there for a very long time (10+ years I was
> active there?).
> 
> I think I have already wrote many times that I would not do any new
> stuff here for you until you start processing existing reports. Seems
> that you have been ignoring these my warnings. And when I starting
> applying my statements, you are not happy with it? You should have been
> thinking about it year ago.
> 
> On Wednesday 30 August 2023 21:44:09 Pali Rohár wrote:
> > And you too. That was at the time when you and your people were
> > interested in reviews from others.
> > 
> > On Wednesday 30 August 2023 15:41:57 Tom Rini wrote:
> > > Then you should probably remove yourself from the places you've listed
> > > yourself as an interested maintainer, thanks.
> > > 
> > > On Wed, Aug 30, 2023 at 09:10:36PM +0200, Pali Rohár wrote:
> > > > You have already decided, what is the point? You are not taking any my
> > > > objections into account, so stop writing to me and to others these your
> > > > stupids bullshits. I'm not an idiot who is interesting for them.
> > > > 
> > > > On Wednesday 30 August 2023 15:04:22 Tom Rini wrote:
> > > > > You're a listed maintainer for a file being changed. If you objected to
> > > > > the changes, your objection would matter.  If you don't object, you can
> > > > > just ignore it, or review it, whatever you like.  You need to decide
> > > > > what you want to do about code you're volunteering to maintain.
> > > > > 
> > > > > On Wed, Aug 30, 2023 at 08:39:13PM +0200, Pali Rohár wrote:
> > > > > > And what? How it is related to the statements that my reviews would also
> > > > > > ignored? And what you want from me now?
> > > > > > 
> > > > > > On Wednesday 30 August 2023 14:17:50 Tom Rini wrote:
> > > > > > > Pali,
> > > > > > > 
> > > > > > > You are specifically listed as a maintainer for drivers/pci/pci_mvebu.c
> > > > > > > and that is changed by this patch.
> > > > > > > 
> > > > > > > On Wed, Aug 30, 2023 at 08:14:59PM +0200, Pali Rohár wrote:
> > > > > > > > Simon, why you are contacting me? You have wrote to me that you would
> > > > > > > > ignore my reviews here, so what you want now? Could you please explain
> > > > > > > > what you are trying to achieve? I'm not going to review this or any
> > > > > > > > other your changes.
> > > > > > > > 
> > > > > > > > On Wednesday 30 August 2023 12:05:03 Simon Glass wrote:
> > > > > > > > > The PCI helpers read only the base address for a PCI region. In some cases
> > > > > > > > > the size is needed as well, e.g. to pass along to a driver which needs to
> > > > > > > > > know the size of its register area.
> > > > > > > > > 
> > > > > > > > > Update the functions to allow the size to be returned. For serial, record
> > > > > > > > > the information and provided it with the serial_info() call.
> > > > > > > > > 
> > > > > > > > > A limitation still exists in that the size is not available when OF_LIVE
> > > > > > > > > is enabled, so take account of that in the tests.
> > > > > > > > > 
> > > > > > > > > Signed-off-by: Simon Glass <sjg@chromium.org>
> > > > > > > > > ---
> > > > > > > > > 
> > > > > > > > >  arch/sandbox/dts/test.dts   |  6 +++---
> > > > > > > > >  drivers/core/fdtaddr.c      |  6 +++---
> > > > > > > > >  drivers/core/ofnode.c       | 11 ++++++++---
> > > > > > > > >  drivers/core/read.c         |  6 ++++--
> > > > > > > > >  drivers/core/util.c         |  2 +-
> > > > > > > > >  drivers/pci/pci-uclass.c    |  2 +-
> > > > > > > > >  drivers/pci/pci_mvebu.c     |  3 ++-
> > > > > > > > >  drivers/pci/pci_tegra.c     |  2 +-
> > > > > > > > >  drivers/pci/pcie_mediatek.c |  4 ++--
> > > > > > > > >  drivers/serial/ns16550.c    | 15 ++++++++++-----
> > > > > > > > >  include/dm/fdtaddr.h        |  3 ++-
> > > > > > > > >  include/dm/ofnode.h         |  4 +++-
> > > > > > > > >  include/dm/read.h           |  8 +++++---
> > > > > > > > >  include/ns16550.h           |  4 +++-
> > > > > > > > >  include/serial.h            |  2 ++
> > > > > > > > >  test/dm/pci.c               | 14 ++++++++++----
> > > > > > > > >  16 files changed, 60 insertions(+), 32 deletions(-)
> > > > > > > > > 
> > > > > > > > > diff --git a/arch/sandbox/dts/test.dts b/arch/sandbox/dts/test.dts
> > > > > > > > > index a413cbe4989..961e8895a49 100644
> > > > > > > > > --- a/arch/sandbox/dts/test.dts
> > > > > > > > > +++ b/arch/sandbox/dts/test.dts
> > > > > > > > > @@ -1087,8 +1087,8 @@
> > > > > > > > >  		pci@1,0 {
> > > > > > > > >  			compatible = "pci-generic";
> > > > > > > > >  			/* reg 0 is at 0x14, using FDT_PCI_SPACE_MEM32 */
> > > > > > > > > -			reg = <0x02000814 0 0 0 0
> > > > > > > > > -			       0x01000810 0 0 0 0>;
> > > > > > > > > +			reg = <0x02000814 0 0 0x80 0
> > > > > > > > > +			       0x01000810 0 0 0xc0 0>;
> > > > > > > > >  			sandbox,emul = <&swap_case_emul0_1>;
> > > > > > > > >  		};
> > > > > > > > >  		p2sb-pci@2,0 {
> > > > > > > > > @@ -1115,7 +1115,7 @@
> > > > > > > > >  		pci@1f,0 {
> > > > > > > > >  			compatible = "pci-generic";
> > > > > > > > >  			/* reg 0 is at 0x10, using FDT_PCI_SPACE_IO */
> > > > > > > > > -			reg = <0x0100f810 0 0 0 0>;
> > > > > > > > > +			reg = <0x0100f810 0 0 0x100 0>;
> > > > > > > > >  			sandbox,emul = <&swap_case_emul0_1f>;
> > > > > > > > >  		};
> > > > > > > > >  	};
> > > > > > > > > diff --git a/drivers/core/fdtaddr.c b/drivers/core/fdtaddr.c
> > > > > > > > > index 546db675aaf..b79d138c419 100644
> > > > > > > > > --- a/drivers/core/fdtaddr.c
> > > > > > > > > +++ b/drivers/core/fdtaddr.c
> > > > > > > > > @@ -215,7 +215,7 @@ void *devfdt_map_physmem(const struct udevice *dev, unsigned long size)
> > > > > > > > >  	return map_physmem(addr, size, MAP_NOCACHE);
> > > > > > > > >  }
> > > > > > > > >  
> > > > > > > > > -fdt_addr_t devfdt_get_addr_pci(const struct udevice *dev)
> > > > > > > > > +fdt_addr_t devfdt_get_addr_pci(const struct udevice *dev, fdt_size_t *sizep)
> > > > > > > > >  {
> > > > > > > > >  	ulong addr;
> > > > > > > > >  
> > > > > > > > > @@ -226,12 +226,12 @@ fdt_addr_t devfdt_get_addr_pci(const struct udevice *dev)
> > > > > > > > >  		int ret;
> > > > > > > > >  
> > > > > > > > >  		ret = ofnode_read_pci_addr(dev_ofnode(dev), FDT_PCI_SPACE_MEM32,
> > > > > > > > > -					   "reg", &pci_addr);
> > > > > > > > > +					   "reg", &pci_addr, sizep);
> > > > > > > > >  		if (ret) {
> > > > > > > > >  			/* try if there is any i/o-mapped register */
> > > > > > > > >  			ret = ofnode_read_pci_addr(dev_ofnode(dev),
> > > > > > > > >  						   FDT_PCI_SPACE_IO, "reg",
> > > > > > > > > -						   &pci_addr);
> > > > > > > > > +						   &pci_addr, sizep);
> > > > > > > > >  			if (ret)
> > > > > > > > >  				return FDT_ADDR_T_NONE;
> > > > > > > > >  		}
> > > > > > > > > diff --git a/drivers/core/ofnode.c b/drivers/core/ofnode.c
> > > > > > > > > index 2ef4114cb6f..c9cec456f43 100644
> > > > > > > > > --- a/drivers/core/ofnode.c
> > > > > > > > > +++ b/drivers/core/ofnode.c
> > > > > > > > > @@ -1270,7 +1270,8 @@ const uint8_t *ofnode_read_u8_array_ptr(ofnode node, const char *propname,
> > > > > > > > >  }
> > > > > > > > >  
> > > > > > > > >  int ofnode_read_pci_addr(ofnode node, enum fdt_pci_space type,
> > > > > > > > > -			 const char *propname, struct fdt_pci_addr *addr)
> > > > > > > > > +			 const char *propname, struct fdt_pci_addr *addr,
> > > > > > > > > +			 fdt_size_t *size)
> > > > > > > > >  {
> > > > > > > > >  	const fdt32_t *cell;
> > > > > > > > >  	int len;
> > > > > > > > > @@ -1298,14 +1299,18 @@ int ofnode_read_pci_addr(ofnode node, enum fdt_pci_space type,
> > > > > > > > >  			      (ulong)fdt32_to_cpu(cell[1]),
> > > > > > > > >  			      (ulong)fdt32_to_cpu(cell[2]));
> > > > > > > > >  			if ((fdt32_to_cpu(*cell) & type) == type) {
> > > > > > > > > +				const unaligned_fdt64_t *ptr;
> > > > > > > > > +
> > > > > > > > >  				addr->phys_hi = fdt32_to_cpu(cell[0]);
> > > > > > > > >  				addr->phys_mid = fdt32_to_cpu(cell[1]);
> > > > > > > > >  				addr->phys_lo = fdt32_to_cpu(cell[2]);
> > > > > > > > > +				ptr = (const unaligned_fdt64_t *)(cell + 3);
> > > > > > > > > +				if (size)
> > > > > > > > > +					*size = fdt64_to_cpu(*ptr);
> > > > > > > > >  				break;
> > > > > > > > >  			}
> > > > > > > > >  
> > > > > > > > > -			cell += (FDT_PCI_ADDR_CELLS +
> > > > > > > > > -				 FDT_PCI_SIZE_CELLS);
> > > > > > > > > +			cell += FDT_PCI_ADDR_CELLS + FDT_PCI_SIZE_CELLS;
> > > > > > > > >  		}
> > > > > > > > >  
> > > > > > > > >  		if (i == num) {
> > > > > > > > > diff --git a/drivers/core/read.c b/drivers/core/read.c
> > > > > > > > > index 49066b59cda..419013451f0 100644
> > > > > > > > > --- a/drivers/core/read.c
> > > > > > > > > +++ b/drivers/core/read.c
> > > > > > > > > @@ -405,13 +405,15 @@ int dev_read_alias_highest_id(const char *stem)
> > > > > > > > >  	return fdtdec_get_alias_highest_id(gd->fdt_blob, stem);
> > > > > > > > >  }
> > > > > > > > >  
> > > > > > > > > -fdt_addr_t dev_read_addr_pci(const struct udevice *dev)
> > > > > > > > > +fdt_addr_t dev_read_addr_pci(const struct udevice *dev, fdt_size_t *sizep)
> > > > > > > > >  {
> > > > > > > > >  	ulong addr;
> > > > > > > > >  
> > > > > > > > >  	addr = dev_read_addr(dev);
> > > > > > > > > +	if (sizep)
> > > > > > > > > +		*sizep = 0;
> > > > > > > > >  	if (addr == FDT_ADDR_T_NONE && !of_live_active())
> > > > > > > > > -		addr = devfdt_get_addr_pci(dev);
> > > > > > > > > +		addr = devfdt_get_addr_pci(dev, sizep);
> > > > > > > > >  
> > > > > > > > >  	return addr;
> > > > > > > > >  }
> > > > > > > > > diff --git a/drivers/core/util.c b/drivers/core/util.c
> > > > > > > > > index aa60fdd15bc..81497df85ff 100644
> > > > > > > > > --- a/drivers/core/util.c
> > > > > > > > > +++ b/drivers/core/util.c
> > > > > > > > > @@ -30,7 +30,7 @@ int pci_get_devfn(struct udevice *dev)
> > > > > > > > >  
> > > > > > > > >  	/* Extract the devfn from fdt_pci_addr */
> > > > > > > > >  	ret = ofnode_read_pci_addr(dev_ofnode(dev), FDT_PCI_SPACE_CONFIG,
> > > > > > > > > -				   "reg", &addr);
> > > > > > > > > +				   "reg", &addr, NULL);
> > > > > > > > >  	if (ret) {
> > > > > > > > >  		if (ret != -ENOENT)
> > > > > > > > >  			return -EINVAL;
> > > > > > > > > diff --git a/drivers/pci/pci-uclass.c b/drivers/pci/pci-uclass.c
> > > > > > > > > index 0adcdceb1d3..c670f8754e8 100644
> > > > > > > > > --- a/drivers/pci/pci-uclass.c
> > > > > > > > > +++ b/drivers/pci/pci-uclass.c
> > > > > > > > > @@ -122,7 +122,7 @@ static void pci_dev_find_ofnode(struct udevice *bus, phys_addr_t bdf,
> > > > > > > > >  
> > > > > > > > >  	dev_for_each_subnode(node, bus) {
> > > > > > > > >  		ret = ofnode_read_pci_addr(node, FDT_PCI_SPACE_CONFIG, "reg",
> > > > > > > > > -					   &addr);
> > > > > > > > > +					   &addr, NULL);
> > > > > > > > >  		if (ret)
> > > > > > > > >  			continue;
> > > > > > > > >  
> > > > > > > > > diff --git a/drivers/pci/pci_mvebu.c b/drivers/pci/pci_mvebu.c
> > > > > > > > > index 93a7508d8a2..25878bde534 100644
> > > > > > > > > --- a/drivers/pci/pci_mvebu.c
> > > > > > > > > +++ b/drivers/pci/pci_mvebu.c
> > > > > > > > > @@ -640,7 +640,8 @@ static int mvebu_pcie_port_parse_dt(ofnode node, ofnode parent, struct mvebu_pci
> > > > > > > > >  		pcie->is_x4 = true;
> > > > > > > > >  
> > > > > > > > >  	/* devfn is in bits [15:8], see PCI_DEV usage */
> > > > > > > > > -	ret = ofnode_read_pci_addr(node, FDT_PCI_SPACE_CONFIG, "reg", &pci_addr);
> > > > > > > > > +	ret = ofnode_read_pci_addr(node, FDT_PCI_SPACE_CONFIG, "reg", &pci_addr,
> > > > > > > > > +				   NULL);
> > > > > > > > >  	if (ret < 0) {
> > > > > > > > >  		printf("%s: property \"reg\" is invalid\n", pcie->name);
> > > > > > > > >  		goto err;
> > > > > > > > > diff --git a/drivers/pci/pci_tegra.c b/drivers/pci/pci_tegra.c
> > > > > > > > > index 29d54117e93..ae90bd2fbf1 100644
> > > > > > > > > --- a/drivers/pci/pci_tegra.c
> > > > > > > > > +++ b/drivers/pci/pci_tegra.c
> > > > > > > > > @@ -461,7 +461,7 @@ static int tegra_pcie_parse_port_info(ofnode node, uint *index, uint *lanes)
> > > > > > > > >  
> > > > > > > > >  	*lanes = err;
> > > > > > > > >  
> > > > > > > > > -	err = ofnode_read_pci_addr(node, 0, "reg", &addr);
> > > > > > > > > +	err = ofnode_read_pci_addr(node, 0, "reg", &addr, NULL);
> > > > > > > > >  	if (err < 0) {
> > > > > > > > >  		pr_err("failed to parse \"reg\" property\n");
> > > > > > > > >  		return err;
> > > > > > > > > diff --git a/drivers/pci/pcie_mediatek.c b/drivers/pci/pcie_mediatek.c
> > > > > > > > > index c6e30e24622..e59ebd13ad0 100644
> > > > > > > > > --- a/drivers/pci/pcie_mediatek.c
> > > > > > > > > +++ b/drivers/pci/pcie_mediatek.c
> > > > > > > > > @@ -660,7 +660,7 @@ static int mtk_pcie_probe(struct udevice *dev)
> > > > > > > > >  		if (!ofnode_is_enabled(subnode))
> > > > > > > > >  			continue;
> > > > > > > > >  
> > > > > > > > > -		err = ofnode_read_pci_addr(subnode, 0, "reg", &addr);
> > > > > > > > > +		err = ofnode_read_pci_addr(subnode, 0, "reg", &addr, NULL);
> > > > > > > > >  		if (err)
> > > > > > > > >  			return err;
> > > > > > > > >  
> > > > > > > > > @@ -699,7 +699,7 @@ static int mtk_pcie_probe_v2(struct udevice *dev)
> > > > > > > > >  		if (!ofnode_is_enabled(subnode))
> > > > > > > > >  			continue;
> > > > > > > > >  
> > > > > > > > > -		err = ofnode_read_pci_addr(subnode, 0, "reg", &addr);
> > > > > > > > > +		err = ofnode_read_pci_addr(subnode, 0, "reg", &addr, NULL);
> > > > > > > > >  		if (err)
> > > > > > > > >  			return err;
> > > > > > > > >  
> > > > > > > > > diff --git a/drivers/serial/ns16550.c b/drivers/serial/ns16550.c
> > > > > > > > > index eab9537fbae..a349e5e132a 100644
> > > > > > > > > --- a/drivers/serial/ns16550.c
> > > > > > > > > +++ b/drivers/serial/ns16550.c
> > > > > > > > > @@ -479,6 +479,7 @@ static int ns16550_serial_getinfo(struct udevice *dev,
> > > > > > > > >  	info->addr_space = SERIAL_ADDRESS_SPACE_MEMORY;
> > > > > > > > >  #endif
> > > > > > > > >  	info->addr = plat->base;
> > > > > > > > > +	info->size = plat->size;
> > > > > > > > >  	info->reg_width = plat->reg_width;
> > > > > > > > >  	info->reg_shift = plat->reg_shift;
> > > > > > > > >  	info->reg_offset = plat->reg_offset;
> > > > > > > > > @@ -487,7 +488,8 @@ static int ns16550_serial_getinfo(struct udevice *dev,
> > > > > > > > >  	return 0;
> > > > > > > > >  }
> > > > > > > > >  
> > > > > > > > > -static int ns16550_serial_assign_base(struct ns16550_plat *plat, fdt_addr_t base)
> > > > > > > > > +static int ns16550_serial_assign_base(struct ns16550_plat *plat,
> > > > > > > > > +				      fdt_addr_t base, fdt_size_t size)
> > > > > > > > >  {
> > > > > > > > >  	if (base == FDT_ADDR_T_NONE)
> > > > > > > > >  		return -EINVAL;
> > > > > > > > > @@ -497,6 +499,7 @@ static int ns16550_serial_assign_base(struct ns16550_plat *plat, fdt_addr_t base
> > > > > > > > >  #else
> > > > > > > > >  	plat->base = (unsigned long)map_physmem(base, 0, MAP_NOCACHE);
> > > > > > > > >  #endif
> > > > > > > > > +	plat->size = size;
> > > > > > > > >  
> > > > > > > > >  	return 0;
> > > > > > > > >  }
> > > > > > > > > @@ -507,6 +510,7 @@ int ns16550_serial_probe(struct udevice *dev)
> > > > > > > > >  	struct ns16550 *const com_port = dev_get_priv(dev);
> > > > > > > > >  	struct reset_ctl_bulk reset_bulk;
> > > > > > > > >  	fdt_addr_t addr;
> > > > > > > > > +	fdt_addr_t size;
> > > > > > > > >  	int ret;
> > > > > > > > >  
> > > > > > > > >  	/*
> > > > > > > > > @@ -514,8 +518,8 @@ int ns16550_serial_probe(struct udevice *dev)
> > > > > > > > >  	 * or via a PCI bridge, assign plat->base before probing hardware.
> > > > > > > > >  	 */
> > > > > > > > >  	if (device_is_on_pci_bus(dev)) {
> > > > > > > > > -		addr = devfdt_get_addr_pci(dev);
> > > > > > > > > -		ret = ns16550_serial_assign_base(plat, addr);
> > > > > > > > > +		addr = devfdt_get_addr_pci(dev, &size);
> > > > > > > > > +		ret = ns16550_serial_assign_base(plat, addr, size);
> > > > > > > > >  		if (ret)
> > > > > > > > >  			return ret;
> > > > > > > > >  	}
> > > > > > > > > @@ -543,11 +547,12 @@ int ns16550_serial_of_to_plat(struct udevice *dev)
> > > > > > > > >  	struct ns16550_plat *plat = dev_get_plat(dev);
> > > > > > > > >  	const u32 port_type = dev_get_driver_data(dev);
> > > > > > > > >  	fdt_addr_t addr;
> > > > > > > > > +	fdt_size_t size;
> > > > > > > > >  	struct clk clk;
> > > > > > > > >  	int err;
> > > > > > > > >  
> > > > > > > > > -	addr = dev_read_addr(dev);
> > > > > > > > > -	err = ns16550_serial_assign_base(plat, addr);
> > > > > > > > > +	addr = dev_read_addr_size(dev, &size);
> > > > > > > > > +	err = ns16550_serial_assign_base(plat, addr, size);
> > > > > > > > >  	if (err && !device_is_on_pci_bus(dev))
> > > > > > > > >  		return err;
> > > > > > > > >  
> > > > > > > > > diff --git a/include/dm/fdtaddr.h b/include/dm/fdtaddr.h
> > > > > > > > > index dcdc19137cc..6d2fa8f1044 100644
> > > > > > > > > --- a/include/dm/fdtaddr.h
> > > > > > > > > +++ b/include/dm/fdtaddr.h
> > > > > > > > > @@ -168,8 +168,9 @@ fdt_addr_t devfdt_get_addr_size_name(const struct udevice *dev,
> > > > > > > > >   * devfdt_get_addr_pci() - Read an address and handle PCI address translation
> > > > > > > > >   *
> > > > > > > > >   * @dev: Device to read from
> > > > > > > > > + * @sizep: If non-NULL, returns size of address space
> > > > > > > > >   * Return: address or FDT_ADDR_T_NONE if not found
> > > > > > > > >   */
> > > > > > > > > -fdt_addr_t devfdt_get_addr_pci(const struct udevice *dev);
> > > > > > > > > +fdt_addr_t devfdt_get_addr_pci(const struct udevice *dev, fdt_size_t *sizep);
> > > > > > > > >  
> > > > > > > > >  #endif
> > > > > > > > > diff --git a/include/dm/ofnode.h b/include/dm/ofnode.h
> > > > > > > > > index 726d8f82ddf..97cad971611 100644
> > > > > > > > > --- a/include/dm/ofnode.h
> > > > > > > > > +++ b/include/dm/ofnode.h
> > > > > > > > > @@ -1152,13 +1152,15 @@ const uint8_t *ofnode_read_u8_array_ptr(ofnode node, const char *propname,
> > > > > > > > >   * @type:	pci address type (FDT_PCI_SPACE_xxx)
> > > > > > > > >   * @propname:	name of property to find
> > > > > > > > >   * @addr:	returns pci address in the form of fdt_pci_addr
> > > > > > > > > + * @size:	if non-null, returns register-space size
> > > > > > > > >   * Return:
> > > > > > > > >   * 0 if ok, -ENOENT if the property did not exist, -EINVAL if the
> > > > > > > > >   * format of the property was invalid, -ENXIO if the requested
> > > > > > > > >   * address type was not found
> > > > > > > > >   */
> > > > > > > > >  int ofnode_read_pci_addr(ofnode node, enum fdt_pci_space type,
> > > > > > > > > -			 const char *propname, struct fdt_pci_addr *addr);
> > > > > > > > > +			 const char *propname, struct fdt_pci_addr *addr,
> > > > > > > > > +			 fdt_size_t *size);
> > > > > > > > >  
> > > > > > > > >  /**
> > > > > > > > >   * ofnode_read_pci_vendev() - look up PCI vendor and device id
> > > > > > > > > diff --git a/include/dm/read.h b/include/dm/read.h
> > > > > > > > > index c2615f72f40..3c2eea6f0c4 100644
> > > > > > > > > --- a/include/dm/read.h
> > > > > > > > > +++ b/include/dm/read.h
> > > > > > > > > @@ -346,9 +346,10 @@ void *dev_read_addr_ptr(const struct udevice *dev);
> > > > > > > > >   *    fdtdec_get_addr() and friends.
> > > > > > > > >   *
> > > > > > > > >   * @dev: Device to read from
> > > > > > > > > + * @sizep: If non-NULL, returns size of address space found
> > > > > > > > >   * Return: address or FDT_ADDR_T_NONE if not found
> > > > > > > > >   */
> > > > > > > > > -fdt_addr_t dev_read_addr_pci(const struct udevice *dev);
> > > > > > > > > +fdt_addr_t dev_read_addr_pci(const struct udevice *dev, fdt_size_t *sizep);
> > > > > > > > >  
> > > > > > > > >  /**
> > > > > > > > >   * dev_remap_addr() - Get the reg property of a device as a
> > > > > > > > > @@ -996,9 +997,10 @@ static inline void *dev_read_addr_ptr(const struct udevice *dev)
> > > > > > > > >  	return devfdt_get_addr_ptr(dev);
> > > > > > > > >  }
> > > > > > > > >  
> > > > > > > > > -static inline fdt_addr_t dev_read_addr_pci(const struct udevice *dev)
> > > > > > > > > +static inline fdt_addr_t dev_read_addr_pci(const struct udevice *dev,
> > > > > > > > > +					   fdt_size_t *sizep)
> > > > > > > > >  {
> > > > > > > > > -	return devfdt_get_addr_pci(dev);
> > > > > > > > > +	return devfdt_get_addr_pci(dev, sizep);
> > > > > > > > >  }
> > > > > > > > >  
> > > > > > > > >  static inline void *dev_remap_addr(const struct udevice *dev)
> > > > > > > > > diff --git a/include/ns16550.h b/include/ns16550.h
> > > > > > > > > index e7e68663d03..7f481300083 100644
> > > > > > > > > --- a/include/ns16550.h
> > > > > > > > > +++ b/include/ns16550.h
> > > > > > > > > @@ -58,6 +58,7 @@ enum ns16550_flags {
> > > > > > > > >   * struct ns16550_plat - information about a NS16550 port
> > > > > > > > >   *
> > > > > > > > >   * @base:		Base register address
> > > > > > > > > + * @size:		Size of register area in bytes
> > > > > > > > >   * @reg_width:		IO accesses size of registers (in bytes, 1 or 4)
> > > > > > > > >   * @reg_shift:		Shift size of registers (0=byte, 1=16bit, 2=32bit...)
> > > > > > > > >   * @reg_offset:		Offset to start of registers (normally 0)
> > > > > > > > > @@ -67,7 +68,8 @@ enum ns16550_flags {
> > > > > > > > >   * @bdf:		PCI slot/function (pci_dev_t)
> > > > > > > > >   */
> > > > > > > > >  struct ns16550_plat {
> > > > > > > > > -	unsigned long base;
> > > > > > > > > +	ulong base;
> > > > > > > > > +	ulong size;
> > > > > > > > >  	int reg_width;
> > > > > > > > >  	int reg_shift;
> > > > > > > > >  	int reg_offset;
> > > > > > > > > diff --git a/include/serial.h b/include/serial.h
> > > > > > > > > index 42bdf3759c0..205889d28be 100644
> > > > > > > > > --- a/include/serial.h
> > > > > > > > > +++ b/include/serial.h
> > > > > > > > > @@ -137,6 +137,7 @@ enum adr_space_type {
> > > > > > > > >   * @type:	type of the UART chip
> > > > > > > > >   * @addr_space:	address space to access the registers
> > > > > > > > >   * @addr:	physical address of the registers
> > > > > > > > > + * @size:	size of the register area in bytes
> > > > > > > > >   * @reg_width:	size (in bytes) of the IO accesses to the registers
> > > > > > > > >   * @reg_offset:	offset to apply to the @addr from the start of the registers
> > > > > > > > >   * @reg_shift:	quantity to shift the register offsets by
> > > > > > > > > @@ -147,6 +148,7 @@ struct serial_device_info {
> > > > > > > > >  	enum serial_chip_type type;
> > > > > > > > >  	enum adr_space_type addr_space;
> > > > > > > > >  	ulong addr;
> > > > > > > > > +	ulong size;
> > > > > > > > >  	u8 reg_width;
> > > > > > > > >  	u8 reg_offset;
> > > > > > > > >  	u8 reg_shift;
> > > > > > > > > diff --git a/test/dm/pci.c b/test/dm/pci.c
> > > > > > > > > index 70a736cfdb8..8c5e7da9e62 100644
> > > > > > > > > --- a/test/dm/pci.c
> > > > > > > > > +++ b/test/dm/pci.c
> > > > > > > > > @@ -301,10 +301,12 @@ static int dm_test_pci_addr_flat(struct unit_test_state *uts)
> > > > > > > > >  {
> > > > > > > > >  	struct udevice *swap1f, *swap1;
> > > > > > > > >  	ulong io_addr, mem_addr;
> > > > > > > > > +	fdt_addr_t size;
> > > > > > > > >  
> > > > > > > > >  	ut_assertok(dm_pci_bus_find_bdf(PCI_BDF(0, 0x1f, 0), &swap1f));
> > > > > > > > >  	io_addr = dm_pci_read_bar32(swap1f, 0);
> > > > > > > > > -	ut_asserteq(io_addr, dev_read_addr_pci(swap1f));
> > > > > > > > > +	ut_asserteq(io_addr, dev_read_addr_pci(swap1f, &size));
> > > > > > > > > +	ut_asserteq(0, size);
> > > > > > > > >  
> > > > > > > > >  	/*
> > > > > > > > >  	 * This device has both I/O and MEM spaces but the MEM space appears
> > > > > > > > > @@ -312,7 +314,8 @@ static int dm_test_pci_addr_flat(struct unit_test_state *uts)
> > > > > > > > >  	 */
> > > > > > > > >  	ut_assertok(dm_pci_bus_find_bdf(PCI_BDF(0, 0x1, 0), &swap1));
> > > > > > > > >  	mem_addr = dm_pci_read_bar32(swap1, 1);
> > > > > > > > > -	ut_asserteq(mem_addr, dev_read_addr_pci(swap1));
> > > > > > > > > +	ut_asserteq(mem_addr, dev_read_addr_pci(swap1, &size));
> > > > > > > > > +	ut_asserteq(0, size);
> > > > > > > > >  
> > > > > > > > >  	return 0;
> > > > > > > > >  }
> > > > > > > > > @@ -329,12 +332,15 @@ DM_TEST(dm_test_pci_addr_flat, UT_TESTF_SCAN_PDATA | UT_TESTF_SCAN_FDT |
> > > > > > > > >  static int dm_test_pci_addr_live(struct unit_test_state *uts)
> > > > > > > > >  {
> > > > > > > > >  	struct udevice *swap1f, *swap1;
> > > > > > > > > +	fdt_size_t size;
> > > > > > > > >  
> > > > > > > > >  	ut_assertok(dm_pci_bus_find_bdf(PCI_BDF(0, 0x1f, 0), &swap1f));
> > > > > > > > > -	ut_asserteq_64(FDT_ADDR_T_NONE, dev_read_addr_pci(swap1f));
> > > > > > > > > +	ut_asserteq_64(FDT_ADDR_T_NONE, dev_read_addr_pci(swap1f, &size));
> > > > > > > > > +	ut_asserteq(0, size);
> > > > > > > > >  
> > > > > > > > >  	ut_assertok(dm_pci_bus_find_bdf(PCI_BDF(0, 0x1, 0), &swap1));
> > > > > > > > > -	ut_asserteq_64(FDT_ADDR_T_NONE, dev_read_addr_pci(swap1));
> > > > > > > > > +	ut_asserteq_64(FDT_ADDR_T_NONE, dev_read_addr_pci(swap1, &size));
> > > > > > > > > +	ut_asserteq(0, size);
> > > > > > > > >  
> > > > > > > > >  	return 0;
> > > > > > > > >  }
> > > > > > > > > -- 
> > > > > > > > > 2.42.0.rc2.253.gd59a3bf2b4-goog
> > > > > > > > > 
> > > > > > > 
> > > > > > > -- 
> > > > > > > Tom
> > > > > > 
> > > > > > 
> > > > > 
> > > > > -- 
> > > > > Tom
> > > > 
> > > > 
> > > 
> > > -- 
> > > Tom
> > 
> > 

-- 
Tom

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 659 bytes --]

^ permalink raw reply	[flat|nested] 86+ messages in thread

* Re: [PATCH 32/32] pci: serial: Support reading PCI-register size with base
  2023-08-30 21:08                   ` Tom Rini
@ 2023-08-30 21:13                     ` Pali Rohár
  2023-08-30 21:26                       ` Tom Rini
  0 siblings, 1 reply; 86+ messages in thread
From: Pali Rohár @ 2023-08-30 21:13 UTC (permalink / raw)
  To: Tom Rini
  Cc: Simon Glass, U-Boot Mailing List, Marek Vasut,
	Abdellatif El Khlifi, Andre Przywara, Bin Meng, Chunfeng Yun,
	Dzmitry Sankouski, GSS_MTK_Uboot_upstream, Heinrich Schuchardt,
	Ilias Apalodimas, Michal Simek, Michal Suchanek, Nikhil M Jain,
	Ryder Lee, Stefan Roese, Weijie Gao

Seems that you completely miss the point of the argument, then the only
option for such people is to repeat them. Or have I repeat you again
that you have not answered the first question, why you are asking for
review from somebody who you are ignoring and not taking into account?
You do not want to answer this question, right? So you rather change a
topic and talking about something totally different.

On Wednesday 30 August 2023 17:08:42 Tom Rini wrote:
> I don't think it's worth re-hashing the same arguments over and over.
> There is no "my persons", there is the public community.  If you no
> longer wish to participate, I can remove you from the maintainers
> entries you're listed in.  But please stop with the long arguments
> unrelated to the patches at hand when there's a dozen people and other
> lists on CC.
> 
> On Wed, Aug 30, 2023 at 10:51:45PM +0200, Pali Rohár wrote:
> > So lets recap what you and your persons have done in last 6 months:
> > 
> > * Ignored my changes
> > * Ignored my reviews
> > * Ignored my regression reports
> > * Ignored my reminders
> > 
> > And now you complaining that I'm not going to do another review? Then
> > you should be the first who step down there as incompetent person. I was
> > interesting in developing there for a very long time (10+ years I was
> > active there?).
> > 
> > I think I have already wrote many times that I would not do any new
> > stuff here for you until you start processing existing reports. Seems
> > that you have been ignoring these my warnings. And when I starting
> > applying my statements, you are not happy with it? You should have been
> > thinking about it year ago.
> > 
> > On Wednesday 30 August 2023 21:44:09 Pali Rohár wrote:
> > > And you too. That was at the time when you and your people were
> > > interested in reviews from others.
> > > 
> > > On Wednesday 30 August 2023 15:41:57 Tom Rini wrote:
> > > > Then you should probably remove yourself from the places you've listed
> > > > yourself as an interested maintainer, thanks.
> > > > 
> > > > On Wed, Aug 30, 2023 at 09:10:36PM +0200, Pali Rohár wrote:
> > > > > You have already decided, what is the point? You are not taking any my
> > > > > objections into account, so stop writing to me and to others these your
> > > > > stupids bullshits. I'm not an idiot who is interesting for them.
> > > > > 
> > > > > On Wednesday 30 August 2023 15:04:22 Tom Rini wrote:
> > > > > > You're a listed maintainer for a file being changed. If you objected to
> > > > > > the changes, your objection would matter.  If you don't object, you can
> > > > > > just ignore it, or review it, whatever you like.  You need to decide
> > > > > > what you want to do about code you're volunteering to maintain.
> > > > > > 
> > > > > > On Wed, Aug 30, 2023 at 08:39:13PM +0200, Pali Rohár wrote:
> > > > > > > And what? How it is related to the statements that my reviews would also
> > > > > > > ignored? And what you want from me now?
> > > > > > > 
> > > > > > > On Wednesday 30 August 2023 14:17:50 Tom Rini wrote:
> > > > > > > > Pali,
> > > > > > > > 
> > > > > > > > You are specifically listed as a maintainer for drivers/pci/pci_mvebu.c
> > > > > > > > and that is changed by this patch.
> > > > > > > > 
> > > > > > > > On Wed, Aug 30, 2023 at 08:14:59PM +0200, Pali Rohár wrote:
> > > > > > > > > Simon, why you are contacting me? You have wrote to me that you would
> > > > > > > > > ignore my reviews here, so what you want now? Could you please explain
> > > > > > > > > what you are trying to achieve? I'm not going to review this or any
> > > > > > > > > other your changes.
> > > > > > > > > 
> > > > > > > > > On Wednesday 30 August 2023 12:05:03 Simon Glass wrote:
> > > > > > > > > > The PCI helpers read only the base address for a PCI region. In some cases
> > > > > > > > > > the size is needed as well, e.g. to pass along to a driver which needs to
> > > > > > > > > > know the size of its register area.
> > > > > > > > > > 
> > > > > > > > > > Update the functions to allow the size to be returned. For serial, record
> > > > > > > > > > the information and provided it with the serial_info() call.
> > > > > > > > > > 
> > > > > > > > > > A limitation still exists in that the size is not available when OF_LIVE
> > > > > > > > > > is enabled, so take account of that in the tests.
> > > > > > > > > > 
> > > > > > > > > > Signed-off-by: Simon Glass <sjg@chromium.org>
> > > > > > > > > > ---
> > > > > > > > > > 
> > > > > > > > > >  arch/sandbox/dts/test.dts   |  6 +++---
> > > > > > > > > >  drivers/core/fdtaddr.c      |  6 +++---
> > > > > > > > > >  drivers/core/ofnode.c       | 11 ++++++++---
> > > > > > > > > >  drivers/core/read.c         |  6 ++++--
> > > > > > > > > >  drivers/core/util.c         |  2 +-
> > > > > > > > > >  drivers/pci/pci-uclass.c    |  2 +-
> > > > > > > > > >  drivers/pci/pci_mvebu.c     |  3 ++-
> > > > > > > > > >  drivers/pci/pci_tegra.c     |  2 +-
> > > > > > > > > >  drivers/pci/pcie_mediatek.c |  4 ++--
> > > > > > > > > >  drivers/serial/ns16550.c    | 15 ++++++++++-----
> > > > > > > > > >  include/dm/fdtaddr.h        |  3 ++-
> > > > > > > > > >  include/dm/ofnode.h         |  4 +++-
> > > > > > > > > >  include/dm/read.h           |  8 +++++---
> > > > > > > > > >  include/ns16550.h           |  4 +++-
> > > > > > > > > >  include/serial.h            |  2 ++
> > > > > > > > > >  test/dm/pci.c               | 14 ++++++++++----
> > > > > > > > > >  16 files changed, 60 insertions(+), 32 deletions(-)
> > > > > > > > > > 
> > > > > > > > > > diff --git a/arch/sandbox/dts/test.dts b/arch/sandbox/dts/test.dts
> > > > > > > > > > index a413cbe4989..961e8895a49 100644
> > > > > > > > > > --- a/arch/sandbox/dts/test.dts
> > > > > > > > > > +++ b/arch/sandbox/dts/test.dts
> > > > > > > > > > @@ -1087,8 +1087,8 @@
> > > > > > > > > >  		pci@1,0 {
> > > > > > > > > >  			compatible = "pci-generic";
> > > > > > > > > >  			/* reg 0 is at 0x14, using FDT_PCI_SPACE_MEM32 */
> > > > > > > > > > -			reg = <0x02000814 0 0 0 0
> > > > > > > > > > -			       0x01000810 0 0 0 0>;
> > > > > > > > > > +			reg = <0x02000814 0 0 0x80 0
> > > > > > > > > > +			       0x01000810 0 0 0xc0 0>;
> > > > > > > > > >  			sandbox,emul = <&swap_case_emul0_1>;
> > > > > > > > > >  		};
> > > > > > > > > >  		p2sb-pci@2,0 {
> > > > > > > > > > @@ -1115,7 +1115,7 @@
> > > > > > > > > >  		pci@1f,0 {
> > > > > > > > > >  			compatible = "pci-generic";
> > > > > > > > > >  			/* reg 0 is at 0x10, using FDT_PCI_SPACE_IO */
> > > > > > > > > > -			reg = <0x0100f810 0 0 0 0>;
> > > > > > > > > > +			reg = <0x0100f810 0 0 0x100 0>;
> > > > > > > > > >  			sandbox,emul = <&swap_case_emul0_1f>;
> > > > > > > > > >  		};
> > > > > > > > > >  	};
> > > > > > > > > > diff --git a/drivers/core/fdtaddr.c b/drivers/core/fdtaddr.c
> > > > > > > > > > index 546db675aaf..b79d138c419 100644
> > > > > > > > > > --- a/drivers/core/fdtaddr.c
> > > > > > > > > > +++ b/drivers/core/fdtaddr.c
> > > > > > > > > > @@ -215,7 +215,7 @@ void *devfdt_map_physmem(const struct udevice *dev, unsigned long size)
> > > > > > > > > >  	return map_physmem(addr, size, MAP_NOCACHE);
> > > > > > > > > >  }
> > > > > > > > > >  
> > > > > > > > > > -fdt_addr_t devfdt_get_addr_pci(const struct udevice *dev)
> > > > > > > > > > +fdt_addr_t devfdt_get_addr_pci(const struct udevice *dev, fdt_size_t *sizep)
> > > > > > > > > >  {
> > > > > > > > > >  	ulong addr;
> > > > > > > > > >  
> > > > > > > > > > @@ -226,12 +226,12 @@ fdt_addr_t devfdt_get_addr_pci(const struct udevice *dev)
> > > > > > > > > >  		int ret;
> > > > > > > > > >  
> > > > > > > > > >  		ret = ofnode_read_pci_addr(dev_ofnode(dev), FDT_PCI_SPACE_MEM32,
> > > > > > > > > > -					   "reg", &pci_addr);
> > > > > > > > > > +					   "reg", &pci_addr, sizep);
> > > > > > > > > >  		if (ret) {
> > > > > > > > > >  			/* try if there is any i/o-mapped register */
> > > > > > > > > >  			ret = ofnode_read_pci_addr(dev_ofnode(dev),
> > > > > > > > > >  						   FDT_PCI_SPACE_IO, "reg",
> > > > > > > > > > -						   &pci_addr);
> > > > > > > > > > +						   &pci_addr, sizep);
> > > > > > > > > >  			if (ret)
> > > > > > > > > >  				return FDT_ADDR_T_NONE;
> > > > > > > > > >  		}
> > > > > > > > > > diff --git a/drivers/core/ofnode.c b/drivers/core/ofnode.c
> > > > > > > > > > index 2ef4114cb6f..c9cec456f43 100644
> > > > > > > > > > --- a/drivers/core/ofnode.c
> > > > > > > > > > +++ b/drivers/core/ofnode.c
> > > > > > > > > > @@ -1270,7 +1270,8 @@ const uint8_t *ofnode_read_u8_array_ptr(ofnode node, const char *propname,
> > > > > > > > > >  }
> > > > > > > > > >  
> > > > > > > > > >  int ofnode_read_pci_addr(ofnode node, enum fdt_pci_space type,
> > > > > > > > > > -			 const char *propname, struct fdt_pci_addr *addr)
> > > > > > > > > > +			 const char *propname, struct fdt_pci_addr *addr,
> > > > > > > > > > +			 fdt_size_t *size)
> > > > > > > > > >  {
> > > > > > > > > >  	const fdt32_t *cell;
> > > > > > > > > >  	int len;
> > > > > > > > > > @@ -1298,14 +1299,18 @@ int ofnode_read_pci_addr(ofnode node, enum fdt_pci_space type,
> > > > > > > > > >  			      (ulong)fdt32_to_cpu(cell[1]),
> > > > > > > > > >  			      (ulong)fdt32_to_cpu(cell[2]));
> > > > > > > > > >  			if ((fdt32_to_cpu(*cell) & type) == type) {
> > > > > > > > > > +				const unaligned_fdt64_t *ptr;
> > > > > > > > > > +
> > > > > > > > > >  				addr->phys_hi = fdt32_to_cpu(cell[0]);
> > > > > > > > > >  				addr->phys_mid = fdt32_to_cpu(cell[1]);
> > > > > > > > > >  				addr->phys_lo = fdt32_to_cpu(cell[2]);
> > > > > > > > > > +				ptr = (const unaligned_fdt64_t *)(cell + 3);
> > > > > > > > > > +				if (size)
> > > > > > > > > > +					*size = fdt64_to_cpu(*ptr);
> > > > > > > > > >  				break;
> > > > > > > > > >  			}
> > > > > > > > > >  
> > > > > > > > > > -			cell += (FDT_PCI_ADDR_CELLS +
> > > > > > > > > > -				 FDT_PCI_SIZE_CELLS);
> > > > > > > > > > +			cell += FDT_PCI_ADDR_CELLS + FDT_PCI_SIZE_CELLS;
> > > > > > > > > >  		}
> > > > > > > > > >  
> > > > > > > > > >  		if (i == num) {
> > > > > > > > > > diff --git a/drivers/core/read.c b/drivers/core/read.c
> > > > > > > > > > index 49066b59cda..419013451f0 100644
> > > > > > > > > > --- a/drivers/core/read.c
> > > > > > > > > > +++ b/drivers/core/read.c
> > > > > > > > > > @@ -405,13 +405,15 @@ int dev_read_alias_highest_id(const char *stem)
> > > > > > > > > >  	return fdtdec_get_alias_highest_id(gd->fdt_blob, stem);
> > > > > > > > > >  }
> > > > > > > > > >  
> > > > > > > > > > -fdt_addr_t dev_read_addr_pci(const struct udevice *dev)
> > > > > > > > > > +fdt_addr_t dev_read_addr_pci(const struct udevice *dev, fdt_size_t *sizep)
> > > > > > > > > >  {
> > > > > > > > > >  	ulong addr;
> > > > > > > > > >  
> > > > > > > > > >  	addr = dev_read_addr(dev);
> > > > > > > > > > +	if (sizep)
> > > > > > > > > > +		*sizep = 0;
> > > > > > > > > >  	if (addr == FDT_ADDR_T_NONE && !of_live_active())
> > > > > > > > > > -		addr = devfdt_get_addr_pci(dev);
> > > > > > > > > > +		addr = devfdt_get_addr_pci(dev, sizep);
> > > > > > > > > >  
> > > > > > > > > >  	return addr;
> > > > > > > > > >  }
> > > > > > > > > > diff --git a/drivers/core/util.c b/drivers/core/util.c
> > > > > > > > > > index aa60fdd15bc..81497df85ff 100644
> > > > > > > > > > --- a/drivers/core/util.c
> > > > > > > > > > +++ b/drivers/core/util.c
> > > > > > > > > > @@ -30,7 +30,7 @@ int pci_get_devfn(struct udevice *dev)
> > > > > > > > > >  
> > > > > > > > > >  	/* Extract the devfn from fdt_pci_addr */
> > > > > > > > > >  	ret = ofnode_read_pci_addr(dev_ofnode(dev), FDT_PCI_SPACE_CONFIG,
> > > > > > > > > > -				   "reg", &addr);
> > > > > > > > > > +				   "reg", &addr, NULL);
> > > > > > > > > >  	if (ret) {
> > > > > > > > > >  		if (ret != -ENOENT)
> > > > > > > > > >  			return -EINVAL;
> > > > > > > > > > diff --git a/drivers/pci/pci-uclass.c b/drivers/pci/pci-uclass.c
> > > > > > > > > > index 0adcdceb1d3..c670f8754e8 100644
> > > > > > > > > > --- a/drivers/pci/pci-uclass.c
> > > > > > > > > > +++ b/drivers/pci/pci-uclass.c
> > > > > > > > > > @@ -122,7 +122,7 @@ static void pci_dev_find_ofnode(struct udevice *bus, phys_addr_t bdf,
> > > > > > > > > >  
> > > > > > > > > >  	dev_for_each_subnode(node, bus) {
> > > > > > > > > >  		ret = ofnode_read_pci_addr(node, FDT_PCI_SPACE_CONFIG, "reg",
> > > > > > > > > > -					   &addr);
> > > > > > > > > > +					   &addr, NULL);
> > > > > > > > > >  		if (ret)
> > > > > > > > > >  			continue;
> > > > > > > > > >  
> > > > > > > > > > diff --git a/drivers/pci/pci_mvebu.c b/drivers/pci/pci_mvebu.c
> > > > > > > > > > index 93a7508d8a2..25878bde534 100644
> > > > > > > > > > --- a/drivers/pci/pci_mvebu.c
> > > > > > > > > > +++ b/drivers/pci/pci_mvebu.c
> > > > > > > > > > @@ -640,7 +640,8 @@ static int mvebu_pcie_port_parse_dt(ofnode node, ofnode parent, struct mvebu_pci
> > > > > > > > > >  		pcie->is_x4 = true;
> > > > > > > > > >  
> > > > > > > > > >  	/* devfn is in bits [15:8], see PCI_DEV usage */
> > > > > > > > > > -	ret = ofnode_read_pci_addr(node, FDT_PCI_SPACE_CONFIG, "reg", &pci_addr);
> > > > > > > > > > +	ret = ofnode_read_pci_addr(node, FDT_PCI_SPACE_CONFIG, "reg", &pci_addr,
> > > > > > > > > > +				   NULL);
> > > > > > > > > >  	if (ret < 0) {
> > > > > > > > > >  		printf("%s: property \"reg\" is invalid\n", pcie->name);
> > > > > > > > > >  		goto err;
> > > > > > > > > > diff --git a/drivers/pci/pci_tegra.c b/drivers/pci/pci_tegra.c
> > > > > > > > > > index 29d54117e93..ae90bd2fbf1 100644
> > > > > > > > > > --- a/drivers/pci/pci_tegra.c
> > > > > > > > > > +++ b/drivers/pci/pci_tegra.c
> > > > > > > > > > @@ -461,7 +461,7 @@ static int tegra_pcie_parse_port_info(ofnode node, uint *index, uint *lanes)
> > > > > > > > > >  
> > > > > > > > > >  	*lanes = err;
> > > > > > > > > >  
> > > > > > > > > > -	err = ofnode_read_pci_addr(node, 0, "reg", &addr);
> > > > > > > > > > +	err = ofnode_read_pci_addr(node, 0, "reg", &addr, NULL);
> > > > > > > > > >  	if (err < 0) {
> > > > > > > > > >  		pr_err("failed to parse \"reg\" property\n");
> > > > > > > > > >  		return err;
> > > > > > > > > > diff --git a/drivers/pci/pcie_mediatek.c b/drivers/pci/pcie_mediatek.c
> > > > > > > > > > index c6e30e24622..e59ebd13ad0 100644
> > > > > > > > > > --- a/drivers/pci/pcie_mediatek.c
> > > > > > > > > > +++ b/drivers/pci/pcie_mediatek.c
> > > > > > > > > > @@ -660,7 +660,7 @@ static int mtk_pcie_probe(struct udevice *dev)
> > > > > > > > > >  		if (!ofnode_is_enabled(subnode))
> > > > > > > > > >  			continue;
> > > > > > > > > >  
> > > > > > > > > > -		err = ofnode_read_pci_addr(subnode, 0, "reg", &addr);
> > > > > > > > > > +		err = ofnode_read_pci_addr(subnode, 0, "reg", &addr, NULL);
> > > > > > > > > >  		if (err)
> > > > > > > > > >  			return err;
> > > > > > > > > >  
> > > > > > > > > > @@ -699,7 +699,7 @@ static int mtk_pcie_probe_v2(struct udevice *dev)
> > > > > > > > > >  		if (!ofnode_is_enabled(subnode))
> > > > > > > > > >  			continue;
> > > > > > > > > >  
> > > > > > > > > > -		err = ofnode_read_pci_addr(subnode, 0, "reg", &addr);
> > > > > > > > > > +		err = ofnode_read_pci_addr(subnode, 0, "reg", &addr, NULL);
> > > > > > > > > >  		if (err)
> > > > > > > > > >  			return err;
> > > > > > > > > >  
> > > > > > > > > > diff --git a/drivers/serial/ns16550.c b/drivers/serial/ns16550.c
> > > > > > > > > > index eab9537fbae..a349e5e132a 100644
> > > > > > > > > > --- a/drivers/serial/ns16550.c
> > > > > > > > > > +++ b/drivers/serial/ns16550.c
> > > > > > > > > > @@ -479,6 +479,7 @@ static int ns16550_serial_getinfo(struct udevice *dev,
> > > > > > > > > >  	info->addr_space = SERIAL_ADDRESS_SPACE_MEMORY;
> > > > > > > > > >  #endif
> > > > > > > > > >  	info->addr = plat->base;
> > > > > > > > > > +	info->size = plat->size;
> > > > > > > > > >  	info->reg_width = plat->reg_width;
> > > > > > > > > >  	info->reg_shift = plat->reg_shift;
> > > > > > > > > >  	info->reg_offset = plat->reg_offset;
> > > > > > > > > > @@ -487,7 +488,8 @@ static int ns16550_serial_getinfo(struct udevice *dev,
> > > > > > > > > >  	return 0;
> > > > > > > > > >  }
> > > > > > > > > >  
> > > > > > > > > > -static int ns16550_serial_assign_base(struct ns16550_plat *plat, fdt_addr_t base)
> > > > > > > > > > +static int ns16550_serial_assign_base(struct ns16550_plat *plat,
> > > > > > > > > > +				      fdt_addr_t base, fdt_size_t size)
> > > > > > > > > >  {
> > > > > > > > > >  	if (base == FDT_ADDR_T_NONE)
> > > > > > > > > >  		return -EINVAL;
> > > > > > > > > > @@ -497,6 +499,7 @@ static int ns16550_serial_assign_base(struct ns16550_plat *plat, fdt_addr_t base
> > > > > > > > > >  #else
> > > > > > > > > >  	plat->base = (unsigned long)map_physmem(base, 0, MAP_NOCACHE);
> > > > > > > > > >  #endif
> > > > > > > > > > +	plat->size = size;
> > > > > > > > > >  
> > > > > > > > > >  	return 0;
> > > > > > > > > >  }
> > > > > > > > > > @@ -507,6 +510,7 @@ int ns16550_serial_probe(struct udevice *dev)
> > > > > > > > > >  	struct ns16550 *const com_port = dev_get_priv(dev);
> > > > > > > > > >  	struct reset_ctl_bulk reset_bulk;
> > > > > > > > > >  	fdt_addr_t addr;
> > > > > > > > > > +	fdt_addr_t size;
> > > > > > > > > >  	int ret;
> > > > > > > > > >  
> > > > > > > > > >  	/*
> > > > > > > > > > @@ -514,8 +518,8 @@ int ns16550_serial_probe(struct udevice *dev)
> > > > > > > > > >  	 * or via a PCI bridge, assign plat->base before probing hardware.
> > > > > > > > > >  	 */
> > > > > > > > > >  	if (device_is_on_pci_bus(dev)) {
> > > > > > > > > > -		addr = devfdt_get_addr_pci(dev);
> > > > > > > > > > -		ret = ns16550_serial_assign_base(plat, addr);
> > > > > > > > > > +		addr = devfdt_get_addr_pci(dev, &size);
> > > > > > > > > > +		ret = ns16550_serial_assign_base(plat, addr, size);
> > > > > > > > > >  		if (ret)
> > > > > > > > > >  			return ret;
> > > > > > > > > >  	}
> > > > > > > > > > @@ -543,11 +547,12 @@ int ns16550_serial_of_to_plat(struct udevice *dev)
> > > > > > > > > >  	struct ns16550_plat *plat = dev_get_plat(dev);
> > > > > > > > > >  	const u32 port_type = dev_get_driver_data(dev);
> > > > > > > > > >  	fdt_addr_t addr;
> > > > > > > > > > +	fdt_size_t size;
> > > > > > > > > >  	struct clk clk;
> > > > > > > > > >  	int err;
> > > > > > > > > >  
> > > > > > > > > > -	addr = dev_read_addr(dev);
> > > > > > > > > > -	err = ns16550_serial_assign_base(plat, addr);
> > > > > > > > > > +	addr = dev_read_addr_size(dev, &size);
> > > > > > > > > > +	err = ns16550_serial_assign_base(plat, addr, size);
> > > > > > > > > >  	if (err && !device_is_on_pci_bus(dev))
> > > > > > > > > >  		return err;
> > > > > > > > > >  
> > > > > > > > > > diff --git a/include/dm/fdtaddr.h b/include/dm/fdtaddr.h
> > > > > > > > > > index dcdc19137cc..6d2fa8f1044 100644
> > > > > > > > > > --- a/include/dm/fdtaddr.h
> > > > > > > > > > +++ b/include/dm/fdtaddr.h
> > > > > > > > > > @@ -168,8 +168,9 @@ fdt_addr_t devfdt_get_addr_size_name(const struct udevice *dev,
> > > > > > > > > >   * devfdt_get_addr_pci() - Read an address and handle PCI address translation
> > > > > > > > > >   *
> > > > > > > > > >   * @dev: Device to read from
> > > > > > > > > > + * @sizep: If non-NULL, returns size of address space
> > > > > > > > > >   * Return: address or FDT_ADDR_T_NONE if not found
> > > > > > > > > >   */
> > > > > > > > > > -fdt_addr_t devfdt_get_addr_pci(const struct udevice *dev);
> > > > > > > > > > +fdt_addr_t devfdt_get_addr_pci(const struct udevice *dev, fdt_size_t *sizep);
> > > > > > > > > >  
> > > > > > > > > >  #endif
> > > > > > > > > > diff --git a/include/dm/ofnode.h b/include/dm/ofnode.h
> > > > > > > > > > index 726d8f82ddf..97cad971611 100644
> > > > > > > > > > --- a/include/dm/ofnode.h
> > > > > > > > > > +++ b/include/dm/ofnode.h
> > > > > > > > > > @@ -1152,13 +1152,15 @@ const uint8_t *ofnode_read_u8_array_ptr(ofnode node, const char *propname,
> > > > > > > > > >   * @type:	pci address type (FDT_PCI_SPACE_xxx)
> > > > > > > > > >   * @propname:	name of property to find
> > > > > > > > > >   * @addr:	returns pci address in the form of fdt_pci_addr
> > > > > > > > > > + * @size:	if non-null, returns register-space size
> > > > > > > > > >   * Return:
> > > > > > > > > >   * 0 if ok, -ENOENT if the property did not exist, -EINVAL if the
> > > > > > > > > >   * format of the property was invalid, -ENXIO if the requested
> > > > > > > > > >   * address type was not found
> > > > > > > > > >   */
> > > > > > > > > >  int ofnode_read_pci_addr(ofnode node, enum fdt_pci_space type,
> > > > > > > > > > -			 const char *propname, struct fdt_pci_addr *addr);
> > > > > > > > > > +			 const char *propname, struct fdt_pci_addr *addr,
> > > > > > > > > > +			 fdt_size_t *size);
> > > > > > > > > >  
> > > > > > > > > >  /**
> > > > > > > > > >   * ofnode_read_pci_vendev() - look up PCI vendor and device id
> > > > > > > > > > diff --git a/include/dm/read.h b/include/dm/read.h
> > > > > > > > > > index c2615f72f40..3c2eea6f0c4 100644
> > > > > > > > > > --- a/include/dm/read.h
> > > > > > > > > > +++ b/include/dm/read.h
> > > > > > > > > > @@ -346,9 +346,10 @@ void *dev_read_addr_ptr(const struct udevice *dev);
> > > > > > > > > >   *    fdtdec_get_addr() and friends.
> > > > > > > > > >   *
> > > > > > > > > >   * @dev: Device to read from
> > > > > > > > > > + * @sizep: If non-NULL, returns size of address space found
> > > > > > > > > >   * Return: address or FDT_ADDR_T_NONE if not found
> > > > > > > > > >   */
> > > > > > > > > > -fdt_addr_t dev_read_addr_pci(const struct udevice *dev);
> > > > > > > > > > +fdt_addr_t dev_read_addr_pci(const struct udevice *dev, fdt_size_t *sizep);
> > > > > > > > > >  
> > > > > > > > > >  /**
> > > > > > > > > >   * dev_remap_addr() - Get the reg property of a device as a
> > > > > > > > > > @@ -996,9 +997,10 @@ static inline void *dev_read_addr_ptr(const struct udevice *dev)
> > > > > > > > > >  	return devfdt_get_addr_ptr(dev);
> > > > > > > > > >  }
> > > > > > > > > >  
> > > > > > > > > > -static inline fdt_addr_t dev_read_addr_pci(const struct udevice *dev)
> > > > > > > > > > +static inline fdt_addr_t dev_read_addr_pci(const struct udevice *dev,
> > > > > > > > > > +					   fdt_size_t *sizep)
> > > > > > > > > >  {
> > > > > > > > > > -	return devfdt_get_addr_pci(dev);
> > > > > > > > > > +	return devfdt_get_addr_pci(dev, sizep);
> > > > > > > > > >  }
> > > > > > > > > >  
> > > > > > > > > >  static inline void *dev_remap_addr(const struct udevice *dev)
> > > > > > > > > > diff --git a/include/ns16550.h b/include/ns16550.h
> > > > > > > > > > index e7e68663d03..7f481300083 100644
> > > > > > > > > > --- a/include/ns16550.h
> > > > > > > > > > +++ b/include/ns16550.h
> > > > > > > > > > @@ -58,6 +58,7 @@ enum ns16550_flags {
> > > > > > > > > >   * struct ns16550_plat - information about a NS16550 port
> > > > > > > > > >   *
> > > > > > > > > >   * @base:		Base register address
> > > > > > > > > > + * @size:		Size of register area in bytes
> > > > > > > > > >   * @reg_width:		IO accesses size of registers (in bytes, 1 or 4)
> > > > > > > > > >   * @reg_shift:		Shift size of registers (0=byte, 1=16bit, 2=32bit...)
> > > > > > > > > >   * @reg_offset:		Offset to start of registers (normally 0)
> > > > > > > > > > @@ -67,7 +68,8 @@ enum ns16550_flags {
> > > > > > > > > >   * @bdf:		PCI slot/function (pci_dev_t)
> > > > > > > > > >   */
> > > > > > > > > >  struct ns16550_plat {
> > > > > > > > > > -	unsigned long base;
> > > > > > > > > > +	ulong base;
> > > > > > > > > > +	ulong size;
> > > > > > > > > >  	int reg_width;
> > > > > > > > > >  	int reg_shift;
> > > > > > > > > >  	int reg_offset;
> > > > > > > > > > diff --git a/include/serial.h b/include/serial.h
> > > > > > > > > > index 42bdf3759c0..205889d28be 100644
> > > > > > > > > > --- a/include/serial.h
> > > > > > > > > > +++ b/include/serial.h
> > > > > > > > > > @@ -137,6 +137,7 @@ enum adr_space_type {
> > > > > > > > > >   * @type:	type of the UART chip
> > > > > > > > > >   * @addr_space:	address space to access the registers
> > > > > > > > > >   * @addr:	physical address of the registers
> > > > > > > > > > + * @size:	size of the register area in bytes
> > > > > > > > > >   * @reg_width:	size (in bytes) of the IO accesses to the registers
> > > > > > > > > >   * @reg_offset:	offset to apply to the @addr from the start of the registers
> > > > > > > > > >   * @reg_shift:	quantity to shift the register offsets by
> > > > > > > > > > @@ -147,6 +148,7 @@ struct serial_device_info {
> > > > > > > > > >  	enum serial_chip_type type;
> > > > > > > > > >  	enum adr_space_type addr_space;
> > > > > > > > > >  	ulong addr;
> > > > > > > > > > +	ulong size;
> > > > > > > > > >  	u8 reg_width;
> > > > > > > > > >  	u8 reg_offset;
> > > > > > > > > >  	u8 reg_shift;
> > > > > > > > > > diff --git a/test/dm/pci.c b/test/dm/pci.c
> > > > > > > > > > index 70a736cfdb8..8c5e7da9e62 100644
> > > > > > > > > > --- a/test/dm/pci.c
> > > > > > > > > > +++ b/test/dm/pci.c
> > > > > > > > > > @@ -301,10 +301,12 @@ static int dm_test_pci_addr_flat(struct unit_test_state *uts)
> > > > > > > > > >  {
> > > > > > > > > >  	struct udevice *swap1f, *swap1;
> > > > > > > > > >  	ulong io_addr, mem_addr;
> > > > > > > > > > +	fdt_addr_t size;
> > > > > > > > > >  
> > > > > > > > > >  	ut_assertok(dm_pci_bus_find_bdf(PCI_BDF(0, 0x1f, 0), &swap1f));
> > > > > > > > > >  	io_addr = dm_pci_read_bar32(swap1f, 0);
> > > > > > > > > > -	ut_asserteq(io_addr, dev_read_addr_pci(swap1f));
> > > > > > > > > > +	ut_asserteq(io_addr, dev_read_addr_pci(swap1f, &size));
> > > > > > > > > > +	ut_asserteq(0, size);
> > > > > > > > > >  
> > > > > > > > > >  	/*
> > > > > > > > > >  	 * This device has both I/O and MEM spaces but the MEM space appears
> > > > > > > > > > @@ -312,7 +314,8 @@ static int dm_test_pci_addr_flat(struct unit_test_state *uts)
> > > > > > > > > >  	 */
> > > > > > > > > >  	ut_assertok(dm_pci_bus_find_bdf(PCI_BDF(0, 0x1, 0), &swap1));
> > > > > > > > > >  	mem_addr = dm_pci_read_bar32(swap1, 1);
> > > > > > > > > > -	ut_asserteq(mem_addr, dev_read_addr_pci(swap1));
> > > > > > > > > > +	ut_asserteq(mem_addr, dev_read_addr_pci(swap1, &size));
> > > > > > > > > > +	ut_asserteq(0, size);
> > > > > > > > > >  
> > > > > > > > > >  	return 0;
> > > > > > > > > >  }
> > > > > > > > > > @@ -329,12 +332,15 @@ DM_TEST(dm_test_pci_addr_flat, UT_TESTF_SCAN_PDATA | UT_TESTF_SCAN_FDT |
> > > > > > > > > >  static int dm_test_pci_addr_live(struct unit_test_state *uts)
> > > > > > > > > >  {
> > > > > > > > > >  	struct udevice *swap1f, *swap1;
> > > > > > > > > > +	fdt_size_t size;
> > > > > > > > > >  
> > > > > > > > > >  	ut_assertok(dm_pci_bus_find_bdf(PCI_BDF(0, 0x1f, 0), &swap1f));
> > > > > > > > > > -	ut_asserteq_64(FDT_ADDR_T_NONE, dev_read_addr_pci(swap1f));
> > > > > > > > > > +	ut_asserteq_64(FDT_ADDR_T_NONE, dev_read_addr_pci(swap1f, &size));
> > > > > > > > > > +	ut_asserteq(0, size);
> > > > > > > > > >  
> > > > > > > > > >  	ut_assertok(dm_pci_bus_find_bdf(PCI_BDF(0, 0x1, 0), &swap1));
> > > > > > > > > > -	ut_asserteq_64(FDT_ADDR_T_NONE, dev_read_addr_pci(swap1));
> > > > > > > > > > +	ut_asserteq_64(FDT_ADDR_T_NONE, dev_read_addr_pci(swap1, &size));
> > > > > > > > > > +	ut_asserteq(0, size);
> > > > > > > > > >  
> > > > > > > > > >  	return 0;
> > > > > > > > > >  }
> > > > > > > > > > -- 
> > > > > > > > > > 2.42.0.rc2.253.gd59a3bf2b4-goog
> > > > > > > > > > 
> > > > > > > > 
> > > > > > > > -- 
> > > > > > > > Tom
> > > > > > > 
> > > > > > > 
> > > > > > 
> > > > > > -- 
> > > > > > Tom
> > > > > 
> > > > > 
> > > > 
> > > > -- 
> > > > Tom
> > > 
> > > 
> 
> -- 
> Tom



^ permalink raw reply	[flat|nested] 86+ messages in thread

* Re: [PATCH 32/32] pci: serial: Support reading PCI-register size with base
  2023-08-30 21:13                     ` Pali Rohár
@ 2023-08-30 21:26                       ` Tom Rini
  2023-08-30 21:29                         ` Pali Rohár
  0 siblings, 1 reply; 86+ messages in thread
From: Tom Rini @ 2023-08-30 21:26 UTC (permalink / raw)
  To: Pali Rohár; +Cc: U-Boot Mailing List

[-- Attachment #1: Type: text/plain, Size: 29625 bytes --]

I'm trimming the CC list. All of those points you list were addressed
and answered in your last long running argument. You need to decide what
is best for you moving forward and I would ask that it not involve
complaining that you're being asked to review code that you're a listed
maintainer of.

On Wed, Aug 30, 2023 at 11:13:16PM +0200, Pali Rohár wrote:
> Seems that you completely miss the point of the argument, then the only
> option for such people is to repeat them. Or have I repeat you again
> that you have not answered the first question, why you are asking for
> review from somebody who you are ignoring and not taking into account?
> You do not want to answer this question, right? So you rather change a
> topic and talking about something totally different.
> 
> On Wednesday 30 August 2023 17:08:42 Tom Rini wrote:
> > I don't think it's worth re-hashing the same arguments over and over.
> > There is no "my persons", there is the public community.  If you no
> > longer wish to participate, I can remove you from the maintainers
> > entries you're listed in.  But please stop with the long arguments
> > unrelated to the patches at hand when there's a dozen people and other
> > lists on CC.
> > 
> > On Wed, Aug 30, 2023 at 10:51:45PM +0200, Pali Rohár wrote:
> > > So lets recap what you and your persons have done in last 6 months:
> > > 
> > > * Ignored my changes
> > > * Ignored my reviews
> > > * Ignored my regression reports
> > > * Ignored my reminders
> > > 
> > > And now you complaining that I'm not going to do another review? Then
> > > you should be the first who step down there as incompetent person. I was
> > > interesting in developing there for a very long time (10+ years I was
> > > active there?).
> > > 
> > > I think I have already wrote many times that I would not do any new
> > > stuff here for you until you start processing existing reports. Seems
> > > that you have been ignoring these my warnings. And when I starting
> > > applying my statements, you are not happy with it? You should have been
> > > thinking about it year ago.
> > > 
> > > On Wednesday 30 August 2023 21:44:09 Pali Rohár wrote:
> > > > And you too. That was at the time when you and your people were
> > > > interested in reviews from others.
> > > > 
> > > > On Wednesday 30 August 2023 15:41:57 Tom Rini wrote:
> > > > > Then you should probably remove yourself from the places you've listed
> > > > > yourself as an interested maintainer, thanks.
> > > > > 
> > > > > On Wed, Aug 30, 2023 at 09:10:36PM +0200, Pali Rohár wrote:
> > > > > > You have already decided, what is the point? You are not taking any my
> > > > > > objections into account, so stop writing to me and to others these your
> > > > > > stupids bullshits. I'm not an idiot who is interesting for them.
> > > > > > 
> > > > > > On Wednesday 30 August 2023 15:04:22 Tom Rini wrote:
> > > > > > > You're a listed maintainer for a file being changed. If you objected to
> > > > > > > the changes, your objection would matter.  If you don't object, you can
> > > > > > > just ignore it, or review it, whatever you like.  You need to decide
> > > > > > > what you want to do about code you're volunteering to maintain.
> > > > > > > 
> > > > > > > On Wed, Aug 30, 2023 at 08:39:13PM +0200, Pali Rohár wrote:
> > > > > > > > And what? How it is related to the statements that my reviews would also
> > > > > > > > ignored? And what you want from me now?
> > > > > > > > 
> > > > > > > > On Wednesday 30 August 2023 14:17:50 Tom Rini wrote:
> > > > > > > > > Pali,
> > > > > > > > > 
> > > > > > > > > You are specifically listed as a maintainer for drivers/pci/pci_mvebu.c
> > > > > > > > > and that is changed by this patch.
> > > > > > > > > 
> > > > > > > > > On Wed, Aug 30, 2023 at 08:14:59PM +0200, Pali Rohár wrote:
> > > > > > > > > > Simon, why you are contacting me? You have wrote to me that you would
> > > > > > > > > > ignore my reviews here, so what you want now? Could you please explain
> > > > > > > > > > what you are trying to achieve? I'm not going to review this or any
> > > > > > > > > > other your changes.
> > > > > > > > > > 
> > > > > > > > > > On Wednesday 30 August 2023 12:05:03 Simon Glass wrote:
> > > > > > > > > > > The PCI helpers read only the base address for a PCI region. In some cases
> > > > > > > > > > > the size is needed as well, e.g. to pass along to a driver which needs to
> > > > > > > > > > > know the size of its register area.
> > > > > > > > > > > 
> > > > > > > > > > > Update the functions to allow the size to be returned. For serial, record
> > > > > > > > > > > the information and provided it with the serial_info() call.
> > > > > > > > > > > 
> > > > > > > > > > > A limitation still exists in that the size is not available when OF_LIVE
> > > > > > > > > > > is enabled, so take account of that in the tests.
> > > > > > > > > > > 
> > > > > > > > > > > Signed-off-by: Simon Glass <sjg@chromium.org>
> > > > > > > > > > > ---
> > > > > > > > > > > 
> > > > > > > > > > >  arch/sandbox/dts/test.dts   |  6 +++---
> > > > > > > > > > >  drivers/core/fdtaddr.c      |  6 +++---
> > > > > > > > > > >  drivers/core/ofnode.c       | 11 ++++++++---
> > > > > > > > > > >  drivers/core/read.c         |  6 ++++--
> > > > > > > > > > >  drivers/core/util.c         |  2 +-
> > > > > > > > > > >  drivers/pci/pci-uclass.c    |  2 +-
> > > > > > > > > > >  drivers/pci/pci_mvebu.c     |  3 ++-
> > > > > > > > > > >  drivers/pci/pci_tegra.c     |  2 +-
> > > > > > > > > > >  drivers/pci/pcie_mediatek.c |  4 ++--
> > > > > > > > > > >  drivers/serial/ns16550.c    | 15 ++++++++++-----
> > > > > > > > > > >  include/dm/fdtaddr.h        |  3 ++-
> > > > > > > > > > >  include/dm/ofnode.h         |  4 +++-
> > > > > > > > > > >  include/dm/read.h           |  8 +++++---
> > > > > > > > > > >  include/ns16550.h           |  4 +++-
> > > > > > > > > > >  include/serial.h            |  2 ++
> > > > > > > > > > >  test/dm/pci.c               | 14 ++++++++++----
> > > > > > > > > > >  16 files changed, 60 insertions(+), 32 deletions(-)
> > > > > > > > > > > 
> > > > > > > > > > > diff --git a/arch/sandbox/dts/test.dts b/arch/sandbox/dts/test.dts
> > > > > > > > > > > index a413cbe4989..961e8895a49 100644
> > > > > > > > > > > --- a/arch/sandbox/dts/test.dts
> > > > > > > > > > > +++ b/arch/sandbox/dts/test.dts
> > > > > > > > > > > @@ -1087,8 +1087,8 @@
> > > > > > > > > > >  		pci@1,0 {
> > > > > > > > > > >  			compatible = "pci-generic";
> > > > > > > > > > >  			/* reg 0 is at 0x14, using FDT_PCI_SPACE_MEM32 */
> > > > > > > > > > > -			reg = <0x02000814 0 0 0 0
> > > > > > > > > > > -			       0x01000810 0 0 0 0>;
> > > > > > > > > > > +			reg = <0x02000814 0 0 0x80 0
> > > > > > > > > > > +			       0x01000810 0 0 0xc0 0>;
> > > > > > > > > > >  			sandbox,emul = <&swap_case_emul0_1>;
> > > > > > > > > > >  		};
> > > > > > > > > > >  		p2sb-pci@2,0 {
> > > > > > > > > > > @@ -1115,7 +1115,7 @@
> > > > > > > > > > >  		pci@1f,0 {
> > > > > > > > > > >  			compatible = "pci-generic";
> > > > > > > > > > >  			/* reg 0 is at 0x10, using FDT_PCI_SPACE_IO */
> > > > > > > > > > > -			reg = <0x0100f810 0 0 0 0>;
> > > > > > > > > > > +			reg = <0x0100f810 0 0 0x100 0>;
> > > > > > > > > > >  			sandbox,emul = <&swap_case_emul0_1f>;
> > > > > > > > > > >  		};
> > > > > > > > > > >  	};
> > > > > > > > > > > diff --git a/drivers/core/fdtaddr.c b/drivers/core/fdtaddr.c
> > > > > > > > > > > index 546db675aaf..b79d138c419 100644
> > > > > > > > > > > --- a/drivers/core/fdtaddr.c
> > > > > > > > > > > +++ b/drivers/core/fdtaddr.c
> > > > > > > > > > > @@ -215,7 +215,7 @@ void *devfdt_map_physmem(const struct udevice *dev, unsigned long size)
> > > > > > > > > > >  	return map_physmem(addr, size, MAP_NOCACHE);
> > > > > > > > > > >  }
> > > > > > > > > > >  
> > > > > > > > > > > -fdt_addr_t devfdt_get_addr_pci(const struct udevice *dev)
> > > > > > > > > > > +fdt_addr_t devfdt_get_addr_pci(const struct udevice *dev, fdt_size_t *sizep)
> > > > > > > > > > >  {
> > > > > > > > > > >  	ulong addr;
> > > > > > > > > > >  
> > > > > > > > > > > @@ -226,12 +226,12 @@ fdt_addr_t devfdt_get_addr_pci(const struct udevice *dev)
> > > > > > > > > > >  		int ret;
> > > > > > > > > > >  
> > > > > > > > > > >  		ret = ofnode_read_pci_addr(dev_ofnode(dev), FDT_PCI_SPACE_MEM32,
> > > > > > > > > > > -					   "reg", &pci_addr);
> > > > > > > > > > > +					   "reg", &pci_addr, sizep);
> > > > > > > > > > >  		if (ret) {
> > > > > > > > > > >  			/* try if there is any i/o-mapped register */
> > > > > > > > > > >  			ret = ofnode_read_pci_addr(dev_ofnode(dev),
> > > > > > > > > > >  						   FDT_PCI_SPACE_IO, "reg",
> > > > > > > > > > > -						   &pci_addr);
> > > > > > > > > > > +						   &pci_addr, sizep);
> > > > > > > > > > >  			if (ret)
> > > > > > > > > > >  				return FDT_ADDR_T_NONE;
> > > > > > > > > > >  		}
> > > > > > > > > > > diff --git a/drivers/core/ofnode.c b/drivers/core/ofnode.c
> > > > > > > > > > > index 2ef4114cb6f..c9cec456f43 100644
> > > > > > > > > > > --- a/drivers/core/ofnode.c
> > > > > > > > > > > +++ b/drivers/core/ofnode.c
> > > > > > > > > > > @@ -1270,7 +1270,8 @@ const uint8_t *ofnode_read_u8_array_ptr(ofnode node, const char *propname,
> > > > > > > > > > >  }
> > > > > > > > > > >  
> > > > > > > > > > >  int ofnode_read_pci_addr(ofnode node, enum fdt_pci_space type,
> > > > > > > > > > > -			 const char *propname, struct fdt_pci_addr *addr)
> > > > > > > > > > > +			 const char *propname, struct fdt_pci_addr *addr,
> > > > > > > > > > > +			 fdt_size_t *size)
> > > > > > > > > > >  {
> > > > > > > > > > >  	const fdt32_t *cell;
> > > > > > > > > > >  	int len;
> > > > > > > > > > > @@ -1298,14 +1299,18 @@ int ofnode_read_pci_addr(ofnode node, enum fdt_pci_space type,
> > > > > > > > > > >  			      (ulong)fdt32_to_cpu(cell[1]),
> > > > > > > > > > >  			      (ulong)fdt32_to_cpu(cell[2]));
> > > > > > > > > > >  			if ((fdt32_to_cpu(*cell) & type) == type) {
> > > > > > > > > > > +				const unaligned_fdt64_t *ptr;
> > > > > > > > > > > +
> > > > > > > > > > >  				addr->phys_hi = fdt32_to_cpu(cell[0]);
> > > > > > > > > > >  				addr->phys_mid = fdt32_to_cpu(cell[1]);
> > > > > > > > > > >  				addr->phys_lo = fdt32_to_cpu(cell[2]);
> > > > > > > > > > > +				ptr = (const unaligned_fdt64_t *)(cell + 3);
> > > > > > > > > > > +				if (size)
> > > > > > > > > > > +					*size = fdt64_to_cpu(*ptr);
> > > > > > > > > > >  				break;
> > > > > > > > > > >  			}
> > > > > > > > > > >  
> > > > > > > > > > > -			cell += (FDT_PCI_ADDR_CELLS +
> > > > > > > > > > > -				 FDT_PCI_SIZE_CELLS);
> > > > > > > > > > > +			cell += FDT_PCI_ADDR_CELLS + FDT_PCI_SIZE_CELLS;
> > > > > > > > > > >  		}
> > > > > > > > > > >  
> > > > > > > > > > >  		if (i == num) {
> > > > > > > > > > > diff --git a/drivers/core/read.c b/drivers/core/read.c
> > > > > > > > > > > index 49066b59cda..419013451f0 100644
> > > > > > > > > > > --- a/drivers/core/read.c
> > > > > > > > > > > +++ b/drivers/core/read.c
> > > > > > > > > > > @@ -405,13 +405,15 @@ int dev_read_alias_highest_id(const char *stem)
> > > > > > > > > > >  	return fdtdec_get_alias_highest_id(gd->fdt_blob, stem);
> > > > > > > > > > >  }
> > > > > > > > > > >  
> > > > > > > > > > > -fdt_addr_t dev_read_addr_pci(const struct udevice *dev)
> > > > > > > > > > > +fdt_addr_t dev_read_addr_pci(const struct udevice *dev, fdt_size_t *sizep)
> > > > > > > > > > >  {
> > > > > > > > > > >  	ulong addr;
> > > > > > > > > > >  
> > > > > > > > > > >  	addr = dev_read_addr(dev);
> > > > > > > > > > > +	if (sizep)
> > > > > > > > > > > +		*sizep = 0;
> > > > > > > > > > >  	if (addr == FDT_ADDR_T_NONE && !of_live_active())
> > > > > > > > > > > -		addr = devfdt_get_addr_pci(dev);
> > > > > > > > > > > +		addr = devfdt_get_addr_pci(dev, sizep);
> > > > > > > > > > >  
> > > > > > > > > > >  	return addr;
> > > > > > > > > > >  }
> > > > > > > > > > > diff --git a/drivers/core/util.c b/drivers/core/util.c
> > > > > > > > > > > index aa60fdd15bc..81497df85ff 100644
> > > > > > > > > > > --- a/drivers/core/util.c
> > > > > > > > > > > +++ b/drivers/core/util.c
> > > > > > > > > > > @@ -30,7 +30,7 @@ int pci_get_devfn(struct udevice *dev)
> > > > > > > > > > >  
> > > > > > > > > > >  	/* Extract the devfn from fdt_pci_addr */
> > > > > > > > > > >  	ret = ofnode_read_pci_addr(dev_ofnode(dev), FDT_PCI_SPACE_CONFIG,
> > > > > > > > > > > -				   "reg", &addr);
> > > > > > > > > > > +				   "reg", &addr, NULL);
> > > > > > > > > > >  	if (ret) {
> > > > > > > > > > >  		if (ret != -ENOENT)
> > > > > > > > > > >  			return -EINVAL;
> > > > > > > > > > > diff --git a/drivers/pci/pci-uclass.c b/drivers/pci/pci-uclass.c
> > > > > > > > > > > index 0adcdceb1d3..c670f8754e8 100644
> > > > > > > > > > > --- a/drivers/pci/pci-uclass.c
> > > > > > > > > > > +++ b/drivers/pci/pci-uclass.c
> > > > > > > > > > > @@ -122,7 +122,7 @@ static void pci_dev_find_ofnode(struct udevice *bus, phys_addr_t bdf,
> > > > > > > > > > >  
> > > > > > > > > > >  	dev_for_each_subnode(node, bus) {
> > > > > > > > > > >  		ret = ofnode_read_pci_addr(node, FDT_PCI_SPACE_CONFIG, "reg",
> > > > > > > > > > > -					   &addr);
> > > > > > > > > > > +					   &addr, NULL);
> > > > > > > > > > >  		if (ret)
> > > > > > > > > > >  			continue;
> > > > > > > > > > >  
> > > > > > > > > > > diff --git a/drivers/pci/pci_mvebu.c b/drivers/pci/pci_mvebu.c
> > > > > > > > > > > index 93a7508d8a2..25878bde534 100644
> > > > > > > > > > > --- a/drivers/pci/pci_mvebu.c
> > > > > > > > > > > +++ b/drivers/pci/pci_mvebu.c
> > > > > > > > > > > @@ -640,7 +640,8 @@ static int mvebu_pcie_port_parse_dt(ofnode node, ofnode parent, struct mvebu_pci
> > > > > > > > > > >  		pcie->is_x4 = true;
> > > > > > > > > > >  
> > > > > > > > > > >  	/* devfn is in bits [15:8], see PCI_DEV usage */
> > > > > > > > > > > -	ret = ofnode_read_pci_addr(node, FDT_PCI_SPACE_CONFIG, "reg", &pci_addr);
> > > > > > > > > > > +	ret = ofnode_read_pci_addr(node, FDT_PCI_SPACE_CONFIG, "reg", &pci_addr,
> > > > > > > > > > > +				   NULL);
> > > > > > > > > > >  	if (ret < 0) {
> > > > > > > > > > >  		printf("%s: property \"reg\" is invalid\n", pcie->name);
> > > > > > > > > > >  		goto err;
> > > > > > > > > > > diff --git a/drivers/pci/pci_tegra.c b/drivers/pci/pci_tegra.c
> > > > > > > > > > > index 29d54117e93..ae90bd2fbf1 100644
> > > > > > > > > > > --- a/drivers/pci/pci_tegra.c
> > > > > > > > > > > +++ b/drivers/pci/pci_tegra.c
> > > > > > > > > > > @@ -461,7 +461,7 @@ static int tegra_pcie_parse_port_info(ofnode node, uint *index, uint *lanes)
> > > > > > > > > > >  
> > > > > > > > > > >  	*lanes = err;
> > > > > > > > > > >  
> > > > > > > > > > > -	err = ofnode_read_pci_addr(node, 0, "reg", &addr);
> > > > > > > > > > > +	err = ofnode_read_pci_addr(node, 0, "reg", &addr, NULL);
> > > > > > > > > > >  	if (err < 0) {
> > > > > > > > > > >  		pr_err("failed to parse \"reg\" property\n");
> > > > > > > > > > >  		return err;
> > > > > > > > > > > diff --git a/drivers/pci/pcie_mediatek.c b/drivers/pci/pcie_mediatek.c
> > > > > > > > > > > index c6e30e24622..e59ebd13ad0 100644
> > > > > > > > > > > --- a/drivers/pci/pcie_mediatek.c
> > > > > > > > > > > +++ b/drivers/pci/pcie_mediatek.c
> > > > > > > > > > > @@ -660,7 +660,7 @@ static int mtk_pcie_probe(struct udevice *dev)
> > > > > > > > > > >  		if (!ofnode_is_enabled(subnode))
> > > > > > > > > > >  			continue;
> > > > > > > > > > >  
> > > > > > > > > > > -		err = ofnode_read_pci_addr(subnode, 0, "reg", &addr);
> > > > > > > > > > > +		err = ofnode_read_pci_addr(subnode, 0, "reg", &addr, NULL);
> > > > > > > > > > >  		if (err)
> > > > > > > > > > >  			return err;
> > > > > > > > > > >  
> > > > > > > > > > > @@ -699,7 +699,7 @@ static int mtk_pcie_probe_v2(struct udevice *dev)
> > > > > > > > > > >  		if (!ofnode_is_enabled(subnode))
> > > > > > > > > > >  			continue;
> > > > > > > > > > >  
> > > > > > > > > > > -		err = ofnode_read_pci_addr(subnode, 0, "reg", &addr);
> > > > > > > > > > > +		err = ofnode_read_pci_addr(subnode, 0, "reg", &addr, NULL);
> > > > > > > > > > >  		if (err)
> > > > > > > > > > >  			return err;
> > > > > > > > > > >  
> > > > > > > > > > > diff --git a/drivers/serial/ns16550.c b/drivers/serial/ns16550.c
> > > > > > > > > > > index eab9537fbae..a349e5e132a 100644
> > > > > > > > > > > --- a/drivers/serial/ns16550.c
> > > > > > > > > > > +++ b/drivers/serial/ns16550.c
> > > > > > > > > > > @@ -479,6 +479,7 @@ static int ns16550_serial_getinfo(struct udevice *dev,
> > > > > > > > > > >  	info->addr_space = SERIAL_ADDRESS_SPACE_MEMORY;
> > > > > > > > > > >  #endif
> > > > > > > > > > >  	info->addr = plat->base;
> > > > > > > > > > > +	info->size = plat->size;
> > > > > > > > > > >  	info->reg_width = plat->reg_width;
> > > > > > > > > > >  	info->reg_shift = plat->reg_shift;
> > > > > > > > > > >  	info->reg_offset = plat->reg_offset;
> > > > > > > > > > > @@ -487,7 +488,8 @@ static int ns16550_serial_getinfo(struct udevice *dev,
> > > > > > > > > > >  	return 0;
> > > > > > > > > > >  }
> > > > > > > > > > >  
> > > > > > > > > > > -static int ns16550_serial_assign_base(struct ns16550_plat *plat, fdt_addr_t base)
> > > > > > > > > > > +static int ns16550_serial_assign_base(struct ns16550_plat *plat,
> > > > > > > > > > > +				      fdt_addr_t base, fdt_size_t size)
> > > > > > > > > > >  {
> > > > > > > > > > >  	if (base == FDT_ADDR_T_NONE)
> > > > > > > > > > >  		return -EINVAL;
> > > > > > > > > > > @@ -497,6 +499,7 @@ static int ns16550_serial_assign_base(struct ns16550_plat *plat, fdt_addr_t base
> > > > > > > > > > >  #else
> > > > > > > > > > >  	plat->base = (unsigned long)map_physmem(base, 0, MAP_NOCACHE);
> > > > > > > > > > >  #endif
> > > > > > > > > > > +	plat->size = size;
> > > > > > > > > > >  
> > > > > > > > > > >  	return 0;
> > > > > > > > > > >  }
> > > > > > > > > > > @@ -507,6 +510,7 @@ int ns16550_serial_probe(struct udevice *dev)
> > > > > > > > > > >  	struct ns16550 *const com_port = dev_get_priv(dev);
> > > > > > > > > > >  	struct reset_ctl_bulk reset_bulk;
> > > > > > > > > > >  	fdt_addr_t addr;
> > > > > > > > > > > +	fdt_addr_t size;
> > > > > > > > > > >  	int ret;
> > > > > > > > > > >  
> > > > > > > > > > >  	/*
> > > > > > > > > > > @@ -514,8 +518,8 @@ int ns16550_serial_probe(struct udevice *dev)
> > > > > > > > > > >  	 * or via a PCI bridge, assign plat->base before probing hardware.
> > > > > > > > > > >  	 */
> > > > > > > > > > >  	if (device_is_on_pci_bus(dev)) {
> > > > > > > > > > > -		addr = devfdt_get_addr_pci(dev);
> > > > > > > > > > > -		ret = ns16550_serial_assign_base(plat, addr);
> > > > > > > > > > > +		addr = devfdt_get_addr_pci(dev, &size);
> > > > > > > > > > > +		ret = ns16550_serial_assign_base(plat, addr, size);
> > > > > > > > > > >  		if (ret)
> > > > > > > > > > >  			return ret;
> > > > > > > > > > >  	}
> > > > > > > > > > > @@ -543,11 +547,12 @@ int ns16550_serial_of_to_plat(struct udevice *dev)
> > > > > > > > > > >  	struct ns16550_plat *plat = dev_get_plat(dev);
> > > > > > > > > > >  	const u32 port_type = dev_get_driver_data(dev);
> > > > > > > > > > >  	fdt_addr_t addr;
> > > > > > > > > > > +	fdt_size_t size;
> > > > > > > > > > >  	struct clk clk;
> > > > > > > > > > >  	int err;
> > > > > > > > > > >  
> > > > > > > > > > > -	addr = dev_read_addr(dev);
> > > > > > > > > > > -	err = ns16550_serial_assign_base(plat, addr);
> > > > > > > > > > > +	addr = dev_read_addr_size(dev, &size);
> > > > > > > > > > > +	err = ns16550_serial_assign_base(plat, addr, size);
> > > > > > > > > > >  	if (err && !device_is_on_pci_bus(dev))
> > > > > > > > > > >  		return err;
> > > > > > > > > > >  
> > > > > > > > > > > diff --git a/include/dm/fdtaddr.h b/include/dm/fdtaddr.h
> > > > > > > > > > > index dcdc19137cc..6d2fa8f1044 100644
> > > > > > > > > > > --- a/include/dm/fdtaddr.h
> > > > > > > > > > > +++ b/include/dm/fdtaddr.h
> > > > > > > > > > > @@ -168,8 +168,9 @@ fdt_addr_t devfdt_get_addr_size_name(const struct udevice *dev,
> > > > > > > > > > >   * devfdt_get_addr_pci() - Read an address and handle PCI address translation
> > > > > > > > > > >   *
> > > > > > > > > > >   * @dev: Device to read from
> > > > > > > > > > > + * @sizep: If non-NULL, returns size of address space
> > > > > > > > > > >   * Return: address or FDT_ADDR_T_NONE if not found
> > > > > > > > > > >   */
> > > > > > > > > > > -fdt_addr_t devfdt_get_addr_pci(const struct udevice *dev);
> > > > > > > > > > > +fdt_addr_t devfdt_get_addr_pci(const struct udevice *dev, fdt_size_t *sizep);
> > > > > > > > > > >  
> > > > > > > > > > >  #endif
> > > > > > > > > > > diff --git a/include/dm/ofnode.h b/include/dm/ofnode.h
> > > > > > > > > > > index 726d8f82ddf..97cad971611 100644
> > > > > > > > > > > --- a/include/dm/ofnode.h
> > > > > > > > > > > +++ b/include/dm/ofnode.h
> > > > > > > > > > > @@ -1152,13 +1152,15 @@ const uint8_t *ofnode_read_u8_array_ptr(ofnode node, const char *propname,
> > > > > > > > > > >   * @type:	pci address type (FDT_PCI_SPACE_xxx)
> > > > > > > > > > >   * @propname:	name of property to find
> > > > > > > > > > >   * @addr:	returns pci address in the form of fdt_pci_addr
> > > > > > > > > > > + * @size:	if non-null, returns register-space size
> > > > > > > > > > >   * Return:
> > > > > > > > > > >   * 0 if ok, -ENOENT if the property did not exist, -EINVAL if the
> > > > > > > > > > >   * format of the property was invalid, -ENXIO if the requested
> > > > > > > > > > >   * address type was not found
> > > > > > > > > > >   */
> > > > > > > > > > >  int ofnode_read_pci_addr(ofnode node, enum fdt_pci_space type,
> > > > > > > > > > > -			 const char *propname, struct fdt_pci_addr *addr);
> > > > > > > > > > > +			 const char *propname, struct fdt_pci_addr *addr,
> > > > > > > > > > > +			 fdt_size_t *size);
> > > > > > > > > > >  
> > > > > > > > > > >  /**
> > > > > > > > > > >   * ofnode_read_pci_vendev() - look up PCI vendor and device id
> > > > > > > > > > > diff --git a/include/dm/read.h b/include/dm/read.h
> > > > > > > > > > > index c2615f72f40..3c2eea6f0c4 100644
> > > > > > > > > > > --- a/include/dm/read.h
> > > > > > > > > > > +++ b/include/dm/read.h
> > > > > > > > > > > @@ -346,9 +346,10 @@ void *dev_read_addr_ptr(const struct udevice *dev);
> > > > > > > > > > >   *    fdtdec_get_addr() and friends.
> > > > > > > > > > >   *
> > > > > > > > > > >   * @dev: Device to read from
> > > > > > > > > > > + * @sizep: If non-NULL, returns size of address space found
> > > > > > > > > > >   * Return: address or FDT_ADDR_T_NONE if not found
> > > > > > > > > > >   */
> > > > > > > > > > > -fdt_addr_t dev_read_addr_pci(const struct udevice *dev);
> > > > > > > > > > > +fdt_addr_t dev_read_addr_pci(const struct udevice *dev, fdt_size_t *sizep);
> > > > > > > > > > >  
> > > > > > > > > > >  /**
> > > > > > > > > > >   * dev_remap_addr() - Get the reg property of a device as a
> > > > > > > > > > > @@ -996,9 +997,10 @@ static inline void *dev_read_addr_ptr(const struct udevice *dev)
> > > > > > > > > > >  	return devfdt_get_addr_ptr(dev);
> > > > > > > > > > >  }
> > > > > > > > > > >  
> > > > > > > > > > > -static inline fdt_addr_t dev_read_addr_pci(const struct udevice *dev)
> > > > > > > > > > > +static inline fdt_addr_t dev_read_addr_pci(const struct udevice *dev,
> > > > > > > > > > > +					   fdt_size_t *sizep)
> > > > > > > > > > >  {
> > > > > > > > > > > -	return devfdt_get_addr_pci(dev);
> > > > > > > > > > > +	return devfdt_get_addr_pci(dev, sizep);
> > > > > > > > > > >  }
> > > > > > > > > > >  
> > > > > > > > > > >  static inline void *dev_remap_addr(const struct udevice *dev)
> > > > > > > > > > > diff --git a/include/ns16550.h b/include/ns16550.h
> > > > > > > > > > > index e7e68663d03..7f481300083 100644
> > > > > > > > > > > --- a/include/ns16550.h
> > > > > > > > > > > +++ b/include/ns16550.h
> > > > > > > > > > > @@ -58,6 +58,7 @@ enum ns16550_flags {
> > > > > > > > > > >   * struct ns16550_plat - information about a NS16550 port
> > > > > > > > > > >   *
> > > > > > > > > > >   * @base:		Base register address
> > > > > > > > > > > + * @size:		Size of register area in bytes
> > > > > > > > > > >   * @reg_width:		IO accesses size of registers (in bytes, 1 or 4)
> > > > > > > > > > >   * @reg_shift:		Shift size of registers (0=byte, 1=16bit, 2=32bit...)
> > > > > > > > > > >   * @reg_offset:		Offset to start of registers (normally 0)
> > > > > > > > > > > @@ -67,7 +68,8 @@ enum ns16550_flags {
> > > > > > > > > > >   * @bdf:		PCI slot/function (pci_dev_t)
> > > > > > > > > > >   */
> > > > > > > > > > >  struct ns16550_plat {
> > > > > > > > > > > -	unsigned long base;
> > > > > > > > > > > +	ulong base;
> > > > > > > > > > > +	ulong size;
> > > > > > > > > > >  	int reg_width;
> > > > > > > > > > >  	int reg_shift;
> > > > > > > > > > >  	int reg_offset;
> > > > > > > > > > > diff --git a/include/serial.h b/include/serial.h
> > > > > > > > > > > index 42bdf3759c0..205889d28be 100644
> > > > > > > > > > > --- a/include/serial.h
> > > > > > > > > > > +++ b/include/serial.h
> > > > > > > > > > > @@ -137,6 +137,7 @@ enum adr_space_type {
> > > > > > > > > > >   * @type:	type of the UART chip
> > > > > > > > > > >   * @addr_space:	address space to access the registers
> > > > > > > > > > >   * @addr:	physical address of the registers
> > > > > > > > > > > + * @size:	size of the register area in bytes
> > > > > > > > > > >   * @reg_width:	size (in bytes) of the IO accesses to the registers
> > > > > > > > > > >   * @reg_offset:	offset to apply to the @addr from the start of the registers
> > > > > > > > > > >   * @reg_shift:	quantity to shift the register offsets by
> > > > > > > > > > > @@ -147,6 +148,7 @@ struct serial_device_info {
> > > > > > > > > > >  	enum serial_chip_type type;
> > > > > > > > > > >  	enum adr_space_type addr_space;
> > > > > > > > > > >  	ulong addr;
> > > > > > > > > > > +	ulong size;
> > > > > > > > > > >  	u8 reg_width;
> > > > > > > > > > >  	u8 reg_offset;
> > > > > > > > > > >  	u8 reg_shift;
> > > > > > > > > > > diff --git a/test/dm/pci.c b/test/dm/pci.c
> > > > > > > > > > > index 70a736cfdb8..8c5e7da9e62 100644
> > > > > > > > > > > --- a/test/dm/pci.c
> > > > > > > > > > > +++ b/test/dm/pci.c
> > > > > > > > > > > @@ -301,10 +301,12 @@ static int dm_test_pci_addr_flat(struct unit_test_state *uts)
> > > > > > > > > > >  {
> > > > > > > > > > >  	struct udevice *swap1f, *swap1;
> > > > > > > > > > >  	ulong io_addr, mem_addr;
> > > > > > > > > > > +	fdt_addr_t size;
> > > > > > > > > > >  
> > > > > > > > > > >  	ut_assertok(dm_pci_bus_find_bdf(PCI_BDF(0, 0x1f, 0), &swap1f));
> > > > > > > > > > >  	io_addr = dm_pci_read_bar32(swap1f, 0);
> > > > > > > > > > > -	ut_asserteq(io_addr, dev_read_addr_pci(swap1f));
> > > > > > > > > > > +	ut_asserteq(io_addr, dev_read_addr_pci(swap1f, &size));
> > > > > > > > > > > +	ut_asserteq(0, size);
> > > > > > > > > > >  
> > > > > > > > > > >  	/*
> > > > > > > > > > >  	 * This device has both I/O and MEM spaces but the MEM space appears
> > > > > > > > > > > @@ -312,7 +314,8 @@ static int dm_test_pci_addr_flat(struct unit_test_state *uts)
> > > > > > > > > > >  	 */
> > > > > > > > > > >  	ut_assertok(dm_pci_bus_find_bdf(PCI_BDF(0, 0x1, 0), &swap1));
> > > > > > > > > > >  	mem_addr = dm_pci_read_bar32(swap1, 1);
> > > > > > > > > > > -	ut_asserteq(mem_addr, dev_read_addr_pci(swap1));
> > > > > > > > > > > +	ut_asserteq(mem_addr, dev_read_addr_pci(swap1, &size));
> > > > > > > > > > > +	ut_asserteq(0, size);
> > > > > > > > > > >  
> > > > > > > > > > >  	return 0;
> > > > > > > > > > >  }
> > > > > > > > > > > @@ -329,12 +332,15 @@ DM_TEST(dm_test_pci_addr_flat, UT_TESTF_SCAN_PDATA | UT_TESTF_SCAN_FDT |
> > > > > > > > > > >  static int dm_test_pci_addr_live(struct unit_test_state *uts)
> > > > > > > > > > >  {
> > > > > > > > > > >  	struct udevice *swap1f, *swap1;
> > > > > > > > > > > +	fdt_size_t size;
> > > > > > > > > > >  
> > > > > > > > > > >  	ut_assertok(dm_pci_bus_find_bdf(PCI_BDF(0, 0x1f, 0), &swap1f));
> > > > > > > > > > > -	ut_asserteq_64(FDT_ADDR_T_NONE, dev_read_addr_pci(swap1f));
> > > > > > > > > > > +	ut_asserteq_64(FDT_ADDR_T_NONE, dev_read_addr_pci(swap1f, &size));
> > > > > > > > > > > +	ut_asserteq(0, size);
> > > > > > > > > > >  
> > > > > > > > > > >  	ut_assertok(dm_pci_bus_find_bdf(PCI_BDF(0, 0x1, 0), &swap1));
> > > > > > > > > > > -	ut_asserteq_64(FDT_ADDR_T_NONE, dev_read_addr_pci(swap1));
> > > > > > > > > > > +	ut_asserteq_64(FDT_ADDR_T_NONE, dev_read_addr_pci(swap1, &size));
> > > > > > > > > > > +	ut_asserteq(0, size);
> > > > > > > > > > >  
> > > > > > > > > > >  	return 0;
> > > > > > > > > > >  }
> > > > > > > > > > > -- 
> > > > > > > > > > > 2.42.0.rc2.253.gd59a3bf2b4-goog
> > > > > > > > > > > 
> > > > > > > > > 
> > > > > > > > > -- 
> > > > > > > > > Tom
> > > > > > > > 
> > > > > > > > 
> > > > > > > 
> > > > > > > -- 
> > > > > > > Tom
> > > > > > 
> > > > > > 
> > > > > 
> > > > > -- 
> > > > > Tom
> > > > 
> > > > 
> > 
> > -- 
> > Tom
> 
> 

-- 
Tom

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 659 bytes --]

^ permalink raw reply	[flat|nested] 86+ messages in thread

* Re: [PATCH 32/32] pci: serial: Support reading PCI-register size with base
  2023-08-30 21:26                       ` Tom Rini
@ 2023-08-30 21:29                         ` Pali Rohár
  2023-08-30 21:42                           ` Tom Rini
  0 siblings, 1 reply; 86+ messages in thread
From: Pali Rohár @ 2023-08-30 21:29 UTC (permalink / raw)
  To: Tom Rini; +Cc: U-Boot Mailing List

There were no answers.

On Wednesday 30 August 2023 17:26:20 Tom Rini wrote:
> I'm trimming the CC list. All of those points you list were addressed
> and answered in your last long running argument. You need to decide what
> is best for you moving forward and I would ask that it not involve
> complaining that you're being asked to review code that you're a listed
> maintainer of.
> 
> On Wed, Aug 30, 2023 at 11:13:16PM +0200, Pali Rohár wrote:
> > Seems that you completely miss the point of the argument, then the only
> > option for such people is to repeat them. Or have I repeat you again
> > that you have not answered the first question, why you are asking for
> > review from somebody who you are ignoring and not taking into account?
> > You do not want to answer this question, right? So you rather change a
> > topic and talking about something totally different.
> > 
> > On Wednesday 30 August 2023 17:08:42 Tom Rini wrote:
> > > I don't think it's worth re-hashing the same arguments over and over.
> > > There is no "my persons", there is the public community.  If you no
> > > longer wish to participate, I can remove you from the maintainers
> > > entries you're listed in.  But please stop with the long arguments
> > > unrelated to the patches at hand when there's a dozen people and other
> > > lists on CC.
> > > 
> > > On Wed, Aug 30, 2023 at 10:51:45PM +0200, Pali Rohár wrote:
> > > > So lets recap what you and your persons have done in last 6 months:
> > > > 
> > > > * Ignored my changes
> > > > * Ignored my reviews
> > > > * Ignored my regression reports
> > > > * Ignored my reminders
> > > > 
> > > > And now you complaining that I'm not going to do another review? Then
> > > > you should be the first who step down there as incompetent person. I was
> > > > interesting in developing there for a very long time (10+ years I was
> > > > active there?).
> > > > 
> > > > I think I have already wrote many times that I would not do any new
> > > > stuff here for you until you start processing existing reports. Seems
> > > > that you have been ignoring these my warnings. And when I starting
> > > > applying my statements, you are not happy with it? You should have been
> > > > thinking about it year ago.
> > > > 
> > > > On Wednesday 30 August 2023 21:44:09 Pali Rohár wrote:
> > > > > And you too. That was at the time when you and your people were
> > > > > interested in reviews from others.
> > > > > 
> > > > > On Wednesday 30 August 2023 15:41:57 Tom Rini wrote:
> > > > > > Then you should probably remove yourself from the places you've listed
> > > > > > yourself as an interested maintainer, thanks.
> > > > > > 
> > > > > > On Wed, Aug 30, 2023 at 09:10:36PM +0200, Pali Rohár wrote:
> > > > > > > You have already decided, what is the point? You are not taking any my
> > > > > > > objections into account, so stop writing to me and to others these your
> > > > > > > stupids bullshits. I'm not an idiot who is interesting for them.
> > > > > > > 
> > > > > > > On Wednesday 30 August 2023 15:04:22 Tom Rini wrote:
> > > > > > > > You're a listed maintainer for a file being changed. If you objected to
> > > > > > > > the changes, your objection would matter.  If you don't object, you can
> > > > > > > > just ignore it, or review it, whatever you like.  You need to decide
> > > > > > > > what you want to do about code you're volunteering to maintain.
> > > > > > > > 
> > > > > > > > On Wed, Aug 30, 2023 at 08:39:13PM +0200, Pali Rohár wrote:
> > > > > > > > > And what? How it is related to the statements that my reviews would also
> > > > > > > > > ignored? And what you want from me now?
> > > > > > > > > 
> > > > > > > > > On Wednesday 30 August 2023 14:17:50 Tom Rini wrote:
> > > > > > > > > > Pali,
> > > > > > > > > > 
> > > > > > > > > > You are specifically listed as a maintainer for drivers/pci/pci_mvebu.c
> > > > > > > > > > and that is changed by this patch.
> > > > > > > > > > 
> > > > > > > > > > On Wed, Aug 30, 2023 at 08:14:59PM +0200, Pali Rohár wrote:
> > > > > > > > > > > Simon, why you are contacting me? You have wrote to me that you would
> > > > > > > > > > > ignore my reviews here, so what you want now? Could you please explain
> > > > > > > > > > > what you are trying to achieve? I'm not going to review this or any
> > > > > > > > > > > other your changes.
> > > > > > > > > > > 
> > > > > > > > > > > On Wednesday 30 August 2023 12:05:03 Simon Glass wrote:
> > > > > > > > > > > > The PCI helpers read only the base address for a PCI region. In some cases
> > > > > > > > > > > > the size is needed as well, e.g. to pass along to a driver which needs to
> > > > > > > > > > > > know the size of its register area.
> > > > > > > > > > > > 
> > > > > > > > > > > > Update the functions to allow the size to be returned. For serial, record
> > > > > > > > > > > > the information and provided it with the serial_info() call.
> > > > > > > > > > > > 
> > > > > > > > > > > > A limitation still exists in that the size is not available when OF_LIVE
> > > > > > > > > > > > is enabled, so take account of that in the tests.
> > > > > > > > > > > > 
> > > > > > > > > > > > Signed-off-by: Simon Glass <sjg@chromium.org>
> > > > > > > > > > > > ---
> > > > > > > > > > > > 
> > > > > > > > > > > >  arch/sandbox/dts/test.dts   |  6 +++---
> > > > > > > > > > > >  drivers/core/fdtaddr.c      |  6 +++---
> > > > > > > > > > > >  drivers/core/ofnode.c       | 11 ++++++++---
> > > > > > > > > > > >  drivers/core/read.c         |  6 ++++--
> > > > > > > > > > > >  drivers/core/util.c         |  2 +-
> > > > > > > > > > > >  drivers/pci/pci-uclass.c    |  2 +-
> > > > > > > > > > > >  drivers/pci/pci_mvebu.c     |  3 ++-
> > > > > > > > > > > >  drivers/pci/pci_tegra.c     |  2 +-
> > > > > > > > > > > >  drivers/pci/pcie_mediatek.c |  4 ++--
> > > > > > > > > > > >  drivers/serial/ns16550.c    | 15 ++++++++++-----
> > > > > > > > > > > >  include/dm/fdtaddr.h        |  3 ++-
> > > > > > > > > > > >  include/dm/ofnode.h         |  4 +++-
> > > > > > > > > > > >  include/dm/read.h           |  8 +++++---
> > > > > > > > > > > >  include/ns16550.h           |  4 +++-
> > > > > > > > > > > >  include/serial.h            |  2 ++
> > > > > > > > > > > >  test/dm/pci.c               | 14 ++++++++++----
> > > > > > > > > > > >  16 files changed, 60 insertions(+), 32 deletions(-)
> > > > > > > > > > > > 
> > > > > > > > > > > > diff --git a/arch/sandbox/dts/test.dts b/arch/sandbox/dts/test.dts
> > > > > > > > > > > > index a413cbe4989..961e8895a49 100644
> > > > > > > > > > > > --- a/arch/sandbox/dts/test.dts
> > > > > > > > > > > > +++ b/arch/sandbox/dts/test.dts
> > > > > > > > > > > > @@ -1087,8 +1087,8 @@
> > > > > > > > > > > >  		pci@1,0 {
> > > > > > > > > > > >  			compatible = "pci-generic";
> > > > > > > > > > > >  			/* reg 0 is at 0x14, using FDT_PCI_SPACE_MEM32 */
> > > > > > > > > > > > -			reg = <0x02000814 0 0 0 0
> > > > > > > > > > > > -			       0x01000810 0 0 0 0>;
> > > > > > > > > > > > +			reg = <0x02000814 0 0 0x80 0
> > > > > > > > > > > > +			       0x01000810 0 0 0xc0 0>;
> > > > > > > > > > > >  			sandbox,emul = <&swap_case_emul0_1>;
> > > > > > > > > > > >  		};
> > > > > > > > > > > >  		p2sb-pci@2,0 {
> > > > > > > > > > > > @@ -1115,7 +1115,7 @@
> > > > > > > > > > > >  		pci@1f,0 {
> > > > > > > > > > > >  			compatible = "pci-generic";
> > > > > > > > > > > >  			/* reg 0 is at 0x10, using FDT_PCI_SPACE_IO */
> > > > > > > > > > > > -			reg = <0x0100f810 0 0 0 0>;
> > > > > > > > > > > > +			reg = <0x0100f810 0 0 0x100 0>;
> > > > > > > > > > > >  			sandbox,emul = <&swap_case_emul0_1f>;
> > > > > > > > > > > >  		};
> > > > > > > > > > > >  	};
> > > > > > > > > > > > diff --git a/drivers/core/fdtaddr.c b/drivers/core/fdtaddr.c
> > > > > > > > > > > > index 546db675aaf..b79d138c419 100644
> > > > > > > > > > > > --- a/drivers/core/fdtaddr.c
> > > > > > > > > > > > +++ b/drivers/core/fdtaddr.c
> > > > > > > > > > > > @@ -215,7 +215,7 @@ void *devfdt_map_physmem(const struct udevice *dev, unsigned long size)
> > > > > > > > > > > >  	return map_physmem(addr, size, MAP_NOCACHE);
> > > > > > > > > > > >  }
> > > > > > > > > > > >  
> > > > > > > > > > > > -fdt_addr_t devfdt_get_addr_pci(const struct udevice *dev)
> > > > > > > > > > > > +fdt_addr_t devfdt_get_addr_pci(const struct udevice *dev, fdt_size_t *sizep)
> > > > > > > > > > > >  {
> > > > > > > > > > > >  	ulong addr;
> > > > > > > > > > > >  
> > > > > > > > > > > > @@ -226,12 +226,12 @@ fdt_addr_t devfdt_get_addr_pci(const struct udevice *dev)
> > > > > > > > > > > >  		int ret;
> > > > > > > > > > > >  
> > > > > > > > > > > >  		ret = ofnode_read_pci_addr(dev_ofnode(dev), FDT_PCI_SPACE_MEM32,
> > > > > > > > > > > > -					   "reg", &pci_addr);
> > > > > > > > > > > > +					   "reg", &pci_addr, sizep);
> > > > > > > > > > > >  		if (ret) {
> > > > > > > > > > > >  			/* try if there is any i/o-mapped register */
> > > > > > > > > > > >  			ret = ofnode_read_pci_addr(dev_ofnode(dev),
> > > > > > > > > > > >  						   FDT_PCI_SPACE_IO, "reg",
> > > > > > > > > > > > -						   &pci_addr);
> > > > > > > > > > > > +						   &pci_addr, sizep);
> > > > > > > > > > > >  			if (ret)
> > > > > > > > > > > >  				return FDT_ADDR_T_NONE;
> > > > > > > > > > > >  		}
> > > > > > > > > > > > diff --git a/drivers/core/ofnode.c b/drivers/core/ofnode.c
> > > > > > > > > > > > index 2ef4114cb6f..c9cec456f43 100644
> > > > > > > > > > > > --- a/drivers/core/ofnode.c
> > > > > > > > > > > > +++ b/drivers/core/ofnode.c
> > > > > > > > > > > > @@ -1270,7 +1270,8 @@ const uint8_t *ofnode_read_u8_array_ptr(ofnode node, const char *propname,
> > > > > > > > > > > >  }
> > > > > > > > > > > >  
> > > > > > > > > > > >  int ofnode_read_pci_addr(ofnode node, enum fdt_pci_space type,
> > > > > > > > > > > > -			 const char *propname, struct fdt_pci_addr *addr)
> > > > > > > > > > > > +			 const char *propname, struct fdt_pci_addr *addr,
> > > > > > > > > > > > +			 fdt_size_t *size)
> > > > > > > > > > > >  {
> > > > > > > > > > > >  	const fdt32_t *cell;
> > > > > > > > > > > >  	int len;
> > > > > > > > > > > > @@ -1298,14 +1299,18 @@ int ofnode_read_pci_addr(ofnode node, enum fdt_pci_space type,
> > > > > > > > > > > >  			      (ulong)fdt32_to_cpu(cell[1]),
> > > > > > > > > > > >  			      (ulong)fdt32_to_cpu(cell[2]));
> > > > > > > > > > > >  			if ((fdt32_to_cpu(*cell) & type) == type) {
> > > > > > > > > > > > +				const unaligned_fdt64_t *ptr;
> > > > > > > > > > > > +
> > > > > > > > > > > >  				addr->phys_hi = fdt32_to_cpu(cell[0]);
> > > > > > > > > > > >  				addr->phys_mid = fdt32_to_cpu(cell[1]);
> > > > > > > > > > > >  				addr->phys_lo = fdt32_to_cpu(cell[2]);
> > > > > > > > > > > > +				ptr = (const unaligned_fdt64_t *)(cell + 3);
> > > > > > > > > > > > +				if (size)
> > > > > > > > > > > > +					*size = fdt64_to_cpu(*ptr);
> > > > > > > > > > > >  				break;
> > > > > > > > > > > >  			}
> > > > > > > > > > > >  
> > > > > > > > > > > > -			cell += (FDT_PCI_ADDR_CELLS +
> > > > > > > > > > > > -				 FDT_PCI_SIZE_CELLS);
> > > > > > > > > > > > +			cell += FDT_PCI_ADDR_CELLS + FDT_PCI_SIZE_CELLS;
> > > > > > > > > > > >  		}
> > > > > > > > > > > >  
> > > > > > > > > > > >  		if (i == num) {
> > > > > > > > > > > > diff --git a/drivers/core/read.c b/drivers/core/read.c
> > > > > > > > > > > > index 49066b59cda..419013451f0 100644
> > > > > > > > > > > > --- a/drivers/core/read.c
> > > > > > > > > > > > +++ b/drivers/core/read.c
> > > > > > > > > > > > @@ -405,13 +405,15 @@ int dev_read_alias_highest_id(const char *stem)
> > > > > > > > > > > >  	return fdtdec_get_alias_highest_id(gd->fdt_blob, stem);
> > > > > > > > > > > >  }
> > > > > > > > > > > >  
> > > > > > > > > > > > -fdt_addr_t dev_read_addr_pci(const struct udevice *dev)
> > > > > > > > > > > > +fdt_addr_t dev_read_addr_pci(const struct udevice *dev, fdt_size_t *sizep)
> > > > > > > > > > > >  {
> > > > > > > > > > > >  	ulong addr;
> > > > > > > > > > > >  
> > > > > > > > > > > >  	addr = dev_read_addr(dev);
> > > > > > > > > > > > +	if (sizep)
> > > > > > > > > > > > +		*sizep = 0;
> > > > > > > > > > > >  	if (addr == FDT_ADDR_T_NONE && !of_live_active())
> > > > > > > > > > > > -		addr = devfdt_get_addr_pci(dev);
> > > > > > > > > > > > +		addr = devfdt_get_addr_pci(dev, sizep);
> > > > > > > > > > > >  
> > > > > > > > > > > >  	return addr;
> > > > > > > > > > > >  }
> > > > > > > > > > > > diff --git a/drivers/core/util.c b/drivers/core/util.c
> > > > > > > > > > > > index aa60fdd15bc..81497df85ff 100644
> > > > > > > > > > > > --- a/drivers/core/util.c
> > > > > > > > > > > > +++ b/drivers/core/util.c
> > > > > > > > > > > > @@ -30,7 +30,7 @@ int pci_get_devfn(struct udevice *dev)
> > > > > > > > > > > >  
> > > > > > > > > > > >  	/* Extract the devfn from fdt_pci_addr */
> > > > > > > > > > > >  	ret = ofnode_read_pci_addr(dev_ofnode(dev), FDT_PCI_SPACE_CONFIG,
> > > > > > > > > > > > -				   "reg", &addr);
> > > > > > > > > > > > +				   "reg", &addr, NULL);
> > > > > > > > > > > >  	if (ret) {
> > > > > > > > > > > >  		if (ret != -ENOENT)
> > > > > > > > > > > >  			return -EINVAL;
> > > > > > > > > > > > diff --git a/drivers/pci/pci-uclass.c b/drivers/pci/pci-uclass.c
> > > > > > > > > > > > index 0adcdceb1d3..c670f8754e8 100644
> > > > > > > > > > > > --- a/drivers/pci/pci-uclass.c
> > > > > > > > > > > > +++ b/drivers/pci/pci-uclass.c
> > > > > > > > > > > > @@ -122,7 +122,7 @@ static void pci_dev_find_ofnode(struct udevice *bus, phys_addr_t bdf,
> > > > > > > > > > > >  
> > > > > > > > > > > >  	dev_for_each_subnode(node, bus) {
> > > > > > > > > > > >  		ret = ofnode_read_pci_addr(node, FDT_PCI_SPACE_CONFIG, "reg",
> > > > > > > > > > > > -					   &addr);
> > > > > > > > > > > > +					   &addr, NULL);
> > > > > > > > > > > >  		if (ret)
> > > > > > > > > > > >  			continue;
> > > > > > > > > > > >  
> > > > > > > > > > > > diff --git a/drivers/pci/pci_mvebu.c b/drivers/pci/pci_mvebu.c
> > > > > > > > > > > > index 93a7508d8a2..25878bde534 100644
> > > > > > > > > > > > --- a/drivers/pci/pci_mvebu.c
> > > > > > > > > > > > +++ b/drivers/pci/pci_mvebu.c
> > > > > > > > > > > > @@ -640,7 +640,8 @@ static int mvebu_pcie_port_parse_dt(ofnode node, ofnode parent, struct mvebu_pci
> > > > > > > > > > > >  		pcie->is_x4 = true;
> > > > > > > > > > > >  
> > > > > > > > > > > >  	/* devfn is in bits [15:8], see PCI_DEV usage */
> > > > > > > > > > > > -	ret = ofnode_read_pci_addr(node, FDT_PCI_SPACE_CONFIG, "reg", &pci_addr);
> > > > > > > > > > > > +	ret = ofnode_read_pci_addr(node, FDT_PCI_SPACE_CONFIG, "reg", &pci_addr,
> > > > > > > > > > > > +				   NULL);
> > > > > > > > > > > >  	if (ret < 0) {
> > > > > > > > > > > >  		printf("%s: property \"reg\" is invalid\n", pcie->name);
> > > > > > > > > > > >  		goto err;
> > > > > > > > > > > > diff --git a/drivers/pci/pci_tegra.c b/drivers/pci/pci_tegra.c
> > > > > > > > > > > > index 29d54117e93..ae90bd2fbf1 100644
> > > > > > > > > > > > --- a/drivers/pci/pci_tegra.c
> > > > > > > > > > > > +++ b/drivers/pci/pci_tegra.c
> > > > > > > > > > > > @@ -461,7 +461,7 @@ static int tegra_pcie_parse_port_info(ofnode node, uint *index, uint *lanes)
> > > > > > > > > > > >  
> > > > > > > > > > > >  	*lanes = err;
> > > > > > > > > > > >  
> > > > > > > > > > > > -	err = ofnode_read_pci_addr(node, 0, "reg", &addr);
> > > > > > > > > > > > +	err = ofnode_read_pci_addr(node, 0, "reg", &addr, NULL);
> > > > > > > > > > > >  	if (err < 0) {
> > > > > > > > > > > >  		pr_err("failed to parse \"reg\" property\n");
> > > > > > > > > > > >  		return err;
> > > > > > > > > > > > diff --git a/drivers/pci/pcie_mediatek.c b/drivers/pci/pcie_mediatek.c
> > > > > > > > > > > > index c6e30e24622..e59ebd13ad0 100644
> > > > > > > > > > > > --- a/drivers/pci/pcie_mediatek.c
> > > > > > > > > > > > +++ b/drivers/pci/pcie_mediatek.c
> > > > > > > > > > > > @@ -660,7 +660,7 @@ static int mtk_pcie_probe(struct udevice *dev)
> > > > > > > > > > > >  		if (!ofnode_is_enabled(subnode))
> > > > > > > > > > > >  			continue;
> > > > > > > > > > > >  
> > > > > > > > > > > > -		err = ofnode_read_pci_addr(subnode, 0, "reg", &addr);
> > > > > > > > > > > > +		err = ofnode_read_pci_addr(subnode, 0, "reg", &addr, NULL);
> > > > > > > > > > > >  		if (err)
> > > > > > > > > > > >  			return err;
> > > > > > > > > > > >  
> > > > > > > > > > > > @@ -699,7 +699,7 @@ static int mtk_pcie_probe_v2(struct udevice *dev)
> > > > > > > > > > > >  		if (!ofnode_is_enabled(subnode))
> > > > > > > > > > > >  			continue;
> > > > > > > > > > > >  
> > > > > > > > > > > > -		err = ofnode_read_pci_addr(subnode, 0, "reg", &addr);
> > > > > > > > > > > > +		err = ofnode_read_pci_addr(subnode, 0, "reg", &addr, NULL);
> > > > > > > > > > > >  		if (err)
> > > > > > > > > > > >  			return err;
> > > > > > > > > > > >  
> > > > > > > > > > > > diff --git a/drivers/serial/ns16550.c b/drivers/serial/ns16550.c
> > > > > > > > > > > > index eab9537fbae..a349e5e132a 100644
> > > > > > > > > > > > --- a/drivers/serial/ns16550.c
> > > > > > > > > > > > +++ b/drivers/serial/ns16550.c
> > > > > > > > > > > > @@ -479,6 +479,7 @@ static int ns16550_serial_getinfo(struct udevice *dev,
> > > > > > > > > > > >  	info->addr_space = SERIAL_ADDRESS_SPACE_MEMORY;
> > > > > > > > > > > >  #endif
> > > > > > > > > > > >  	info->addr = plat->base;
> > > > > > > > > > > > +	info->size = plat->size;
> > > > > > > > > > > >  	info->reg_width = plat->reg_width;
> > > > > > > > > > > >  	info->reg_shift = plat->reg_shift;
> > > > > > > > > > > >  	info->reg_offset = plat->reg_offset;
> > > > > > > > > > > > @@ -487,7 +488,8 @@ static int ns16550_serial_getinfo(struct udevice *dev,
> > > > > > > > > > > >  	return 0;
> > > > > > > > > > > >  }
> > > > > > > > > > > >  
> > > > > > > > > > > > -static int ns16550_serial_assign_base(struct ns16550_plat *plat, fdt_addr_t base)
> > > > > > > > > > > > +static int ns16550_serial_assign_base(struct ns16550_plat *plat,
> > > > > > > > > > > > +				      fdt_addr_t base, fdt_size_t size)
> > > > > > > > > > > >  {
> > > > > > > > > > > >  	if (base == FDT_ADDR_T_NONE)
> > > > > > > > > > > >  		return -EINVAL;
> > > > > > > > > > > > @@ -497,6 +499,7 @@ static int ns16550_serial_assign_base(struct ns16550_plat *plat, fdt_addr_t base
> > > > > > > > > > > >  #else
> > > > > > > > > > > >  	plat->base = (unsigned long)map_physmem(base, 0, MAP_NOCACHE);
> > > > > > > > > > > >  #endif
> > > > > > > > > > > > +	plat->size = size;
> > > > > > > > > > > >  
> > > > > > > > > > > >  	return 0;
> > > > > > > > > > > >  }
> > > > > > > > > > > > @@ -507,6 +510,7 @@ int ns16550_serial_probe(struct udevice *dev)
> > > > > > > > > > > >  	struct ns16550 *const com_port = dev_get_priv(dev);
> > > > > > > > > > > >  	struct reset_ctl_bulk reset_bulk;
> > > > > > > > > > > >  	fdt_addr_t addr;
> > > > > > > > > > > > +	fdt_addr_t size;
> > > > > > > > > > > >  	int ret;
> > > > > > > > > > > >  
> > > > > > > > > > > >  	/*
> > > > > > > > > > > > @@ -514,8 +518,8 @@ int ns16550_serial_probe(struct udevice *dev)
> > > > > > > > > > > >  	 * or via a PCI bridge, assign plat->base before probing hardware.
> > > > > > > > > > > >  	 */
> > > > > > > > > > > >  	if (device_is_on_pci_bus(dev)) {
> > > > > > > > > > > > -		addr = devfdt_get_addr_pci(dev);
> > > > > > > > > > > > -		ret = ns16550_serial_assign_base(plat, addr);
> > > > > > > > > > > > +		addr = devfdt_get_addr_pci(dev, &size);
> > > > > > > > > > > > +		ret = ns16550_serial_assign_base(plat, addr, size);
> > > > > > > > > > > >  		if (ret)
> > > > > > > > > > > >  			return ret;
> > > > > > > > > > > >  	}
> > > > > > > > > > > > @@ -543,11 +547,12 @@ int ns16550_serial_of_to_plat(struct udevice *dev)
> > > > > > > > > > > >  	struct ns16550_plat *plat = dev_get_plat(dev);
> > > > > > > > > > > >  	const u32 port_type = dev_get_driver_data(dev);
> > > > > > > > > > > >  	fdt_addr_t addr;
> > > > > > > > > > > > +	fdt_size_t size;
> > > > > > > > > > > >  	struct clk clk;
> > > > > > > > > > > >  	int err;
> > > > > > > > > > > >  
> > > > > > > > > > > > -	addr = dev_read_addr(dev);
> > > > > > > > > > > > -	err = ns16550_serial_assign_base(plat, addr);
> > > > > > > > > > > > +	addr = dev_read_addr_size(dev, &size);
> > > > > > > > > > > > +	err = ns16550_serial_assign_base(plat, addr, size);
> > > > > > > > > > > >  	if (err && !device_is_on_pci_bus(dev))
> > > > > > > > > > > >  		return err;
> > > > > > > > > > > >  
> > > > > > > > > > > > diff --git a/include/dm/fdtaddr.h b/include/dm/fdtaddr.h
> > > > > > > > > > > > index dcdc19137cc..6d2fa8f1044 100644
> > > > > > > > > > > > --- a/include/dm/fdtaddr.h
> > > > > > > > > > > > +++ b/include/dm/fdtaddr.h
> > > > > > > > > > > > @@ -168,8 +168,9 @@ fdt_addr_t devfdt_get_addr_size_name(const struct udevice *dev,
> > > > > > > > > > > >   * devfdt_get_addr_pci() - Read an address and handle PCI address translation
> > > > > > > > > > > >   *
> > > > > > > > > > > >   * @dev: Device to read from
> > > > > > > > > > > > + * @sizep: If non-NULL, returns size of address space
> > > > > > > > > > > >   * Return: address or FDT_ADDR_T_NONE if not found
> > > > > > > > > > > >   */
> > > > > > > > > > > > -fdt_addr_t devfdt_get_addr_pci(const struct udevice *dev);
> > > > > > > > > > > > +fdt_addr_t devfdt_get_addr_pci(const struct udevice *dev, fdt_size_t *sizep);
> > > > > > > > > > > >  
> > > > > > > > > > > >  #endif
> > > > > > > > > > > > diff --git a/include/dm/ofnode.h b/include/dm/ofnode.h
> > > > > > > > > > > > index 726d8f82ddf..97cad971611 100644
> > > > > > > > > > > > --- a/include/dm/ofnode.h
> > > > > > > > > > > > +++ b/include/dm/ofnode.h
> > > > > > > > > > > > @@ -1152,13 +1152,15 @@ const uint8_t *ofnode_read_u8_array_ptr(ofnode node, const char *propname,
> > > > > > > > > > > >   * @type:	pci address type (FDT_PCI_SPACE_xxx)
> > > > > > > > > > > >   * @propname:	name of property to find
> > > > > > > > > > > >   * @addr:	returns pci address in the form of fdt_pci_addr
> > > > > > > > > > > > + * @size:	if non-null, returns register-space size
> > > > > > > > > > > >   * Return:
> > > > > > > > > > > >   * 0 if ok, -ENOENT if the property did not exist, -EINVAL if the
> > > > > > > > > > > >   * format of the property was invalid, -ENXIO if the requested
> > > > > > > > > > > >   * address type was not found
> > > > > > > > > > > >   */
> > > > > > > > > > > >  int ofnode_read_pci_addr(ofnode node, enum fdt_pci_space type,
> > > > > > > > > > > > -			 const char *propname, struct fdt_pci_addr *addr);
> > > > > > > > > > > > +			 const char *propname, struct fdt_pci_addr *addr,
> > > > > > > > > > > > +			 fdt_size_t *size);
> > > > > > > > > > > >  
> > > > > > > > > > > >  /**
> > > > > > > > > > > >   * ofnode_read_pci_vendev() - look up PCI vendor and device id
> > > > > > > > > > > > diff --git a/include/dm/read.h b/include/dm/read.h
> > > > > > > > > > > > index c2615f72f40..3c2eea6f0c4 100644
> > > > > > > > > > > > --- a/include/dm/read.h
> > > > > > > > > > > > +++ b/include/dm/read.h
> > > > > > > > > > > > @@ -346,9 +346,10 @@ void *dev_read_addr_ptr(const struct udevice *dev);
> > > > > > > > > > > >   *    fdtdec_get_addr() and friends.
> > > > > > > > > > > >   *
> > > > > > > > > > > >   * @dev: Device to read from
> > > > > > > > > > > > + * @sizep: If non-NULL, returns size of address space found
> > > > > > > > > > > >   * Return: address or FDT_ADDR_T_NONE if not found
> > > > > > > > > > > >   */
> > > > > > > > > > > > -fdt_addr_t dev_read_addr_pci(const struct udevice *dev);
> > > > > > > > > > > > +fdt_addr_t dev_read_addr_pci(const struct udevice *dev, fdt_size_t *sizep);
> > > > > > > > > > > >  
> > > > > > > > > > > >  /**
> > > > > > > > > > > >   * dev_remap_addr() - Get the reg property of a device as a
> > > > > > > > > > > > @@ -996,9 +997,10 @@ static inline void *dev_read_addr_ptr(const struct udevice *dev)
> > > > > > > > > > > >  	return devfdt_get_addr_ptr(dev);
> > > > > > > > > > > >  }
> > > > > > > > > > > >  
> > > > > > > > > > > > -static inline fdt_addr_t dev_read_addr_pci(const struct udevice *dev)
> > > > > > > > > > > > +static inline fdt_addr_t dev_read_addr_pci(const struct udevice *dev,
> > > > > > > > > > > > +					   fdt_size_t *sizep)
> > > > > > > > > > > >  {
> > > > > > > > > > > > -	return devfdt_get_addr_pci(dev);
> > > > > > > > > > > > +	return devfdt_get_addr_pci(dev, sizep);
> > > > > > > > > > > >  }
> > > > > > > > > > > >  
> > > > > > > > > > > >  static inline void *dev_remap_addr(const struct udevice *dev)
> > > > > > > > > > > > diff --git a/include/ns16550.h b/include/ns16550.h
> > > > > > > > > > > > index e7e68663d03..7f481300083 100644
> > > > > > > > > > > > --- a/include/ns16550.h
> > > > > > > > > > > > +++ b/include/ns16550.h
> > > > > > > > > > > > @@ -58,6 +58,7 @@ enum ns16550_flags {
> > > > > > > > > > > >   * struct ns16550_plat - information about a NS16550 port
> > > > > > > > > > > >   *
> > > > > > > > > > > >   * @base:		Base register address
> > > > > > > > > > > > + * @size:		Size of register area in bytes
> > > > > > > > > > > >   * @reg_width:		IO accesses size of registers (in bytes, 1 or 4)
> > > > > > > > > > > >   * @reg_shift:		Shift size of registers (0=byte, 1=16bit, 2=32bit...)
> > > > > > > > > > > >   * @reg_offset:		Offset to start of registers (normally 0)
> > > > > > > > > > > > @@ -67,7 +68,8 @@ enum ns16550_flags {
> > > > > > > > > > > >   * @bdf:		PCI slot/function (pci_dev_t)
> > > > > > > > > > > >   */
> > > > > > > > > > > >  struct ns16550_plat {
> > > > > > > > > > > > -	unsigned long base;
> > > > > > > > > > > > +	ulong base;
> > > > > > > > > > > > +	ulong size;
> > > > > > > > > > > >  	int reg_width;
> > > > > > > > > > > >  	int reg_shift;
> > > > > > > > > > > >  	int reg_offset;
> > > > > > > > > > > > diff --git a/include/serial.h b/include/serial.h
> > > > > > > > > > > > index 42bdf3759c0..205889d28be 100644
> > > > > > > > > > > > --- a/include/serial.h
> > > > > > > > > > > > +++ b/include/serial.h
> > > > > > > > > > > > @@ -137,6 +137,7 @@ enum adr_space_type {
> > > > > > > > > > > >   * @type:	type of the UART chip
> > > > > > > > > > > >   * @addr_space:	address space to access the registers
> > > > > > > > > > > >   * @addr:	physical address of the registers
> > > > > > > > > > > > + * @size:	size of the register area in bytes
> > > > > > > > > > > >   * @reg_width:	size (in bytes) of the IO accesses to the registers
> > > > > > > > > > > >   * @reg_offset:	offset to apply to the @addr from the start of the registers
> > > > > > > > > > > >   * @reg_shift:	quantity to shift the register offsets by
> > > > > > > > > > > > @@ -147,6 +148,7 @@ struct serial_device_info {
> > > > > > > > > > > >  	enum serial_chip_type type;
> > > > > > > > > > > >  	enum adr_space_type addr_space;
> > > > > > > > > > > >  	ulong addr;
> > > > > > > > > > > > +	ulong size;
> > > > > > > > > > > >  	u8 reg_width;
> > > > > > > > > > > >  	u8 reg_offset;
> > > > > > > > > > > >  	u8 reg_shift;
> > > > > > > > > > > > diff --git a/test/dm/pci.c b/test/dm/pci.c
> > > > > > > > > > > > index 70a736cfdb8..8c5e7da9e62 100644
> > > > > > > > > > > > --- a/test/dm/pci.c
> > > > > > > > > > > > +++ b/test/dm/pci.c
> > > > > > > > > > > > @@ -301,10 +301,12 @@ static int dm_test_pci_addr_flat(struct unit_test_state *uts)
> > > > > > > > > > > >  {
> > > > > > > > > > > >  	struct udevice *swap1f, *swap1;
> > > > > > > > > > > >  	ulong io_addr, mem_addr;
> > > > > > > > > > > > +	fdt_addr_t size;
> > > > > > > > > > > >  
> > > > > > > > > > > >  	ut_assertok(dm_pci_bus_find_bdf(PCI_BDF(0, 0x1f, 0), &swap1f));
> > > > > > > > > > > >  	io_addr = dm_pci_read_bar32(swap1f, 0);
> > > > > > > > > > > > -	ut_asserteq(io_addr, dev_read_addr_pci(swap1f));
> > > > > > > > > > > > +	ut_asserteq(io_addr, dev_read_addr_pci(swap1f, &size));
> > > > > > > > > > > > +	ut_asserteq(0, size);
> > > > > > > > > > > >  
> > > > > > > > > > > >  	/*
> > > > > > > > > > > >  	 * This device has both I/O and MEM spaces but the MEM space appears
> > > > > > > > > > > > @@ -312,7 +314,8 @@ static int dm_test_pci_addr_flat(struct unit_test_state *uts)
> > > > > > > > > > > >  	 */
> > > > > > > > > > > >  	ut_assertok(dm_pci_bus_find_bdf(PCI_BDF(0, 0x1, 0), &swap1));
> > > > > > > > > > > >  	mem_addr = dm_pci_read_bar32(swap1, 1);
> > > > > > > > > > > > -	ut_asserteq(mem_addr, dev_read_addr_pci(swap1));
> > > > > > > > > > > > +	ut_asserteq(mem_addr, dev_read_addr_pci(swap1, &size));
> > > > > > > > > > > > +	ut_asserteq(0, size);
> > > > > > > > > > > >  
> > > > > > > > > > > >  	return 0;
> > > > > > > > > > > >  }
> > > > > > > > > > > > @@ -329,12 +332,15 @@ DM_TEST(dm_test_pci_addr_flat, UT_TESTF_SCAN_PDATA | UT_TESTF_SCAN_FDT |
> > > > > > > > > > > >  static int dm_test_pci_addr_live(struct unit_test_state *uts)
> > > > > > > > > > > >  {
> > > > > > > > > > > >  	struct udevice *swap1f, *swap1;
> > > > > > > > > > > > +	fdt_size_t size;
> > > > > > > > > > > >  
> > > > > > > > > > > >  	ut_assertok(dm_pci_bus_find_bdf(PCI_BDF(0, 0x1f, 0), &swap1f));
> > > > > > > > > > > > -	ut_asserteq_64(FDT_ADDR_T_NONE, dev_read_addr_pci(swap1f));
> > > > > > > > > > > > +	ut_asserteq_64(FDT_ADDR_T_NONE, dev_read_addr_pci(swap1f, &size));
> > > > > > > > > > > > +	ut_asserteq(0, size);
> > > > > > > > > > > >  
> > > > > > > > > > > >  	ut_assertok(dm_pci_bus_find_bdf(PCI_BDF(0, 0x1, 0), &swap1));
> > > > > > > > > > > > -	ut_asserteq_64(FDT_ADDR_T_NONE, dev_read_addr_pci(swap1));
> > > > > > > > > > > > +	ut_asserteq_64(FDT_ADDR_T_NONE, dev_read_addr_pci(swap1, &size));
> > > > > > > > > > > > +	ut_asserteq(0, size);
> > > > > > > > > > > >  
> > > > > > > > > > > >  	return 0;
> > > > > > > > > > > >  }
> > > > > > > > > > > > -- 
> > > > > > > > > > > > 2.42.0.rc2.253.gd59a3bf2b4-goog
> > > > > > > > > > > > 
> > > > > > > > > > 
> > > > > > > > > > -- 
> > > > > > > > > > Tom
> > > > > > > > > 
> > > > > > > > > 
> > > > > > > > 
> > > > > > > > -- 
> > > > > > > > Tom
> > > > > > > 
> > > > > > > 
> > > > > > 
> > > > > > -- 
> > > > > > Tom
> > > > > 
> > > > > 
> > > 
> > > -- 
> > > Tom
> > 
> > 
> 
> -- 
> Tom



^ permalink raw reply	[flat|nested] 86+ messages in thread

* Re: [PATCH 04/32] spl: Avoid #ifdef with CONFIG_SPL_SYS_MALLOC
  2023-08-30 18:04 ` [PATCH 04/32] spl: Avoid #ifdef with CONFIG_SPL_SYS_MALLOC Simon Glass
@ 2023-08-30 21:32   ` Tom Rini
  0 siblings, 0 replies; 86+ messages in thread
From: Tom Rini @ 2023-08-30 21:32 UTC (permalink / raw)
  To: Simon Glass
  Cc: U-Boot Mailing List, Marek Vasut, Nathan Barrett-Morrison, Nikhil M Jain

[-- Attachment #1: Type: text/plain, Size: 1852 bytes --]

On Wed, Aug 30, 2023 at 12:04:35PM -0600, Simon Glass wrote:

> Use IF_ENABLED_INT() to avoid needing to use the preprocessor.
> 
> Signed-off-by: Simon Glass <sjg@chromium.org>
> ---
> 
>  common/spl/spl.c           | 12 ++++++++----
>  include/system-constants.h |  5 ++++-
>  2 files changed, 12 insertions(+), 5 deletions(-)
> 
> diff --git a/common/spl/spl.c b/common/spl/spl.c
> index 27266b393ea..78db9ef5318 100644
> --- a/common/spl/spl.c
> +++ b/common/spl/spl.c
> @@ -754,10 +754,14 @@ void board_init_r(gd_t *dummy1, ulong dummy2)
>  
>  	spl_set_bd();
>  
> -#if defined(CONFIG_SPL_SYS_MALLOC)
> -	mem_malloc_init(SPL_SYS_MALLOC_START, CONFIG_SPL_SYS_MALLOC_SIZE);
> -	gd->flags |= GD_FLG_FULL_MALLOC_INIT;
> -#endif
> +	if (IS_ENABLED(CONFIG_SPL_SYS_MALLOC)) {
> +		ulong size;
> +
> +		size = IF_ENABLED_INT(CONFIG_SPL_SYS_MALLOC,
> +				      CONFIG_SPL_SYS_MALLOC_SIZE);
> +		mem_malloc_init(SPL_SYS_MALLOC_START, size);
> +		gd->flags |= GD_FLG_FULL_MALLOC_INIT;
> +	}
>  	if (!(gd->flags & GD_FLG_SPL_INIT)) {
>  		if (spl_init())
>  			hang();
> diff --git a/include/system-constants.h b/include/system-constants.h
> index f0a191be590..aa02c48f49d 100644
> --- a/include/system-constants.h
> +++ b/include/system-constants.h
> @@ -24,9 +24,12 @@
>   */
>  #ifdef CONFIG_SPL_HAS_CUSTOM_MALLOC_START
>  #define SPL_SYS_MALLOC_START		CONFIG_SPL_CUSTOM_SYS_MALLOC_ADDR
> -#else
> +#elif defined(CONFIG_SPL_BSS_START_ADDR)
>  #define SPL_SYS_MALLOC_START		(CONFIG_SPL_BSS_START_ADDR + \
>  					 CONFIG_SPL_BSS_MAX_SIZE)
> +#else
> +/* feature not enabled: this value avoids compiler errors but is not used */
> +#define SPL_SYS_MALLOC_START	0
>  #endif
>  
>  #endif

Does this become relevant later?  It decreases, rather than increases
readability of the code to me.

-- 
Tom

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 659 bytes --]

^ permalink raw reply	[flat|nested] 86+ messages in thread

* Re: [PATCH 07/32] spl: Avoid #ifdef with CONFIG_SPL_SYS_ARGS_ADDR
  2023-08-30 18:04 ` [PATCH 07/32] spl: Avoid #ifdef with CONFIG_SPL_SYS_ARGS_ADDR Simon Glass
@ 2023-08-30 21:34   ` Tom Rini
  0 siblings, 0 replies; 86+ messages in thread
From: Tom Rini @ 2023-08-30 21:34 UTC (permalink / raw)
  To: Simon Glass
  Cc: U-Boot Mailing List, Marek Vasut, Andre Przywara,
	Leo Yu-Chi Liang, Mayuresh Chitale, Nathan Barrett-Morrison,
	Nikhil M Jain, Oleksandr Suvorov, Roger Quadros

[-- Attachment #1: Type: text/plain, Size: 2238 bytes --]

On Wed, Aug 30, 2023 at 12:04:38PM -0600, Simon Glass wrote:
> Use IF_ENABLED_INT() to avoid needing to use the preprocessor. Give the
> Kconfig option a default since we try to avoid hex values without
> defaults.
> 
> Signed-off-by: Simon Glass <sjg@chromium.org>
> ---
> 
>  common/spl/Kconfig |  1 +
>  common/spl/spl.c   | 18 ++++++++++++++----
>  2 files changed, 15 insertions(+), 4 deletions(-)
> 
> diff --git a/common/spl/Kconfig b/common/spl/Kconfig
> index c23a1f7750b..e863aac2b34 100644
> --- a/common/spl/Kconfig
> +++ b/common/spl/Kconfig
> @@ -1067,6 +1067,7 @@ config SPL_SYS_ARGS_ADDR
>  	hex "Address in memory to load 'args' file for Falcon Mode to"
>  	depends on SPL_OS_BOOT
>  	default 0x88000000 if ARCH_OMAP2PLUS
> +	default 0

No, we don't do this.  We do not put fake address defaults on questions
that must be answered.  Further, default 0 on a hex is wrong.

> diff --git a/common/spl/spl.c b/common/spl/spl.c
> index 77fe4cdb053..2da5bc0c4f5 100644
> --- a/common/spl/spl.c
> +++ b/common/spl/spl.c
> @@ -814,9 +814,11 @@ void board_init_r(gd_t *dummy1, ulong dummy2)
>  	}
>  
>  	memset(&spl_image, '\0', sizeof(spl_image));
> -#ifdef CONFIG_SPL_SYS_ARGS_ADDR
> -	spl_image.arg = (void *)CONFIG_SPL_SYS_ARGS_ADDR;
> -#endif
> +	if (IS_ENABLED(CONFIG_SPL_SYS_ARGS_ADDR)) {
> +		spl_image.arg =
> +			map_sysmem(IF_ENABLED_INT(CONFIG_SPL_OS_BOOT,
> +						  CONFIG_SPL_SYS_ARGS_ADDR), 0);
> +	}
>  	spl_image.boot_device = BOOT_DEVICE_NONE;
>  	board_boot_order(spl_boot_list);
>  
> @@ -873,8 +875,16 @@ void board_init_r(gd_t *dummy1, ulong dummy2)
>  #if CONFIG_IS_ENABLED(OS_BOOT)
>  	case IH_OS_LINUX:
>  		debug("Jumping to Linux\n");
> +		if (IS_ENABLED(CONFIG_SPL_SYS_ARGS_ADDR)) {
> +			ulong addr;
> +
> +			addr = IF_ENABLED_INT(CONFIG_SPL_OS_BOOT,
> +					      CONFIG_SPL_SYS_ARGS_ADDR);
> +			spl_fixup_fdt(map_sysmem(addr, 0));
> +		}
> +	}
> +
>  #if defined(CONFIG_SPL_SYS_ARGS_ADDR)
> -		spl_fixup_fdt((void *)CONFIG_SPL_SYS_ARGS_ADDR);
>  #endif
>  		spl_board_prepare_for_linux();
>  		jump_to_image_linux(&spl_image);

This is also not more readable.  The CONFIG option is oddly named, and
this doesn't help.

-- 
Tom

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 659 bytes --]

^ permalink raw reply	[flat|nested] 86+ messages in thread

* Re: [PATCH 03/32] spl: Rename SYS_SPL_ARGS_ADDR to SPL_SYS_ARGS_ADDR
  2023-08-30 18:04 ` [PATCH 03/32] spl: Rename SYS_SPL_ARGS_ADDR to SPL_SYS_ARGS_ADDR Simon Glass
@ 2023-08-30 21:37   ` Tom Rini
  0 siblings, 0 replies; 86+ messages in thread
From: Tom Rini @ 2023-08-30 21:37 UTC (permalink / raw)
  To: Simon Glass
  Cc: U-Boot Mailing List, Marek Vasut, Adam Ford, Andre Przywara,
	Elena Popa, Enric Balletbo i Serra, Eric Bénard,
	Heinrich Schuchardt, Ilias Apalodimas, Jagan Teki,
	Leo Yu-Chi Liang, Lukasz Majewski, Mario Kicherer,
	Mayuresh Chitale, Michal Simek, Mingkai Hu,
	Nathan Barrett-Morrison, Nikhil M Jain, Oleksandr Suvorov,
	Patrice Chotard, Raffaele RECALCATI, Roger Quadros,
	Simone CIANNI, Stefan Roese, Thomas Weber, Tim Harvey,
	Tom McLeod, Vikas Manocha, uboot-stm32

[-- Attachment #1: Type: text/plain, Size: 955 bytes --]

On Wed, Aug 30, 2023 at 12:04:34PM -0600, Simon Glass wrote:

> Rename this so that SPL is first, as per U-Boot convention.
> 
> Signed-off-by: Simon Glass <sjg@chromium.org>
[snip]
> diff --git a/doc/develop/falcon.rst b/doc/develop/falcon.rst
> index a569d1a2951..fbf8c10e47e 100644
> --- a/doc/develop/falcon.rst
> +++ b/doc/develop/falcon.rst
> @@ -63,7 +63,7 @@ CONFIG_CMD_SPL
>      Enable the "spl export" command.
>      The command "spl export" is then available in U-Boot mode.
>  
> -CONFIG_SYS_SPL_ARGS_ADDR
> +CONFIG_SPL_SYS_ARGS_ADDR
>      Address in RAM where the parameters must be copied by SPL.
>      In most cases, it is <start_of_ram> + 0x100.

This was intentionally "CONFIG_SYS_SPL_ARGS_ADDR" and not the other way
around, for semi-dubious reasons.  We should instead try and give this
perhaps a better name to describe that it is where in memory the
parameters for our payload have been stored.

-- 
Tom

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 659 bytes --]

^ permalink raw reply	[flat|nested] 86+ messages in thread

* Re: [PATCH 09/32] spl: Avoid an #ifdef when printing gd->malloc_ptr
  2023-08-30 18:04 ` [PATCH 09/32] spl: Avoid an #ifdef when printing gd->malloc_ptr Simon Glass
@ 2023-08-30 21:39   ` Tom Rini
  2023-09-21  1:03     ` Simon Glass
  0 siblings, 1 reply; 86+ messages in thread
From: Tom Rini @ 2023-08-30 21:39 UTC (permalink / raw)
  To: Simon Glass
  Cc: U-Boot Mailing List, Marek Vasut, Bin Meng, Heinrich Schuchardt,
	Nathan Barrett-Morrison, Nikhil M Jain, Rasmus Villemoes,
	Stefan Roese

[-- Attachment #1: Type: text/plain, Size: 2061 bytes --]

On Wed, Aug 30, 2023 at 12:04:40PM -0600, Simon Glass wrote:
> Use an accessor in the header file to avoid this.
> 
> Signed-off-by: Simon Glass <sjg@chromium.org>
> ---
> 
>  common/spl/spl.c                  | 9 +++++----
>  include/asm-generic/global_data.h | 7 +++++++
>  2 files changed, 12 insertions(+), 4 deletions(-)
> 
> diff --git a/common/spl/spl.c b/common/spl/spl.c
> index f0a90c280da..f5cef81000c 100644
> --- a/common/spl/spl.c
> +++ b/common/spl/spl.c
> @@ -876,10 +876,11 @@ void board_init_r(gd_t *dummy1, ulong dummy2)
>  	} else {
>  		debug("Unsupported OS image.. Jumping nevertheless..\n");
>  	}
> -#if CONFIG_VAL(SYS_MALLOC_F_LEN) && !defined(CONFIG_SPL_SYS_MALLOC_SIZE)
> -	debug("SPL malloc() used 0x%lx bytes (%ld KB)\n", gd->malloc_ptr,
> -	      gd->malloc_ptr / 1024);
> -#endif
> +	if (IS_ENABLED(CONFIG_SYS_MALLOC_F) &&
> +	    !IS_ENABLED(CONFIG_SPL_SYS_MALLOC_SIZE))
> +		debug("SPL malloc() used 0x%lx bytes (%ld KB)\n",
> +		      gd_malloc_ptr(), gd_malloc_ptr() / 1024);
> +
>  	bootstage_mark_name(get_bootstage_id(false), "end phase");
>  #ifdef CONFIG_BOOTSTAGE_STASH
>  	ret = bootstage_stash((void *)CONFIG_BOOTSTAGE_STASH_ADDR,
> diff --git a/include/asm-generic/global_data.h b/include/asm-generic/global_data.h
> index 8fc205ded1a..edf9ff6823f 100644
> --- a/include/asm-generic/global_data.h
> +++ b/include/asm-generic/global_data.h
> @@ -573,6 +573,13 @@ static_assert(sizeof(struct global_data) == GD_SIZE);
>  #define gd_malloc_start()	0
>  #define gd_set_malloc_start(val)
>  #endif
> +
> +#if CONFIG_VAL(SYS_MALLOC_F_LEN)
> +#define gd_malloc_ptr()		gd->malloc_ptr
> +#else
> +#define gd_malloc_ptr()		0L
> +#endif
> +
>  /**
>   * enum gd_flags - global data flags
>   *

This is another case where readability is not improved. I also have a
bad feeling that changing that exact area had some unintended
consequences from the compiler, that totally should not have happened.
But maybe that was something in a similar code section instead.

-- 
Tom

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 659 bytes --]

^ permalink raw reply	[flat|nested] 86+ messages in thread

* Re: [PATCH 32/32] pci: serial: Support reading PCI-register size with base
  2023-08-30 21:29                         ` Pali Rohár
@ 2023-08-30 21:42                           ` Tom Rini
  2023-09-03 20:36                             ` Pali Rohár
  0 siblings, 1 reply; 86+ messages in thread
From: Tom Rini @ 2023-08-30 21:42 UTC (permalink / raw)
  To: Pali Rohár; +Cc: U-Boot Mailing List

[-- Attachment #1: Type: text/plain, Size: 2213 bytes --]

On Wed, Aug 30, 2023 at 11:29:34PM +0200, Pali Rohár wrote:

> There were no answers.
> 
> On Wednesday 30 August 2023 17:26:20 Tom Rini wrote:
> > I'm trimming the CC list. All of those points you list were addressed
> > and answered in your last long running argument. You need to decide what
> > is best for you moving forward and I would ask that it not involve
> > complaining that you're being asked to review code that you're a listed
> > maintainer of.
> > 
> > On Wed, Aug 30, 2023 at 11:13:16PM +0200, Pali Rohár wrote:
> > > Seems that you completely miss the point of the argument, then the only
> > > option for such people is to repeat them. Or have I repeat you again
> > > that you have not answered the first question, why you are asking for
> > > review from somebody who you are ignoring and not taking into account?
> > > You do not want to answer this question, right? So you rather change a
> > > topic and talking about something totally different.
> > > 
> > > On Wednesday 30 August 2023 17:08:42 Tom Rini wrote:
> > > > I don't think it's worth re-hashing the same arguments over and over.
> > > > There is no "my persons", there is the public community.  If you no
> > > > longer wish to participate, I can remove you from the maintainers
> > > > entries you're listed in.  But please stop with the long arguments
> > > > unrelated to the patches at hand when there's a dozen people and other
> > > > lists on CC.
> > > > 
> > > > On Wed, Aug 30, 2023 at 10:51:45PM +0200, Pali Rohár wrote:
> > > > > So lets recap what you and your persons have done in last 6 months:
> > > > > 
> > > > > * Ignored my changes
> > > > > * Ignored my reviews
> > > > > * Ignored my reminders

Not ignored, changes requested and refused.  Compromises refused.
Apologies from others who had said they would pick up the platform and
push it, but did not have time ignored.

> > > > > * Ignored my regression reports

Not ignored, debugged, problems with your platform implementation
reported and questions asked, patches provided to help you debug the
problem on the single place that seems to show a problem which no one
else can reproduce ignored.

-- 
Tom

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 659 bytes --]

^ permalink raw reply	[flat|nested] 86+ messages in thread

* Re: [PATCH 30/32] fdt: Allow the devicetree to come from a bloblist
  2023-08-30 18:05 ` [PATCH 30/32] fdt: Allow the devicetree to come from a bloblist Simon Glass
@ 2023-08-31  7:06   ` Ilias Apalodimas
  2023-08-31 19:02     ` Simon Glass
  0 siblings, 1 reply; 86+ messages in thread
From: Ilias Apalodimas @ 2023-08-31  7:06 UTC (permalink / raw)
  To: Simon Glass
  Cc: U-Boot Mailing List, Tom Rini, Marek Vasut, Baruch Siach,
	Bin Meng, Heinrich Schuchardt, Jerry Van Baren, Michal Simek,
	Nikhil M Jain, Qu Wenruo, Stefan Roese

Hi Simon,

On Wed, Aug 30, 2023 at 12:05:01PM -0600, Simon Glass wrote:
> Standard passage provides for a bloblist to be passed from one firmware
> phase to the next. That can be used to pass the devicetree along as well.
> Add an option to support this.
> 
> Tests for this will be added as part of the Universal Payload work.
> 
> Signed-off-by: Simon Glass <sjg@chromium.org>
> ---
> 
>  common/bloblist.c                  |  2 ++
>  doc/develop/devicetree/control.rst |  3 ++
>  dts/Kconfig                        |  8 ++++++
>  include/bloblist.h                 |  5 ++++
>  include/fdtdec.h                   |  3 +-
>  lib/fdtdec.c                       | 44 ++++++++++++++++++++++--------
>  6 files changed, 52 insertions(+), 13 deletions(-)
> 
> diff --git a/common/bloblist.c b/common/bloblist.c
> index 6f2a4577708..b07ede11cfe 100644
> --- a/common/bloblist.c
> +++ b/common/bloblist.c
> @@ -48,9 +48,11 @@ static struct tag_name {
>  	{ BLOBLISTT_ACPI_TABLES, "ACPI tables for x86" },
>  	{ BLOBLISTT_SMBIOS_TABLES, "SMBIOS tables for x86" },
>  	{ BLOBLISTT_VBOOT_CTX, "Chrome OS vboot context" },
> +	{ BLOBLISTT_CONTROL_FDT, "Control FDT" },
>  
>  	/* BLOBLISTT_PROJECT_AREA */
>  	{ BLOBLISTT_U_BOOT_SPL_HANDOFF, "SPL hand-off" },
> +	{ BLOBLISTT_VBE, "VBE" },
>  	{ BLOBLISTT_U_BOOT_VIDEO, "SPL video handoff" },
>  
>  	/* BLOBLISTT_VENDOR_AREA */
> diff --git a/doc/develop/devicetree/control.rst b/doc/develop/devicetree/control.rst
> index cbb65c9b177..56e00090166 100644
> --- a/doc/develop/devicetree/control.rst
> +++ b/doc/develop/devicetree/control.rst
> @@ -108,6 +108,9 @@ If CONFIG_OF_BOARD is defined, a board-specific routine will provide the
>  devicetree at runtime, for example if an earlier bootloader stage creates
>  it and passes it to U-Boot.
>  
> +If CONFIG_OF_BLOBLIST is defined, the devicetree comes from a bloblist passed
> +from a previous stage.
> +

Is this bloblist in the format described in the firmware handoff [0] ?

> +config OF_BLOBLIST
> +	bool "DTB is provided by a bloblist"
> +	help
> +	  Select this to read the devicetree from the bloblist. This allows
> +	  using a bloblist to transfer the devicetree between  U-Boot phases.
> +	  The devicetree is stored in the bloblist by an early phase so that
> +	  U-Boot can read it.
> +

I dont think this is a good idea.  We used to have 4-5 different options
here, which we tried to clean up and ended up with two very discrete
options.  Why do we have to reintroduce a new one?  Doesn't that bloblist
have a header of some sort?  The bloblist literally comes from a previous
stage bootloader which is what OF_BOARD is here for. So why can't we just
read the header and figure out if the magic of the bloblist matches?

>  config OF_BOARD
>  	bool "Provided by the board (e.g a previous loader) at runtime"
>  	default y if SANDBOX || OF_HAS_PRIOR_STAGE
> diff --git a/include/bloblist.h b/include/bloblist.h
> index 080cc46a126..e16d122f4fb 100644
> --- a/include/bloblist.h
> +++ b/include/bloblist.h
> @@ -103,6 +103,11 @@ enum bloblist_tag_t {
>  	BLOBLISTT_ACPI_TABLES = 0x104,	/* ACPI tables for x86 */
>  	BLOBLISTT_SMBIOS_TABLES = 0x105, /* SMBIOS tables for x86 */
>  	BLOBLISTT_VBOOT_CTX = 0x106,	/* Chromium OS verified boot context */
> +	/*

[...]

> 
[0] https://github.com/FirmwareHandoff/firmware_handoff

Thanks
/Ilias

^ permalink raw reply	[flat|nested] 86+ messages in thread

* Re: [PATCH 02/32] spl: Use CONFIG_SPL... instead of CONFIG_..._SPL_...
  2023-08-30 18:04 ` [PATCH 02/32] spl: Use CONFIG_SPL... instead of CONFIG_..._SPL_ Simon Glass
@ 2023-08-31  7:37   ` Marcel Ziswiler
  2023-08-31  8:42   ` Martyn Welch
  2023-08-31  9:22   ` Svyatoslav Ryhel
  2 siblings, 0 replies; 86+ messages in thread
From: Marcel Ziswiler @ 2023-08-31  7:37 UTC (permalink / raw)
  To: sjg, u-boot
  Cc: clamor95, green.wan, elly.siew.chin.lim, peng.fan, pan, agust,
	matthias.winker, trini, Gireesh.Hiremath, afd, marex,
	martyn.welch, alban.bedel, michal.simek, navin, mchitale,
	wasim.khan, udit.agarwal, open-source, breno.lima, matteo.lisi,
	d-gerlach, dinguyen, le.jin, a-govindraju, patrick, xypron.glpk,
	sr, michael, lusus

Hi Simon

For the Toradex Apalis, Colibri and Verdin SoMs.

On Wed, 2023-08-30 at 12:04 -0600, Simon Glass wrote:
> We like to put the SPL first so it is clear that it relates to SPL. Rename
> various malloc-related options which have crept in, to stick to this
> convention.
> 
> Signed-off-by: Simon Glass <sjg@chromium.org>

Reviewed-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>

[snip]

Cheers

Marcel

^ permalink raw reply	[flat|nested] 86+ messages in thread

* Re: [PATCH 02/32] spl: Use CONFIG_SPL... instead of CONFIG_..._SPL_...
  2023-08-30 18:04 ` [PATCH 02/32] spl: Use CONFIG_SPL... instead of CONFIG_..._SPL_ Simon Glass
  2023-08-31  7:37   ` Marcel Ziswiler
@ 2023-08-31  8:42   ` Martyn Welch
  2023-08-31  9:22   ` Svyatoslav Ryhel
  2 siblings, 0 replies; 86+ messages in thread
From: Martyn Welch @ 2023-08-31  8:42 UTC (permalink / raw)
  To: Simon Glass, U-Boot Mailing List
  Cc: Tom Rini, Marek Vasut, Alban Bedel, Anatolij Gustschin,
	Andrew F. Davis, Aswath Govindraju, Breno Lima, Dave Gerlach,
	Dinh Nguyen, Green Wan, Heinrich Schuchardt, Hiremath Gireesh,
	Le Jin, Marcel Ziswiler, Matteo Lisi, Matthias Winker,
	Mayuresh Chitale, Michael Walle, Michal Simek,
	Navin Sankar Velliangiri, Niel Fourie, Patrick Wildt,
	Paweł Anikiel, Peng Fan, Siew Chin Lim, Silvio Fricke,
	Stefan Roese, Svyatoslav Ryhel, Udit Agarwal, Wasim Khan

Hi,

On 30/08/2023 19:04, Simon Glass wrote:
> We like to put the SPL first so it is clear that it relates to SPL. Rename
> various malloc-related options which have crept in, to stick to this
> convention.
>
> Signed-off-by: Simon Glass<sjg@chromium.org>

For the common changes and `configs/am335x_guardian_defconfig`:

Reviewed-by: Martyn Welch <martyn.welch@collabora.com>


Martyn


^ permalink raw reply	[flat|nested] 86+ messages in thread

* Re: [PATCH 02/32] spl: Use CONFIG_SPL... instead of CONFIG_..._SPL_...
  2023-08-30 18:04 ` [PATCH 02/32] spl: Use CONFIG_SPL... instead of CONFIG_..._SPL_ Simon Glass
  2023-08-31  7:37   ` Marcel Ziswiler
  2023-08-31  8:42   ` Martyn Welch
@ 2023-08-31  9:22   ` Svyatoslav Ryhel
  2 siblings, 0 replies; 86+ messages in thread
From: Svyatoslav Ryhel @ 2023-08-31  9:22 UTC (permalink / raw)
  To: Simon Glass
  Cc: U-Boot Mailing List, Tom Rini, Marek Vasut, Alban Bedel,
	Anatolij Gustschin, Andrew F. Davis, Aswath Govindraju,
	Breno Lima, Dave Gerlach, Dinh Nguyen, Green Wan,
	Heinrich Schuchardt, Hiremath Gireesh, Le Jin, Marcel Ziswiler,
	Martyn Welch, Matteo Lisi, Matthias Winker, Mayuresh Chitale,
	Michael Walle, Michal Simek, Navin Sankar Velliangiri,
	Niel Fourie, Patrick Wildt, Paweł Anikiel, Peng Fan,
	Siew Chin Lim, Silvio Fricke, Stefan Roese, Udit Agarwal,
	Wasim Khan

Greetings!

ср, 30 серп. 2023 р. о 21:05 Simon Glass <sjg@chromium.org> пише:
>
> We like to put the SPL first so it is clear that it relates to SPL. Rename
> various malloc-related options which have crept in, to stick to this
> convention.
>
> Signed-off-by: Simon Glass <sjg@chromium.org>

For the Tegra30 Transformers, Grouper, X3 and Endeavoru.

Reviewed-by: Svyatoslav Ryhel <clamor95@gmail.com>

^ permalink raw reply	[flat|nested] 86+ messages in thread

* Re: [PATCH 05/32] spl: mx6: powerpc: Drop the condition on timer_init()
  2023-08-30 18:04 ` [PATCH 05/32] spl: mx6: powerpc: Drop the condition on timer_init() Simon Glass
@ 2023-08-31 17:50   ` Tom Rini
  2023-09-21  1:03     ` Simon Glass
  0 siblings, 1 reply; 86+ messages in thread
From: Tom Rini @ 2023-08-31 17:50 UTC (permalink / raw)
  To: Simon Glass
  Cc: U-Boot Mailing List, Marek Vasut, Andy Fleming, Mario Six,
	Nathan Barrett-Morrison, Nikhil M Jain, Priyanka Jain,
	Stefan Roese, Wolfgang Denk

[-- Attachment #1: Type: text/plain, Size: 1033 bytes --]

On Wed, Aug 30, 2023 at 12:04:36PM -0600, Simon Glass wrote:

> It doesn't make sense to have some boards do this differently. Drop the
> condition in the hope that the maintainers can figure out any run-time
> problems.
> 
> Signed-off-by: Simon Glass <sjg@chromium.org>
> ---
> 
>  common/spl/spl.c | 6 ------
>  1 file changed, 6 deletions(-)
> 
> diff --git a/common/spl/spl.c b/common/spl/spl.c
> index 78db9ef5318..3f513b0563a 100644
> --- a/common/spl/spl.c
> +++ b/common/spl/spl.c
> @@ -766,13 +766,7 @@ void board_init_r(gd_t *dummy1, ulong dummy2)
>  		if (spl_init())
>  			hang();
>  	}
> -#if !defined(CONFIG_PPC) && !defined(CONFIG_ARCH_MX6)
> -	/*
> -	 * timer_init() does not exist on PPC systems. The timer is initialized
> -	 * and enabled (decrementer) in interrupt_init() here.
> -	 */
>  	timer_init();
> -#endif

PowerPC might be a little tricky, did qemu-ppce500 run?  And please
reach out to some of the iMX folks instead of just dropping this and
hoping it works.

-- 
Tom

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 659 bytes --]

^ permalink raw reply	[flat|nested] 86+ messages in thread

* Re: [PATCH 30/32] fdt: Allow the devicetree to come from a bloblist
  2023-08-31  7:06   ` Ilias Apalodimas
@ 2023-08-31 19:02     ` Simon Glass
  2023-09-01  7:49       ` Ilias Apalodimas
  0 siblings, 1 reply; 86+ messages in thread
From: Simon Glass @ 2023-08-31 19:02 UTC (permalink / raw)
  To: Ilias Apalodimas
  Cc: U-Boot Mailing List, Tom Rini, Marek Vasut, Baruch Siach,
	Bin Meng, Heinrich Schuchardt, Jerry Van Baren, Michal Simek,
	Nikhil M Jain, Qu Wenruo, Stefan Roese

Hi Ilias,

On Thu, 31 Aug 2023 at 01:06, Ilias Apalodimas
<ilias.apalodimas@linaro.org> wrote:
>
> Hi Simon,
>
> On Wed, Aug 30, 2023 at 12:05:01PM -0600, Simon Glass wrote:
> > Standard passage provides for a bloblist to be passed from one firmware
> > phase to the next. That can be used to pass the devicetree along as well.
> > Add an option to support this.
> >
> > Tests for this will be added as part of the Universal Payload work.
> >
> > Signed-off-by: Simon Glass <sjg@chromium.org>
> > ---
> >
> >  common/bloblist.c                  |  2 ++
> >  doc/develop/devicetree/control.rst |  3 ++
> >  dts/Kconfig                        |  8 ++++++
> >  include/bloblist.h                 |  5 ++++
> >  include/fdtdec.h                   |  3 +-
> >  lib/fdtdec.c                       | 44 ++++++++++++++++++++++--------
> >  6 files changed, 52 insertions(+), 13 deletions(-)
> >
> > diff --git a/common/bloblist.c b/common/bloblist.c
> > index 6f2a4577708..b07ede11cfe 100644
> > --- a/common/bloblist.c
> > +++ b/common/bloblist.c
> > @@ -48,9 +48,11 @@ static struct tag_name {
> >       { BLOBLISTT_ACPI_TABLES, "ACPI tables for x86" },
> >       { BLOBLISTT_SMBIOS_TABLES, "SMBIOS tables for x86" },
> >       { BLOBLISTT_VBOOT_CTX, "Chrome OS vboot context" },
> > +     { BLOBLISTT_CONTROL_FDT, "Control FDT" },
> >
> >       /* BLOBLISTT_PROJECT_AREA */
> >       { BLOBLISTT_U_BOOT_SPL_HANDOFF, "SPL hand-off" },
> > +     { BLOBLISTT_VBE, "VBE" },
> >       { BLOBLISTT_U_BOOT_VIDEO, "SPL video handoff" },
> >
> >       /* BLOBLISTT_VENDOR_AREA */
> > diff --git a/doc/develop/devicetree/control.rst b/doc/develop/devicetree/control.rst
> > index cbb65c9b177..56e00090166 100644
> > --- a/doc/develop/devicetree/control.rst
> > +++ b/doc/develop/devicetree/control.rst
> > @@ -108,6 +108,9 @@ If CONFIG_OF_BOARD is defined, a board-specific routine will provide the
> >  devicetree at runtime, for example if an earlier bootloader stage creates
> >  it and passes it to U-Boot.
> >
> > +If CONFIG_OF_BLOBLIST is defined, the devicetree comes from a bloblist passed
> > +from a previous stage.
> > +
>
> Is this bloblist in the format described in the firmware handoff [0] ?

Yes

>
> > +config OF_BLOBLIST
> > +     bool "DTB is provided by a bloblist"
> > +     help
> > +       Select this to read the devicetree from the bloblist. This allows
> > +       using a bloblist to transfer the devicetree between  U-Boot phases.
> > +       The devicetree is stored in the bloblist by an early phase so that
> > +       U-Boot can read it.
> > +
>
> I dont think this is a good idea.  We used to have 4-5 different options
> here, which we tried to clean up and ended up with two very discrete
> options.  Why do we have to reintroduce a new one?  Doesn't that bloblist
> have a header of some sort?  The bloblist literally comes from a previous
> stage bootloader which is what OF_BOARD is here for. So why can't we just
> read the header and figure out if the magic of the bloblist matches?

No, OF_BOARD is a hack to allow boards to do what they like with the FDT.

This patch is a standard mechanism to pass the DT from one firmware
phase to the next. We have spent quite a bit of time creating a spec
for it, and we should use it.

The patches to align bloblist with the spec have been sent, but there
is a late-breaking change that we are trying to resolve. Once that is
sorted out, I will send v2 of those patches.

>
> >  config OF_BOARD
> >       bool "Provided by the board (e.g a previous loader) at runtime"
> >       default y if SANDBOX || OF_HAS_PRIOR_STAGE
> > diff --git a/include/bloblist.h b/include/bloblist.h
> > index 080cc46a126..e16d122f4fb 100644
> > --- a/include/bloblist.h
> > +++ b/include/bloblist.h
> > @@ -103,6 +103,11 @@ enum bloblist_tag_t {
> >       BLOBLISTT_ACPI_TABLES = 0x104,  /* ACPI tables for x86 */
> >       BLOBLISTT_SMBIOS_TABLES = 0x105, /* SMBIOS tables for x86 */
> >       BLOBLISTT_VBOOT_CTX = 0x106,    /* Chromium OS verified boot context */
> > +     /*
>
> [...]
>
> >
> [0] https://github.com/FirmwareHandoff/firmware_handoff

Regards,
Simon

^ permalink raw reply	[flat|nested] 86+ messages in thread

* Re: [PATCH 30/32] fdt: Allow the devicetree to come from a bloblist
  2023-08-31 19:02     ` Simon Glass
@ 2023-09-01  7:49       ` Ilias Apalodimas
  2023-09-01 15:51         ` Simon Glass
  0 siblings, 1 reply; 86+ messages in thread
From: Ilias Apalodimas @ 2023-09-01  7:49 UTC (permalink / raw)
  To: Simon Glass
  Cc: U-Boot Mailing List, Tom Rini, Marek Vasut, Baruch Siach,
	Bin Meng, Heinrich Schuchardt, Jerry Van Baren, Michal Simek,
	Nikhil M Jain, Qu Wenruo, Stefan Roese

[...]

> >
> > > +config OF_BLOBLIST
> > > +     bool "DTB is provided by a bloblist"
> > > +     help
> > > +       Select this to read the devicetree from the bloblist. This allows
> > > +       using a bloblist to transfer the devicetree between  U-Boot phases.
> > > +       The devicetree is stored in the bloblist by an early phase so that
> > > +       U-Boot can read it.
> > > +
> >
> > I dont think this is a good idea.  We used to have 4-5 different options
> > here, which we tried to clean up and ended up with two very discrete
> > options.  Why do we have to reintroduce a new one?  Doesn't that bloblist
> > have a header of some sort?  The bloblist literally comes from a previous
> > stage bootloader which is what OF_BOARD is here for. So why can't we just
> > read the header and figure out if the magic of the bloblist matches?
>
> No, OF_BOARD is a hack to allow boards to do what they like with the FDT.
>
> This patch is a standard mechanism to pass the DT from one firmware
> phase to the next. We have spent quite a bit of time creating a spec
> for it, and we should use it.

Where exactly am I objecting using the spec?   Can you please re-read my email?
I am actually pointing out we should use the spec *properly*.  So
instead of having a Kconfig option for the DT, which is pretty
pointless,  we should parse the bloblist.  If the header defined by
the *spec* is found, we should just search for the DT in there.
What you are doing here, is take the spec, pick a very specific item
that the list contains, and create a Kconfig option out of it.  Which
basically ignores the discoverable options of the bloblist.  For
example, that bloblist can also contain an entry to a TPM eventlog.
Should we start creating Kconfig options for all the firmware handoff
entries that are defined on that spec?

Thanks
/Ilias

>
> The patches to align bloblist with the spec have been sent, but there
> is a late-breaking change that we are trying to resolve. Once that is
> sorted out, I will send v2 of those patches.
>
> >
> > >  config OF_BOARD
> > >       bool "Provided by the board (e.g a previous loader) at runtime"
> > >       default y if SANDBOX || OF_HAS_PRIOR_STAGE
> > > diff --git a/include/bloblist.h b/include/bloblist.h
> > > index 080cc46a126..e16d122f4fb 100644
> > > --- a/include/bloblist.h
> > > +++ b/include/bloblist.h
> > > @@ -103,6 +103,11 @@ enum bloblist_tag_t {
> > >       BLOBLISTT_ACPI_TABLES = 0x104,  /* ACPI tables for x86 */
> > >       BLOBLISTT_SMBIOS_TABLES = 0x105, /* SMBIOS tables for x86 */
> > >       BLOBLISTT_VBOOT_CTX = 0x106,    /* Chromium OS verified boot context */
> > > +     /*
> >
> > [...]
> >
> > >
> > [0] https://github.com/FirmwareHandoff/firmware_handoff
>
> Regards,
> Simon

^ permalink raw reply	[flat|nested] 86+ messages in thread

* Re: [PATCH 30/32] fdt: Allow the devicetree to come from a bloblist
  2023-09-01  7:49       ` Ilias Apalodimas
@ 2023-09-01 15:51         ` Simon Glass
  2023-09-04  9:30           ` Ilias Apalodimas
  0 siblings, 1 reply; 86+ messages in thread
From: Simon Glass @ 2023-09-01 15:51 UTC (permalink / raw)
  To: Ilias Apalodimas
  Cc: U-Boot Mailing List, Tom Rini, Marek Vasut, Baruch Siach,
	Bin Meng, Heinrich Schuchardt, Jerry Van Baren, Michal Simek,
	Nikhil M Jain, Qu Wenruo, Stefan Roese

Hi Ilias,

On Fri, 1 Sept 2023 at 01:50, Ilias Apalodimas <ilias.apalodimas@linaro.org>
wrote:
>
> [...]
>
> > >
> > > > +config OF_BLOBLIST
> > > > +     bool "DTB is provided by a bloblist"
> > > > +     help
> > > > +       Select this to read the devicetree from the bloblist. This
allows
> > > > +       using a bloblist to transfer the devicetree between  U-Boot
phases.
> > > > +       The devicetree is stored in the bloblist by an early phase
so that
> > > > +       U-Boot can read it.
> > > > +
> > >
> > > I dont think this is a good idea.  We used to have 4-5 different
options
> > > here, which we tried to clean up and ended up with two very discrete
> > > options.  Why do we have to reintroduce a new one?  Doesn't that
bloblist
> > > have a header of some sort?  The bloblist literally comes from a
previous
> > > stage bootloader which is what OF_BOARD is here for. So why can't we
just
> > > read the header and figure out if the magic of the bloblist matches?
> >
> > No, OF_BOARD is a hack to allow boards to do what they like with the
FDT.
> >
> > This patch is a standard mechanism to pass the DT from one firmware
> > phase to the next. We have spent quite a bit of time creating a spec
> > for it, and we should use it.
>
> Where exactly am I objecting using the spec?   Can you please re-read my
email?
> I am actually pointing out we should use the spec *properly*.  So
> instead of having a Kconfig option for the DT, which is pretty
> pointless,  we should parse the bloblist.  If the header defined by
> the *spec* is found, we should just search for the DT in there.
> What you are doing here, is take the spec, pick a very specific item
> that the list contains, and create a Kconfig option out of it.  Which
> basically ignores the discoverable options of the bloblist.  For
> example, that bloblist can also contain an entry to a TPM eventlog.
> Should we start creating Kconfig options for all the firmware handoff
> entries that are defined on that spec?

OK so that is a different thing. What should it do if it expects to find a
bloblist but cannot? I want it to throw an error, because I am trying to
make the boot deterministic. What do you think?

>
> Thanks
> /Ilias
>
> >
> > The patches to align bloblist with the spec have been sent, but there
> > is a late-breaking change that we are trying to resolve. Once that is
> > sorted out, I will send v2 of those patches.
> >
> > >
> > > >  config OF_BOARD
> > > >       bool "Provided by the board (e.g a previous loader) at
runtime"
> > > >       default y if SANDBOX || OF_HAS_PRIOR_STAGE
> > > > diff --git a/include/bloblist.h b/include/bloblist.h
> > > > index 080cc46a126..e16d122f4fb 100644
> > > > --- a/include/bloblist.h
> > > > +++ b/include/bloblist.h
> > > > @@ -103,6 +103,11 @@ enum bloblist_tag_t {
> > > >       BLOBLISTT_ACPI_TABLES = 0x104,  /* ACPI tables for x86 */
> > > >       BLOBLISTT_SMBIOS_TABLES = 0x105, /* SMBIOS tables for x86 */
> > > >       BLOBLISTT_VBOOT_CTX = 0x106,    /* Chromium OS verified boot
context */
> > > > +     /*
> > >
> > > [...]
> > >
> > > >
> > > [0] https://github.com/FirmwareHandoff/firmware_handoff
> >

Regards,
Simon

^ permalink raw reply	[flat|nested] 86+ messages in thread

* Re: [PATCH 32/32] pci: serial: Support reading PCI-register size with base
  2023-08-30 21:42                           ` Tom Rini
@ 2023-09-03 20:36                             ` Pali Rohár
  2023-09-04 19:55                               ` Tom Rini
  0 siblings, 1 reply; 86+ messages in thread
From: Pali Rohár @ 2023-09-03 20:36 UTC (permalink / raw)
  To: Tom Rini; +Cc: U-Boot Mailing List

You are not saying truth here, you are lying and you know it. mvebu
changes? ignored, no answer. ppc changes? ignored no answer in 10
months. mmc changes, no answer at all. rx-51 bug reports and regression
which you and your people broke? you wrote me: fuck you and fix it
yourself. So what does compromise means for you? Just "Pali has to do
anything". So yes, I'm refusing to do all this dirty jobs for you. This
is not any compromise, maybe just in your head or your language.
Compromise is something like, you will fix regression what you and your
people caused and I then I will look at some of the pending patches for
which I'm listed as reviewer. Helping do debug? Nobody helped me with
anything. Do you still you think that I'm such idiot who is going to
review more and more of your code and you continue ignoring me?? No.

On Wednesday 30 August 2023 17:42:01 Tom Rini wrote:
> On Wed, Aug 30, 2023 at 11:29:34PM +0200, Pali Rohár wrote:
> 
> > There were no answers.
> > 
> > On Wednesday 30 August 2023 17:26:20 Tom Rini wrote:
> > > I'm trimming the CC list. All of those points you list were addressed
> > > and answered in your last long running argument. You need to decide what
> > > is best for you moving forward and I would ask that it not involve
> > > complaining that you're being asked to review code that you're a listed
> > > maintainer of.
> > > 
> > > On Wed, Aug 30, 2023 at 11:13:16PM +0200, Pali Rohár wrote:
> > > > Seems that you completely miss the point of the argument, then the only
> > > > option for such people is to repeat them. Or have I repeat you again
> > > > that you have not answered the first question, why you are asking for
> > > > review from somebody who you are ignoring and not taking into account?
> > > > You do not want to answer this question, right? So you rather change a
> > > > topic and talking about something totally different.
> > > > 
> > > > On Wednesday 30 August 2023 17:08:42 Tom Rini wrote:
> > > > > I don't think it's worth re-hashing the same arguments over and over.
> > > > > There is no "my persons", there is the public community.  If you no
> > > > > longer wish to participate, I can remove you from the maintainers
> > > > > entries you're listed in.  But please stop with the long arguments
> > > > > unrelated to the patches at hand when there's a dozen people and other
> > > > > lists on CC.
> > > > > 
> > > > > On Wed, Aug 30, 2023 at 10:51:45PM +0200, Pali Rohár wrote:
> > > > > > So lets recap what you and your persons have done in last 6 months:
> > > > > > 
> > > > > > * Ignored my changes
> > > > > > * Ignored my reviews
> > > > > > * Ignored my reminders
> 
> Not ignored, changes requested and refused.  Compromises refused.
> Apologies from others who had said they would pick up the platform and
> push it, but did not have time ignored.
> 
> > > > > > * Ignored my regression reports
> 
> Not ignored, debugged, problems with your platform implementation
> reported and questions asked, patches provided to help you debug the
> problem on the single place that seems to show a problem which no one
> else can reproduce ignored.
> 
> -- 
> Tom



^ permalink raw reply	[flat|nested] 86+ messages in thread

* Re: [PATCH 32/32] pci: serial: Support reading PCI-register size with base
  2023-08-30 18:14   ` Pali Rohár
  2023-08-30 18:17     ` Tom Rini
@ 2023-09-03 20:39     ` Pali Rohár
  2023-09-04 20:15       ` Pali Rohár
  1 sibling, 1 reply; 86+ messages in thread
From: Pali Rohár @ 2023-09-03 20:39 UTC (permalink / raw)
  To: Simon Glass
  Cc: U-Boot Mailing List, Tom Rini, Marek Vasut, Abdellatif El Khlifi,
	Andre Przywara, Bin Meng, Chunfeng Yun, Dzmitry Sankouski,
	GSS_MTK_Uboot_upstream, Heinrich Schuchardt, Ilias Apalodimas,
	Michal Simek, Michal Suchanek, Nikhil M Jain, Ryder Lee,
	Stefan Roese, Weijie Gao

I still have not received any reply from you.

On Wednesday 30 August 2023 20:14:59 Pali Rohár wrote:
> Simon, why you are contacting me? You have wrote to me that you would
> ignore my reviews here, so what you want now? Could you please explain
> what you are trying to achieve? I'm not going to review this or any
> other your changes.
> 
> On Wednesday 30 August 2023 12:05:03 Simon Glass wrote:
> > The PCI helpers read only the base address for a PCI region. In some cases
> > the size is needed as well, e.g. to pass along to a driver which needs to
> > know the size of its register area.
> > 
> > Update the functions to allow the size to be returned. For serial, record
> > the information and provided it with the serial_info() call.
> > 
> > A limitation still exists in that the size is not available when OF_LIVE
> > is enabled, so take account of that in the tests.
> > 
> > Signed-off-by: Simon Glass <sjg@chromium.org>
> > ---
> > 
> >  arch/sandbox/dts/test.dts   |  6 +++---
> >  drivers/core/fdtaddr.c      |  6 +++---
> >  drivers/core/ofnode.c       | 11 ++++++++---
> >  drivers/core/read.c         |  6 ++++--
> >  drivers/core/util.c         |  2 +-
> >  drivers/pci/pci-uclass.c    |  2 +-
> >  drivers/pci/pci_mvebu.c     |  3 ++-
> >  drivers/pci/pci_tegra.c     |  2 +-
> >  drivers/pci/pcie_mediatek.c |  4 ++--
> >  drivers/serial/ns16550.c    | 15 ++++++++++-----
> >  include/dm/fdtaddr.h        |  3 ++-
> >  include/dm/ofnode.h         |  4 +++-
> >  include/dm/read.h           |  8 +++++---
> >  include/ns16550.h           |  4 +++-
> >  include/serial.h            |  2 ++
> >  test/dm/pci.c               | 14 ++++++++++----
> >  16 files changed, 60 insertions(+), 32 deletions(-)
> > 
> > diff --git a/arch/sandbox/dts/test.dts b/arch/sandbox/dts/test.dts
> > index a413cbe4989..961e8895a49 100644
> > --- a/arch/sandbox/dts/test.dts
> > +++ b/arch/sandbox/dts/test.dts
> > @@ -1087,8 +1087,8 @@
> >  		pci@1,0 {
> >  			compatible = "pci-generic";
> >  			/* reg 0 is at 0x14, using FDT_PCI_SPACE_MEM32 */
> > -			reg = <0x02000814 0 0 0 0
> > -			       0x01000810 0 0 0 0>;
> > +			reg = <0x02000814 0 0 0x80 0
> > +			       0x01000810 0 0 0xc0 0>;
> >  			sandbox,emul = <&swap_case_emul0_1>;
> >  		};
> >  		p2sb-pci@2,0 {
> > @@ -1115,7 +1115,7 @@
> >  		pci@1f,0 {
> >  			compatible = "pci-generic";
> >  			/* reg 0 is at 0x10, using FDT_PCI_SPACE_IO */
> > -			reg = <0x0100f810 0 0 0 0>;
> > +			reg = <0x0100f810 0 0 0x100 0>;
> >  			sandbox,emul = <&swap_case_emul0_1f>;
> >  		};
> >  	};
> > diff --git a/drivers/core/fdtaddr.c b/drivers/core/fdtaddr.c
> > index 546db675aaf..b79d138c419 100644
> > --- a/drivers/core/fdtaddr.c
> > +++ b/drivers/core/fdtaddr.c
> > @@ -215,7 +215,7 @@ void *devfdt_map_physmem(const struct udevice *dev, unsigned long size)
> >  	return map_physmem(addr, size, MAP_NOCACHE);
> >  }
> >  
> > -fdt_addr_t devfdt_get_addr_pci(const struct udevice *dev)
> > +fdt_addr_t devfdt_get_addr_pci(const struct udevice *dev, fdt_size_t *sizep)
> >  {
> >  	ulong addr;
> >  
> > @@ -226,12 +226,12 @@ fdt_addr_t devfdt_get_addr_pci(const struct udevice *dev)
> >  		int ret;
> >  
> >  		ret = ofnode_read_pci_addr(dev_ofnode(dev), FDT_PCI_SPACE_MEM32,
> > -					   "reg", &pci_addr);
> > +					   "reg", &pci_addr, sizep);
> >  		if (ret) {
> >  			/* try if there is any i/o-mapped register */
> >  			ret = ofnode_read_pci_addr(dev_ofnode(dev),
> >  						   FDT_PCI_SPACE_IO, "reg",
> > -						   &pci_addr);
> > +						   &pci_addr, sizep);
> >  			if (ret)
> >  				return FDT_ADDR_T_NONE;
> >  		}
> > diff --git a/drivers/core/ofnode.c b/drivers/core/ofnode.c
> > index 2ef4114cb6f..c9cec456f43 100644
> > --- a/drivers/core/ofnode.c
> > +++ b/drivers/core/ofnode.c
> > @@ -1270,7 +1270,8 @@ const uint8_t *ofnode_read_u8_array_ptr(ofnode node, const char *propname,
> >  }
> >  
> >  int ofnode_read_pci_addr(ofnode node, enum fdt_pci_space type,
> > -			 const char *propname, struct fdt_pci_addr *addr)
> > +			 const char *propname, struct fdt_pci_addr *addr,
> > +			 fdt_size_t *size)
> >  {
> >  	const fdt32_t *cell;
> >  	int len;
> > @@ -1298,14 +1299,18 @@ int ofnode_read_pci_addr(ofnode node, enum fdt_pci_space type,
> >  			      (ulong)fdt32_to_cpu(cell[1]),
> >  			      (ulong)fdt32_to_cpu(cell[2]));
> >  			if ((fdt32_to_cpu(*cell) & type) == type) {
> > +				const unaligned_fdt64_t *ptr;
> > +
> >  				addr->phys_hi = fdt32_to_cpu(cell[0]);
> >  				addr->phys_mid = fdt32_to_cpu(cell[1]);
> >  				addr->phys_lo = fdt32_to_cpu(cell[2]);
> > +				ptr = (const unaligned_fdt64_t *)(cell + 3);
> > +				if (size)
> > +					*size = fdt64_to_cpu(*ptr);
> >  				break;
> >  			}
> >  
> > -			cell += (FDT_PCI_ADDR_CELLS +
> > -				 FDT_PCI_SIZE_CELLS);
> > +			cell += FDT_PCI_ADDR_CELLS + FDT_PCI_SIZE_CELLS;
> >  		}
> >  
> >  		if (i == num) {
> > diff --git a/drivers/core/read.c b/drivers/core/read.c
> > index 49066b59cda..419013451f0 100644
> > --- a/drivers/core/read.c
> > +++ b/drivers/core/read.c
> > @@ -405,13 +405,15 @@ int dev_read_alias_highest_id(const char *stem)
> >  	return fdtdec_get_alias_highest_id(gd->fdt_blob, stem);
> >  }
> >  
> > -fdt_addr_t dev_read_addr_pci(const struct udevice *dev)
> > +fdt_addr_t dev_read_addr_pci(const struct udevice *dev, fdt_size_t *sizep)
> >  {
> >  	ulong addr;
> >  
> >  	addr = dev_read_addr(dev);
> > +	if (sizep)
> > +		*sizep = 0;
> >  	if (addr == FDT_ADDR_T_NONE && !of_live_active())
> > -		addr = devfdt_get_addr_pci(dev);
> > +		addr = devfdt_get_addr_pci(dev, sizep);
> >  
> >  	return addr;
> >  }
> > diff --git a/drivers/core/util.c b/drivers/core/util.c
> > index aa60fdd15bc..81497df85ff 100644
> > --- a/drivers/core/util.c
> > +++ b/drivers/core/util.c
> > @@ -30,7 +30,7 @@ int pci_get_devfn(struct udevice *dev)
> >  
> >  	/* Extract the devfn from fdt_pci_addr */
> >  	ret = ofnode_read_pci_addr(dev_ofnode(dev), FDT_PCI_SPACE_CONFIG,
> > -				   "reg", &addr);
> > +				   "reg", &addr, NULL);
> >  	if (ret) {
> >  		if (ret != -ENOENT)
> >  			return -EINVAL;
> > diff --git a/drivers/pci/pci-uclass.c b/drivers/pci/pci-uclass.c
> > index 0adcdceb1d3..c670f8754e8 100644
> > --- a/drivers/pci/pci-uclass.c
> > +++ b/drivers/pci/pci-uclass.c
> > @@ -122,7 +122,7 @@ static void pci_dev_find_ofnode(struct udevice *bus, phys_addr_t bdf,
> >  
> >  	dev_for_each_subnode(node, bus) {
> >  		ret = ofnode_read_pci_addr(node, FDT_PCI_SPACE_CONFIG, "reg",
> > -					   &addr);
> > +					   &addr, NULL);
> >  		if (ret)
> >  			continue;
> >  
> > diff --git a/drivers/pci/pci_mvebu.c b/drivers/pci/pci_mvebu.c
> > index 93a7508d8a2..25878bde534 100644
> > --- a/drivers/pci/pci_mvebu.c
> > +++ b/drivers/pci/pci_mvebu.c
> > @@ -640,7 +640,8 @@ static int mvebu_pcie_port_parse_dt(ofnode node, ofnode parent, struct mvebu_pci
> >  		pcie->is_x4 = true;
> >  
> >  	/* devfn is in bits [15:8], see PCI_DEV usage */
> > -	ret = ofnode_read_pci_addr(node, FDT_PCI_SPACE_CONFIG, "reg", &pci_addr);
> > +	ret = ofnode_read_pci_addr(node, FDT_PCI_SPACE_CONFIG, "reg", &pci_addr,
> > +				   NULL);
> >  	if (ret < 0) {
> >  		printf("%s: property \"reg\" is invalid\n", pcie->name);
> >  		goto err;
> > diff --git a/drivers/pci/pci_tegra.c b/drivers/pci/pci_tegra.c
> > index 29d54117e93..ae90bd2fbf1 100644
> > --- a/drivers/pci/pci_tegra.c
> > +++ b/drivers/pci/pci_tegra.c
> > @@ -461,7 +461,7 @@ static int tegra_pcie_parse_port_info(ofnode node, uint *index, uint *lanes)
> >  
> >  	*lanes = err;
> >  
> > -	err = ofnode_read_pci_addr(node, 0, "reg", &addr);
> > +	err = ofnode_read_pci_addr(node, 0, "reg", &addr, NULL);
> >  	if (err < 0) {
> >  		pr_err("failed to parse \"reg\" property\n");
> >  		return err;
> > diff --git a/drivers/pci/pcie_mediatek.c b/drivers/pci/pcie_mediatek.c
> > index c6e30e24622..e59ebd13ad0 100644
> > --- a/drivers/pci/pcie_mediatek.c
> > +++ b/drivers/pci/pcie_mediatek.c
> > @@ -660,7 +660,7 @@ static int mtk_pcie_probe(struct udevice *dev)
> >  		if (!ofnode_is_enabled(subnode))
> >  			continue;
> >  
> > -		err = ofnode_read_pci_addr(subnode, 0, "reg", &addr);
> > +		err = ofnode_read_pci_addr(subnode, 0, "reg", &addr, NULL);
> >  		if (err)
> >  			return err;
> >  
> > @@ -699,7 +699,7 @@ static int mtk_pcie_probe_v2(struct udevice *dev)
> >  		if (!ofnode_is_enabled(subnode))
> >  			continue;
> >  
> > -		err = ofnode_read_pci_addr(subnode, 0, "reg", &addr);
> > +		err = ofnode_read_pci_addr(subnode, 0, "reg", &addr, NULL);
> >  		if (err)
> >  			return err;
> >  
> > diff --git a/drivers/serial/ns16550.c b/drivers/serial/ns16550.c
> > index eab9537fbae..a349e5e132a 100644
> > --- a/drivers/serial/ns16550.c
> > +++ b/drivers/serial/ns16550.c
> > @@ -479,6 +479,7 @@ static int ns16550_serial_getinfo(struct udevice *dev,
> >  	info->addr_space = SERIAL_ADDRESS_SPACE_MEMORY;
> >  #endif
> >  	info->addr = plat->base;
> > +	info->size = plat->size;
> >  	info->reg_width = plat->reg_width;
> >  	info->reg_shift = plat->reg_shift;
> >  	info->reg_offset = plat->reg_offset;
> > @@ -487,7 +488,8 @@ static int ns16550_serial_getinfo(struct udevice *dev,
> >  	return 0;
> >  }
> >  
> > -static int ns16550_serial_assign_base(struct ns16550_plat *plat, fdt_addr_t base)
> > +static int ns16550_serial_assign_base(struct ns16550_plat *plat,
> > +				      fdt_addr_t base, fdt_size_t size)
> >  {
> >  	if (base == FDT_ADDR_T_NONE)
> >  		return -EINVAL;
> > @@ -497,6 +499,7 @@ static int ns16550_serial_assign_base(struct ns16550_plat *plat, fdt_addr_t base
> >  #else
> >  	plat->base = (unsigned long)map_physmem(base, 0, MAP_NOCACHE);
> >  #endif
> > +	plat->size = size;
> >  
> >  	return 0;
> >  }
> > @@ -507,6 +510,7 @@ int ns16550_serial_probe(struct udevice *dev)
> >  	struct ns16550 *const com_port = dev_get_priv(dev);
> >  	struct reset_ctl_bulk reset_bulk;
> >  	fdt_addr_t addr;
> > +	fdt_addr_t size;
> >  	int ret;
> >  
> >  	/*
> > @@ -514,8 +518,8 @@ int ns16550_serial_probe(struct udevice *dev)
> >  	 * or via a PCI bridge, assign plat->base before probing hardware.
> >  	 */
> >  	if (device_is_on_pci_bus(dev)) {
> > -		addr = devfdt_get_addr_pci(dev);
> > -		ret = ns16550_serial_assign_base(plat, addr);
> > +		addr = devfdt_get_addr_pci(dev, &size);
> > +		ret = ns16550_serial_assign_base(plat, addr, size);
> >  		if (ret)
> >  			return ret;
> >  	}
> > @@ -543,11 +547,12 @@ int ns16550_serial_of_to_plat(struct udevice *dev)
> >  	struct ns16550_plat *plat = dev_get_plat(dev);
> >  	const u32 port_type = dev_get_driver_data(dev);
> >  	fdt_addr_t addr;
> > +	fdt_size_t size;
> >  	struct clk clk;
> >  	int err;
> >  
> > -	addr = dev_read_addr(dev);
> > -	err = ns16550_serial_assign_base(plat, addr);
> > +	addr = dev_read_addr_size(dev, &size);
> > +	err = ns16550_serial_assign_base(plat, addr, size);
> >  	if (err && !device_is_on_pci_bus(dev))
> >  		return err;
> >  
> > diff --git a/include/dm/fdtaddr.h b/include/dm/fdtaddr.h
> > index dcdc19137cc..6d2fa8f1044 100644
> > --- a/include/dm/fdtaddr.h
> > +++ b/include/dm/fdtaddr.h
> > @@ -168,8 +168,9 @@ fdt_addr_t devfdt_get_addr_size_name(const struct udevice *dev,
> >   * devfdt_get_addr_pci() - Read an address and handle PCI address translation
> >   *
> >   * @dev: Device to read from
> > + * @sizep: If non-NULL, returns size of address space
> >   * Return: address or FDT_ADDR_T_NONE if not found
> >   */
> > -fdt_addr_t devfdt_get_addr_pci(const struct udevice *dev);
> > +fdt_addr_t devfdt_get_addr_pci(const struct udevice *dev, fdt_size_t *sizep);
> >  
> >  #endif
> > diff --git a/include/dm/ofnode.h b/include/dm/ofnode.h
> > index 726d8f82ddf..97cad971611 100644
> > --- a/include/dm/ofnode.h
> > +++ b/include/dm/ofnode.h
> > @@ -1152,13 +1152,15 @@ const uint8_t *ofnode_read_u8_array_ptr(ofnode node, const char *propname,
> >   * @type:	pci address type (FDT_PCI_SPACE_xxx)
> >   * @propname:	name of property to find
> >   * @addr:	returns pci address in the form of fdt_pci_addr
> > + * @size:	if non-null, returns register-space size
> >   * Return:
> >   * 0 if ok, -ENOENT if the property did not exist, -EINVAL if the
> >   * format of the property was invalid, -ENXIO if the requested
> >   * address type was not found
> >   */
> >  int ofnode_read_pci_addr(ofnode node, enum fdt_pci_space type,
> > -			 const char *propname, struct fdt_pci_addr *addr);
> > +			 const char *propname, struct fdt_pci_addr *addr,
> > +			 fdt_size_t *size);
> >  
> >  /**
> >   * ofnode_read_pci_vendev() - look up PCI vendor and device id
> > diff --git a/include/dm/read.h b/include/dm/read.h
> > index c2615f72f40..3c2eea6f0c4 100644
> > --- a/include/dm/read.h
> > +++ b/include/dm/read.h
> > @@ -346,9 +346,10 @@ void *dev_read_addr_ptr(const struct udevice *dev);
> >   *    fdtdec_get_addr() and friends.
> >   *
> >   * @dev: Device to read from
> > + * @sizep: If non-NULL, returns size of address space found
> >   * Return: address or FDT_ADDR_T_NONE if not found
> >   */
> > -fdt_addr_t dev_read_addr_pci(const struct udevice *dev);
> > +fdt_addr_t dev_read_addr_pci(const struct udevice *dev, fdt_size_t *sizep);
> >  
> >  /**
> >   * dev_remap_addr() - Get the reg property of a device as a
> > @@ -996,9 +997,10 @@ static inline void *dev_read_addr_ptr(const struct udevice *dev)
> >  	return devfdt_get_addr_ptr(dev);
> >  }
> >  
> > -static inline fdt_addr_t dev_read_addr_pci(const struct udevice *dev)
> > +static inline fdt_addr_t dev_read_addr_pci(const struct udevice *dev,
> > +					   fdt_size_t *sizep)
> >  {
> > -	return devfdt_get_addr_pci(dev);
> > +	return devfdt_get_addr_pci(dev, sizep);
> >  }
> >  
> >  static inline void *dev_remap_addr(const struct udevice *dev)
> > diff --git a/include/ns16550.h b/include/ns16550.h
> > index e7e68663d03..7f481300083 100644
> > --- a/include/ns16550.h
> > +++ b/include/ns16550.h
> > @@ -58,6 +58,7 @@ enum ns16550_flags {
> >   * struct ns16550_plat - information about a NS16550 port
> >   *
> >   * @base:		Base register address
> > + * @size:		Size of register area in bytes
> >   * @reg_width:		IO accesses size of registers (in bytes, 1 or 4)
> >   * @reg_shift:		Shift size of registers (0=byte, 1=16bit, 2=32bit...)
> >   * @reg_offset:		Offset to start of registers (normally 0)
> > @@ -67,7 +68,8 @@ enum ns16550_flags {
> >   * @bdf:		PCI slot/function (pci_dev_t)
> >   */
> >  struct ns16550_plat {
> > -	unsigned long base;
> > +	ulong base;
> > +	ulong size;
> >  	int reg_width;
> >  	int reg_shift;
> >  	int reg_offset;
> > diff --git a/include/serial.h b/include/serial.h
> > index 42bdf3759c0..205889d28be 100644
> > --- a/include/serial.h
> > +++ b/include/serial.h
> > @@ -137,6 +137,7 @@ enum adr_space_type {
> >   * @type:	type of the UART chip
> >   * @addr_space:	address space to access the registers
> >   * @addr:	physical address of the registers
> > + * @size:	size of the register area in bytes
> >   * @reg_width:	size (in bytes) of the IO accesses to the registers
> >   * @reg_offset:	offset to apply to the @addr from the start of the registers
> >   * @reg_shift:	quantity to shift the register offsets by
> > @@ -147,6 +148,7 @@ struct serial_device_info {
> >  	enum serial_chip_type type;
> >  	enum adr_space_type addr_space;
> >  	ulong addr;
> > +	ulong size;
> >  	u8 reg_width;
> >  	u8 reg_offset;
> >  	u8 reg_shift;
> > diff --git a/test/dm/pci.c b/test/dm/pci.c
> > index 70a736cfdb8..8c5e7da9e62 100644
> > --- a/test/dm/pci.c
> > +++ b/test/dm/pci.c
> > @@ -301,10 +301,12 @@ static int dm_test_pci_addr_flat(struct unit_test_state *uts)
> >  {
> >  	struct udevice *swap1f, *swap1;
> >  	ulong io_addr, mem_addr;
> > +	fdt_addr_t size;
> >  
> >  	ut_assertok(dm_pci_bus_find_bdf(PCI_BDF(0, 0x1f, 0), &swap1f));
> >  	io_addr = dm_pci_read_bar32(swap1f, 0);
> > -	ut_asserteq(io_addr, dev_read_addr_pci(swap1f));
> > +	ut_asserteq(io_addr, dev_read_addr_pci(swap1f, &size));
> > +	ut_asserteq(0, size);
> >  
> >  	/*
> >  	 * This device has both I/O and MEM spaces but the MEM space appears
> > @@ -312,7 +314,8 @@ static int dm_test_pci_addr_flat(struct unit_test_state *uts)
> >  	 */
> >  	ut_assertok(dm_pci_bus_find_bdf(PCI_BDF(0, 0x1, 0), &swap1));
> >  	mem_addr = dm_pci_read_bar32(swap1, 1);
> > -	ut_asserteq(mem_addr, dev_read_addr_pci(swap1));
> > +	ut_asserteq(mem_addr, dev_read_addr_pci(swap1, &size));
> > +	ut_asserteq(0, size);
> >  
> >  	return 0;
> >  }
> > @@ -329,12 +332,15 @@ DM_TEST(dm_test_pci_addr_flat, UT_TESTF_SCAN_PDATA | UT_TESTF_SCAN_FDT |
> >  static int dm_test_pci_addr_live(struct unit_test_state *uts)
> >  {
> >  	struct udevice *swap1f, *swap1;
> > +	fdt_size_t size;
> >  
> >  	ut_assertok(dm_pci_bus_find_bdf(PCI_BDF(0, 0x1f, 0), &swap1f));
> > -	ut_asserteq_64(FDT_ADDR_T_NONE, dev_read_addr_pci(swap1f));
> > +	ut_asserteq_64(FDT_ADDR_T_NONE, dev_read_addr_pci(swap1f, &size));
> > +	ut_asserteq(0, size);
> >  
> >  	ut_assertok(dm_pci_bus_find_bdf(PCI_BDF(0, 0x1, 0), &swap1));
> > -	ut_asserteq_64(FDT_ADDR_T_NONE, dev_read_addr_pci(swap1));
> > +	ut_asserteq_64(FDT_ADDR_T_NONE, dev_read_addr_pci(swap1, &size));
> > +	ut_asserteq(0, size);
> >  
> >  	return 0;
> >  }
> > -- 
> > 2.42.0.rc2.253.gd59a3bf2b4-goog
> > 

^ permalink raw reply	[flat|nested] 86+ messages in thread

* Re: [PATCH 30/32] fdt: Allow the devicetree to come from a bloblist
  2023-09-01 15:51         ` Simon Glass
@ 2023-09-04  9:30           ` Ilias Apalodimas
  2023-09-10 19:13             ` Simon Glass
  0 siblings, 1 reply; 86+ messages in thread
From: Ilias Apalodimas @ 2023-09-04  9:30 UTC (permalink / raw)
  To: Simon Glass
  Cc: U-Boot Mailing List, Tom Rini, Marek Vasut, Baruch Siach,
	Bin Meng, Heinrich Schuchardt, Michal Simek, Nikhil M Jain,
	Qu Wenruo, Stefan Roese

Hi Simon,

On Fri, 1 Sept 2023 at 18:51, Simon Glass <sjg@chromium.org> wrote:
>
> Hi Ilias,
>
> On Fri, 1 Sept 2023 at 01:50, Ilias Apalodimas <ilias.apalodimas@linaro.org> wrote:
> >
> > [...]
> >
> > > >
> > > > > +config OF_BLOBLIST
> > > > > +     bool "DTB is provided by a bloblist"
> > > > > +     help
> > > > > +       Select this to read the devicetree from the bloblist. This allows
> > > > > +       using a bloblist to transfer the devicetree between  U-Boot phases.
> > > > > +       The devicetree is stored in the bloblist by an early phase so that
> > > > > +       U-Boot can read it.
> > > > > +
> > > >
> > > > I dont think this is a good idea.  We used to have 4-5 different options
> > > > here, which we tried to clean up and ended up with two very discrete
> > > > options.  Why do we have to reintroduce a new one?  Doesn't that bloblist
> > > > have a header of some sort?  The bloblist literally comes from a previous
> > > > stage bootloader which is what OF_BOARD is here for. So why can't we just
> > > > read the header and figure out if the magic of the bloblist matches?
> > >
> > > No, OF_BOARD is a hack to allow boards to do what they like with the FDT.
> > >
> > > This patch is a standard mechanism to pass the DT from one firmware
> > > phase to the next. We have spent quite a bit of time creating a spec
> > > for it, and we should use it.
> >
> > Where exactly am I objecting using the spec?   Can you please re-read my email?
> > I am actually pointing out we should use the spec *properly*.  So
> > instead of having a Kconfig option for the DT, which is pretty
> > pointless,  we should parse the bloblist.  If the header defined by
> > the *spec* is found, we should just search for the DT in there.
> > What you are doing here, is take the spec, pick a very specific item
> > that the list contains, and create a Kconfig option out of it.  Which
> > basically ignores the discoverable options of the bloblist.  For
> > example, that bloblist can also contain an entry to a TPM eventlog.
> > Should we start creating Kconfig options for all the firmware handoff
> > entries that are defined on that spec?
>
> OK so that is a different thing. What should it do if it expects to find a bloblist but cannot? I want it to throw an error, because I am trying to make the boot deterministic. What do you think?

That's fine by me.  You can even put that under IS_ENABLED for the
bloblist inside the existing OF_BOARD check.  So I was thinking
- If no bloblist is required in Kconfig options we do the hacks we used to
- if bloblist is selected and the config option is OF_BOARD, throw an
error and mention that the previous stage loader should hand over a DT

Is that what you had in mind?

Thanks
/Ilias
>
> >
> > Thanks
> > /Ilias
> >
> > >
> > > The patches to align bloblist with the spec have been sent, but there
> > > is a late-breaking change that we are trying to resolve. Once that is
> > > sorted out, I will send v2 of those patches.
> > >
> > > >
> > > > >  config OF_BOARD
> > > > >       bool "Provided by the board (e.g a previous loader) at runtime"
> > > > >       default y if SANDBOX || OF_HAS_PRIOR_STAGE
> > > > > diff --git a/include/bloblist.h b/include/bloblist.h
> > > > > index 080cc46a126..e16d122f4fb 100644
> > > > > --- a/include/bloblist.h
> > > > > +++ b/include/bloblist.h
> > > > > @@ -103,6 +103,11 @@ enum bloblist_tag_t {
> > > > >       BLOBLISTT_ACPI_TABLES = 0x104,  /* ACPI tables for x86 */
> > > > >       BLOBLISTT_SMBIOS_TABLES = 0x105, /* SMBIOS tables for x86 */
> > > > >       BLOBLISTT_VBOOT_CTX = 0x106,    /* Chromium OS verified boot context */
> > > > > +     /*
> > > >
> > > > [...]
> > > >
> > > > >
> > > > [0] https://github.com/FirmwareHandoff/firmware_handoff
> > >
>
> Regards,
> Simon

^ permalink raw reply	[flat|nested] 86+ messages in thread

* Re: [PATCH 32/32] pci: serial: Support reading PCI-register size with base
  2023-09-03 20:36                             ` Pali Rohár
@ 2023-09-04 19:55                               ` Tom Rini
  2023-09-04 20:07                                 ` Pali Rohár
  0 siblings, 1 reply; 86+ messages in thread
From: Tom Rini @ 2023-09-04 19:55 UTC (permalink / raw)
  To: Pali Rohár; +Cc: U-Boot Mailing List

[-- Attachment #1: Type: text/plain, Size: 3997 bytes --]

On Sun, Sep 03, 2023 at 10:36:15PM +0200, Pali Rohár wrote:
> You are not saying truth here, you are lying and you know it. mvebu
> changes? ignored, no answer. ppc changes? ignored no answer in 10
> months. mmc changes, no answer at all. rx-51 bug reports and regression
> which you and your people broke? you wrote me: fuck you and fix it
> yourself. So what does compromise means for you? Just "Pali has to do
> anything". So yes, I'm refusing to do all this dirty jobs for you. This
> is not any compromise, maybe just in your head or your language.
> Compromise is something like, you will fix regression what you and your
> people caused and I then I will look at some of the pending patches for
> which I'm listed as reviewer. Helping do debug? Nobody helped me with
> anything. Do you still you think that I'm such idiot who is going to
> review more and more of your code and you continue ignoring me?? No.

No, I'm still speaking the truth. Your MMC changes broke other
platforms, and you didn't respin the whole patch, you just posted
another patch instead despite me asking you to respin things to include
it.  What I summarized there is exactly what happened with the powerpc
changes, and a similar but shorter timeline for the rx-51 report that
you still refuse to further debug after being repeatedly told that no
one else can reproduce the problem anywhere else.

And Simon contacted you on this thread because you're the listed
maintainer of one of the files changed here.

> 
> On Wednesday 30 August 2023 17:42:01 Tom Rini wrote:
> > On Wed, Aug 30, 2023 at 11:29:34PM +0200, Pali Rohár wrote:
> > 
> > > There were no answers.
> > > 
> > > On Wednesday 30 August 2023 17:26:20 Tom Rini wrote:
> > > > I'm trimming the CC list. All of those points you list were addressed
> > > > and answered in your last long running argument. You need to decide what
> > > > is best for you moving forward and I would ask that it not involve
> > > > complaining that you're being asked to review code that you're a listed
> > > > maintainer of.
> > > > 
> > > > On Wed, Aug 30, 2023 at 11:13:16PM +0200, Pali Rohár wrote:
> > > > > Seems that you completely miss the point of the argument, then the only
> > > > > option for such people is to repeat them. Or have I repeat you again
> > > > > that you have not answered the first question, why you are asking for
> > > > > review from somebody who you are ignoring and not taking into account?
> > > > > You do not want to answer this question, right? So you rather change a
> > > > > topic and talking about something totally different.
> > > > > 
> > > > > On Wednesday 30 August 2023 17:08:42 Tom Rini wrote:
> > > > > > I don't think it's worth re-hashing the same arguments over and over.
> > > > > > There is no "my persons", there is the public community.  If you no
> > > > > > longer wish to participate, I can remove you from the maintainers
> > > > > > entries you're listed in.  But please stop with the long arguments
> > > > > > unrelated to the patches at hand when there's a dozen people and other
> > > > > > lists on CC.
> > > > > > 
> > > > > > On Wed, Aug 30, 2023 at 10:51:45PM +0200, Pali Rohár wrote:
> > > > > > > So lets recap what you and your persons have done in last 6 months:
> > > > > > > 
> > > > > > > * Ignored my changes
> > > > > > > * Ignored my reviews
> > > > > > > * Ignored my reminders
> > 
> > Not ignored, changes requested and refused.  Compromises refused.
> > Apologies from others who had said they would pick up the platform and
> > push it, but did not have time ignored.
> > 
> > > > > > > * Ignored my regression reports
> > 
> > Not ignored, debugged, problems with your platform implementation
> > reported and questions asked, patches provided to help you debug the
> > problem on the single place that seems to show a problem which no one
> > else can reproduce ignored.
> > 
> > -- 
> > Tom
> 
> 

-- 
Tom

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 659 bytes --]

^ permalink raw reply	[flat|nested] 86+ messages in thread

* Re: [PATCH 32/32] pci: serial: Support reading PCI-register size with base
  2023-09-04 19:55                               ` Tom Rini
@ 2023-09-04 20:07                                 ` Pali Rohár
  0 siblings, 0 replies; 86+ messages in thread
From: Pali Rohár @ 2023-09-04 20:07 UTC (permalink / raw)
  To: Tom Rini; +Cc: U-Boot Mailing List

On Monday 04 September 2023 15:55:18 Tom Rini wrote:
> On Sun, Sep 03, 2023 at 10:36:15PM +0200, Pali Rohár wrote:
> > You are not saying truth here, you are lying and you know it. mvebu
> > changes? ignored, no answer. ppc changes? ignored no answer in 10
> > months. mmc changes, no answer at all. rx-51 bug reports and regression
> > which you and your people broke? you wrote me: fuck you and fix it
> > yourself. So what does compromise means for you? Just "Pali has to do
> > anything". So yes, I'm refusing to do all this dirty jobs for you. This
> > is not any compromise, maybe just in your head or your language.
> > Compromise is something like, you will fix regression what you and your
> > people caused and I then I will look at some of the pending patches for
> > which I'm listed as reviewer. Helping do debug? Nobody helped me with
> > anything. Do you still you think that I'm such idiot who is going to
> > review more and more of your code and you continue ignoring me?? No.
> 
> No, I'm still speaking the truth. Your MMC changes broke other
> platforms, and you didn't respin the whole patch, you just posted
> another patch instead despite me asking you to respin things to include
> it.  What I summarized there is exactly what happened with the powerpc
> changes, and a similar but shorter timeline for the rx-51 report that
> you still refuse to further debug after being repeatedly told that no
> one else can reproduce the problem anywhere else.

Your changes broke rx-51 and you refused to revert that change, you
refused to work on fixing this change and you refused to respin the new
version. I have provided all detailed information and you refused to
work with it.

I sent a new mmc version, I sent two new ppc changes and all of them
you ignored.

So stop writing bullshit here.

And now I'm really refusing to do other work as I see that you and your
people would ignore also this stuff, like all other.

Once you stop doing this, stop ignoring me, review and reapply my
changes, then come back to me and after that I may decided if I look at
any your or your people changes. Not before.

> And Simon contacted you on this thread because you're the listed
> maintainer of one of the files changed here.

And I have contacted him and he refused to reply and is continuing
ignoring me.

So what I wrote is truth there, you are continuing saying untruth here.

> > 
> > On Wednesday 30 August 2023 17:42:01 Tom Rini wrote:
> > > On Wed, Aug 30, 2023 at 11:29:34PM +0200, Pali Rohár wrote:
> > > 
> > > > There were no answers.
> > > > 
> > > > On Wednesday 30 August 2023 17:26:20 Tom Rini wrote:
> > > > > I'm trimming the CC list. All of those points you list were addressed
> > > > > and answered in your last long running argument. You need to decide what
> > > > > is best for you moving forward and I would ask that it not involve
> > > > > complaining that you're being asked to review code that you're a listed
> > > > > maintainer of.
> > > > > 
> > > > > On Wed, Aug 30, 2023 at 11:13:16PM +0200, Pali Rohár wrote:
> > > > > > Seems that you completely miss the point of the argument, then the only
> > > > > > option for such people is to repeat them. Or have I repeat you again
> > > > > > that you have not answered the first question, why you are asking for
> > > > > > review from somebody who you are ignoring and not taking into account?
> > > > > > You do not want to answer this question, right? So you rather change a
> > > > > > topic and talking about something totally different.
> > > > > > 
> > > > > > On Wednesday 30 August 2023 17:08:42 Tom Rini wrote:
> > > > > > > I don't think it's worth re-hashing the same arguments over and over.
> > > > > > > There is no "my persons", there is the public community.  If you no
> > > > > > > longer wish to participate, I can remove you from the maintainers
> > > > > > > entries you're listed in.  But please stop with the long arguments
> > > > > > > unrelated to the patches at hand when there's a dozen people and other
> > > > > > > lists on CC.
> > > > > > > 
> > > > > > > On Wed, Aug 30, 2023 at 10:51:45PM +0200, Pali Rohár wrote:
> > > > > > > > So lets recap what you and your persons have done in last 6 months:
> > > > > > > > 
> > > > > > > > * Ignored my changes
> > > > > > > > * Ignored my reviews
> > > > > > > > * Ignored my reminders
> > > 
> > > Not ignored, changes requested and refused.  Compromises refused.
> > > Apologies from others who had said they would pick up the platform and
> > > push it, but did not have time ignored.
> > > 
> > > > > > > > * Ignored my regression reports
> > > 
> > > Not ignored, debugged, problems with your platform implementation
> > > reported and questions asked, patches provided to help you debug the
> > > problem on the single place that seems to show a problem which no one
> > > else can reproduce ignored.
> > > 
> > > -- 
> > > Tom
> > 
> > 
> 
> -- 
> Tom



^ permalink raw reply	[flat|nested] 86+ messages in thread

* Re: [PATCH 32/32] pci: serial: Support reading PCI-register size with base
  2023-09-03 20:39     ` Pali Rohár
@ 2023-09-04 20:15       ` Pali Rohár
  2023-09-04 20:27         ` Tom Rini
  0 siblings, 1 reply; 86+ messages in thread
From: Pali Rohár @ 2023-09-04 20:15 UTC (permalink / raw)
  To: Simon Glass
  Cc: U-Boot Mailing List, Tom Rini, Marek Vasut, Abdellatif El Khlifi,
	Andre Przywara, Bin Meng, Chunfeng Yun, Dzmitry Sankouski,
	GSS_MTK_Uboot_upstream, Heinrich Schuchardt, Ilias Apalodimas,
	Michal Simek, Michal Suchanek, Nikhil M Jain, Ryder Lee,
	Stefan Roese, Weijie Gao

Simon, could you react here? Because Tom is complaining again that I'm
not responding to this email. But this is again total nonsense from Tom
as I have asked you to react 2 times, which provides that I'm not the
one who does not response here.

On Sunday 03 September 2023 22:39:39 Pali Rohár wrote:
> I still have not received any reply from you.
> 
> On Wednesday 30 August 2023 20:14:59 Pali Rohár wrote:
> > Simon, why you are contacting me? You have wrote to me that you would
> > ignore my reviews here, so what you want now? Could you please explain
> > what you are trying to achieve? I'm not going to review this or any
> > other your changes.
> > 
> > On Wednesday 30 August 2023 12:05:03 Simon Glass wrote:
> > > The PCI helpers read only the base address for a PCI region. In some cases
> > > the size is needed as well, e.g. to pass along to a driver which needs to
> > > know the size of its register area.
> > > 
> > > Update the functions to allow the size to be returned. For serial, record
> > > the information and provided it with the serial_info() call.
> > > 
> > > A limitation still exists in that the size is not available when OF_LIVE
> > > is enabled, so take account of that in the tests.
> > > 
> > > Signed-off-by: Simon Glass <sjg@chromium.org>
> > > ---
> > > 
> > >  arch/sandbox/dts/test.dts   |  6 +++---
> > >  drivers/core/fdtaddr.c      |  6 +++---
> > >  drivers/core/ofnode.c       | 11 ++++++++---
> > >  drivers/core/read.c         |  6 ++++--
> > >  drivers/core/util.c         |  2 +-
> > >  drivers/pci/pci-uclass.c    |  2 +-
> > >  drivers/pci/pci_mvebu.c     |  3 ++-
> > >  drivers/pci/pci_tegra.c     |  2 +-
> > >  drivers/pci/pcie_mediatek.c |  4 ++--
> > >  drivers/serial/ns16550.c    | 15 ++++++++++-----
> > >  include/dm/fdtaddr.h        |  3 ++-
> > >  include/dm/ofnode.h         |  4 +++-
> > >  include/dm/read.h           |  8 +++++---
> > >  include/ns16550.h           |  4 +++-
> > >  include/serial.h            |  2 ++
> > >  test/dm/pci.c               | 14 ++++++++++----
> > >  16 files changed, 60 insertions(+), 32 deletions(-)
> > > 
> > > diff --git a/arch/sandbox/dts/test.dts b/arch/sandbox/dts/test.dts
> > > index a413cbe4989..961e8895a49 100644
> > > --- a/arch/sandbox/dts/test.dts
> > > +++ b/arch/sandbox/dts/test.dts
> > > @@ -1087,8 +1087,8 @@
> > >  		pci@1,0 {
> > >  			compatible = "pci-generic";
> > >  			/* reg 0 is at 0x14, using FDT_PCI_SPACE_MEM32 */
> > > -			reg = <0x02000814 0 0 0 0
> > > -			       0x01000810 0 0 0 0>;
> > > +			reg = <0x02000814 0 0 0x80 0
> > > +			       0x01000810 0 0 0xc0 0>;
> > >  			sandbox,emul = <&swap_case_emul0_1>;
> > >  		};
> > >  		p2sb-pci@2,0 {
> > > @@ -1115,7 +1115,7 @@
> > >  		pci@1f,0 {
> > >  			compatible = "pci-generic";
> > >  			/* reg 0 is at 0x10, using FDT_PCI_SPACE_IO */
> > > -			reg = <0x0100f810 0 0 0 0>;
> > > +			reg = <0x0100f810 0 0 0x100 0>;
> > >  			sandbox,emul = <&swap_case_emul0_1f>;
> > >  		};
> > >  	};
> > > diff --git a/drivers/core/fdtaddr.c b/drivers/core/fdtaddr.c
> > > index 546db675aaf..b79d138c419 100644
> > > --- a/drivers/core/fdtaddr.c
> > > +++ b/drivers/core/fdtaddr.c
> > > @@ -215,7 +215,7 @@ void *devfdt_map_physmem(const struct udevice *dev, unsigned long size)
> > >  	return map_physmem(addr, size, MAP_NOCACHE);
> > >  }
> > >  
> > > -fdt_addr_t devfdt_get_addr_pci(const struct udevice *dev)
> > > +fdt_addr_t devfdt_get_addr_pci(const struct udevice *dev, fdt_size_t *sizep)
> > >  {
> > >  	ulong addr;
> > >  
> > > @@ -226,12 +226,12 @@ fdt_addr_t devfdt_get_addr_pci(const struct udevice *dev)
> > >  		int ret;
> > >  
> > >  		ret = ofnode_read_pci_addr(dev_ofnode(dev), FDT_PCI_SPACE_MEM32,
> > > -					   "reg", &pci_addr);
> > > +					   "reg", &pci_addr, sizep);
> > >  		if (ret) {
> > >  			/* try if there is any i/o-mapped register */
> > >  			ret = ofnode_read_pci_addr(dev_ofnode(dev),
> > >  						   FDT_PCI_SPACE_IO, "reg",
> > > -						   &pci_addr);
> > > +						   &pci_addr, sizep);
> > >  			if (ret)
> > >  				return FDT_ADDR_T_NONE;
> > >  		}
> > > diff --git a/drivers/core/ofnode.c b/drivers/core/ofnode.c
> > > index 2ef4114cb6f..c9cec456f43 100644
> > > --- a/drivers/core/ofnode.c
> > > +++ b/drivers/core/ofnode.c
> > > @@ -1270,7 +1270,8 @@ const uint8_t *ofnode_read_u8_array_ptr(ofnode node, const char *propname,
> > >  }
> > >  
> > >  int ofnode_read_pci_addr(ofnode node, enum fdt_pci_space type,
> > > -			 const char *propname, struct fdt_pci_addr *addr)
> > > +			 const char *propname, struct fdt_pci_addr *addr,
> > > +			 fdt_size_t *size)
> > >  {
> > >  	const fdt32_t *cell;
> > >  	int len;
> > > @@ -1298,14 +1299,18 @@ int ofnode_read_pci_addr(ofnode node, enum fdt_pci_space type,
> > >  			      (ulong)fdt32_to_cpu(cell[1]),
> > >  			      (ulong)fdt32_to_cpu(cell[2]));
> > >  			if ((fdt32_to_cpu(*cell) & type) == type) {
> > > +				const unaligned_fdt64_t *ptr;
> > > +
> > >  				addr->phys_hi = fdt32_to_cpu(cell[0]);
> > >  				addr->phys_mid = fdt32_to_cpu(cell[1]);
> > >  				addr->phys_lo = fdt32_to_cpu(cell[2]);
> > > +				ptr = (const unaligned_fdt64_t *)(cell + 3);
> > > +				if (size)
> > > +					*size = fdt64_to_cpu(*ptr);
> > >  				break;
> > >  			}
> > >  
> > > -			cell += (FDT_PCI_ADDR_CELLS +
> > > -				 FDT_PCI_SIZE_CELLS);
> > > +			cell += FDT_PCI_ADDR_CELLS + FDT_PCI_SIZE_CELLS;
> > >  		}
> > >  
> > >  		if (i == num) {
> > > diff --git a/drivers/core/read.c b/drivers/core/read.c
> > > index 49066b59cda..419013451f0 100644
> > > --- a/drivers/core/read.c
> > > +++ b/drivers/core/read.c
> > > @@ -405,13 +405,15 @@ int dev_read_alias_highest_id(const char *stem)
> > >  	return fdtdec_get_alias_highest_id(gd->fdt_blob, stem);
> > >  }
> > >  
> > > -fdt_addr_t dev_read_addr_pci(const struct udevice *dev)
> > > +fdt_addr_t dev_read_addr_pci(const struct udevice *dev, fdt_size_t *sizep)
> > >  {
> > >  	ulong addr;
> > >  
> > >  	addr = dev_read_addr(dev);
> > > +	if (sizep)
> > > +		*sizep = 0;
> > >  	if (addr == FDT_ADDR_T_NONE && !of_live_active())
> > > -		addr = devfdt_get_addr_pci(dev);
> > > +		addr = devfdt_get_addr_pci(dev, sizep);
> > >  
> > >  	return addr;
> > >  }
> > > diff --git a/drivers/core/util.c b/drivers/core/util.c
> > > index aa60fdd15bc..81497df85ff 100644
> > > --- a/drivers/core/util.c
> > > +++ b/drivers/core/util.c
> > > @@ -30,7 +30,7 @@ int pci_get_devfn(struct udevice *dev)
> > >  
> > >  	/* Extract the devfn from fdt_pci_addr */
> > >  	ret = ofnode_read_pci_addr(dev_ofnode(dev), FDT_PCI_SPACE_CONFIG,
> > > -				   "reg", &addr);
> > > +				   "reg", &addr, NULL);
> > >  	if (ret) {
> > >  		if (ret != -ENOENT)
> > >  			return -EINVAL;
> > > diff --git a/drivers/pci/pci-uclass.c b/drivers/pci/pci-uclass.c
> > > index 0adcdceb1d3..c670f8754e8 100644
> > > --- a/drivers/pci/pci-uclass.c
> > > +++ b/drivers/pci/pci-uclass.c
> > > @@ -122,7 +122,7 @@ static void pci_dev_find_ofnode(struct udevice *bus, phys_addr_t bdf,
> > >  
> > >  	dev_for_each_subnode(node, bus) {
> > >  		ret = ofnode_read_pci_addr(node, FDT_PCI_SPACE_CONFIG, "reg",
> > > -					   &addr);
> > > +					   &addr, NULL);
> > >  		if (ret)
> > >  			continue;
> > >  
> > > diff --git a/drivers/pci/pci_mvebu.c b/drivers/pci/pci_mvebu.c
> > > index 93a7508d8a2..25878bde534 100644
> > > --- a/drivers/pci/pci_mvebu.c
> > > +++ b/drivers/pci/pci_mvebu.c
> > > @@ -640,7 +640,8 @@ static int mvebu_pcie_port_parse_dt(ofnode node, ofnode parent, struct mvebu_pci
> > >  		pcie->is_x4 = true;
> > >  
> > >  	/* devfn is in bits [15:8], see PCI_DEV usage */
> > > -	ret = ofnode_read_pci_addr(node, FDT_PCI_SPACE_CONFIG, "reg", &pci_addr);
> > > +	ret = ofnode_read_pci_addr(node, FDT_PCI_SPACE_CONFIG, "reg", &pci_addr,
> > > +				   NULL);
> > >  	if (ret < 0) {
> > >  		printf("%s: property \"reg\" is invalid\n", pcie->name);
> > >  		goto err;
> > > diff --git a/drivers/pci/pci_tegra.c b/drivers/pci/pci_tegra.c
> > > index 29d54117e93..ae90bd2fbf1 100644
> > > --- a/drivers/pci/pci_tegra.c
> > > +++ b/drivers/pci/pci_tegra.c
> > > @@ -461,7 +461,7 @@ static int tegra_pcie_parse_port_info(ofnode node, uint *index, uint *lanes)
> > >  
> > >  	*lanes = err;
> > >  
> > > -	err = ofnode_read_pci_addr(node, 0, "reg", &addr);
> > > +	err = ofnode_read_pci_addr(node, 0, "reg", &addr, NULL);
> > >  	if (err < 0) {
> > >  		pr_err("failed to parse \"reg\" property\n");
> > >  		return err;
> > > diff --git a/drivers/pci/pcie_mediatek.c b/drivers/pci/pcie_mediatek.c
> > > index c6e30e24622..e59ebd13ad0 100644
> > > --- a/drivers/pci/pcie_mediatek.c
> > > +++ b/drivers/pci/pcie_mediatek.c
> > > @@ -660,7 +660,7 @@ static int mtk_pcie_probe(struct udevice *dev)
> > >  		if (!ofnode_is_enabled(subnode))
> > >  			continue;
> > >  
> > > -		err = ofnode_read_pci_addr(subnode, 0, "reg", &addr);
> > > +		err = ofnode_read_pci_addr(subnode, 0, "reg", &addr, NULL);
> > >  		if (err)
> > >  			return err;
> > >  
> > > @@ -699,7 +699,7 @@ static int mtk_pcie_probe_v2(struct udevice *dev)
> > >  		if (!ofnode_is_enabled(subnode))
> > >  			continue;
> > >  
> > > -		err = ofnode_read_pci_addr(subnode, 0, "reg", &addr);
> > > +		err = ofnode_read_pci_addr(subnode, 0, "reg", &addr, NULL);
> > >  		if (err)
> > >  			return err;
> > >  
> > > diff --git a/drivers/serial/ns16550.c b/drivers/serial/ns16550.c
> > > index eab9537fbae..a349e5e132a 100644
> > > --- a/drivers/serial/ns16550.c
> > > +++ b/drivers/serial/ns16550.c
> > > @@ -479,6 +479,7 @@ static int ns16550_serial_getinfo(struct udevice *dev,
> > >  	info->addr_space = SERIAL_ADDRESS_SPACE_MEMORY;
> > >  #endif
> > >  	info->addr = plat->base;
> > > +	info->size = plat->size;
> > >  	info->reg_width = plat->reg_width;
> > >  	info->reg_shift = plat->reg_shift;
> > >  	info->reg_offset = plat->reg_offset;
> > > @@ -487,7 +488,8 @@ static int ns16550_serial_getinfo(struct udevice *dev,
> > >  	return 0;
> > >  }
> > >  
> > > -static int ns16550_serial_assign_base(struct ns16550_plat *plat, fdt_addr_t base)
> > > +static int ns16550_serial_assign_base(struct ns16550_plat *plat,
> > > +				      fdt_addr_t base, fdt_size_t size)
> > >  {
> > >  	if (base == FDT_ADDR_T_NONE)
> > >  		return -EINVAL;
> > > @@ -497,6 +499,7 @@ static int ns16550_serial_assign_base(struct ns16550_plat *plat, fdt_addr_t base
> > >  #else
> > >  	plat->base = (unsigned long)map_physmem(base, 0, MAP_NOCACHE);
> > >  #endif
> > > +	plat->size = size;
> > >  
> > >  	return 0;
> > >  }
> > > @@ -507,6 +510,7 @@ int ns16550_serial_probe(struct udevice *dev)
> > >  	struct ns16550 *const com_port = dev_get_priv(dev);
> > >  	struct reset_ctl_bulk reset_bulk;
> > >  	fdt_addr_t addr;
> > > +	fdt_addr_t size;
> > >  	int ret;
> > >  
> > >  	/*
> > > @@ -514,8 +518,8 @@ int ns16550_serial_probe(struct udevice *dev)
> > >  	 * or via a PCI bridge, assign plat->base before probing hardware.
> > >  	 */
> > >  	if (device_is_on_pci_bus(dev)) {
> > > -		addr = devfdt_get_addr_pci(dev);
> > > -		ret = ns16550_serial_assign_base(plat, addr);
> > > +		addr = devfdt_get_addr_pci(dev, &size);
> > > +		ret = ns16550_serial_assign_base(plat, addr, size);
> > >  		if (ret)
> > >  			return ret;
> > >  	}
> > > @@ -543,11 +547,12 @@ int ns16550_serial_of_to_plat(struct udevice *dev)
> > >  	struct ns16550_plat *plat = dev_get_plat(dev);
> > >  	const u32 port_type = dev_get_driver_data(dev);
> > >  	fdt_addr_t addr;
> > > +	fdt_size_t size;
> > >  	struct clk clk;
> > >  	int err;
> > >  
> > > -	addr = dev_read_addr(dev);
> > > -	err = ns16550_serial_assign_base(plat, addr);
> > > +	addr = dev_read_addr_size(dev, &size);
> > > +	err = ns16550_serial_assign_base(plat, addr, size);
> > >  	if (err && !device_is_on_pci_bus(dev))
> > >  		return err;
> > >  
> > > diff --git a/include/dm/fdtaddr.h b/include/dm/fdtaddr.h
> > > index dcdc19137cc..6d2fa8f1044 100644
> > > --- a/include/dm/fdtaddr.h
> > > +++ b/include/dm/fdtaddr.h
> > > @@ -168,8 +168,9 @@ fdt_addr_t devfdt_get_addr_size_name(const struct udevice *dev,
> > >   * devfdt_get_addr_pci() - Read an address and handle PCI address translation
> > >   *
> > >   * @dev: Device to read from
> > > + * @sizep: If non-NULL, returns size of address space
> > >   * Return: address or FDT_ADDR_T_NONE if not found
> > >   */
> > > -fdt_addr_t devfdt_get_addr_pci(const struct udevice *dev);
> > > +fdt_addr_t devfdt_get_addr_pci(const struct udevice *dev, fdt_size_t *sizep);
> > >  
> > >  #endif
> > > diff --git a/include/dm/ofnode.h b/include/dm/ofnode.h
> > > index 726d8f82ddf..97cad971611 100644
> > > --- a/include/dm/ofnode.h
> > > +++ b/include/dm/ofnode.h
> > > @@ -1152,13 +1152,15 @@ const uint8_t *ofnode_read_u8_array_ptr(ofnode node, const char *propname,
> > >   * @type:	pci address type (FDT_PCI_SPACE_xxx)
> > >   * @propname:	name of property to find
> > >   * @addr:	returns pci address in the form of fdt_pci_addr
> > > + * @size:	if non-null, returns register-space size
> > >   * Return:
> > >   * 0 if ok, -ENOENT if the property did not exist, -EINVAL if the
> > >   * format of the property was invalid, -ENXIO if the requested
> > >   * address type was not found
> > >   */
> > >  int ofnode_read_pci_addr(ofnode node, enum fdt_pci_space type,
> > > -			 const char *propname, struct fdt_pci_addr *addr);
> > > +			 const char *propname, struct fdt_pci_addr *addr,
> > > +			 fdt_size_t *size);
> > >  
> > >  /**
> > >   * ofnode_read_pci_vendev() - look up PCI vendor and device id
> > > diff --git a/include/dm/read.h b/include/dm/read.h
> > > index c2615f72f40..3c2eea6f0c4 100644
> > > --- a/include/dm/read.h
> > > +++ b/include/dm/read.h
> > > @@ -346,9 +346,10 @@ void *dev_read_addr_ptr(const struct udevice *dev);
> > >   *    fdtdec_get_addr() and friends.
> > >   *
> > >   * @dev: Device to read from
> > > + * @sizep: If non-NULL, returns size of address space found
> > >   * Return: address or FDT_ADDR_T_NONE if not found
> > >   */
> > > -fdt_addr_t dev_read_addr_pci(const struct udevice *dev);
> > > +fdt_addr_t dev_read_addr_pci(const struct udevice *dev, fdt_size_t *sizep);
> > >  
> > >  /**
> > >   * dev_remap_addr() - Get the reg property of a device as a
> > > @@ -996,9 +997,10 @@ static inline void *dev_read_addr_ptr(const struct udevice *dev)
> > >  	return devfdt_get_addr_ptr(dev);
> > >  }
> > >  
> > > -static inline fdt_addr_t dev_read_addr_pci(const struct udevice *dev)
> > > +static inline fdt_addr_t dev_read_addr_pci(const struct udevice *dev,
> > > +					   fdt_size_t *sizep)
> > >  {
> > > -	return devfdt_get_addr_pci(dev);
> > > +	return devfdt_get_addr_pci(dev, sizep);
> > >  }
> > >  
> > >  static inline void *dev_remap_addr(const struct udevice *dev)
> > > diff --git a/include/ns16550.h b/include/ns16550.h
> > > index e7e68663d03..7f481300083 100644
> > > --- a/include/ns16550.h
> > > +++ b/include/ns16550.h
> > > @@ -58,6 +58,7 @@ enum ns16550_flags {
> > >   * struct ns16550_plat - information about a NS16550 port
> > >   *
> > >   * @base:		Base register address
> > > + * @size:		Size of register area in bytes
> > >   * @reg_width:		IO accesses size of registers (in bytes, 1 or 4)
> > >   * @reg_shift:		Shift size of registers (0=byte, 1=16bit, 2=32bit...)
> > >   * @reg_offset:		Offset to start of registers (normally 0)
> > > @@ -67,7 +68,8 @@ enum ns16550_flags {
> > >   * @bdf:		PCI slot/function (pci_dev_t)
> > >   */
> > >  struct ns16550_plat {
> > > -	unsigned long base;
> > > +	ulong base;
> > > +	ulong size;
> > >  	int reg_width;
> > >  	int reg_shift;
> > >  	int reg_offset;
> > > diff --git a/include/serial.h b/include/serial.h
> > > index 42bdf3759c0..205889d28be 100644
> > > --- a/include/serial.h
> > > +++ b/include/serial.h
> > > @@ -137,6 +137,7 @@ enum adr_space_type {
> > >   * @type:	type of the UART chip
> > >   * @addr_space:	address space to access the registers
> > >   * @addr:	physical address of the registers
> > > + * @size:	size of the register area in bytes
> > >   * @reg_width:	size (in bytes) of the IO accesses to the registers
> > >   * @reg_offset:	offset to apply to the @addr from the start of the registers
> > >   * @reg_shift:	quantity to shift the register offsets by
> > > @@ -147,6 +148,7 @@ struct serial_device_info {
> > >  	enum serial_chip_type type;
> > >  	enum adr_space_type addr_space;
> > >  	ulong addr;
> > > +	ulong size;
> > >  	u8 reg_width;
> > >  	u8 reg_offset;
> > >  	u8 reg_shift;
> > > diff --git a/test/dm/pci.c b/test/dm/pci.c
> > > index 70a736cfdb8..8c5e7da9e62 100644
> > > --- a/test/dm/pci.c
> > > +++ b/test/dm/pci.c
> > > @@ -301,10 +301,12 @@ static int dm_test_pci_addr_flat(struct unit_test_state *uts)
> > >  {
> > >  	struct udevice *swap1f, *swap1;
> > >  	ulong io_addr, mem_addr;
> > > +	fdt_addr_t size;
> > >  
> > >  	ut_assertok(dm_pci_bus_find_bdf(PCI_BDF(0, 0x1f, 0), &swap1f));
> > >  	io_addr = dm_pci_read_bar32(swap1f, 0);
> > > -	ut_asserteq(io_addr, dev_read_addr_pci(swap1f));
> > > +	ut_asserteq(io_addr, dev_read_addr_pci(swap1f, &size));
> > > +	ut_asserteq(0, size);
> > >  
> > >  	/*
> > >  	 * This device has both I/O and MEM spaces but the MEM space appears
> > > @@ -312,7 +314,8 @@ static int dm_test_pci_addr_flat(struct unit_test_state *uts)
> > >  	 */
> > >  	ut_assertok(dm_pci_bus_find_bdf(PCI_BDF(0, 0x1, 0), &swap1));
> > >  	mem_addr = dm_pci_read_bar32(swap1, 1);
> > > -	ut_asserteq(mem_addr, dev_read_addr_pci(swap1));
> > > +	ut_asserteq(mem_addr, dev_read_addr_pci(swap1, &size));
> > > +	ut_asserteq(0, size);
> > >  
> > >  	return 0;
> > >  }
> > > @@ -329,12 +332,15 @@ DM_TEST(dm_test_pci_addr_flat, UT_TESTF_SCAN_PDATA | UT_TESTF_SCAN_FDT |
> > >  static int dm_test_pci_addr_live(struct unit_test_state *uts)
> > >  {
> > >  	struct udevice *swap1f, *swap1;
> > > +	fdt_size_t size;
> > >  
> > >  	ut_assertok(dm_pci_bus_find_bdf(PCI_BDF(0, 0x1f, 0), &swap1f));
> > > -	ut_asserteq_64(FDT_ADDR_T_NONE, dev_read_addr_pci(swap1f));
> > > +	ut_asserteq_64(FDT_ADDR_T_NONE, dev_read_addr_pci(swap1f, &size));
> > > +	ut_asserteq(0, size);
> > >  
> > >  	ut_assertok(dm_pci_bus_find_bdf(PCI_BDF(0, 0x1, 0), &swap1));
> > > -	ut_asserteq_64(FDT_ADDR_T_NONE, dev_read_addr_pci(swap1));
> > > +	ut_asserteq_64(FDT_ADDR_T_NONE, dev_read_addr_pci(swap1, &size));
> > > +	ut_asserteq(0, size);
> > >  
> > >  	return 0;
> > >  }
> > > -- 
> > > 2.42.0.rc2.253.gd59a3bf2b4-goog
> > > 

^ permalink raw reply	[flat|nested] 86+ messages in thread

* Re: [PATCH 32/32] pci: serial: Support reading PCI-register size with base
  2023-09-04 20:15       ` Pali Rohár
@ 2023-09-04 20:27         ` Tom Rini
  2023-09-04 21:07           ` Pali Rohár
  0 siblings, 1 reply; 86+ messages in thread
From: Tom Rini @ 2023-09-04 20:27 UTC (permalink / raw)
  To: Pali Rohár
  Cc: Simon Glass, U-Boot Mailing List, Marek Vasut,
	Abdellatif El Khlifi, Andre Przywara, Bin Meng, Chunfeng Yun,
	Dzmitry Sankouski, GSS_MTK_Uboot_upstream, Heinrich Schuchardt,
	Ilias Apalodimas, Michal Simek, Michal Suchanek, Nikhil M Jain,
	Ryder Lee, Stefan Roese, Weijie Gao

[-- Attachment #1: Type: text/plain, Size: 20327 bytes --]

Simon has filtered your emails, which I believe he even told you, after
how much you were berating him in a previous thread.  That's why he's
not responding and I'm answering your only relevant to this thread
question so far.  He cc'd you because a file you're listed as maintainer
on was changed.  If you had negative feedback on this change itself,
yes, I'd have gone through and let him know there's something he needs
to look at.  However, you've so far only taken this an in invitation to
once again air all of your grievances.

On Mon, Sep 04, 2023 at 10:15:14PM +0200, Pali Rohár wrote:
> Simon, could you react here? Because Tom is complaining again that I'm
> not responding to this email. But this is again total nonsense from Tom
> as I have asked you to react 2 times, which provides that I'm not the
> one who does not response here.
> 
> On Sunday 03 September 2023 22:39:39 Pali Rohár wrote:
> > I still have not received any reply from you.
> > 
> > On Wednesday 30 August 2023 20:14:59 Pali Rohár wrote:
> > > Simon, why you are contacting me? You have wrote to me that you would
> > > ignore my reviews here, so what you want now? Could you please explain
> > > what you are trying to achieve? I'm not going to review this or any
> > > other your changes.
> > > 
> > > On Wednesday 30 August 2023 12:05:03 Simon Glass wrote:
> > > > The PCI helpers read only the base address for a PCI region. In some cases
> > > > the size is needed as well, e.g. to pass along to a driver which needs to
> > > > know the size of its register area.
> > > > 
> > > > Update the functions to allow the size to be returned. For serial, record
> > > > the information and provided it with the serial_info() call.
> > > > 
> > > > A limitation still exists in that the size is not available when OF_LIVE
> > > > is enabled, so take account of that in the tests.
> > > > 
> > > > Signed-off-by: Simon Glass <sjg@chromium.org>
> > > > ---
> > > > 
> > > >  arch/sandbox/dts/test.dts   |  6 +++---
> > > >  drivers/core/fdtaddr.c      |  6 +++---
> > > >  drivers/core/ofnode.c       | 11 ++++++++---
> > > >  drivers/core/read.c         |  6 ++++--
> > > >  drivers/core/util.c         |  2 +-
> > > >  drivers/pci/pci-uclass.c    |  2 +-
> > > >  drivers/pci/pci_mvebu.c     |  3 ++-
> > > >  drivers/pci/pci_tegra.c     |  2 +-
> > > >  drivers/pci/pcie_mediatek.c |  4 ++--
> > > >  drivers/serial/ns16550.c    | 15 ++++++++++-----
> > > >  include/dm/fdtaddr.h        |  3 ++-
> > > >  include/dm/ofnode.h         |  4 +++-
> > > >  include/dm/read.h           |  8 +++++---
> > > >  include/ns16550.h           |  4 +++-
> > > >  include/serial.h            |  2 ++
> > > >  test/dm/pci.c               | 14 ++++++++++----
> > > >  16 files changed, 60 insertions(+), 32 deletions(-)
> > > > 
> > > > diff --git a/arch/sandbox/dts/test.dts b/arch/sandbox/dts/test.dts
> > > > index a413cbe4989..961e8895a49 100644
> > > > --- a/arch/sandbox/dts/test.dts
> > > > +++ b/arch/sandbox/dts/test.dts
> > > > @@ -1087,8 +1087,8 @@
> > > >  		pci@1,0 {
> > > >  			compatible = "pci-generic";
> > > >  			/* reg 0 is at 0x14, using FDT_PCI_SPACE_MEM32 */
> > > > -			reg = <0x02000814 0 0 0 0
> > > > -			       0x01000810 0 0 0 0>;
> > > > +			reg = <0x02000814 0 0 0x80 0
> > > > +			       0x01000810 0 0 0xc0 0>;
> > > >  			sandbox,emul = <&swap_case_emul0_1>;
> > > >  		};
> > > >  		p2sb-pci@2,0 {
> > > > @@ -1115,7 +1115,7 @@
> > > >  		pci@1f,0 {
> > > >  			compatible = "pci-generic";
> > > >  			/* reg 0 is at 0x10, using FDT_PCI_SPACE_IO */
> > > > -			reg = <0x0100f810 0 0 0 0>;
> > > > +			reg = <0x0100f810 0 0 0x100 0>;
> > > >  			sandbox,emul = <&swap_case_emul0_1f>;
> > > >  		};
> > > >  	};
> > > > diff --git a/drivers/core/fdtaddr.c b/drivers/core/fdtaddr.c
> > > > index 546db675aaf..b79d138c419 100644
> > > > --- a/drivers/core/fdtaddr.c
> > > > +++ b/drivers/core/fdtaddr.c
> > > > @@ -215,7 +215,7 @@ void *devfdt_map_physmem(const struct udevice *dev, unsigned long size)
> > > >  	return map_physmem(addr, size, MAP_NOCACHE);
> > > >  }
> > > >  
> > > > -fdt_addr_t devfdt_get_addr_pci(const struct udevice *dev)
> > > > +fdt_addr_t devfdt_get_addr_pci(const struct udevice *dev, fdt_size_t *sizep)
> > > >  {
> > > >  	ulong addr;
> > > >  
> > > > @@ -226,12 +226,12 @@ fdt_addr_t devfdt_get_addr_pci(const struct udevice *dev)
> > > >  		int ret;
> > > >  
> > > >  		ret = ofnode_read_pci_addr(dev_ofnode(dev), FDT_PCI_SPACE_MEM32,
> > > > -					   "reg", &pci_addr);
> > > > +					   "reg", &pci_addr, sizep);
> > > >  		if (ret) {
> > > >  			/* try if there is any i/o-mapped register */
> > > >  			ret = ofnode_read_pci_addr(dev_ofnode(dev),
> > > >  						   FDT_PCI_SPACE_IO, "reg",
> > > > -						   &pci_addr);
> > > > +						   &pci_addr, sizep);
> > > >  			if (ret)
> > > >  				return FDT_ADDR_T_NONE;
> > > >  		}
> > > > diff --git a/drivers/core/ofnode.c b/drivers/core/ofnode.c
> > > > index 2ef4114cb6f..c9cec456f43 100644
> > > > --- a/drivers/core/ofnode.c
> > > > +++ b/drivers/core/ofnode.c
> > > > @@ -1270,7 +1270,8 @@ const uint8_t *ofnode_read_u8_array_ptr(ofnode node, const char *propname,
> > > >  }
> > > >  
> > > >  int ofnode_read_pci_addr(ofnode node, enum fdt_pci_space type,
> > > > -			 const char *propname, struct fdt_pci_addr *addr)
> > > > +			 const char *propname, struct fdt_pci_addr *addr,
> > > > +			 fdt_size_t *size)
> > > >  {
> > > >  	const fdt32_t *cell;
> > > >  	int len;
> > > > @@ -1298,14 +1299,18 @@ int ofnode_read_pci_addr(ofnode node, enum fdt_pci_space type,
> > > >  			      (ulong)fdt32_to_cpu(cell[1]),
> > > >  			      (ulong)fdt32_to_cpu(cell[2]));
> > > >  			if ((fdt32_to_cpu(*cell) & type) == type) {
> > > > +				const unaligned_fdt64_t *ptr;
> > > > +
> > > >  				addr->phys_hi = fdt32_to_cpu(cell[0]);
> > > >  				addr->phys_mid = fdt32_to_cpu(cell[1]);
> > > >  				addr->phys_lo = fdt32_to_cpu(cell[2]);
> > > > +				ptr = (const unaligned_fdt64_t *)(cell + 3);
> > > > +				if (size)
> > > > +					*size = fdt64_to_cpu(*ptr);
> > > >  				break;
> > > >  			}
> > > >  
> > > > -			cell += (FDT_PCI_ADDR_CELLS +
> > > > -				 FDT_PCI_SIZE_CELLS);
> > > > +			cell += FDT_PCI_ADDR_CELLS + FDT_PCI_SIZE_CELLS;
> > > >  		}
> > > >  
> > > >  		if (i == num) {
> > > > diff --git a/drivers/core/read.c b/drivers/core/read.c
> > > > index 49066b59cda..419013451f0 100644
> > > > --- a/drivers/core/read.c
> > > > +++ b/drivers/core/read.c
> > > > @@ -405,13 +405,15 @@ int dev_read_alias_highest_id(const char *stem)
> > > >  	return fdtdec_get_alias_highest_id(gd->fdt_blob, stem);
> > > >  }
> > > >  
> > > > -fdt_addr_t dev_read_addr_pci(const struct udevice *dev)
> > > > +fdt_addr_t dev_read_addr_pci(const struct udevice *dev, fdt_size_t *sizep)
> > > >  {
> > > >  	ulong addr;
> > > >  
> > > >  	addr = dev_read_addr(dev);
> > > > +	if (sizep)
> > > > +		*sizep = 0;
> > > >  	if (addr == FDT_ADDR_T_NONE && !of_live_active())
> > > > -		addr = devfdt_get_addr_pci(dev);
> > > > +		addr = devfdt_get_addr_pci(dev, sizep);
> > > >  
> > > >  	return addr;
> > > >  }
> > > > diff --git a/drivers/core/util.c b/drivers/core/util.c
> > > > index aa60fdd15bc..81497df85ff 100644
> > > > --- a/drivers/core/util.c
> > > > +++ b/drivers/core/util.c
> > > > @@ -30,7 +30,7 @@ int pci_get_devfn(struct udevice *dev)
> > > >  
> > > >  	/* Extract the devfn from fdt_pci_addr */
> > > >  	ret = ofnode_read_pci_addr(dev_ofnode(dev), FDT_PCI_SPACE_CONFIG,
> > > > -				   "reg", &addr);
> > > > +				   "reg", &addr, NULL);
> > > >  	if (ret) {
> > > >  		if (ret != -ENOENT)
> > > >  			return -EINVAL;
> > > > diff --git a/drivers/pci/pci-uclass.c b/drivers/pci/pci-uclass.c
> > > > index 0adcdceb1d3..c670f8754e8 100644
> > > > --- a/drivers/pci/pci-uclass.c
> > > > +++ b/drivers/pci/pci-uclass.c
> > > > @@ -122,7 +122,7 @@ static void pci_dev_find_ofnode(struct udevice *bus, phys_addr_t bdf,
> > > >  
> > > >  	dev_for_each_subnode(node, bus) {
> > > >  		ret = ofnode_read_pci_addr(node, FDT_PCI_SPACE_CONFIG, "reg",
> > > > -					   &addr);
> > > > +					   &addr, NULL);
> > > >  		if (ret)
> > > >  			continue;
> > > >  
> > > > diff --git a/drivers/pci/pci_mvebu.c b/drivers/pci/pci_mvebu.c
> > > > index 93a7508d8a2..25878bde534 100644
> > > > --- a/drivers/pci/pci_mvebu.c
> > > > +++ b/drivers/pci/pci_mvebu.c
> > > > @@ -640,7 +640,8 @@ static int mvebu_pcie_port_parse_dt(ofnode node, ofnode parent, struct mvebu_pci
> > > >  		pcie->is_x4 = true;
> > > >  
> > > >  	/* devfn is in bits [15:8], see PCI_DEV usage */
> > > > -	ret = ofnode_read_pci_addr(node, FDT_PCI_SPACE_CONFIG, "reg", &pci_addr);
> > > > +	ret = ofnode_read_pci_addr(node, FDT_PCI_SPACE_CONFIG, "reg", &pci_addr,
> > > > +				   NULL);
> > > >  	if (ret < 0) {
> > > >  		printf("%s: property \"reg\" is invalid\n", pcie->name);
> > > >  		goto err;
> > > > diff --git a/drivers/pci/pci_tegra.c b/drivers/pci/pci_tegra.c
> > > > index 29d54117e93..ae90bd2fbf1 100644
> > > > --- a/drivers/pci/pci_tegra.c
> > > > +++ b/drivers/pci/pci_tegra.c
> > > > @@ -461,7 +461,7 @@ static int tegra_pcie_parse_port_info(ofnode node, uint *index, uint *lanes)
> > > >  
> > > >  	*lanes = err;
> > > >  
> > > > -	err = ofnode_read_pci_addr(node, 0, "reg", &addr);
> > > > +	err = ofnode_read_pci_addr(node, 0, "reg", &addr, NULL);
> > > >  	if (err < 0) {
> > > >  		pr_err("failed to parse \"reg\" property\n");
> > > >  		return err;
> > > > diff --git a/drivers/pci/pcie_mediatek.c b/drivers/pci/pcie_mediatek.c
> > > > index c6e30e24622..e59ebd13ad0 100644
> > > > --- a/drivers/pci/pcie_mediatek.c
> > > > +++ b/drivers/pci/pcie_mediatek.c
> > > > @@ -660,7 +660,7 @@ static int mtk_pcie_probe(struct udevice *dev)
> > > >  		if (!ofnode_is_enabled(subnode))
> > > >  			continue;
> > > >  
> > > > -		err = ofnode_read_pci_addr(subnode, 0, "reg", &addr);
> > > > +		err = ofnode_read_pci_addr(subnode, 0, "reg", &addr, NULL);
> > > >  		if (err)
> > > >  			return err;
> > > >  
> > > > @@ -699,7 +699,7 @@ static int mtk_pcie_probe_v2(struct udevice *dev)
> > > >  		if (!ofnode_is_enabled(subnode))
> > > >  			continue;
> > > >  
> > > > -		err = ofnode_read_pci_addr(subnode, 0, "reg", &addr);
> > > > +		err = ofnode_read_pci_addr(subnode, 0, "reg", &addr, NULL);
> > > >  		if (err)
> > > >  			return err;
> > > >  
> > > > diff --git a/drivers/serial/ns16550.c b/drivers/serial/ns16550.c
> > > > index eab9537fbae..a349e5e132a 100644
> > > > --- a/drivers/serial/ns16550.c
> > > > +++ b/drivers/serial/ns16550.c
> > > > @@ -479,6 +479,7 @@ static int ns16550_serial_getinfo(struct udevice *dev,
> > > >  	info->addr_space = SERIAL_ADDRESS_SPACE_MEMORY;
> > > >  #endif
> > > >  	info->addr = plat->base;
> > > > +	info->size = plat->size;
> > > >  	info->reg_width = plat->reg_width;
> > > >  	info->reg_shift = plat->reg_shift;
> > > >  	info->reg_offset = plat->reg_offset;
> > > > @@ -487,7 +488,8 @@ static int ns16550_serial_getinfo(struct udevice *dev,
> > > >  	return 0;
> > > >  }
> > > >  
> > > > -static int ns16550_serial_assign_base(struct ns16550_plat *plat, fdt_addr_t base)
> > > > +static int ns16550_serial_assign_base(struct ns16550_plat *plat,
> > > > +				      fdt_addr_t base, fdt_size_t size)
> > > >  {
> > > >  	if (base == FDT_ADDR_T_NONE)
> > > >  		return -EINVAL;
> > > > @@ -497,6 +499,7 @@ static int ns16550_serial_assign_base(struct ns16550_plat *plat, fdt_addr_t base
> > > >  #else
> > > >  	plat->base = (unsigned long)map_physmem(base, 0, MAP_NOCACHE);
> > > >  #endif
> > > > +	plat->size = size;
> > > >  
> > > >  	return 0;
> > > >  }
> > > > @@ -507,6 +510,7 @@ int ns16550_serial_probe(struct udevice *dev)
> > > >  	struct ns16550 *const com_port = dev_get_priv(dev);
> > > >  	struct reset_ctl_bulk reset_bulk;
> > > >  	fdt_addr_t addr;
> > > > +	fdt_addr_t size;
> > > >  	int ret;
> > > >  
> > > >  	/*
> > > > @@ -514,8 +518,8 @@ int ns16550_serial_probe(struct udevice *dev)
> > > >  	 * or via a PCI bridge, assign plat->base before probing hardware.
> > > >  	 */
> > > >  	if (device_is_on_pci_bus(dev)) {
> > > > -		addr = devfdt_get_addr_pci(dev);
> > > > -		ret = ns16550_serial_assign_base(plat, addr);
> > > > +		addr = devfdt_get_addr_pci(dev, &size);
> > > > +		ret = ns16550_serial_assign_base(plat, addr, size);
> > > >  		if (ret)
> > > >  			return ret;
> > > >  	}
> > > > @@ -543,11 +547,12 @@ int ns16550_serial_of_to_plat(struct udevice *dev)
> > > >  	struct ns16550_plat *plat = dev_get_plat(dev);
> > > >  	const u32 port_type = dev_get_driver_data(dev);
> > > >  	fdt_addr_t addr;
> > > > +	fdt_size_t size;
> > > >  	struct clk clk;
> > > >  	int err;
> > > >  
> > > > -	addr = dev_read_addr(dev);
> > > > -	err = ns16550_serial_assign_base(plat, addr);
> > > > +	addr = dev_read_addr_size(dev, &size);
> > > > +	err = ns16550_serial_assign_base(plat, addr, size);
> > > >  	if (err && !device_is_on_pci_bus(dev))
> > > >  		return err;
> > > >  
> > > > diff --git a/include/dm/fdtaddr.h b/include/dm/fdtaddr.h
> > > > index dcdc19137cc..6d2fa8f1044 100644
> > > > --- a/include/dm/fdtaddr.h
> > > > +++ b/include/dm/fdtaddr.h
> > > > @@ -168,8 +168,9 @@ fdt_addr_t devfdt_get_addr_size_name(const struct udevice *dev,
> > > >   * devfdt_get_addr_pci() - Read an address and handle PCI address translation
> > > >   *
> > > >   * @dev: Device to read from
> > > > + * @sizep: If non-NULL, returns size of address space
> > > >   * Return: address or FDT_ADDR_T_NONE if not found
> > > >   */
> > > > -fdt_addr_t devfdt_get_addr_pci(const struct udevice *dev);
> > > > +fdt_addr_t devfdt_get_addr_pci(const struct udevice *dev, fdt_size_t *sizep);
> > > >  
> > > >  #endif
> > > > diff --git a/include/dm/ofnode.h b/include/dm/ofnode.h
> > > > index 726d8f82ddf..97cad971611 100644
> > > > --- a/include/dm/ofnode.h
> > > > +++ b/include/dm/ofnode.h
> > > > @@ -1152,13 +1152,15 @@ const uint8_t *ofnode_read_u8_array_ptr(ofnode node, const char *propname,
> > > >   * @type:	pci address type (FDT_PCI_SPACE_xxx)
> > > >   * @propname:	name of property to find
> > > >   * @addr:	returns pci address in the form of fdt_pci_addr
> > > > + * @size:	if non-null, returns register-space size
> > > >   * Return:
> > > >   * 0 if ok, -ENOENT if the property did not exist, -EINVAL if the
> > > >   * format of the property was invalid, -ENXIO if the requested
> > > >   * address type was not found
> > > >   */
> > > >  int ofnode_read_pci_addr(ofnode node, enum fdt_pci_space type,
> > > > -			 const char *propname, struct fdt_pci_addr *addr);
> > > > +			 const char *propname, struct fdt_pci_addr *addr,
> > > > +			 fdt_size_t *size);
> > > >  
> > > >  /**
> > > >   * ofnode_read_pci_vendev() - look up PCI vendor and device id
> > > > diff --git a/include/dm/read.h b/include/dm/read.h
> > > > index c2615f72f40..3c2eea6f0c4 100644
> > > > --- a/include/dm/read.h
> > > > +++ b/include/dm/read.h
> > > > @@ -346,9 +346,10 @@ void *dev_read_addr_ptr(const struct udevice *dev);
> > > >   *    fdtdec_get_addr() and friends.
> > > >   *
> > > >   * @dev: Device to read from
> > > > + * @sizep: If non-NULL, returns size of address space found
> > > >   * Return: address or FDT_ADDR_T_NONE if not found
> > > >   */
> > > > -fdt_addr_t dev_read_addr_pci(const struct udevice *dev);
> > > > +fdt_addr_t dev_read_addr_pci(const struct udevice *dev, fdt_size_t *sizep);
> > > >  
> > > >  /**
> > > >   * dev_remap_addr() - Get the reg property of a device as a
> > > > @@ -996,9 +997,10 @@ static inline void *dev_read_addr_ptr(const struct udevice *dev)
> > > >  	return devfdt_get_addr_ptr(dev);
> > > >  }
> > > >  
> > > > -static inline fdt_addr_t dev_read_addr_pci(const struct udevice *dev)
> > > > +static inline fdt_addr_t dev_read_addr_pci(const struct udevice *dev,
> > > > +					   fdt_size_t *sizep)
> > > >  {
> > > > -	return devfdt_get_addr_pci(dev);
> > > > +	return devfdt_get_addr_pci(dev, sizep);
> > > >  }
> > > >  
> > > >  static inline void *dev_remap_addr(const struct udevice *dev)
> > > > diff --git a/include/ns16550.h b/include/ns16550.h
> > > > index e7e68663d03..7f481300083 100644
> > > > --- a/include/ns16550.h
> > > > +++ b/include/ns16550.h
> > > > @@ -58,6 +58,7 @@ enum ns16550_flags {
> > > >   * struct ns16550_plat - information about a NS16550 port
> > > >   *
> > > >   * @base:		Base register address
> > > > + * @size:		Size of register area in bytes
> > > >   * @reg_width:		IO accesses size of registers (in bytes, 1 or 4)
> > > >   * @reg_shift:		Shift size of registers (0=byte, 1=16bit, 2=32bit...)
> > > >   * @reg_offset:		Offset to start of registers (normally 0)
> > > > @@ -67,7 +68,8 @@ enum ns16550_flags {
> > > >   * @bdf:		PCI slot/function (pci_dev_t)
> > > >   */
> > > >  struct ns16550_plat {
> > > > -	unsigned long base;
> > > > +	ulong base;
> > > > +	ulong size;
> > > >  	int reg_width;
> > > >  	int reg_shift;
> > > >  	int reg_offset;
> > > > diff --git a/include/serial.h b/include/serial.h
> > > > index 42bdf3759c0..205889d28be 100644
> > > > --- a/include/serial.h
> > > > +++ b/include/serial.h
> > > > @@ -137,6 +137,7 @@ enum adr_space_type {
> > > >   * @type:	type of the UART chip
> > > >   * @addr_space:	address space to access the registers
> > > >   * @addr:	physical address of the registers
> > > > + * @size:	size of the register area in bytes
> > > >   * @reg_width:	size (in bytes) of the IO accesses to the registers
> > > >   * @reg_offset:	offset to apply to the @addr from the start of the registers
> > > >   * @reg_shift:	quantity to shift the register offsets by
> > > > @@ -147,6 +148,7 @@ struct serial_device_info {
> > > >  	enum serial_chip_type type;
> > > >  	enum adr_space_type addr_space;
> > > >  	ulong addr;
> > > > +	ulong size;
> > > >  	u8 reg_width;
> > > >  	u8 reg_offset;
> > > >  	u8 reg_shift;
> > > > diff --git a/test/dm/pci.c b/test/dm/pci.c
> > > > index 70a736cfdb8..8c5e7da9e62 100644
> > > > --- a/test/dm/pci.c
> > > > +++ b/test/dm/pci.c
> > > > @@ -301,10 +301,12 @@ static int dm_test_pci_addr_flat(struct unit_test_state *uts)
> > > >  {
> > > >  	struct udevice *swap1f, *swap1;
> > > >  	ulong io_addr, mem_addr;
> > > > +	fdt_addr_t size;
> > > >  
> > > >  	ut_assertok(dm_pci_bus_find_bdf(PCI_BDF(0, 0x1f, 0), &swap1f));
> > > >  	io_addr = dm_pci_read_bar32(swap1f, 0);
> > > > -	ut_asserteq(io_addr, dev_read_addr_pci(swap1f));
> > > > +	ut_asserteq(io_addr, dev_read_addr_pci(swap1f, &size));
> > > > +	ut_asserteq(0, size);
> > > >  
> > > >  	/*
> > > >  	 * This device has both I/O and MEM spaces but the MEM space appears
> > > > @@ -312,7 +314,8 @@ static int dm_test_pci_addr_flat(struct unit_test_state *uts)
> > > >  	 */
> > > >  	ut_assertok(dm_pci_bus_find_bdf(PCI_BDF(0, 0x1, 0), &swap1));
> > > >  	mem_addr = dm_pci_read_bar32(swap1, 1);
> > > > -	ut_asserteq(mem_addr, dev_read_addr_pci(swap1));
> > > > +	ut_asserteq(mem_addr, dev_read_addr_pci(swap1, &size));
> > > > +	ut_asserteq(0, size);
> > > >  
> > > >  	return 0;
> > > >  }
> > > > @@ -329,12 +332,15 @@ DM_TEST(dm_test_pci_addr_flat, UT_TESTF_SCAN_PDATA | UT_TESTF_SCAN_FDT |
> > > >  static int dm_test_pci_addr_live(struct unit_test_state *uts)
> > > >  {
> > > >  	struct udevice *swap1f, *swap1;
> > > > +	fdt_size_t size;
> > > >  
> > > >  	ut_assertok(dm_pci_bus_find_bdf(PCI_BDF(0, 0x1f, 0), &swap1f));
> > > > -	ut_asserteq_64(FDT_ADDR_T_NONE, dev_read_addr_pci(swap1f));
> > > > +	ut_asserteq_64(FDT_ADDR_T_NONE, dev_read_addr_pci(swap1f, &size));
> > > > +	ut_asserteq(0, size);
> > > >  
> > > >  	ut_assertok(dm_pci_bus_find_bdf(PCI_BDF(0, 0x1, 0), &swap1));
> > > > -	ut_asserteq_64(FDT_ADDR_T_NONE, dev_read_addr_pci(swap1));
> > > > +	ut_asserteq_64(FDT_ADDR_T_NONE, dev_read_addr_pci(swap1, &size));
> > > > +	ut_asserteq(0, size);
> > > >  
> > > >  	return 0;
> > > >  }
> > > > -- 
> > > > 2.42.0.rc2.253.gd59a3bf2b4-goog
> > > > 

-- 
Tom

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 659 bytes --]

^ permalink raw reply	[flat|nested] 86+ messages in thread

* Re: [PATCH 32/32] pci: serial: Support reading PCI-register size with base
  2023-09-04 20:27         ` Tom Rini
@ 2023-09-04 21:07           ` Pali Rohár
  0 siblings, 0 replies; 86+ messages in thread
From: Pali Rohár @ 2023-09-04 21:07 UTC (permalink / raw)
  To: Tom Rini
  Cc: Simon Glass, U-Boot Mailing List, Marek Vasut,
	Abdellatif El Khlifi, Andre Przywara, Bin Meng, Chunfeng Yun,
	Dzmitry Sankouski, GSS_MTK_Uboot_upstream, Heinrich Schuchardt,
	Ilias Apalodimas, Michal Simek, Michal Suchanek, Nikhil M Jain,
	Ryder Lee, Stefan Roese, Weijie Gao

I'm not your bitch, and I would not do any feedback for somebody who
decided that do not want feedback from me. Why you are contacting me
then? Just to provoke me?

Either you want a feedback and will not ignore it. Or you do not want a
feedback and then you would not contact me.

I see that Simon is filtering me for a whole year, so this is not
something new. And I was very patient, I was asking very generously for
one whole year and I saw absolutely no response.

And if somebody is complaining that I started to be more offensive after
one year of waiting, then must be the rudest and idiotic person on the
whole world. This really is not a way how somebody can receive a
feedback from me. I would not use middlemen agent for sending feedback,

I have already pointed about bugs and regression what author of this
patch done. What was the result? You was happy that finally somebody was
able to break something about which I complained. So I see that you not
interested from any feedback and all this is just to continue provoke
me.

And I'm not even the person who started this discussion, the person who
sent the first email was Simon. So look again who is the reason. Or are
you blind and do not see who sent the first email there? I would not be
surprised as it is not the first time.

And I'm really not understand, why you are commenting this discussion.
Or are you secretary of the Simon?

On Monday 04 September 2023 16:27:52 Tom Rini wrote:
> Simon has filtered your emails, which I believe he even told you, after
> how much you were berating him in a previous thread.  That's why he's
> not responding and I'm answering your only relevant to this thread
> question so far.  He cc'd you because a file you're listed as maintainer
> on was changed.  If you had negative feedback on this change itself,
> yes, I'd have gone through and let him know there's something he needs
> to look at.  However, you've so far only taken this an in invitation to
> once again air all of your grievances.
> 
> On Mon, Sep 04, 2023 at 10:15:14PM +0200, Pali Rohár wrote:
> > Simon, could you react here? Because Tom is complaining again that I'm
> > not responding to this email. But this is again total nonsense from Tom
> > as I have asked you to react 2 times, which provides that I'm not the
> > one who does not response here.
> > 
> > On Sunday 03 September 2023 22:39:39 Pali Rohár wrote:
> > > I still have not received any reply from you.
> > > 
> > > On Wednesday 30 August 2023 20:14:59 Pali Rohár wrote:
> > > > Simon, why you are contacting me? You have wrote to me that you would
> > > > ignore my reviews here, so what you want now? Could you please explain
> > > > what you are trying to achieve? I'm not going to review this or any
> > > > other your changes.
> > > > 
> > > > On Wednesday 30 August 2023 12:05:03 Simon Glass wrote:
> > > > > The PCI helpers read only the base address for a PCI region. In some cases
> > > > > the size is needed as well, e.g. to pass along to a driver which needs to
> > > > > know the size of its register area.
> > > > > 
> > > > > Update the functions to allow the size to be returned. For serial, record
> > > > > the information and provided it with the serial_info() call.
> > > > > 
> > > > > A limitation still exists in that the size is not available when OF_LIVE
> > > > > is enabled, so take account of that in the tests.
> > > > > 
> > > > > Signed-off-by: Simon Glass <sjg@chromium.org>
> > > > > ---
> > > > > 
> > > > >  arch/sandbox/dts/test.dts   |  6 +++---
> > > > >  drivers/core/fdtaddr.c      |  6 +++---
> > > > >  drivers/core/ofnode.c       | 11 ++++++++---
> > > > >  drivers/core/read.c         |  6 ++++--
> > > > >  drivers/core/util.c         |  2 +-
> > > > >  drivers/pci/pci-uclass.c    |  2 +-
> > > > >  drivers/pci/pci_mvebu.c     |  3 ++-
> > > > >  drivers/pci/pci_tegra.c     |  2 +-
> > > > >  drivers/pci/pcie_mediatek.c |  4 ++--
> > > > >  drivers/serial/ns16550.c    | 15 ++++++++++-----
> > > > >  include/dm/fdtaddr.h        |  3 ++-
> > > > >  include/dm/ofnode.h         |  4 +++-
> > > > >  include/dm/read.h           |  8 +++++---
> > > > >  include/ns16550.h           |  4 +++-
> > > > >  include/serial.h            |  2 ++
> > > > >  test/dm/pci.c               | 14 ++++++++++----
> > > > >  16 files changed, 60 insertions(+), 32 deletions(-)
> > > > > 
> > > > > diff --git a/arch/sandbox/dts/test.dts b/arch/sandbox/dts/test.dts
> > > > > index a413cbe4989..961e8895a49 100644
> > > > > --- a/arch/sandbox/dts/test.dts
> > > > > +++ b/arch/sandbox/dts/test.dts
> > > > > @@ -1087,8 +1087,8 @@
> > > > >  		pci@1,0 {
> > > > >  			compatible = "pci-generic";
> > > > >  			/* reg 0 is at 0x14, using FDT_PCI_SPACE_MEM32 */
> > > > > -			reg = <0x02000814 0 0 0 0
> > > > > -			       0x01000810 0 0 0 0>;
> > > > > +			reg = <0x02000814 0 0 0x80 0
> > > > > +			       0x01000810 0 0 0xc0 0>;
> > > > >  			sandbox,emul = <&swap_case_emul0_1>;
> > > > >  		};
> > > > >  		p2sb-pci@2,0 {
> > > > > @@ -1115,7 +1115,7 @@
> > > > >  		pci@1f,0 {
> > > > >  			compatible = "pci-generic";
> > > > >  			/* reg 0 is at 0x10, using FDT_PCI_SPACE_IO */
> > > > > -			reg = <0x0100f810 0 0 0 0>;
> > > > > +			reg = <0x0100f810 0 0 0x100 0>;
> > > > >  			sandbox,emul = <&swap_case_emul0_1f>;
> > > > >  		};
> > > > >  	};
> > > > > diff --git a/drivers/core/fdtaddr.c b/drivers/core/fdtaddr.c
> > > > > index 546db675aaf..b79d138c419 100644
> > > > > --- a/drivers/core/fdtaddr.c
> > > > > +++ b/drivers/core/fdtaddr.c
> > > > > @@ -215,7 +215,7 @@ void *devfdt_map_physmem(const struct udevice *dev, unsigned long size)
> > > > >  	return map_physmem(addr, size, MAP_NOCACHE);
> > > > >  }
> > > > >  
> > > > > -fdt_addr_t devfdt_get_addr_pci(const struct udevice *dev)
> > > > > +fdt_addr_t devfdt_get_addr_pci(const struct udevice *dev, fdt_size_t *sizep)
> > > > >  {
> > > > >  	ulong addr;
> > > > >  
> > > > > @@ -226,12 +226,12 @@ fdt_addr_t devfdt_get_addr_pci(const struct udevice *dev)
> > > > >  		int ret;
> > > > >  
> > > > >  		ret = ofnode_read_pci_addr(dev_ofnode(dev), FDT_PCI_SPACE_MEM32,
> > > > > -					   "reg", &pci_addr);
> > > > > +					   "reg", &pci_addr, sizep);
> > > > >  		if (ret) {
> > > > >  			/* try if there is any i/o-mapped register */
> > > > >  			ret = ofnode_read_pci_addr(dev_ofnode(dev),
> > > > >  						   FDT_PCI_SPACE_IO, "reg",
> > > > > -						   &pci_addr);
> > > > > +						   &pci_addr, sizep);
> > > > >  			if (ret)
> > > > >  				return FDT_ADDR_T_NONE;
> > > > >  		}
> > > > > diff --git a/drivers/core/ofnode.c b/drivers/core/ofnode.c
> > > > > index 2ef4114cb6f..c9cec456f43 100644
> > > > > --- a/drivers/core/ofnode.c
> > > > > +++ b/drivers/core/ofnode.c
> > > > > @@ -1270,7 +1270,8 @@ const uint8_t *ofnode_read_u8_array_ptr(ofnode node, const char *propname,
> > > > >  }
> > > > >  
> > > > >  int ofnode_read_pci_addr(ofnode node, enum fdt_pci_space type,
> > > > > -			 const char *propname, struct fdt_pci_addr *addr)
> > > > > +			 const char *propname, struct fdt_pci_addr *addr,
> > > > > +			 fdt_size_t *size)
> > > > >  {
> > > > >  	const fdt32_t *cell;
> > > > >  	int len;
> > > > > @@ -1298,14 +1299,18 @@ int ofnode_read_pci_addr(ofnode node, enum fdt_pci_space type,
> > > > >  			      (ulong)fdt32_to_cpu(cell[1]),
> > > > >  			      (ulong)fdt32_to_cpu(cell[2]));
> > > > >  			if ((fdt32_to_cpu(*cell) & type) == type) {
> > > > > +				const unaligned_fdt64_t *ptr;
> > > > > +
> > > > >  				addr->phys_hi = fdt32_to_cpu(cell[0]);
> > > > >  				addr->phys_mid = fdt32_to_cpu(cell[1]);
> > > > >  				addr->phys_lo = fdt32_to_cpu(cell[2]);
> > > > > +				ptr = (const unaligned_fdt64_t *)(cell + 3);
> > > > > +				if (size)
> > > > > +					*size = fdt64_to_cpu(*ptr);
> > > > >  				break;
> > > > >  			}
> > > > >  
> > > > > -			cell += (FDT_PCI_ADDR_CELLS +
> > > > > -				 FDT_PCI_SIZE_CELLS);
> > > > > +			cell += FDT_PCI_ADDR_CELLS + FDT_PCI_SIZE_CELLS;
> > > > >  		}
> > > > >  
> > > > >  		if (i == num) {
> > > > > diff --git a/drivers/core/read.c b/drivers/core/read.c
> > > > > index 49066b59cda..419013451f0 100644
> > > > > --- a/drivers/core/read.c
> > > > > +++ b/drivers/core/read.c
> > > > > @@ -405,13 +405,15 @@ int dev_read_alias_highest_id(const char *stem)
> > > > >  	return fdtdec_get_alias_highest_id(gd->fdt_blob, stem);
> > > > >  }
> > > > >  
> > > > > -fdt_addr_t dev_read_addr_pci(const struct udevice *dev)
> > > > > +fdt_addr_t dev_read_addr_pci(const struct udevice *dev, fdt_size_t *sizep)
> > > > >  {
> > > > >  	ulong addr;
> > > > >  
> > > > >  	addr = dev_read_addr(dev);
> > > > > +	if (sizep)
> > > > > +		*sizep = 0;
> > > > >  	if (addr == FDT_ADDR_T_NONE && !of_live_active())
> > > > > -		addr = devfdt_get_addr_pci(dev);
> > > > > +		addr = devfdt_get_addr_pci(dev, sizep);
> > > > >  
> > > > >  	return addr;
> > > > >  }
> > > > > diff --git a/drivers/core/util.c b/drivers/core/util.c
> > > > > index aa60fdd15bc..81497df85ff 100644
> > > > > --- a/drivers/core/util.c
> > > > > +++ b/drivers/core/util.c
> > > > > @@ -30,7 +30,7 @@ int pci_get_devfn(struct udevice *dev)
> > > > >  
> > > > >  	/* Extract the devfn from fdt_pci_addr */
> > > > >  	ret = ofnode_read_pci_addr(dev_ofnode(dev), FDT_PCI_SPACE_CONFIG,
> > > > > -				   "reg", &addr);
> > > > > +				   "reg", &addr, NULL);
> > > > >  	if (ret) {
> > > > >  		if (ret != -ENOENT)
> > > > >  			return -EINVAL;
> > > > > diff --git a/drivers/pci/pci-uclass.c b/drivers/pci/pci-uclass.c
> > > > > index 0adcdceb1d3..c670f8754e8 100644
> > > > > --- a/drivers/pci/pci-uclass.c
> > > > > +++ b/drivers/pci/pci-uclass.c
> > > > > @@ -122,7 +122,7 @@ static void pci_dev_find_ofnode(struct udevice *bus, phys_addr_t bdf,
> > > > >  
> > > > >  	dev_for_each_subnode(node, bus) {
> > > > >  		ret = ofnode_read_pci_addr(node, FDT_PCI_SPACE_CONFIG, "reg",
> > > > > -					   &addr);
> > > > > +					   &addr, NULL);
> > > > >  		if (ret)
> > > > >  			continue;
> > > > >  
> > > > > diff --git a/drivers/pci/pci_mvebu.c b/drivers/pci/pci_mvebu.c
> > > > > index 93a7508d8a2..25878bde534 100644
> > > > > --- a/drivers/pci/pci_mvebu.c
> > > > > +++ b/drivers/pci/pci_mvebu.c
> > > > > @@ -640,7 +640,8 @@ static int mvebu_pcie_port_parse_dt(ofnode node, ofnode parent, struct mvebu_pci
> > > > >  		pcie->is_x4 = true;
> > > > >  
> > > > >  	/* devfn is in bits [15:8], see PCI_DEV usage */
> > > > > -	ret = ofnode_read_pci_addr(node, FDT_PCI_SPACE_CONFIG, "reg", &pci_addr);
> > > > > +	ret = ofnode_read_pci_addr(node, FDT_PCI_SPACE_CONFIG, "reg", &pci_addr,
> > > > > +				   NULL);
> > > > >  	if (ret < 0) {
> > > > >  		printf("%s: property \"reg\" is invalid\n", pcie->name);
> > > > >  		goto err;
> > > > > diff --git a/drivers/pci/pci_tegra.c b/drivers/pci/pci_tegra.c
> > > > > index 29d54117e93..ae90bd2fbf1 100644
> > > > > --- a/drivers/pci/pci_tegra.c
> > > > > +++ b/drivers/pci/pci_tegra.c
> > > > > @@ -461,7 +461,7 @@ static int tegra_pcie_parse_port_info(ofnode node, uint *index, uint *lanes)
> > > > >  
> > > > >  	*lanes = err;
> > > > >  
> > > > > -	err = ofnode_read_pci_addr(node, 0, "reg", &addr);
> > > > > +	err = ofnode_read_pci_addr(node, 0, "reg", &addr, NULL);
> > > > >  	if (err < 0) {
> > > > >  		pr_err("failed to parse \"reg\" property\n");
> > > > >  		return err;
> > > > > diff --git a/drivers/pci/pcie_mediatek.c b/drivers/pci/pcie_mediatek.c
> > > > > index c6e30e24622..e59ebd13ad0 100644
> > > > > --- a/drivers/pci/pcie_mediatek.c
> > > > > +++ b/drivers/pci/pcie_mediatek.c
> > > > > @@ -660,7 +660,7 @@ static int mtk_pcie_probe(struct udevice *dev)
> > > > >  		if (!ofnode_is_enabled(subnode))
> > > > >  			continue;
> > > > >  
> > > > > -		err = ofnode_read_pci_addr(subnode, 0, "reg", &addr);
> > > > > +		err = ofnode_read_pci_addr(subnode, 0, "reg", &addr, NULL);
> > > > >  		if (err)
> > > > >  			return err;
> > > > >  
> > > > > @@ -699,7 +699,7 @@ static int mtk_pcie_probe_v2(struct udevice *dev)
> > > > >  		if (!ofnode_is_enabled(subnode))
> > > > >  			continue;
> > > > >  
> > > > > -		err = ofnode_read_pci_addr(subnode, 0, "reg", &addr);
> > > > > +		err = ofnode_read_pci_addr(subnode, 0, "reg", &addr, NULL);
> > > > >  		if (err)
> > > > >  			return err;
> > > > >  
> > > > > diff --git a/drivers/serial/ns16550.c b/drivers/serial/ns16550.c
> > > > > index eab9537fbae..a349e5e132a 100644
> > > > > --- a/drivers/serial/ns16550.c
> > > > > +++ b/drivers/serial/ns16550.c
> > > > > @@ -479,6 +479,7 @@ static int ns16550_serial_getinfo(struct udevice *dev,
> > > > >  	info->addr_space = SERIAL_ADDRESS_SPACE_MEMORY;
> > > > >  #endif
> > > > >  	info->addr = plat->base;
> > > > > +	info->size = plat->size;
> > > > >  	info->reg_width = plat->reg_width;
> > > > >  	info->reg_shift = plat->reg_shift;
> > > > >  	info->reg_offset = plat->reg_offset;
> > > > > @@ -487,7 +488,8 @@ static int ns16550_serial_getinfo(struct udevice *dev,
> > > > >  	return 0;
> > > > >  }
> > > > >  
> > > > > -static int ns16550_serial_assign_base(struct ns16550_plat *plat, fdt_addr_t base)
> > > > > +static int ns16550_serial_assign_base(struct ns16550_plat *plat,
> > > > > +				      fdt_addr_t base, fdt_size_t size)
> > > > >  {
> > > > >  	if (base == FDT_ADDR_T_NONE)
> > > > >  		return -EINVAL;
> > > > > @@ -497,6 +499,7 @@ static int ns16550_serial_assign_base(struct ns16550_plat *plat, fdt_addr_t base
> > > > >  #else
> > > > >  	plat->base = (unsigned long)map_physmem(base, 0, MAP_NOCACHE);
> > > > >  #endif
> > > > > +	plat->size = size;
> > > > >  
> > > > >  	return 0;
> > > > >  }
> > > > > @@ -507,6 +510,7 @@ int ns16550_serial_probe(struct udevice *dev)
> > > > >  	struct ns16550 *const com_port = dev_get_priv(dev);
> > > > >  	struct reset_ctl_bulk reset_bulk;
> > > > >  	fdt_addr_t addr;
> > > > > +	fdt_addr_t size;
> > > > >  	int ret;
> > > > >  
> > > > >  	/*
> > > > > @@ -514,8 +518,8 @@ int ns16550_serial_probe(struct udevice *dev)
> > > > >  	 * or via a PCI bridge, assign plat->base before probing hardware.
> > > > >  	 */
> > > > >  	if (device_is_on_pci_bus(dev)) {
> > > > > -		addr = devfdt_get_addr_pci(dev);
> > > > > -		ret = ns16550_serial_assign_base(plat, addr);
> > > > > +		addr = devfdt_get_addr_pci(dev, &size);
> > > > > +		ret = ns16550_serial_assign_base(plat, addr, size);
> > > > >  		if (ret)
> > > > >  			return ret;
> > > > >  	}
> > > > > @@ -543,11 +547,12 @@ int ns16550_serial_of_to_plat(struct udevice *dev)
> > > > >  	struct ns16550_plat *plat = dev_get_plat(dev);
> > > > >  	const u32 port_type = dev_get_driver_data(dev);
> > > > >  	fdt_addr_t addr;
> > > > > +	fdt_size_t size;
> > > > >  	struct clk clk;
> > > > >  	int err;
> > > > >  
> > > > > -	addr = dev_read_addr(dev);
> > > > > -	err = ns16550_serial_assign_base(plat, addr);
> > > > > +	addr = dev_read_addr_size(dev, &size);
> > > > > +	err = ns16550_serial_assign_base(plat, addr, size);
> > > > >  	if (err && !device_is_on_pci_bus(dev))
> > > > >  		return err;
> > > > >  
> > > > > diff --git a/include/dm/fdtaddr.h b/include/dm/fdtaddr.h
> > > > > index dcdc19137cc..6d2fa8f1044 100644
> > > > > --- a/include/dm/fdtaddr.h
> > > > > +++ b/include/dm/fdtaddr.h
> > > > > @@ -168,8 +168,9 @@ fdt_addr_t devfdt_get_addr_size_name(const struct udevice *dev,
> > > > >   * devfdt_get_addr_pci() - Read an address and handle PCI address translation
> > > > >   *
> > > > >   * @dev: Device to read from
> > > > > + * @sizep: If non-NULL, returns size of address space
> > > > >   * Return: address or FDT_ADDR_T_NONE if not found
> > > > >   */
> > > > > -fdt_addr_t devfdt_get_addr_pci(const struct udevice *dev);
> > > > > +fdt_addr_t devfdt_get_addr_pci(const struct udevice *dev, fdt_size_t *sizep);
> > > > >  
> > > > >  #endif
> > > > > diff --git a/include/dm/ofnode.h b/include/dm/ofnode.h
> > > > > index 726d8f82ddf..97cad971611 100644
> > > > > --- a/include/dm/ofnode.h
> > > > > +++ b/include/dm/ofnode.h
> > > > > @@ -1152,13 +1152,15 @@ const uint8_t *ofnode_read_u8_array_ptr(ofnode node, const char *propname,
> > > > >   * @type:	pci address type (FDT_PCI_SPACE_xxx)
> > > > >   * @propname:	name of property to find
> > > > >   * @addr:	returns pci address in the form of fdt_pci_addr
> > > > > + * @size:	if non-null, returns register-space size
> > > > >   * Return:
> > > > >   * 0 if ok, -ENOENT if the property did not exist, -EINVAL if the
> > > > >   * format of the property was invalid, -ENXIO if the requested
> > > > >   * address type was not found
> > > > >   */
> > > > >  int ofnode_read_pci_addr(ofnode node, enum fdt_pci_space type,
> > > > > -			 const char *propname, struct fdt_pci_addr *addr);
> > > > > +			 const char *propname, struct fdt_pci_addr *addr,
> > > > > +			 fdt_size_t *size);
> > > > >  
> > > > >  /**
> > > > >   * ofnode_read_pci_vendev() - look up PCI vendor and device id
> > > > > diff --git a/include/dm/read.h b/include/dm/read.h
> > > > > index c2615f72f40..3c2eea6f0c4 100644
> > > > > --- a/include/dm/read.h
> > > > > +++ b/include/dm/read.h
> > > > > @@ -346,9 +346,10 @@ void *dev_read_addr_ptr(const struct udevice *dev);
> > > > >   *    fdtdec_get_addr() and friends.
> > > > >   *
> > > > >   * @dev: Device to read from
> > > > > + * @sizep: If non-NULL, returns size of address space found
> > > > >   * Return: address or FDT_ADDR_T_NONE if not found
> > > > >   */
> > > > > -fdt_addr_t dev_read_addr_pci(const struct udevice *dev);
> > > > > +fdt_addr_t dev_read_addr_pci(const struct udevice *dev, fdt_size_t *sizep);
> > > > >  
> > > > >  /**
> > > > >   * dev_remap_addr() - Get the reg property of a device as a
> > > > > @@ -996,9 +997,10 @@ static inline void *dev_read_addr_ptr(const struct udevice *dev)
> > > > >  	return devfdt_get_addr_ptr(dev);
> > > > >  }
> > > > >  
> > > > > -static inline fdt_addr_t dev_read_addr_pci(const struct udevice *dev)
> > > > > +static inline fdt_addr_t dev_read_addr_pci(const struct udevice *dev,
> > > > > +					   fdt_size_t *sizep)
> > > > >  {
> > > > > -	return devfdt_get_addr_pci(dev);
> > > > > +	return devfdt_get_addr_pci(dev, sizep);
> > > > >  }
> > > > >  
> > > > >  static inline void *dev_remap_addr(const struct udevice *dev)
> > > > > diff --git a/include/ns16550.h b/include/ns16550.h
> > > > > index e7e68663d03..7f481300083 100644
> > > > > --- a/include/ns16550.h
> > > > > +++ b/include/ns16550.h
> > > > > @@ -58,6 +58,7 @@ enum ns16550_flags {
> > > > >   * struct ns16550_plat - information about a NS16550 port
> > > > >   *
> > > > >   * @base:		Base register address
> > > > > + * @size:		Size of register area in bytes
> > > > >   * @reg_width:		IO accesses size of registers (in bytes, 1 or 4)
> > > > >   * @reg_shift:		Shift size of registers (0=byte, 1=16bit, 2=32bit...)
> > > > >   * @reg_offset:		Offset to start of registers (normally 0)
> > > > > @@ -67,7 +68,8 @@ enum ns16550_flags {
> > > > >   * @bdf:		PCI slot/function (pci_dev_t)
> > > > >   */
> > > > >  struct ns16550_plat {
> > > > > -	unsigned long base;
> > > > > +	ulong base;
> > > > > +	ulong size;
> > > > >  	int reg_width;
> > > > >  	int reg_shift;
> > > > >  	int reg_offset;
> > > > > diff --git a/include/serial.h b/include/serial.h
> > > > > index 42bdf3759c0..205889d28be 100644
> > > > > --- a/include/serial.h
> > > > > +++ b/include/serial.h
> > > > > @@ -137,6 +137,7 @@ enum adr_space_type {
> > > > >   * @type:	type of the UART chip
> > > > >   * @addr_space:	address space to access the registers
> > > > >   * @addr:	physical address of the registers
> > > > > + * @size:	size of the register area in bytes
> > > > >   * @reg_width:	size (in bytes) of the IO accesses to the registers
> > > > >   * @reg_offset:	offset to apply to the @addr from the start of the registers
> > > > >   * @reg_shift:	quantity to shift the register offsets by
> > > > > @@ -147,6 +148,7 @@ struct serial_device_info {
> > > > >  	enum serial_chip_type type;
> > > > >  	enum adr_space_type addr_space;
> > > > >  	ulong addr;
> > > > > +	ulong size;
> > > > >  	u8 reg_width;
> > > > >  	u8 reg_offset;
> > > > >  	u8 reg_shift;
> > > > > diff --git a/test/dm/pci.c b/test/dm/pci.c
> > > > > index 70a736cfdb8..8c5e7da9e62 100644
> > > > > --- a/test/dm/pci.c
> > > > > +++ b/test/dm/pci.c
> > > > > @@ -301,10 +301,12 @@ static int dm_test_pci_addr_flat(struct unit_test_state *uts)
> > > > >  {
> > > > >  	struct udevice *swap1f, *swap1;
> > > > >  	ulong io_addr, mem_addr;
> > > > > +	fdt_addr_t size;
> > > > >  
> > > > >  	ut_assertok(dm_pci_bus_find_bdf(PCI_BDF(0, 0x1f, 0), &swap1f));
> > > > >  	io_addr = dm_pci_read_bar32(swap1f, 0);
> > > > > -	ut_asserteq(io_addr, dev_read_addr_pci(swap1f));
> > > > > +	ut_asserteq(io_addr, dev_read_addr_pci(swap1f, &size));
> > > > > +	ut_asserteq(0, size);
> > > > >  
> > > > >  	/*
> > > > >  	 * This device has both I/O and MEM spaces but the MEM space appears
> > > > > @@ -312,7 +314,8 @@ static int dm_test_pci_addr_flat(struct unit_test_state *uts)
> > > > >  	 */
> > > > >  	ut_assertok(dm_pci_bus_find_bdf(PCI_BDF(0, 0x1, 0), &swap1));
> > > > >  	mem_addr = dm_pci_read_bar32(swap1, 1);
> > > > > -	ut_asserteq(mem_addr, dev_read_addr_pci(swap1));
> > > > > +	ut_asserteq(mem_addr, dev_read_addr_pci(swap1, &size));
> > > > > +	ut_asserteq(0, size);
> > > > >  
> > > > >  	return 0;
> > > > >  }
> > > > > @@ -329,12 +332,15 @@ DM_TEST(dm_test_pci_addr_flat, UT_TESTF_SCAN_PDATA | UT_TESTF_SCAN_FDT |
> > > > >  static int dm_test_pci_addr_live(struct unit_test_state *uts)
> > > > >  {
> > > > >  	struct udevice *swap1f, *swap1;
> > > > > +	fdt_size_t size;
> > > > >  
> > > > >  	ut_assertok(dm_pci_bus_find_bdf(PCI_BDF(0, 0x1f, 0), &swap1f));
> > > > > -	ut_asserteq_64(FDT_ADDR_T_NONE, dev_read_addr_pci(swap1f));
> > > > > +	ut_asserteq_64(FDT_ADDR_T_NONE, dev_read_addr_pci(swap1f, &size));
> > > > > +	ut_asserteq(0, size);
> > > > >  
> > > > >  	ut_assertok(dm_pci_bus_find_bdf(PCI_BDF(0, 0x1, 0), &swap1));
> > > > > -	ut_asserteq_64(FDT_ADDR_T_NONE, dev_read_addr_pci(swap1));
> > > > > +	ut_asserteq_64(FDT_ADDR_T_NONE, dev_read_addr_pci(swap1, &size));
> > > > > +	ut_asserteq(0, size);
> > > > >  
> > > > >  	return 0;
> > > > >  }
> > > > > -- 
> > > > > 2.42.0.rc2.253.gd59a3bf2b4-goog
> > > > > 
> 
> -- 
> Tom



^ permalink raw reply	[flat|nested] 86+ messages in thread

* Re: [PATCH 30/32] fdt: Allow the devicetree to come from a bloblist
  2023-09-04  9:30           ` Ilias Apalodimas
@ 2023-09-10 19:13             ` Simon Glass
  2023-09-11  6:17               ` Ilias Apalodimas
  0 siblings, 1 reply; 86+ messages in thread
From: Simon Glass @ 2023-09-10 19:13 UTC (permalink / raw)
  To: Ilias Apalodimas
  Cc: U-Boot Mailing List, Tom Rini, Marek Vasut, Baruch Siach,
	Bin Meng, Heinrich Schuchardt, Michal Simek, Nikhil M Jain,
	Qu Wenruo, Stefan Roese

Hi Ilias,

On Mon, 4 Sept 2023 at 03:31, Ilias Apalodimas
<ilias.apalodimas@linaro.org> wrote:
>
> Hi Simon,
>
> On Fri, 1 Sept 2023 at 18:51, Simon Glass <sjg@chromium.org> wrote:
> >
> > Hi Ilias,
> >
> > On Fri, 1 Sept 2023 at 01:50, Ilias Apalodimas <ilias.apalodimas@linaro.org> wrote:
> > >
> > > [...]
> > >
> > > > >
> > > > > > +config OF_BLOBLIST
> > > > > > +     bool "DTB is provided by a bloblist"
> > > > > > +     help
> > > > > > +       Select this to read the devicetree from the bloblist. This allows
> > > > > > +       using a bloblist to transfer the devicetree between  U-Boot phases.
> > > > > > +       The devicetree is stored in the bloblist by an early phase so that
> > > > > > +       U-Boot can read it.
> > > > > > +
> > > > >
> > > > > I dont think this is a good idea.  We used to have 4-5 different options
> > > > > here, which we tried to clean up and ended up with two very discrete
> > > > > options.  Why do we have to reintroduce a new one?  Doesn't that bloblist
> > > > > have a header of some sort?  The bloblist literally comes from a previous
> > > > > stage bootloader which is what OF_BOARD is here for. So why can't we just
> > > > > read the header and figure out if the magic of the bloblist matches?
> > > >
> > > > No, OF_BOARD is a hack to allow boards to do what they like with the FDT.
> > > >
> > > > This patch is a standard mechanism to pass the DT from one firmware
> > > > phase to the next. We have spent quite a bit of time creating a spec
> > > > for it, and we should use it.
> > >
> > > Where exactly am I objecting using the spec?   Can you please re-read my email?
> > > I am actually pointing out we should use the spec *properly*.  So
> > > instead of having a Kconfig option for the DT, which is pretty
> > > pointless,  we should parse the bloblist.  If the header defined by
> > > the *spec* is found, we should just search for the DT in there.
> > > What you are doing here, is take the spec, pick a very specific item
> > > that the list contains, and create a Kconfig option out of it.  Which
> > > basically ignores the discoverable options of the bloblist.  For
> > > example, that bloblist can also contain an entry to a TPM eventlog.
> > > Should we start creating Kconfig options for all the firmware handoff
> > > entries that are defined on that spec?
> >
> > OK so that is a different thing. What should it do if it expects to find a bloblist but cannot? I want it to throw an error, because I am trying to make the boot deterministic. What do you think?
>
> That's fine by me.  You can even put that under IS_ENABLED for the
> bloblist inside the existing OF_BOARD check.  So I was thinking
> - If no bloblist is required in Kconfig options we do the hacks we used to
> - if bloblist is selected and the config option is OF_BOARD, throw an
> error and mention that the previous stage loader should hand over a DT
>
> Is that what you had in mind?

Yes, that sounds good to me.

But I still think we need an OF_BLOBLIST option to control whether the
devicetree comes from there. Otherwise we will end up with people
using OF_BOARD to work around it. We also have the SPL case which does
not pass the DT in a bloblist...in fact SPL typically doesn't even
have the full DT.

[..]

Regards,
Simon

^ permalink raw reply	[flat|nested] 86+ messages in thread

* Re: [PATCH 30/32] fdt: Allow the devicetree to come from a bloblist
  2023-09-10 19:13             ` Simon Glass
@ 2023-09-11  6:17               ` Ilias Apalodimas
  2023-09-11  6:38                 ` Michal Simek
  0 siblings, 1 reply; 86+ messages in thread
From: Ilias Apalodimas @ 2023-09-11  6:17 UTC (permalink / raw)
  To: Simon Glass
  Cc: U-Boot Mailing List, Tom Rini, Marek Vasut, Baruch Siach,
	Bin Meng, Heinrich Schuchardt, Michal Simek, Nikhil M Jain,
	Qu Wenruo, Stefan Roese

Hi Simon,

On Sun, 10 Sept 2023 at 22:14, Simon Glass <sjg@chromium.org> wrote:
>
> Hi Ilias,
>
> On Mon, 4 Sept 2023 at 03:31, Ilias Apalodimas
> <ilias.apalodimas@linaro.org> wrote:
> >
> > Hi Simon,
> >
> > On Fri, 1 Sept 2023 at 18:51, Simon Glass <sjg@chromium.org> wrote:
> > >
> > > Hi Ilias,
> > >
> > > On Fri, 1 Sept 2023 at 01:50, Ilias Apalodimas <ilias.apalodimas@linaro.org> wrote:
> > > >
> > > > [...]
> > > >
> > > > > >
> > > > > > > +config OF_BLOBLIST
> > > > > > > +     bool "DTB is provided by a bloblist"
> > > > > > > +     help
> > > > > > > +       Select this to read the devicetree from the bloblist. This allows
> > > > > > > +       using a bloblist to transfer the devicetree between  U-Boot phases.
> > > > > > > +       The devicetree is stored in the bloblist by an early phase so that
> > > > > > > +       U-Boot can read it.
> > > > > > > +
> > > > > >
> > > > > > I dont think this is a good idea.  We used to have 4-5 different options
> > > > > > here, which we tried to clean up and ended up with two very discrete
> > > > > > options.  Why do we have to reintroduce a new one?  Doesn't that bloblist
> > > > > > have a header of some sort?  The bloblist literally comes from a previous
> > > > > > stage bootloader which is what OF_BOARD is here for. So why can't we just
> > > > > > read the header and figure out if the magic of the bloblist matches?
> > > > >
> > > > > No, OF_BOARD is a hack to allow boards to do what they like with the FDT.
> > > > >
> > > > > This patch is a standard mechanism to pass the DT from one firmware
> > > > > phase to the next. We have spent quite a bit of time creating a spec
> > > > > for it, and we should use it.
> > > >
> > > > Where exactly am I objecting using the spec?   Can you please re-read my email?
> > > > I am actually pointing out we should use the spec *properly*.  So
> > > > instead of having a Kconfig option for the DT, which is pretty
> > > > pointless,  we should parse the bloblist.  If the header defined by
> > > > the *spec* is found, we should just search for the DT in there.
> > > > What you are doing here, is take the spec, pick a very specific item
> > > > that the list contains, and create a Kconfig option out of it.  Which
> > > > basically ignores the discoverable options of the bloblist.  For
> > > > example, that bloblist can also contain an entry to a TPM eventlog.
> > > > Should we start creating Kconfig options for all the firmware handoff
> > > > entries that are defined on that spec?
> > >
> > > OK so that is a different thing. What should it do if it expects to find a bloblist but cannot? I want it to throw an error, because I am trying to make the boot deterministic. What do you think?
> >
> > That's fine by me.  You can even put that under IS_ENABLED for the
> > bloblist inside the existing OF_BOARD check.  So I was thinking
> > - If no bloblist is required in Kconfig options we do the hacks we used to
> > - if bloblist is selected and the config option is OF_BOARD, throw an
> > error and mention that the previous stage loader should hand over a DT
> >
> > Is that what you had in mind?
>
> Yes, that sounds good to me.
>
> But I still think we need an OF_BLOBLIST option to control whether the
> devicetree comes from there.
>  Otherwise we will end up with people
> using OF_BOARD to work around it. We also have the SPL case which does
> not pass the DT in a bloblist...in fact SPL typically doesn't even
> have the full DT.

Wouldn't IS_ENABLED(BLOBLIST) || IS_ENABLED(SPL_BLOBLIST) be enough?
Inside the OF_BOARD portion of the function, search for a bloblist if
the option is enabled.  If you can't find a bloblist and the DT within
that bloblist, then error out

Thanks
/Ilias
>
> [..]
>
> Regards,
> Simon

^ permalink raw reply	[flat|nested] 86+ messages in thread

* Re: [PATCH 30/32] fdt: Allow the devicetree to come from a bloblist
  2023-09-11  6:17               ` Ilias Apalodimas
@ 2023-09-11  6:38                 ` Michal Simek
  2023-09-11  7:56                   ` Ilias Apalodimas
  0 siblings, 1 reply; 86+ messages in thread
From: Michal Simek @ 2023-09-11  6:38 UTC (permalink / raw)
  To: Ilias Apalodimas, Simon Glass
  Cc: U-Boot Mailing List, Tom Rini, Marek Vasut, Baruch Siach,
	Bin Meng, Heinrich Schuchardt, Nikhil M Jain, Qu Wenruo,
	Stefan Roese



On 9/11/23 08:17, Ilias Apalodimas wrote:
> Hi Simon,
> 
> On Sun, 10 Sept 2023 at 22:14, Simon Glass <sjg@chromium.org> wrote:
>>
>> Hi Ilias,
>>
>> On Mon, 4 Sept 2023 at 03:31, Ilias Apalodimas
>> <ilias.apalodimas@linaro.org> wrote:
>>>
>>> Hi Simon,
>>>
>>> On Fri, 1 Sept 2023 at 18:51, Simon Glass <sjg@chromium.org> wrote:
>>>>
>>>> Hi Ilias,
>>>>
>>>> On Fri, 1 Sept 2023 at 01:50, Ilias Apalodimas <ilias.apalodimas@linaro.org> wrote:
>>>>>
>>>>> [...]
>>>>>
>>>>>>>
>>>>>>>> +config OF_BLOBLIST
>>>>>>>> +     bool "DTB is provided by a bloblist"
>>>>>>>> +     help
>>>>>>>> +       Select this to read the devicetree from the bloblist. This allows
>>>>>>>> +       using a bloblist to transfer the devicetree between  U-Boot phases.
>>>>>>>> +       The devicetree is stored in the bloblist by an early phase so that
>>>>>>>> +       U-Boot can read it.
>>>>>>>> +
>>>>>>>
>>>>>>> I dont think this is a good idea.  We used to have 4-5 different options
>>>>>>> here, which we tried to clean up and ended up with two very discrete
>>>>>>> options.  Why do we have to reintroduce a new one?  Doesn't that bloblist
>>>>>>> have a header of some sort?  The bloblist literally comes from a previous
>>>>>>> stage bootloader which is what OF_BOARD is here for. So why can't we just
>>>>>>> read the header and figure out if the magic of the bloblist matches?
>>>>>>
>>>>>> No, OF_BOARD is a hack to allow boards to do what they like with the FDT.
>>>>>>
>>>>>> This patch is a standard mechanism to pass the DT from one firmware
>>>>>> phase to the next. We have spent quite a bit of time creating a spec
>>>>>> for it, and we should use it.
>>>>>
>>>>> Where exactly am I objecting using the spec?   Can you please re-read my email?
>>>>> I am actually pointing out we should use the spec *properly*.  So
>>>>> instead of having a Kconfig option for the DT, which is pretty
>>>>> pointless,  we should parse the bloblist.  If the header defined by
>>>>> the *spec* is found, we should just search for the DT in there.
>>>>> What you are doing here, is take the spec, pick a very specific item
>>>>> that the list contains, and create a Kconfig option out of it.  Which
>>>>> basically ignores the discoverable options of the bloblist.  For
>>>>> example, that bloblist can also contain an entry to a TPM eventlog.
>>>>> Should we start creating Kconfig options for all the firmware handoff
>>>>> entries that are defined on that spec?
>>>>
>>>> OK so that is a different thing. What should it do if it expects to find a bloblist but cannot? I want it to throw an error, because I am trying to make the boot deterministic. What do you think?
>>>
>>> That's fine by me.  You can even put that under IS_ENABLED for the
>>> bloblist inside the existing OF_BOARD check.  So I was thinking
>>> - If no bloblist is required in Kconfig options we do the hacks we used to
>>> - if bloblist is selected and the config option is OF_BOARD, throw an
>>> error and mention that the previous stage loader should hand over a DT
>>>
>>> Is that what you had in mind?
>>
>> Yes, that sounds good to me.
>>
>> But I still think we need an OF_BLOBLIST option to control whether the
>> devicetree comes from there.
>>   Otherwise we will end up with people
>> using OF_BOARD to work around it. We also have the SPL case which does
>> not pass the DT in a bloblist...in fact SPL typically doesn't even
>> have the full DT.
> 
> Wouldn't IS_ENABLED(BLOBLIST) || IS_ENABLED(SPL_BLOBLIST) be enough?
> Inside the OF_BOARD portion of the function, search for a bloblist if
> the option is enabled.  If you can't find a bloblist and the DT within
> that bloblist, then error out

Just my 2c here.
I think all options should be possible to disable. It means I can imagine to 
disable u-boot not to take care about DT provided from previous stage. The same 
is for TPM event log. IMHO every stage should have an option to simply ignore 
data pass from previous stage. I don't really mind how it is done but there 
should be an option to by purpose say to ignore the part of pass data.

Regarding DT part. We are experimenting with TF-A injecting for example DDR 
memory reservation to DT.
Injection is working properly if you are using single DT but in SOM case we are 
using FIT image with a lot of DTBs inside (issue with checksums calculation).
I see couple of platforms (IIRC renesas/imx) which are using DT overlays and 
passing it via specific registers. For these using bloblist might be right way 
to go.
I wasn't aware about the whole fdt bloblist discussion but based on my 
experiments you can create multiple FDT entries that's why I expect that there 
could be DT overlays from different stages. And I even think that all of them 
can be overlays without base DT which can be select later on.

Thanks,
Michal



^ permalink raw reply	[flat|nested] 86+ messages in thread

* Re: [PATCH 30/32] fdt: Allow the devicetree to come from a bloblist
  2023-09-11  6:38                 ` Michal Simek
@ 2023-09-11  7:56                   ` Ilias Apalodimas
  2023-09-11 10:58                     ` Michal Simek
  0 siblings, 1 reply; 86+ messages in thread
From: Ilias Apalodimas @ 2023-09-11  7:56 UTC (permalink / raw)
  To: Michal Simek
  Cc: Simon Glass, U-Boot Mailing List, Tom Rini, Marek Vasut,
	Baruch Siach, Bin Meng, Heinrich Schuchardt, Nikhil M Jain,
	Qu Wenruo, Stefan Roese

Hi Michal,

On Mon, 11 Sept 2023 at 09:38, Michal Simek <michal.simek@amd.com> wrote:
>
>
>
> On 9/11/23 08:17, Ilias Apalodimas wrote:
> > Hi Simon,
> >
> > On Sun, 10 Sept 2023 at 22:14, Simon Glass <sjg@chromium.org> wrote:
> >>
> >> Hi Ilias,
> >>
> >> On Mon, 4 Sept 2023 at 03:31, Ilias Apalodimas
> >> <ilias.apalodimas@linaro.org> wrote:
> >>>
> >>> Hi Simon,
> >>>
> >>> On Fri, 1 Sept 2023 at 18:51, Simon Glass <sjg@chromium.org> wrote:
> >>>>
> >>>> Hi Ilias,
> >>>>
> >>>> On Fri, 1 Sept 2023 at 01:50, Ilias Apalodimas <ilias.apalodimas@linaro.org> wrote:
> >>>>>
> >>>>> [...]
> >>>>>
> >>>>>>>
> >>>>>>>> +config OF_BLOBLIST
> >>>>>>>> +     bool "DTB is provided by a bloblist"
> >>>>>>>> +     help
> >>>>>>>> +       Select this to read the devicetree from the bloblist. This allows
> >>>>>>>> +       using a bloblist to transfer the devicetree between  U-Boot phases.
> >>>>>>>> +       The devicetree is stored in the bloblist by an early phase so that
> >>>>>>>> +       U-Boot can read it.
> >>>>>>>> +
> >>>>>>>
> >>>>>>> I dont think this is a good idea.  We used to have 4-5 different options
> >>>>>>> here, which we tried to clean up and ended up with two very discrete
> >>>>>>> options.  Why do we have to reintroduce a new one?  Doesn't that bloblist
> >>>>>>> have a header of some sort?  The bloblist literally comes from a previous
> >>>>>>> stage bootloader which is what OF_BOARD is here for. So why can't we just
> >>>>>>> read the header and figure out if the magic of the bloblist matches?
> >>>>>>
> >>>>>> No, OF_BOARD is a hack to allow boards to do what they like with the FDT.
> >>>>>>
> >>>>>> This patch is a standard mechanism to pass the DT from one firmware
> >>>>>> phase to the next. We have spent quite a bit of time creating a spec
> >>>>>> for it, and we should use it.
> >>>>>
> >>>>> Where exactly am I objecting using the spec?   Can you please re-read my email?
> >>>>> I am actually pointing out we should use the spec *properly*.  So
> >>>>> instead of having a Kconfig option for the DT, which is pretty
> >>>>> pointless,  we should parse the bloblist.  If the header defined by
> >>>>> the *spec* is found, we should just search for the DT in there.
> >>>>> What you are doing here, is take the spec, pick a very specific item
> >>>>> that the list contains, and create a Kconfig option out of it.  Which
> >>>>> basically ignores the discoverable options of the bloblist.  For
> >>>>> example, that bloblist can also contain an entry to a TPM eventlog.
> >>>>> Should we start creating Kconfig options for all the firmware handoff
> >>>>> entries that are defined on that spec?
> >>>>
> >>>> OK so that is a different thing. What should it do if it expects to find a bloblist but cannot? I want it to throw an error, because I am trying to make the boot deterministic. What do you think?
> >>>
> >>> That's fine by me.  You can even put that under IS_ENABLED for the
> >>> bloblist inside the existing OF_BOARD check.  So I was thinking
> >>> - If no bloblist is required in Kconfig options we do the hacks we used to
> >>> - if bloblist is selected and the config option is OF_BOARD, throw an
> >>> error and mention that the previous stage loader should hand over a DT
> >>>
> >>> Is that what you had in mind?
> >>
> >> Yes, that sounds good to me.
> >>
> >> But I still think we need an OF_BLOBLIST option to control whether the
> >> devicetree comes from there.
> >>   Otherwise we will end up with people
> >> using OF_BOARD to work around it. We also have the SPL case which does
> >> not pass the DT in a bloblist...in fact SPL typically doesn't even
> >> have the full DT.
> >
> > Wouldn't IS_ENABLED(BLOBLIST) || IS_ENABLED(SPL_BLOBLIST) be enough?
> > Inside the OF_BOARD portion of the function, search for a bloblist if
> > the option is enabled.  If you can't find a bloblist and the DT within
> > that bloblist, then error out
>
> Just my 2c here.
> I think all options should be possible to disable. It means I can imagine to
> disable u-boot not to take care about DT provided from previous stage. The same
> is for TPM event log. IMHO every stage should have an option to simply ignore
> data pass from previous stage. I don't really mind how it is done but there
> should be an option to by purpose say to ignore the part of pass data.

That would be done by disabling BLOBLIST.  I don't think having a Kconfig to say
"I want a bloblist, but I only want the DT from there" is reasonable
(or for any other item the bloblist can carry).   OF_BOARD means the
DT will come from a previous stage loader. If bloblist is enabled then
the DT must come from there.

>
> Regarding DT part. We are experimenting with TF-A injecting for example DDR
> memory reservation to DT.
> Injection is working properly if you are using single DT but in SOM case we are
> using FIT image with a lot of DTBs inside (issue with checksums calculation).
> I see couple of platforms (IIRC renesas/imx) which are using DT overlays and
> passing it via specific registers. For these using bloblist might be right way
> to go.

Yes that's in fact the purpose of that spec.

> I wasn't aware about the whole fdt bloblist discussion but based on my
> experiments you can create multiple FDT entries that's why I expect that there
> could be DT overlays from different stages. And I even think that all of them
> can be overlays without base DT which can be select later on.

If the bloblist has overlays, then we shouldn't be compiling with
OF_BOARD.  You will get a DT from u-boot and tghe adding this
overlays, is an matter of parsing the bloblist and appending the,

Thanks
/Ilias
>
> Thanks,
> Michal
>
>

^ permalink raw reply	[flat|nested] 86+ messages in thread

* Re: [PATCH 30/32] fdt: Allow the devicetree to come from a bloblist
  2023-09-11  7:56                   ` Ilias Apalodimas
@ 2023-09-11 10:58                     ` Michal Simek
  2023-09-11 11:47                       ` Ilias Apalodimas
  0 siblings, 1 reply; 86+ messages in thread
From: Michal Simek @ 2023-09-11 10:58 UTC (permalink / raw)
  To: Ilias Apalodimas
  Cc: Simon Glass, U-Boot Mailing List, Tom Rini, Marek Vasut,
	Baruch Siach, Bin Meng, Heinrich Schuchardt, Nikhil M Jain,
	Qu Wenruo, Stefan Roese

Hi Ilias,

On 9/11/23 09:56, Ilias Apalodimas wrote:
> Hi Michal,
> 
> On Mon, 11 Sept 2023 at 09:38, Michal Simek <michal.simek@amd.com> wrote:
>>
>>
>>
>> On 9/11/23 08:17, Ilias Apalodimas wrote:
>>> Hi Simon,
>>>
>>> On Sun, 10 Sept 2023 at 22:14, Simon Glass <sjg@chromium.org> wrote:
>>>>
>>>> Hi Ilias,
>>>>
>>>> On Mon, 4 Sept 2023 at 03:31, Ilias Apalodimas
>>>> <ilias.apalodimas@linaro.org> wrote:
>>>>>
>>>>> Hi Simon,
>>>>>
>>>>> On Fri, 1 Sept 2023 at 18:51, Simon Glass <sjg@chromium.org> wrote:
>>>>>>
>>>>>> Hi Ilias,
>>>>>>
>>>>>> On Fri, 1 Sept 2023 at 01:50, Ilias Apalodimas <ilias.apalodimas@linaro.org> wrote:
>>>>>>>
>>>>>>> [...]
>>>>>>>
>>>>>>>>>
>>>>>>>>>> +config OF_BLOBLIST
>>>>>>>>>> +     bool "DTB is provided by a bloblist"
>>>>>>>>>> +     help
>>>>>>>>>> +       Select this to read the devicetree from the bloblist. This allows
>>>>>>>>>> +       using a bloblist to transfer the devicetree between  U-Boot phases.
>>>>>>>>>> +       The devicetree is stored in the bloblist by an early phase so that
>>>>>>>>>> +       U-Boot can read it.
>>>>>>>>>> +
>>>>>>>>>
>>>>>>>>> I dont think this is a good idea.  We used to have 4-5 different options
>>>>>>>>> here, which we tried to clean up and ended up with two very discrete
>>>>>>>>> options.  Why do we have to reintroduce a new one?  Doesn't that bloblist
>>>>>>>>> have a header of some sort?  The bloblist literally comes from a previous
>>>>>>>>> stage bootloader which is what OF_BOARD is here for. So why can't we just
>>>>>>>>> read the header and figure out if the magic of the bloblist matches?
>>>>>>>>
>>>>>>>> No, OF_BOARD is a hack to allow boards to do what they like with the FDT.
>>>>>>>>
>>>>>>>> This patch is a standard mechanism to pass the DT from one firmware
>>>>>>>> phase to the next. We have spent quite a bit of time creating a spec
>>>>>>>> for it, and we should use it.
>>>>>>>
>>>>>>> Where exactly am I objecting using the spec?   Can you please re-read my email?
>>>>>>> I am actually pointing out we should use the spec *properly*.  So
>>>>>>> instead of having a Kconfig option for the DT, which is pretty
>>>>>>> pointless,  we should parse the bloblist.  If the header defined by
>>>>>>> the *spec* is found, we should just search for the DT in there.
>>>>>>> What you are doing here, is take the spec, pick a very specific item
>>>>>>> that the list contains, and create a Kconfig option out of it.  Which
>>>>>>> basically ignores the discoverable options of the bloblist.  For
>>>>>>> example, that bloblist can also contain an entry to a TPM eventlog.
>>>>>>> Should we start creating Kconfig options for all the firmware handoff
>>>>>>> entries that are defined on that spec?
>>>>>>
>>>>>> OK so that is a different thing. What should it do if it expects to find a bloblist but cannot? I want it to throw an error, because I am trying to make the boot deterministic. What do you think?
>>>>>
>>>>> That's fine by me.  You can even put that under IS_ENABLED for the
>>>>> bloblist inside the existing OF_BOARD check.  So I was thinking
>>>>> - If no bloblist is required in Kconfig options we do the hacks we used to
>>>>> - if bloblist is selected and the config option is OF_BOARD, throw an
>>>>> error and mention that the previous stage loader should hand over a DT
>>>>>
>>>>> Is that what you had in mind?
>>>>
>>>> Yes, that sounds good to me.
>>>>
>>>> But I still think we need an OF_BLOBLIST option to control whether the
>>>> devicetree comes from there.
>>>>    Otherwise we will end up with people
>>>> using OF_BOARD to work around it. We also have the SPL case which does
>>>> not pass the DT in a bloblist...in fact SPL typically doesn't even
>>>> have the full DT.
>>>
>>> Wouldn't IS_ENABLED(BLOBLIST) || IS_ENABLED(SPL_BLOBLIST) be enough?
>>> Inside the OF_BOARD portion of the function, search for a bloblist if
>>> the option is enabled.  If you can't find a bloblist and the DT within
>>> that bloblist, then error out
>>
>> Just my 2c here.
>> I think all options should be possible to disable. It means I can imagine to
>> disable u-boot not to take care about DT provided from previous stage. The same
>> is for TPM event log. IMHO every stage should have an option to simply ignore
>> data pass from previous stage. I don't really mind how it is done but there
>> should be an option to by purpose say to ignore the part of pass data.
> 
> That would be done by disabling BLOBLIST.  I don't think having a Kconfig to say
> "I want a bloblist, but I only want the DT from there" is reasonable
> (or for any other item the bloblist can carry).   OF_BOARD means the
> DT will come from a previous stage loader. If bloblist is enabled then
> the DT must come from there.

I don't agree on this. If bloblist is enabled and DT is passed SW should have a 
freedom to ignore it.

At start everything is likely in sync but later stages before U-Boot can stay at 
certain version but there could be a need to update u-boot where DT from 
previous stage could be broken.


>>
>> Regarding DT part. We are experimenting with TF-A injecting for example DDR
>> memory reservation to DT.
>> Injection is working properly if you are using single DT but in SOM case we are
>> using FIT image with a lot of DTBs inside (issue with checksums calculation).
>> I see couple of platforms (IIRC renesas/imx) which are using DT overlays and
>> passing it via specific registers. For these using bloblist might be right way
>> to go.
> 
> Yes that's in fact the purpose of that spec.

Good that I read it properly.

Thanks,
Michal


^ permalink raw reply	[flat|nested] 86+ messages in thread

* Re: [PATCH 30/32] fdt: Allow the devicetree to come from a bloblist
  2023-09-11 10:58                     ` Michal Simek
@ 2023-09-11 11:47                       ` Ilias Apalodimas
  2023-09-21  1:03                         ` Simon Glass
  0 siblings, 1 reply; 86+ messages in thread
From: Ilias Apalodimas @ 2023-09-11 11:47 UTC (permalink / raw)
  To: Michal Simek
  Cc: Simon Glass, U-Boot Mailing List, Tom Rini, Marek Vasut,
	Baruch Siach, Bin Meng, Heinrich Schuchardt, Nikhil M Jain,
	Qu Wenruo, Stefan Roese

Hi Michal,

On Mon, 11 Sept 2023 at 13:58, Michal Simek <michal.simek@amd.com> wrote:
>
> Hi Ilias,
>
> On 9/11/23 09:56, Ilias Apalodimas wrote:
> > Hi Michal,
> >
> > On Mon, 11 Sept 2023 at 09:38, Michal Simek <michal.simek@amd.com> wrote:
> >>
> >>
> >>
> >> On 9/11/23 08:17, Ilias Apalodimas wrote:
> >>> Hi Simon,
> >>>
> >>> On Sun, 10 Sept 2023 at 22:14, Simon Glass <sjg@chromium.org> wrote:
> >>>>
> >>>> Hi Ilias,
> >>>>
> >>>> On Mon, 4 Sept 2023 at 03:31, Ilias Apalodimas
> >>>> <ilias.apalodimas@linaro.org> wrote:
> >>>>>
> >>>>> Hi Simon,
> >>>>>
> >>>>> On Fri, 1 Sept 2023 at 18:51, Simon Glass <sjg@chromium.org> wrote:
> >>>>>>
> >>>>>> Hi Ilias,
> >>>>>>
> >>>>>> On Fri, 1 Sept 2023 at 01:50, Ilias Apalodimas <ilias.apalodimas@linaro.org> wrote:
> >>>>>>>
> >>>>>>> [...]
> >>>>>>>
> >>>>>>>>>
> >>>>>>>>>> +config OF_BLOBLIST
> >>>>>>>>>> +     bool "DTB is provided by a bloblist"
> >>>>>>>>>> +     help
> >>>>>>>>>> +       Select this to read the devicetree from the bloblist. This allows
> >>>>>>>>>> +       using a bloblist to transfer the devicetree between  U-Boot phases.
> >>>>>>>>>> +       The devicetree is stored in the bloblist by an early phase so that
> >>>>>>>>>> +       U-Boot can read it.
> >>>>>>>>>> +
> >>>>>>>>>
> >>>>>>>>> I dont think this is a good idea.  We used to have 4-5 different options
> >>>>>>>>> here, which we tried to clean up and ended up with two very discrete
> >>>>>>>>> options.  Why do we have to reintroduce a new one?  Doesn't that bloblist
> >>>>>>>>> have a header of some sort?  The bloblist literally comes from a previous
> >>>>>>>>> stage bootloader which is what OF_BOARD is here for. So why can't we just
> >>>>>>>>> read the header and figure out if the magic of the bloblist matches?
> >>>>>>>>
> >>>>>>>> No, OF_BOARD is a hack to allow boards to do what they like with the FDT.
> >>>>>>>>
> >>>>>>>> This patch is a standard mechanism to pass the DT from one firmware
> >>>>>>>> phase to the next. We have spent quite a bit of time creating a spec
> >>>>>>>> for it, and we should use it.
> >>>>>>>
> >>>>>>> Where exactly am I objecting using the spec?   Can you please re-read my email?
> >>>>>>> I am actually pointing out we should use the spec *properly*.  So
> >>>>>>> instead of having a Kconfig option for the DT, which is pretty
> >>>>>>> pointless,  we should parse the bloblist.  If the header defined by
> >>>>>>> the *spec* is found, we should just search for the DT in there.
> >>>>>>> What you are doing here, is take the spec, pick a very specific item
> >>>>>>> that the list contains, and create a Kconfig option out of it.  Which
> >>>>>>> basically ignores the discoverable options of the bloblist.  For
> >>>>>>> example, that bloblist can also contain an entry to a TPM eventlog.
> >>>>>>> Should we start creating Kconfig options for all the firmware handoff
> >>>>>>> entries that are defined on that spec?
> >>>>>>
> >>>>>> OK so that is a different thing. What should it do if it expects to find a bloblist but cannot? I want it to throw an error, because I am trying to make the boot deterministic. What do you think?
> >>>>>
> >>>>> That's fine by me.  You can even put that under IS_ENABLED for the
> >>>>> bloblist inside the existing OF_BOARD check.  So I was thinking
> >>>>> - If no bloblist is required in Kconfig options we do the hacks we used to
> >>>>> - if bloblist is selected and the config option is OF_BOARD, throw an
> >>>>> error and mention that the previous stage loader should hand over a DT
> >>>>>
> >>>>> Is that what you had in mind?
> >>>>
> >>>> Yes, that sounds good to me.
> >>>>
> >>>> But I still think we need an OF_BLOBLIST option to control whether the
> >>>> devicetree comes from there.
> >>>>    Otherwise we will end up with people
> >>>> using OF_BOARD to work around it. We also have the SPL case which does
> >>>> not pass the DT in a bloblist...in fact SPL typically doesn't even
> >>>> have the full DT.
> >>>
> >>> Wouldn't IS_ENABLED(BLOBLIST) || IS_ENABLED(SPL_BLOBLIST) be enough?
> >>> Inside the OF_BOARD portion of the function, search for a bloblist if
> >>> the option is enabled.  If you can't find a bloblist and the DT within
> >>> that bloblist, then error out
> >>
> >> Just my 2c here.
> >> I think all options should be possible to disable. It means I can imagine to
> >> disable u-boot not to take care about DT provided from previous stage. The same
> >> is for TPM event log. IMHO every stage should have an option to simply ignore
> >> data pass from previous stage. I don't really mind how it is done but there
> >> should be an option to by purpose say to ignore the part of pass data.
> >
> > That would be done by disabling BLOBLIST.  I don't think having a Kconfig to say
> > "I want a bloblist, but I only want the DT from there" is reasonable
> > (or for any other item the bloblist can carry).   OF_BOARD means the
> > DT will come from a previous stage loader. If bloblist is enabled then
> > the DT must come from there.
>
> I don't agree on this. If bloblist is enabled and DT is passed SW should have a
> freedom to ignore it.
>
> At start everything is likely in sync but later stages before U-Boot can stay at
> certain version but there could be a need to update u-boot where DT from
> previous stage could be broken.

But you *can* ignore it and load a different one later.  The only
restriction is that if you compile u-boot with the assumption an early
stage bootloader provides a DT you *must* find it.  But we will still
just keep 2 options in U-Boot of how you get a DT.
A previous loader provided it or U-Boot provided it.  Whether that
comes from a bloblist or a register is irrelevant no ?

[...]


Thanks

/Ilias

^ permalink raw reply	[flat|nested] 86+ messages in thread

* Re: [PATCH 05/32] spl: mx6: powerpc: Drop the condition on timer_init()
  2023-08-31 17:50   ` Tom Rini
@ 2023-09-21  1:03     ` Simon Glass
  2023-09-26 11:37       ` Simon Glass
  0 siblings, 1 reply; 86+ messages in thread
From: Simon Glass @ 2023-09-21  1:03 UTC (permalink / raw)
  To: Tom Rini, Christophe Leroy, Marek Behún
  Cc: U-Boot Mailing List, Marek Vasut, Andy Fleming, Mario Six,
	Nathan Barrett-Morrison, Nikhil M Jain, Priyanka Jain,
	Stefan Roese

Hi Tom,

On Thu, 31 Aug 2023 at 11:51, Tom Rini <trini@konsulko.com> wrote:
>
> On Wed, Aug 30, 2023 at 12:04:36PM -0600, Simon Glass wrote:
>
> > It doesn't make sense to have some boards do this differently. Drop the
> > condition in the hope that the maintainers can figure out any run-time
> > problems.
> >
> > Signed-off-by: Simon Glass <sjg@chromium.org>
> > ---
> >
> >  common/spl/spl.c | 6 ------
> >  1 file changed, 6 deletions(-)
> >
> > diff --git a/common/spl/spl.c b/common/spl/spl.c
> > index 78db9ef5318..3f513b0563a 100644
> > --- a/common/spl/spl.c
> > +++ b/common/spl/spl.c
> > @@ -766,13 +766,7 @@ void board_init_r(gd_t *dummy1, ulong dummy2)
> >               if (spl_init())
> >                       hang();
> >       }
> > -#if !defined(CONFIG_PPC) && !defined(CONFIG_ARCH_MX6)
> > -     /*
> > -      * timer_init() does not exist on PPC systems. The timer is initialized
> > -      * and enabled (decrementer) in interrupt_init() here.
> > -      */
> >       timer_init();
> > -#endif
>
> PowerPC might be a little tricky, did qemu-ppce500 run?  And please
> reach out to some of the iMX folks instead of just dropping this and
> hoping it works.

Yes, CI passes.

+Christophe Leroy
+Marek Behún

PowerPC people, does this look OK?

Regards,
Simon

^ permalink raw reply	[flat|nested] 86+ messages in thread

* Re: [PATCH 09/32] spl: Avoid an #ifdef when printing gd->malloc_ptr
  2023-08-30 21:39   ` Tom Rini
@ 2023-09-21  1:03     ` Simon Glass
  2023-09-21 15:35       ` Tom Rini
  0 siblings, 1 reply; 86+ messages in thread
From: Simon Glass @ 2023-09-21  1:03 UTC (permalink / raw)
  To: Tom Rini
  Cc: U-Boot Mailing List, Marek Vasut, Bin Meng, Heinrich Schuchardt,
	Nathan Barrett-Morrison, Nikhil M Jain, Rasmus Villemoes,
	Stefan Roese

Hi Tom,

On Wed, 30 Aug 2023 at 15:39, Tom Rini <trini@konsulko.com> wrote:
>
> On Wed, Aug 30, 2023 at 12:04:40PM -0600, Simon Glass wrote:
> > Use an accessor in the header file to avoid this.
> >
> > Signed-off-by: Simon Glass <sjg@chromium.org>
> > ---
> >
> >  common/spl/spl.c                  | 9 +++++----
> >  include/asm-generic/global_data.h | 7 +++++++
> >  2 files changed, 12 insertions(+), 4 deletions(-)
> >
> > diff --git a/common/spl/spl.c b/common/spl/spl.c
> > index f0a90c280da..f5cef81000c 100644
> > --- a/common/spl/spl.c
> > +++ b/common/spl/spl.c
> > @@ -876,10 +876,11 @@ void board_init_r(gd_t *dummy1, ulong dummy2)
> >       } else {
> >               debug("Unsupported OS image.. Jumping nevertheless..\n");
> >       }
> > -#if CONFIG_VAL(SYS_MALLOC_F_LEN) && !defined(CONFIG_SPL_SYS_MALLOC_SIZE)
> > -     debug("SPL malloc() used 0x%lx bytes (%ld KB)\n", gd->malloc_ptr,
> > -           gd->malloc_ptr / 1024);
> > -#endif
> > +     if (IS_ENABLED(CONFIG_SYS_MALLOC_F) &&
> > +         !IS_ENABLED(CONFIG_SPL_SYS_MALLOC_SIZE))
> > +             debug("SPL malloc() used 0x%lx bytes (%ld KB)\n",
> > +                   gd_malloc_ptr(), gd_malloc_ptr() / 1024);
> > +
> >       bootstage_mark_name(get_bootstage_id(false), "end phase");
> >  #ifdef CONFIG_BOOTSTAGE_STASH
> >       ret = bootstage_stash((void *)CONFIG_BOOTSTAGE_STASH_ADDR,
> > diff --git a/include/asm-generic/global_data.h b/include/asm-generic/global_data.h
> > index 8fc205ded1a..edf9ff6823f 100644
> > --- a/include/asm-generic/global_data.h
> > +++ b/include/asm-generic/global_data.h
> > @@ -573,6 +573,13 @@ static_assert(sizeof(struct global_data) == GD_SIZE);
> >  #define gd_malloc_start()    0
> >  #define gd_set_malloc_start(val)
> >  #endif
> > +
> > +#if CONFIG_VAL(SYS_MALLOC_F_LEN)
> > +#define gd_malloc_ptr()              gd->malloc_ptr
> > +#else
> > +#define gd_malloc_ptr()              0L
> > +#endif
> > +
> >  /**
> >   * enum gd_flags - global data flags
> >   *
>
> This is another case where readability is not improved. I also have a
> bad feeling that changing that exact area had some unintended
> consequences from the compiler, that totally should not have happened.
> But maybe that was something in a similar code section instead.

The improvement is in the C file...here we have an accessor in the
header file as has been done elsewhere.

Do you have any more details on the problem you mention? I will align
the accessor to the struct member which should resolve it.

Regards,
Simon

^ permalink raw reply	[flat|nested] 86+ messages in thread

* Re: [PATCH 30/32] fdt: Allow the devicetree to come from a bloblist
  2023-09-11 11:47                       ` Ilias Apalodimas
@ 2023-09-21  1:03                         ` Simon Glass
  2023-09-25 10:18                           ` Ilias Apalodimas
  0 siblings, 1 reply; 86+ messages in thread
From: Simon Glass @ 2023-09-21  1:03 UTC (permalink / raw)
  To: Ilias Apalodimas
  Cc: Michal Simek, U-Boot Mailing List, Tom Rini, Marek Vasut,
	Baruch Siach, Bin Meng, Heinrich Schuchardt, Nikhil M Jain,
	Qu Wenruo, Stefan Roese

Hi,

On Mon, 11 Sept 2023 at 05:48, Ilias Apalodimas
<ilias.apalodimas@linaro.org> wrote:
>
> Hi Michal,
>
> On Mon, 11 Sept 2023 at 13:58, Michal Simek <michal.simek@amd.com> wrote:
> >
> > Hi Ilias,
> >
> > On 9/11/23 09:56, Ilias Apalodimas wrote:
> > > Hi Michal,
> > >
> > > On Mon, 11 Sept 2023 at 09:38, Michal Simek <michal.simek@amd.com> wrote:
> > >>
> > >>
> > >>
> > >> On 9/11/23 08:17, Ilias Apalodimas wrote:
> > >>> Hi Simon,
> > >>>
> > >>> On Sun, 10 Sept 2023 at 22:14, Simon Glass <sjg@chromium.org> wrote:
> > >>>>
> > >>>> Hi Ilias,
> > >>>>
> > >>>> On Mon, 4 Sept 2023 at 03:31, Ilias Apalodimas
> > >>>> <ilias.apalodimas@linaro.org> wrote:
> > >>>>>
> > >>>>> Hi Simon,
> > >>>>>
> > >>>>> On Fri, 1 Sept 2023 at 18:51, Simon Glass <sjg@chromium.org> wrote:
> > >>>>>>
> > >>>>>> Hi Ilias,
> > >>>>>>
> > >>>>>> On Fri, 1 Sept 2023 at 01:50, Ilias Apalodimas <ilias.apalodimas@linaro.org> wrote:
> > >>>>>>>
> > >>>>>>> [...]
> > >>>>>>>
> > >>>>>>>>>
> > >>>>>>>>>> +config OF_BLOBLIST
> > >>>>>>>>>> +     bool "DTB is provided by a bloblist"
> > >>>>>>>>>> +     help
> > >>>>>>>>>> +       Select this to read the devicetree from the bloblist. This allows
> > >>>>>>>>>> +       using a bloblist to transfer the devicetree between  U-Boot phases.
> > >>>>>>>>>> +       The devicetree is stored in the bloblist by an early phase so that
> > >>>>>>>>>> +       U-Boot can read it.
> > >>>>>>>>>> +
> > >>>>>>>>>
> > >>>>>>>>> I dont think this is a good idea.  We used to have 4-5 different options
> > >>>>>>>>> here, which we tried to clean up and ended up with two very discrete
> > >>>>>>>>> options.  Why do we have to reintroduce a new one?  Doesn't that bloblist
> > >>>>>>>>> have a header of some sort?  The bloblist literally comes from a previous
> > >>>>>>>>> stage bootloader which is what OF_BOARD is here for. So why can't we just
> > >>>>>>>>> read the header and figure out if the magic of the bloblist matches?
> > >>>>>>>>
> > >>>>>>>> No, OF_BOARD is a hack to allow boards to do what they like with the FDT.
> > >>>>>>>>
> > >>>>>>>> This patch is a standard mechanism to pass the DT from one firmware
> > >>>>>>>> phase to the next. We have spent quite a bit of time creating a spec
> > >>>>>>>> for it, and we should use it.
> > >>>>>>>
> > >>>>>>> Where exactly am I objecting using the spec?   Can you please re-read my email?
> > >>>>>>> I am actually pointing out we should use the spec *properly*.  So
> > >>>>>>> instead of having a Kconfig option for the DT, which is pretty
> > >>>>>>> pointless,  we should parse the bloblist.  If the header defined by
> > >>>>>>> the *spec* is found, we should just search for the DT in there.
> > >>>>>>> What you are doing here, is take the spec, pick a very specific item
> > >>>>>>> that the list contains, and create a Kconfig option out of it.  Which
> > >>>>>>> basically ignores the discoverable options of the bloblist.  For
> > >>>>>>> example, that bloblist can also contain an entry to a TPM eventlog.
> > >>>>>>> Should we start creating Kconfig options for all the firmware handoff
> > >>>>>>> entries that are defined on that spec?
> > >>>>>>
> > >>>>>> OK so that is a different thing. What should it do if it expects to find a bloblist but cannot? I want it to throw an error, because I am trying to make the boot deterministic. What do you think?
> > >>>>>
> > >>>>> That's fine by me.  You can even put that under IS_ENABLED for the
> > >>>>> bloblist inside the existing OF_BOARD check.  So I was thinking
> > >>>>> - If no bloblist is required in Kconfig options we do the hacks we used to
> > >>>>> - if bloblist is selected and the config option is OF_BOARD, throw an
> > >>>>> error and mention that the previous stage loader should hand over a DT
> > >>>>>
> > >>>>> Is that what you had in mind?
> > >>>>
> > >>>> Yes, that sounds good to me.
> > >>>>
> > >>>> But I still think we need an OF_BLOBLIST option to control whether the
> > >>>> devicetree comes from there.
> > >>>>    Otherwise we will end up with people
> > >>>> using OF_BOARD to work around it. We also have the SPL case which does
> > >>>> not pass the DT in a bloblist...in fact SPL typically doesn't even
> > >>>> have the full DT.
> > >>>
> > >>> Wouldn't IS_ENABLED(BLOBLIST) || IS_ENABLED(SPL_BLOBLIST) be enough?
> > >>> Inside the OF_BOARD portion of the function, search for a bloblist if
> > >>> the option is enabled.  If you can't find a bloblist and the DT within
> > >>> that bloblist, then error out
> > >>
> > >> Just my 2c here.
> > >> I think all options should be possible to disable. It means I can imagine to
> > >> disable u-boot not to take care about DT provided from previous stage. The same
> > >> is for TPM event log. IMHO every stage should have an option to simply ignore
> > >> data pass from previous stage. I don't really mind how it is done but there
> > >> should be an option to by purpose say to ignore the part of pass data.
> > >
> > > That would be done by disabling BLOBLIST.  I don't think having a Kconfig to say
> > > "I want a bloblist, but I only want the DT from there" is reasonable
> > > (or for any other item the bloblist can carry).   OF_BOARD means the
> > > DT will come from a previous stage loader. If bloblist is enabled then
> > > the DT must come from there.
> >
> > I don't agree on this. If bloblist is enabled and DT is passed SW should have a
> > freedom to ignore it.
> >
> > At start everything is likely in sync but later stages before U-Boot can stay at
> > certain version but there could be a need to update u-boot where DT from
> > previous stage could be broken.
>
> But you *can* ignore it and load a different one later.  The only
> restriction is that if you compile u-boot with the assumption an early
> stage bootloader provides a DT you *must* find it.  But we will still
> just keep 2 options in U-Boot of how you get a DT.
> A previous loader provided it or U-Boot provided it.  Whether that
> comes from a bloblist or a register is irrelevant no ?

I'm not sure what is being requested here, so I'll leave this as is for v2.

The main struggle I have is how to tell whether you expect to
*receive* the DT in the bloblist, or expect it to be attached to the
image and be *sent* to the next phase.

SPL - attached to image, send in bloblist
U-Boot proper - not attached to image, receive it from bloblist

This is exactly the problem that is solved by the 'standard passage'
stuff [1] but that depends on Firmware Handoff and [2] which are not
ready yet...

So I think what I have is the best we can do for now.

Regards,
Simon

[1] https://patchwork.ozlabs.org/project/uboot/list/?series=281465&state=*
[2] https://patchwork.ozlabs.org/project/uboot/list/?series=365719

^ permalink raw reply	[flat|nested] 86+ messages in thread

* Re: [PATCH 09/32] spl: Avoid an #ifdef when printing gd->malloc_ptr
  2023-09-21  1:03     ` Simon Glass
@ 2023-09-21 15:35       ` Tom Rini
  2023-09-22 18:27         ` Simon Glass
  0 siblings, 1 reply; 86+ messages in thread
From: Tom Rini @ 2023-09-21 15:35 UTC (permalink / raw)
  To: Simon Glass
  Cc: U-Boot Mailing List, Marek Vasut, Bin Meng, Heinrich Schuchardt,
	Nathan Barrett-Morrison, Nikhil M Jain, Rasmus Villemoes,
	Stefan Roese

[-- Attachment #1: Type: text/plain, Size: 3323 bytes --]

On Wed, Sep 20, 2023 at 07:03:34PM -0600, Simon Glass wrote:
> Hi Tom,
> 
> On Wed, 30 Aug 2023 at 15:39, Tom Rini <trini@konsulko.com> wrote:
> >
> > On Wed, Aug 30, 2023 at 12:04:40PM -0600, Simon Glass wrote:
> > > Use an accessor in the header file to avoid this.
> > >
> > > Signed-off-by: Simon Glass <sjg@chromium.org>
> > > ---
> > >
> > >  common/spl/spl.c                  | 9 +++++----
> > >  include/asm-generic/global_data.h | 7 +++++++
> > >  2 files changed, 12 insertions(+), 4 deletions(-)
> > >
> > > diff --git a/common/spl/spl.c b/common/spl/spl.c
> > > index f0a90c280da..f5cef81000c 100644
> > > --- a/common/spl/spl.c
> > > +++ b/common/spl/spl.c
> > > @@ -876,10 +876,11 @@ void board_init_r(gd_t *dummy1, ulong dummy2)
> > >       } else {
> > >               debug("Unsupported OS image.. Jumping nevertheless..\n");
> > >       }
> > > -#if CONFIG_VAL(SYS_MALLOC_F_LEN) && !defined(CONFIG_SPL_SYS_MALLOC_SIZE)
> > > -     debug("SPL malloc() used 0x%lx bytes (%ld KB)\n", gd->malloc_ptr,
> > > -           gd->malloc_ptr / 1024);
> > > -#endif
> > > +     if (IS_ENABLED(CONFIG_SYS_MALLOC_F) &&
> > > +         !IS_ENABLED(CONFIG_SPL_SYS_MALLOC_SIZE))
> > > +             debug("SPL malloc() used 0x%lx bytes (%ld KB)\n",
> > > +                   gd_malloc_ptr(), gd_malloc_ptr() / 1024);

This is not more readable.  But I guess my comment was unclear as you're
mixing changes here.  gd_malloc_ptr() rather than gd->malloc_ptr is a
wash, to me.  I think one could argue it's not a helpful abstraction.
but it's so that you can avoid CONFIG_VAL here, and say "if (...)" not
"#if ..." here.

> > > +
> > >       bootstage_mark_name(get_bootstage_id(false), "end phase");
> > >  #ifdef CONFIG_BOOTSTAGE_STASH
> > >       ret = bootstage_stash((void *)CONFIG_BOOTSTAGE_STASH_ADDR,
> > > diff --git a/include/asm-generic/global_data.h b/include/asm-generic/global_data.h
> > > index 8fc205ded1a..edf9ff6823f 100644
> > > --- a/include/asm-generic/global_data.h
> > > +++ b/include/asm-generic/global_data.h
> > > @@ -573,6 +573,13 @@ static_assert(sizeof(struct global_data) == GD_SIZE);
> > >  #define gd_malloc_start()    0
> > >  #define gd_set_malloc_start(val)
> > >  #endif
> > > +
> > > +#if CONFIG_VAL(SYS_MALLOC_F_LEN)
> > > +#define gd_malloc_ptr()              gd->malloc_ptr
> > > +#else
> > > +#define gd_malloc_ptr()              0L
> > > +#endif
> > > +
> > >  /**
> > >   * enum gd_flags - global data flags
> > >   *
> >
> > This is another case where readability is not improved. I also have a
> > bad feeling that changing that exact area had some unintended
> > consequences from the compiler, that totally should not have happened.
> > But maybe that was something in a similar code section instead.
> 
> The improvement is in the C file...here we have an accessor in the
> header file as has been done elsewhere.
> 
> Do you have any more details on the problem you mention? I will align
> the accessor to the struct member which should resolve it.

It's unfortunately one of those cases to do a global before/after build
and see if anything does or does not get tripped up.  As I believe I did
use CONFIG_VAL there and not a check on CONFIG_SYS_MALLOC_F itself for a
reason, at the time.

-- 
Tom

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 659 bytes --]

^ permalink raw reply	[flat|nested] 86+ messages in thread

* Re: [PATCH 09/32] spl: Avoid an #ifdef when printing gd->malloc_ptr
  2023-09-21 15:35       ` Tom Rini
@ 2023-09-22 18:27         ` Simon Glass
  2023-09-22 19:28           ` Tom Rini
  0 siblings, 1 reply; 86+ messages in thread
From: Simon Glass @ 2023-09-22 18:27 UTC (permalink / raw)
  To: Tom Rini
  Cc: U-Boot Mailing List, Marek Vasut, Bin Meng, Heinrich Schuchardt,
	Nathan Barrett-Morrison, Nikhil M Jain, Rasmus Villemoes,
	Stefan Roese

Hi Tom,

On Thu, 21 Sept 2023 at 09:36, Tom Rini <trini@konsulko.com> wrote:
>
> On Wed, Sep 20, 2023 at 07:03:34PM -0600, Simon Glass wrote:
> > Hi Tom,
> >
> > On Wed, 30 Aug 2023 at 15:39, Tom Rini <trini@konsulko.com> wrote:
> > >
> > > On Wed, Aug 30, 2023 at 12:04:40PM -0600, Simon Glass wrote:
> > > > Use an accessor in the header file to avoid this.
> > > >
> > > > Signed-off-by: Simon Glass <sjg@chromium.org>
> > > > ---
> > > >
> > > >  common/spl/spl.c                  | 9 +++++----
> > > >  include/asm-generic/global_data.h | 7 +++++++
> > > >  2 files changed, 12 insertions(+), 4 deletions(-)
> > > >
> > > > diff --git a/common/spl/spl.c b/common/spl/spl.c
> > > > index f0a90c280da..f5cef81000c 100644
> > > > --- a/common/spl/spl.c
> > > > +++ b/common/spl/spl.c
> > > > @@ -876,10 +876,11 @@ void board_init_r(gd_t *dummy1, ulong dummy2)
> > > >       } else {
> > > >               debug("Unsupported OS image.. Jumping nevertheless..\n");
> > > >       }
> > > > -#if CONFIG_VAL(SYS_MALLOC_F_LEN) && !defined(CONFIG_SPL_SYS_MALLOC_SIZE)
> > > > -     debug("SPL malloc() used 0x%lx bytes (%ld KB)\n", gd->malloc_ptr,
> > > > -           gd->malloc_ptr / 1024);
> > > > -#endif
> > > > +     if (IS_ENABLED(CONFIG_SYS_MALLOC_F) &&
> > > > +         !IS_ENABLED(CONFIG_SPL_SYS_MALLOC_SIZE))
> > > > +             debug("SPL malloc() used 0x%lx bytes (%ld KB)\n",
> > > > +                   gd_malloc_ptr(), gd_malloc_ptr() / 1024);
>
> This is not more readable.  But I guess my comment was unclear as you're
> mixing changes here.  gd_malloc_ptr() rather than gd->malloc_ptr is a
> wash, to me.  I think one could argue it's not a helpful abstraction.
> but it's so that you can avoid CONFIG_VAL here, and say "if (...)" not
> "#if ..." here.

Yes,

>
> > > > +
> > > >       bootstage_mark_name(get_bootstage_id(false), "end phase");
> > > >  #ifdef CONFIG_BOOTSTAGE_STASH
> > > >       ret = bootstage_stash((void *)CONFIG_BOOTSTAGE_STASH_ADDR,
> > > > diff --git a/include/asm-generic/global_data.h b/include/asm-generic/global_data.h
> > > > index 8fc205ded1a..edf9ff6823f 100644
> > > > --- a/include/asm-generic/global_data.h
> > > > +++ b/include/asm-generic/global_data.h
> > > > @@ -573,6 +573,13 @@ static_assert(sizeof(struct global_data) == GD_SIZE);
> > > >  #define gd_malloc_start()    0
> > > >  #define gd_set_malloc_start(val)
> > > >  #endif
> > > > +
> > > > +#if CONFIG_VAL(SYS_MALLOC_F_LEN)
> > > > +#define gd_malloc_ptr()              gd->malloc_ptr
> > > > +#else
> > > > +#define gd_malloc_ptr()              0L
> > > > +#endif
> > > > +
> > > >  /**
> > > >   * enum gd_flags - global data flags
> > > >   *
> > >
> > > This is another case where readability is not improved. I also have a
> > > bad feeling that changing that exact area had some unintended
> > > consequences from the compiler, that totally should not have happened.
> > > But maybe that was something in a similar code section instead.
> >
> > The improvement is in the C file...here we have an accessor in the
> > header file as has been done elsewhere.
> >
> > Do you have any more details on the problem you mention? I will align
> > the accessor to the struct member which should resolve it.
>
> It's unfortunately one of those cases to do a global before/after build
> and see if anything does or does not get tripped up.  As I believe I did
> use CONFIG_VAL there and not a check on CONFIG_SYS_MALLOC_F itself for a
> reason, at the time.

But the CONFIG_VAL symbols actually depends on CONFIG_SYS_MALLOC_F, so
I can't imagine what it might be. Of course if the value is 0, then
the 'if CONFIG_VAL()' test would fail, but to what purpose?

Regards,
Simon

^ permalink raw reply	[flat|nested] 86+ messages in thread

* Re: [PATCH 09/32] spl: Avoid an #ifdef when printing gd->malloc_ptr
  2023-09-22 18:27         ` Simon Glass
@ 2023-09-22 19:28           ` Tom Rini
  2023-09-22 23:06             ` Simon Glass
  0 siblings, 1 reply; 86+ messages in thread
From: Tom Rini @ 2023-09-22 19:28 UTC (permalink / raw)
  To: Simon Glass
  Cc: U-Boot Mailing List, Marek Vasut, Bin Meng, Heinrich Schuchardt,
	Nathan Barrett-Morrison, Nikhil M Jain, Rasmus Villemoes,
	Stefan Roese

[-- Attachment #1: Type: text/plain, Size: 4370 bytes --]

On Fri, Sep 22, 2023 at 12:27:36PM -0600, Simon Glass wrote:
> Hi Tom,
> 
> On Thu, 21 Sept 2023 at 09:36, Tom Rini <trini@konsulko.com> wrote:
> >
> > On Wed, Sep 20, 2023 at 07:03:34PM -0600, Simon Glass wrote:
> > > Hi Tom,
> > >
> > > On Wed, 30 Aug 2023 at 15:39, Tom Rini <trini@konsulko.com> wrote:
> > > >
> > > > On Wed, Aug 30, 2023 at 12:04:40PM -0600, Simon Glass wrote:
> > > > > Use an accessor in the header file to avoid this.
> > > > >
> > > > > Signed-off-by: Simon Glass <sjg@chromium.org>
> > > > > ---
> > > > >
> > > > >  common/spl/spl.c                  | 9 +++++----
> > > > >  include/asm-generic/global_data.h | 7 +++++++
> > > > >  2 files changed, 12 insertions(+), 4 deletions(-)
> > > > >
> > > > > diff --git a/common/spl/spl.c b/common/spl/spl.c
> > > > > index f0a90c280da..f5cef81000c 100644
> > > > > --- a/common/spl/spl.c
> > > > > +++ b/common/spl/spl.c
> > > > > @@ -876,10 +876,11 @@ void board_init_r(gd_t *dummy1, ulong dummy2)
> > > > >       } else {
> > > > >               debug("Unsupported OS image.. Jumping nevertheless..\n");
> > > > >       }
> > > > > -#if CONFIG_VAL(SYS_MALLOC_F_LEN) && !defined(CONFIG_SPL_SYS_MALLOC_SIZE)
> > > > > -     debug("SPL malloc() used 0x%lx bytes (%ld KB)\n", gd->malloc_ptr,
> > > > > -           gd->malloc_ptr / 1024);
> > > > > -#endif
> > > > > +     if (IS_ENABLED(CONFIG_SYS_MALLOC_F) &&
> > > > > +         !IS_ENABLED(CONFIG_SPL_SYS_MALLOC_SIZE))
> > > > > +             debug("SPL malloc() used 0x%lx bytes (%ld KB)\n",
> > > > > +                   gd_malloc_ptr(), gd_malloc_ptr() / 1024);
> >
> > This is not more readable.  But I guess my comment was unclear as you're
> > mixing changes here.  gd_malloc_ptr() rather than gd->malloc_ptr is a
> > wash, to me.  I think one could argue it's not a helpful abstraction.
> > but it's so that you can avoid CONFIG_VAL here, and say "if (...)" not
> > "#if ..." here.
> 
> Yes,
> 
> >
> > > > > +
> > > > >       bootstage_mark_name(get_bootstage_id(false), "end phase");
> > > > >  #ifdef CONFIG_BOOTSTAGE_STASH
> > > > >       ret = bootstage_stash((void *)CONFIG_BOOTSTAGE_STASH_ADDR,
> > > > > diff --git a/include/asm-generic/global_data.h b/include/asm-generic/global_data.h
> > > > > index 8fc205ded1a..edf9ff6823f 100644
> > > > > --- a/include/asm-generic/global_data.h
> > > > > +++ b/include/asm-generic/global_data.h
> > > > > @@ -573,6 +573,13 @@ static_assert(sizeof(struct global_data) == GD_SIZE);
> > > > >  #define gd_malloc_start()    0
> > > > >  #define gd_set_malloc_start(val)
> > > > >  #endif
> > > > > +
> > > > > +#if CONFIG_VAL(SYS_MALLOC_F_LEN)
> > > > > +#define gd_malloc_ptr()              gd->malloc_ptr
> > > > > +#else
> > > > > +#define gd_malloc_ptr()              0L
> > > > > +#endif
> > > > > +
> > > > >  /**
> > > > >   * enum gd_flags - global data flags
> > > > >   *
> > > >
> > > > This is another case where readability is not improved. I also have a
> > > > bad feeling that changing that exact area had some unintended
> > > > consequences from the compiler, that totally should not have happened.
> > > > But maybe that was something in a similar code section instead.
> > >
> > > The improvement is in the C file...here we have an accessor in the
> > > header file as has been done elsewhere.
> > >
> > > Do you have any more details on the problem you mention? I will align
> > > the accessor to the struct member which should resolve it.
> >
> > It's unfortunately one of those cases to do a global before/after build
> > and see if anything does or does not get tripped up.  As I believe I did
> > use CONFIG_VAL there and not a check on CONFIG_SYS_MALLOC_F itself for a
> > reason, at the time.
> 
> But the CONFIG_VAL symbols actually depends on CONFIG_SYS_MALLOC_F, so
> I can't imagine what it might be. Of course if the value is 0, then
> the 'if CONFIG_VAL()' test would fail, but to what purpose?

Yes, there's been a time or two where I banged my head against the
figurative wall trying to understand what exactly the compiler could be
seeing as why to change something.  I don't have a "reasonable"
explanation.  Readability aside, "tidy things up" changes need to be on
their own so that their impact can be seen aside from the new
functionality changes.

-- 
Tom

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 659 bytes --]

^ permalink raw reply	[flat|nested] 86+ messages in thread

* Re: [PATCH 09/32] spl: Avoid an #ifdef when printing gd->malloc_ptr
  2023-09-22 19:28           ` Tom Rini
@ 2023-09-22 23:06             ` Simon Glass
  0 siblings, 0 replies; 86+ messages in thread
From: Simon Glass @ 2023-09-22 23:06 UTC (permalink / raw)
  To: Tom Rini
  Cc: U-Boot Mailing List, Marek Vasut, Bin Meng, Heinrich Schuchardt,
	Nathan Barrett-Morrison, Nikhil M Jain, Rasmus Villemoes,
	Stefan Roese

Hi Tom,

On Fri, 22 Sept 2023 at 13:28, Tom Rini <trini@konsulko.com> wrote:
>
> On Fri, Sep 22, 2023 at 12:27:36PM -0600, Simon Glass wrote:
> > Hi Tom,
> >
> > On Thu, 21 Sept 2023 at 09:36, Tom Rini <trini@konsulko.com> wrote:
> > >
> > > On Wed, Sep 20, 2023 at 07:03:34PM -0600, Simon Glass wrote:
> > > > Hi Tom,
> > > >
> > > > On Wed, 30 Aug 2023 at 15:39, Tom Rini <trini@konsulko.com> wrote:
> > > > >
> > > > > On Wed, Aug 30, 2023 at 12:04:40PM -0600, Simon Glass wrote:
> > > > > > Use an accessor in the header file to avoid this.
> > > > > >
> > > > > > Signed-off-by: Simon Glass <sjg@chromium.org>
> > > > > > ---
> > > > > >
> > > > > >  common/spl/spl.c                  | 9 +++++----
> > > > > >  include/asm-generic/global_data.h | 7 +++++++
> > > > > >  2 files changed, 12 insertions(+), 4 deletions(-)
> > > > > >
> > > > > > diff --git a/common/spl/spl.c b/common/spl/spl.c
> > > > > > index f0a90c280da..f5cef81000c 100644
> > > > > > --- a/common/spl/spl.c
> > > > > > +++ b/common/spl/spl.c
> > > > > > @@ -876,10 +876,11 @@ void board_init_r(gd_t *dummy1, ulong dummy2)
> > > > > >       } else {
> > > > > >               debug("Unsupported OS image.. Jumping nevertheless..\n");
> > > > > >       }
> > > > > > -#if CONFIG_VAL(SYS_MALLOC_F_LEN) && !defined(CONFIG_SPL_SYS_MALLOC_SIZE)
> > > > > > -     debug("SPL malloc() used 0x%lx bytes (%ld KB)\n", gd->malloc_ptr,
> > > > > > -           gd->malloc_ptr / 1024);
> > > > > > -#endif
> > > > > > +     if (IS_ENABLED(CONFIG_SYS_MALLOC_F) &&
> > > > > > +         !IS_ENABLED(CONFIG_SPL_SYS_MALLOC_SIZE))
> > > > > > +             debug("SPL malloc() used 0x%lx bytes (%ld KB)\n",
> > > > > > +                   gd_malloc_ptr(), gd_malloc_ptr() / 1024);
> > >
> > > This is not more readable.  But I guess my comment was unclear as you're
> > > mixing changes here.  gd_malloc_ptr() rather than gd->malloc_ptr is a
> > > wash, to me.  I think one could argue it's not a helpful abstraction.
> > > but it's so that you can avoid CONFIG_VAL here, and say "if (...)" not
> > > "#if ..." here.
> >
> > Yes,
> >
> > >
> > > > > > +
> > > > > >       bootstage_mark_name(get_bootstage_id(false), "end phase");
> > > > > >  #ifdef CONFIG_BOOTSTAGE_STASH
> > > > > >       ret = bootstage_stash((void *)CONFIG_BOOTSTAGE_STASH_ADDR,
> > > > > > diff --git a/include/asm-generic/global_data.h b/include/asm-generic/global_data.h
> > > > > > index 8fc205ded1a..edf9ff6823f 100644
> > > > > > --- a/include/asm-generic/global_data.h
> > > > > > +++ b/include/asm-generic/global_data.h
> > > > > > @@ -573,6 +573,13 @@ static_assert(sizeof(struct global_data) == GD_SIZE);
> > > > > >  #define gd_malloc_start()    0
> > > > > >  #define gd_set_malloc_start(val)
> > > > > >  #endif
> > > > > > +
> > > > > > +#if CONFIG_VAL(SYS_MALLOC_F_LEN)
> > > > > > +#define gd_malloc_ptr()              gd->malloc_ptr
> > > > > > +#else
> > > > > > +#define gd_malloc_ptr()              0L
> > > > > > +#endif
> > > > > > +
> > > > > >  /**
> > > > > >   * enum gd_flags - global data flags
> > > > > >   *
> > > > >
> > > > > This is another case where readability is not improved. I also have a
> > > > > bad feeling that changing that exact area had some unintended
> > > > > consequences from the compiler, that totally should not have happened.
> > > > > But maybe that was something in a similar code section instead.
> > > >
> > > > The improvement is in the C file...here we have an accessor in the
> > > > header file as has been done elsewhere.
> > > >
> > > > Do you have any more details on the problem you mention? I will align
> > > > the accessor to the struct member which should resolve it.
> > >
> > > It's unfortunately one of those cases to do a global before/after build
> > > and see if anything does or does not get tripped up.  As I believe I did
> > > use CONFIG_VAL there and not a check on CONFIG_SYS_MALLOC_F itself for a
> > > reason, at the time.
> >
> > But the CONFIG_VAL symbols actually depends on CONFIG_SYS_MALLOC_F, so
> > I can't imagine what it might be. Of course if the value is 0, then
> > the 'if CONFIG_VAL()' test would fail, but to what purpose?
>
> Yes, there's been a time or two where I banged my head against the
> figurative wall trying to understand what exactly the compiler could be
> seeing as why to change something.  I don't have a "reasonable"
> explanation.  Readability aside, "tidy things up" changes need to be on
> their own so that their impact can be seen aside from the new
> functionality changes.
>

Ah, I see. Yes this is quite a mess. I had not noticed exactly what
was going on there. The _F suffix is not really correct, but I suppose
we want the same symbol in SPL and proper.

I will add a new patch before this one.

Regards,
Simon

^ permalink raw reply	[flat|nested] 86+ messages in thread

* Re: [PATCH 30/32] fdt: Allow the devicetree to come from a bloblist
  2023-09-21  1:03                         ` Simon Glass
@ 2023-09-25 10:18                           ` Ilias Apalodimas
  2023-10-18 15:26                             ` Simon Glass
  0 siblings, 1 reply; 86+ messages in thread
From: Ilias Apalodimas @ 2023-09-25 10:18 UTC (permalink / raw)
  To: Simon Glass
  Cc: Michal Simek, U-Boot Mailing List, Tom Rini, Marek Vasut,
	Baruch Siach, Bin Meng, Heinrich Schuchardt, Nikhil M Jain,
	Qu Wenruo, Stefan Roese

Hi Simon,

[...]

> > > >>>>>>>>>> +config OF_BLOBLIST
> > > >>>>>>>>>> +     bool "DTB is provided by a bloblist"
> > > >>>>>>>>>> +     help
> > > >>>>>>>>>> +       Select this to read the devicetree from the bloblist. This allows
> > > >>>>>>>>>> +       using a bloblist to transfer the devicetree between  U-Boot phases.
> > > >>>>>>>>>> +       The devicetree is stored in the bloblist by an early phase so that
> > > >>>>>>>>>> +       U-Boot can read it.
> > > >>>>>>>>>> +
> > > >>>>>>>>>
> > > >>>>>>>>> I dont think this is a good idea.  We used to have 4-5 different options
> > > >>>>>>>>> here, which we tried to clean up and ended up with two very discrete
> > > >>>>>>>>> options.  Why do we have to reintroduce a new one?  Doesn't that bloblist
> > > >>>>>>>>> have a header of some sort?  The bloblist literally comes from a previous
> > > >>>>>>>>> stage bootloader which is what OF_BOARD is here for. So why can't we just
> > > >>>>>>>>> read the header and figure out if the magic of the bloblist matches?
> > > >>>>>>>>
> > > >>>>>>>> No, OF_BOARD is a hack to allow boards to do what they like with the FDT.
> > > >>>>>>>>
> > > >>>>>>>> This patch is a standard mechanism to pass the DT from one firmware
> > > >>>>>>>> phase to the next. We have spent quite a bit of time creating a spec
> > > >>>>>>>> for it, and we should use it.
> > > >>>>>>>
> > > >>>>>>> Where exactly am I objecting using the spec?   Can you please re-read my email?
> > > >>>>>>> I am actually pointing out we should use the spec *properly*.  So
> > > >>>>>>> instead of having a Kconfig option for the DT, which is pretty
> > > >>>>>>> pointless,  we should parse the bloblist.  If the header defined by
> > > >>>>>>> the *spec* is found, we should just search for the DT in there.
> > > >>>>>>> What you are doing here, is take the spec, pick a very specific item
> > > >>>>>>> that the list contains, and create a Kconfig option out of it.  Which
> > > >>>>>>> basically ignores the discoverable options of the bloblist.  For
> > > >>>>>>> example, that bloblist can also contain an entry to a TPM eventlog.
> > > >>>>>>> Should we start creating Kconfig options for all the firmware handoff
> > > >>>>>>> entries that are defined on that spec?
> > > >>>>>>
> > > >>>>>> OK so that is a different thing. What should it do if it expects to find a bloblist but cannot? I want it to throw an error, because I am trying to make the boot deterministic. What do you think?
> > > >>>>>
> > > >>>>> That's fine by me.  You can even put that under IS_ENABLED for the
> > > >>>>> bloblist inside the existing OF_BOARD check.  So I was thinking
> > > >>>>> - If no bloblist is required in Kconfig options we do the hacks we used to
> > > >>>>> - if bloblist is selected and the config option is OF_BOARD, throw an
> > > >>>>> error and mention that the previous stage loader should hand over a DT
> > > >>>>>
> > > >>>>> Is that what you had in mind?
> > > >>>>
> > > >>>> Yes, that sounds good to me.
> > > >>>>
> > > >>>> But I still think we need an OF_BLOBLIST option to control whether the
> > > >>>> devicetree comes from there.
> > > >>>>    Otherwise we will end up with people
> > > >>>> using OF_BOARD to work around it. We also have the SPL case which does
> > > >>>> not pass the DT in a bloblist...in fact SPL typically doesn't even
> > > >>>> have the full DT.
> > > >>>
> > > >>> Wouldn't IS_ENABLED(BLOBLIST) || IS_ENABLED(SPL_BLOBLIST) be enough?
> > > >>> Inside the OF_BOARD portion of the function, search for a bloblist if
> > > >>> the option is enabled.  If you can't find a bloblist and the DT within
> > > >>> that bloblist, then error out
> > > >>
> > > >> Just my 2c here.
> > > >> I think all options should be possible to disable. It means I can imagine to
> > > >> disable u-boot not to take care about DT provided from previous stage. The same
> > > >> is for TPM event log. IMHO every stage should have an option to simply ignore
> > > >> data pass from previous stage. I don't really mind how it is done but there
> > > >> should be an option to by purpose say to ignore the part of pass data.
> > > >
> > > > That would be done by disabling BLOBLIST.  I don't think having a Kconfig to say
> > > > "I want a bloblist, but I only want the DT from there" is reasonable
> > > > (or for any other item the bloblist can carry).   OF_BOARD means the
> > > > DT will come from a previous stage loader. If bloblist is enabled then
> > > > the DT must come from there.
> > >
> > > I don't agree on this. If bloblist is enabled and DT is passed SW should have a
> > > freedom to ignore it.
> > >
> > > At start everything is likely in sync but later stages before U-Boot can stay at
> > > certain version but there could be a need to update u-boot where DT from
> > > previous stage could be broken.
> >
> > But you *can* ignore it and load a different one later.  The only
> > restriction is that if you compile u-boot with the assumption an early
> > stage bootloader provides a DT you *must* find it.  But we will still
> > just keep 2 options in U-Boot of how you get a DT.
> > A previous loader provided it or U-Boot provided it.  Whether that
> > comes from a bloblist or a register is irrelevant no ?
>
> I'm not sure what is being requested here, so I'll leave this as is for v2.

Please don't.   A few mails above there's a discussion of how I'd
prefer things to look like, please have a look and let me know if
something isn't clear.
tl;dr
 "That's fine by me.  You can even put that under IS_ENABLED for the
 bloblist inside the existing OF_BOARD check.  So I was thinking
 - If no bloblist is required in Kconfig options we do the hacks we used to
 - if bloblist is selected and the config option is OF_BOARD, throw an
error and mention that the previous stage loader should hand over a DT"

>
> The main struggle I have is how to tell whether you expect to
> *receive* the DT in the bloblist, or expect it to be attached to the
> image and be *sent* to the next phase.

bloblist

>
> SPL - attached to image, send in bloblist
> U-Boot proper - not attached to image, receive it from bloblist
>
> This is exactly the problem that is solved by the 'standard passage'
> stuff [1] but that depends on Firmware Handoff and [2] which are not
> ready yet...
>
> So I think what I have is the best we can do for now.

We can avoid the extra complication in Kconfigs.  The DT either comes
from u-boot itself or from a previous stage loader. we don't need the
extra "it comes from a bloblist".
If they come from a previous stage loader and BLOBLIST *is* enabled,
then just scan for the DT, if you don't find it error out.

Thanks
/Ilias
>
> Regards,
> Simon
>
> [1] https://patchwork.ozlabs.org/project/uboot/list/?series=281465&state=*
> [2] https://patchwork.ozlabs.org/project/uboot/list/?series=365719

^ permalink raw reply	[flat|nested] 86+ messages in thread

* Re: [PATCH 05/32] spl: mx6: powerpc: Drop the condition on timer_init()
  2023-09-21  1:03     ` Simon Glass
@ 2023-09-26 11:37       ` Simon Glass
  2023-09-26 13:38         ` Christophe Leroy
  0 siblings, 1 reply; 86+ messages in thread
From: Simon Glass @ 2023-09-26 11:37 UTC (permalink / raw)
  To: Tom Rini, Christophe Leroy, Marek Behún
  Cc: U-Boot Mailing List, Marek Vasut, Andy Fleming, Mario Six,
	Nathan Barrett-Morrison, Nikhil M Jain, Priyanka Jain,
	Stefan Roese

Hi,

On Wed, 20 Sept 2023 at 19:03, Simon Glass <sjg@chromium.org> wrote:
>
> Hi Tom,
>
> On Thu, 31 Aug 2023 at 11:51, Tom Rini <trini@konsulko.com> wrote:
> >
> > On Wed, Aug 30, 2023 at 12:04:36PM -0600, Simon Glass wrote:
> >
> > > It doesn't make sense to have some boards do this differently. Drop the
> > > condition in the hope that the maintainers can figure out any run-time
> > > problems.
> > >
> > > Signed-off-by: Simon Glass <sjg@chromium.org>
> > > ---
> > >
> > >  common/spl/spl.c | 6 ------
> > >  1 file changed, 6 deletions(-)
> > >
> > > diff --git a/common/spl/spl.c b/common/spl/spl.c
> > > index 78db9ef5318..3f513b0563a 100644
> > > --- a/common/spl/spl.c
> > > +++ b/common/spl/spl.c
> > > @@ -766,13 +766,7 @@ void board_init_r(gd_t *dummy1, ulong dummy2)
> > >               if (spl_init())
> > >                       hang();
> > >       }
> > > -#if !defined(CONFIG_PPC) && !defined(CONFIG_ARCH_MX6)
> > > -     /*
> > > -      * timer_init() does not exist on PPC systems. The timer is initialized
> > > -      * and enabled (decrementer) in interrupt_init() here.
> > > -      */
> > >       timer_init();
> > > -#endif
> >
> > PowerPC might be a little tricky, did qemu-ppce500 run?  And please
> > reach out to some of the iMX folks instead of just dropping this and
> > hoping it works.
>
> Yes, CI passes.
>
> +Christophe Leroy
> +Marek Behún
>
> PowerPC people, does this look OK?

Are there any active maintainers for PowerPC?

Apart from this patch, is there any word on the DM_SERIAL migration?

Regards,
Simon

^ permalink raw reply	[flat|nested] 86+ messages in thread

* Re: [PATCH 05/32] spl: mx6: powerpc: Drop the condition on timer_init()
  2023-09-26 11:37       ` Simon Glass
@ 2023-09-26 13:38         ` Christophe Leroy
  0 siblings, 0 replies; 86+ messages in thread
From: Christophe Leroy @ 2023-09-26 13:38 UTC (permalink / raw)
  To: Simon Glass, Tom Rini, Marek Behún
  Cc: U-Boot Mailing List, Marek Vasut, Andy Fleming, Mario Six,
	Nathan Barrett-Morrison, Nikhil M Jain, Priyanka Jain,
	Stefan Roese



Le 26/09/2023 à 13:37, Simon Glass a écrit :
> Hi,
> 
> On Wed, 20 Sept 2023 at 19:03, Simon Glass <sjg@chromium.org> wrote:
>>
>> Hi Tom,
>>
>> On Thu, 31 Aug 2023 at 11:51, Tom Rini <trini@konsulko.com> wrote:
>>>
>>> On Wed, Aug 30, 2023 at 12:04:36PM -0600, Simon Glass wrote:
>>>
>>>> It doesn't make sense to have some boards do this differently. Drop the
>>>> condition in the hope that the maintainers can figure out any run-time
>>>> problems.
>>>>
>>>> Signed-off-by: Simon Glass <sjg@chromium.org>
>>>> ---
>>>>
>>>>   common/spl/spl.c | 6 ------
>>>>   1 file changed, 6 deletions(-)
>>>>
>>>> diff --git a/common/spl/spl.c b/common/spl/spl.c
>>>> index 78db9ef5318..3f513b0563a 100644
>>>> --- a/common/spl/spl.c
>>>> +++ b/common/spl/spl.c
>>>> @@ -766,13 +766,7 @@ void board_init_r(gd_t *dummy1, ulong dummy2)
>>>>                if (spl_init())
>>>>                        hang();
>>>>        }
>>>> -#if !defined(CONFIG_PPC) && !defined(CONFIG_ARCH_MX6)
>>>> -     /*
>>>> -      * timer_init() does not exist on PPC systems. The timer is initialized
>>>> -      * and enabled (decrementer) in interrupt_init() here.
>>>> -      */
>>>>        timer_init();
>>>> -#endif
>>>
>>> PowerPC might be a little tricky, did qemu-ppce500 run?  And please
>>> reach out to some of the iMX folks instead of just dropping this and
>>> hoping it works.
>>
>> Yes, CI passes.
>>
>> +Christophe Leroy
>> +Marek Behún
>>
>> PowerPC people, does this look OK?
> 
> Are there any active maintainers for PowerPC?
> 
> Apart from this patch, is there any word on the DM_SERIAL migration?
> 

The three powerpc boards I maintain (ref. boards/cssi/MAINTAINERS) all 
select DM_SERIAL:

configs/CMPC885_defconfig:CONFIG_DM_SERIAL=y
configs/CMPCPRO_defconfig:CONFIG_DM_SERIAL=y
configs/MCR3000_defconfig:CONFIG_DM_SERIAL=y

Christophe

^ permalink raw reply	[flat|nested] 86+ messages in thread

* Re: [PATCH 30/32] fdt: Allow the devicetree to come from a bloblist
  2023-09-25 10:18                           ` Ilias Apalodimas
@ 2023-10-18 15:26                             ` Simon Glass
  2023-10-20  8:21                               ` Ilias Apalodimas
  0 siblings, 1 reply; 86+ messages in thread
From: Simon Glass @ 2023-10-18 15:26 UTC (permalink / raw)
  To: Ilias Apalodimas
  Cc: Michal Simek, U-Boot Mailing List, Tom Rini, Marek Vasut,
	Baruch Siach, Bin Meng, Heinrich Schuchardt, Nikhil M Jain,
	Qu Wenruo, Stefan Roese

Hi Ilias,

On Mon, 25 Sept 2023 at 04:19, Ilias Apalodimas
<ilias.apalodimas@linaro.org> wrote:
>
> Hi Simon,
>
> [...]
>
> > > > >>>>>>>>>> +config OF_BLOBLIST
> > > > >>>>>>>>>> +     bool "DTB is provided by a bloblist"
> > > > >>>>>>>>>> +     help
> > > > >>>>>>>>>> +       Select this to read the devicetree from the bloblist. This allows
> > > > >>>>>>>>>> +       using a bloblist to transfer the devicetree between  U-Boot phases.
> > > > >>>>>>>>>> +       The devicetree is stored in the bloblist by an early phase so that
> > > > >>>>>>>>>> +       U-Boot can read it.
> > > > >>>>>>>>>> +
> > > > >>>>>>>>>
> > > > >>>>>>>>> I dont think this is a good idea.  We used to have 4-5 different options
> > > > >>>>>>>>> here, which we tried to clean up and ended up with two very discrete
> > > > >>>>>>>>> options.  Why do we have to reintroduce a new one?  Doesn't that bloblist
> > > > >>>>>>>>> have a header of some sort?  The bloblist literally comes from a previous
> > > > >>>>>>>>> stage bootloader which is what OF_BOARD is here for. So why can't we just
> > > > >>>>>>>>> read the header and figure out if the magic of the bloblist matches?
> > > > >>>>>>>>
> > > > >>>>>>>> No, OF_BOARD is a hack to allow boards to do what they like with the FDT.
> > > > >>>>>>>>
> > > > >>>>>>>> This patch is a standard mechanism to pass the DT from one firmware
> > > > >>>>>>>> phase to the next. We have spent quite a bit of time creating a spec
> > > > >>>>>>>> for it, and we should use it.
> > > > >>>>>>>
> > > > >>>>>>> Where exactly am I objecting using the spec?   Can you please re-read my email?
> > > > >>>>>>> I am actually pointing out we should use the spec *properly*.  So
> > > > >>>>>>> instead of having a Kconfig option for the DT, which is pretty
> > > > >>>>>>> pointless,  we should parse the bloblist.  If the header defined by
> > > > >>>>>>> the *spec* is found, we should just search for the DT in there.
> > > > >>>>>>> What you are doing here, is take the spec, pick a very specific item
> > > > >>>>>>> that the list contains, and create a Kconfig option out of it.  Which
> > > > >>>>>>> basically ignores the discoverable options of the bloblist.  For
> > > > >>>>>>> example, that bloblist can also contain an entry to a TPM eventlog.
> > > > >>>>>>> Should we start creating Kconfig options for all the firmware handoff
> > > > >>>>>>> entries that are defined on that spec?
> > > > >>>>>>
> > > > >>>>>> OK so that is a different thing. What should it do if it expects to find a bloblist but cannot? I want it to throw an error, because I am trying to make the boot deterministic. What do you think?
> > > > >>>>>
> > > > >>>>> That's fine by me.  You can even put that under IS_ENABLED for the
> > > > >>>>> bloblist inside the existing OF_BOARD check.  So I was thinking
> > > > >>>>> - If no bloblist is required in Kconfig options we do the hacks we used to
> > > > >>>>> - if bloblist is selected and the config option is OF_BOARD, throw an
> > > > >>>>> error and mention that the previous stage loader should hand over a DT
> > > > >>>>>
> > > > >>>>> Is that what you had in mind?
> > > > >>>>
> > > > >>>> Yes, that sounds good to me.
> > > > >>>>
> > > > >>>> But I still think we need an OF_BLOBLIST option to control whether the
> > > > >>>> devicetree comes from there.
> > > > >>>>    Otherwise we will end up with people
> > > > >>>> using OF_BOARD to work around it. We also have the SPL case which does
> > > > >>>> not pass the DT in a bloblist...in fact SPL typically doesn't even
> > > > >>>> have the full DT.
> > > > >>>
> > > > >>> Wouldn't IS_ENABLED(BLOBLIST) || IS_ENABLED(SPL_BLOBLIST) be enough?
> > > > >>> Inside the OF_BOARD portion of the function, search for a bloblist if
> > > > >>> the option is enabled.  If you can't find a bloblist and the DT within
> > > > >>> that bloblist, then error out
> > > > >>
> > > > >> Just my 2c here.
> > > > >> I think all options should be possible to disable. It means I can imagine to
> > > > >> disable u-boot not to take care about DT provided from previous stage. The same
> > > > >> is for TPM event log. IMHO every stage should have an option to simply ignore
> > > > >> data pass from previous stage. I don't really mind how it is done but there
> > > > >> should be an option to by purpose say to ignore the part of pass data.
> > > > >
> > > > > That would be done by disabling BLOBLIST.  I don't think having a Kconfig to say
> > > > > "I want a bloblist, but I only want the DT from there" is reasonable
> > > > > (or for any other item the bloblist can carry).   OF_BOARD means the
> > > > > DT will come from a previous stage loader. If bloblist is enabled then
> > > > > the DT must come from there.
> > > >
> > > > I don't agree on this. If bloblist is enabled and DT is passed SW should have a
> > > > freedom to ignore it.
> > > >
> > > > At start everything is likely in sync but later stages before U-Boot can stay at
> > > > certain version but there could be a need to update u-boot where DT from
> > > > previous stage could be broken.
> > >
> > > But you *can* ignore it and load a different one later.  The only
> > > restriction is that if you compile u-boot with the assumption an early
> > > stage bootloader provides a DT you *must* find it.  But we will still
> > > just keep 2 options in U-Boot of how you get a DT.
> > > A previous loader provided it or U-Boot provided it.  Whether that
> > > comes from a bloblist or a register is irrelevant no ?
> >
> > I'm not sure what is being requested here, so I'll leave this as is for v2.
>
> Please don't.   A few mails above there's a discussion of how I'd
> prefer things to look like, please have a look and let me know if
> something isn't clear.
> tl;dr
>  "That's fine by me.  You can even put that under IS_ENABLED for the
>  bloblist inside the existing OF_BOARD check.  So I was thinking
>  - If no bloblist is required in Kconfig options we do the hacks we used to
>  - if bloblist is selected and the config option is OF_BOARD, throw an
> error and mention that the previous stage loader should hand over a DT"
>
> >
> > The main struggle I have is how to tell whether you expect to
> > *receive* the DT in the bloblist, or expect it to be attached to the
> > image and be *sent* to the next phase.
>
> bloblist
>
> >
> > SPL - attached to image, send in bloblist
> > U-Boot proper - not attached to image, receive it from bloblist
> >
> > This is exactly the problem that is solved by the 'standard passage'
> > stuff [1] but that depends on Firmware Handoff and [2] which are not
> > ready yet...
> >
> > So I think what I have is the best we can do for now.
>
> We can avoid the extra complication in Kconfigs.  The DT either comes
> from u-boot itself or from a previous stage loader. we don't need the
> extra "it comes from a bloblist".
> If they come from a previous stage loader and BLOBLIST *is* enabled,
> then just scan for the DT, if you don't find it error out.

Are you planning to send a patch for this? Otherwise, what do you
think about going with this one and dealing with OF_BOARD board by
board?

> > [1] https://patchwork.ozlabs.org/project/uboot/list/?series=281465&state=*
> > [2] https://patchwork.ozlabs.org/project/uboot/list/?series=365719


Regards,
Simon

^ permalink raw reply	[flat|nested] 86+ messages in thread

* Re: [PATCH 30/32] fdt: Allow the devicetree to come from a bloblist
  2023-10-18 15:26                             ` Simon Glass
@ 2023-10-20  8:21                               ` Ilias Apalodimas
  2023-10-20 13:59                                 ` Tom Rini
  2023-10-20 15:13                                 ` Simon Glass
  0 siblings, 2 replies; 86+ messages in thread
From: Ilias Apalodimas @ 2023-10-20  8:21 UTC (permalink / raw)
  To: Simon Glass
  Cc: Michal Simek, U-Boot Mailing List, Tom Rini, Marek Vasut,
	Baruch Siach, Bin Meng, Heinrich Schuchardt, Nikhil M Jain,
	Qu Wenruo, Stefan Roese

Hi Simon,

On Wed, 18 Oct 2023 at 18:26, Simon Glass <sjg@chromium.org> wrote:
>
> Hi Ilias,
>
> On Mon, 25 Sept 2023 at 04:19, Ilias Apalodimas
> <ilias.apalodimas@linaro.org> wrote:
> >
> > Hi Simon,
> >
> > [...]
> >
> > > > > >>>>>>>>>> +config OF_BLOBLIST
> > > > > >>>>>>>>>> +     bool "DTB is provided by a bloblist"
> > > > > >>>>>>>>>> +     help
> > > > > >>>>>>>>>> +       Select this to read the devicetree from the bloblist. This allows
> > > > > >>>>>>>>>> +       using a bloblist to transfer the devicetree between  U-Boot phases.
> > > > > >>>>>>>>>> +       The devicetree is stored in the bloblist by an early phase so that
> > > > > >>>>>>>>>> +       U-Boot can read it.
> > > > > >>>>>>>>>> +
> > > > > >>>>>>>>>
> > > > > >>>>>>>>> I dont think this is a good idea.  We used to have 4-5 different options
> > > > > >>>>>>>>> here, which we tried to clean up and ended up with two very discrete
> > > > > >>>>>>>>> options.  Why do we have to reintroduce a new one?  Doesn't that bloblist
> > > > > >>>>>>>>> have a header of some sort?  The bloblist literally comes from a previous
> > > > > >>>>>>>>> stage bootloader which is what OF_BOARD is here for. So why can't we just
> > > > > >>>>>>>>> read the header and figure out if the magic of the bloblist matches?
> > > > > >>>>>>>>
> > > > > >>>>>>>> No, OF_BOARD is a hack to allow boards to do what they like with the FDT.
> > > > > >>>>>>>>
> > > > > >>>>>>>> This patch is a standard mechanism to pass the DT from one firmware
> > > > > >>>>>>>> phase to the next. We have spent quite a bit of time creating a spec
> > > > > >>>>>>>> for it, and we should use it.
> > > > > >>>>>>>
> > > > > >>>>>>> Where exactly am I objecting using the spec?   Can you please re-read my email?
> > > > > >>>>>>> I am actually pointing out we should use the spec *properly*.  So
> > > > > >>>>>>> instead of having a Kconfig option for the DT, which is pretty
> > > > > >>>>>>> pointless,  we should parse the bloblist.  If the header defined by
> > > > > >>>>>>> the *spec* is found, we should just search for the DT in there.
> > > > > >>>>>>> What you are doing here, is take the spec, pick a very specific item
> > > > > >>>>>>> that the list contains, and create a Kconfig option out of it.  Which
> > > > > >>>>>>> basically ignores the discoverable options of the bloblist.  For
> > > > > >>>>>>> example, that bloblist can also contain an entry to a TPM eventlog.
> > > > > >>>>>>> Should we start creating Kconfig options for all the firmware handoff
> > > > > >>>>>>> entries that are defined on that spec?
> > > > > >>>>>>
> > > > > >>>>>> OK so that is a different thing. What should it do if it expects to find a bloblist but cannot? I want it to throw an error, because I am trying to make the boot deterministic. What do you think?
> > > > > >>>>>
> > > > > >>>>> That's fine by me.  You can even put that under IS_ENABLED for the
> > > > > >>>>> bloblist inside the existing OF_BOARD check.  So I was thinking
> > > > > >>>>> - If no bloblist is required in Kconfig options we do the hacks we used to
> > > > > >>>>> - if bloblist is selected and the config option is OF_BOARD, throw an
> > > > > >>>>> error and mention that the previous stage loader should hand over a DT
> > > > > >>>>>
> > > > > >>>>> Is that what you had in mind?
> > > > > >>>>
> > > > > >>>> Yes, that sounds good to me.
> > > > > >>>>
> > > > > >>>> But I still think we need an OF_BLOBLIST option to control whether the
> > > > > >>>> devicetree comes from there.
> > > > > >>>>    Otherwise we will end up with people
> > > > > >>>> using OF_BOARD to work around it. We also have the SPL case which does
> > > > > >>>> not pass the DT in a bloblist...in fact SPL typically doesn't even
> > > > > >>>> have the full DT.
> > > > > >>>
> > > > > >>> Wouldn't IS_ENABLED(BLOBLIST) || IS_ENABLED(SPL_BLOBLIST) be enough?
> > > > > >>> Inside the OF_BOARD portion of the function, search for a bloblist if
> > > > > >>> the option is enabled.  If you can't find a bloblist and the DT within
> > > > > >>> that bloblist, then error out
> > > > > >>
> > > > > >> Just my 2c here.
> > > > > >> I think all options should be possible to disable. It means I can imagine to
> > > > > >> disable u-boot not to take care about DT provided from previous stage. The same
> > > > > >> is for TPM event log. IMHO every stage should have an option to simply ignore
> > > > > >> data pass from previous stage. I don't really mind how it is done but there
> > > > > >> should be an option to by purpose say to ignore the part of pass data.
> > > > > >
> > > > > > That would be done by disabling BLOBLIST.  I don't think having a Kconfig to say
> > > > > > "I want a bloblist, but I only want the DT from there" is reasonable
> > > > > > (or for any other item the bloblist can carry).   OF_BOARD means the
> > > > > > DT will come from a previous stage loader. If bloblist is enabled then
> > > > > > the DT must come from there.
> > > > >
> > > > > I don't agree on this. If bloblist is enabled and DT is passed SW should have a
> > > > > freedom to ignore it.
> > > > >
> > > > > At start everything is likely in sync but later stages before U-Boot can stay at
> > > > > certain version but there could be a need to update u-boot where DT from
> > > > > previous stage could be broken.
> > > >
> > > > But you *can* ignore it and load a different one later.  The only
> > > > restriction is that if you compile u-boot with the assumption an early
> > > > stage bootloader provides a DT you *must* find it.  But we will still
> > > > just keep 2 options in U-Boot of how you get a DT.
> > > > A previous loader provided it or U-Boot provided it.  Whether that
> > > > comes from a bloblist or a register is irrelevant no ?
> > >
> > > I'm not sure what is being requested here, so I'll leave this as is for v2.
> >
> > Please don't.   A few mails above there's a discussion of how I'd
> > prefer things to look like, please have a look and let me know if
> > something isn't clear.
> > tl;dr
> >  "That's fine by me.  You can even put that under IS_ENABLED for the
> >  bloblist inside the existing OF_BOARD check.  So I was thinking
> >  - If no bloblist is required in Kconfig options we do the hacks we used to
> >  - if bloblist is selected and the config option is OF_BOARD, throw an
> > error and mention that the previous stage loader should hand over a DT"
> >
> > >
> > > The main struggle I have is how to tell whether you expect to
> > > *receive* the DT in the bloblist, or expect it to be attached to the
> > > image and be *sent* to the next phase.
> >
> > bloblist
> >
> > >
> > > SPL - attached to image, send in bloblist
> > > U-Boot proper - not attached to image, receive it from bloblist
> > >
> > > This is exactly the problem that is solved by the 'standard passage'
> > > stuff [1] but that depends on Firmware Handoff and [2] which are not
> > > ready yet...
> > >
> > > So I think what I have is the best we can do for now.
> >
> > We can avoid the extra complication in Kconfigs.  The DT either comes
> > from u-boot itself or from a previous stage loader. we don't need the
> > extra "it comes from a bloblist".
> > If they come from a previous stage loader and BLOBLIST *is* enabled,
> > then just scan for the DT, if you don't find it error out.
>
> Are you planning to send a patch for this? Otherwise, what do you
> think about going with this one and dealing with OF_BOARD board by
> board?

Yes, I can do that.  Since this patch is part of your series, I'll
send it over to you and carry it there

Thanks
/Ilias
> > > [1] https://patchwork.ozlabs.org/project/uboot/list/?series=281465&state=*
> > > [2] https://patchwork.ozlabs.org/project/uboot/list/?series=365719
>
>
> Regards,
> Simon

^ permalink raw reply	[flat|nested] 86+ messages in thread

* Re: [PATCH 30/32] fdt: Allow the devicetree to come from a bloblist
  2023-10-20  8:21                               ` Ilias Apalodimas
@ 2023-10-20 13:59                                 ` Tom Rini
  2023-10-20 15:13                                 ` Simon Glass
  1 sibling, 0 replies; 86+ messages in thread
From: Tom Rini @ 2023-10-20 13:59 UTC (permalink / raw)
  To: Ilias Apalodimas
  Cc: Simon Glass, Michal Simek, U-Boot Mailing List, Marek Vasut,
	Baruch Siach, Bin Meng, Heinrich Schuchardt, Nikhil M Jain,
	Qu Wenruo, Stefan Roese

[-- Attachment #1: Type: text/plain, Size: 8173 bytes --]

On Fri, Oct 20, 2023 at 11:21:29AM +0300, Ilias Apalodimas wrote:
> Hi Simon,
> 
> On Wed, 18 Oct 2023 at 18:26, Simon Glass <sjg@chromium.org> wrote:
> >
> > Hi Ilias,
> >
> > On Mon, 25 Sept 2023 at 04:19, Ilias Apalodimas
> > <ilias.apalodimas@linaro.org> wrote:
> > >
> > > Hi Simon,
> > >
> > > [...]
> > >
> > > > > > >>>>>>>>>> +config OF_BLOBLIST
> > > > > > >>>>>>>>>> +     bool "DTB is provided by a bloblist"
> > > > > > >>>>>>>>>> +     help
> > > > > > >>>>>>>>>> +       Select this to read the devicetree from the bloblist. This allows
> > > > > > >>>>>>>>>> +       using a bloblist to transfer the devicetree between  U-Boot phases.
> > > > > > >>>>>>>>>> +       The devicetree is stored in the bloblist by an early phase so that
> > > > > > >>>>>>>>>> +       U-Boot can read it.
> > > > > > >>>>>>>>>> +
> > > > > > >>>>>>>>>
> > > > > > >>>>>>>>> I dont think this is a good idea.  We used to have 4-5 different options
> > > > > > >>>>>>>>> here, which we tried to clean up and ended up with two very discrete
> > > > > > >>>>>>>>> options.  Why do we have to reintroduce a new one?  Doesn't that bloblist
> > > > > > >>>>>>>>> have a header of some sort?  The bloblist literally comes from a previous
> > > > > > >>>>>>>>> stage bootloader which is what OF_BOARD is here for. So why can't we just
> > > > > > >>>>>>>>> read the header and figure out if the magic of the bloblist matches?
> > > > > > >>>>>>>>
> > > > > > >>>>>>>> No, OF_BOARD is a hack to allow boards to do what they like with the FDT.
> > > > > > >>>>>>>>
> > > > > > >>>>>>>> This patch is a standard mechanism to pass the DT from one firmware
> > > > > > >>>>>>>> phase to the next. We have spent quite a bit of time creating a spec
> > > > > > >>>>>>>> for it, and we should use it.
> > > > > > >>>>>>>
> > > > > > >>>>>>> Where exactly am I objecting using the spec?   Can you please re-read my email?
> > > > > > >>>>>>> I am actually pointing out we should use the spec *properly*.  So
> > > > > > >>>>>>> instead of having a Kconfig option for the DT, which is pretty
> > > > > > >>>>>>> pointless,  we should parse the bloblist.  If the header defined by
> > > > > > >>>>>>> the *spec* is found, we should just search for the DT in there.
> > > > > > >>>>>>> What you are doing here, is take the spec, pick a very specific item
> > > > > > >>>>>>> that the list contains, and create a Kconfig option out of it.  Which
> > > > > > >>>>>>> basically ignores the discoverable options of the bloblist.  For
> > > > > > >>>>>>> example, that bloblist can also contain an entry to a TPM eventlog.
> > > > > > >>>>>>> Should we start creating Kconfig options for all the firmware handoff
> > > > > > >>>>>>> entries that are defined on that spec?
> > > > > > >>>>>>
> > > > > > >>>>>> OK so that is a different thing. What should it do if it expects to find a bloblist but cannot? I want it to throw an error, because I am trying to make the boot deterministic. What do you think?
> > > > > > >>>>>
> > > > > > >>>>> That's fine by me.  You can even put that under IS_ENABLED for the
> > > > > > >>>>> bloblist inside the existing OF_BOARD check.  So I was thinking
> > > > > > >>>>> - If no bloblist is required in Kconfig options we do the hacks we used to
> > > > > > >>>>> - if bloblist is selected and the config option is OF_BOARD, throw an
> > > > > > >>>>> error and mention that the previous stage loader should hand over a DT
> > > > > > >>>>>
> > > > > > >>>>> Is that what you had in mind?
> > > > > > >>>>
> > > > > > >>>> Yes, that sounds good to me.
> > > > > > >>>>
> > > > > > >>>> But I still think we need an OF_BLOBLIST option to control whether the
> > > > > > >>>> devicetree comes from there.
> > > > > > >>>>    Otherwise we will end up with people
> > > > > > >>>> using OF_BOARD to work around it. We also have the SPL case which does
> > > > > > >>>> not pass the DT in a bloblist...in fact SPL typically doesn't even
> > > > > > >>>> have the full DT.
> > > > > > >>>
> > > > > > >>> Wouldn't IS_ENABLED(BLOBLIST) || IS_ENABLED(SPL_BLOBLIST) be enough?
> > > > > > >>> Inside the OF_BOARD portion of the function, search for a bloblist if
> > > > > > >>> the option is enabled.  If you can't find a bloblist and the DT within
> > > > > > >>> that bloblist, then error out
> > > > > > >>
> > > > > > >> Just my 2c here.
> > > > > > >> I think all options should be possible to disable. It means I can imagine to
> > > > > > >> disable u-boot not to take care about DT provided from previous stage. The same
> > > > > > >> is for TPM event log. IMHO every stage should have an option to simply ignore
> > > > > > >> data pass from previous stage. I don't really mind how it is done but there
> > > > > > >> should be an option to by purpose say to ignore the part of pass data.
> > > > > > >
> > > > > > > That would be done by disabling BLOBLIST.  I don't think having a Kconfig to say
> > > > > > > "I want a bloblist, but I only want the DT from there" is reasonable
> > > > > > > (or for any other item the bloblist can carry).   OF_BOARD means the
> > > > > > > DT will come from a previous stage loader. If bloblist is enabled then
> > > > > > > the DT must come from there.
> > > > > >
> > > > > > I don't agree on this. If bloblist is enabled and DT is passed SW should have a
> > > > > > freedom to ignore it.
> > > > > >
> > > > > > At start everything is likely in sync but later stages before U-Boot can stay at
> > > > > > certain version but there could be a need to update u-boot where DT from
> > > > > > previous stage could be broken.
> > > > >
> > > > > But you *can* ignore it and load a different one later.  The only
> > > > > restriction is that if you compile u-boot with the assumption an early
> > > > > stage bootloader provides a DT you *must* find it.  But we will still
> > > > > just keep 2 options in U-Boot of how you get a DT.
> > > > > A previous loader provided it or U-Boot provided it.  Whether that
> > > > > comes from a bloblist or a register is irrelevant no ?
> > > >
> > > > I'm not sure what is being requested here, so I'll leave this as is for v2.
> > >
> > > Please don't.   A few mails above there's a discussion of how I'd
> > > prefer things to look like, please have a look and let me know if
> > > something isn't clear.
> > > tl;dr
> > >  "That's fine by me.  You can even put that under IS_ENABLED for the
> > >  bloblist inside the existing OF_BOARD check.  So I was thinking
> > >  - If no bloblist is required in Kconfig options we do the hacks we used to
> > >  - if bloblist is selected and the config option is OF_BOARD, throw an
> > > error and mention that the previous stage loader should hand over a DT"
> > >
> > > >
> > > > The main struggle I have is how to tell whether you expect to
> > > > *receive* the DT in the bloblist, or expect it to be attached to the
> > > > image and be *sent* to the next phase.
> > >
> > > bloblist
> > >
> > > >
> > > > SPL - attached to image, send in bloblist
> > > > U-Boot proper - not attached to image, receive it from bloblist
> > > >
> > > > This is exactly the problem that is solved by the 'standard passage'
> > > > stuff [1] but that depends on Firmware Handoff and [2] which are not
> > > > ready yet...
> > > >
> > > > So I think what I have is the best we can do for now.
> > >
> > > We can avoid the extra complication in Kconfigs.  The DT either comes
> > > from u-boot itself or from a previous stage loader. we don't need the
> > > extra "it comes from a bloblist".
> > > If they come from a previous stage loader and BLOBLIST *is* enabled,
> > > then just scan for the DT, if you don't find it error out.
> >
> > Are you planning to send a patch for this? Otherwise, what do you
> > think about going with this one and dealing with OF_BOARD board by
> > board?
> 
> Yes, I can do that.  Since this patch is part of your series, I'll
> send it over to you and carry it there

The rest of this series, minus this patch has been merged.  We should
just start a new series I think.

-- 
Tom

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 659 bytes --]

^ permalink raw reply	[flat|nested] 86+ messages in thread

* Re: [PATCH 30/32] fdt: Allow the devicetree to come from a bloblist
  2023-10-20  8:21                               ` Ilias Apalodimas
  2023-10-20 13:59                                 ` Tom Rini
@ 2023-10-20 15:13                                 ` Simon Glass
  1 sibling, 0 replies; 86+ messages in thread
From: Simon Glass @ 2023-10-20 15:13 UTC (permalink / raw)
  To: Ilias Apalodimas
  Cc: Michal Simek, U-Boot Mailing List, Tom Rini, Marek Vasut,
	Baruch Siach, Bin Meng, Heinrich Schuchardt, Nikhil M Jain,
	Qu Wenruo, Stefan Roese

Hi Ilias,

On Fri, 20 Oct 2023 at 01:22, Ilias Apalodimas <ilias.apalodimas@linaro.org>
wrote:
>
> Hi Simon,
>
> On Wed, 18 Oct 2023 at 18:26, Simon Glass <sjg@chromium.org> wrote:
> >
> > Hi Ilias,
> >
> > On Mon, 25 Sept 2023 at 04:19, Ilias Apalodimas
> > <ilias.apalodimas@linaro.org> wrote:
> > >
> > > Hi Simon,
> > >
> > > [...]
> > >
> > > > > > >>>>>>>>>> +config OF_BLOBLIST
> > > > > > >>>>>>>>>> +     bool "DTB is provided by a bloblist"
> > > > > > >>>>>>>>>> +     help
> > > > > > >>>>>>>>>> +       Select this to read the devicetree from the
bloblist. This allows
> > > > > > >>>>>>>>>> +       using a bloblist to transfer the devicetree
between  U-Boot phases.
> > > > > > >>>>>>>>>> +       The devicetree is stored in the bloblist by
an early phase so that
> > > > > > >>>>>>>>>> +       U-Boot can read it.
> > > > > > >>>>>>>>>> +
> > > > > > >>>>>>>>>
> > > > > > >>>>>>>>> I dont think this is a good idea.  We used to have
4-5 different options
> > > > > > >>>>>>>>> here, which we tried to clean up and ended up with
two very discrete
> > > > > > >>>>>>>>> options.  Why do we have to reintroduce a new one?
Doesn't that bloblist
> > > > > > >>>>>>>>> have a header of some sort?  The bloblist literally
comes from a previous
> > > > > > >>>>>>>>> stage bootloader which is what OF_BOARD is here for.
So why can't we just
> > > > > > >>>>>>>>> read the header and figure out if the magic of the
bloblist matches?
> > > > > > >>>>>>>>
> > > > > > >>>>>>>> No, OF_BOARD is a hack to allow boards to do what they
like with the FDT.
> > > > > > >>>>>>>>
> > > > > > >>>>>>>> This patch is a standard mechanism to pass the DT from
one firmware
> > > > > > >>>>>>>> phase to the next. We have spent quite a bit of time
creating a spec
> > > > > > >>>>>>>> for it, and we should use it.
> > > > > > >>>>>>>
> > > > > > >>>>>>> Where exactly am I objecting using the spec?   Can you
please re-read my email?
> > > > > > >>>>>>> I am actually pointing out we should use the spec
*properly*.  So
> > > > > > >>>>>>> instead of having a Kconfig option for the DT, which is
pretty
> > > > > > >>>>>>> pointless,  we should parse the bloblist.  If the
header defined by
> > > > > > >>>>>>> the *spec* is found, we should just search for the DT
in there.
> > > > > > >>>>>>> What you are doing here, is take the spec, pick a very
specific item
> > > > > > >>>>>>> that the list contains, and create a Kconfig option out
of it.  Which
> > > > > > >>>>>>> basically ignores the discoverable options of the
bloblist.  For
> > > > > > >>>>>>> example, that bloblist can also contain an entry to a
TPM eventlog.
> > > > > > >>>>>>> Should we start creating Kconfig options for all the
firmware handoff
> > > > > > >>>>>>> entries that are defined on that spec?
> > > > > > >>>>>>
> > > > > > >>>>>> OK so that is a different thing. What should it do if it
expects to find a bloblist but cannot? I want it to throw an error, because
I am trying to make the boot deterministic. What do you think?
> > > > > > >>>>>
> > > > > > >>>>> That's fine by me.  You can even put that under
IS_ENABLED for the
> > > > > > >>>>> bloblist inside the existing OF_BOARD check.  So I was
thinking
> > > > > > >>>>> - If no bloblist is required in Kconfig options we do the
hacks we used to
> > > > > > >>>>> - if bloblist is selected and the config option is
OF_BOARD, throw an
> > > > > > >>>>> error and mention that the previous stage loader should
hand over a DT
> > > > > > >>>>>
> > > > > > >>>>> Is that what you had in mind?
> > > > > > >>>>
> > > > > > >>>> Yes, that sounds good to me.
> > > > > > >>>>
> > > > > > >>>> But I still think we need an OF_BLOBLIST option to control
whether the
> > > > > > >>>> devicetree comes from there.
> > > > > > >>>>    Otherwise we will end up with people
> > > > > > >>>> using OF_BOARD to work around it. We also have the SPL
case which does
> > > > > > >>>> not pass the DT in a bloblist...in fact SPL typically
doesn't even
> > > > > > >>>> have the full DT.
> > > > > > >>>
> > > > > > >>> Wouldn't IS_ENABLED(BLOBLIST) || IS_ENABLED(SPL_BLOBLIST)
be enough?
> > > > > > >>> Inside the OF_BOARD portion of the function, search for a
bloblist if
> > > > > > >>> the option is enabled.  If you can't find a bloblist and
the DT within
> > > > > > >>> that bloblist, then error out
> > > > > > >>
> > > > > > >> Just my 2c here.
> > > > > > >> I think all options should be possible to disable. It means
I can imagine to
> > > > > > >> disable u-boot not to take care about DT provided from
previous stage. The same
> > > > > > >> is for TPM event log. IMHO every stage should have an option
to simply ignore
> > > > > > >> data pass from previous stage. I don't really mind how it is
done but there
> > > > > > >> should be an option to by purpose say to ignore the part of
pass data.
> > > > > > >
> > > > > > > That would be done by disabling BLOBLIST.  I don't think
having a Kconfig to say
> > > > > > > "I want a bloblist, but I only want the DT from there" is
reasonable
> > > > > > > (or for any other item the bloblist can carry).   OF_BOARD
means the
> > > > > > > DT will come from a previous stage loader. If bloblist is
enabled then
> > > > > > > the DT must come from there.
> > > > > >
> > > > > > I don't agree on this. If bloblist is enabled and DT is passed
SW should have a
> > > > > > freedom to ignore it.
> > > > > >
> > > > > > At start everything is likely in sync but later stages before
U-Boot can stay at
> > > > > > certain version but there could be a need to update u-boot
where DT from
> > > > > > previous stage could be broken.
> > > > >
> > > > > But you *can* ignore it and load a different one later.  The only
> > > > > restriction is that if you compile u-boot with the assumption an
early
> > > > > stage bootloader provides a DT you *must* find it.  But we will
still
> > > > > just keep 2 options in U-Boot of how you get a DT.
> > > > > A previous loader provided it or U-Boot provided it.  Whether that
> > > > > comes from a bloblist or a register is irrelevant no ?
> > > >
> > > > I'm not sure what is being requested here, so I'll leave this as is
for v2.
> > >
> > > Please don't.   A few mails above there's a discussion of how I'd
> > > prefer things to look like, please have a look and let me know if
> > > something isn't clear.
> > > tl;dr
> > >  "That's fine by me.  You can even put that under IS_ENABLED for the
> > >  bloblist inside the existing OF_BOARD check.  So I was thinking
> > >  - If no bloblist is required in Kconfig options we do the hacks we
used to
> > >  - if bloblist is selected and the config option is OF_BOARD, throw an
> > > error and mention that the previous stage loader should hand over a
DT"
> > >
> > > >
> > > > The main struggle I have is how to tell whether you expect to
> > > > *receive* the DT in the bloblist, or expect it to be attached to the
> > > > image and be *sent* to the next phase.
> > >
> > > bloblist
> > >
> > > >
> > > > SPL - attached to image, send in bloblist
> > > > U-Boot proper - not attached to image, receive it from bloblist
> > > >
> > > > This is exactly the problem that is solved by the 'standard passage'
> > > > stuff [1] but that depends on Firmware Handoff and [2] which are not
> > > > ready yet...
> > > >
> > > > So I think what I have is the best we can do for now.
> > >
> > > We can avoid the extra complication in Kconfigs.  The DT either comes
> > > from u-boot itself or from a previous stage loader. we don't need the
> > > extra "it comes from a bloblist".
> > > If they come from a previous stage loader and BLOBLIST *is* enabled,
> > > then just scan for the DT, if you don't find it error out.
> >
> > Are you planning to send a patch for this? Otherwise, what do you
> > think about going with this one and dealing with OF_BOARD board by
> > board?
>
> Yes, I can do that.  Since this patch is part of your series, I'll
> send it over to you and carry it there

Thanks. The rest of it was applied, but we didn't want to apply this one
due to the discussion. So you can just send the patch.

But I see Tom already said this.

Regards,
Simon

^ permalink raw reply	[flat|nested] 86+ messages in thread

end of thread, other threads:[~2023-10-20 15:13 UTC | newest]

Thread overview: 86+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-08-30 18:04 [PATCH 00/32] spl: Preparation for Universal Payload Simon Glass
2023-08-30 18:04 ` [PATCH 01/32] dm: core: support reading a single indexed u64 value Simon Glass
2023-08-30 18:04 ` [PATCH 02/32] spl: Use CONFIG_SPL... instead of CONFIG_..._SPL_ Simon Glass
2023-08-31  7:37   ` Marcel Ziswiler
2023-08-31  8:42   ` Martyn Welch
2023-08-31  9:22   ` Svyatoslav Ryhel
2023-08-30 18:04 ` [PATCH 03/32] spl: Rename SYS_SPL_ARGS_ADDR to SPL_SYS_ARGS_ADDR Simon Glass
2023-08-30 21:37   ` Tom Rini
2023-08-30 18:04 ` [PATCH 04/32] spl: Avoid #ifdef with CONFIG_SPL_SYS_MALLOC Simon Glass
2023-08-30 21:32   ` Tom Rini
2023-08-30 18:04 ` [PATCH 05/32] spl: mx6: powerpc: Drop the condition on timer_init() Simon Glass
2023-08-31 17:50   ` Tom Rini
2023-09-21  1:03     ` Simon Glass
2023-09-26 11:37       ` Simon Glass
2023-09-26 13:38         ` Christophe Leroy
2023-08-30 18:04 ` [PATCH 06/32] spl: Drop #ifdefs for BOARD_INIT and watchdog Simon Glass
2023-08-30 18:04 ` [PATCH 07/32] spl: Avoid #ifdef with CONFIG_SPL_SYS_ARGS_ADDR Simon Glass
2023-08-30 21:34   ` Tom Rini
2023-08-30 18:04 ` [PATCH 08/32] spl: Drop the switch() statement for OS selection Simon Glass
2023-08-30 18:04 ` [PATCH 09/32] spl: Avoid an #ifdef when printing gd->malloc_ptr Simon Glass
2023-08-30 21:39   ` Tom Rini
2023-09-21  1:03     ` Simon Glass
2023-09-21 15:35       ` Tom Rini
2023-09-22 18:27         ` Simon Glass
2023-09-22 19:28           ` Tom Rini
2023-09-22 23:06             ` Simon Glass
2023-08-30 18:04 ` [PATCH 10/32] spl: Remove #ifdefs with BOOTSTAGE Simon Glass
2023-08-30 18:04 ` [PATCH 11/32] spl: Rename spl_load_fit_image() to load_simple_fit() Simon Glass
2023-08-30 18:04 ` [PATCH 12/32] spl: Move the full FIT code to spl_fit.c Simon Glass
2023-08-30 18:04 ` [PATCH 13/32] spl: Use the correct FIT_..._PROP constants Simon Glass
2023-08-30 18:04 ` [PATCH 14/32] spl: Move bloblist writing until the image is known Simon Glass
2023-08-30 18:04 ` [PATCH 15/32] dm: core: Reverse the argument order in ofnode_copy_props() Simon Glass
2023-08-30 18:04 ` [PATCH 16/32] dm: core: Ensure we run flattree tests on ofnode Simon Glass
2023-08-30 18:04 ` [PATCH 17/32] dm: core: Tidy up comments in the ofnode tests Simon Glass
2023-08-30 18:04 ` [PATCH 18/32] dm: core: Add a function to create an empty tree Simon Glass
2023-08-30 18:04 ` [PATCH 19/32] dm: core: Add a way to copy a node Simon Glass
2023-08-30 18:04 ` [PATCH 20/32] dm: core: Add a way to delete " Simon Glass
2023-08-30 18:04 ` [PATCH 21/32] dm: core: Add a way to convert a devicetree to a dtb Simon Glass
2023-08-30 18:04 ` [PATCH 22/32] dm: core: Support writing a boolean Simon Glass
2023-08-30 18:04 ` [PATCH 23/32] dm: core: Support writing a 64-bit value Simon Glass
2023-08-30 18:04 ` [PATCH 24/32] dm: core: Add tests for oftree_path() Simon Glass
2023-08-30 18:04 ` [PATCH 25/32] sandbox: Move reading the RAM buffer into a better place Simon Glass
2023-08-30 18:04 ` [PATCH 26/32] sandbox: Init the EC properly even if no state file is available Simon Glass
2023-08-30 18:04 ` [PATCH 27/32] sandbox: Only read the state if we have a state file Simon Glass
2023-08-30 18:04 ` [PATCH 28/32] sandbox: Move the bloblist down a little in memory Simon Glass
2023-08-30 18:05 ` [PATCH 29/32] bloblist: Support initing from multiple places Simon Glass
2023-08-30 18:05 ` [PATCH 30/32] fdt: Allow the devicetree to come from a bloblist Simon Glass
2023-08-31  7:06   ` Ilias Apalodimas
2023-08-31 19:02     ` Simon Glass
2023-09-01  7:49       ` Ilias Apalodimas
2023-09-01 15:51         ` Simon Glass
2023-09-04  9:30           ` Ilias Apalodimas
2023-09-10 19:13             ` Simon Glass
2023-09-11  6:17               ` Ilias Apalodimas
2023-09-11  6:38                 ` Michal Simek
2023-09-11  7:56                   ` Ilias Apalodimas
2023-09-11 10:58                     ` Michal Simek
2023-09-11 11:47                       ` Ilias Apalodimas
2023-09-21  1:03                         ` Simon Glass
2023-09-25 10:18                           ` Ilias Apalodimas
2023-10-18 15:26                             ` Simon Glass
2023-10-20  8:21                               ` Ilias Apalodimas
2023-10-20 13:59                                 ` Tom Rini
2023-10-20 15:13                                 ` Simon Glass
2023-08-30 18:05 ` [PATCH 31/32] command: Include a required header in command.h Simon Glass
2023-08-30 18:05 ` [PATCH 32/32] pci: serial: Support reading PCI-register size with base Simon Glass
2023-08-30 18:14   ` Pali Rohár
2023-08-30 18:17     ` Tom Rini
2023-08-30 18:39       ` Pali Rohár
2023-08-30 19:04         ` Tom Rini
2023-08-30 19:10           ` Pali Rohár
2023-08-30 19:41             ` Tom Rini
2023-08-30 19:44               ` Pali Rohár
2023-08-30 20:51                 ` Pali Rohár
2023-08-30 21:08                   ` Tom Rini
2023-08-30 21:13                     ` Pali Rohár
2023-08-30 21:26                       ` Tom Rini
2023-08-30 21:29                         ` Pali Rohár
2023-08-30 21:42                           ` Tom Rini
2023-09-03 20:36                             ` Pali Rohár
2023-09-04 19:55                               ` Tom Rini
2023-09-04 20:07                                 ` Pali Rohár
2023-09-03 20:39     ` Pali Rohár
2023-09-04 20:15       ` Pali Rohár
2023-09-04 20:27         ` Tom Rini
2023-09-04 21:07           ` Pali Rohár

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.