devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Lee Jones <lee.jones@linaro.org>
To: Jassi Brar <jassisinghbrar@gmail.com>
Cc: Jassi Brar <jaswinder.singh@linaro.org>,
	Arnd Bergmann <arnd@arndb.de>,
	Devicetree List <devicetree@vger.kernel.org>,
	lkml <linux-kernel@vger.kernel.org>,
	"linux-arm-kernel@lists.infradead.org"
	<linux-arm-kernel@lists.infradead.org>,
	kernel@stlinux.com
Subject: Re: [PATCH 3/3] mailbox: Add support for ST's Mailbox IP
Date: Mon, 23 Mar 2015 15:06:46 +0000	[thread overview]
Message-ID: <20150323150646.GO24804@x1> (raw)
In-Reply-To: <CABb+yY3GZG0Dg5Vzsp1Cv+C1_yc8SxuqGFXLi3_wg7TrBbk6jw@mail.gmail.com>

On Thu, 19 Mar 2015, Jassi Brar wrote:

> On Thu, Mar 19, 2015 at 2:47 PM, Lee Jones <lee.jones@linaro.org> wrote:
> > On Thu, 19 Mar 2015, Jassi Brar wrote:
> >
> >> On Wed, Mar 18, 2015 at 9:04 PM, Lee Jones <lee.jones@linaro.org> wrote:
> >> > On Wed, 18 Mar 2015, Jassi Brar wrote:
> >> >
> >> >> On Wed, Mar 18, 2015 at 6:47 PM, Lee Jones <lee.jones@linaro.org> wrote:
> >> >> > On Tue, 03 Mar 2015, Jassi Brar wrote:
> >> >> >
> >> >> >> On 3 March 2015 at 17:04, Arnd Bergmann <arnd@arndb.de> wrote:
> >> >> >> > On Tuesday 03 March 2015 10:41:23 Lee Jones wrote:
> >> >> >> >> +
> >> >> >> >> +/*
> >> >> >> >> + * struct sti_mbox_msg - sti mailbox message description
> >> >> >> >> + * @dsize:             data payload size
> >> >> >> >> + * @pdata:             message data payload
> >> >> >> >> + */
> >> >> >> >> +struct sti_mbox_msg {
> >> >> >> >> +       u32             dsize;
> >> >> >> >> +       u8              *pdata;
> >> >> >> >> +};
> >> >> >> >
> >> >> >> > As mentioned in another thread, we may just want to add a 'size'
> >> >> >> > argument to the message send function, and a default helper for
> >> >> >> > messages with size of 32 bits.
> >> >> >> >
> >> >> >> Case-a) 'size' is a member of the payload structure itself
> >> >> >>     The extra 'size' argument would only be used for sanity check.
> >> >> >>     This driver seems so. Lee, can you not do without 'dsize'?
> >> >> >>
> >> >> >> Case-b) 'size' is not a member of payload structure:
> >> >> >>      b1)  payload is fixed length, that is 'size' := sizeof(struct my_payload)
> >> >> >>             Here the size argument is redundant.
> >> >> >>
> >> >> >>      b2)  payload length varies
> >> >> >>             This case is highly unlikely because there would be no way
> >> >> >> for remote to know how many bytes to read as the payload. Not to mean
> >> >> >> we can't do without the 'size' argument.
> >> >> >>
> >> >> >> Your opinion has huge weight, but I would like to be enlightened
> >> >> >> before agreeing.
> >> >> >
> >> >> > Let's simplify this.
> >> >> >
> >> >> > If you want to have varying length payloads, you have to carry the
> >> >> > size in the payload.  If you wish to force fixed size payloads, then
> >> >> > you may do without a size segment.
> >> >> >
> >> >> > Do you really want to force all users of Mailbox to use fixed size
> >> >> > payloads?
> >> >> >
> >> >> No. I only observed the fact that every known mailbox controller
> >> >> driver already has a way to figure out the payload length because
> >> >> either the protocol uses fixed length payloads or has the 'size' field
> >> >> in every payload.
> >> >> I am yet to see a platform that uses both, then the 'size' argument
> >> >> will be helpful but still not necessary.
> >> >
> >> > I see.  So your real concern is that controllers shouldn't have two
> >> > means of obtaining size.
> >> >
> >> I think right now there's not much need to expand the api for 'u32'
> >> sized payloads.
> >>
> >> > Arnd's idea of placing the message size as part of the send_message()
> >> > call is fine, but it's still going to end up in the payload isn't it?
> >> >
> >> ... or it will be implied by sizeof(struct my_packet) if the protocol
> >> has finite set of payloads.
> >>
> >> > And what about receiving?
> >> >
> >> Similar to sending - controller driver passes pointer to RX buffer
> >> which the client parses. Remember the protocol would already have a
> >> way to communicate payload length.
> >
> > So this is the bit that's getting me.  How do you pass payload length
> > to the remote processor if you don't have it in the payload?
> >
> Some protocol may use signature to identify a packet type.
> For example, the remote supports upto 100 commands, each having unique
> 8bit code. At fixed offset of any payload is the command code. All the
> remote needs to do is read the u8 value of predefined offset and use
> it dispatch the payload to handler of that command. The command
> handler would know the format of such requests.

Okay, I see what you're saying.  We'll push the knowledge of 'command
type', 'size' and anything else we wish to encode into the message
back into the client so the controller doesn't have to worry about
it.  Sounds reasonable to me.

-- 
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog

  reply	other threads:[~2015-03-23 15:06 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-03 10:41 [PATCH 0/3] mailbox: New mailbox driver for ST Lee Jones
2015-03-03 10:41 ` [PATCH 1/3] ARM: STi: stih407-family: Add nodes for Mailbox Lee Jones
2015-03-03 10:41 ` [PATCH 2/3] mailbox: dt: Supply bindings for ST's Mailbox IP Lee Jones
2015-03-04 13:31   ` Jassi Brar
2015-03-03 10:41 ` [PATCH 3/3] mailbox: Add support " Lee Jones
2015-03-03 11:34   ` Arnd Bergmann
2015-03-03 15:18     ` Jassi Brar
     [not found]       ` <CAJe_ZhdjPa3C_TUDAPA3fS3K83FGB-GaAjVBjtsow2mp5h8NRw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2015-03-18 13:17         ` Lee Jones
2015-03-18 13:53           ` Jassi Brar
2015-03-18 15:34             ` Lee Jones
2015-03-19  5:50               ` Jassi Brar
     [not found]                 ` <CABb+yY0HufMEDy7ANj8KV0hamvM-Tgy4GBkwD73wm3DMumcbaQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2015-03-19  9:17                   ` Lee Jones
2015-03-19 12:41                     ` Jassi Brar
2015-03-23 15:06                       ` Lee Jones [this message]
     [not found]   ` <1425379283-1567-4-git-send-email-lee.jones-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
2015-03-04 13:27     ` Jassi Brar
2015-03-18 13:12       ` Lee Jones
2015-03-18 13:32         ` Jassi Brar
2015-03-18 15:26           ` Lee Jones
2015-03-19  5:13             ` Jassi Brar
2015-03-19  9:57               ` Lee Jones
2015-03-19 12:43                 ` Jassi Brar

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=20150323150646.GO24804@x1 \
    --to=lee.jones@linaro.org \
    --cc=arnd@arndb.de \
    --cc=devicetree@vger.kernel.org \
    --cc=jassisinghbrar@gmail.com \
    --cc=jaswinder.singh@linaro.org \
    --cc=kernel@stlinux.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 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).