lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20251113141826.qvjz4ozlnvx3ucw6@hu-mojha-hyd.qualcomm.com>
Date: Thu, 13 Nov 2025 19:48:26 +0530
From: Mukesh Ojha <mukesh.ojha@....qualcomm.com>
To: Stephan Gerhold <stephan.gerhold@...aro.org>
Cc: Bjorn Andersson <andersson@...nel.org>,
        Mathieu Poirier <mathieu.poirier@...aro.org>,
        Rob Herring <robh@...nel.org>,
        Krzysztof Kozlowski <krzk+dt@...nel.org>,
        Conor Dooley <conor+dt@...nel.org>,
        Manivannan Sadhasivam <mani@...nel.org>,
        Konrad Dybcio <konradybcio@...nel.org>, linux-arm-msm@...r.kernel.org,
        linux-remoteproc@...r.kernel.org, devicetree@...r.kernel.org,
        linux-kernel@...r.kernel.org
Subject: Re: [PATCH v7 04/14] firmware: qcom_scm: Introduce PAS context
 initialization helper function

On Thu, Nov 13, 2025 at 12:57:08PM +0100, Stephan Gerhold wrote:
> On Thu, Nov 13, 2025 at 04:05:54PM +0530, Mukesh Ojha wrote:
> > When the Peripheral Authentication Service (PAS) method runs on a SoC
> > where Linux operates at EL2 (i.e., without the Gunyah hypervisor), the
> > reset sequences are handled by TrustZone. In such cases, Linux must
> > perform additional steps before invoking PAS SMC calls, such as creating
> > a SHM bridge. Therefore, PAS SMC calls require awareness and handling of
> > these additional steps when Linux runs at EL2.
> > 
> > To support this, there is a need for a data structure that can be
> > initialized prior to invoking any SMC or MDT functions. This structure
> > allows those functions to determine whether they are operating in the
> > presence or absence of the Gunyah hypervisor and behave accordingly.
> > 
> > Currently, remoteproc and non-remoteproc subsystems use different
> > variants of the MDT loader helper API, primarily due to differences in
> > metadata context handling. Remoteproc subsystems retain the metadata
> > context until authentication and reset are completed, while
> > non-remoteproc subsystems (e.g., video, graphics, IPA, etc.) do not
> > retain the metadata context and can free it within the
> > qcom_scm_pas_init() call by passing a NULL context parameter and due to
> > these differences, it is not possible to extend metadata context
> > handling to support remoteproc and non remoteproc subsystem use PAS
> > operations, when Linux operates at EL2.
> > 
> > Add PAS context data structure and initialization helper function.
> > 
> > Signed-off-by: Mukesh Ojha <mukesh.ojha@....qualcomm.com>
> > ---
> >  drivers/firmware/qcom/qcom_scm.c       | 32 ++++++++++++++++++++++++++++++++
> >  include/linux/firmware/qcom/qcom_scm.h | 12 ++++++++++++
> >  2 files changed, 44 insertions(+)
> > 
> > diff --git a/drivers/firmware/qcom/qcom_scm.c b/drivers/firmware/qcom/qcom_scm.c
> > index 0a0c48fca7cf..e4eb7f3ab7a5 100644
> > --- a/drivers/firmware/qcom/qcom_scm.c
> > +++ b/drivers/firmware/qcom/qcom_scm.c
> > @@ -558,6 +558,38 @@ static void qcom_scm_set_download_mode(u32 dload_mode)
> >  		dev_err(__scm->dev, "failed to set download mode: %d\n", ret);
> >  }
> >  
> > +/**
> > + * devm_qcom_scm_pas_context_init() - Initialize peripheral authentication service
> > + *				      context for a given peripheral
> > + *
> > + * PAS context is device-resource managed, so the caller does not need
> > + * to worry about freeing the context memory.
> > + *
> > + * @dev:	  PAS firmware device
> > + * @pas_id:	  peripheral authentication service id
> > + * @mem_phys:	  Subsystem reserve memory start address
> > + * @mem_size:	  Subsystem reserve memory size
> > + *
> > + * Upon successful, returns the PAS context or ERR_PTR() of the error otherwise.
> > + */
> > +void *devm_qcom_scm_pas_context_init(struct device *dev, u32 pas_id, phys_addr_t mem_phys,
> 
> Why does this return void* rather than struct qcom_scm_pas_context *?

I kept it similar to align with other devm_* api, however, I can change it to
struct qcom_scm_pas_context if it looks more reasonable.

> 
> > +				     size_t mem_size)
> > +{
> > +	struct qcom_scm_pas_context *ctx;
> > +
> > +	ctx = devm_kzalloc(dev, sizeof(*ctx), GFP_KERNEL);
> > +	if (!ctx)
> > +		return ERR_PTR(-ENOMEM);
> > +
> > +	ctx->dev = dev;
> > +	ctx->pas_id = pas_id;
> > +	ctx->mem_phys = mem_phys;
> > +	ctx->mem_size = mem_size;
> > +
> > +	return ctx;
> > +}
> > +EXPORT_SYMBOL_GPL(devm_qcom_scm_pas_context_init);
> 
> Thanks,
> Stephan

-- 
-Mukesh Ojha

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ