From: jeffy <jeffy.chen@rock-chips.com>
To: Marc Zyngier <marc.zyngier@arm.com>,
Jon Hunter <jonathanh@nvidia.com>,
Thomas Gleixner <tglx@linutronix.de>,
Jason Cooper <jason@lakedaemon.net>
Cc: Rob Herring <robh+dt@kernel.org>, Pawel Moll <pawel.moll@arm.com>,
Mark Rutland <mark.rutland@arm.com>,
Ian Campbell <ijc+devicetree@hellion.org.uk>,
Kumar Gala <galak@codeaurora.org>,
Stephen Warren <swarren@wwwdotorg.org>,
Thierry Reding <thierry.reding@gmail.com>,
Kevin Hilman <khilman@kernel.org>,
Geert Uytterhoeven <geert@linux-m68k.org>,
Grygorii Strashko <grygorii.strashko@ti.com>,
Lars-Peter Clausen <lars@metafoo.de>,
Linus Walleij <linus.walleij@linaro.org>,
linux-tegra@vger.kernel.org, devicetree@vger.kernel.org,
linux-kernel@vger.kernel.org, briannorris@chromium.com
Subject: Re: [V6,3/9] irqdomain: Don't set type when mapping an IRQ
Date: Thu, 17 Aug 2017 22:42:13 +0800 [thread overview]
Message-ID: <5995AB45.6010706@rock-chips.com> (raw)
In-Reply-To: <feb4e020-b738-9165-c044-b0e246ee4bd5@arm.com>
Hi Marc,
Thanks for your reply.
On 08/17/2017 09:34 PM, Marc Zyngier wrote:
> On 17/08/17 13:46, jeffy wrote:
>> Hi guys,
>>
>> I hit an problem when testing a level triggered irq with:
>>
>> irq = platform_get_irq_byname(pdev, "wake");
>> ...<-- irq trigger type is correct
>> irq_set_status_flags(irq, IRQ_NOAUTOEN);
>> ...<-- irq trigger type become zero
>> request_threaded_irq(irq, ...)
>>
>> the trigger type lost(irqd_get_trigger_type returns zero) after
>> irq_set_status_flags.
>>
>>
>> it looks like irq_set_status_flags would try to use
>> irq_settings_is_level to get level trigger type, which would get zero
>> since we removed set type here...could you help to check this, thanks :)
>
> Hmm. That's quite unexpected. Can you please try this?
>
> diff --git a/kernel/irq/chip.c b/kernel/irq/chip.c
> index a3cc37c0c85e..3675c6004f2a 100644
> --- a/kernel/irq/chip.c
> +++ b/kernel/irq/chip.c
> @@ -1000,7 +1000,7 @@ EXPORT_SYMBOL_GPL(irq_set_chip_and_handler_name);
>
> void irq_modify_status(unsigned int irq, unsigned long clr, unsigned long set)
> {
> - unsigned long flags;
> + unsigned long flags, trigger, tmp;
> struct irq_desc *desc = irq_get_desc_lock(irq, &flags, 0);
>
> if (!desc)
> @@ -1014,6 +1014,8 @@ void irq_modify_status(unsigned int irq, unsigned long clr, unsigned long set)
>
> irq_settings_clr_and_set(desc, clr, set);
>
> + trigger = irqd_get_trigger_type(&desc->irq_data);
> +
> irqd_clear(&desc->irq_data, IRQD_NO_BALANCING | IRQD_PER_CPU |
> IRQD_TRIGGER_MASK | IRQD_LEVEL | IRQD_MOVE_PCNTXT);
> if (irq_settings_has_no_balance_set(desc))
> @@ -1025,7 +1027,11 @@ void irq_modify_status(unsigned int irq, unsigned long clr, unsigned long set)
> if (irq_settings_is_level(desc))
> irqd_set(&desc->irq_data, IRQD_LEVEL);
>
> - irqd_set(&desc->irq_data, irq_settings_get_trigger_mask(desc));
> + tmp = irq_settings_get_trigger_mask(desc);
> + if (tmp != IRQ_TYPE_NONE)
> + trigger = tmp;
> +
> + irqd_set(&desc->irq_data, trigger);
>
> irq_put_desc_unlock(desc, flags);
> }
>
> Basically, save the trigger info before clearing it. If the interrupt
> has already been configured, use that. Otherwise restore the previous
> trigger settings. But I'm slightly confused as to which field is used
> for what...
Thanks:), this patch works well, so
Tested-by: Jeffy Chen <jeffy.chen@rock-chips.com>
>
> M.
>
next prev parent reply other threads:[~2017-08-17 14:42 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-06-07 15:12 [PATCH V6 0/9] Add support for Tegra210 AGIC Jon Hunter
2016-06-07 15:12 ` [PATCH V6 1/9] irqdomain: Fix handling of type settings for existing mappings Jon Hunter
2016-06-07 15:12 ` [PATCH V6 2/9] genirq: Look-up trigger type if not specified by caller Jon Hunter
2016-06-13 10:42 ` Marc Zyngier
2016-06-13 11:09 ` Jon Hunter
2016-06-13 11:59 ` Marc Zyngier
2016-06-13 12:24 ` Jon Hunter
2016-06-13 12:33 ` Marc Zyngier
2016-06-07 15:12 ` [PATCH V6 3/9] irqdomain: Don't set type when mapping an IRQ Jon Hunter
2016-07-29 3:53 ` Masahiro Yamada
2016-07-29 8:10 ` Marc Zyngier
2016-08-01 1:28 ` Masahiro Yamada
2016-08-01 7:46 ` Marc Zyngier
2016-08-01 8:30 ` Masahiro Yamada
2016-07-29 8:31 ` Jon Hunter
2016-08-01 3:09 ` Masahiro Yamada
2017-08-17 12:46 ` [V6,3/9] " jeffy
2017-08-17 13:34 ` Marc Zyngier
2017-08-17 14:42 ` jeffy [this message]
2016-06-07 15:12 ` [PATCH V6 4/9] genirq: Add runtime power management support for IRQ chips Jon Hunter
2016-06-10 22:08 ` Kevin Hilman
2016-06-07 15:12 ` [PATCH V6 5/9] irqchip/gic: Isolate early GIC initialisation code Jon Hunter
2016-06-07 15:12 ` [PATCH V6 6/9] irqchip/gic: Add helper function for chip initialisation Jon Hunter
2016-06-07 15:12 ` [PATCH V6 7/9] irqchip/gic: Prepare for adding platform driver Jon Hunter
2016-06-07 15:12 ` [PATCH V6 8/9] dt-bindings: arm-gic: Add documentation for Tegra210 AGIC Jon Hunter
2016-06-07 15:12 ` [PATCH V6 9/9] irqchip/gic: Add platform driver for non-root GICs that require RPM Jon Hunter
2016-06-13 9:10 ` Marc Zyngier
2016-06-13 9:58 ` Jon Hunter
2016-06-13 10:13 ` Marc Zyngier
2016-06-13 10:27 ` Jon Hunter
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=5995AB45.6010706@rock-chips.com \
--to=jeffy.chen@rock-chips.com \
--cc=briannorris@chromium.com \
--cc=devicetree@vger.kernel.org \
--cc=galak@codeaurora.org \
--cc=geert@linux-m68k.org \
--cc=grygorii.strashko@ti.com \
--cc=ijc+devicetree@hellion.org.uk \
--cc=jason@lakedaemon.net \
--cc=jonathanh@nvidia.com \
--cc=khilman@kernel.org \
--cc=lars@metafoo.de \
--cc=linus.walleij@linaro.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-tegra@vger.kernel.org \
--cc=marc.zyngier@arm.com \
--cc=mark.rutland@arm.com \
--cc=pawel.moll@arm.com \
--cc=robh+dt@kernel.org \
--cc=swarren@wwwdotorg.org \
--cc=tglx@linutronix.de \
--cc=thierry.reding@gmail.com \
/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