On Sat Dec 13, 2025 at 7:47 AM CET, Udit Kumar wrote:
>
> On 12/10/2025 7:39 PM, Markus Schneider-Pargmann (TI.com) wrote:
>> This is a common function that helps to resume from DDR. There are two
>> pointers which are fetched from DDR to resume, the TIFS context pointer
>> which points to the context in DDR. There is another pointer to the DM
>> loadaddr to jump back into DM.
>>
>> Tested-by: Anshul Dalal <[email protected]>
>> Signed-off-by: Markus Schneider-Pargmann (TI.com) <[email protected]>
>> ---
>>   arch/arm/mach-k3/common.c | 49 
>> +++++++++++++++++++++++++++++++++++++++++++++++
>>   arch/arm/mach-k3/common.h |  1 +
>>   2 files changed, 50 insertions(+)
>>
>> diff --git a/arch/arm/mach-k3/common.c b/arch/arm/mach-k3/common.c
>> index 
>> 81e180c8706445c270cfecb0500015eee7547f98..ee56f0b86ce303e319cfcd2b0db3bade1540635b
>>  100644
>> --- a/arch/arm/mach-k3/common.c
>> +++ b/arch/arm/mach-k3/common.c
>> @@ -193,6 +193,55 @@ int __maybe_unused 
>> wkup_ctrl_remove_can_io_isolation_if_set(void)
>>      return 0;
>>   }
>>   
>> +#if IS_ENABLED(CONFIG_K3_IODDR)
>> +static int lpm_restore_context(u64 ctx_addr)
>> +{
>> +    struct ti_sci_handle *ti_sci = get_ti_sci_handle();
>> +    int ret;
>> +
>> +    ret = ti_sci->ops.lpm_ops.min_context_restore(ti_sci, ctx_addr);
>> +    if (ret)
>> +            printf("Failed to restore context from DDR %d\n", ret);
>> +
>> +    return ret;
>> +}
>> +
>> +struct lpm_meta_data {
>> +    u64 dm_jump_address;
>> +    u64 tifs_context_save_address;
>> +    u64 reserved[30];
>> +} __packed__;
>> +
>> +void __noreturn lpm_resume_from_ddr(u64 meta_data_addr)
>> +{
>> +    struct lpm_meta_data lpm_data = *(struct lpm_meta_data 
>> *)(uintptr_t)meta_data_addr;
>> +    typedef void __noreturn (*image_entry_noargs_t)(void);
>> +    image_entry_noargs_t image_entry;
>> +    int ret;
>> +
>> +    ret = lpm_restore_context(lpm_data.tifs_context_save_address);
>> +    if (ret)
>> +            panic("Failed to restore context from 0x%x%08x\n",
>> +                  (u32)(lpm_data.tifs_context_save_address >> 32),
>> +                  (u32)lpm_data.tifs_context_save_address);
>> +
>> +    image_entry = (image_entry_noargs_t)(uintptr_t)lpm_data.dm_jump_address;
>> +    printf("Resuming from DDR, jumping to stored DM loadaddr 0x%x%08x, TIFS 
>> context restored from 0x%x%08x\n",
>> +           (u32)(lpm_data.dm_jump_address >> 32),
>> +           (u32)lpm_data.dm_jump_address,
>> +           (u32)(lpm_data.tifs_context_save_address >> 32),
>> +           (u32)lpm_data.tifs_context_save_address);
>
> you want printf, here or could be debug info ?

I think it would be good to have this as printf instead of debug info in
case something goes wrong at some point.

Best
Markus

Attachment: signature.asc
Description: PGP signature

Reply via email to