From nobody Sat Feb 7 09:29:52 2026 Received: from mx0a-0031df01.pphosted.com (mx0a-0031df01.pphosted.com [205.220.168.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 EEE3933B95E for ; Mon, 5 Jan 2026 13:23:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.168.131 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767619414; cv=none; b=gB1E5tmeiUkmhvWIBJn1TwWzCHuUJpjE4NRHFBiKYul3rR34XiyJKmpeLOqqxASypZZxUau+CZYgH9CIhlZJaNKyvhXmEOLhN50SjOOc1HqqkvMBoLfTtsugqy9/Tw8UCOqgSHeUWOTGgafdZO0ZzSUdeMeJ6OQeHdRkeX9blq8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767619414; c=relaxed/simple; bh=HrLkG36I07Ib0XRgEzoPfMEgZMeQfHT6NhYwPB4Ll/Q=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=lm++KogqqdrD7f56JYbls6ZkZDthC2a4cuNqBC8z8V6r3eS6whWzwUXIvLupuF9XjsSiBaUQ+kT7R8heDVRI31xeZF2b4PkZ+3YWpMKB8hWIhRrsnoB/lnvYKQo22qlDYuqMJf8vZFS5ydioVYM+f/cyYQBWqOlla7JsLYonpWo= 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=TgmxVvoY; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b=IbpFN4oa; arc=none smtp.client-ip=205.220.168.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="TgmxVvoY"; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b="IbpFN4oa" Received: from pps.filterd (m0279866.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 605A6DYU3541659 for ; Mon, 5 Jan 2026 13:23:32 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= +ixUkiWjvrA2xnuQivPNMlYRl32u7TOycV7BpXyApjM=; b=TgmxVvoYUlLvcu4F 1aCF99jzASv23+RPtdpBV8v87aMdpFk0Gesh1SU/OSa5s9slFDas+iubdhXQZPIB xg+cHdC8rChoAmeXelqldFYSPa0PcXzIJCSIdIQWB3Hijb+jOoa1mbXS+vAItdLy iyc3mMwAjcoMIUnTuRsa3FkiCT7z3eNSnqtJx3yGAtQx47LVXTM8bbov3O+wTsM3 VcOcR+tcZ4WHEij/NijV9l6+qjpaeEvs+J5z1aCMTaaFrAvp3X9AvUxuXYkpuG2p YxurqE5Y4yZQea1dQQSwxVXt97f/nWxi0wQbPzmAAOwzBE4WIE50DBd3GviSZQYx 0W3o/w== Received: from mail-pf1-f199.google.com (mail-pf1-f199.google.com [209.85.210.199]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4bg57shkfq-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Mon, 05 Jan 2026 13:23:32 +0000 (GMT) Received: by mail-pf1-f199.google.com with SMTP id d2e1a72fcca58-7f21951c317so11253498b3a.2 for ; Mon, 05 Jan 2026 05:23:32 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1767619411; x=1768224211; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=+ixUkiWjvrA2xnuQivPNMlYRl32u7TOycV7BpXyApjM=; b=IbpFN4oaGgX+p1KY5Eyn8oMP4CKnnDtiZA8LasC05/qf82zNt7LGauIZ/XoXYjFsyg AEBAUmbE60k3Oj286mRgiiMnKX+hzz/eY2PkLSZXxna8ClazEfuZjWm3MtH2X3pjSTTL KDfBExOcWMtiKYKyl+1usv3Jlc+SKsF2hPECIPfU8natekYUimDuZayXqJirwkxLcXCo NBJEqLkTbqLMmecHxvPhNosId0c8Jj9/2IPzPwLnazkLmkuAbXhvsouNKaxIK7NsUsPR OhpIksldqcxJf6aI44mY6hBl/PDgDPpxQ3QhyYUF+7ObK1hTz4JJxbzyMu7LirnseqWL 3KDg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1767619411; x=1768224211; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-gg:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=+ixUkiWjvrA2xnuQivPNMlYRl32u7TOycV7BpXyApjM=; b=rKE9LnwwEAhxoHuQ4vBlI0Q4JIPkA0mW7Vkvt+L4eAruEE8sHLMiPruUHN/9K5NYtW ClyD1YUkrKE9ETaEURWz/vcTnXoGVSHja8epq0IM7nioCIFQlVB3TsXhP5ZFVuwGZypY W66uLqacSppW3nqXVoPiaZAMeAxmWG5otKCosuvm+BFUT+3j4LLJM4PE23yBABfOe6CP 72y2uXy0VmSn3P8jSXuN8yQtMOd2d+GddcyH07IIux2HONnIQ7ktauwWsLBhvsQrYYaP qNGAI76wOuX6tK9rNLtgYK1g3qZojDVEArKYaF/75e67P2gz/eQe3Of5YSXcPYnyOCHU htMQ== X-Forwarded-Encrypted: i=1; AJvYcCUbtTQchebgKvnKg4Undh08W8pdETg/NDpTugcOtyXxoF1TQuZoW7KNpvUWeo5+WGX0Ykg4YqaS18BZyJc=@vger.kernel.org X-Gm-Message-State: AOJu0Yx71XRA54AFFYPkHCQ4UulE6Ri40ewRrb8mPxm9fCbLsZG3qPAy lod8Uo+hutuKVFJuV9gDmvoN/GItk/v2r8q6IpYjq9240oH5PmaybR61FdRhMibdbwkJI7pVRmY aLHao6EQpMWoWhNhVomQnCpfzR8bBN+f9hEEdi3GjgC8fk3afFtcIPr/ZUTqdweRwzDA= X-Gm-Gg: AY/fxX7x6xHLuGUYIdNYfPI1WJ/S6AJO33YRdpBwjVhbiYjC1CJRycT+jYrAuW0dGCs lhrRTdGUO06oNBAz/FAyXN+IwbFNOsP2+LZb6tTZS/yHxFfqYSe+QubXFBIrMWUX0UdccF13aGu hA3QOA3hgs3L+O5DM6KBpLStins2pBXCnNdmfrPsn+FO6ZhDscPwccAkaSkAXwnVpLIBQhrEs4O EAyqvrPcaKgGQUKoqYCP7evLQf6KNxwGk/exA3XRk+Oi+HyHaw/Wf2s5PYQFeQY0kCUtFAJLbws 6EEDDiwA2Fy7BUHAMHNCxFkQeGdZ0NFDJqSSCG6v+MKrcnkfq+vKY0XSJtdG97loTm4tVbvZOkW GBaQdy/xn6qdOEeunz0BlUUn6S2j5VL9EA8cL X-Received: by 2002:a05:6a00:4483:b0:7e8:4471:8e4 with SMTP id d2e1a72fcca58-7ff66f5ae03mr38215253b3a.69.1767619411411; Mon, 05 Jan 2026 05:23:31 -0800 (PST) X-Google-Smtp-Source: AGHT+IG+OmHz3U8kN2GWNtwM65IjApm5j0ep/tO3ITPoxAyzCoic25jZF7MQ25wgM4nE9IGG8nMJhg== X-Received: by 2002:a05:6a00:4483:b0:7e8:4471:8e4 with SMTP id d2e1a72fcca58-7ff66f5ae03mr38215227b3a.69.1767619410822; Mon, 05 Jan 2026 05:23:30 -0800 (PST) Received: from hu-mojha-hyd.qualcomm.com ([202.46.23.25]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-7ff7b127b00sm48426542b3a.21.2026.01.05.05.23.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 05 Jan 2026 05:23:30 -0800 (PST) From: Mukesh Ojha Date: Mon, 05 Jan 2026 18:52:52 +0530 Subject: [PATCH v10 04/14] firmware: qcom_scm: Introduce PAS context allocator helper function Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260105-kvmrprocv10-v10-4-022e96815380@oss.qualcomm.com> References: <20260105-kvmrprocv10-v10-0-022e96815380@oss.qualcomm.com> In-Reply-To: <20260105-kvmrprocv10-v10-0-022e96815380@oss.qualcomm.com> To: Bjorn Andersson , Mathieu Poirier , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Manivannan Sadhasivam , Konrad Dybcio Cc: linux-arm-msm@vger.kernel.org, linux-remoteproc@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Mukesh Ojha X-Mailer: b4 0.14-dev-f7c49 X-Developer-Signature: v=1; a=ed25519-sha256; t=1767619390; l=4036; i=mukesh.ojha@oss.qualcomm.com; s=20250708; h=from:subject:message-id; bh=HrLkG36I07Ib0XRgEzoPfMEgZMeQfHT6NhYwPB4Ll/Q=; b=YiRaLse+KM8syyQNGIDwZvKaM1DSMbpFOU4ROmDFa2yVE9Paj9VMYZI8oxQ03C2ZkNdgyI/X5 /oSxL26nZJfABAeJBF7CAAQZ1zSuYkLon7814XQ9qEfh70m07uk1eun X-Developer-Key: i=mukesh.ojha@oss.qualcomm.com; a=ed25519; pk=eX8dr/7d4HJz/HEXZIpe3c+Ukopa/wZmxH+5YV3gdNc= X-Authority-Analysis: v=2.4 cv=UJ/Q3Sfy c=1 sm=1 tr=0 ts=695bbb54 cx=c_pps a=WW5sKcV1LcKqjgzy2JUPuA==:117 a=ZePRamnt/+rB5gQjfz0u9A==:17 a=IkcTkHD0fZMA:10 a=vUbySO9Y5rIA:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=EUspDBNiAAAA:8 a=FtZ2CgB1kwCBZN0VdloA:9 a=QEXdDO2ut3YA:10 a=OpyuDcXvxspvyRM73sMx:22 X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwMTA1MDExNyBTYWx0ZWRfXzFVKhwy4n/sh oX/6KavjRGjdAYJFrflAIyhe4Yvq80SjNXbhwAgANv9kc5qkh6neH/aYwmerXFp8OuOU9lMf6S4 x2CPyMTwi9fv8FMOKsxZ33+pxsu6mxlp7vWucgskqdz8JXVy5fG/aVswEqYFo//Pslu7MgqSIlL 9kiraXIJvNq7VKggHBbBSJvpi0NjL8yMhzNtg29VrQ51odxEJiFzYZVpm/9njo7Hcp0819fAYhV 4GLEkM57mQZKFnZTnfrkYd6ZJ61HQkJXXW+NI3MnS9PoDr2yu81hBpztMSfG1WcPPgLeBa8RcuD lTTB+Zox9MmErh54DWC1e31oTHAuOllJraQ+tVqANFC7EIIskf/zDEJWOy6SwVpAkrZxr6HGA7k 6GtzlksZ/078jzXj8enfava1nHRjRIcOACSvKRCxiWNk/fk2kTgmJh/d+t4dsH6gRZecTRhy2ux 4GXQoIH2c2+99cUkhmQ== X-Proofpoint-ORIG-GUID: z39aqkHScICQ5rjSryveZMLAeeKFcaI8 X-Proofpoint-GUID: z39aqkHScICQ5rjSryveZMLAeeKFcaI8 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1121,Hydra:6.1.9,FMLib:17.12.100.49 definitions=2026-01-05_01,2025-12-31_01,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 suspectscore=0 adultscore=0 spamscore=0 bulkscore=0 phishscore=0 lowpriorityscore=0 clxscore=1015 priorityscore=1501 impostorscore=0 malwarescore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2512120000 definitions=main-2601050117 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 allocator helper function. Signed-off-by: Mukesh Ojha --- drivers/firmware/qcom/qcom_scm.c | 34 ++++++++++++++++++++++++++++++= ++++ include/linux/firmware/qcom/qcom_scm.h | 14 ++++++++++++++ 2 files changed, 48 insertions(+) diff --git a/drivers/firmware/qcom/qcom_scm.c b/drivers/firmware/qcom/qcom_= scm.c index 0a4d5d58c177..43a6187f4bd2 100644 --- a/drivers/firmware/qcom/qcom_scm.c +++ b/drivers/firmware/qcom/qcom_scm.c @@ -558,6 +558,40 @@ static void qcom_scm_set_download_mode(u32 dload_mode) dev_err(__scm->dev, "failed to set download mode: %d\n", ret); } =20 +/** + * devm_qcom_scm_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 + * + * Returns: The new PAS context, or ERR_PTR() on failure. + */ +struct qcom_scm_pas_context *devm_qcom_scm_pas_context_alloc(struct device= *dev, + u32 pas_id, + phys_addr_t mem_phys, + size_t mem_size) +{ + struct qcom_scm_pas_context *ctx; + + ctx =3D devm_kzalloc(dev, sizeof(*ctx), GFP_KERNEL); + if (!ctx) + return ERR_PTR(-ENOMEM); + + ctx->dev =3D dev; + ctx->pas_id =3D pas_id; + ctx->mem_phys =3D mem_phys; + ctx->mem_size =3D mem_size; + + return ctx; +} +EXPORT_SYMBOL_GPL(devm_qcom_scm_pas_context_alloc); + /** * qcom_scm_pas_init_image() - Initialize peripheral authentication service * state machine for a given peripheral, using the diff --git a/include/linux/firmware/qcom/qcom_scm.h b/include/linux/firmwar= e/qcom/qcom_scm.h index a13f703b16cd..5045f8fe876d 100644 --- a/include/linux/firmware/qcom/qcom_scm.h +++ b/include/linux/firmware/qcom/qcom_scm.h @@ -72,6 +72,20 @@ struct qcom_scm_pas_metadata { ssize_t size; }; =20 +struct qcom_scm_pas_context { + struct device *dev; + u32 pas_id; + phys_addr_t mem_phys; + size_t mem_size; + void *ptr; + dma_addr_t phys; + ssize_t size; +}; + +struct qcom_scm_pas_context *devm_qcom_scm_pas_context_alloc(struct device= *dev, + u32 pas_id, + phys_addr_t mem_phys, + size_t mem_size); int qcom_scm_pas_init_image(u32 pas_id, const void *metadata, size_t size, struct qcom_scm_pas_metadata *ctx); void qcom_scm_pas_metadata_release(struct qcom_scm_pas_metadata *ctx); --=20 2.50.1