From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mx0b-0031df01.pphosted.com (mx0b-0031df01.pphosted.com [205.220.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 451FF1A680D for ; Mon, 23 Mar 2026 14:26:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.180.131 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774275972; cv=none; b=tVFZcdg6UicItBuKWBI9KNMHVhkIhLSsAVarG4HnpgE76acesJ+Rt6fHmx+hVsxyaD687YYgkN6cIjJ+WcLd9YbeRdISX3A82v8k9+leZQnFcd58MhtEi9lulsjfYJQCkPeLsTNSBFlG4V6RBOBu0mr621Vm7ZkCY3Y3beuBzVI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774275972; c=relaxed/simple; bh=pqVgpg17eJHPRS2YVvj9etxBbvKB5WNQ8xPwA2cEbD4=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=TtCXDLWJ+PwIXqworh+8sll0sRYnMxQ5I9/H2Kdiv1MYaHgy3yIFlR3gs0KSZJxhN0HD1hchj0CsXhe3V7aNP6m39dIfkA6KJbHlmrWOcOLtdyFR6srOOjna8s/dmiGkb65LNRx33s+eaWsNOff90yJiXVrR0/mjoGWE5RGdds8= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com; spf=pass smtp.mailfrom=oss.qualcomm.com; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b=FCEqIwQU; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b=Vq7usdm4; arc=none smtp.client-ip=205.220.180.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b="FCEqIwQU"; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b="Vq7usdm4" Received: from pps.filterd (m0279872.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 62NC1wvH3041702 for ; Mon, 23 Mar 2026 14:26:09 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qualcomm.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=qcppdkim1; bh= q8MEwGZvZBzKxOvXFYbCiIUql2m67G/KfJewSSa/tAY=; b=FCEqIwQUe0G4B+4e zycwwl8D0aVorIfQgKi2f+U0Ie1Rsmy8mJcPQv9ta1zUjIRobIXPRX1FB+je6tFy lWD6YNGpm4ryD0UGclb1tO9bnvUzmsbC04jtc8zf25QkqKIzZMGBKlIgof23JVU5 sSpH/Ka9AkItoR6abfTE9BQG/H6Q0/w+x+D1FGGxi7pQIk803hOvATDR/hHCEi9f P+qb9sVlsJrjZgOZiR/TEEvqsf79rCjhVZjXMDlHCecg6nKC8iaSqLczdOMn24Xx /eyehRrNiyyTuCjELGNSwoRzYFbrrH8hkneo/UREupc1mFc4RoKAp1GjUlNbF9ZO HLT3fA== Received: from mail-vs1-f71.google.com (mail-vs1-f71.google.com [209.85.217.71]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4d355w0gnt-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Mon, 23 Mar 2026 14:26:09 +0000 (GMT) Received: by mail-vs1-f71.google.com with SMTP id ada2fe7eead31-60276d88541so430620137.2 for ; Mon, 23 Mar 2026 07:26:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1774275969; x=1774880769; darn=vger.kernel.org; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=q8MEwGZvZBzKxOvXFYbCiIUql2m67G/KfJewSSa/tAY=; b=Vq7usdm4bMsTEYVm3m7LkhBZEnwPZnx61MlqsgbqzQQe3ArvwXcPgvidhWrEhNafOn zCnW31yxuDD8KDZhfFbl6X0KBSAtwMeehV4txMQrJDDqBdg9SXGt26ItvC0wRkY4xCDj UVjlOmtA4Tj5uvLBo0DYt/QEG76+ga+4JytSUkfs96xas+20w+4VParhfjW77n0P5Dzh wr8OaUFAhBDDq5Sj3V2tiMJF5ux6nyy4JJtvYWxMXGiC5x2H3M+3mr2fCF2IG5/JEmD/ iQEZKU5URwUPfyXNNyV7T+eFcyT2DM93iczruPx78bk1ObbuxRcOaCfbSgeBCJ9i44Zr JdSQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1774275969; x=1774880769; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :x-gm-gg:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=q8MEwGZvZBzKxOvXFYbCiIUql2m67G/KfJewSSa/tAY=; b=cgF9CrtRx46sh8YBc9gvOr7ZXAw3HN7wQ1rU7zTRCASgIZZKIL2WZ0Vu5bdj5m45m/ MloqSOPkWZtBd3Wo7RxJZGt8UtKNTzw4Nc04NbT6fFurxFuemWRc/4bYql7QNU1dXhfn Gc00pgchf7C2qMiAKHn5Fx++AvRXAvm+c9POLS/PhZi6/e+s6VxuOlUz+C79eVZ4ugEd B3XaDpDc5qi4FH2UWwqUs7XAg4FzDeACDjAGFD/e3vsH65yVfB2SYeA/3/cfJP5+NE7V ez0IFv5S3UFxYJ3v5CDKCmluuQofSVGuHZ3E7Cq00MkUHslzsh96WYMeU40f/G7kQ7Xj 5nHw== X-Forwarded-Encrypted: i=1; AJvYcCVup2okKn9yW4Ro6ZXaZD+qUM30Pq3DHaknk7uotluUdfG8sraIgMrhIvS58GIEPbMvSqBgkWQ=@vger.kernel.org X-Gm-Message-State: AOJu0YzMngXg9nzzSZ1OR0B90vosTw/fx3a0R1/+Nnwdr4FToubQzEJn J1A2+Szrjf58hwDF+ja2/Qi5nTnLWN3oQt+Q+VMkxIGaaPlFBElF09msi6q1agl5IKDVwLIeXzw /jAAqVZlNKfquzy3chXQZq0K8aq+lpXl7Kix7yv/v11ew9rE3P76wwSbQ6n4= X-Gm-Gg: ATEYQzy7/UogyKoXTzT+9Li+OwED4N4oIDWRE52D+ngHp+K6PrvZMIxrJR03fRJfwBK 6iX/ZrV7GwAVgGHN4pSTJVIlIA0hodGIWz+ed61sDgQlGAonjnwT3GnX+x5NlPrt8HABcKE5kjf t2SMnuupvmnKpzWw5xtVQDY6mat1v3UeYH6+o5JJZDLjFWD9YV/F6Zvt5xQfoZc7LCPgSZZr9o2 cREE8LZv9JQPUz+AfYATW4EdrsibFbyrHbSE7YOdsdLT34cdLtboSuycWeLNy/fOKzYD5kv66M+ VS8H2TCqvJIKQEu9SO5PA5j/8BTjdeWzDz4B+Qj5GJ4u37oil7JklbS09S1KKa6jYKp7CjPU6/m BWbeU5cN3GPtKwhluQ0N/yk7qf0QnMIqmuPNo84bGRGxA/ZK7DWzlMo6nqoUj9WEWc9FcpD3ev/ vmAgg= X-Received: by 2002:a05:6102:3910:b0:5ff:9d74:9677 with SMTP id ada2fe7eead31-602aec08323mr2933734137.3.1774275968636; Mon, 23 Mar 2026 07:26:08 -0700 (PDT) X-Received: by 2002:a05:6102:3910:b0:5ff:9d74:9677 with SMTP id ada2fe7eead31-602aec08323mr2933671137.3.1774275967928; Mon, 23 Mar 2026 07:26:07 -0700 (PDT) Received: from [192.168.119.254] (078088045245.garwolin.vectranet.pl. [78.88.45.245]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-b983e4e9b65sm398492366b.31.2026.03.23.07.26.02 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 23 Mar 2026 07:26:07 -0700 (PDT) Message-ID: <2e55bdc3-54a1-4f18-b9ad-fe03f21fc4da@oss.qualcomm.com> Date: Mon, 23 Mar 2026 15:26:01 +0100 Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v2 02/15] firmware: qcom: Add a generic PAS service To: Krzysztof Kozlowski , Sumit Garg 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, mukesh.ojha@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 References: <20260312062756.694390-1-sumit.garg@kernel.org> <20260312062756.694390-3-sumit.garg@kernel.org> <28d63822-f191-400a-8005-5185dd480dbb@kernel.org> <5c5b49aa-7819-44c6-b5f7-19ec780d73fa@kernel.org> Content-Language: en-US From: Konrad Dybcio In-Reply-To: <5c5b49aa-7819-44c6-b5f7-19ec780d73fa@kernel.org> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Authority-Analysis: v=2.4 cv=fq7RpV4f c=1 sm=1 tr=0 ts=69c14d81 cx=c_pps a=P2rfLEam3zuxRRdjJWA2cw==:117 a=FpWmc02/iXfjRdCD7H54yg==:17 a=IkcTkHD0fZMA:10 a=Yq5XynenixoA:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=u7WPNUs3qKkmUXheDGA7:22 a=yx91gb_oNiZeI1HMLzn7:22 a=EUspDBNiAAAA:8 a=RZWjG5IIt-miciyuqOEA:9 a=QEXdDO2ut3YA:10 a=ODZdjJIeia2B_SHc_B0f:22 X-Proofpoint-ORIG-GUID: ID54WlaDM2zcokDwsQI4q9B9IQXviMVX X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwMzIzMDExMSBTYWx0ZWRfX/BJSKMYQhCol PBUPBDD+5C8XDzBY45YIcIVfCqlNeqZpxjUSV+lJ6czHVIZYfdm8Wf2noRP4bQ+KQK+77fuFhTu uxxmhmCGed9zGqf1B1ufGUsp8yXniQDU8gZqt7DgzAR157MBJ7VvqMo9deH5pSGO9ZuhU/W1DB8 GLBHD5l8NKUagRy34KvoXdJVwf7Yea6Lx46uEK/OsaXJdfaMGkc6yt2gZxOfBOtCX/XBlEwU2Fq SHfn/x20IyfHCF1n/vTyfZ2wStpKN8gN2q9kiLSggER1C8JchT4+ewqfiBljp9YhqA3zjkUwGra afkfHrYizaW925Lkv9lpGcNKaZHJVhdZxH0T6Ti7LuCW7yqp9tHOsVUnhwMxOaNPXt++BsQTm+9 CgIDKWHYm0ukb2tkWWLpLZJRMbC+72vlPpiPmkRtdV9GVHQUThdk9SVjR5/84lrKHN1gZ6//rqp 9sIzaR2sV1X95CNKYWw== X-Proofpoint-GUID: ID54WlaDM2zcokDwsQI4q9B9IQXviMVX X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1143,Hydra:6.1.51,FMLib:17.12.100.49 definitions=2026-03-23_04,2026-03-23_01,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 malwarescore=0 spamscore=0 adultscore=0 clxscore=1015 impostorscore=0 lowpriorityscore=0 suspectscore=0 priorityscore=1501 bulkscore=0 phishscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2603050001 definitions=main-2603230111 On 3/23/26 3:19 PM, Krzysztof Kozlowski wrote: > On 23/03/2026 14:22, Sumit Garg wrote: >> On Mon, Mar 16, 2026 at 08:51:16AM +0100, Krzysztof Kozlowski wrote: >>> On 12/03/2026 07:27, 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 >>>> 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/Kconfig b/drivers/firmware/qcom/Kconfig >>>> index b477d54b495a..8653639d06db 100644 >>>> --- a/drivers/firmware/qcom/Kconfig >>>> +++ b/drivers/firmware/qcom/Kconfig >>>> @@ -6,6 +6,14 @@ >>>> >>>> menu "Qualcomm firmware drivers" >>>> >>>> +config QCOM_PAS >>>> + tristate >>>> + help >>>> + 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. >>>> + >>>> config QCOM_SCM >>>> select QCOM_TZMEM >>>> tristate >>>> diff --git a/drivers/firmware/qcom/Makefile b/drivers/firmware/qcom/Makefile >>>> index 0be40a1abc13..dc5ab45f906a 100644 >>>> --- a/drivers/firmware/qcom/Makefile >>>> +++ b/drivers/firmware/qcom/Makefile >>>> @@ -8,3 +8,4 @@ qcom-scm-objs += qcom_scm.o qcom_scm-smc.o qcom_scm-legacy.o >>>> obj-$(CONFIG_QCOM_TZMEM) += qcom_tzmem.o >>>> obj-$(CONFIG_QCOM_QSEECOM) += qcom_qseecom.o >>>> obj-$(CONFIG_QCOM_QSEECOM_UEFISECAPP) += qcom_qseecom_uefisecapp.o >>>> +obj-$(CONFIG_QCOM_PAS) += qcom_pas.o >>>> 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; >>> >>> Same comment as before. Don't create singletons. And for sure not global >>> ones. >> >> This pattern has been carried from the PAS API contract among kernel >> clients and the SCM PAS service earlier. The clients don't hold a >> reference to the PAS data like underlying platform or TEE device etc. >> Hence the need to have a global data pointer to hold reference to the >> ops data structure registered by drivers having different lifetime of >> devices. Also, the PAS APIs can be called from very different client >> driver contexts. >> >> Surely, avoiding global data is always better given a better alternative >> is there. Do you have any better alternative proposal here? > > Why it cannot be part of the context? > > Look at your API, e.g.: > qcom_pas_init_image(). It takes struct qcom_pas_context which should > contain the ops. This would make the client have to select the ops. The whole point is to avoid that, since the client has no clue (and is supposed not to have any). What Sumit does is to bind the ops based on the runtime-discovered mechanism (which needs to only happen once, given we're not replacing the TZ at runtime) Konrad