From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 84E5EF46100 for ; Mon, 23 Mar 2026 12:56:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:In-Reply-To: Content-Transfer-Encoding:Content-Type:MIME-Version:References:Message-ID: Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=myYt+XzCg+bE5pVv29XO8ZCXAJn0GDOTuiMIeq1HcZ0=; b=YaNBSh5TzM8TX72EJmrhNX0yJT iVkT72FJj3TxrMhPijnr3QOvYVJqP2lyfNQGO6TMppGGPkZjj7/lv9VIcSqBNoUIUT8KnGdEP2VKC QfLiOSAQk4asT7Wwj3DIIkm3aaLQDc6EbS9p6Y7G416ZVjoowcoeR7uWEbKJLN79UCRslPwxNqlia mgdiBIfDtZwwySLuy+iacpz2lmMhv4tBFezw2gJiRUCLA7Yg30QXB2omRgUeDI+MYyGtXgZ6iQEuI j1rV7DtsAJBhiXcXKvAn12rPyfvT71Dwm99EpcHNCKGsGLFF2U9cZcI4x0WrhNEDoevduOI7n+Fb4 MDe8sf9w==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98.2 #2 (Red Hat Linux)) id 1w4epK-0000000GjQy-17Y3; Mon, 23 Mar 2026 12:56:14 +0000 Received: from tor.source.kernel.org ([172.105.4.254]) by bombadil.infradead.org with esmtps (Exim 4.98.2 #2 (Red Hat Linux)) id 1w4epJ-0000000GjQq-0LOL for ath12k@lists.infradead.org; Mon, 23 Mar 2026 12:56:13 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by tor.source.kernel.org (Postfix) with ESMTP id DBF13600CB; Mon, 23 Mar 2026 12:56:11 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3F94AC4CEF7; Mon, 23 Mar 2026 12:55:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1774270571; bh=PcarGU8E9MYAzSiGlIlaN0J/d/2KgvnXGF646Sss/6o=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=NoUvT0Ua7vExYFgPZA0igjTdgV0kBq94+evWjMhFBjOIZRv4xfdNUbiaxRXEfZMq6 91VS32MQ+DNV8yrBKUUuWfsUhYYbBdqA2iOX/1ZwqUfR3o4KK55KUT2sg/AomDWEVJ cML8StUwS91VgBAOaGqn9DzrXrCZkJgJmXnHsIyEns5DJl0GkuS5xEozjfMwyEYLMI tUjxXbsQKfDvWtljLmC/dhr0bPEzLs3j+Dt/v6AOidSmPjND8gkQSoG0ROJevzjOye BsJCTGQ6iR64jHHIJ0sY3Z/7theuY1nSZ3Mlnh6tPIwZ/YiVv44DygZqJ1F8pvKq7T hl+W33yrZuphA== Date: Mon, 23 Mar 2026 18:25:53 +0530 From: Sumit Garg To: Mukesh Ojha Cc: linux-arm-msm@vger.kernel.org, devicetree@vger.kernel.org, dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org, linux-media@vger.kernel.org, netdev@vger.kernel.org, linux-wireless@vger.kernel.org, ath12k@lists.infradead.org, linux-remoteproc@vger.kernel.org, andersson@kernel.org, konradybcio@kernel.org, robh@kernel.org, krzk+dt@kernel.org, conor+dt@kernel.org, robin.clark@oss.qualcomm.com, sean@poorly.run, akhilpo@oss.qualcomm.com, lumag@kernel.org, abhinav.kumar@linux.dev, jesszhan0024@gmail.com, marijn.suijten@somainline.org, airlied@gmail.com, simona@ffwll.ch, vikash.garodia@oss.qualcomm.com, dikshita.agarwal@oss.qualcomm.com, bod@kernel.org, mchehab@kernel.org, elder@kernel.org, andrew+netdev@lunn.ch, davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, jjohnson@kernel.org, mathieu.poirier@linaro.org, trilokkumar.soni@oss.qualcomm.com, pavan.kondeti@oss.qualcomm.com, jorge.ramirez@oss.qualcomm.com, tonyh@qti.qualcomm.com, vignesh.viswanathan@oss.qualcomm.com, srinivas.kandagatla@oss.qualcomm.com, amirreza.zarrabi@oss.qualcomm.com, jens.wiklander@linaro.org, op-tee@lists.trustedfirmware.org, apurupa@qti.qualcomm.com, skare@qti.qualcomm.com, linux-kernel@vger.kernel.org, Sumit Garg Subject: Re: [PATCH v2 02/15] firmware: qcom: Add a generic PAS service Message-ID: References: <20260312062756.694390-1-sumit.garg@kernel.org> <20260312062756.694390-3-sumit.garg@kernel.org> <20260313072450.sx7vqtvh62nflhff@hu-mojha-hyd.qualcomm.com> <20260313073121.qb7yq7tcga3sshcr@hu-mojha-hyd.qualcomm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20260313073121.qb7yq7tcga3sshcr@hu-mojha-hyd.qualcomm.com> X-BeenThere: ath12k@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "ath12k" Errors-To: ath12k-bounces+ath12k=archiver.kernel.org@lists.infradead.org On Fri, Mar 13, 2026 at 01:01:21PM +0530, Mukesh Ojha wrote: > On Fri, Mar 13, 2026 at 12:54:50PM +0530, Mukesh Ojha wrote: > > On Thu, Mar 12, 2026 at 11:57:43AM +0530, Sumit Garg wrote: > > > From: Sumit Garg > > > > > > Qcom platforms has the legacy of using non-standard SCM calls > > > splintered over the various kernel drivers. These SCM calls aren't > > > compliant with the standard SMC calling conventions which is a > > > prerequisite to enable migration to the FF-A specifications from Arm. > > > > > > OP-TEE as an alternative trusted OS to Qualcomm TEE (QTEE) can't > > > support these non-standard SCM calls. And even for newer architectures > > > with S-EL2 and Hafnium support, QTEE won't be able to support SCM > > > > using S‑EL2 with Hafnium > > > > > calls either with FF-A requirements coming in. And with both OP-TEE > > > and QTEE drivers well integrated in the TEE subsystem, it makes further > > > sense to reuse the TEE bus client drivers infrastructure. > > > > > > The added benefit of TEE bus infrastructure is that there is support > > > for discoverable/enumerable services. With that client drivers don't > > > have to manually invoke a special SCM call to know the service status. > > > > > > So enable the generic Peripheral Authentication Service (PAS) provided > > > by the firmware. It acts as the common layer with different TZ > > > backends plugged in whether it's an SCM implementation or a proper > > > TEE bus based PAS service implementation. > > > > > > Signed-off-by: Sumit Garg > > > --- > > > drivers/firmware/qcom/Kconfig | 8 + > > > drivers/firmware/qcom/Makefile | 1 + > > > drivers/firmware/qcom/qcom_pas.c | 298 +++++++++++++++++++++++++ > > > drivers/firmware/qcom/qcom_pas.h | 53 +++++ > > > include/linux/firmware/qcom/qcom_pas.h | 41 ++++ > > > 5 files changed, 401 insertions(+) > > > create mode 100644 drivers/firmware/qcom/qcom_pas.c > > > create mode 100644 drivers/firmware/qcom/qcom_pas.h > > > create mode 100644 include/linux/firmware/qcom/qcom_pas.h > > > > > > diff --git a/drivers/firmware/qcom/qcom_pas.c b/drivers/firmware/qcom/qcom_pas.c > > > new file mode 100644 > > > index 000000000000..beb1bae55546 > > > --- /dev/null > > > +++ b/drivers/firmware/qcom/qcom_pas.c > > > @@ -0,0 +1,298 @@ > > > +// SPDX-License-Identifier: GPL-2.0 > > > +/* > > > + * Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries. > > > + */ > > > + > > > +#include > > > +#include > > > +#include > > > +#include > > > + > > > +#include "qcom_pas.h" > > > + > > > +struct qcom_pas_ops *ops_ptr; > > > > Should this be static ? > > > > > + > > > +/** > > > + * devm_qcom_pas_context_alloc() - Allocate 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 > > > + * > > > + * Return: The new PAS context, or ERR_PTR() on failure. > > > + */ > > > +struct qcom_pas_context *devm_qcom_pas_context_alloc(struct device *dev, > > > + u32 pas_id, > > > + phys_addr_t mem_phys, > > > + size_t mem_size) > > > +{ > > > + struct qcom_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_pas_context_alloc); > > > + > > > +/** > > > + * qcom_pas_init_image() - Initialize peripheral authentication service state > > > + * machine for a given peripheral, using the metadata > > > + * @pas_id: peripheral authentication service id > > > + * @metadata: pointer to memory containing ELF header, program header table > > > + * and optional blob of data used for authenticating the metadata > > > + * and the rest of the firmware > > > + * @size: size of the metadata > > > + * @ctx: optional pas context > > > + * > > > + * Return: 0 on success. > > > + * > > > + * Upon successful return, the PAS metadata context (@ctx) will be used to > > > + * track the metadata allocation, this needs to be released by invoking > > > + * qcom_pas_metadata_release() by the caller. > > > + */ > > > +int qcom_pas_init_image(u32 pas_id, const void *metadata, size_t size, > > > + struct qcom_pas_context *ctx) > > please, align this with previous line '(' for all the functions. > The alignment is fine here, not sure why the plain text replies show them as not aligned. -Sumit