lkml.org 
[lkml]   [2022]   [Nov]   [21]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
SubjectRe: [PATCH v4 3/5] firmware: ti_sci: Allocate memory for the LPM modes
From
Hi Nishanth,

On 11/21/22 20:44, Nishanth Menon wrote:
> On 20:13-20221116, Georgi Vlaev wrote:
> [...]
>
>> +static int ti_sci_init_suspend(struct platform_device *pdev,
>> + struct ti_sci_info *info)
>> +{
>> + struct device *dev = &pdev->dev;
>> + int ret;
>> +
>> + dma_set_mask_and_coherent(dev, DMA_BIT_MASK(64));
>> + info->ctx_mem_buf = dma_alloc_coherent(info->dev, LPM_CTX_MEM_SIZE,
>> + &info->ctx_mem_addr,
>> + GFP_KERNEL);
>> + if (!info->ctx_mem_buf) {
>> + dev_err(info->dev, "Failed to allocate LPM context memory\n");
>> + return -ENOMEM;
>> + }
>> +
>> + /*
>> + * Attempt to call prepare_sleep, this will be NAK'd if suspend is not
>> + * supported by firmware in use, in which case we will not attempt to
>> + * init suspend.
>> + */
>> + ret = ti_sci_cmd_prepare_sleep(&info->handle, 0,
>> + (u32)(info->ctx_mem_addr & 0xffffffff),
>> + (u32)((u64)info->ctx_mem_addr >> 32), 0);
>> +
>> + if (ret)
>> + goto err;
>> +
>> + return 0;
>> +err:
>> + dma_free_coherent(info->dev, LPM_CTX_MEM_SIZE,
>> + info->ctx_mem_buf,
>> + info->ctx_mem_addr);
>> + return ret;
>> +}
>> +
>> /* Description for K2G */
>> static const struct ti_sci_desc ti_sci_pmmc_k2g_desc = {
>> .default_host_id = 2,
>> @@ -3639,6 +3682,14 @@ static int ti_sci_probe(struct platform_device *pdev)
>> }
>> }
>>
>> + ret = ti_sci_init_suspend(pdev, info);
>> + if (ret)
>> + dev_warn(dev,
>> + "ti_sci_init_suspend failed, mem suspend will be non-functional.\n");
>> +
>> + /* Suspend is an optional feature, reset return value and continue. */
>> + ret = 0;
>
> We end up getting this warning on all platforms with TISCI - even if
> LPM sequence is capable or not - what does the message mean? firmware is
> not capable of supporting sleep or it is a firmware capable of
> supporting, but failed to allocate LPM context memory?
>
> If it is optional (since it is probing to see if it has functionality),
> then do we need a dev_warn - maybe a softer of form?
>

Yeah, I agree, the message looks confusing. In both cases we can't enter suspend-to-ram,
but we consider that an optional feature, so a softer message will be more appropriate.


> [...]
>

--
Regards,
Georgi

\
 
 \ /
  Last update: 2022-11-21 22:46    [W:0.057 / U:1.672 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site