[EXTERNAL] [PATCH 11/20] mach-k3: r5: common: add helper functions needed in LPM resume sequence

Richard GENOUD richard.genoud at bootlin.com
Mon Jun 1 10:09:23 CEST 2026


Hi Abhash,
Le 01/06/2026 à 10:05, Kumar, Abhash a écrit :
> 
> On 4/30/2026 2:14 PM, Richard Genoud (TI) wrote:
>> From: Prasanth Babu Mantena <p-mantena@ ti. com> Add helper functions 
>> that are used by respective SoCs in LPM resume flow. - lpm_process() 
>> is called at boot time to: - retrieve the LPM memory region from DTS - 
>> save ATF/OPTEE certificates
>> ZjQcmQRYFpfptBannerStart
>> This message was sent from outside of Texas Instruments.
>> Do not click links or open attachments unless you recognize the source 
>> of this email and know the content is safe.
>> Report Suspicious
>> <https://us-phishalarm-ewt.proofpoint.com/EWT/v1/G3vK! 
>> undqXRfPtm2bSgZlPFMD_PaDMAG16nyrFWtHumWcmHVJHF2x9T6ju4MVod9Xz5kkhLg8jvqD8Vb2RXV8TKm6Nx3q-RI8sEAX0Ue59g$>
>> ZjQcmQRYFpfptBannerEnd
>> From: Prasanth Babu Mantena <p-mantena at ti.com>
>>
>> Add helper functions that are used by respective SoCs in LPM resume flow.
>>
>> - lpm_process() is called at boot time to:
>>    - retrieve the LPM memory region from DTS
>>    - save ATF/OPTEE certificates information and DM code in this memory
>>      region
>>    - Forward the LPM address to TIFS via TISCI_MSG_LPM_SAVE_ADDR
>> TIFS will use this address to save TFA context and its own minimal
>> context just before suspend.
>>
>> - do_resume() is called at resume, just after bringing the DDR out of
>>    retention to:
>>    - retrieve the LPM memory region from DTS
>>    - authenticate certificates from LPM memory region and apply firewalls
>>    - ask TIFS to restore TFA and its own minimal context
>>    - start TFA on remote proc
>>    - load and jump to DM
>>
>> https://software-dl.ti.com/tisci/esd/latest/2_tisci_msgs/pm/ 
>> lpm.html#lpm-msg-lpm-save-addr
>>
>> Signed-off-by: Prasanth Babu Mantena <p-mantena at ti.com>
>> Co-developed-by: Richard Genoud (TI) <richard.genoud at bootlin.com>
>> Signed-off-by: Richard Genoud (TI) <richard.genoud at bootlin.com>
>> ---
>>   arch/arm/mach-k3/common.h        |  16 +++
>>   arch/arm/mach-k3/lpm-common.h    |  15 ++
>>   arch/arm/mach-k3/r5/Kconfig      |   4 +
>>   arch/arm/mach-k3/r5/Makefile     |   1 +
>>   arch/arm/mach-k3/r5/common.c     |  17 +--
>>   arch/arm/mach-k3/r5/lpm-common.c | 228 +++++++++++++++++++++++++++++++
>>   6 files changed, 269 insertions(+), 12 deletions(-)
>>   create mode 100644 arch/arm/mach-k3/lpm-common.h
>>   create mode 100644 arch/arm/mach-k3/r5/lpm-common.c
>>
>> diff --git a/arch/arm/mach-k3/common.h b/arch/arm/mach-k3/common.h
>> index e970076d08ec..50e670f845e3 100644
>> --- a/arch/arm/mach-k3/common.h
>> +++ b/arch/arm/mach-k3/common.h
>> @@ -8,6 +8,7 @@
>>   #include <asm/armv7_mpu.h>
>>   #include <asm/hardware.h>
>> +#include <image.h>
>>   #include <mach/security.h>
>> +static int extract_lpm_region(void)
>> +{
>> +    ofnode node;
>> +    fdt_addr_t lpm_reg_addr;
>> +    fdt_size_t lpm_reg_size;
>> +
>> +    node = ofnode_path("/reserved-memory/lpm-memory");
>> +    if (!ofnode_valid(node)) {
>> +        printf("lpm will not be functional\n");
>> +        return -ENODEV;
>> +    }
>> +
>> +    lpm_reg_addr = ofnode_get_addr(node);
>> +    if (lpm_reg_addr == FDT_ADDR_T_NONE) {
>> +        printf("Can't find a valid reserved node!\n");
>> +        return -ENODEV;
>> +    }
>> +
>> +    lpm_reg_size = ofnode_get_size(node);
>> +    if (lpm_reg_size == FDT_ADDR_T_NONE) {
>> +        printf("Can't find a valid reserved node!\n");
>> +        return -ENODEV;
>> +    }
>> +
>> +    mem_addr_lpm.context_save_addr = (u32 *)lpm_reg_addr;
>> +    mem_addr_lpm.atf_cert_addr = mem_addr_lpm.context_save_addr + 
>> FW_IMAGE_SIZE;
>> +    mem_addr_lpm.optee_cert_addr = mem_addr_lpm.atf_cert_addr + 
>> FW_IMAGE_SIZE;
> 
> Hi Richard,
> 
> Adding a u32 pointer to an integer "FW_IMAGE_SIZE" would scale 
> FW_IMAGE_SIZE by sizeof(u32).
> 
> This would cause the address values to come out different than intended.
Good catch, I'll fix that.

Thanks!

> 
>> +    mem_addr_lpm.dm_save_addr = mem_addr_lpm.optee_cert_addr + (2 * 
>> FW_IMAGE_SIZE);
>> +    mem_addr_lpm.size = lpm_reg_size;
>> +
>> +    return 0;
>> +}
>> +
> 
> Thanks,
> 
> Abhash
> 



More information about the U-Boot mailing list