mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Jon Hunter <jonathanh@nvidia.com>
To: John Stultz <john.stultz@linaro.org>
Cc: Marc Zyngier <marc.zyngier@arm.com>,
	Thomas Gleixner <tglx@linutronix.de>,
	lkml <linux-kernel@vger.kernel.org>,
	Bjorn Andersson <bjorn.andersson@linaro.org>
Subject: Re: [Regression] "irqdomain: Don't set type when mapping an IRQ" breaks nexus7 gpio buttons
Date: Mon, 8 Aug 2016 10:31:47 +0100	[thread overview]
Message-ID: <566aa781-6364-07ba-054a-2fcce0f4331b@nvidia.com> (raw)
In-Reply-To: <CALAqxLWgEdNhY7sH20H91VhQZd1UF5ONqUoqz_gHC-R-VMN6bQ@mail.gmail.com>


On 06/08/16 00:45, John Stultz wrote:
> On Mon, Aug 1, 2016 at 3:26 AM, Jon Hunter <jonathanh@nvidia.com> wrote:
>> Hi John,
>>
>> On 30/07/16 05:39, John Stultz wrote:
>>> Hey Jon,
>>>   So after rebasing my nexus7 patch stack onto pre-4.8-rc1 tree, I
>>> noticed the power/volume buttons stopped working.
>>>
>>> I did a manual rebased bisection and chased it down to your commit
>>> 1e2a7d78499e ("irqdomain: Don't set type when mapping an IRQ").
>>>
>>> Reverting that patch makes things work again, so I wanted to see if
>>> there was any debugging info I could provide to try to help narrow
>>> down the problem here. (Sorry, I'd tinker myself with it some and try
>>> to debug the issue, but after burning my friday night on this, I'm
>>> eager to get away from the keyboard for the weekend).
>>
>> Before this commit bad IRQ type settings in device-tree were not getting
>> reported and so failures to set the IRQ type were going unnoticed. It's
>> most likely a bad IRQ type settings somewhere.
>>
>> As Thomas mentioned hopefully dmesg will shed a bit more light.
>>
>> Otherwise it can be worth looking at the ->irq_set_type() function for
>> the irqchips in the path of the interrupt requested to see if any are
>> failing. Looking at the nexus7 (assuming qcom variant), it looks like
>> there are 3 irqchips in the path (pm8921 --> apq8064-pinctrl --> gic).
>> The pm8xxx_irq_set_type() could return a failure when setting up the IRQ
>> type and could be worth checking. It does not look like the set_type for
>> the apq8064-pinctrl should ever fail (apart from calling BUG() which
>> would be obvious). The gic can also return a failure for setting the
>> type, but I did not see anything at first glance that looks incorrect in
>> the dts.
>>
>> If we can narrow down irqchip, then hopefully it will be clearer.
> 
> The pm_8xxx_irq_set_type doesn't seem to be failing as far as I can see..
> 
> Looking at the patch that seems to cause the trouble, I narrowed it
> down to just the following chunk:
> 
> @@ -614,7 +615,11 @@ unsigned int irq_create_fwspec_mapping(struct
> irq_fwspec *fwspec)
>                  * it now and return the interrupt number.
>                  */
>                 if (irq_get_trigger_type(virq) == IRQ_TYPE_NONE) {
> -                       irq_set_irq_type(virq, type);
> +                       irq_data = irq_get_irq_data(virq);
> +                       if (!irq_data)
> +                               return 0;
> +
> +                       irqd_set_trigger_type(irq_data, type);
>                         return virq;
>                 }
> 
> If I revert just that, it works again.
> 
> I was worried we were hitting an early failure from !irq_data, but it
> seems there's some subtle difference between irqd_set_trigger_type and
> irq_set_type that makes the former break for me.

Thanks this is good info and at the same time odd.

I am guessing that it is failing above because the irq_data is not found
for the irq?

What is odd, is that the above sequence is only executed if a irq
mapping exists and so really, AFAICT this should not happen. Ie. the irq
descriptor should have been allocated for the mapping to exist. We
should probably warn if this happens.

Without reverting the above, can you add a print to show the
domain->name, hwirq and virq information if !irq_data? That will confirm
the domain for us.

Also it could be worth enabling all the debug prints in
kernel/irq/irqdomain.c to see what is happening on boot.

Cheers
Jon

-- 
nvpublic

  reply	other threads:[~2016-08-08  9:38 UTC|newest]

Thread overview: 38+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-07-30  4:39 John Stultz
2016-07-30  4:52 ` Bjorn Andersson
2016-07-30 11:10   ` Marc Zyngier
2016-07-30  8:07 ` Thomas Gleixner
2016-08-05 18:12   ` John Stultz
2016-08-08  9:04     ` Jon Hunter
2016-08-08 21:50       ` Linus Walleij
2016-08-08 21:35   ` Linus Walleij
2016-08-01 10:26 ` Jon Hunter
2016-08-05 23:45   ` John Stultz
2016-08-08  9:31     ` Jon Hunter [this message]
2016-08-09  4:25       ` John Stultz
2016-08-09 13:20         ` Jon Hunter
2016-08-09 15:08           ` Marc Zyngier
2016-08-09 23:03           ` Linus Walleij
2016-08-10  9:41             ` Marc Zyngier
2016-08-10  9:56               ` Jon Hunter
2016-08-10 10:21                 ` Marc Zyngier
2016-08-10 13:58                 ` Linus Walleij
2016-08-10 14:12                   ` Jon Hunter
2016-08-10 22:06                     ` Linus Walleij
2016-08-10 13:50               ` Linus Walleij
2016-08-10 15:17                 ` Marc Zyngier
2016-08-10 22:14                   ` Linus Walleij
2016-08-08 21:48     ` Linus Walleij
2016-08-11  8:37       ` Marc Zyngier
2016-08-11  9:47         ` Jon Hunter
2016-08-11 11:45           ` Marc Zyngier
2016-08-11 11:53             ` Marc Zyngier
2016-08-11 12:46           ` Marc Zyngier
2016-08-11 13:29             ` Jon Hunter
2016-08-11 13:34               ` Marc Zyngier
2016-08-11 15:32             ` John Stultz
2016-08-11 15:51               ` Marc Zyngier
2016-08-11 21:08             ` Linus Walleij
2016-08-11 21:23             ` Bjorn Andersson
2016-08-12 10:22               ` Marc Zyngier
2016-08-11 12:01         ` 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=566aa781-6364-07ba-054a-2fcce0f4331b@nvidia.com \
    --to=jonathanh@nvidia.com \
    --cc=bjorn.andersson@linaro.org \
    --cc=john.stultz@linaro.org \
    --cc=linux-kernel@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome