From nobody Fri Dec 19 22:07:52 2025 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 355C3C77B61 for ; Sun, 9 Apr 2023 18:20:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229632AbjDISUG (ORCPT ); Sun, 9 Apr 2023 14:20:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56448 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229605AbjDISUB (ORCPT ); Sun, 9 Apr 2023 14:20:01 -0400 Received: from mx0a-0031df01.pphosted.com (mx0a-0031df01.pphosted.com [205.220.168.131]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 379962D6B; Sun, 9 Apr 2023 11:20:00 -0700 (PDT) Received: from pps.filterd (m0279865.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 339IJkPL023087; Sun, 9 Apr 2023 18:19:46 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-type; s=qcppdkim1; bh=tCLFfzbS4CdkXJ/5Rv9z076f2AbyuOOgsJ3/fzWAFiI=; b=Xkd7iPspI3bXVVWhlWGZyghPYNfjjYNqTsE8TlGrN3U6TQT+Gy6gziBEI9HuUyO9V/9Z 9WCNJKdgbNybqiC3AclXM+yfmDQpEuK6MbAPTIvDKl58YZxzrgMhZN9gh1BZMj3YOw3P 4SvKacfVsnZd9g52VPMyuzI/XH1fv1l2IZ1mc3xGulj7+EaZAydtbaRYXG4ZW3AFoXXU I4a/GBdY9pZDAT4ATefmWNsNiw7DaxDytNjsTSRjNrW4/IsafmELIvYagpBJkIjPGV0R 3jdvKzo7li4Z3aobwC7k68sEXo8jQHaQViG0Txy3HCOB4pcrqj5Fx8JOm2GaLlG9lXbb Eg== Received: from nalasppmta02.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3pty82spmk-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Sun, 09 Apr 2023 18:19:45 +0000 Received: from nalasex01c.na.qualcomm.com (nalasex01c.na.qualcomm.com [10.47.97.35]) by NALASPPMTA02.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTPS id 339IJjAA014279 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Sun, 9 Apr 2023 18:19:45 GMT Received: from car-linux11.qualcomm.com (10.80.80.8) by nalasex01c.na.qualcomm.com (10.47.97.35) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.42; Sun, 9 Apr 2023 11:19:44 -0700 From: Nikunj Kela To: CC: , , , , , , Nikunj Kela Subject: [PATCH 1/2] dt-bindings: firmware: arm,scmi: support parameter passing in smc/hvc Date: Sun, 9 Apr 2023 11:19:17 -0700 Message-ID: <20230409181918.29270-2-quic_nkela@quicinc.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20230409181918.29270-1-quic_nkela@quicinc.com> References: <20230409181918.29270-1-quic_nkela@quicinc.com> MIME-Version: 1.0 X-Originating-IP: [10.80.80.8] X-ClientProxiedBy: nasanex01b.na.qualcomm.com (10.46.141.250) To nalasex01c.na.qualcomm.com (10.47.97.35) X-QCInternal: smtphost X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-ORIG-GUID: G79in4T4NDaTcPXFQ9JWV-HSBSD8Z7-Q X-Proofpoint-GUID: G79in4T4NDaTcPXFQ9JWV-HSBSD8Z7-Q X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.942,Hydra:6.0.573,FMLib:17.11.170.22 definitions=2023-04-09_14,2023-04-06_03,2023-02-09_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 mlxscore=0 priorityscore=1501 bulkscore=0 impostorscore=0 adultscore=0 phishscore=0 malwarescore=0 spamscore=0 suspectscore=0 clxscore=1015 mlxlogscore=999 lowpriorityscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2303200000 definitions=main-2304090167 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Currently, smc/hvc calls are made with smc-id only. The parameters are all set to zeros. This patch defines two optional device tree bindings, that can be used to pass parameters in smc/hvc calls. This is useful when multiple scmi instances are used with common smc-id. Signed-off-by: Nikunj Kela Reported-by: kernel test robot --- .../devicetree/bindings/firmware/arm,scmi.yaml | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/Documentation/devicetree/bindings/firmware/arm,scmi.yaml b/Doc= umentation/devicetree/bindings/firmware/arm,scmi.yaml index 5824c43e9893..08c331a79b80 100644 --- a/Documentation/devicetree/bindings/firmware/arm,scmi.yaml +++ b/Documentation/devicetree/bindings/firmware/arm,scmi.yaml @@ -115,6 +115,22 @@ properties: description: SMC id required when using smc or hvc transports =20 + arm,smc32-params: + $ref: /schemas/types.yaml#/definitions/uint32-array + description: + An optional parameter list passed in smc32 or hvc32 calls + default: 0 + minItems: 1 + maxItems: 6 + + arm,smc64-params: + $ref: /schemas/types.yaml#/definitions/uint64-array + description: + An optional parameter list passed in smc64 or hvc64 calls + default: 0 + minItems: 1 + maxItems: 6 + linaro,optee-channel-id: $ref: /schemas/types.yaml#/definitions/uint32 description: --=20 2.17.1 From nobody Fri Dec 19 22:07:52 2025 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id DF8A3C77B6E for ; Sun, 9 Apr 2023 18:20:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229615AbjDISUD (ORCPT ); Sun, 9 Apr 2023 14:20:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56438 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229573AbjDISUA (ORCPT ); Sun, 9 Apr 2023 14:20:00 -0400 Received: from mx0b-0031df01.pphosted.com (mx0b-0031df01.pphosted.com [205.220.180.131]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 07D502D70; Sun, 9 Apr 2023 11:19:58 -0700 (PDT) Received: from pps.filterd (m0279870.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 339IJoGl013399; Sun, 9 Apr 2023 18:19:50 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-type; s=qcppdkim1; bh=AH6JycWFfTa0H9UydaGSCHS5yCEanwthhgNDmq0/Tto=; b=muEmNQtCuOuiHAwTyxIcWZOhclyF71lyY+z2hbUVpSF7twHeHSxPR68ueUerLmRlf6vl rytmHFKSwPD7OdIdQW4DHbkIVfLs9pwfpPesUog44U8o2dqhxF72pBV7YnoE5X4Yldkl azfYrF7QTgTgpkjjhxqqryHx4sonLMKbfRZYDk3/8/IKPrP3iHJM7FYxEB3uh4w+ktE6 3+1JfbJnHnx+p/JlscnItLfjeFfUg03B6E+1tsnVmEsyk3WCfD4y80G6d4OH3DfaEi69 cJl7TBEvrWJaoqXDGkpeTnTSDjsZohH2ILVLJ4z1/YQo7zL6cD9u1wm41DNkYk1rW/YX kA== Received: from nalasppmta03.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3pu0c31n9j-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Sun, 09 Apr 2023 18:19:49 +0000 Received: from nalasex01c.na.qualcomm.com (nalasex01c.na.qualcomm.com [10.47.97.35]) by NALASPPMTA03.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTPS id 339IJmcE007268 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Sun, 9 Apr 2023 18:19:48 GMT Received: from car-linux11.qualcomm.com (10.80.80.8) by nalasex01c.na.qualcomm.com (10.47.97.35) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.42; Sun, 9 Apr 2023 11:19:47 -0700 From: Nikunj Kela To: CC: , , , , , , Nikunj Kela Subject: [PATCH 2/2] firmware: arm_scmi: Augment SMC/HVC to allow optional parameters Date: Sun, 9 Apr 2023 11:19:18 -0700 Message-ID: <20230409181918.29270-3-quic_nkela@quicinc.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20230409181918.29270-1-quic_nkela@quicinc.com> References: <20230409181918.29270-1-quic_nkela@quicinc.com> MIME-Version: 1.0 X-Originating-IP: [10.80.80.8] X-ClientProxiedBy: nasanex01b.na.qualcomm.com (10.46.141.250) To nalasex01c.na.qualcomm.com (10.47.97.35) X-QCInternal: smtphost X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-GUID: YUhtf_wvWNzYzLEuId7HEoLyyz7E5_e7 X-Proofpoint-ORIG-GUID: YUhtf_wvWNzYzLEuId7HEoLyyz7E5_e7 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.942,Hydra:6.0.573,FMLib:17.11.170.22 definitions=2023-04-09_13,2023-04-06_03,2023-02-09_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 impostorscore=0 priorityscore=1501 bulkscore=0 lowpriorityscore=0 phishscore=0 mlxscore=0 suspectscore=0 clxscore=1015 spamscore=0 malwarescore=0 adultscore=0 mlxlogscore=999 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2303200000 definitions=main-2304090167 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" This patch add support for passing parameters to smc/hvc calls. This patch is useful when multiple scmi instances are using same smc-id and firmware needs to distiguish among the instances. Signed-off-by: Nikunj Kela Reported-by: kernel test robot --- drivers/firmware/arm_scmi/smc.c | 66 ++++++++++++++++++++++++++++++++- 1 file changed, 65 insertions(+), 1 deletion(-) diff --git a/drivers/firmware/arm_scmi/smc.c b/drivers/firmware/arm_scmi/sm= c.c index 93272e4bbd12..39582d1e2c9f 100644 --- a/drivers/firmware/arm_scmi/smc.c +++ b/drivers/firmware/arm_scmi/smc.c @@ -20,6 +20,16 @@ =20 #include "common.h" =20 +#define MAX_PARAM_COUNT 6 + +/** + * scmi_smc_param_t - parameter type for SCMI smc/hvc call + */ +typedef union { + u64 x; + u32 w; +} scmi_smc_param_t; + /** * struct scmi_smc - Structure representing a SCMI smc transport * @@ -30,6 +40,8 @@ * @inflight: Atomic flag to protect access to Tx/Rx shared memory area. * Used when operating in atomic mode. * @func_id: smc/hvc call function id + * @is_smc64: A flag, indicating smc64 calling convention. + * @params: Optional, smc/hvc call parameters. */ =20 struct scmi_smc { @@ -40,8 +52,51 @@ struct scmi_smc { #define INFLIGHT_NONE MSG_TOKEN_MAX atomic_t inflight; u32 func_id; + bool is_smc64; + scmi_smc_param_t params[MAX_PARAM_COUNT]; }; =20 +static void populate_smc_params(struct device *dev, struct scmi_smc *scmi_= info) +{ + struct device_node *np =3D dev->of_node; + u64 params64[MAX_PARAM_COUNT] =3D { 0 }; + u32 params32[MAX_PARAM_COUNT] =3D { 0 }; + int i, count; + + if (scmi_info->is_smc64) { + count =3D of_property_read_variable_u64_array(np, + "arm,smc64-params", + ¶ms64[0], 1, + MAX_PARAM_COUNT); + if (count =3D=3D -EINVAL) /* if property is not defined */ + return; + + if (count > 0) /* populate the parameters */ + for (i =3D 0; i < count; i++) + scmi_info->params[i].x =3D params64[i]; + else + goto param_err; + } else { + count =3D of_property_read_variable_u32_array(np, + "arm,smc32-params", + ¶ms32[0], 1, + MAX_PARAM_COUNT); + if (count =3D=3D -EINVAL) /* if property is not defined */ + return; + + if (count > 0) /* populate the parameters */ + for (i =3D 0; i < count; i++) + scmi_info->params[i].w =3D params32[i]; + else + goto param_err; + } + + return; + +param_err: + dev_warn(dev, "failed to read smc/hvc call parameters\n"); +} + static irqreturn_t smc_msg_done_isr(int irq, void *data) { struct scmi_smc *scmi_info =3D data; @@ -156,6 +211,8 @@ static int smc_chan_setup(struct scmi_chan_info *cinfo,= struct device *dev, } =20 scmi_info->func_id =3D func_id; + scmi_info->is_smc64 =3D ARM_SMCCC_IS_64(func_id); + populate_smc_params(dev, scmi_info); scmi_info->cinfo =3D cinfo; smc_channel_lock_init(scmi_info); cinfo->transport_info =3D scmi_info; @@ -179,6 +236,7 @@ static int smc_send_message(struct scmi_chan_info *cinf= o, { struct scmi_smc *scmi_info =3D cinfo->transport_info; struct arm_smccc_res res; + scmi_smc_param_t *p =3D scmi_info->params; =20 /* * Channel will be released only once response has been @@ -188,7 +246,13 @@ static int smc_send_message(struct scmi_chan_info *cin= fo, =20 shmem_tx_prepare(scmi_info->shmem, xfer, cinfo); =20 - arm_smccc_1_1_invoke(scmi_info->func_id, 0, 0, 0, 0, 0, 0, 0, &res); + if (scmi_info->is_smc64) + arm_smccc_1_1_invoke(scmi_info->func_id, p[0].x, p[1].x, p[2].x, + p[3].x, p[4].x, p[5].x, 0, &res); + else + arm_smccc_1_1_invoke(scmi_info->func_id, p[0].w, p[1].w, p[2].w, + p[3].w, p[4].w, p[5].w, 0, &res); + =20 /* Only SMCCC_RET_NOT_SUPPORTED is valid error code */ if (res.a0) { --=20 2.17.1