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=-16.2 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,MENTIONS_GIT_HOSTING,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED,USER_AGENT_SANE_1 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 53FA6C433E7 for ; Tue, 13 Oct 2020 10:17:38 +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 0234220708 for ; Tue, 13 Oct 2020 10:17:37 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="kcac7ul9" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 0234220708 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=arm.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+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=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: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=IQtD3GucjhxFt1fMSIa6VJgTVDvJ+NIUqmqrzmP/TwM=; b=kcac7ul90ufMScZf6MTx2grF+ KXGr/UYnM6Tv1wJxlQhFwxurQPJ0VuSTmVriItZmy/5vUi3D59NrNnGjvjfQYwCE6pvDswhj1hUru S8u8Dtfa9eGQ8aD1ibqS059hpl5r09kyTtuwYsLDAnOHQKRGNeWhX95HdmEpJ7I8tc4v5zrCfctaz dmRYh1Qt9bcXVXmrwudZYdj6hn6AYcE1ktJmop3aP5rjJLyjTB3rRv2q0h6s7xeR9RrZSw4yBONfY qXWPta+PZR+aancCBDp6TgH1UBCkdmt7QpLiIzjpTbIvpF+PJzD8BCqSyN1uQ0oY4dE9XcRm8iCLR ZR0RnpFtQ==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kSHLt-0000fX-O9; Tue, 13 Oct 2020 10:16:17 +0000 Received: from foss.arm.com ([217.140.110.172]) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kSHLq-0000eO-H1 for linux-arm-kernel@lists.infradead.org; Tue, 13 Oct 2020 10:16:15 +0000 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 93A3A31B; Tue, 13 Oct 2020 03:16:11 -0700 (PDT) Received: from bogus (unknown [10.57.16.122]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 4FFBA3F66B; Tue, 13 Oct 2020 03:16:10 -0700 (PDT) Date: Tue, 13 Oct 2020 11:16:04 +0100 From: Sudeep Holla To: Etienne Carriere Subject: Re: [PATCH] firmware: arm_scmi: Add missing Rx size re-initialisation Message-ID: <20201013101604.GA7040@bogus> References: <20201008143722.21888-2-etienne.carriere@linaro.org> <20201012141746.32575-1-sudeep.holla@arm.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.9.4 (2018-02-28) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20201013_061614_689032_418DA463 X-CRM114-Status: GOOD ( 30.62 ) 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 , Vincent Guittot , Cristian Marussi , linux-kernel@vger.kernel.org, "moderated list:ARM/FREESCALE IMX / MXC ARM ARCHITECTURE" Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Tue, Oct 13, 2020 at 11:58:09AM +0200, Etienne Carriere wrote: > On Mon, 12 Oct 2020 at 16:17, Sudeep Holla wrote: > > > > Few commands provide the list of description partially and require > > to be called consecutively until all the descriptors are fetched > > completely. In such cases, we don't release the buffers and reuse > > them for consecutive transmits. > > > > However, currently we don't reset the Rx size which will be set as > > per the response for the last transmit. This may result in incorrect > > response size being interpretted as the firmware may repond with size > > greater than the one set but we read only upto the size set by previous > > response. > > > > Let us reset the receive buffer size to max possible in such cases as > > we don't know the exact size of the response. > > > > Fixes: b6f20ff8bd94 ("firmware: arm_scmi: add common infrastructure and support for base protocol") > > Reported-by: Etienne Carriere > > Signed-off-by: Sudeep Holla > > --- > > drivers/firmware/arm_scmi/base.c | 2 ++ > > drivers/firmware/arm_scmi/clock.c | 2 ++ > > drivers/firmware/arm_scmi/common.h | 8 ++++++++ > > drivers/firmware/arm_scmi/perf.c | 2 ++ > > drivers/firmware/arm_scmi/sensors.c | 2 ++ > > 5 files changed, 16 insertions(+) > > > > Hi Etienne, > > > > I reworked this in a different way and hence dropped your authorship and added > > reported by. If you prefer I can attribute you as author. I want to push > > 2,4,5/5 as fixes and hence the rush. > > Hi Sudeep, > > Tags are fine like that. > As for the content, it looks good to me. Thanks. > When trying to apply this, I failed, but I guess I'm not testing over > the same kernel tree/branch as you. Ah OK. I wasn't sure if we had touch code around these recently. Anyway, I have all these on my for-next/scmi[1][2] -- Regards, Sudeep [1] https://git.kernel.org/sudeep.holla/linux/h/for-next/scmi [2] git://git.kernel.org/pub/scm/linux/kernel/git/sudeep.holla/linux.git for-next/scmi > All in one, I am really fine with this change, I think it does the job > > Regards, > Etienne > > > > > Regards, > > Sudeep > > > > diff --git a/drivers/firmware/arm_scmi/base.c b/drivers/firmware/arm_scmi/base.c > > index 9853bd3c4d45..017e5d8bd869 100644 > > --- a/drivers/firmware/arm_scmi/base.c > > +++ b/drivers/firmware/arm_scmi/base.c > > @@ -197,6 +197,8 @@ static int scmi_base_implementation_list_get(const struct scmi_handle *handle, > > protocols_imp[tot_num_ret + loop] = *(list + loop); > > > > tot_num_ret += loop_num_ret; > > + > > + scmi_reset_rx_to_maxsz(handle, t); > > } while (loop_num_ret); > > > > scmi_xfer_put(handle, t); > > diff --git a/drivers/firmware/arm_scmi/clock.c b/drivers/firmware/arm_scmi/clock.c > > index c1cfe3ee3d55..4645677d86f1 100644 > > --- a/drivers/firmware/arm_scmi/clock.c > > +++ b/drivers/firmware/arm_scmi/clock.c > > @@ -192,6 +192,8 @@ scmi_clock_describe_rates_get(const struct scmi_handle *handle, u32 clk_id, > > } > > > > tot_rate_cnt += num_returned; > > + > > + scmi_reset_rx_to_maxsz(handle, t); > > /* > > * check for both returned and remaining to avoid infinite > > * loop due to buggy firmware > > diff --git a/drivers/firmware/arm_scmi/common.h b/drivers/firmware/arm_scmi/common.h > > index 37fb583f1bf5..a3f1bc44b1de 100644 > > --- a/drivers/firmware/arm_scmi/common.h > > +++ b/drivers/firmware/arm_scmi/common.h > > @@ -245,6 +245,14 @@ extern const struct scmi_desc scmi_mailbox_desc; > > extern const struct scmi_desc scmi_smc_desc; > > #endif > > > > +static inline void scmi_reset_rx_to_maxsz(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; > > +} > > + > > void scmi_rx_callback(struct scmi_chan_info *cinfo, u32 msg_hdr); > > void scmi_free_channel(struct scmi_chan_info *cinfo, struct idr *idr, int id); > > > > diff --git a/drivers/firmware/arm_scmi/perf.c b/drivers/firmware/arm_scmi/perf.c > > index ed475b40bd08..82fb3babff72 100644 > > --- a/drivers/firmware/arm_scmi/perf.c > > +++ b/drivers/firmware/arm_scmi/perf.c > > @@ -304,6 +304,8 @@ scmi_perf_describe_levels_get(const struct scmi_handle *handle, u32 domain, > > } > > > > tot_opp_cnt += num_returned; > > + > > + scmi_reset_rx_to_maxsz(handle, t); > > /* > > * check for both returned and remaining to avoid infinite > > * loop due to buggy firmware > > diff --git a/drivers/firmware/arm_scmi/sensors.c b/drivers/firmware/arm_scmi/sensors.c > > index 9703cf6356a0..b4232d611033 100644 > > --- a/drivers/firmware/arm_scmi/sensors.c > > +++ b/drivers/firmware/arm_scmi/sensors.c > > @@ -166,6 +166,8 @@ static int scmi_sensor_description_get(const struct scmi_handle *handle, > > } > > > > desc_index += num_returned; > > + > > + scmi_reset_rx_to_maxsz(handle, t); > > /* > > * check for both returned and remaining to avoid infinite > > * loop due to buggy firmware > > -- > > 2.17.1 > > _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel