From: Etienne Carriere <etienne.carriere@linaro.org>
To: Sudeep Holla <sudeep.holla@arm.com>
Cc: linux-kernel@vger.kernel.org,
"moderated list:ARM/FREESCALE IMX / MXC ARM ARCHITECTURE"
<linux-arm-kernel@lists.infradead.org>,
Cristian Marussi <cristian.marussi@arm.com>,
Vincent Guittot <vincent.guittot@linaro.org>,
Souvik Chakravarty <Souvik.Chakravarty@arm.com>
Subject: Re: [PATCH] firmware: arm_scmi: Add missing Rx size re-initialisation
Date: Tue, 13 Oct 2020 11:58:09 +0200 [thread overview]
Message-ID: <CAN5uoS_GHXv-RHJACJMJqN_xRSSWuv=mTPW_aHZv5U6PjK16xg@mail.gmail.com> (raw)
In-Reply-To: <20201012141746.32575-1-sudeep.holla@arm.com>
On Mon, 12 Oct 2020 at 16:17, Sudeep Holla <sudeep.holla@arm.com> 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 <etienne.carriere@linaro.org>
> Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>
> ---
> 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.
When trying to apply this, I failed, but I guess I'm not testing over
the same kernel tree/branch as you.
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
>
next prev parent reply other threads:[~2020-10-13 9:58 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-10-08 14:37 [PATCH 1/5] firmware: arm_scmi: always initialize protocols Etienne Carriere
2020-10-08 14:37 ` [PATCH 2/5] firmware: arm_scmi: fix transfer missing re-initialization Etienne Carriere
2020-10-08 21:18 ` Sudeep Holla
2020-10-09 12:38 ` Etienne Carriere
2020-10-09 15:20 ` Sudeep Holla
2020-10-12 14:17 ` [PATCH] firmware: arm_scmi: Add missing Rx size re-initialisation Sudeep Holla
2020-10-13 9:58 ` Etienne Carriere [this message]
2020-10-13 10:16 ` Sudeep Holla
2020-10-13 10:50 ` Sudeep Holla
2020-10-08 14:37 ` [PATCH 3/5] firmware: arm_scmi: add config dependency for smc transport Etienne Carriere
2020-10-08 21:08 ` Sudeep Holla
2020-10-09 12:33 ` Etienne Carriere
2020-10-09 15:58 ` Sudeep Holla
2020-10-12 10:11 ` Etienne Carriere
2020-10-08 14:37 ` [PATCH 4/5] firmware: arm_scmi: smc transport supports multi-message pool Etienne Carriere
2020-10-08 21:11 ` Sudeep Holla
2020-10-09 12:43 ` Etienne Carriere
2020-10-09 15:17 ` Sudeep Holla
2020-10-12 8:57 ` Sudeep Holla
2020-10-12 9:12 ` Etienne Carriere
2020-10-08 14:37 ` [PATCH 5/5] firmware: arm_scmi: fix ARCH_COLD_RESET Etienne Carriere
2020-10-08 21:16 ` Sudeep Holla
2020-10-08 19:17 ` [PATCH 1/5] firmware: arm_scmi: always initialize protocols Sudeep Holla
2020-10-09 12:31 ` Etienne Carriere
2020-10-09 16:31 ` Cristian Marussi
2020-10-12 9:32 ` Sudeep Holla
2020-10-13 10:45 ` Sudeep Holla
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='CAN5uoS_GHXv-RHJACJMJqN_xRSSWuv=mTPW_aHZv5U6PjK16xg@mail.gmail.com' \
--to=etienne.carriere@linaro.org \
--cc=Souvik.Chakravarty@arm.com \
--cc=cristian.marussi@arm.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=sudeep.holla@arm.com \
--cc=vincent.guittot@linaro.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).