Re: [PATCHv5 2/4] mailbox: Introduce framework for mailbox

From: Arnd Bergmann
Date: Mon May 19 2014 - 09:16:35 EST


On Friday 16 May 2014 19:03:25 Jassi Brar wrote:
> >> +/**
> >> + * struct mbox_controller - Controller of a class of communication chans
> >> + * @dev: Device backing this controller
> >> + * @controller_name: Literal name of the controller.
> >> + * @ops: Operators that work on each communication chan
> >> + * @chans: Null terminated array of chans.
> >> + * @txdone_irq: Indicates if the controller can report to API when
> >> + * the last transmitted data was read by the remote.
> >> + * Eg, if it has some TX ACK irq.
> >> + * @txdone_poll: If the controller can read but not report the TX
> >> + * done. Ex, some register shows the TX status but
> >> + * no interrupt rises. Ignored if 'txdone_irq' is set.
> >> + * @txpoll_period: If 'txdone_poll' is in effect, the API polls for
> >> + * last TX's status after these many millisecs
> >> + */
> >> +struct mbox_controller {
> >> + struct device *dev;
> >> + struct mbox_chan_ops *ops;
> >> + struct mbox_chan *chans;
> >> + int num_chans;
> >> + bool txdone_irq;
> >> + bool txdone_poll;
> >> + unsigned txpoll_period;
> >> + struct mbox_chan *(*of_xlate)(struct mbox_controller *mbox,
> >> + const struct of_phandle_args *sp);
> >> + /*
> >> + * If the controller supports only TXDONE_BY_POLL,
> >> + * this timer polls all the links for txdone.
> >> + */
> >> + struct timer_list poll;
> >> + unsigned period;
> >> + /* Hook to add to the global controller list */
> >> + struct list_head node;
> >> +} __aligned(32);
> >
> > What is the __aligned(32) for?
> >
> Attempt to align access to mailbox?

I still don't understand why it matters. This data structure is internal
to the kernel, at least I don't see anything that is accessed by the
hardware here. Note that anything that allocates a mbox_controller through
kmalloc will not get the alignment from here anyway, but will get the
default slab alignment instead (which happens to also be 32 bytes on
ARM).

> I am still open to opinion about whether the mailbox ownership should
> be exclusive or shared among clients. Need to handle async messages
> from remote is one reason one might want more than one client to own a
> channel. Allowing for RX via notifiers might be one option but that
> breaks semantics of 'ownership' of a mailbox channel.

I don't have a strong opinion on that.

> Also, some platform might need to communicate with remote master
> during very early boot like for initializing system timers and clocks.
> The API isn't working then.

Do you have an example for a platform like that? I'd expect that normally
we can have a boot loader that sets up the system timer to work good
enough for us to get into normal driver initialization.

Arnd
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/