From patchwork Fri Jun 21 12:46:58 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Peng Fan (OSS)" X-Patchwork-Id: 13707569 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 41FCFC27C4F for ; Fri, 21 Jun 2024 12:54:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:MIME-Version:Cc:To: In-Reply-To:References:Message-Id:Content-Transfer-Encoding:Content-Type: Subject:Date:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=tQvBX14H9kyEKhbZC5fZD4gy0s6Y6n56TvnFOyYliek=; b=PkD9NwDf/dayQiPt6aW5KEcG/r aeqqLhCHTF+5JJ5l0nlwqXlefwY/4t8BvIC/sIc4BvMmmnJA0GgxrxZWsueJ9tII0qIB42uxPnsXo FiuTNqHxUGDXFsp+IBtkVDya+FbvIjoJq1nQM2KrMX1jLpUJYRaDIQztP+l8F+7i46ekaeDUNtQM7 bh+dUv06R+sPRQp9FvGKu7EpNAN958eIZ3PR7O8UvDTbum9kT82eXkfdmZhBWqRbOhnIAsJa2eleN on9KmewGfi1Tk0j5qFxVAKudKBiVYhsKrZllSTWNDfMojhRDIU7eV60d8nAzs9o3nGjGpGSwX1l1v oAjUn9pQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sKdm3-00000009F4x-1kal; Fri, 21 Jun 2024 12:53:51 +0000 Received: from mail-db8eur05on2062f.outbound.protection.outlook.com ([2a01:111:f400:7e1a::62f] helo=EUR05-DB8-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sKdm0-00000009F3p-18sS for linux-arm-kernel@lists.infradead.org; Fri, 21 Jun 2024 12:53:49 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Q5l7tHj/fnr+qwMGOAJbHoi2RcOBUbmUDG3ujOrJaPY86cU+WekqZf4YB56qN/pfjv+lSGJyR/2fdtN0JGjOyRN6DPy3NQc1wKVIh8Vn3fGO6y+mnqOdNux80SzIfywCiFChbTGhkh56ir/QufpfDPZihDqepBHd5FN8g5kHBZJAEsbL64ul63SM6XoiU1NFc+lAWUSFU8qe5A0cxprrLqflmVx4oVGsrOcfoUjTQcH5HAIknG+T4OVhk0i4sdId9ISKeK+tVLt799U3mX/kACnfzhJ1GlXh81txVGtMMkptShz4wzSxyyKQkIuBabLHjlOZvIabFNaLaI2SfLX0dw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=tQvBX14H9kyEKhbZC5fZD4gy0s6Y6n56TvnFOyYliek=; b=c4k7B41ODJ7+oKZK5y0etHoSBilIb0R/rVxSEFnTPSgNo5wjriOE2CYgWtwdEcSySJdIrZx972y2gcsxROZoG9RRowNxcUqocLtL6gkiie8JjIMtgP8Gp+Jr7NtGzB+CrieHSkgwy2KeQp45B3RFVhLmGnVvWWx11kiNulho58t3ysFS4LgCg4BGDjISS3JsEnpEa3KsVsWOStJncb+DWUjgQ9Qr4KWMorv5Rv8syd7OCIYLclbnZZFyxcoCUqgwJpAkdSybpyD8xoPDzjk3kKzAKJdRhZpvtwRP6wRuU5LsHNdZTvQCLRwFURTSXH5W+QUY45uwgZFC4JvHVsAf6A== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oss.nxp.com; dmarc=pass action=none header.from=oss.nxp.com; dkim=pass header.d=oss.nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=NXP1.onmicrosoft.com; s=selector2-NXP1-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=tQvBX14H9kyEKhbZC5fZD4gy0s6Y6n56TvnFOyYliek=; b=kYSasvLyaoNlWZcpLRXgmzTm6Es/3Tokqdgz0RWMwH73nqvrrIxRPAnvR7HQKOALqxZC2nCEEZfipd8OegBydtrnStVU/wRgeut60JgUIycQKcZHY7OaEzgpNt0K9HVWpwyt/wSozhdBiOnmmUAnRZ/O2ZYv0UIs/n7oAm/Fj/g= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=oss.nxp.com; Received: from AM6PR04MB5941.eurprd04.prod.outlook.com (2603:10a6:20b:9e::16) by VI0PR04MB10757.eurprd04.prod.outlook.com (2603:10a6:800:26a::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7698.21; Fri, 21 Jun 2024 12:37:58 +0000 Received: from AM6PR04MB5941.eurprd04.prod.outlook.com ([fe80::9f4e:b695:f5f0:5256]) by AM6PR04MB5941.eurprd04.prod.outlook.com ([fe80::9f4e:b695:f5f0:5256%4]) with mapi id 15.20.7698.017; Fri, 21 Jun 2024 12:37:58 +0000 From: "Peng Fan (OSS)" Date: Fri, 21 Jun 2024 20:46:58 +0800 Subject: [PATCH 2/2] firmware: arm_scmi: set mailbox timeout value from device tree Message-Id: <20240621-scmi-mailbox-v1-v1-2-8ed450735f46@nxp.com> References: <20240621-scmi-mailbox-v1-v1-0-8ed450735f46@nxp.com> In-Reply-To: <20240621-scmi-mailbox-v1-v1-0-8ed450735f46@nxp.com> To: Sudeep Holla , Cristian Marussi , Rob Herring , Krzysztof Kozlowski , Conor Dooley Cc: arm-scmi@vger.kernel.org, linux-arm-kernel@lists.infradead.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Peng Fan X-Mailer: b4 0.12.3 X-Developer-Signature: v=1; a=ed25519-sha256; t=1718974025; l=6769; i=peng.fan@nxp.com; s=20230812; h=from:subject:message-id; bh=tz2/NaWjI5asca5j9w8U1Oak8RkVbzQDFFcujBPkR4g=; b=SnwXei2qTLUnmzPkCSG2PDPK/D0m3cc8HMQwV6GcYObxn6ynU4vulft4XOCSIZeYxtVBcjyS2 2vP2xL1ZqvFBJtWDXDQBtJbFCORbzP97xzaEMtUYNPOcJnW3DGdVvrc X-Developer-Key: i=peng.fan@nxp.com; a=ed25519; pk=I4sJg7atIT1g63H7bb5lDRGR2gJW14RKDD0wFL8TT1g= X-ClientProxiedBy: SG2PR06CA0241.apcprd06.prod.outlook.com (2603:1096:4:ac::25) To AM6PR04MB5941.eurprd04.prod.outlook.com (2603:10a6:20b:9e::16) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM6PR04MB5941:EE_|VI0PR04MB10757:EE_ X-MS-Office365-Filtering-Correlation-Id: 9ade757d-7c5c-4f44-c08f-08dc91eefb68 X-MS-Exchange-SharedMailbox-RoutingAgent-Processed: True X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230037|366013|376011|52116011|1800799021|38350700011; X-Microsoft-Antispam-Message-Info: =?utf-8?q?4mux6VQ+zRWSyEeLvac15y9zXX+kC/n?= =?utf-8?q?Jo5k2FxGRbHaYgN7os7kH9c7BcLnbbOhvPUkRYTdfzj1x5CaN7/qg0lMoyCw06q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=?utf-8?q?tHToQBoC7FgqGDD19VgI10rQQmfby/x69Y5FSGg+e50hKaR7+hTNeBo32ZY+9y4t9?= =?utf-8?q?Ge7DCZlTMHHqz8O7LsJAa+8gxYVbMQ3z9bVIr9E4FT4jZJcEfTzp3Z/PNdIDscxp7?= =?utf-8?q?ubdYemyBbVFvBJWayxz2ebo4cqeG7IkZMBHzU4VoNiNEVmvBZ0i0ZmZ6Wfp6iRGI0?= =?utf-8?q?lLOSIsm8Ctcws/L4p10Y+DhwNlvkRcQOIK2m9qnn1aduQ8/V6wml0dQGRfkAy6q9u?= =?utf-8?q?BFtlmICFQ7Phm/ZTLvAV+n3Qn18BCk7CKL3wNCs8UL5m+2xBMs/02Iq/FKERDxsUV?= =?utf-8?q?SwWp9OmMoXnPmhrSSRfDoFsxpEwIP+5bkQAn1bK3xdruQwKXI3bX+hI4=3D?= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:AM6PR04MB5941.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230037)(366013)(376011)(52116011)(1800799021)(38350700011);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?toGID5FTsUsx80uuLE6rwLn5LwvS?= =?utf-8?q?+kMGimGva11Gn5+UfL40bZYw+rfTgsSz4uCue4rfaSigs2j5lkOAUR9FJTv/utoOv?= =?utf-8?q?myJNVIoybTXWm7SDOSBbGw7n89np3YSjcBoh+YpD01ACjg5V5vGzNx4XAjeIZWDfJ?= =?utf-8?q?mELi78okVFlcApajbY5HbMAfrhelTW0CeyKunU81g72Iy43P/qVD1wJgQbGu2I8A/?= =?utf-8?q?scqOvhnaABKB5LktKMxdK9pKL3Zw1yCtpgVF04wdAFoeYjYPwy5NDvWxpHNGZJtGq?= =?utf-8?q?4u7l3WMgEUNOVmqS+odr/Ew2g9eWx6mbIARl4q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5x7fieK/SmwVTgzGF?= =?utf-8?q?Mm/oMee/2yKhd7VOce/t0EBXzNbDsL/CGtF3qiGQ9cpStJSrKUHipNBIX/d0I7E8n?= =?utf-8?q?fIwf23DHGd9XwLPaSSRT8HhXDCn6KeZ7r6N3nDJOCtvSs8yi0/GVz3SuHaFBAd14F?= =?utf-8?q?GN8e+IOc+8qYFeLumU7yZU+ZvI/NpBLZ9xLtlbuaRYteJf/1iQ4E4RLdj5DEccPNQ?= =?utf-8?q?97fDkkryxcwxZGadCx9TsRGkKtFbMPO/m7aMlRswHEsz8HhVXigaCdurGoFSBm5Mw?= =?utf-8?q?EDvEze4EvExDwejisViU6AXLQvw/H6omypEZ5BRr/gjtWftyr0DRCHC9OpCx6SwKp?= =?utf-8?q?4T0eMhPIDcMj?= X-OriginatorOrg: oss.nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 9ade757d-7c5c-4f44-c08f-08dc91eefb68 X-MS-Exchange-CrossTenant-AuthSource: AM6PR04MB5941.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Jun 2024 12:37:58.6971 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: cJV9GPI/TBdPOssBM+w73SJV5wLC1uIzBN3Xadxu+WocCuyFPmpC/25lIJ6X7X6cNfiQ2FxB5QJcdi6m0oVerQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI0PR04MB10757 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240621_055348_611752_40118582 X-CRM114-Status: GOOD ( 16.18 ) 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 From: Peng Fan Each platform might have its own maximum mailbox receive channel timeout value, so get property max-rx-timeout-ms from device tree and use it. If the property does not exist, use mailbox 'scmi_desc' fixed value 30ms as before. Signed-off-by: Peng Fan --- drivers/firmware/arm_scmi/driver.c | 19 ++++++++++++++----- drivers/firmware/arm_scmi/raw_mode.c | 11 +++++++---- drivers/firmware/arm_scmi/raw_mode.h | 3 ++- 3 files changed, 23 insertions(+), 10 deletions(-) diff --git a/drivers/firmware/arm_scmi/driver.c b/drivers/firmware/arm_scmi/driver.c index 6b6957f4743f..1aa613d4cb43 100644 --- a/drivers/firmware/arm_scmi/driver.c +++ b/drivers/firmware/arm_scmi/driver.c @@ -162,6 +162,7 @@ struct scmi_debug_info { * @devreq_mtx: A mutex to serialize device creation for this SCMI instance * @dbg: A pointer to debugfs related data (if any) * @raw: An opaque reference handle used by SCMI Raw mode. + * @max_rx_timeout_ms: the maximum receive channel timeout value */ struct scmi_info { int id; @@ -188,6 +189,7 @@ struct scmi_info { struct mutex devreq_mtx; struct scmi_debug_info *dbg; void *raw; + unsigned int max_rx_timeout_ms; }; #define handle_to_scmi_info(h) container_of(h, struct scmi_info, handle) @@ -1302,11 +1304,11 @@ static int scmi_wait_for_message_response(struct scmi_chan_info *cinfo, trace_scmi_xfer_response_wait(xfer->transfer_id, xfer->hdr.id, xfer->hdr.protocol_id, xfer->hdr.seq, - info->desc->max_rx_timeout_ms, + info->max_rx_timeout_ms, xfer->hdr.poll_completion); return scmi_wait_for_reply(dev, info->desc, cinfo, xfer, - info->desc->max_rx_timeout_ms); + info->max_rx_timeout_ms); } /** @@ -2614,7 +2616,7 @@ static int scmi_chan_setup(struct scmi_info *info, struct device_node *of_node, if (!cinfo) return -ENOMEM; - cinfo->rx_timeout_ms = info->desc->max_rx_timeout_ms; + cinfo->rx_timeout_ms = info->max_rx_timeout_ms; /* Create a unique name for this transport device */ snprintf(name, 32, "__scmi_transport_device_%s_%02X", @@ -2888,7 +2890,7 @@ static struct scmi_debug_info *scmi_debugfs_common_setup(struct scmi_info *info) debugfs_create_bool("is_atomic", 0400, trans, &dbg->is_atomic); debugfs_create_u32("max_rx_timeout_ms", 0400, trans, - (u32 *)&info->desc->max_rx_timeout_ms); + (u32 *)&info->max_rx_timeout_ms); debugfs_create_u32("max_msg_size", 0400, trans, (u32 *)&info->desc->max_msg_size); @@ -2940,7 +2942,8 @@ static int scmi_debugfs_raw_mode_setup(struct scmi_info *info) info->raw = scmi_raw_mode_init(&info->handle, info->dbg->top_dentry, info->id, channels, num_chans, - info->desc, info->tx_minfo.max_msg); + info->desc, info->tx_minfo.max_msg, + info->max_rx_timeout_ms); if (IS_ERR(info->raw)) { dev_err(info->dev, "Failed to initialize SCMI RAW Mode !\n"); ret = PTR_ERR(info->raw); @@ -2953,6 +2956,7 @@ static int scmi_debugfs_raw_mode_setup(struct scmi_info *info) static int scmi_probe(struct platform_device *pdev) { int ret; + u32 timeout; char *err_str = "probe failure\n"; struct scmi_handle *handle; const struct scmi_desc *desc; @@ -3002,6 +3006,11 @@ static int scmi_probe(struct platform_device *pdev) info->atomic_threshold); handle->is_transport_atomic = scmi_is_transport_atomic; + if (!of_property_read_u32(np, "max-rx-timeout-ms", &timeout)) + info->max_rx_timeout_ms = timeout; + else + info->max_rx_timeout_ms = info->desc->max_rx_timeout_ms; + if (desc->ops->link_supplier) { ret = desc->ops->link_supplier(dev); if (ret) { diff --git a/drivers/firmware/arm_scmi/raw_mode.c b/drivers/firmware/arm_scmi/raw_mode.c index 130d13e9cd6b..d4f37ee664a2 100644 --- a/drivers/firmware/arm_scmi/raw_mode.c +++ b/drivers/firmware/arm_scmi/raw_mode.c @@ -379,7 +379,7 @@ static void scmi_xfer_raw_waiter_enqueue(struct scmi_raw_mode_info *raw, trace_scmi_xfer_response_wait(rw->xfer->transfer_id, rw->xfer->hdr.id, rw->xfer->hdr.protocol_id, rw->xfer->hdr.seq, - raw->desc->max_rx_timeout_ms, + raw->max_rx_timeout_ms, rw->xfer->hdr.poll_completion); mutex_lock(&raw->active_mtx); @@ -437,7 +437,7 @@ static void scmi_xfer_raw_worker(struct work_struct *work) raw = container_of(work, struct scmi_raw_mode_info, waiters_work); dev = raw->handle->dev; - max_tmo = msecs_to_jiffies(raw->desc->max_rx_timeout_ms); + max_tmo = msecs_to_jiffies(raw->max_rx_timeout_ms); do { int ret = 0; @@ -574,7 +574,7 @@ static int scmi_xfer_raw_get_init(struct scmi_raw_mode_info *raw, void *buf, dev_dbg(dev, "...retrying[%d] inflight registration\n", retry); - msleep(raw->desc->max_rx_timeout_ms / + msleep(raw->max_rx_timeout_ms / SCMI_XFER_RAW_MAX_RETRIES); } } while (ret && --retry); @@ -1162,6 +1162,7 @@ static int scmi_raw_mode_setup(struct scmi_raw_mode_info *raw, * @num_chans: The number of entries in @channels * @desc: Reference to the transport operations * @tx_max_msg: Max number of in-flight messages allowed by the transport + * @max_rx_timeout_ms: Max receive channel timeout value * * This function prepare the SCMI Raw stack and creates the debugfs API. * @@ -1170,7 +1171,8 @@ static int scmi_raw_mode_setup(struct scmi_raw_mode_info *raw, void *scmi_raw_mode_init(const struct scmi_handle *handle, struct dentry *top_dentry, int instance_id, u8 *channels, int num_chans, - const struct scmi_desc *desc, int tx_max_msg) + const struct scmi_desc *desc, int tx_max_msg, + u32 max_rx_timeout_ms) { int ret; struct scmi_raw_mode_info *raw; @@ -1188,6 +1190,7 @@ void *scmi_raw_mode_init(const struct scmi_handle *handle, raw->desc = desc; raw->tx_max_msg = tx_max_msg; raw->id = instance_id; + raw->max_rx_timeout_ms = max_rx_timeout_ms; ret = scmi_raw_mode_setup(raw, channels, num_chans); if (ret) { diff --git a/drivers/firmware/arm_scmi/raw_mode.h b/drivers/firmware/arm_scmi/raw_mode.h index 8af756a83fd1..25d4a46261e7 100644 --- a/drivers/firmware/arm_scmi/raw_mode.h +++ b/drivers/firmware/arm_scmi/raw_mode.h @@ -20,7 +20,8 @@ enum { void *scmi_raw_mode_init(const struct scmi_handle *handle, struct dentry *top_dentry, int instance_id, u8 *channels, int num_chans, - const struct scmi_desc *desc, int tx_max_msg); + const struct scmi_desc *desc, int tx_max_msg, + u32 max_rx_timeout_ms); void scmi_raw_mode_cleanup(void *raw); void scmi_raw_message_report(void *raw, struct scmi_xfer *xfer,