Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1191165 > unrolled thread
| Started by | Alexey Klimov <klimov.linux@gmail.com> |
|---|---|
| First post | 2015-07-23 19:30 +0200 |
| Last post | 2015-07-24 12:00 +0200 |
| Articles | 2 — 2 participants |
Back to article view | Back to linux.kernel
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
Re: [PATCH 3/6] mailbox: Add support for ST's Mailbox IP Alexey Klimov <klimov.linux@gmail.com> - 2015-07-23 19:30 +0200
Re: [PATCH 3/6] mailbox: Add support for ST's Mailbox IP Lee Jones <lee.jones@linaro.org> - 2015-07-24 12:00 +0200
| From | Alexey Klimov <klimov.linux@gmail.com> |
|---|---|
| Date | 2015-07-23 19:30 +0200 |
| Subject | Re: [PATCH 3/6] mailbox: Add support for ST's Mailbox IP |
| Message-ID | <pPstJ-4VP-33@gated-at.bofh.it> |
Hi Lee,
On Fri, Jul 17, 2015 at 3:04 PM, Lee Jones <lee.jones@linaro.org> wrote:
> ST's platforms currently support a maximum of 5 Mailboxes, one for
> each of the supported co-processors situated on the platform. Each
> Mailbox is divided up into 4 instances which consist of 32 channels.
> Messages are passed between the application and co-processors using
> shared memory areas. It is the Client's responsibility to manage
> these areas.
>
> Signed-off-by: Lee Jones <lee.jones@linaro.org>
> ---
> drivers/mailbox/Kconfig | 7 +
> drivers/mailbox/Makefile | 2 +
> drivers/mailbox/mailbox-sti.c | 562 ++++++++++++++++++++++++++++++++++++++++++
> 3 files changed, 571 insertions(+)
> create mode 100644 drivers/mailbox/mailbox-sti.c
[..]
> +static irqreturn_t sti_mbox_thread_handler(int irq, void *data)
> +{
> + struct sti_mbox_device *mdev = data;
> + struct sti_mbox_pdata *pdata = dev_get_platdata(mdev->dev);
> + struct mbox_chan *chan;
> + unsigned int instance;
> +
> + for (instance = 0; instance < pdata->num_inst; instance++) {
> +keep_looking:
> + chan = sti_mbox_irq_to_channel(mdev, instance);
> + if (!chan)
> + continue;
> +
> + mbox_chan_received_data(chan, NULL);
> + sti_mbox_clear_irq(chan);
> + sti_mbox_enable_channel(chan);
> + goto keep_looking;
> + }
> +
> + return IRQ_HANDLED;
> +}
> +
> +static irqreturn_t sti_mbox_irq_handler(int irq, void *data)
> +{
> + struct sti_mbox_device *mdev = data;
> + struct sti_mbox_pdata *pdata = dev_get_platdata(mdev->dev);
> + struct sti_channel *chan_info;
> + struct mbox_chan *chan;
> + unsigned int instance;
> + int ret = IRQ_NONE;
> +
> + for (instance = 0; instance < pdata->num_inst; instance++) {
> + chan = sti_mbox_irq_to_channel(mdev, instance);
> + if (!chan)
> + continue;
> + chan_info = chan->con_priv;
> +
> + if (!sti_mbox_channel_is_enabled(chan)) {
> + dev_warn(mdev->dev,
> + "Unexpected IRQ: %s\n"
> + " instance: %d: channel: %d [enabled: %x]\n",
> + mdev->name, chan_info->instance,
> + chan_info->channel, mdev->enabled[instance]);
> + ret = IRQ_HANDLED;
> + continue;
> + }
> +
> + sti_mbox_disable_channel(chan);
> + ret = IRQ_WAKE_THREAD;
> + }
> +
> + if (ret == IRQ_NONE)
> + dev_err(mdev->dev, "Spurious IRQ - was a channel requested?\n");
> +
> + return ret;
> +}
With such usage of ret variable can it happen that handling of last
but one channel/instance will set ret to IRQ_WAKE_THREAD and at the
same time handling of last channel/instance will set ret to
IRQ_HANDLED during iteration loop and finally generic subsystem will
not wake up thread handler because it will receive IRQ_HANDLED?
Just checking.
[..]
--
Thanks,
Alexey Klimov
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[toc] | [next] | [standalone]
| From | Lee Jones <lee.jones@linaro.org> |
|---|---|
| Date | 2015-07-24 12:00 +0200 |
| Message-ID | <pPHVN-2bg-17@gated-at.bofh.it> |
| In reply to | #1191165 |
On Thu, 23 Jul 2015, Alexey Klimov wrote:
> On Fri, Jul 17, 2015 at 3:04 PM, Lee Jones <lee.jones@linaro.org> wrote:
> > ST's platforms currently support a maximum of 5 Mailboxes, one for
> > each of the supported co-processors situated on the platform. Each
> > Mailbox is divided up into 4 instances which consist of 32 channels.
> > Messages are passed between the application and co-processors using
> > shared memory areas. It is the Client's responsibility to manage
> > these areas.
> >
> > Signed-off-by: Lee Jones <lee.jones@linaro.org>
> > ---
> > drivers/mailbox/Kconfig | 7 +
> > drivers/mailbox/Makefile | 2 +
> > drivers/mailbox/mailbox-sti.c | 562 ++++++++++++++++++++++++++++++++++++++++++
> > 3 files changed, 571 insertions(+)
> > create mode 100644 drivers/mailbox/mailbox-sti.c
>
> [..]
>
> > +static irqreturn_t sti_mbox_thread_handler(int irq, void *data)
> > +{
> > + struct sti_mbox_device *mdev = data;
> > + struct sti_mbox_pdata *pdata = dev_get_platdata(mdev->dev);
> > + struct mbox_chan *chan;
> > + unsigned int instance;
> > +
> > + for (instance = 0; instance < pdata->num_inst; instance++) {
> > +keep_looking:
> > + chan = sti_mbox_irq_to_channel(mdev, instance);
> > + if (!chan)
> > + continue;
> > +
> > + mbox_chan_received_data(chan, NULL);
> > + sti_mbox_clear_irq(chan);
> > + sti_mbox_enable_channel(chan);
> > + goto keep_looking;
> > + }
> > +
> > + return IRQ_HANDLED;
> > +}
> > +
> > +static irqreturn_t sti_mbox_irq_handler(int irq, void *data)
> > +{
> > + struct sti_mbox_device *mdev = data;
> > + struct sti_mbox_pdata *pdata = dev_get_platdata(mdev->dev);
> > + struct sti_channel *chan_info;
> > + struct mbox_chan *chan;
> > + unsigned int instance;
> > + int ret = IRQ_NONE;
> > +
> > + for (instance = 0; instance < pdata->num_inst; instance++) {
> > + chan = sti_mbox_irq_to_channel(mdev, instance);
> > + if (!chan)
> > + continue;
> > + chan_info = chan->con_priv;
> > +
> > + if (!sti_mbox_channel_is_enabled(chan)) {
> > + dev_warn(mdev->dev,
> > + "Unexpected IRQ: %s\n"
> > + " instance: %d: channel: %d [enabled: %x]\n",
> > + mdev->name, chan_info->instance,
> > + chan_info->channel, mdev->enabled[instance]);
> > + ret = IRQ_HANDLED;
> > + continue;
> > + }
> > +
> > + sti_mbox_disable_channel(chan);
> > + ret = IRQ_WAKE_THREAD;
> > + }
> > +
> > + if (ret == IRQ_NONE)
> > + dev_err(mdev->dev, "Spurious IRQ - was a channel requested?\n");
> > +
> > + return ret;
> > +}
>
> With such usage of ret variable can it happen that handling of last
> but one channel/instance will set ret to IRQ_WAKE_THREAD and at the
> same time handling of last channel/instance will set ret to
> IRQ_HANDLED during iteration loop and finally generic subsystem will
> not wake up thread handler because it will receive IRQ_HANDLED?
> Just checking.
Yes, I guess that it theoretically possible. Now fixed.
Thanks for the spot.
--
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web