Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp4404047ybl; Mon, 9 Dec 2019 10:15:06 -0800 (PST) X-Google-Smtp-Source: APXvYqzY5IByw3cONJzuuCTkmgWPr/6DLbrqXRMYXKBfhcxkdBHW1wiuH4dDnVGOir0oC2Agtk8e X-Received: by 2002:aca:72d0:: with SMTP id p199mr364724oic.40.1575915306745; Mon, 09 Dec 2019 10:15:06 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1575915306; cv=none; d=google.com; s=arc-20160816; b=zd5fvJR8/+5OwnfF21QtJbhFQr38mTWwbLjQpdC5pN9MCe03N02OTmqbGM17xKrrUS 9rIYeGKe7WFoBA9rpbo9tP6D+GgpEz/gwabdMQ0mCX6wwHCS8sq5PtVclSZP17Jjmfdg /0VeN+flVl7bMKpxixWkdZGIhm4tm0i8wFMSBrFR3RCyfeX0pDCgvRJ9/kzbz8FsInfB e/Xv/k1HZERUXAzQiKHY3W2F93p7hEgUnMJYbC7l3IHjnnj24dVECd5/rpu+LLr3L4sX 4fVaw1weSwGguym6XBA3c06FhKSXIsCHK2JwFdB57bvcGY6ocUtMA9JgtGzIyNDxlsbQ ++WQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject; bh=6T8N7aECpkKWiEYgzkD9NW/CNul+kkZA+nUjbK1cAF0=; b=GbGXs2M13dvsj9PQThivmbBSicV55RPxGyzA7PXvdgH4HJFpVdKWCbN1rjtmghhYTq xKLJyHk5YR9QANoKEqdR/HAebF8aDNTcGXNIRPUnVwZPkiPvbxcsDqnK3LzUearQ74+u xv01kJ6v3tivDR/2DNggn7P1o/5potCmPGURcEtYWzOysBF8E7I6ehhR9oqbGhR6+rbK wxGgKiqku9hl0isrZDoB5rUIhYaRL/i6ZvwiHoWhCW/m0lCLo/Khj0ALhDH06LYwGigz 5bFtSw3LmqQCoisBzbM4Ro+rQC1gpwlUiOvhjZ0evQGqKZ2due1gPkeiZtCeO+ydobez ECJA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a136si317633oib.252.2019.12.09.10.14.55; Mon, 09 Dec 2019 10:15:06 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726801AbfLISNV (ORCPT + 99 others); Mon, 9 Dec 2019 13:13:21 -0500 Received: from foss.arm.com ([217.140.110.172]:40760 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726265AbfLISNV (ORCPT ); Mon, 9 Dec 2019 13:13:21 -0500 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 A90081045; Mon, 9 Dec 2019 10:13:20 -0800 (PST) Received: from [10.1.197.50] (e120937-lin.cambridge.arm.com [10.1.197.50]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id AC9453F6CF; Mon, 9 Dec 2019 10:13:19 -0800 (PST) Subject: Re: [PATCH] firmware: arm_scmi: Make scmi core independent of transport type To: Viresh Kumar , Sudeep Holla Cc: Vincent Guittot , Arnd Bergmann , Jassi Brar , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org References: <5c545c2866ba075ddb44907940a1dae1d823b8a1.1575019719.git.viresh.kumar@linaro.org> From: Cristian Marussi Message-ID: <71417ba8-b844-ac96-bcad-4bf48fa8b869@arm.com> Date: Mon, 9 Dec 2019 18:13:18 +0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.2.1 MIME-Version: 1.0 In-Reply-To: <5c545c2866ba075ddb44907940a1dae1d823b8a1.1575019719.git.viresh.kumar@linaro.org> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi a one minor nit, and one question about scmi_desc usage in this new transport independent driver. On 29/11/2019 09:31, Viresh Kumar wrote: > The SCMI specification is fairly independent of the transport protocol, > which can be a simple mailbox (already implemented) or anything else. > The current Linux implementation however is very much dependent of the > mailbox transport layer. > > This patch makes the SCMI core code (driver.c) independent of the > mailbox transport layer and moves all mailbox related code to a new > file: mailbox.c. > > We can now implement more transport protocols to transport SCMI > messages. > > The transport protocols just need to provide struct scmi_transport_ops, > with its version of the callbacks to enable exchange of SCMI messages. > > Signed-off-by: Viresh Kumar > --- > drivers/firmware/arm_scmi/Makefile | 3 +- > drivers/firmware/arm_scmi/common.h | 39 ++++++++ > drivers/firmware/arm_scmi/driver.c | 143 ++++++++++----------------- > drivers/firmware/arm_scmi/mailbox.c | 146 ++++++++++++++++++++++++++++ > 4 files changed, 236 insertions(+), 95 deletions(-) > create mode 100644 drivers/firmware/arm_scmi/mailbox.c > [snip] > /** > * struct scmi_info - Structure representing a SCMI instance > * > @@ -128,6 +109,7 @@ struct scmi_chan_info { > struct scmi_info { > struct device *dev; > const struct scmi_desc *desc; > + struct scmi_transport_ops *transport_ops; > struct scmi_revision_info version; > struct scmi_handle handle; > struct scmi_xfers_info tx_minfo; > @@ -138,7 +120,6 @@ struct scmi_info { > int users; > }; > Could we add also the related @transport_ops in the above comment block ? > -#define client_to_scmi_chan_info(c) container_of(c, struct scmi_chan_info, cl) > #define handle_to_scmi_info(h) container_of(h, struct scmi_info, handle) > > /* [snip] > + > static int scmi_probe(struct platform_device *pdev) > { > int ret; > @@ -833,12 +800,6 @@ static int scmi_probe(struct platform_device *pdev) > struct device *dev = &pdev->dev; > struct device_node *child, *np = dev->of_node; > > - /* Only mailbox method supported, check for the presence of one */ > - if (scmi_mailbox_check(np, 0)) { > - dev_err(dev, "no mailbox found in %pOF\n", np); > - return -EINVAL; > - } > - > desc = of_device_get_match_data(dev); > if (!desc) > return -EINVAL; This scmi_desc struct descriptor is retrieved from of_match_table .data and points to the driver-provided scmi_generic_desc static const struct scmi_desc scmi_generic_desc = { .max_rx_timeout_ms = 30, /* We may increase this if required */ .max_msg = 20, /* Limited by MBOX_TX_QUEUE_LEN */ .max_msg_size = 128, }; Is not this kind of information possibly (maybe partially) related to the selected transport, and as such it should be also provided dynamically by the chosen transport layer at probe time, like the transport_ops, instead of being hard-coded in this driver ? Thanks Cristian