From: Simon Horman <horms@kernel.org>
To: Bjorn Andersson <quic_bjorande@quicinc.com>
Cc: Bjorn Andersson <andersson@kernel.org>,
Konrad Dybcio <konrad.dybcio@linaro.org>,
Chris Lew <quic_clew@quicinc.com>, Alex Elder <elder@kernel.org>,
"David S. Miller" <davem@davemloft.net>,
Jakub Kicinski <kuba@kernel.org>,
Mathieu Poirier <mathieu.poirier@linaro.org>,
netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-arm-msm@vger.kernel.org, linux-remoteproc@vger.kernel.org
Subject: Re: [PATCH 1/4] soc: qcom: aoss: Move length requirements from caller
Date: Mon, 31 Jul 2023 17:10:24 +0200 [thread overview]
Message-ID: <ZMfO4B5ZifxPv/sk@kernel.org> (raw)
In-Reply-To: <20230731041013.2950307-2-quic_bjorande@quicinc.com>
On Sun, Jul 30, 2023 at 09:10:10PM -0700, Bjorn Andersson wrote:
> The existing implementation of qmp_send() requires the caller to provide
> a buffer which is of word-aligned. The underlying reason for this is
> that message ram only supports word accesses, but pushing this
> requirement onto the clients results in the same boiler plate code
> sprinkled in every call site.
>
> By using a temporary buffer in qmp_send() we can hide the underlying
> hardware limitations from the clients and allow them to pass their
> NUL-terminates C string directly.
>
> Signed-off-by: Bjorn Andersson <quic_bjorande@quicinc.com>
> ---
> drivers/net/ipa/ipa_power.c | 2 +-
> drivers/remoteproc/qcom_q6v5.c | 2 +-
> drivers/soc/qcom/qcom_aoss.c | 25 ++++++++++++-------------
> include/linux/soc/qcom/qcom_aoss.h | 4 ++--
> 4 files changed, 16 insertions(+), 17 deletions(-)
>
> diff --git a/drivers/net/ipa/ipa_power.c b/drivers/net/ipa/ipa_power.c
> index 921eecf3eff6..26181eeed975 100644
> --- a/drivers/net/ipa/ipa_power.c
> +++ b/drivers/net/ipa/ipa_power.c
> @@ -332,7 +332,7 @@ void ipa_power_retention(struct ipa *ipa, bool enable)
>
> (void)snprintf(buf, sizeof(buf), fmt, enable ? '1' : '0');
>
> - ret = qmp_send(power->qmp, buf, sizeof(buf));
> + ret = qmp_send(power->qmp, buf);
> if (ret)
> dev_err(power->dev, "error %d sending QMP %sable request\n",
> ret, enable ? "en" : "dis");
> diff --git a/drivers/remoteproc/qcom_q6v5.c b/drivers/remoteproc/qcom_q6v5.c
> index 192c7aa0e39e..8b41a73fa4d1 100644
> --- a/drivers/remoteproc/qcom_q6v5.c
> +++ b/drivers/remoteproc/qcom_q6v5.c
> @@ -35,7 +35,7 @@ static int q6v5_load_state_toggle(struct qcom_q6v5 *q6v5, bool enable)
>
> WARN_ON(ret >= Q6V5_LOAD_STATE_MSG_LEN);
>
> - ret = qmp_send(q6v5->qmp, buf, sizeof(buf));
> + ret = qmp_send(q6v5->qmp, buf);
> if (ret)
> dev_err(q6v5->dev, "failed to toggle load state\n");
>
> diff --git a/drivers/soc/qcom/qcom_aoss.c b/drivers/soc/qcom/qcom_aoss.c
> index e376c32cc16e..5e74332515cf 100644
> --- a/drivers/soc/qcom/qcom_aoss.c
> +++ b/drivers/soc/qcom/qcom_aoss.c
> @@ -206,36 +206,35 @@ static bool qmp_message_empty(struct qmp *qmp)
> * qmp_send() - send a message to the AOSS
> * @qmp: qmp context
> * @data: message to be sent
> - * @len: length of the message
> *
> * Transmit @data to AOSS and wait for the AOSS to acknowledge the message.
> - * @len must be a multiple of 4 and not longer than the mailbox size. Access is
> - * synchronized by this implementation.
> + * data must not be longer than the mailbox size. Access is synchronized by
> + * this implementation.
> *
> * Return: 0 on success, negative errno on failure
> */
> -int qmp_send(struct qmp *qmp, const void *data, size_t len)
> +int qmp_send(struct qmp *qmp, const void *data)
> {
> long time_left;
> + char buf[QMP_MSG_LEN];
> int ret;
Hi Bjorn,
please consider preserving reverse xmas tree - longest line to shortest -
for local variable declarations in this Networking code.
char buf[QMP_MSG_LEN];
long time_left;
int ret;
...
next prev parent reply other threads:[~2023-07-31 15:11 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-07-31 4:10 [PATCH 0/4] soc: qcom: aoss: Introduce debugfs interface and cleanup things Bjorn Andersson
2023-07-31 4:10 ` [PATCH 1/4] soc: qcom: aoss: Move length requirements from caller Bjorn Andersson
2023-07-31 15:10 ` Simon Horman [this message]
2023-07-31 21:29 ` Chris Lew
2023-07-31 23:10 ` Bjorn Andersson
2023-07-31 23:46 ` Chris Lew
2023-07-31 4:10 ` [PATCH 2/4] soc: qcom: aoss: Add debugfs interface for sending messages Bjorn Andersson
2023-07-31 8:15 ` Konrad Dybcio
2023-07-31 16:01 ` Bjorn Andersson
2023-07-31 8:21 ` Andrew Lunn
2023-07-31 15:39 ` Bjorn Andersson
2023-08-01 8:45 ` Andrew Lunn
2023-07-31 15:08 ` Simon Horman
2023-08-01 4:41 ` Pavan Kondeti
2023-07-31 4:10 ` [PATCH 3/4] soc: qcom: aoss: Format string in qmp_send() Bjorn Andersson
2023-07-31 8:20 ` Konrad Dybcio
2023-07-31 4:10 ` [PATCH 4/4] soc: qcom: aoss: Tidy up qmp_send() callers Bjorn Andersson
2023-07-31 8:23 ` Konrad Dybcio
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=ZMfO4B5ZifxPv/sk@kernel.org \
--to=horms@kernel.org \
--cc=andersson@kernel.org \
--cc=davem@davemloft.net \
--cc=elder@kernel.org \
--cc=konrad.dybcio@linaro.org \
--cc=kuba@kernel.org \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-remoteproc@vger.kernel.org \
--cc=mathieu.poirier@linaro.org \
--cc=netdev@vger.kernel.org \
--cc=quic_bjorande@quicinc.com \
--cc=quic_clew@quicinc.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.