On Thu, Nov 13, 2025 at 04:06:02PM +0530, Mukesh Ojha wrote:
> Qualcomm remote processor may rely on static and dynamic resources for
> it to be functional. For most of the Qualcomm SoCs, when run with Gunyah
> or older QHEE hypervisor, all the resources whether it is static or
> dynamic, is managed by the hypervisor. Dynamic resources if it is
> present for a remote processor will always be coming from secure world
> via SMC call while static resources may be present in remote processor
> firmware binary or it may be coming from SMC call along with dynamic
> resources.
> 
> Remoteproc already has method like rproc_elf_load_rsc_table() to check
> firmware binary has resources or not and if it is not having then we
> pass NULL and zero as input resource table and its size argument
> respectively to qcom_scm_pas_get_rsc_table() and while it has resource
> present then it should pass the present resources to Trustzone(TZ) so that
> it could authenticate the present resources and append dynamic resource
> to return in output_rt argument along with authenticated resources.
> 
> Extend parse_fw callback to include SMC call to get resources from
> Trustzone and to leverage resource table parsing and mapping and
> unmapping code from the remoteproc framework.
> 
> Signed-off-by: Mukesh Ojha <[email protected]>
> ---
>  drivers/remoteproc/qcom_q6v5_pas.c | 60 
> ++++++++++++++++++++++++++++++++++++--
>  1 file changed, 58 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/remoteproc/qcom_q6v5_pas.c 
> b/drivers/remoteproc/qcom_q6v5_pas.c
> index 9feee2cb1883..4d00837db58d 100644
> --- a/drivers/remoteproc/qcom_q6v5_pas.c
> +++ b/drivers/remoteproc/qcom_q6v5_pas.c
> [...]
> @@ -413,6 +414,61 @@ static void *qcom_pas_da_to_va(struct rproc *rproc, u64 
> da, size_t len, bool *is
>       return pas->mem_region + offset;
>  }
>  
> +static int qcom_pas_parse_firmware(struct rproc *rproc, const struct 
> firmware *fw)
> +{
> +     size_t output_rt_size = MAX_RSCTABLE_SIZE;
> +     struct qcom_pas *pas = rproc->priv;
> +     struct resource_table *table = NULL;
> +     void *output_rt;
> +     size_t table_sz;
> +     int ret;
> +
> +     ret = qcom_register_dump_segments(rproc, fw);
> +     if (ret) {
> +             dev_err(pas->dev, "Error in registering dump segments\n");
> +             return ret;
> +     }
> +
> +     if (!rproc->has_iommu)
> +             return ret;

Just do "return 0;" please, you know already that it is 0.

> +
> +     ret = rproc_elf_load_rsc_table(rproc, fw);
> +     if (ret)
> +             dev_info(&rproc->dev, "Error in loading resource table from 
> firmware\n");

This is odd, you log an "error" as dev_info(), so is it an error or not?
If it is expected that firmware images may not have the resource table
in the ELF, you should probably just silently ignore this error (or use
dev_dbg()).

Thanks,
Stephan

Reply via email to