[PATCH v4 3/5] firmware: ti_sci: Allocate memory for the LPM modes

Nishanth Menon nm at ti.com
Mon Nov 21 10:44:35 PST 2022


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?

[...]

-- 
Regards,
Nishanth Menon
Key (0xDDB5849D1736249D) / Fingerprint: F8A2 8693 54EB 8232 17A3  1A34 DDB5 849D 1736 249D



More information about the linux-arm-kernel mailing list