Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp2544206ybb; Fri, 27 Mar 2020 07:35:22 -0700 (PDT) X-Google-Smtp-Source: ADFU+vtkK4KHjNxQzAtlN4zfOsgNti7knetxfcCSV3LLEuKXPmovEHLLv1moiMqz4DTg3EKl4MM4 X-Received: by 2002:a9d:3423:: with SMTP id v32mr10381805otb.46.1585319721907; Fri, 27 Mar 2020 07:35:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1585319721; cv=none; d=google.com; s=arc-20160816; b=qjH87wvgGV+fEYRxERvhf3OVcbGVuJjKoGHv0oiOG6gO8+0JI6qquIG0Dtgsowehed GHgnWRHcldMpRK5jzSJ8GWaIaGQc92tWpAjb8KZ8MHeNfoUXAMYTlrM6/dsYlrSV8TLx VXuunYXfk6suBeh4X3YK1ppGzomV1epeJ4uO3Dr98Ri+Z+HjbwgyzFkJw8cpRFWcvmsx QQmwX4RtdSno1tFImdwpn9B1U5Afw9atsVOl9P8p/J7Vjnl3oaeA5wDjHkOikSB/hu2X FlTyV56sTxH6iC39da10kyy7R5FFkDk6Fih0tiyZZgZ9A0dj7cyREOc0S+NIUEY2SGQv 1EzA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from; bh=uSbhuIZBrBksWQOgrn9RAQwiRAxvy6RAl6+zYW0+gQ0=; b=l4YIqWpTIElrGoKKH65fAy4TFSbAAtJEcXADBljSRyp+yWT1mBqt6lbKGMhoi40sa3 FM8s4nvoZnrhaeTohyjBNcscvWxFL1KTWR0hfwBiO9vinYld632I8fTAoZJ/MzjFscjZ mepImKubYqDeH6e6vUIVfBJfyQF3S/vc2NYtWpWb6aGHc64OB7nBCmuGplKXG1hUWXy+ 5XF+iuW8wj/a9JWgzqagWuRW+6GyoJ5IvGkgfKT23v2paedMvgmIzsNkcQ0WuGDqrEE/ uV5kbY7kEkU/6cDEEulMW5nyKhRQ2nv0MmIdXHY9v8XYjs94pb+9z5Ai0Ce6ykNef+2n nfYQ== 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 q26si2404284otn.296.2020.03.27.07.35.06; Fri, 27 Mar 2020 07:35:21 -0700 (PDT) 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 S1727636AbgC0Oet (ORCPT + 99 others); Fri, 27 Mar 2020 10:34:49 -0400 Received: from foss.arm.com ([217.140.110.172]:45558 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726518AbgC0Oes (ORCPT ); Fri, 27 Mar 2020 10:34:48 -0400 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 AC82D31B; Fri, 27 Mar 2020 07:34:47 -0700 (PDT) Received: from e120937-lin.home (unknown [172.31.20.19]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id A409F3F71F; Fri, 27 Mar 2020 07:34:46 -0700 (PDT) From: Cristian Marussi To: linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Cc: sudeep.holla@arm.com, lukasz.luba@arm.com, james.quinlan@broadcom.com, Jonathan.Cameron@Huawei.com, cristian.marussi@arm.com Subject: [PATCH v6 01/13] firmware: arm_scmi: Add receive buffer support for notifications Date: Fri, 27 Mar 2020 14:34:26 +0000 Message-Id: <20200327143438.5382-2-cristian.marussi@arm.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200327143438.5382-1-cristian.marussi@arm.com> References: <20200327143438.5382-1-cristian.marussi@arm.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. Reviewed-by: Jonathan Cameron Signed-off-by: Sudeep Holla [Changed parameters in __scmi_xfer_info_init()] Signed-off-by: Cristian Marussi --- 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); -- 2.17.1