devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Marc Zyngier <marc.zyngier-5wv7dgnIgG8@public.gmane.org>
To: Jon Hunter <jonathanh-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>,
	Thomas Gleixner <tglx-hfZtesqFncYOwBW4kG4KsQ@public.gmane.org>,
	Jason Cooper <jason-NLaQJdtUoK4Be96aLqz0jA@public.gmane.org>
Cc: Rob Herring <robh+dt-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>,
	Pawel Moll <pawel.moll-5wv7dgnIgG8@public.gmane.org>,
	Mark Rutland <mark.rutland-5wv7dgnIgG8@public.gmane.org>,
	Ian Campbell
	<ijc+devicetree-KcIKpvwj1kUDXYZnReoRVg@public.gmane.org>,
	Kumar Gala <galak-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>,
	Stephen Warren <swarren-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org>,
	Thierry Reding
	<thierry.reding-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>,
	Kevin Hilman <khilman-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>,
	Geert Uytterhoeven
	<geert-Td1EMuHUCqxL1ZNQvxDV9g@public.gmane.org>,
	Grygorii Strashko
	<grygorii.strashko-l0cyMroinI0@public.gmane.org>,
	Lars-Peter Clausen <lars-Qo5EllUWu/uELgA04lAiVw@public.gmane.org>,
	Linus Walleij
	<linus.walleij-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>,
	linux-tegra-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: Re: [PATCH V6 2/9] genirq: Look-up trigger type if not specified by caller
Date: Mon, 13 Jun 2016 13:33:58 +0100	[thread overview]
Message-ID: <575EA836.4010406@arm.com> (raw)
In-Reply-To: <575EA603.7090002-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>

On 13/06/16 13:24, Jon Hunter wrote:
> 
> On 13/06/16 12:59, Marc Zyngier wrote:
>> On 13/06/16 12:09, Jon Hunter wrote:
>>>
>>> On 13/06/16 11:42, Marc Zyngier wrote:
>>>> On 07/06/16 16:12, Jon Hunter wrote:
>>>>> For some devices the IRQ trigger type for a device is read from
>>>>> firmware, such as device-tree. The IRQ trigger type is typically read
>>>>> when the mapping for IRQ is created, which is before the IRQ is
>>>>> requested. Hence, the IRQ trigger type is programmed when mapping the
>>>>> IRQ and not when requesting the IRQ.
>>>>>
>>>>> Although this works for most cases, in order to support IRQ chips which
>>>>> require runtime power management, which may not be accessible prior
>>>>> to requesting the IRQ, it is desirable to look-up the IRQ trigger type
>>>>> when it is requested. Therefore, if the IRQ trigger type is not
>>>>> specified when __setup_irq() is called, look-up the saved IRQ trigger
>>>>> type. This will allow us to defer the programming of the trigger type
>>>>> from when the IRQ is mapped to when it is actually requested.
>>>>>
>>>>> Signed-off-by: Jon Hunter <jonathanh-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
>>>>> Reviewed-by: Marc Zyngier <marc.zyngier-5wv7dgnIgG8@public.gmane.org>
>>>>> ---
>>>>>  kernel/irq/manage.c | 7 +++++++
>>>>>  1 file changed, 7 insertions(+)
>>>>>
>>>>> diff --git a/kernel/irq/manage.c b/kernel/irq/manage.c
>>>>> index ef0bc02c3a70..eaedeb74b49d 100644
>>>>> --- a/kernel/irq/manage.c
>>>>> +++ b/kernel/irq/manage.c
>>>>> @@ -1117,6 +1117,13 @@ __setup_irq(unsigned int irq, struct irq_desc *desc, struct irqaction *new)
>>>>>  	new->irq = irq;
>>>>>  
>>>>>  	/*
>>>>> +	 * If the trigger type is not specified by the caller,
>>>>> +	 * then use the default for this interrupt.
>>>>> +	 */
>>>>> +	if (!(new->flags & IRQF_TRIGGER_MASK))
>>>>> +		new->flags |= irqd_get_trigger_type(&desc->irq_data);
>>>>> +
>>>>> +	/*
>>>>>  	 * Check whether the interrupt nests into another interrupt
>>>>>  	 * thread.
>>>>>  	 */
>>>>>
>>>>
>>>> I've added the following patch to the queue, in order to deal with
>>>> percpu interrupts that were not handled by this patch:
>>>>
>>>> diff --git a/kernel/irq/manage.c b/kernel/irq/manage.c
>>>> index f8fd1fb..00cfc85 100644
>>>> --- a/kernel/irq/manage.c
>>>> +++ b/kernel/irq/manage.c
>>>> @@ -1751,7 +1751,14 @@ void enable_percpu_irq(unsigned int irq, unsigned int type)
>>>>  	if (!desc)
>>>>  		return;
>>>>  
>>>> +	/*
>>>> +	 * If the trigger type is not specified by the caller, then
>>>> +	 * use the default for this interrupt.
>>>> +	 */
>>>>  	type &= IRQ_TYPE_SENSE_MASK;
>>>> +	if (type == IRQ_TYPE_NONE)
>>>> +		type = irqd_get_trigger_type(&desc->irq_data);
>>>> +
>>>
>>> I am wondering if you need this here because now __setup_irq(), called
>>> by request_percpu_irq(), will actually look-up the saved type even for a
>>> percpu-irq. So shouldn't this already be handled? Or am I missing something?
>>
>> You are overlooking the fact that the configuration registers are
>> themselves per-CPU, which means that __setup_irq() will only configure
>> the interrupt on the CPU it runs on. And you can't even tell which one,
>> since you are in a preemptible context.
>>
>> Does it make more sense?
> 
> Yes it does thanks. I am guessing we don't need to worry about there
> being different type configurations for the different CPUs for a given
> interrupt?

I don't know of any firmware that would allow this configuration to be
described (neither DT nor ACPI support this braindeadness). So if that
happens, the only way to support it is to actively pass the trigger type
to enable_percpu_irq().

Should we want to support it from the PoV of a firmware description,
we'd need to expand the trigger to be per-cpu as well, which feels a bit
mad. I'm not in any hurry here!

Thanks,

	M.
-- 
Jazz is not dead. It just smells funny...

  parent reply	other threads:[~2016-06-13 12:33 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
     [not found]   ` <1465312354-27778-3-git-send-email-jonathanh-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
2016-06-13 10:42     ` Marc Zyngier
     [not found]       ` <575E8E29.3090808-5wv7dgnIgG8@public.gmane.org>
2016-06-13 11:09         ` Jon Hunter
     [not found]           ` <575E9457.8010100-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
2016-06-13 11:59             ` Marc Zyngier
2016-06-13 12:24               ` Jon Hunter
     [not found]                 ` <575EA603.7090002-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
2016-06-13 12:33                   ` Marc Zyngier [this message]
2016-06-07 15:12 ` [PATCH V6 3/9] irqdomain: Don't set type when mapping an IRQ Jon Hunter
     [not found]   ` <1465312354-27778-4-git-send-email-jonathanh-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
2016-07-29  3:53     ` Masahiro Yamada
     [not found]       ` <CAK7LNASBpym341Yz57LPa5z81aLX0xmhEVvoY+q5zfiQkFSxwg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2016-07-29  8:10         ` Marc Zyngier
     [not found]           ` <579B0F6C.9070806-5wv7dgnIgG8@public.gmane.org>
2016-08-01  1:28             ` Masahiro Yamada
2016-08-01  7:46               ` Marc Zyngier
     [not found]                 ` <579EFE6D.3050807-5wv7dgnIgG8@public.gmane.org>
2016-08-01  8:30                   ` Masahiro Yamada
2016-07-29  8:31         ` Jon Hunter
     [not found]           ` <bdd8ed36-c2dc-6f73-d362-2cf47d128e6f-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
2016-08-01  3:09             ` Masahiro Yamada
2017-08-17 12:46     ` [V6,3/9] " jeffy
2017-08-17 13:34       ` Marc Zyngier
     [not found]         ` <feb4e020-b738-9165-c044-b0e246ee4bd5-5wv7dgnIgG8@public.gmane.org>
2017-08-17 14:42           ` jeffy
     [not found] ` <1465312354-27778-1-git-send-email-jonathanh-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
2016-06-07 15:12   ` [PATCH V6 4/9] genirq: Add runtime power management support for IRQ chips Jon Hunter
     [not found]     ` <1465312354-27778-5-git-send-email-jonathanh-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
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
     [not found]   ` <1465312354-27778-10-git-send-email-jonathanh-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
2016-06-13  9:10     ` Marc Zyngier
     [not found]       ` <575E789F.3050509-5wv7dgnIgG8@public.gmane.org>
2016-06-13  9:58         ` Jon Hunter
     [not found]           ` <575E83B8.2050602-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
2016-06-13 10:13             ` Marc Zyngier
     [not found]               ` <575E8741.8060902-5wv7dgnIgG8@public.gmane.org>
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=575EA836.4010406@arm.com \
    --to=marc.zyngier-5wv7dgnigg8@public.gmane.org \
    --cc=devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=galak-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org \
    --cc=geert-Td1EMuHUCqxL1ZNQvxDV9g@public.gmane.org \
    --cc=grygorii.strashko-l0cyMroinI0@public.gmane.org \
    --cc=ijc+devicetree-KcIKpvwj1kUDXYZnReoRVg@public.gmane.org \
    --cc=jason-NLaQJdtUoK4Be96aLqz0jA@public.gmane.org \
    --cc=jonathanh-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org \
    --cc=khilman-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org \
    --cc=lars-Qo5EllUWu/uELgA04lAiVw@public.gmane.org \
    --cc=linus.walleij-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org \
    --cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-tegra-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=mark.rutland-5wv7dgnIgG8@public.gmane.org \
    --cc=pawel.moll-5wv7dgnIgG8@public.gmane.org \
    --cc=robh+dt-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org \
    --cc=swarren-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org \
    --cc=tglx-hfZtesqFncYOwBW4kG4KsQ@public.gmane.org \
    --cc=thierry.reding-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
    /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;
as well as URLs for NNTP newsgroup(s).