All of lore.kernel.org
 help / color / mirror / Atom feed
From: Linus Walleij <linus.walleij@linaro.org>
To: "Shah, Nehal-bakulchandra" <Nehal-Bakulchandra.shah@amd.com>
Cc: "linux-gpio@vger.kernel.org" <linux-gpio@vger.kernel.org>,
	"gnurou@gmail.com" <gnurou@gmail.com>,
	"S-k, Shyam-sundar" <Shyam-sundar.S-k@amd.com>,
	Marc Zyngier <marc.zyngier@arm.com>,
	Thomas Gleixner <tglx@linutronix.de>
Subject: Re: [PATCH] pinctrl: amd: Add support for additional GPIO
Date: Tue, 22 Nov 2016 11:44:23 +0100	[thread overview]
Message-ID: <CACRpkdbY-2iB9oxHfFOJBmJQq-zmOR1YEg0dy5zdx++tg-acGw@mail.gmail.com> (raw)
In-Reply-To: <469f529e-818b-392f-9ddb-b02e87e50ca9@amd.com>

On Tue, Nov 22, 2016 at 11:19 AM, Shah, Nehal-bakulchandra
<Nehal-Bakulchandra.shah@amd.com> wrote:

> I understood that chained irq and devm_irq can't be used together. Surely,
> I will rework on the patch.

OK! :)

We have a case where devm_request_threaded_irq() is used like this,
that is called *nested* irqs, when an interrupt-handling thread is called
from within another interrupt-handling thread.

But since this handler is not threaded, but rather a hardirq, it is not
a viable option.

> The reason behind using devm_irq is that in our
> upcoming platform bios may report two gpio controllers. Both will have same IRQs.
> In my understanding if I use chained irq handler, it will not be clear interrupt
> is due to which gpio controller.It may lead to serve irq twice.

This is a shared IRQ line.

How stressful that it is shared between two cascaded irqchips!

Shared IRQs should nominally be handled by the leafs of the interrupt
handlers returning IRQ_HANDLED and the ones that did not
trigger an IRQ returning IRQ_NONE.

With a chained handler the assumption is that the flow handler
is not really returning anything, just dispatching down to the
consumer (device etc) to return IRQ_HANDLED if it was
their IRQ.

If you want to "bail out" of the chained handler (in your
case what you pass to gpiochip_set_chained_irqchip())
just check if the IRQ status register happens to be zero,
and in that case return; before even calling
chained_irq_enter().

I do not know if there is a way to mark a line as shared
in a chained flow handler!

The current assumption is that gpiochip_set_chained_irqchip()
is called for one or many *different* IRQs. That will work.
But if it is called twice for the *same* IRQ, we might need
some special work inside gpiochip_set_chained_irqchip()
to make this work properly with shared IRQs...

> Please let me know if anything is incorrect in my understanding or if there is
> a better way to handle this situation.

I think reading a bit in kernel/irq/chip.c to see what is really
happening with chained IRQs help a lot. If there are unclarities,
it needs to be discussed with the IRQchip maintainers
(Marc & Thomas).

Yours,
Linus Walleij

  reply	other threads:[~2016-11-22 10:44 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-11-09 10:28 [PATCH] pinctrl: amd: Add support for additional GPIO Shah, Nehal-bakulchandra
2016-11-14 13:18 ` Linus Walleij
2016-11-22 10:19   ` Shah, Nehal-bakulchandra
2016-11-22 10:44     ` Linus Walleij [this message]
2016-11-28  9:57       ` Shah, Nehal-bakulchandra
2016-11-29  6:32       ` Shah, Nehal-bakulchandra
2016-11-30 13:10         ` Linus Walleij
2016-12-01  8:09           ` Shah, Nehal-bakulchandra
2016-12-01  8:13           ` Shah, Nehal-bakulchandra
2016-12-02 12:46             ` Linus Walleij
2016-12-06  6:47           ` Shah, Nehal-bakulchandra
2016-12-06 10:14             ` Shah, Nehal-bakulchandra
2016-12-28 12:26             ` Linus Walleij
  -- strict thread matches above, loose matches on Subject: below --
2016-11-04  3:46 Shah, Nehal-bakulchandra
2016-11-08  9:41 ` Linus Walleij
2016-11-08 13:13 ` Linus Walleij

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=CACRpkdbY-2iB9oxHfFOJBmJQq-zmOR1YEg0dy5zdx++tg-acGw@mail.gmail.com \
    --to=linus.walleij@linaro.org \
    --cc=Nehal-Bakulchandra.shah@amd.com \
    --cc=Shyam-sundar.S-k@amd.com \
    --cc=gnurou@gmail.com \
    --cc=linux-gpio@vger.kernel.org \
    --cc=marc.zyngier@arm.com \
    --cc=tglx@linutronix.de \
    /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.