Received: by 2002:a25:c205:0:0:0:0:0 with SMTP id s5csp2345275ybf; Mon, 2 Mar 2020 06:52:35 -0800 (PST) X-Google-Smtp-Source: APXvYqyYwUZ8WDI00kAZZeD3LC+Sy1kM1eOJD0lpaXOqurPavlUxc2y9Sryqk2zUraDABt4V0O5I X-Received: by 2002:a9d:7a47:: with SMTP id z7mr13729269otm.179.1583160755124; Mon, 02 Mar 2020 06:52:35 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1583160755; cv=none; d=google.com; s=arc-20160816; b=Q9Ddf6CKd3WLF2AvOYgjsIH6Jh7FY+9sLawS6/TZLmVWAXQ1iLgK2tsp9y3w4RZFou D9/ujiPbhRnfs2v7+J4JPD+maZq7zdipo8AaMofZQcUsOJ7mNVAtGgvW0FVwwTsR3yh/ hFBDUGufTgpS7lxJGbnTi0EkXryPnhdDqz518ifnCgipjnDrlTIwjVz/dgYNL3ZgrdlL wQ+Flwbb0T5q9HP89JPbAkPVhoklXrQsFiaC+U2Y9CwC2xQOJmM3WkWDFaI5Bl1uMGgB DKY5+VtSrWxlioKSLuzWfR3LRm65Eyan+aAYWgqReYK/w1M5ylEaTdRop4NgczkPgO+1 SBDQ== 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:mime-version :organization:references:in-reply-to:message-id:subject:cc:to:from :date; bh=L/h9/mk1jUxGS6RhmmSS39Rgdw4JcO1H+ltVbDlBrRA=; b=KMrSDfwA8BxaLf2Jx1nmhd0cNmS+q8DaGh8kpPiUCRJiJ2u8I4i1lxiZ6r4v8aeRA5 xsPEYLOrCYCHdvxwCOmYY8/3Vd58yC6F4yc7mqSkA9BhNetYosLJqISaRRmT81HPc3yA a7BALaCO1PRB2zyFHGG/JW4amigh0k5k26rBT9zKGYRuLZbMOxBq7KUgB450oeR+VOQi wyJPkbZzyAlRBdTohTiOIcXRgVSMTBUTVp2FNXRIzhrYmE9KdauK4hGfpD0dZ9UvWTil N+M3WDWrRE0F1zEnUIOLsHnsJDtFjpXy47dEDQgDNQhtgarizBghw5V9BFLkYQCM1oJF tiVg== 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 k202si6615262oih.244.2020.03.02.06.52.23; Mon, 02 Mar 2020 06:52:35 -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 S1727189AbgCBOwR (ORCPT + 99 others); Mon, 2 Mar 2020 09:52:17 -0500 Received: from lhrrgout.huawei.com ([185.176.76.210]:2496 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727112AbgCBOwR (ORCPT ); Mon, 2 Mar 2020 09:52:17 -0500 Received: from lhreml707-cah.china.huawei.com (unknown [172.18.7.108]) by Forcepoint Email with ESMTP id 9916AECE61B444B501C5; Mon, 2 Mar 2020 14:52:15 +0000 (GMT) Received: from lhreml710-chm.china.huawei.com (10.201.108.61) by lhreml707-cah.china.huawei.com (10.201.108.48) with Microsoft SMTP Server (TLS) id 14.3.408.0; Mon, 2 Mar 2020 14:52:15 +0000 Received: from localhost (10.202.226.57) by lhreml710-chm.china.huawei.com (10.201.108.61) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1713.5; Mon, 2 Mar 2020 14:52:14 +0000 Date: Mon, 2 Mar 2020 14:52:13 +0000 From: Jonathan Cameron To: Cristian Marussi CC: , , , , Subject: Re: [RFC PATCH v3 01/13] firmware: arm_scmi: Add receive buffer support for notifications Message-ID: <20200302145213.00003304@Huawei.com> In-Reply-To: <20200224144124.2008-2-cristian.marussi@arm.com> References: <20200224144124.2008-1-cristian.marussi@arm.com> <20200224144124.2008-2-cristian.marussi@arm.com> Organization: Huawei Technologies Research and Development (UK) Ltd. X-Mailer: Claws Mail 3.17.4 (GTK+ 2.24.32; i686-w64-mingw32) MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit X-Originating-IP: [10.202.226.57] X-ClientProxiedBy: lhreml730-chm.china.huawei.com (10.201.108.81) To lhreml710-chm.china.huawei.com (10.201.108.61) X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, 24 Feb 2020 14:41:12 +0000 Cristian Marussi wrote: > From: Sudeep Holla > > With all the plumbing in place, let's just add the separate dedicated > receive buffers to handle notifications that can arrive asynchronously > from the platform firmware to OS. > > Also add one check to see if the platform supports any receive channels > before allocating the receive buffers: since those buffers are optionally > supported though, the whole xfer initialization is also postponed to be > able to check for their existence in advance. > > Signed-off-by: Sudeep Holla > [Changed parameters in __scmi_xfer_info_init()] > Signed-off-by: Cristian Marussi Looks good to me. Reviewed-by: Jonathan Cameron > --- > V1 --> V2: > - reviewed commit message > - reviewed parameters of __scmi_xfer_info_init() > --- > drivers/firmware/arm_scmi/driver.c | 24 ++++++++++++++++++------ > 1 file changed, 18 insertions(+), 6 deletions(-) > > diff --git a/drivers/firmware/arm_scmi/driver.c b/drivers/firmware/arm_scmi/driver.c > index dbec767222e9..efb660c34b57 100644 > --- a/drivers/firmware/arm_scmi/driver.c > +++ b/drivers/firmware/arm_scmi/driver.c > @@ -76,6 +76,7 @@ struct scmi_xfers_info { > * implementation version and (sub-)vendor identification. > * @handle: Instance of SCMI handle to send to clients > * @tx_minfo: Universal Transmit Message management info > + * @rx_minfo: Universal Receive Message management info > * @tx_idr: IDR object to map protocol id to Tx channel info pointer > * @rx_idr: IDR object to map protocol id to Rx channel info pointer > * @protocols_imp: List of protocols implemented, currently maximum of > @@ -89,6 +90,7 @@ struct scmi_info { > struct scmi_revision_info version; > struct scmi_handle handle; > struct scmi_xfers_info tx_minfo; > + struct scmi_xfers_info rx_minfo; > struct idr tx_idr; > struct idr rx_idr; > u8 *protocols_imp; > @@ -525,13 +527,13 @@ int scmi_handle_put(const struct scmi_handle *handle) > return 0; > } > > -static int scmi_xfer_info_init(struct scmi_info *sinfo) > +static int __scmi_xfer_info_init(struct scmi_info *sinfo, > + struct scmi_xfers_info *info) > { > int i; > struct scmi_xfer *xfer; > struct device *dev = sinfo->dev; > const struct scmi_desc *desc = sinfo->desc; > - struct scmi_xfers_info *info = &sinfo->tx_minfo; > > /* Pre-allocated messages, no more than what hdr.seq can support */ > if (WARN_ON(desc->max_msg >= MSG_TOKEN_MAX)) { > @@ -566,6 +568,16 @@ static int scmi_xfer_info_init(struct scmi_info *sinfo) > return 0; > } > > +static int scmi_xfer_info_init(struct scmi_info *sinfo) > +{ > + int ret = __scmi_xfer_info_init(sinfo, &sinfo->tx_minfo); > + > + if (!ret && idr_find(&sinfo->rx_idr, SCMI_PROTOCOL_BASE)) > + ret = __scmi_xfer_info_init(sinfo, &sinfo->rx_minfo); > + > + return ret; > +} > + > static int scmi_chan_setup(struct scmi_info *info, struct device *dev, > int prot_id, bool tx) > { > @@ -699,10 +711,6 @@ static int scmi_probe(struct platform_device *pdev) > info->desc = desc; > INIT_LIST_HEAD(&info->node); > > - ret = scmi_xfer_info_init(info); > - if (ret) > - return ret; > - > platform_set_drvdata(pdev, info); > idr_init(&info->tx_idr); > idr_init(&info->rx_idr); > @@ -715,6 +723,10 @@ static int scmi_probe(struct platform_device *pdev) > if (ret) > return ret; > > + ret = scmi_xfer_info_init(info); > + if (ret) > + return ret; > + > ret = scmi_base_protocol_init(handle); > if (ret) { > dev_err(dev, "unable to communicate with SCMI(%d)\n", ret);