linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mailbox: add tx_prepare client callback
@ 2014-11-11 16:04 Sudeep Holla
  2014-11-11 17:53 ` Jassi Brar
  2014-11-11 18:33 ` [PATCH v2] " Sudeep Holla
  0 siblings, 2 replies; 5+ messages in thread
From: Sudeep Holla @ 2014-11-11 16:04 UTC (permalink / raw)
  To: linux-kernel; +Cc: Sudeep Holla, Jassi Brar, Arnd Bergmann

If the mailbox controller expects the payload is in place before
initiating the transmit, then it's impossible to reuse the list
maintained by core mailbox code currently. Maintaining another list
for sending the message in the controller seems totally unnecessary
as core mailbox library already provides that feature.

This patch introduces tx_prepare callback in mbox_client which
can be used by the core mailbox library before initiating the
transaction through mbox->ops->send_data. The client driver can
implement this callback to ensure the payload is copied to the
shared memory.

Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>
Cc: Jassi Brar <jaswinder.singh@linaro.org>
Cc: Arnd Bergmann <arnd@arndb.de>
---
 drivers/mailbox/mailbox.c      | 2 ++
 include/linux/mailbox_client.h | 1 +
 2 files changed, 3 insertions(+)

diff --git a/drivers/mailbox/mailbox.c b/drivers/mailbox/mailbox.c
index afcb430508ec..4b4044f47b45 100644
--- a/drivers/mailbox/mailbox.c
+++ b/drivers/mailbox/mailbox.c
@@ -76,6 +76,8 @@ static void msg_submit(struct mbox_chan *chan)
 
 	data = chan->msg_data[idx];
 
+	if (chan->cl->tx_prepare)
+		chan->cl->tx_prepare(chan->cl, data);
 	/* Try to submit a message to the MBOX controller */
 	err = chan->mbox->ops->send_data(chan, data);
 	if (!err) {
diff --git a/include/linux/mailbox_client.h b/include/linux/mailbox_client.h
index 307d9cab2026..5a1a6db63e96 100644
--- a/include/linux/mailbox_client.h
+++ b/include/linux/mailbox_client.h
@@ -34,6 +34,7 @@ struct mbox_client {
 	bool knows_txdone;
 
 	void (*rx_callback)(struct mbox_client *cl, void *mssg);
+	void (*tx_prepare)(struct mbox_client *cl, void *mssg);
 	void (*tx_done)(struct mbox_client *cl, void *mssg, int r);
 };
 
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] mailbox: add tx_prepare client callback
  2014-11-11 16:04 [PATCH] mailbox: add tx_prepare client callback Sudeep Holla
@ 2014-11-11 17:53 ` Jassi Brar
  2014-11-11 18:08   ` Sudeep Holla
  2014-11-11 18:33 ` [PATCH v2] " Sudeep Holla
  1 sibling, 1 reply; 5+ messages in thread
From: Jassi Brar @ 2014-11-11 17:53 UTC (permalink / raw)
  To: Sudeep Holla; +Cc: lkml, Arnd Bergmann

On 11 November 2014 21:34, Sudeep Holla <sudeep.holla@arm.com> wrote:
> If the mailbox controller expects the payload is in place before
> initiating the transmit, then it's impossible to reuse the list
> maintained by core mailbox code currently. Maintaining another list
> for sending the message in the controller seems totally unnecessary
> as core mailbox library already provides that feature.
>
> This patch introduces tx_prepare callback in mbox_client which
> can be used by the core mailbox library before initiating the
> transaction through mbox->ops->send_data. The client driver can
> implement this callback to ensure the payload is copied to the
> shared memory.
>
> Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>
> Cc: Jassi Brar <jaswinder.singh@linaro.org>
> Cc: Arnd Bergmann <arnd@arndb.de>
> ---
>  drivers/mailbox/mailbox.c      | 2 ++
>  include/linux/mailbox_client.h | 1 +
>  2 files changed, 3 insertions(+)
>
> diff --git a/drivers/mailbox/mailbox.c b/drivers/mailbox/mailbox.c
> index afcb430508ec..4b4044f47b45 100644
> --- a/drivers/mailbox/mailbox.c
> +++ b/drivers/mailbox/mailbox.c
> @@ -76,6 +76,8 @@ static void msg_submit(struct mbox_chan *chan)
>
>         data = chan->msg_data[idx];
>
> +       if (chan->cl->tx_prepare)
> +               chan->cl->tx_prepare(chan->cl, data);
>         /* Try to submit a message to the MBOX controller */
>         err = chan->mbox->ops->send_data(chan, data);
>         if (!err) {
> diff --git a/include/linux/mailbox_client.h b/include/linux/mailbox_client.h
> index 307d9cab2026..5a1a6db63e96 100644
> --- a/include/linux/mailbox_client.h
> +++ b/include/linux/mailbox_client.h
> @@ -34,6 +34,7 @@ struct mbox_client {
>         bool knows_txdone;
>
>         void (*rx_callback)(struct mbox_client *cl, void *mssg);
> +       void (*tx_prepare)(struct mbox_client *cl, void *mssg);
>         void (*tx_done)(struct mbox_client *cl, void *mssg, int r);
>  };
>
Please add some documentation for tx_prepare() as well.

Thanks
Jassi

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] mailbox: add tx_prepare client callback
  2014-11-11 17:53 ` Jassi Brar
@ 2014-11-11 18:08   ` Sudeep Holla
  0 siblings, 0 replies; 5+ messages in thread
From: Sudeep Holla @ 2014-11-11 18:08 UTC (permalink / raw)
  To: Jassi Brar; +Cc: Sudeep Holla, lkml, Arnd Bergmann



On 11/11/14 17:53, Jassi Brar wrote:
> On 11 November 2014 21:34, Sudeep Holla <sudeep.holla@arm.com> wrote:
>> If the mailbox controller expects the payload is in place before
>> initiating the transmit, then it's impossible to reuse the list
>> maintained by core mailbox code currently. Maintaining another list
>> for sending the message in the controller seems totally unnecessary
>> as core mailbox library already provides that feature.
>>
>> This patch introduces tx_prepare callback in mbox_client which
>> can be used by the core mailbox library before initiating the
>> transaction through mbox->ops->send_data. The client driver can
>> implement this callback to ensure the payload is copied to the
>> shared memory.
>>
>> Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>
>> Cc: Jassi Brar <jaswinder.singh@linaro.org>
>> Cc: Arnd Bergmann <arnd@arndb.de>
>> ---
>>   drivers/mailbox/mailbox.c      | 2 ++
>>   include/linux/mailbox_client.h | 1 +
>>   2 files changed, 3 insertions(+)
>>
>> diff --git a/drivers/mailbox/mailbox.c b/drivers/mailbox/mailbox.c
>> index afcb430508ec..4b4044f47b45 100644
>> --- a/drivers/mailbox/mailbox.c
>> +++ b/drivers/mailbox/mailbox.c
>> @@ -76,6 +76,8 @@ static void msg_submit(struct mbox_chan *chan)
>>
>>          data = chan->msg_data[idx];
>>
>> +       if (chan->cl->tx_prepare)
>> +               chan->cl->tx_prepare(chan->cl, data);
>>          /* Try to submit a message to the MBOX controller */
>>          err = chan->mbox->ops->send_data(chan, data);
>>          if (!err) {
>> diff --git a/include/linux/mailbox_client.h b/include/linux/mailbox_client.h
>> index 307d9cab2026..5a1a6db63e96 100644
>> --- a/include/linux/mailbox_client.h
>> +++ b/include/linux/mailbox_client.h
>> @@ -34,6 +34,7 @@ struct mbox_client {
>>          bool knows_txdone;
>>
>>          void (*rx_callback)(struct mbox_client *cl, void *mssg);
>> +       void (*tx_prepare)(struct mbox_client *cl, void *mssg);
>>          void (*tx_done)(struct mbox_client *cl, void *mssg, int r);
>>   };
>>
> Please add some documentation for tx_prepare() as well.
>

Ah, sorry for missing that, will add and resend.

Regards,
Sudeep


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH v2] mailbox: add tx_prepare client callback
  2014-11-11 16:04 [PATCH] mailbox: add tx_prepare client callback Sudeep Holla
  2014-11-11 17:53 ` Jassi Brar
@ 2014-11-11 18:33 ` Sudeep Holla
  2014-11-27  7:31   ` Jassi Brar
  1 sibling, 1 reply; 5+ messages in thread
From: Sudeep Holla @ 2014-11-11 18:33 UTC (permalink / raw)
  To: linux-kernel; +Cc: Sudeep Holla, Jassi Brar, Arnd Bergmann

If the mailbox controller expects the payload is in place before
initiating the transmit, then it's impossible to reuse the list
maintained by core mailbox code currently. Maintaining another list
for sending the message in the controller seems totally unnecessary
as core mailbox library already provides that feature.

This patch introduces tx_prepare callback in mbox_client which
can be used by the core mailbox library before initiating the
transaction through mbox->ops->send_data. The client driver can
implement this callback to ensure the payload is copied to the
shared memory.

Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>
Cc: Jassi Brar <jaswinder.singh@linaro.org>
Cc: Arnd Bergmann <arnd@arndb.de>
---
 drivers/mailbox/mailbox.c      | 2 ++
 include/linux/mailbox_client.h | 3 +++
 2 files changed, 5 insertions(+)

v1->v2: Added missing documentation for tx_prepare callback

diff --git a/drivers/mailbox/mailbox.c b/drivers/mailbox/mailbox.c
index 17e9e4afc528..06b27e2854a3 100644
--- a/drivers/mailbox/mailbox.c
+++ b/drivers/mailbox/mailbox.c
@@ -74,6 +74,8 @@ static void msg_submit(struct mbox_chan *chan)
 
 	data = chan->msg_data[idx];
 
+	if (chan->cl->tx_prepare)
+		chan->cl->tx_prepare(chan->cl, data);
 	/* Try to submit a message to the MBOX controller */
 	err = chan->mbox->ops->send_data(chan, data);
 	if (!err) {
diff --git a/include/linux/mailbox_client.h b/include/linux/mailbox_client.h
index 307d9cab2026..1726ccbd8009 100644
--- a/include/linux/mailbox_client.h
+++ b/include/linux/mailbox_client.h
@@ -25,6 +25,8 @@ struct mbox_chan;
  *			if the client receives some ACK packet for transmission.
  *			Unused if the controller already has TX_Done/RTR IRQ.
  * @rx_callback:	Atomic callback to provide client the data received
+ * @tx_prepare: 	Atomic callback to ask client to prepare the payload
+ *			before initiating the transmission if required.
  * @tx_done:		Atomic callback to tell client of data transmission
  */
 struct mbox_client {
@@ -34,6 +36,7 @@ struct mbox_client {
 	bool knows_txdone;
 
 	void (*rx_callback)(struct mbox_client *cl, void *mssg);
+	void (*tx_prepare)(struct mbox_client *cl, void *mssg);
 	void (*tx_done)(struct mbox_client *cl, void *mssg, int r);
 };
 
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH v2] mailbox: add tx_prepare client callback
  2014-11-11 18:33 ` [PATCH v2] " Sudeep Holla
@ 2014-11-27  7:31   ` Jassi Brar
  0 siblings, 0 replies; 5+ messages in thread
From: Jassi Brar @ 2014-11-27  7:31 UTC (permalink / raw)
  To: Sudeep Holla; +Cc: lkml, Arnd Bergmann

On 12 November 2014 at 00:03, Sudeep Holla <sudeep.holla@arm.com> wrote:
> If the mailbox controller expects the payload is in place before
> initiating the transmit, then it's impossible to reuse the list
> maintained by core mailbox code currently. Maintaining another list
> for sending the message in the controller seems totally unnecessary
> as core mailbox library already provides that feature.
>
> This patch introduces tx_prepare callback in mbox_client which
> can be used by the core mailbox library before initiating the
> transaction through mbox->ops->send_data. The client driver can
> implement this callback to ensure the payload is copied to the
> shared memory.
>
> Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>
> Cc: Jassi Brar <jaswinder.singh@linaro.org>
> Cc: Arnd Bergmann <arnd@arndb.de>
> ---
>  drivers/mailbox/mailbox.c      | 2 ++
>  include/linux/mailbox_client.h | 3 +++
>  2 files changed, 5 insertions(+)
>
Applied to mailbox-devel, Thanks.
-Jassi

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2014-11-27  7:31 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-11-11 16:04 [PATCH] mailbox: add tx_prepare client callback Sudeep Holla
2014-11-11 17:53 ` Jassi Brar
2014-11-11 18:08   ` Sudeep Holla
2014-11-11 18:33 ` [PATCH v2] " Sudeep Holla
2014-11-27  7:31   ` Jassi Brar

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).