Re: [PATCH v4 6/6] firmware: qcom: scm: introduce keep_mdt_buf flag in PAS context
From: Dmitry Baryshkov
Date: Mon Jul 06 2026 - 14:24:25 EST
On Fri, May 01, 2026 at 12:42:53AM +0530, Mukesh Ojha wrote:
> The PAS image initialization path always retains the metadata buffer
> when a valid qcom_scm_pas_context is provided, even if the caller does
> not require it. This implicit behavior leads to unclear buffer ownership
> and forces new users of qcom_mdt_pas_load() to manually release
> metadata, which is error‑ prone and incorrect.
>
> Add a keep_mdt_buf flag to struct qcom_scm_pas_context to make metadata
> retention explicit. Metadata buffers are now freed by default and are
> only preserved when this flag is set. qcom_q6v5_pas enables this during
> probe for contexts that require retained metadata for subsequent PAS
> operations, while existing callers continue to work unchanged.
Would it make sense to make new API backwards-compatible, so that we
dont' need to touch other drivers at the same time? It probably means
adding ->free_mdt_buf flag rather than keep_mdt_buf.
>
> Signed-off-by: Mukesh Ojha <mukesh.ojha@xxxxxxxxxxxxxxxx>
> ---
> drivers/firmware/qcom/qcom_scm.c | 21 ++++++++++++++++++---
> drivers/remoteproc/qcom_q6v5_pas.c | 2 ++
> include/linux/firmware/qcom/qcom_scm.h | 1 +
> 3 files changed, 21 insertions(+), 3 deletions(-)
>
--
With best wishes
Dmitry