From nobody Mon Apr 6 20:13:02 2026 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 4E27CECAAD5 for ; Sat, 3 Sep 2022 18:32:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233291AbiICScP (ORCPT ); Sat, 3 Sep 2022 14:32:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44072 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231719AbiICScC (ORCPT ); Sat, 3 Sep 2022 14:32:02 -0400 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 3C793564CE for ; Sat, 3 Sep 2022 11:31:29 -0700 (PDT) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id D41A41424; Sat, 3 Sep 2022 11:31:33 -0700 (PDT) Received: from e120937-lin.home (unknown [172.31.20.19]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id C7FE13F71A; Sat, 3 Sep 2022 11:31:25 -0700 (PDT) From: Cristian Marussi To: linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Cc: sudeep.holla@arm.com, james.quinlan@broadcom.com, Jonathan.Cameron@Huawei.com, f.fainelli@gmail.com, etienne.carriere@linaro.org, vincent.guittot@linaro.org, souvik.chakravarty@arm.com, wleavitt@marvell.com, peter.hilber@opensynergy.com, nicola.mazzucato@arm.com, tarek.el-sherbiny@arm.com, cristian.marussi@arm.com Subject: [PATCH v3 9/9] firmware: arm_scmi: Call Raw mode hooks from the core stack Date: Sat, 3 Sep 2022 19:30:42 +0100 Message-Id: <20220903183042.3913053-10-cristian.marussi@arm.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20220903183042.3913053-1-cristian.marussi@arm.com> References: <20220903183042.3913053-1-cristian.marussi@arm.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" Add a few call sites where, if SCMI Raw mode access had been enabled in Kconfig, the needed SCMI Raw initialization and hooks are called. Signed-off-by: Cristian Marussi --- v1 --> v2 - fixes need to use multiple cinfo if available --- drivers/firmware/arm_scmi/driver.c | 32 ++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/drivers/firmware/arm_scmi/driver.c b/drivers/firmware/arm_scmi= /driver.c index 78879e23fef8..fd4f3ac54077 100644 --- a/drivers/firmware/arm_scmi/driver.c +++ b/drivers/firmware/arm_scmi/driver.c @@ -23,10 +23,12 @@ #include #include #include +#include #include #include #include #include +#include #include #include #include @@ -34,6 +36,8 @@ #include "common.h" #include "notify.h" =20 +#include "raw_mode.h" + #define CREATE_TRACE_POINTS #include =20 @@ -133,6 +137,7 @@ struct scmi_protocol_instance { * @notify_priv: Pointer to private data structure specific to notificatio= ns. * @node: List head * @users: Number of users of this instance + * @raw: An opaque reference handle used by SCMI Raw mode. */ struct scmi_info { struct device *dev; @@ -152,6 +157,7 @@ struct scmi_info { void *notify_priv; struct list_head node; int users; + void *raw; }; =20 #define handle_to_scmi_info(h) container_of(h, struct scmi_info, handle) @@ -780,6 +786,11 @@ static void scmi_handle_notification(struct scmi_chan_= info *cinfo, xfer->hdr.protocol_id, xfer->hdr.seq, MSG_TYPE_NOTIFICATION); =20 + if (IS_ENABLED(CONFIG_ARM_SCMI_RAW_MODE_SUPPORT)) { + xfer->hdr.seq =3D MSG_XTRACT_TOKEN(msg_hdr); + scmi_raw_message_report(info->raw, xfer, SCMI_RAW_NOTIF_QUEUE); + } + __scmi_xfer_put(minfo, xfer); =20 scmi_clear_channel(info, cinfo); @@ -793,6 +804,9 @@ static void scmi_handle_response(struct scmi_chan_info = *cinfo, =20 xfer =3D scmi_xfer_command_acquire(cinfo, msg_hdr); if (IS_ERR(xfer)) { + if (IS_ENABLED(CONFIG_ARM_SCMI_RAW_MODE_SUPPORT)) + scmi_raw_error_report(info->raw, cinfo, msg_hdr, priv); + if (MSG_XTRACT_TYPE(msg_hdr) =3D=3D MSG_TYPE_DELAYED_RESP) scmi_clear_channel(info, cinfo); return; @@ -824,6 +838,9 @@ static void scmi_handle_response(struct scmi_chan_info = *cinfo, complete(&xfer->done); } =20 + if (IS_ENABLED(CONFIG_ARM_SCMI_RAW_MODE_SUPPORT)) + scmi_raw_message_report(info->raw, xfer, SCMI_RAW_REPLY_QUEUE); + scmi_xfer_command_release(info, xfer); } =20 @@ -2567,6 +2584,18 @@ static int scmi_probe(struct platform_device *pdev) if (ret) goto clear_txrx_setup; =20 + if (IS_ENABLED(CONFIG_ARM_SCMI_RAW_MODE_SUPPORT)) { + info->raw =3D scmi_raw_mode_init(handle, info->desc, + info->tx_minfo.max_msg); + if (!IS_ERR(info->raw)) { + dev_info(dev, "SCMI RAW Mode initialized.\n"); + return 0; + } + + dev_err(dev, "Failed to initialize SCMI RAW Mode !\n"); + info->raw =3D NULL; + } + if (scmi_notification_init(handle)) dev_err(dev, "SCMI Notifications NOT available.\n"); =20 @@ -2640,6 +2669,9 @@ static int scmi_remove(struct platform_device *pdev) struct scmi_info *info =3D platform_get_drvdata(pdev); struct device_node *child; =20 + if (IS_ENABLED(CONFIG_ARM_SCMI_RAW_MODE_SUPPORT)) + scmi_raw_mode_cleanup(info->raw); + mutex_lock(&scmi_list_mutex); if (info->users) ret =3D -EBUSY; --=20 2.32.0