From mboxrd@z Thu Jan 1 00:00:00 1970 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 F27A7C41535 for ; Fri, 22 Dec 2023 15:31:02 +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:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=dEc+DVA+f0UQD/AbPsQ4jRYwKWe/6aD1HXQ7aW7oHBY=; b=yHFdo7hz2yBejr cY2k9pkQKU4CEem/P93EJcqXBHWu4z4z4jtfPvw9LlsX/xHrXtwOYBK5QJgFvPnxu8kp9K2enGfj9 KI/m5qYzxGrsrqUHNEKoY0tPYMu7kAgwBsjqvp/w2TmkEr1Rnvy5/4hkIhPfK915VcyEZknp8BRTW on0RXLXW+37mdH5kKKhK5Z+sUX82qrRnwMwLww8Tuqzzh3MTU2YnjavTdwjB5oe3ku7uXR0kZPCei 99Jk6/wE8PeiMD0mzKeBEUDwWZij9EOxC2LBhMapR61xb2GyAdMXMxklNBYCgCvi4KnZLyGCWf5nZ +853SsNP8RiJU2qVQeEQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1rGhTp-006FME-0X; Fri, 22 Dec 2023 15:30:29 +0000 Received: from foss.arm.com ([217.140.110.172]) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1rGhTl-006FLn-1c for linux-arm-kernel@lists.infradead.org; Fri, 22 Dec 2023 15:30:27 +0000 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 4C2322F4; Fri, 22 Dec 2023 07:31:03 -0800 (PST) Received: from pluto (unknown [172.31.20.19]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 999953F5A1; Fri, 22 Dec 2023 07:30:14 -0800 (PST) Date: Fri, 22 Dec 2023 15:30:11 +0000 From: Cristian Marussi To: "Peng Fan (OSS)" Cc: Sudeep Holla , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Oleksii Moisieiev , Linus Walleij , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam , NXP Linux Team , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, linux-gpio@vger.kernel.org, Peng Fan Subject: Re: [PATCH 1/7] firmware: arm_scmi: introduce helper get_max_msg_size Message-ID: References: <20231215-pinctrl-scmi-v1-0-0fe35e4611f7@nxp.com> <20231215-pinctrl-scmi-v1-1-0fe35e4611f7@nxp.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20231215-pinctrl-scmi-v1-1-0fe35e4611f7@nxp.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231222_073025_607787_D5D02183 X-CRM114-Status: GOOD ( 21.16 ) 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: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Fri, Dec 15, 2023 at 07:56:29PM +0800, Peng Fan (OSS) wrote: > From: Peng Fan > > When Agent sending data to SCMI server, the Agent driver could check > the size to avoid protocol buffer overflow. So introduce the helper > get_max_msg_size. > > Signed-off-by: Peng Fan > --- > drivers/firmware/arm_scmi/driver.c | 15 +++++++++++++++ > drivers/firmware/arm_scmi/protocols.h | 1 + > 2 files changed, 16 insertions(+) > > diff --git a/drivers/firmware/arm_scmi/driver.c b/drivers/firmware/arm_scmi/driver.c > index a9f70e6e58ac..b4f8f190351b 100644 > --- a/drivers/firmware/arm_scmi/driver.c > +++ b/drivers/firmware/arm_scmi/driver.c > @@ -1481,6 +1481,20 @@ static int scmi_common_extended_name_get(const struct scmi_protocol_handle *ph, > return ret; > } > > +/** > + * scmi_common_get_max_msg_size - Get maximum message size > + * @ph: A protocol handle reference. > + * > + * Return: Maximum message size for the current protocol. > + */ > +static int scmi_common_get_max_msg_size(const struct scmi_protocol_handle *ph) > +{ > + const struct scmi_protocol_instance *pi = ph_to_pi(ph); > + struct scmi_info *info = handle_to_scmi_info(pi->handle); > + > + return info->desc->max_msg_size; > +} > + > /** > * struct scmi_iterator - Iterator descriptor > * @msg: A reference to the message TX buffer; filled by @prepare_message with > @@ -1756,6 +1770,7 @@ static void scmi_common_fastchannel_db_ring(struct scmi_fc_db_info *db) > > static const struct scmi_proto_helpers_ops helpers_ops = { > .extended_name_get = scmi_common_extended_name_get, > + .get_max_msg_size = scmi_common_get_max_msg_size, > .iter_response_init = scmi_iterator_init, > .iter_response_run = scmi_iterator_run, > .fastchannel_init = scmi_common_fastchannel_init, > diff --git a/drivers/firmware/arm_scmi/protocols.h b/drivers/firmware/arm_scmi/protocols.h > index e683c26f24eb..08de8dc064c1 100644 > --- a/drivers/firmware/arm_scmi/protocols.h > +++ b/drivers/firmware/arm_scmi/protocols.h > @@ -270,6 +270,7 @@ struct scmi_proto_helpers_ops { > void __iomem **p_addr, > struct scmi_fc_db_info **p_db); > void (*fastchannel_db_ring)(struct scmi_fc_db_info *db); > + int (*get_max_msg_size)(const struct scmi_protocol_handle *ph); > }; This looks good to me, but please add a comment for this new helper in the comment block above. Other than that: Reviewed-by: Cristian Marussi Thanks, Cristian _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel