From patchwork Thu Oct 8 14:37:19 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Etienne Carriere X-Patchwork-Id: 11823111 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 855FC14D5 for ; Thu, 8 Oct 2020 14:39:05 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (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 4B29421974 for ; Thu, 8 Oct 2020 14:39:05 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="0BiDpTUR"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="UMIv7thr" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 4B29421974 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:MIME-Version:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:References:In-Reply-To:Message-Id:Date:Subject:To: From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=tshuXngTAUmNl3HYktS4O9pmrzQaN1rqU7EEEOoVqgU=; b=0BiDpTURI0B4nrMOTPk84/5NAH CV4Jgb54W8cGO0KyKxIxmNJnXv9pSuNYru76e52IE4AXoJ1+Vz00ZD7MuWn1zMKM94fZuqcFVLxzO l3It4iACq0yQVtqp9x3iIGa4/mXQu8JXHn8p5DVZUd7v/pZBCH/HoOuRZ2gOI0TwDaZRlcNwg3GGh 9FPMkdC8WNOfQD6djWTNGgFph9y6VFuTZdQZbaP+tSHYkHKFoXIpZKO9/svSXN14bit2zCYOIwqBf bzXuak0de05YHKKFT9cWarHrnQNfGnjSRVDjO2kyNCVkOVutfOw7HqMlrmRz0VtViBDYz4IlEdtqY xthh4F+Q==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kQX4B-000088-Sp; Thu, 08 Oct 2020 14:38:47 +0000 Received: from mail-wm1-x341.google.com ([2a00:1450:4864:20::341]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kQX46-00005t-Sc for linux-arm-kernel@lists.infradead.org; Thu, 08 Oct 2020 14:38:43 +0000 Received: by mail-wm1-x341.google.com with SMTP id q5so6771290wmq.0 for ; Thu, 08 Oct 2020 07:38:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=D+9J/HNIjhjYiMOlJN5FLKO8xUVilMJPpBLCBZbGWLw=; b=UMIv7thr4BJdqGPaaDxbj0L5JfqV94gw26TUdeeoEdsuDXaBmIO255ZX0YboaE+xHJ FvokadyGOOTDiVLwu78QN++GEmauP0HHBRN9x2hP3k0PWX4p8XklfbICE4jWIMvhpOKU /KSZAaWlMfz3y3Pcf0Qs451JurQqIFbds4etRxXChNl1oL4WuIu/I0UTciUZ8temcOA/ Sn02bcEnkqBjV9MRvpUS23OgjbkDq0y+dIpRYR50X77jNk25NNXhyAaejXu8bVMaJFQv obUQr47YMd+zKjHLcnd+fnR/ifsxymAHbeOy74d6PTLQK38nLR4//al4qtN3QOphZNKO lYQw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=D+9J/HNIjhjYiMOlJN5FLKO8xUVilMJPpBLCBZbGWLw=; b=RTjGs/IpiLHw7lzXA5ljFUBlVc7H8gamxBosNJi428QRyWLG9e7B9FfAPWgFxXQ6Bo Adh11VhHn9WvMcci4CQYVoDKCXXzKYpxSZTerJzCd+N0PsBavJaHL6ezEC90z6TlR7Y1 4HJoaWG12Ex/vj3ExauTAkkjDR6YnlNXh47b+Kb3e6n0sLeHspfOJcWDYJW1+siUTdWL XZN+QFcIf5FpIPrTNcZCRVlgj3V9Qh0LtI4kGa3ZMdG/9xnu1Ua7+q1SRAfgYC2aWML1 Cct/8zwKBhBa+MA/e1TdzlI0VA8los48xKczoBAkRJi12R3sWrDaIr2SjNCy8/Fdy8HZ Fxaw== X-Gm-Message-State: AOAM532JWhDQiiQZ+qPwdtfa/CQcFegYLbRlac+uBf4o/1eH++eoqyQQ ab23K1fQ4Q169XXHw8KSX3H7YA== X-Google-Smtp-Source: ABdhPJzKkZD13r1AHLAaKgwoB0i221mwt28cGazWbJRZz/jY0hD+8bq6hEB2H4HDDpiro84/lG9EFA== X-Received: by 2002:a7b:c0d8:: with SMTP id s24mr8985143wmh.156.1602167921940; Thu, 08 Oct 2020 07:38:41 -0700 (PDT) Received: from lmecxl0524.lme.st.com ([2a04:cec0:11c8:908d:6533:9100:d943:8b22]) by smtp.gmail.com with ESMTPSA id y14sm6926942wma.48.2020.10.08.07.38.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 08 Oct 2020 07:38:41 -0700 (PDT) From: Etienne Carriere To: linux-kernel@vger.kernel.org Subject: [PATCH 2/5] firmware: arm_scmi: fix transfer missing re-initialization Date: Thu, 8 Oct 2020 16:37:19 +0200 Message-Id: <20201008143722.21888-2-etienne.carriere@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20201008143722.21888-1-etienne.carriere@linaro.org> References: <20201008143722.21888-1-etienne.carriere@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20201008_103842_933985_0EF2A7F1 X-CRM114-Status: GOOD ( 15.56 ) X-Spam-Score: -0.2 (/) X-Spam-Report: SpamAssassin version 3.4.4 on merlin.infradead.org summary: Content analysis details: (-0.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2a00:1450:4864:20:0:0:0:341 listed in] [list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain 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: Souvik Chakravarty , linux-arm-kernel@lists.infradead.org, Sudeep Holla , Vincent Guittot , Etienne Carriere , Cristian Marussi MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org Implement helper function scmi_do_xfer_again() to process consecutive transfers that are initialized only once with scmi_xfer_get_init() and hence get the pool completion and responses message length not reloaded regarding last completed transfer. Signed-off-by: Etienne Carriere --- drivers/firmware/arm_scmi/base.c | 2 +- drivers/firmware/arm_scmi/clock.c | 2 +- drivers/firmware/arm_scmi/common.h | 2 ++ drivers/firmware/arm_scmi/driver.c | 10 ++++++++++ drivers/firmware/arm_scmi/perf.c | 2 +- drivers/firmware/arm_scmi/sensors.c | 2 +- 6 files changed, 16 insertions(+), 4 deletions(-) diff --git a/drivers/firmware/arm_scmi/base.c b/drivers/firmware/arm_scmi/base.c index 9853bd3c4d45..508f214baa1b 100644 --- a/drivers/firmware/arm_scmi/base.c +++ b/drivers/firmware/arm_scmi/base.c @@ -183,7 +183,7 @@ static int scmi_base_implementation_list_get(const struct scmi_handle *handle, /* Set the number of protocols to be skipped/already read */ *num_skip = cpu_to_le32(tot_num_ret); - ret = scmi_do_xfer(handle, t); + ret = scmi_do_xfer_again(handle, t); if (ret) break; diff --git a/drivers/firmware/arm_scmi/clock.c b/drivers/firmware/arm_scmi/clock.c index c1cfe3ee3d55..9bb54c1a8d55 100644 --- a/drivers/firmware/arm_scmi/clock.c +++ b/drivers/firmware/arm_scmi/clock.c @@ -161,7 +161,7 @@ scmi_clock_describe_rates_get(const struct scmi_handle *handle, u32 clk_id, /* Set the number of rates to be skipped/already read */ clk_desc->rate_index = cpu_to_le32(tot_rate_cnt); - ret = scmi_do_xfer(handle, t); + ret = scmi_do_xfer_again(handle, t); if (ret) goto err; diff --git a/drivers/firmware/arm_scmi/common.h b/drivers/firmware/arm_scmi/common.h index 37fb583f1bf5..6d4eea7b0f3e 100644 --- a/drivers/firmware/arm_scmi/common.h +++ b/drivers/firmware/arm_scmi/common.h @@ -143,6 +143,8 @@ struct scmi_xfer { void scmi_xfer_put(const struct scmi_handle *h, struct scmi_xfer *xfer); int scmi_do_xfer(const struct scmi_handle *h, struct scmi_xfer *xfer); +int scmi_do_xfer_again(const struct scmi_handle *handle, + struct scmi_xfer *xfer); int scmi_do_xfer_with_response(const struct scmi_handle *h, struct scmi_xfer *xfer); int scmi_xfer_get_init(const struct scmi_handle *h, u8 msg_id, u8 prot_id, diff --git a/drivers/firmware/arm_scmi/driver.c b/drivers/firmware/arm_scmi/driver.c index c5dea87edf8f..887cb8249db0 100644 --- a/drivers/firmware/arm_scmi/driver.c +++ b/drivers/firmware/arm_scmi/driver.c @@ -402,6 +402,16 @@ int scmi_do_xfer(const struct scmi_handle *handle, struct scmi_xfer *xfer) return ret; } +int scmi_do_xfer_again(const struct scmi_handle *handle, struct scmi_xfer *xfer) +{ + struct scmi_info *info = handle_to_scmi_info(handle); + + xfer->rx.len = info->desc->max_msg_size; + xfer->hdr.poll_completion = false; + + return scmi_do_xfer(handle, xfer); +} + #define SCMI_MAX_RESPONSE_TIMEOUT (2 * MSEC_PER_SEC) /** diff --git a/drivers/firmware/arm_scmi/perf.c b/drivers/firmware/arm_scmi/perf.c index ed475b40bd08..66d3d8459936 100644 --- a/drivers/firmware/arm_scmi/perf.c +++ b/drivers/firmware/arm_scmi/perf.c @@ -281,7 +281,7 @@ scmi_perf_describe_levels_get(const struct scmi_handle *handle, u32 domain, /* Set the number of OPPs to be skipped/already read */ dom_info->level_index = cpu_to_le32(tot_opp_cnt); - ret = scmi_do_xfer(handle, t); + ret = scmi_do_xfer_again(handle, t); if (ret) break; diff --git a/drivers/firmware/arm_scmi/sensors.c b/drivers/firmware/arm_scmi/sensors.c index 9703cf6356a0..97addcf828a3 100644 --- a/drivers/firmware/arm_scmi/sensors.c +++ b/drivers/firmware/arm_scmi/sensors.c @@ -134,7 +134,7 @@ static int scmi_sensor_description_get(const struct scmi_handle *handle, /* Set the number of sensors to be skipped/already read */ put_unaligned_le32(desc_index, t->tx.buf); - ret = scmi_do_xfer(handle, t); + ret = scmi_do_xfer_again(handle, t); if (ret) break;