All of lore.kernel.org
 help / color / mirror / Atom feed
From: Sudeep Holla <sudeep.holla@arm.com>
To: Jassi Brar <jassisinghbrar@gmail.com>
Cc: Sudeep Holla <sudeep.holla@arm.com>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	"linux-arm-kernel@lists.infradead.org" 
	<linux-arm-kernel@lists.infradead.org>,
	Arnd Bergmann <arnd@arndb.de>,
	Bjorn Andersson <bjorn.andersson@linaro.org>
Subject: Re: [PATCH] mailbox: add support for doorbell/signal mode controllers
Date: Thu, 2 Nov 2017 10:47:46 +0000	[thread overview]
Message-ID: <4268c9d9-dc1e-0bd7-3fac-790c2d42b54b@arm.com> (raw)
In-Reply-To: <CABb+yY16-B9vReRjLopV1RsyB8a=c5X9XaomtTj44520XrDdmA@mail.gmail.com>



On 02/11/17 02:39, Jassi Brar wrote:
> On Wed, Nov 1, 2017 at 11:45 PM, Sudeep Holla <sudeep.holla@arm.com> wrote:
>>
>>
>> On 01/11/17 18:03, Jassi Brar wrote:
>>> On Wed, Nov 1, 2017 at 10:02 PM, Sudeep Holla <sudeep.holla@arm.com> wrote:
>>>
>>>>
>>>> Such controllers don't need to transmit any data, they just transmit
>>>> the signal. In such controllers the data pointer passed to
>>>> mbox_send_message is passed to client via it's tx_prepare callback.
>>>> Controller doesn't need any data to be passed from the client.
>>>>
>>> Some controllers need a non-zero value written to a register in order
>>> to trigger the signal.
>>
>> You are right, just right non-zero or whatever controller value to
>> trigger the interrupt to remote.
>>
>>> That register is visible to the remote. While the data/packet is setup
>>> during tx_prepare() callback.
>>
>> Agreed.
>>
>>> You are overlooking this class of doorbell controllers.
>>>
>>
>> Not sure what do you mean by that ?
>>
> Such doorbell controllers can't use send_signal(chan) because they
> need that non-zero value from client to send over the shared register.
> You are assuming every protocol implements just one command.
>

No that non-zero value is not client specific, it's entirely controller
specific. Not sure why do you think I am assuming every protocol
implements just one command.

>>>>
>>>> This is rough idea I have on extending mailbox interface to support
>>>> the doorbell requirements.
>>>>
>>> What doorbell requirements does the api not support?
>>> QComm's APCS IPC is what you call a "doorbell" controller and is
>>> already supported by the API. 

After looking at this, you will see that doorbell has not data specific
to client in the above case.

	unsigned long idx = (unsigned long)chan->con_priv;

	writel(BIT(idx), apcs->reg);

So it's channel specific, same in mailbox-sti

>> Again agreed. But see below for reason to create this API.
>>
>>>> The new API send_signal will eliminate the
>>>> issue Jassi has explained in earlier discussion with respect to generic
>>>> message format using Rockchip example.
>>>>
>>> Sorry I don't see how.
>>> Please explain how can send_signal() api be used by, say, rockchip to
>>> support SCMI?
>>>
>>
>>  80         writel_relaxed(msg->cmd, mb->mbox_base +
>> MAILBOX_A2B_CMD(chans->idx));
>>  81         writel_relaxed(msg->rx_size, mb->mbox_base +
>>
>>  82                        MAILBOX_A2B_DAT(chans->idx));
>>
>>  83
>>
>>  will be replaced with
>>
>> writel(whatever_value_to trigger_signal, MAILBOX_A2B_CMD(chans->idx));
>>
>> in its send_signal function.
>>
> 1) Where does the  "whatever_value_to_trigger_signal"  come from?

Controller specific.

> That has to come from client. 

No.

> You can not dictate the channel transfers a fixed u32 value over its
>lifetime. SCMI may use one command code but other protocols use more.

Yes if it's just a doorbell, see the above 2 cases I have pointed out.

> 
> 2) Using 'rx_size' is not a software choice made in the driver. The
> _hardware_ has two registers shared with remote side - a CMD and a
> DATA register. So the driver (written agnostic to any particular
> client) would naturally expect the command+data from the client to be
> programmed in to CMD and DAT registers.
> 

OK, if this controller needs to be used in doorbell mode for SCMI, we
can send one fixed cmd and fixed rx_size() or 1 based on inclusive or
exclusive).

> 
>>> I am not convinced we should clone an api just so that a client driver
>>> becomes simpler. Esp when it shifts, and not avoid, the additional
>>> code (to support the client) onto the provider side.
>>>
>>
>> It doesn't tie the data format with particular mailbox controller.
>> send_data has void *data and the interpretation is controller specific.
>> send_signal on the other handle can implemented by the controllers which
>> knows how and can trigger the specific signal to the remote.
>>
> Yeah that's what I said - you want to make a client simpler by pushing
> the code requirement onto the provider side.
> 

No, I want to support generic case of mailbox doorbell instead of
creating another unnecessary abstraction layer
> For example, you mean we modify the provider rockchip-mailbox.c by implementing
> 
> rockchip_send_signal(chan)
> {
>   struct rockchip_mbox_msg msg;
> 
>   msg.cmd = chan->idx;  //only one command supported by the channel !!!

Yes, it's just a doorbell. That actual data is transmitted or shared
elsewhere. This doorbell is a signal to the remote to examine that,

>   msg.rx_size = 0;
> 
>   rockchip_send_data(chan, (void*) &msg);
> }
> 
> whereas I suggest this SCMI specific code should be part of
> transport/mapping shim layer of SCMI.
> 

Yes that's what I did with abstraction and few think including me that
it's unnecessary abstraction for such a generic use.

-- 
Regards,
Sudeep

WARNING: multiple messages have this Message-ID (diff)
From: sudeep.holla@arm.com (Sudeep Holla)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH] mailbox: add support for doorbell/signal mode controllers
Date: Thu, 2 Nov 2017 10:47:46 +0000	[thread overview]
Message-ID: <4268c9d9-dc1e-0bd7-3fac-790c2d42b54b@arm.com> (raw)
In-Reply-To: <CABb+yY16-B9vReRjLopV1RsyB8a=c5X9XaomtTj44520XrDdmA@mail.gmail.com>



On 02/11/17 02:39, Jassi Brar wrote:
> On Wed, Nov 1, 2017 at 11:45 PM, Sudeep Holla <sudeep.holla@arm.com> wrote:
>>
>>
>> On 01/11/17 18:03, Jassi Brar wrote:
>>> On Wed, Nov 1, 2017 at 10:02 PM, Sudeep Holla <sudeep.holla@arm.com> wrote:
>>>
>>>>
>>>> Such controllers don't need to transmit any data, they just transmit
>>>> the signal. In such controllers the data pointer passed to
>>>> mbox_send_message is passed to client via it's tx_prepare callback.
>>>> Controller doesn't need any data to be passed from the client.
>>>>
>>> Some controllers need a non-zero value written to a register in order
>>> to trigger the signal.
>>
>> You are right, just right non-zero or whatever controller value to
>> trigger the interrupt to remote.
>>
>>> That register is visible to the remote. While the data/packet is setup
>>> during tx_prepare() callback.
>>
>> Agreed.
>>
>>> You are overlooking this class of doorbell controllers.
>>>
>>
>> Not sure what do you mean by that ?
>>
> Such doorbell controllers can't use send_signal(chan) because they
> need that non-zero value from client to send over the shared register.
> You are assuming every protocol implements just one command.
>

No that non-zero value is not client specific, it's entirely controller
specific. Not sure why do you think I am assuming every protocol
implements just one command.

>>>>
>>>> This is rough idea I have on extending mailbox interface to support
>>>> the doorbell requirements.
>>>>
>>> What doorbell requirements does the api not support?
>>> QComm's APCS IPC is what you call a "doorbell" controller and is
>>> already supported by the API. 

After looking at this, you will see that doorbell has not data specific
to client in the above case.

	unsigned long idx = (unsigned long)chan->con_priv;

	writel(BIT(idx), apcs->reg);

So it's channel specific, same in mailbox-sti

>> Again agreed. But see below for reason to create this API.
>>
>>>> The new API send_signal will eliminate the
>>>> issue Jassi has explained in earlier discussion with respect to generic
>>>> message format using Rockchip example.
>>>>
>>> Sorry I don't see how.
>>> Please explain how can send_signal() api be used by, say, rockchip to
>>> support SCMI?
>>>
>>
>>  80         writel_relaxed(msg->cmd, mb->mbox_base +
>> MAILBOX_A2B_CMD(chans->idx));
>>  81         writel_relaxed(msg->rx_size, mb->mbox_base +
>>
>>  82                        MAILBOX_A2B_DAT(chans->idx));
>>
>>  83
>>
>>  will be replaced with
>>
>> writel(whatever_value_to trigger_signal, MAILBOX_A2B_CMD(chans->idx));
>>
>> in its send_signal function.
>>
> 1) Where does the  "whatever_value_to_trigger_signal"  come from?

Controller specific.

> That has to come from client. 

No.

> You can not dictate the channel transfers a fixed u32 value over its
>lifetime. SCMI may use one command code but other protocols use more.

Yes if it's just a doorbell, see the above 2 cases I have pointed out.

> 
> 2) Using 'rx_size' is not a software choice made in the driver. The
> _hardware_ has two registers shared with remote side - a CMD and a
> DATA register. So the driver (written agnostic to any particular
> client) would naturally expect the command+data from the client to be
> programmed in to CMD and DAT registers.
> 

OK, if this controller needs to be used in doorbell mode for SCMI, we
can send one fixed cmd and fixed rx_size() or 1 based on inclusive or
exclusive).

> 
>>> I am not convinced we should clone an api just so that a client driver
>>> becomes simpler. Esp when it shifts, and not avoid, the additional
>>> code (to support the client) onto the provider side.
>>>
>>
>> It doesn't tie the data format with particular mailbox controller.
>> send_data has void *data and the interpretation is controller specific.
>> send_signal on the other handle can implemented by the controllers which
>> knows how and can trigger the specific signal to the remote.
>>
> Yeah that's what I said - you want to make a client simpler by pushing
> the code requirement onto the provider side.
> 

No, I want to support generic case of mailbox doorbell instead of
creating another unnecessary abstraction layer
> For example, you mean we modify the provider rockchip-mailbox.c by implementing
> 
> rockchip_send_signal(chan)
> {
>   struct rockchip_mbox_msg msg;
> 
>   msg.cmd = chan->idx;  //only one command supported by the channel !!!

Yes, it's just a doorbell. That actual data is transmitted or shared
elsewhere. This doorbell is a signal to the remote to examine that,

>   msg.rx_size = 0;
> 
>   rockchip_send_data(chan, (void*) &msg);
> }
> 
> whereas I suggest this SCMI specific code should be part of
> transport/mapping shim layer of SCMI.
> 

Yes that's what I did with abstraction and few think including me that
it's unnecessary abstraction for such a generic use.

-- 
Regards,
Sudeep

  reply	other threads:[~2017-11-02 10:47 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-11-01 16:32 [PATCH] mailbox: add support for doorbell/signal mode controllers Sudeep Holla
2017-11-01 16:32 ` Sudeep Holla
2017-11-01 18:03 ` Jassi Brar
2017-11-01 18:03   ` Jassi Brar
2017-11-01 18:15   ` Sudeep Holla
2017-11-01 18:15     ` Sudeep Holla
2017-11-01 22:17     ` Bjorn Andersson
2017-11-01 22:17       ` Bjorn Andersson
2017-11-02  3:02       ` Jassi Brar
2017-11-02  3:02         ` Jassi Brar
2017-11-02  3:27         ` Bjorn Andersson
2017-11-02  3:27           ` Bjorn Andersson
2017-11-02  4:48           ` Jassi Brar
2017-11-02  4:48             ` Jassi Brar
2017-11-02  2:39     ` Jassi Brar
2017-11-02  2:39       ` Jassi Brar
2017-11-02 10:47       ` Sudeep Holla [this message]
2017-11-02 10:47         ` Sudeep Holla
2017-11-02 11:26         ` Jassi Brar
2017-11-02 11:26           ` Jassi Brar
2017-11-02 11:49           ` Sudeep Holla
2017-11-02 11:49             ` Sudeep Holla
2017-11-02 12:21             ` Jassi Brar
2017-11-02 12:21               ` Jassi Brar
2017-11-02 12:37               ` Sudeep Holla
2017-11-02 12:37                 ` Sudeep Holla
2017-11-02 14:52                 ` Jassi Brar
2017-11-02 14:52                   ` Jassi Brar
2017-11-01 22:12   ` Bjorn Andersson
2017-11-01 22:12     ` Bjorn Andersson
2017-11-02  2:56     ` Jassi Brar
2017-11-02  2:56       ` Jassi Brar
2017-11-02 10:51     ` Sudeep Holla
2017-11-02 10:51       ` 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=4268c9d9-dc1e-0bd7-3fac-790c2d42b54b@arm.com \
    --to=sudeep.holla@arm.com \
    --cc=arnd@arndb.de \
    --cc=bjorn.andersson@linaro.org \
    --cc=jassisinghbrar@gmail.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.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 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.