From nobody Sat Nov 23 00:44:02 2024 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 8587E38DDB; Fri, 15 Nov 2024 01:15:45 +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=1731633347; cv=none; b=iE4PGDSRIJChUratiQrT59ybq2bP7IwAfzndkWvYoEcR0Et+7vq/es7d9fqbMsMupQZw4+pLJdcFSTJEiEgPj0mFRSznqEHKsNsg6RVpXaV7NvrtdW5hLq10i2iUdriTPJpQLignl87CglS25GJROEj95FbqYR26UQSRtBhRB2g= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731633347; c=relaxed/simple; bh=9W3+Mxq8pisvaEOw+mDosKueHlYiOr1qpwJWnbQn2Ts=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=Wkm+fIsgBafqfDx5sTSC4cDNm6WVsM1wwDUqkHdq6QjPJ9V5RhJYCGJ9JPZ/TE/cddQdn5SCBJ2FOuHsegMhLE21SZeIBySIpXhqN31wsMjkc+dHAXfjjv3l71LJzH1kjih8uHb3IidEvBwJcprPQWLenvqkqD1E5SoYyELDDJM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=quicinc.com; spf=pass smtp.mailfrom=quicinc.com; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b=NXKl3PLp; arc=none smtp.client-ip=205.220.168.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=quicinc.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=quicinc.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b="NXKl3PLp" Received: from pps.filterd (m0279862.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 4AEHHvj3013425; Fri, 15 Nov 2024 01:15:38 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=qcppdkim1; bh= 6S2BcaWCwxvKAi+L/sigecxhEMImoklMjwzbjkt5Fyo=; b=NXKl3PLpolO2IBCm u32q83rjwgOI60uVkBB6qYg3LVf/OUqOfyyqQVrVZObB4/hzoimGWdpnOme9vsrH l7SSmvQqea3rFKNn3Cf4NaA87oUSASGncB4gHMkNF+l7Pe3V/Y59f3bXQCJ8mLil xvxsdjw0U8YMHhyYjLJ1rQYWcM7ybqzNN49p1oaWKWkuVtcz8AnpoBkTR+GaE1Ys q6CxtVeg97Z49WWZ6uZIlc5594j6J21mtEBQ3voLAgc/CkvftfgDAsvHOT8EtXfY wyF6NYMc0za3jjnWkkldxa9MFLytnM80YHlgzA9ogxfvnozBPgon4G5zAq6ANFpR mSSX9g== Received: from nalasppmta05.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 42w7ekmej6-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 15 Nov 2024 01:15:37 +0000 (GMT) Received: from nalasex01a.na.qualcomm.com (nalasex01a.na.qualcomm.com [10.47.209.196]) by NALASPPMTA05.qualcomm.com (8.18.1.2/8.18.1.2) with ESMTPS id 4AF1Fb8f002104 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 15 Nov 2024 01:15:37 GMT Received: from hu-sibis-blr.qualcomm.com (10.80.80.8) by nalasex01a.na.qualcomm.com (10.47.209.196) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.9; Thu, 14 Nov 2024 17:15:33 -0800 From: Sibi Sankar To: , , , CC: , , , , , , Subject: [PATCH V5 1/2] firmware: arm_scmi: Add QCOM Generic Vendor Protocol documentation Date: Fri, 15 Nov 2024 06:45:14 +0530 Message-ID: <20241115011515.1313447-2-quic_sibis@quicinc.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241115011515.1313447-1-quic_sibis@quicinc.com> References: <20241115011515.1313447-1-quic_sibis@quicinc.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: nasanex01b.na.qualcomm.com (10.46.141.250) To nalasex01a.na.qualcomm.com (10.47.209.196) X-QCInternal: smtphost X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-ORIG-GUID: 1QCr6zS6BX_I-owLkbfYeLinjf3FLegQ X-Proofpoint-GUID: 1QCr6zS6BX_I-owLkbfYeLinjf3FLegQ X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1039,Hydra:6.0.680,FMLib:17.12.60.29 definitions=2024-09-06_09,2024-09-06_01,2024-09-02_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 mlxscore=0 impostorscore=0 phishscore=0 lowpriorityscore=0 suspectscore=0 clxscore=1015 bulkscore=0 malwarescore=0 adultscore=0 priorityscore=1501 mlxlogscore=999 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2409260000 definitions=main-2411150009 Content-Type: text/plain; charset="utf-8" Add QCOM System Control Management Interface (SCMI) Generic Vendor Extensions Protocol documentation. Signed-off-by: Sibi Sankar --- v4: * Update the protol attributes doc with more information. [Cristian] .../arm_scmi/vendors/qcom/qcom_generic.rst | 211 ++++++++++++++++++ 1 file changed, 211 insertions(+) create mode 100644 drivers/firmware/arm_scmi/vendors/qcom/qcom_generic.rst diff --git a/drivers/firmware/arm_scmi/vendors/qcom/qcom_generic.rst b/driv= ers/firmware/arm_scmi/vendors/qcom/qcom_generic.rst new file mode 100644 index 000000000000..141bc932e30f --- /dev/null +++ b/drivers/firmware/arm_scmi/vendors/qcom/qcom_generic.rst @@ -0,0 +1,211 @@ +.. SPDX-License-Identifier: GPL-2.0 +.. include:: + +=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D +QCOM System Control and Management Interface(SCMI) Vendor Protocols Extens= ion +=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D + +:Copyright: |copy| 2024, Qualcomm Innovation Center, Inc. All rights reser= ved. + +:Author: Sibi Sankar + +SCMI_GENERIC: System Control and Management Interface QCOM Generic Vendor = Protocol +=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D + +This protocol is intended as a generic way of exposing a number of Qualcomm +SoC specific features through a mixture of pre-determined algorithm string= and +param_id pairs hosted on the SCMI controller. It implements an interface c= ompliant +with the Arm SCMI Specification with additional vendor specific commands as +detailed below. + +Commands: +_________ + +PROTOCOL_VERSION +~~~~~~~~~~~~~~~~ + +message_id: 0x0 +protocol_id: 0x80 + ++---------------+---------------------------------------------------------= -----+ +|Return values = | ++---------------+---------------------------------------------------------= -----+ +|Name |Description = | ++---------------+---------------------------------------------------------= -----+ +|int32 status |See ARM SCMI Specification for status code definitions. = | ++---------------+---------------------------------------------------------= -----+ +|uint32 version |For this revision of the specification, this value must b= e | +| |0x10000. = | ++---------------+---------------------------------------------------------= -----+ + +PROTOCOL_ATTRIBUTES +~~~~~~~~~~~~~~~~~~~ + +message_id: 0x1 +protocol_id: 0x80 + ++---------------+---------------------------------------------------------= -----+ +|Return values = | ++------------------+------------------------------------------------------= -----+ +|Name |Description = | ++------------------+------------------------------------------------------= -----+ +|int32 status |See ARM SCMI Specification for status code definitions= . | ++------------------+------------------------------------------------------= -----+ +|uint32 attributes |Bits[31:16] Reserved, must be to 0. = | +| |Bits[15:8] Number of agents in the system = | +| |Bits[7:0] Number of vendor protocols in the system = | ++------------------+------------------------------------------------------= -----+ + +PROTOCOL_MESSAGE_ATTRIBUTES +~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +message_id: 0x2 +protocol_id: 0x80 + ++---------------+---------------------------------------------------------= -----+ +|Return values = | ++------------------+------------------------------------------------------= -----+ +|Name |Description = | ++------------------+------------------------------------------------------= -----+ +|int32 status |See ARM SCMI Specification for status code definitions= . | ++------------------+------------------------------------------------------= -----+ +|uint32 attributes |For all message id's the parameter has a value of 0. = | ++------------------+------------------------------------------------------= -----+ + +QCOM_SCMI_SET_PARAM +~~~~~~~~~~~~~~~~~~~ + +message_id: 0x10 +protocol_id: 0x80 + ++------------------+------------------------------------------------------= -----+ +|Parameters = | ++------------------+------------------------------------------------------= -----+ +|Name |Description = | ++------------------+------------------------------------------------------= -----+ +|uint32 ext_id |Reserved, must be zero. = | ++------------------+------------------------------------------------------= -----+ +|uint32 algo_low |Lower 32-bit value of the algorithm string. = | ++------------------+------------------------------------------------------= -----+ +|uint32 algo_high |Upper 32-bit value of the algorithm string. = | ++------------------+------------------------------------------------------= -----+ +|uint32 param_id |Serves as the token message id for the algorithm strin= g | +| |and is used to set various parameters supported by it.= | ++------------------+------------------------------------------------------= -----+ +|uint32 buf[] |Serves as the payload for the specified param_id and = | +| |algorithm string pair. = | ++------------------+------------------------------------------------------= -----+ +|Return values = | ++------------------+------------------------------------------------------= -----+ +|Name |Description = | ++------------------+------------------------------------------------------= -----+ +|int32 status |SUCCESS: if the param_id and buf[] is parsed successfu= lly | +| |by the chosen algorithm string. = | +| |NOT_SUPPORTED: if the algorithm string does not have a= ny | +| |matches. = | +| |INVALID_PARAMETERS: if the param_id and the buf[] pass= ed | +| |is rejected by the algorithm string. = | ++------------------+------------------------------------------------------= -----+ + +QCOM_SCMI_GET_PARAM +~~~~~~~~~~~~~~~~~~~ + +message_id: 0x11 +protocol_id: 0x80 + ++------------------+------------------------------------------------------= -----+ +|Parameters = | ++------------------+------------------------------------------------------= -----+ +|Name |Description = | ++------------------+------------------------------------------------------= -----+ +|uint32 ext_id |Reserved, must be zero. = | ++------------------+------------------------------------------------------= -----+ +|uint32 algo_low |Lower 32-bit value of the algorithm string. = | ++------------------+------------------------------------------------------= -----+ +|uint32 algo_high |Upper 32-bit value of the algorithm string. = | ++------------------+------------------------------------------------------= -----+ +|uint32 param_id |Serves as the token message id for the algorithm strin= g. | ++------------------+------------------------------------------------------= -----+ +|uint32 buf[] |Serves as the payload and store of value for the speci= fied | +| |param_id and algorithm string pair. = | ++------------------+------------------------------------------------------= -----+ +|Return values = | ++------------------+------------------------------------------------------= -----+ +|Name |Description = | ++------------------+------------------------------------------------------= -----+ +|int32 status |SUCCESS: if the param_id and buf[] is parsed successfu= lly | +| |by the chosen algorithm string and the result is copie= d | +| |into buf[]. = | +| |NOT_SUPPORTED: if the algorithm string does not have a= ny | +| |matches. = | +| |INVALID_PARAMETERS: if the param_id and the buf[] pass= ed | +| |is rejected by the algorithm string. = | ++------------------+------------------------------------------------------= -----+ + +QCOM_SCMI_START_ACTIVITY +~~~~~~~~~~~~~~~~~~~~~~~~ + +message_id: 0x12 +protocol_id: 0x80 + ++------------------+------------------------------------------------------= -----+ +|Parameters = | ++------------------+------------------------------------------------------= -----+ +|Name |Description = | ++------------------+------------------------------------------------------= -----+ +|uint32 ext_id |Reserved, must be zero. = | ++------------------+------------------------------------------------------= -----+ +|uint32 algo_low |Lower 32-bit value of the algorithm string. = | ++------------------+------------------------------------------------------= -----+ +|uint32 algo_high |Upper 32-bit value of the algorithm string. = | ++------------------+------------------------------------------------------= -----+ +|uint32 param_id |Serves as the token message id for the algorithm strin= g | +| |and is generally used to start the activity performed = by | +| |the algorithm string. = | ++------------------+------------------------------------------------------= -----+ +|uint32 buf[] |Serves as the payload for the specified param_id and = | +| |algorithm string pair. = | ++------------------+------------------------------------------------------= -----+ +|Return values = | ++------------------+------------------------------------------------------= -----+ +|Name |Description = | ++------------------+------------------------------------------------------= -----+ +|int32 status |SUCCESS: if the activity performed by the algorithm st= ring | +| |starts successfully. = | +| |NOT_SUPPORTED: if the algorithm string does not have a= ny. | +| |matches or if the activity is already running. = | ++------------------+------------------------------------------------------= -----+ + +QCOM_SCMI_STOP_ACTIVITY +~~~~~~~~~~~~~~~~~~~~~~~ + +message_id: 0x13 +protocol_id: 0x80 + ++------------------+------------------------------------------------------= -----+ +|Parameters = | ++------------------+------------------------------------------------------= -----+ +|Name |Description = | ++------------------+------------------------------------------------------= -----+ +|uint32 ext_id |Reserved, must be zero. = | ++------------------+------------------------------------------------------= -----+ +|uint32 algo_low |Lower 32-bit value of the algorithm string. = | ++------------------+------------------------------------------------------= -----+ +|uint32 algo_high |Upper 32-bit value of the algorithm string. = | ++------------------+------------------------------------------------------= -----+ +|uint32 param_id |Serves as the token message id for the algorithm strin= g | +| |and is generally used to stop the activity performed b= y | +| |the algorithm string. = | ++------------------+------------------------------------------------------= -----+ +|uint32 buf[] |Serves as the payload for the specified param_id and = | +| |algorithm string pair. = | ++------------------+------------------------------------------------------= -----+ +|Return values = | ++------------------+------------------------------------------------------= -----+ +|Name |Description = | ++------------------+------------------------------------------------------= -----+ +|int32 status |SUCCESS: if the activity performed by the algorithm st= ring | +| |stops successfully. = | +| |NOT_SUPPORTED: if the algorithm string does not have a= ny | +| |matches or if the activity isn't running. = | ++------------------+------------------------------------------------------= -----+ --=20 2.34.1 From nobody Sat Nov 23 00:44:02 2024 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 5BA0E13A88A; Fri, 15 Nov 2024 01:15:49 +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=1731633351; cv=none; b=Y7IknP63UNP51y4ZF83Stf+ex6yxV3EZ36GzWfcPfT7moGmb/W6iOEZf4nnByGpYx/xdq9UpxDZeh7RB1VxQFEChqb+iGND5K9Qx5RsGSlttayaQBmDNGpk5UidZqCgfkF+nzN2bWFo0ktxRDdguwdrwDL7clfhZM4RP6si4yrQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731633351; c=relaxed/simple; bh=2LF7NM83j9VDIN1dogfnDuobHKKvRNyBbh407AOlYHM=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=Imi1f9ZxbHoSSM5Vs+PGgXGJuUynODDNeC3Jv2+6Kf4bomT4bStfmiqSbrBjDThiNdGcy06blXiJmGYvLtGgebmlMNplw1FiZr4VXytuzbaoumIBDnNT6RWM+pQd5A0wp9vUK+Mb/zdZLrf2RQ0s6nqH9xpKOifY8rRGSmtAQmM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=quicinc.com; spf=pass smtp.mailfrom=quicinc.com; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b=mSHFceOy; arc=none smtp.client-ip=205.220.168.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=quicinc.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=quicinc.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b="mSHFceOy" Received: from pps.filterd (m0279867.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 4AEHHxnJ022104; Fri, 15 Nov 2024 01:15:42 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=qcppdkim1; bh= 96MgO3zE1oHyAS/1NoWggftC32/feb47kP20tAxRyLw=; b=mSHFceOyU4n0gL7B ShN6kiBjygyjOKjZrRHwraawPPUXeCYv48ROQPH85WW8z0kchjZ3Vf5FA63cfdQx YQmYwMmdVhKkZb3iXz+r/9ueSrDgp5Ma3b3uFUeVOsGRuOQpOrS1LCbbHrvUyDO3 jVJVBCfGDlUFo64D4WUFudS7gILU8E406EiaGdnhJbOGJled9EBt6GDmky4a6GX4 WN+lITHAiCprwAVFIUcwFsQ01Fnrp/kwp1U3WXoPcrd9HX51hn/pbJqzByWgAWCn lAJ5YYrrCTG6/t1D3Il8V8ifDVEsNYGp4WYYovkzWTNjrsxHNYL51T5pujlzXKVL Tyz1NQ== Received: from nalasppmta03.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 42vsg56qf6-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 15 Nov 2024 01:15:41 +0000 (GMT) Received: from nalasex01a.na.qualcomm.com (nalasex01a.na.qualcomm.com [10.47.209.196]) by NALASPPMTA03.qualcomm.com (8.18.1.2/8.18.1.2) with ESMTPS id 4AF1FfeC009033 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 15 Nov 2024 01:15:41 GMT Received: from hu-sibis-blr.qualcomm.com (10.80.80.8) by nalasex01a.na.qualcomm.com (10.47.209.196) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.9; Thu, 14 Nov 2024 17:15:37 -0800 From: Sibi Sankar To: , , , CC: , , , , , , , Amir Vajid Subject: [PATCH V5 2/2] firmware: arm_scmi: vendors: Add QCOM SCMI Generic Extensions Date: Fri, 15 Nov 2024 06:45:15 +0530 Message-ID: <20241115011515.1313447-3-quic_sibis@quicinc.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241115011515.1313447-1-quic_sibis@quicinc.com> References: <20241115011515.1313447-1-quic_sibis@quicinc.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: nasanex01b.na.qualcomm.com (10.46.141.250) To nalasex01a.na.qualcomm.com (10.47.209.196) X-QCInternal: smtphost X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-GUID: Oz3U6D54__IsiiTY_ukFRP7zEVvWbH05 X-Proofpoint-ORIG-GUID: Oz3U6D54__IsiiTY_ukFRP7zEVvWbH05 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1039,Hydra:6.0.680,FMLib:17.12.60.29 definitions=2024-09-06_09,2024-09-06_01,2024-09-02_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 clxscore=1015 priorityscore=1501 phishscore=0 malwarescore=0 lowpriorityscore=0 mlxscore=0 mlxlogscore=999 impostorscore=0 bulkscore=0 adultscore=0 suspectscore=0 spamscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2409260000 definitions=main-2411150009 Content-Type: text/plain; charset="utf-8" The QCOM SCMI Generic Extensions Protocol provides a generic way of exposing a number of Qualcomm SoC specific features (like memory bus scaling) through a mixture of pre-determined algorithm strings and param_id pairs hosted on the SCMI controller. Co-developed-by: Shivnandan Kumar Signed-off-by: Shivnandan Kumar Co-developed-by: Ramakrishna Gottimukkula Signed-off-by: Ramakrishna Gottimukkula Co-developed-by: Amir Vajid Signed-off-by: Amir Vajid Signed-off-by: Sibi Sankar Reviewed-by: Cristian Marussi --- v4: * Splitting the series into vendor protocol and memlat client. Also the move the memlat client implementation back to RFC due to multiple opens. * Use common xfer helper to avoid code duplication [Dmitry] * Update enum documentation without duplicate enum info [Dmitry] drivers/firmware/arm_scmi/Kconfig | 1 + drivers/firmware/arm_scmi/Makefile | 1 + .../firmware/arm_scmi/vendors/qcom/Kconfig | 15 ++ .../firmware/arm_scmi/vendors/qcom/Makefile | 2 + .../arm_scmi/vendors/qcom/qcom-generic-ext.c | 139 ++++++++++++++++++ include/linux/scmi_qcom_protocol.h | 37 +++++ 6 files changed, 195 insertions(+) create mode 100644 drivers/firmware/arm_scmi/vendors/qcom/Kconfig create mode 100644 drivers/firmware/arm_scmi/vendors/qcom/Makefile create mode 100644 drivers/firmware/arm_scmi/vendors/qcom/qcom-generic-ext= .c create mode 100644 include/linux/scmi_qcom_protocol.h diff --git a/drivers/firmware/arm_scmi/Kconfig b/drivers/firmware/arm_scmi/= Kconfig index dabd874641d0..73128442d97b 100644 --- a/drivers/firmware/arm_scmi/Kconfig +++ b/drivers/firmware/arm_scmi/Kconfig @@ -71,6 +71,7 @@ config ARM_SCMI_DEBUG_COUNTERS =20 source "drivers/firmware/arm_scmi/transports/Kconfig" source "drivers/firmware/arm_scmi/vendors/imx/Kconfig" +source "drivers/firmware/arm_scmi/vendors/qcom/Kconfig" =20 endif #ARM_SCMI_PROTOCOL =20 diff --git a/drivers/firmware/arm_scmi/Makefile b/drivers/firmware/arm_scmi= /Makefile index 9ac81adff567..58cf4d656cbb 100644 --- a/drivers/firmware/arm_scmi/Makefile +++ b/drivers/firmware/arm_scmi/Makefile @@ -12,6 +12,7 @@ scmi-module-objs :=3D $(scmi-driver-y) $(scmi-protocols-y= ) $(scmi-transport-y) =20 obj-$(CONFIG_ARM_SCMI_PROTOCOL) +=3D transports/ obj-$(CONFIG_ARM_SCMI_PROTOCOL) +=3D vendors/imx/ +obj-$(CONFIG_ARM_SCMI_PROTOCOL) +=3D vendors/qcom/ =20 obj-$(CONFIG_ARM_SCMI_PROTOCOL) +=3D scmi-core.o obj-$(CONFIG_ARM_SCMI_PROTOCOL) +=3D scmi-module.o diff --git a/drivers/firmware/arm_scmi/vendors/qcom/Kconfig b/drivers/firmw= are/arm_scmi/vendors/qcom/Kconfig new file mode 100644 index 000000000000..5dd9e8a6b75f --- /dev/null +++ b/drivers/firmware/arm_scmi/vendors/qcom/Kconfig @@ -0,0 +1,15 @@ +# SPDX-License-Identifier: GPL-2.0-only +menu "ARM SCMI QCOM Vendor Protocols" + +config QCOM_SCMI_GENERIC_EXT + tristate "Qualcomm Technologies, Inc. Qcom SCMI vendor Protocol" + depends on ARM_SCMI_PROTOCOL || COMPILE_TEST + help + The QCOM SCMI vendor protocol provides a generic way of exposing + a number of Qualcomm SoC specific features (like memory bus scaling) + through a mixture of pre-determined algorithm strings and param_id + pairs hosted on the SCMI controller. + + This driver defines/documents the message ID's used for this + communication and also exposes the operations used by the clients. +endmenu diff --git a/drivers/firmware/arm_scmi/vendors/qcom/Makefile b/drivers/firm= ware/arm_scmi/vendors/qcom/Makefile new file mode 100644 index 000000000000..6b98fabbebb8 --- /dev/null +++ b/drivers/firmware/arm_scmi/vendors/qcom/Makefile @@ -0,0 +1,2 @@ +# SPDX-License-Identifier: GPL-2.0-only +obj-$(CONFIG_QCOM_SCMI_GENERIC_EXT) +=3D qcom-generic-ext.o diff --git a/drivers/firmware/arm_scmi/vendors/qcom/qcom-generic-ext.c b/dr= ivers/firmware/arm_scmi/vendors/qcom/qcom-generic-ext.c new file mode 100644 index 000000000000..1b209093d275 --- /dev/null +++ b/drivers/firmware/arm_scmi/vendors/qcom/qcom-generic-ext.c @@ -0,0 +1,139 @@ +// SPDX-License-Identifier: GPL-2.0-only +/* + * Copyright (c) 2024, Qualcomm Innovation Center, Inc. All rights reserve= d. + */ + +#include + +#include "../../common.h" + +/** + * enum qcom_generic_ext_protocol_cmd - vendor specific commands supported= by SCMI Qualcomm + * generic vendor protocol. + * + * This protocol is intended as a generic way of exposing a number of Qual= comm SoC + * specific features through a mixture of pre-determined algorithm string = and param_id + * pairs hosted on the SCMI controller. + * + * The QCOM SCMI Vendor Protocol has the protocol id as 0x80 and vendor id= set to + * Qualcomm and the implementation version set to 0x20000. The PROTOCOL_VE= RSION command + * returns version 1.0. + * + * @QCOM_SCMI_SET_PARAM: is used to set the parameter of a specific algo_s= tr hosted on + * QCOM SCMI Vendor Protocol. The tx len depends on the algo_str used. + * @QCOM_SCMI_GET_PARAM: is used to get parameter information of a specifi= c algo_str + * hosted on QCOM SCMI Vendor Protocol. The tx and rx len depends + * on the algo_str used. + * @QCOM_SCMI_START_ACTIVITY: is used to start the activity performed by t= he algo_str. + * @QCOM_SCMI_STOP_ACTIVITY: is used to stop a pre-existing activity perfo= rmed by the algo_str. + */ +enum qcom_generic_ext_protocol_cmd { + QCOM_SCMI_SET_PARAM =3D 0x10, + QCOM_SCMI_GET_PARAM =3D 0x11, + QCOM_SCMI_START_ACTIVITY =3D 0x12, + QCOM_SCMI_STOP_ACTIVITY =3D 0x13, +}; + +/** + * struct qcom_scmi_msg - represents the various parameters to be populated + * for using the QCOM SCMI Vendor Protocol + * + * @ext_id: reserved, must be zero + * @algo_low: lower 32 bits of the algo_str + * @algo_high: upper 32 bits of the algo_str + * @param_id: serves as token message id to the specific algo_str + * @buf: serves as the payload to the specified param_id and algo_str pair + */ +struct qcom_scmi_msg { + __le32 ext_id; + __le32 algo_low; + __le32 algo_high; + __le32 param_id; + __le32 buf[]; +}; + +static int qcom_scmi_common_xfer(const struct scmi_protocol_handle *ph, + enum qcom_generic_ext_protocol_cmd cmd_id, void *buf, + size_t buf_len, u64 algo_str, u32 param_id, size_t rx_size) +{ + struct scmi_xfer *t; + struct qcom_scmi_msg *msg; + int ret; + + ret =3D ph->xops->xfer_get_init(ph, cmd_id, buf_len + sizeof(*msg), rx_si= ze, &t); + if (ret) + return ret; + + msg =3D t->tx.buf; + msg->algo_low =3D cpu_to_le32(lower_32_bits(algo_str)); + msg->algo_high =3D cpu_to_le32(upper_32_bits(algo_str)); + msg->param_id =3D cpu_to_le32(param_id); + memcpy(msg->buf, buf, buf_len); + + ret =3D ph->xops->do_xfer(ph, t); + if (rx_size) + memcpy(buf, t->rx.buf, t->rx.len); + ph->xops->xfer_put(ph, t); + + return ret; +} + +static int qcom_scmi_set_param(const struct scmi_protocol_handle *ph, void= *buf, size_t buf_len, + u64 algo_str, u32 param_id) +{ + return qcom_scmi_common_xfer(ph, QCOM_SCMI_SET_PARAM, buf, buf_len, algo_= str, + param_id, 0); +} + +static int qcom_scmi_get_param(const struct scmi_protocol_handle *ph, void= *buf, size_t buf_len, + u64 algo_str, u32 param_id, size_t rx_size) +{ + return qcom_scmi_common_xfer(ph, QCOM_SCMI_GET_PARAM, buf, buf_len, algo_= str, + param_id, rx_size); +} + +static int qcom_scmi_start_activity(const struct scmi_protocol_handle *ph,= void *buf, + size_t buf_len, u64 algo_str, u32 param_id) +{ + return qcom_scmi_common_xfer(ph, QCOM_SCMI_START_ACTIVITY, buf, buf_len, = algo_str, + param_id, 0); +} + +static int qcom_scmi_stop_activity(const struct scmi_protocol_handle *ph, = void *buf, + size_t buf_len, u64 algo_str, u32 param_id) +{ + return qcom_scmi_common_xfer(ph, QCOM_SCMI_STOP_ACTIVITY, buf, buf_len, a= lgo_str, + param_id, 0); +} + +static struct qcom_generic_ext_ops qcom_proto_ops =3D { + .set_param =3D qcom_scmi_set_param, + .get_param =3D qcom_scmi_get_param, + .start_activity =3D qcom_scmi_start_activity, + .stop_activity =3D qcom_scmi_stop_activity, +}; + +static int qcom_generic_ext_protocol_init(const struct scmi_protocol_handl= e *ph) +{ + u32 version; + + ph->xops->version_get(ph, &version); + + dev_dbg(ph->dev, "QCOM Generic Vendor Version %d.%d\n", + PROTOCOL_REV_MAJOR(version), PROTOCOL_REV_MINOR(version)); + + return 0; +} + +static const struct scmi_protocol qcom_generic_ext =3D { + .id =3D SCMI_PROTOCOL_QCOM_GENERIC, + .owner =3D THIS_MODULE, + .instance_init =3D &qcom_generic_ext_protocol_init, + .ops =3D &qcom_proto_ops, + .vendor_id =3D "Qualcomm", + .impl_ver =3D 0x20000, +}; +module_scmi_protocol(qcom_generic_ext); + +MODULE_DESCRIPTION("QCOM SCMI Generic Vendor protocol"); +MODULE_LICENSE("GPL"); diff --git a/include/linux/scmi_qcom_protocol.h b/include/linux/scmi_qcom_p= rotocol.h new file mode 100644 index 000000000000..465b2522ca29 --- /dev/null +++ b/include/linux/scmi_qcom_protocol.h @@ -0,0 +1,37 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ +/* + * SCMI Message Protocol driver QCOM extension header + * + * Copyright (c) 2024, Qualcomm Innovation Center, Inc. All rights reserve= d. + */ + +#ifndef _LINUX_SCMI_QCOM_PROTOCOL_H +#define _LINUX_SCMI_QCOM_PROTOCOL_H + +#include + +#define SCMI_PROTOCOL_QCOM_GENERIC 0x80 + +struct scmi_protocol_handle; + +/** + * struct qcom_generic_ext_ops - represents the various operations provided + * by QCOM Generic Vendor Protocol + * + * @set_param: set parameter specified by param_id and algo_str pair. + * @get_param: retrieve parameter specified by param_id and algo_str pair. + * @start_activity: initiate a specific activity defined by algo_str. + * @stop_activity: halt previously initiated activity defined by algo_str. + */ +struct qcom_generic_ext_ops { + int (*set_param)(const struct scmi_protocol_handle *ph, void *buf, size_t= buf_len, + u64 algo_str, u32 param_id); + int (*get_param)(const struct scmi_protocol_handle *ph, void *buf, size_t= buf_len, + u64 algo_str, u32 param_id, size_t rx_size); + int (*start_activity)(const struct scmi_protocol_handle *ph, void *buf, s= ize_t buf_len, + u64 algo_str, u32 param_id); + int (*stop_activity)(const struct scmi_protocol_handle *ph, void *buf, si= ze_t buf_len, + u64 algo_str, u32 param_id); +}; + +#endif /* _LINUX_SCMI_QCOM_PROTOCOL_H */ --=20 2.34.1