On Tue, Mar 10, 2026 at 07:07:10PM +0530, Mukesh Ojha wrote:
> DTB PAS context creation should be done only for subsystems that support
> a DTB firmware binary; otherwise, memory is wasted. Move the context
> creation to the appropriate location and, while at it, fix the place
> where the DTB PAS context was being released unconditionally.


Ignore this patch, this is half baked..

> 
> Fixes: b13d8baf5601 ("remoteproc: pas: Replace metadata context with PAS 
> context structure")
> Signed-off-by: Mukesh Ojha <[email protected]>
> ---
>  drivers/remoteproc/qcom_q6v5_pas.c | 35 +++++++++++++++---------------
>  1 file changed, 17 insertions(+), 18 deletions(-)
> 
> diff --git a/drivers/remoteproc/qcom_q6v5_pas.c 
> b/drivers/remoteproc/qcom_q6v5_pas.c
> index 46204da046fa..74596b82aa74 100644
> --- a/drivers/remoteproc/qcom_q6v5_pas.c
> +++ b/drivers/remoteproc/qcom_q6v5_pas.c
> @@ -250,7 +250,9 @@ static int qcom_pas_load(struct rproc *rproc, const 
> struct firmware *fw)
>       return 0;
>  
>  release_dtb_metadata:
> -     qcom_scm_pas_metadata_release(pas->dtb_pas_ctx);
> +     if (pas->dtb_pas_id)
> +             qcom_scm_pas_metadata_release(pas->dtb_pas_ctx);
> +
>       release_firmware(pas->dtb_firmware);
>  
>       return ret;
> @@ -640,6 +642,12 @@ static int qcom_pas_alloc_memory_region(struct qcom_pas 
> *pas)
>               return PTR_ERR(pas->mem_region);
>       }
>  
> +     pas->pas_ctx = devm_qcom_scm_pas_context_alloc(pas->dev, pas->pas_id,
> +                                                    pas->mem_phys, 
> pas->mem_size);
> +     if (IS_ERR(pas->pas_ctx))
> +             return PTR_ERR(pas->pas_ctx);
> +
> +     pas->pas_ctx->use_tzmem = rproc->has_iommu;
>       if (!pas->dtb_pas_id)
>               return 0;
>  
> @@ -657,6 +665,14 @@ static int qcom_pas_alloc_memory_region(struct qcom_pas 
> *pas)
>               return PTR_ERR(pas->dtb_mem_region);
>       }
>  
> +     pas->dtb_pas_ctx = devm_qcom_scm_pas_context_alloc(pas->dev, 
> pas->dtb_pas_id,
> +                                                        pas->dtb_mem_phys,
> +                                                        pas->dtb_mem_size);
> +     if (IS_ERR(pas->dtb_pas_ctx))
> +             return PTR_ERR(pas->dtb_pas_ctx);
> +
> +     pas->dtb_pas_ctx->use_tzmem = rproc->has_iommu;
> +
>       return 0;
>  }
>  
> @@ -838,23 +854,6 @@ static int qcom_pas_probe(struct platform_device *pdev)
>  
>       qcom_add_ssr_subdev(rproc, &pas->ssr_subdev, desc->ssr_name);
>  
> -     pas->pas_ctx = devm_qcom_scm_pas_context_alloc(pas->dev, pas->pas_id,
> -                                                    pas->mem_phys, 
> pas->mem_size);
> -     if (IS_ERR(pas->pas_ctx)) {
> -             ret = PTR_ERR(pas->pas_ctx);
> -             goto remove_ssr_sysmon;
> -     }
> -
> -     pas->dtb_pas_ctx = devm_qcom_scm_pas_context_alloc(pas->dev, 
> pas->dtb_pas_id,
> -                                                        pas->dtb_mem_phys,
> -                                                        pas->dtb_mem_size);
> -     if (IS_ERR(pas->dtb_pas_ctx)) {
> -             ret = PTR_ERR(pas->dtb_pas_ctx);
> -             goto remove_ssr_sysmon;
> -     }
> -
> -     pas->pas_ctx->use_tzmem = rproc->has_iommu;
> -     pas->dtb_pas_ctx->use_tzmem = rproc->has_iommu;
>       ret = rproc_add(rproc);
>       if (ret)
>               goto remove_ssr_sysmon;
> -- 
> 2.50.1
> 

-- 
-Mukesh Ojha

Reply via email to