From nobody Tue Apr 7 19:41:03 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 838B4C64990 for ; Thu, 25 Aug 2022 14:13:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241715AbiHYONG (ORCPT ); Thu, 25 Aug 2022 10:13:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49750 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241647AbiHYOMn (ORCPT ); Thu, 25 Aug 2022 10:12:43 -0400 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 278F7A833D for ; Thu, 25 Aug 2022 07:12:30 -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 F36ADED1; Thu, 25 Aug 2022 07:12: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 8821C3F71A; Thu, 25 Aug 2022 07:12:27 -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 v2 9/9] firmware: arm_scmi: Call Raw mode hooks from the core stack Date: Thu, 25 Aug 2022 15:11:52 +0100 Message-Id: <20220825141152.2334536-10-cristian.marussi@arm.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20220825141152.2334536-1-cristian.marussi@arm.com> References: <20220825141152.2334536-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 7742581b94c7..1300aa9a9bfb 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) @@ -766,6 +772,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); @@ -779,6 +790,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; @@ -810,6 +824,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 @@ -2553,6 +2570,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 @@ -2626,6 +2655,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