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 X-Spam-Level: X-Spam-Status: No, score=-5.8 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,URIBL_DBL_ABUSE_MALW, USER_AGENT_SANE_2 autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 72DECC33CB1 for ; Mon, 27 Jan 2020 17:07:31 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id 489BE2465B for ; Mon, 27 Jan 2020 17:07:31 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="V2goQJrX" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 489BE2465B Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=Huawei.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Subject: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=DB4Va7HwBebu3W44maPmOmDmmjLqUyu508gT6suiGjI=; b=V2goQJrXoIHXOc Wia1ZSIWZO7HPd1rV5WspXsM93CV2tk6VSddd1HqnKqQCPQqwGPX3e4sIF5XL/9FfwW4/8gq+aRF5 pRXG/kArujoQl0NVdyep4Mem6ufDU2XPERg1lYLGuGTB4S7SZhz6LDGlrBIvN2yG1fjur51Y7p10q +jLPjgimG61MMgKjm7Qmz6sxRdmoVr83ex+6m+B3sAVaWLpjELdY90Dn7wNQgtDt4PW3P/M6rG+sS MzOPYksu4FZClqcZCvOnGzEjHfovgm0hhdEUGebzwhlJX6i3O+x8bAI5rc5/Qiz15UEsxcCer19Lz jmL/YaV3dCNHeRBtXG4g==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1iw7r9-0005cK-SD; Mon, 27 Jan 2020 17:07:23 +0000 Received: from lhrrgout.huawei.com ([185.176.76.210] helo=huawei.com) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1iw7r6-0005b9-5L for linux-arm-kernel@lists.infradead.org; Mon, 27 Jan 2020 17:07:21 +0000 Received: from lhreml701-cah.china.huawei.com (unknown [172.18.7.106]) by Forcepoint Email with ESMTP id 7D538FE425EF68D12A98; Mon, 27 Jan 2020 17:07:16 +0000 (GMT) Received: from lhreml710-chm.china.huawei.com (10.201.108.61) by lhreml701-cah.china.huawei.com (10.201.108.42) with Microsoft SMTP Server (TLS) id 14.3.408.0; Mon, 27 Jan 2020 17:07: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, 27 Jan 2020 17:07:16 +0000 Date: Mon, 27 Jan 2020 17:07:13 +0000 From: Jonathan Cameron To: Cristian Marussi Subject: Re: [RFC PATCH 01/11] firmware: arm_scmi: Add receive buffer support for notifications Message-ID: <20200127170713.000013ee@Huawei.com> In-Reply-To: <20200120122333.46217-2-cristian.marussi@arm.com> References: <20200120122333.46217-1-cristian.marussi@arm.com> <20200120122333.46217-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 X-Originating-IP: [10.202.226.57] X-ClientProxiedBy: lhreml737-chm.china.huawei.com (10.201.108.187) To lhreml710-chm.china.huawei.com (10.201.108.61) X-CFilter-Loop: Reflected X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200127_090720_352044_8C24D46F X-CRM114-Status: GOOD ( 19.43 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: james.quinlan@broadcom.com, lukasz.luba@arm.com, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, sudeep.holla@arm.com Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Mon, 20 Jan 2020 12:23:23 +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 check to see if the platform supports any receive channels > before allocating the receive buffers. Perhaps hand hold the reader a tiny bit more by saying that we need to move the initialization later so that we can know *if* the receive channels are supported. Took me a moment to figure out why you did that ;) One minor suggestion inline. > > Signed-off-by: Sudeep Holla > --- > 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 2c96f6b5a7d8..9611e8037d77 100644 > --- a/drivers/firmware/arm_scmi/driver.c > +++ b/drivers/firmware/arm_scmi/driver.c > @@ -123,6 +123,7 @@ struct scmi_chan_info { > * @version: SCMI revision information containing protocol version, > * implementation version and (sub-)vendor identification. > * @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 > @@ -136,6 +137,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; > @@ -690,13 +692,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, bool tx) > { > 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; > + struct scmi_xfers_info *info = tx ? &sinfo->tx_minfo : &sinfo->rx_minfo; Perhaps cleaner to just pass in the relevant info structure rather than a boolean to pick it. Saves people having to check if the boolean is saying it's tx or rx when reading the call sites. > > /* Pre-allocated messages, no more than what hdr.seq can support */ > if (WARN_ON(desc->max_msg >= MSG_TOKEN_MAX)) { > @@ -731,6 +733,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, true); > + > + if (!ret && idr_find(&sinfo->rx_idr, SCMI_PROTOCOL_BASE)) > + ret = __scmi_xfer_info_init(sinfo, false); > + > + return ret; > +} > + > static int scmi_mailbox_check(struct device_node *np, int idx) > { > return of_parse_phandle_with_args(np, "mboxes", "#mbox-cells", > @@ -908,10 +920,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); > @@ -924,6 +932,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); _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel 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 X-Spam-Level: X-Spam-Status: No, score=-8.2 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS, USER_AGENT_SANE_2 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5C59BC2D0DB for ; Mon, 27 Jan 2020 17:07:21 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 386FE20720 for ; Mon, 27 Jan 2020 17:07:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726327AbgA0RHT (ORCPT ); Mon, 27 Jan 2020 12:07:19 -0500 Received: from lhrrgout.huawei.com ([185.176.76.210]:2308 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726099AbgA0RHR (ORCPT ); Mon, 27 Jan 2020 12:07:17 -0500 Received: from lhreml701-cah.china.huawei.com (unknown [172.18.7.106]) by Forcepoint Email with ESMTP id 7D538FE425EF68D12A98; Mon, 27 Jan 2020 17:07:16 +0000 (GMT) Received: from lhreml710-chm.china.huawei.com (10.201.108.61) by lhreml701-cah.china.huawei.com (10.201.108.42) with Microsoft SMTP Server (TLS) id 14.3.408.0; Mon, 27 Jan 2020 17:07: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, 27 Jan 2020 17:07:16 +0000 Date: Mon, 27 Jan 2020 17:07:13 +0000 From: Jonathan Cameron To: Cristian Marussi CC: , , , , Subject: Re: [RFC PATCH 01/11] firmware: arm_scmi: Add receive buffer support for notifications Message-ID: <20200127170713.000013ee@Huawei.com> In-Reply-To: <20200120122333.46217-2-cristian.marussi@arm.com> References: <20200120122333.46217-1-cristian.marussi@arm.com> <20200120122333.46217-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: lhreml737-chm.china.huawei.com (10.201.108.187) 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, 20 Jan 2020 12:23:23 +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 check to see if the platform supports any receive channels > before allocating the receive buffers. Perhaps hand hold the reader a tiny bit more by saying that we need to move the initialization later so that we can know *if* the receive channels are supported. Took me a moment to figure out why you did that ;) One minor suggestion inline. > > Signed-off-by: Sudeep Holla > --- > 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 2c96f6b5a7d8..9611e8037d77 100644 > --- a/drivers/firmware/arm_scmi/driver.c > +++ b/drivers/firmware/arm_scmi/driver.c > @@ -123,6 +123,7 @@ struct scmi_chan_info { > * @version: SCMI revision information containing protocol version, > * implementation version and (sub-)vendor identification. > * @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 > @@ -136,6 +137,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; > @@ -690,13 +692,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, bool tx) > { > 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; > + struct scmi_xfers_info *info = tx ? &sinfo->tx_minfo : &sinfo->rx_minfo; Perhaps cleaner to just pass in the relevant info structure rather than a boolean to pick it. Saves people having to check if the boolean is saying it's tx or rx when reading the call sites. > > /* Pre-allocated messages, no more than what hdr.seq can support */ > if (WARN_ON(desc->max_msg >= MSG_TOKEN_MAX)) { > @@ -731,6 +733,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, true); > + > + if (!ret && idr_find(&sinfo->rx_idr, SCMI_PROTOCOL_BASE)) > + ret = __scmi_xfer_info_init(sinfo, false); > + > + return ret; > +} > + > static int scmi_mailbox_check(struct device_node *np, int idx) > { > return of_parse_phandle_with_args(np, "mboxes", "#mbox-cells", > @@ -908,10 +920,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); > @@ -924,6 +932,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);