From patchwork Tue Apr 18 18:56:58 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nikunj Kela X-Patchwork-Id: 13216070 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 89EB4C77B75 for ; Tue, 18 Apr 2023 18:58:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:CC:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=pRWT8ZZ02AmMLtIMAV9EejZhQe4YpGx1cB7Yi0w9K5I=; b=43b6tIXnDG6ADp IF7yFL45dT2KLtAcinfkSu++GWY8LKwaZEF2uDbdgV3/nuCz0tyE60BrJYqUnZ9gKl2iUCS5mNtb1 hZ9egu5qpKniQK3mq8ygb3EWxwYHU+0j7g49Hdi6oK+gFGd0drS9YC2u+fPJjX7/i+doguVuhKIqp CXc19FGVS4Gzwc7C2UCLcK+PKWs9u8Ianti69aG2L6ppnmy6fJFy7QX5hyxl/7LRLMIdD4T50uWhF ya3LMrvQZTmrXBvR79Op5io+zmz/BxznZ2+gk3jT+u0KRv3FJONU4V2wbIkUt52Mh+lUr6xkdY7tY 74kh2ZBc2rIr0nvxTXBg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1poqWE-00388K-0R; Tue, 18 Apr 2023 18:57:34 +0000 Received: from mx0a-0031df01.pphosted.com ([205.220.168.131]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1poqWB-00387H-0a for linux-arm-kernel@lists.infradead.org; Tue, 18 Apr 2023 18:57:32 +0000 Received: from pps.filterd (m0279862.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 33I6rt33003793; Tue, 18 Apr 2023 18:57:24 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=tDG6E9f8cBUS0AgfMe8wEE59vV+JqBijFjadDrGU6/0=; b=IQWaGSG9NhhWpnbmGl4G/CtiVpLDpCAsUfr6jPKmURuFjsce07UOfUIem1ntUhgHNL2Q wmXNefpLjsfAyOxz3MnoFG7GOZTmwwb/4/ib9uVkw602cAKTJy8T4XYQxuqKbW/tlIMF 4IO/Tk2du+ly3852QHp4p5IPe8m0KPbaDWR2WsBCqd94nZnbLXFhxZfWsAi7GLl/sSX5 U9vBx3gRM7FunnuOv673fPmBrp/HOxJIbEI90n/KNjUwCvgxa8++vvDfx/BdROWDeDeR E9F+0DH8w1o+Jmr9fj6tmwgUAfRvnC/GPBja062yWXVf8oZQIkSnXIV893JGrL4uKUZ7 EQ== Received: from nalasppmta03.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3q1nf8hy6g-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 18 Apr 2023 18:57:23 +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 33IIvNon021503 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 18 Apr 2023 18:57:23 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; Tue, 18 Apr 2023 11:57:22 -0700 From: Nikunj Kela To: CC: , , , , , , Nikunj Kela Subject: [PATCH v4 1/2] dt-bindings: firmware: arm,scmi: support for parameter in smc/hvc call Date: Tue, 18 Apr 2023 11:56:58 -0700 Message-ID: <20230418185659.29745-2-quic_nkela@quicinc.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20230418185659.29745-1-quic_nkela@quicinc.com> References: <20230409181918.29270-1-quic_nkela@quicinc.com> <20230418185659.29745-1-quic_nkela@quicinc.com> MIME-Version: 1.0 X-Originating-IP: [10.80.80.8] X-ClientProxiedBy: nasanex01a.na.qualcomm.com (10.52.223.231) 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: UuPgZpqM38Yp7nPHdPfcKoMUX-62DHdt X-Proofpoint-ORIG-GUID: UuPgZpqM38Yp7nPHdPfcKoMUX-62DHdt 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-18_13,2023-04-18_01,2023-02-09_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 clxscore=1015 impostorscore=0 lowpriorityscore=0 phishscore=0 malwarescore=0 suspectscore=0 priorityscore=1501 bulkscore=0 mlxlogscore=999 adultscore=0 mlxscore=0 spamscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2303200000 definitions=main-2304180155 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230418_115731_242884_24604E03 X-CRM114-Status: GOOD ( 15.61 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Currently, smc/hvc calls are made with smc-id only. The parameters are all set to zeros. This patch defines a new compatible string that can be used to pass shmem address(4KB-page, offset) as two parameters in SMC/HVC doorbell. This is useful when multiple scmi instances are used with common smc-id. Signed-off-by: Nikunj Kela Reviewed-by: Rob Herring --- Documentation/devicetree/bindings/firmware/arm,scmi.yaml | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/Documentation/devicetree/bindings/firmware/arm,scmi.yaml b/Documentation/devicetree/bindings/firmware/arm,scmi.yaml index 5824c43e9893..ad776911f990 100644 --- a/Documentation/devicetree/bindings/firmware/arm,scmi.yaml +++ b/Documentation/devicetree/bindings/firmware/arm,scmi.yaml @@ -34,6 +34,10 @@ properties: - description: SCMI compliant firmware with ARM SMC/HVC transport items: - const: arm,scmi-smc + - description: SCMI compliant firmware with ARM SMC/HVC transport + with shmem address(4KB-page, offset) as parameters + items: + - const: arm,scmi-smc-param - description: SCMI compliant firmware with SCMI Virtio transport. The virtio transport only supports a single device. items: @@ -299,7 +303,9 @@ else: properties: compatible: contains: - const: arm,scmi-smc + enum: + - arm,scmi-smc + - arm,scmi-smc-param then: required: - arm,smc-id From patchwork Tue Apr 18 18:56:59 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nikunj Kela X-Patchwork-Id: 13216072 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 78AD2C77B75 for ; Tue, 18 Apr 2023 18:58:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:CC:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=CACK+ekon34XTw+01FOee8MeGgUaIkQjB1iUqAYsd08=; b=ygQWU3kvRvmUj+ ClIc1YwV2OZN7zqClGgxvUgP7b4Tw0X2VHf5k8dKkkL/uO+GUn6Cg4C05zbl4SFGsF8jXlNRuoamR YciV9yFCsLiaI7a6o+Y5+IC8KAOTxHcoJap+vvWjTsvQl0Xc7TAFYvDP4v4/MZCbXJ6osRpNDMzOI GQ0G51ycXMWbwWFn/04ZQ2w1Wvf4HVqwKp6R/mFS43PdJ46rz833gNPxkIc7y9TDz0SKE9wAyUegI SpKES+vyPoxH1oRWzy3TfYbgCY7U1CCZo2gZ3OxnEmyHZqpGQy+iTlaWz7IzO4SE0uvYtSxkC/PMz h6gsPoHb2QbBcgmBaTpw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1poqWQ-0038AW-1O; Tue, 18 Apr 2023 18:57:46 +0000 Received: from mx0b-0031df01.pphosted.com ([205.220.180.131]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1poqWC-00387b-00 for linux-arm-kernel@lists.infradead.org; Tue, 18 Apr 2023 18:57:33 +0000 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 33IFWj7P000537; Tue, 18 Apr 2023 18:57:26 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=z1BWlAn4LRvm6qqsRsFneV1IuZD0KXxFnNUH5JgDFko=; b=iU6ZIs7xIOx4AgEgGKPTeHBwHLhzqC3kNgl0bgtgb/2HV8sv9mT3Ie/LqvVf4t9e2bEK boFyatPS1LTS9xvZL01qB7I28qlu1UXOd5lroHlrqKpWA0+OjoEVbuezdF5eoUSeL+li qadIuwtkARoHPiH1vNPe5jLDvR62n2KHrl5rZnHqeD/EuwN6SUtRI9lnax2XLuqq0ilZ I8gK+h8Gzzba5Cqu6q+wFhuEhBDEJkwETzdxkO+Sy65fHcETBHti7ZfwP6VXD00lUP0N oKgMBz1imH2IjYbaLGa0PXoCmPZh3Axda01vcIgGjykqM6Aok/fJ7PBUSEQHdQ+nnIMT og== Received: from nalasppmta02.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3q1wxk0nrt-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 18 Apr 2023 18:57:26 +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 33IIvPXq025114 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 18 Apr 2023 18:57:25 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; Tue, 18 Apr 2023 11:57:25 -0700 From: Nikunj Kela To: CC: , , , , , , Nikunj Kela Subject: [PATCH v4 2/2] firmware: arm_scmi: Augment SMC/HVC to allow optional parameters Date: Tue, 18 Apr 2023 11:56:59 -0700 Message-ID: <20230418185659.29745-3-quic_nkela@quicinc.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20230418185659.29745-1-quic_nkela@quicinc.com> References: <20230409181918.29270-1-quic_nkela@quicinc.com> <20230418185659.29745-1-quic_nkela@quicinc.com> MIME-Version: 1.0 X-Originating-IP: [10.80.80.8] X-ClientProxiedBy: nasanex01a.na.qualcomm.com (10.52.223.231) 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: yBMu5k7_7NnielXXhtZrzofLbbRojqgj X-Proofpoint-ORIG-GUID: yBMu5k7_7NnielXXhtZrzofLbbRojqgj 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-18_13,2023-04-18_01,2023-02-09_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 phishscore=0 adultscore=0 mlxlogscore=999 bulkscore=0 impostorscore=0 lowpriorityscore=0 spamscore=0 priorityscore=1501 clxscore=1015 suspectscore=0 mlxscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2303200000 definitions=main-2304180155 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230418_115732_157381_06035A30 X-CRM114-Status: GOOD ( 23.15 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org This patch add support for passing shmem channel address as parameters in smc/hvc call. The address is split into 4KB-page and offset. This patch is useful when multiple scmi instances are using same smc-id and firmware needs to distinguish among the instances. Signed-off-by: Nikunj Kela --- drivers/firmware/arm_scmi/driver.c | 1 + drivers/firmware/arm_scmi/smc.c | 14 +++++++++++++- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/drivers/firmware/arm_scmi/driver.c b/drivers/firmware/arm_scmi/driver.c index e7d97b59963b..b5957cc12fee 100644 --- a/drivers/firmware/arm_scmi/driver.c +++ b/drivers/firmware/arm_scmi/driver.c @@ -2914,6 +2914,7 @@ static const struct of_device_id scmi_of_match[] = { #endif #ifdef CONFIG_ARM_SCMI_TRANSPORT_SMC { .compatible = "arm,scmi-smc", .data = &scmi_smc_desc}, + { .compatible = "arm,scmi-smc-param", .data = &scmi_smc_desc}, #endif #ifdef CONFIG_ARM_SCMI_TRANSPORT_VIRTIO { .compatible = "arm,scmi-virtio", .data = &scmi_virtio_desc}, diff --git a/drivers/firmware/arm_scmi/smc.c b/drivers/firmware/arm_scmi/smc.c index 93272e4bbd12..71e080b70df5 100644 --- a/drivers/firmware/arm_scmi/smc.c +++ b/drivers/firmware/arm_scmi/smc.c @@ -20,6 +20,11 @@ #include "common.h" +#define SHMEM_SHIFT 12 +#define SHMEM_SIZE (_AC(1, UL) << SHMEM_SHIFT) +#define SHMEM_PAGE(x) ((unsigned long)((x) >> SHMEM_SHIFT)) +#define SHMEM_OFFSET(x) ((x) & (SHMEM_SIZE - 1)) + /** * struct scmi_smc - Structure representing a SCMI smc transport * @@ -30,6 +35,7 @@ * @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 + * @param: physical address of the shmem channel */ struct scmi_smc { @@ -40,6 +46,7 @@ struct scmi_smc { #define INFLIGHT_NONE MSG_TOKEN_MAX atomic_t inflight; u32 func_id; + phys_addr_t param; }; static irqreturn_t smc_msg_done_isr(int irq, void *data) @@ -137,6 +144,8 @@ static int smc_chan_setup(struct scmi_chan_info *cinfo, struct device *dev, if (ret < 0) return ret; + if (of_device_is_compatible(dev->of_node, "arm,scmi-smc-param")) + scmi_info->param = res.start; /* * If there is an interrupt named "a2p", then the service and * completion of a message is signaled by an interrupt rather than by @@ -179,6 +188,8 @@ static int smc_send_message(struct scmi_chan_info *cinfo, { struct scmi_smc *scmi_info = cinfo->transport_info; struct arm_smccc_res res; + unsigned long page = SHMEM_PAGE(scmi_info->param); + unsigned long offset = SHMEM_OFFSET(scmi_info->param); /* * Channel will be released only once response has been @@ -188,7 +199,8 @@ static int smc_send_message(struct scmi_chan_info *cinfo, shmem_tx_prepare(scmi_info->shmem, xfer, cinfo); - arm_smccc_1_1_invoke(scmi_info->func_id, 0, 0, 0, 0, 0, 0, 0, &res); + arm_smccc_1_1_invoke(scmi_info->func_id, page, offset, 0, 0, 0, 0, 0, + &res); /* Only SMCCC_RET_NOT_SUPPORTED is valid error code */ if (res.a0) {