From: Cristian Marussi <cristian.marussi@arm.com>
To: Florian Fainelli <florian.fainelli@broadcom.com>
Cc: Cristian Marussi <cristian.marussi@arm.com>,
linux-kernel@vger.kernel.org,
linux-arm-kernel@lists.infradead.org, arm-scmi@vger.kernel.org,
sudeep.holla@arm.com, james.quinlan@broadcom.com,
vincent.guittot@linaro.org, etienne.carriere@st.com,
peng.fan@oss.nxp.com, michal.simek@amd.com,
quic_sibis@quicinc.com, quic_nkela@quicinc.com,
dan.carpenter@linaro.org
Subject: Re: [PATCH v2 1/5] firmware: arm_scmi: Account for SHMEM memory overhead
Date: Tue, 22 Oct 2024 10:18:34 +0100 [thread overview]
Message-ID: <Zxdt6vLeExBs744x@pluto> (raw)
In-Reply-To: <5d6d545d-b6bc-4b37-b324-a664e4685100@broadcom.com>
On Mon, Oct 21, 2024 at 10:11:44AM -0700, Florian Fainelli wrote:
> On 10/21/24 10:07, Cristian Marussi wrote:
> > Transports using shared memory have to consider the overhead due to the
> > layout area when determining the area effectively available for messages.
> >
Hi Florian,
thanks for having a look.
> > Till now, such definitions were ambiguos across the SCMI stack and the
> > overhead layout area was not considered at all.
> >
> > Add proper checks in the shmem layer to validate the provided max_msg_size
> > against the effectively available memory area, less the layout.
> >
> > Signed-off-by: Cristian Marussi <cristian.marussi@arm.com>
> > ---
> > Note that as a consequence of this fix the default max_msg_size is reduced
> > to 104 bytes for shmem-based transports, in order to fit into the most
> > common implementations where the whole shmem area is sized at 128,
> > including the 24 bytes of standard layout area.
> >
> > This should have NO bad side effects, since the current maximum payload
> > size of any messages across any protocol (including all the known vendor
> > ones) is 76 bytes.
>
> This looks good to me, just a small nit/suggestion:
>
> [snip]
>
> > size = resource_size(res);
> > + if (cinfo->max_msg_size + SCMI_SHMEM_LAYOUT_OVERHEAD > size) {
> > + dev_err(dev, "misconfigured SCMI shared memory\n");
> > + return IOMEM_ERR_PTR(-ENOSPC);
> > + }
> > +
> > addr = devm_ioremap(dev, res->start, size);
> > if (!addr) {
> > dev_err(dev, "failed to ioremap SCMI %s shared memory\n", desc);
> > diff --git a/drivers/firmware/arm_scmi/transports/mailbox.c b/drivers/firmware/arm_scmi/transports/mailbox.c
> > index e7efa3376aae..4e0396250ad0 100644
> > --- a/drivers/firmware/arm_scmi/transports/mailbox.c
> > +++ b/drivers/firmware/arm_scmi/transports/mailbox.c
> > @@ -16,6 +16,8 @@
> > #include "../common.h"
> > +#define SCMI_MAILBOX_MAX_MSG_SIZE 104
>
> This IMHO, could be named SCMI_SHMEM_MAX_PAYLOAD_SIZE and used across all 3
> transports that are loosely SHMEM-based?
Yes indeed, just I was not so sure we want to stick to the same default
across different transports that are based on SHMEM....even though they
are in fact the same as of now, and anyway modifiable via DT if his
series goes in...I'll see what Sudeep prefers in these regards.
Thanks,
Cristian
next prev parent reply other threads:[~2024-10-22 9:38 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-10-21 17:07 [PATCH v2 0/5] Expose SCMI Transport properties Cristian Marussi
2024-10-21 17:07 ` [PATCH v2 1/5] firmware: arm_scmi: Account for SHMEM memory overhead Cristian Marussi
2024-10-21 17:11 ` Florian Fainelli
2024-10-22 9:18 ` Cristian Marussi [this message]
2024-10-21 17:07 ` [PATCH v2 2/5] firmware: arm_scmi: Calculate virtio PDU max size dynamically Cristian Marussi
2024-10-21 17:19 ` Florian Fainelli
2024-10-21 17:07 ` [PATCH v2 3/5] dt-bindings: firmware: arm,scmi: Introduce more transport properties Cristian Marussi
2024-10-24 15:07 ` Rob Herring (Arm)
2024-10-21 17:07 ` [PATCH v2 4/5] firmware: arm_scmi: Use max_msg and max_msg_size devicetree properties Cristian Marussi
2024-10-21 17:07 ` [PATCH v2 5/5] firmware: arm_scmi: Relocate atomic_threshold to scmi_desc Cristian Marussi
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=Zxdt6vLeExBs744x@pluto \
--to=cristian.marussi@arm.com \
--cc=arm-scmi@vger.kernel.org \
--cc=dan.carpenter@linaro.org \
--cc=etienne.carriere@st.com \
--cc=florian.fainelli@broadcom.com \
--cc=james.quinlan@broadcom.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=michal.simek@amd.com \
--cc=peng.fan@oss.nxp.com \
--cc=quic_nkela@quicinc.com \
--cc=quic_sibis@quicinc.com \
--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).