diff mbox series

[4/5] firmware: arm_scmi: smc transport supports multi-message pool

Message ID 20201008143722.21888-4-etienne.carriere@linaro.org (mailing list archive)
State New, archived
Headers show
Series [1/5] firmware: arm_scmi: always initialize protocols | expand

Commit Message

Etienne Carriere Oct. 8, 2020, 2:37 p.m. UTC
There is no reason for the smc transport to restrict itself to a 1
message pool. More can be allocated, messages are copied from/to the
shared memory only on SMC exit/entry hence SCMI driver can play with
several messages.

Use value of 20 to mimic mailbox transport implementation. Any high
value could fit. This should be something configurable.

Signed-off-by: Etienne Carriere <etienne.carriere@linaro.org>
Cc: Peng Fan <peng.fan@nxp.com>
---
 drivers/firmware/arm_scmi/smc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Sudeep Holla Oct. 8, 2020, 9:11 p.m. UTC | #1
On Thu, Oct 08, 2020 at 04:37:21PM +0200, Etienne Carriere wrote:
> There is no reason for the smc transport to restrict itself to a 1
> message pool. More can be allocated, messages are copied from/to the
> shared memory only on SMC exit/entry hence SCMI driver can play with
> several messages.
> 
> Use value of 20 to mimic mailbox transport implementation.

What is the need to mimic ?

> Any high value could fit. This should be something configurable.

Why not 10 or 100 ? I see any value other than 1 is useless as we lock
the channel in send_message and we don't maintain a queue like mailbox.
Etienne Carriere Oct. 9, 2020, 12:43 p.m. UTC | #2
On Thu, 8 Oct 2020 at 23:11, Sudeep Holla <sudeep.holla@arm.com> wrote:
>
> On Thu, Oct 08, 2020 at 04:37:21PM +0200, Etienne Carriere wrote:
> > There is no reason for the smc transport to restrict itself to a 1
> > message pool. More can be allocated, messages are copied from/to the
> > shared memory only on SMC exit/entry hence SCMI driver can play with
> > several messages.
> >
> > Use value of 20 to mimic mailbox transport implementation.
>
> What is the need to mimic ?

I had to pick a value. I can't say whether 2, 5 or 20 is better.
I looks how the mailbox transport did and used the same value
as it seemed reasonable regarding its memory cost.

>
> > Any high value could fit. This should be something configurable.
>
> Why not 10 or 100 ? I see any value other than 1 is useless as we lock
> the channel in send_message and we don't maintain a queue like mailbox.

I'll check again.
Playing with SCMI voltage domain [1], it happens that I needed several
preallocated
message buffers unless what regulators fail to be probed.

[1] https://lkml.org/lkml/2020/10/5/1341

Regards,
etienne

>
> --
> Regards,
> Sudeep
Sudeep Holla Oct. 9, 2020, 3:17 p.m. UTC | #3
On Fri, Oct 09, 2020 at 02:43:31PM +0200, Etienne Carriere wrote:
> On Thu, 8 Oct 2020 at 23:11, Sudeep Holla <sudeep.holla@arm.com> wrote:
> >
> > On Thu, Oct 08, 2020 at 04:37:21PM +0200, Etienne Carriere wrote:
> > > There is no reason for the smc transport to restrict itself to a 1
> > > message pool. More can be allocated, messages are copied from/to the
> > > shared memory only on SMC exit/entry hence SCMI driver can play with
> > > several messages.
> > >
> > > Use value of 20 to mimic mailbox transport implementation.
> >
> > What is the need to mimic ?
> 
> I had to pick a value. I can't say whether 2, 5 or 20 is better.
> I looks how the mailbox transport did and used the same value
> as it seemed reasonable regarding its memory cost.
> 
> >
> > > Any high value could fit. This should be something configurable.
> >
> > Why not 10 or 100 ? I see any value other than 1 is useless as we lock
> > the channel in send_message and we don't maintain a queue like mailbox.
> 
> I'll check again.
> Playing with SCMI voltage domain [1], it happens that I needed several
> preallocated message buffers unless what regulators fail to be probed.


I may be missing something but I can't see how, we simply block in
send_message while mailbox has a queue of 20 which is why it has 20 there.

The issue you are seeing could be different. Let me know if I am missing
something.
Sudeep Holla Oct. 12, 2020, 8:57 a.m. UTC | #4
On Fri, Oct 09, 2020 at 04:17:52PM +0100, Sudeep Holla wrote:
> On Fri, Oct 09, 2020 at 02:43:31PM +0200, Etienne Carriere wrote:
> > On Thu, 8 Oct 2020 at 23:11, Sudeep Holla <sudeep.holla@arm.com> wrote:
> > >
> > > On Thu, Oct 08, 2020 at 04:37:21PM +0200, Etienne Carriere wrote:
> > > > There is no reason for the smc transport to restrict itself to a 1
> > > > message pool. More can be allocated, messages are copied from/to the
> > > > shared memory only on SMC exit/entry hence SCMI driver can play with
> > > > several messages.
> > > >
> > > > Use value of 20 to mimic mailbox transport implementation.
> > >
> > > What is the need to mimic ?
> > 
> > I had to pick a value. I can't say whether 2, 5 or 20 is better.
> > I looks how the mailbox transport did and used the same value
> > as it seemed reasonable regarding its memory cost.
> > 
> > >
> > > > Any high value could fit. This should be something configurable.
> > >
> > > Why not 10 or 100 ? I see any value other than 1 is useless as we lock
> > > the channel in send_message and we don't maintain a queue like mailbox.
> > 
> > I'll check again.
> > Playing with SCMI voltage domain [1], it happens that I needed several
> > preallocated message buffers unless what regulators fail to be probed.
> 
> 
> I may be missing something but I can't see how, we simply block in
> send_message while mailbox has a queue of 20 which is why it has 20 there.
> 
> The issue you are seeing could be different. Let me know if I am missing
> something.
> 

OK, I gave this some thought and realise that in-order to allow multiple
requests simultaneously, we do need this value > 1. I will take this
and make some tweaks to the commit log to indicate the same.
Etienne Carriere Oct. 12, 2020, 9:12 a.m. UTC | #5
On Mon, 12 Oct 2020 at 10:57, Sudeep Holla <sudeep.holla@arm.com> wrote:
>
> On Fri, Oct 09, 2020 at 04:17:52PM +0100, Sudeep Holla wrote:
> > On Fri, Oct 09, 2020 at 02:43:31PM +0200, Etienne Carriere wrote:
> > > On Thu, 8 Oct 2020 at 23:11, Sudeep Holla <sudeep.holla@arm.com> wrote:
> > > >
> > > > On Thu, Oct 08, 2020 at 04:37:21PM +0200, Etienne Carriere wrote:
> > > > > There is no reason for the smc transport to restrict itself to a 1
> > > > > message pool. More can be allocated, messages are copied from/to the
> > > > > shared memory only on SMC exit/entry hence SCMI driver can play with
> > > > > several messages.
> > > > >
> > > > > Use value of 20 to mimic mailbox transport implementation.
> > > >
> > > > What is the need to mimic ?
> > >
> > > I had to pick a value. I can't say whether 2, 5 or 20 is better.
> > > I looks how the mailbox transport did and used the same value
> > > as it seemed reasonable regarding its memory cost.
> > >
> > > >
> > > > > Any high value could fit. This should be something configurable.
> > > >
> > > > Why not 10 or 100 ? I see any value other than 1 is useless as we lock
> > > > the channel in send_message and we don't maintain a queue like mailbox.
> > >
> > > I'll check again.
> > > Playing with SCMI voltage domain [1], it happens that I needed several
> > > preallocated message buffers unless what regulators fail to be probed.
> >
> >
> > I may be missing something but I can't see how, we simply block in
> > send_message while mailbox has a queue of 20 which is why it has 20 there.
> >
> > The issue you are seeing could be different. Let me know if I am missing
> > something.
> >
>
> OK, I gave this some thought and realise that in-order to allow multiple
> requests simultaneously, we do need this value > 1. I will take this
> and make some tweaks to the commit log to indicate the same.
>

Thanks for the feedback.
I planned to look back which value would really make sense.
Whatever, feel free to tweak or change this proposal.

Regards,
etienne

> --
> Regards,
> Sudeep
diff mbox series

Patch

diff --git a/drivers/firmware/arm_scmi/smc.c b/drivers/firmware/arm_scmi/smc.c
index 1a03c3ec0230..82a82a5dc86a 100644
--- a/drivers/firmware/arm_scmi/smc.c
+++ b/drivers/firmware/arm_scmi/smc.c
@@ -149,6 +149,6 @@  static const struct scmi_transport_ops scmi_smc_ops = {
 const struct scmi_desc scmi_smc_desc = {
 	.ops = &scmi_smc_ops,
 	.max_rx_timeout_ms = 30,
-	.max_msg = 1,
+	.max_msg = 20,
 	.max_msg_size = 128,
 };