Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1384100
| From | Jon Hunter <jonathanh@nvidia.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [PATCH V2 04/14] irqdomain: Fix handling of type settings for existing mappings |
| Date | 2016-04-21 13:40 +0200 |
| Message-ID | <rql7H-8rt-1@gated-at.bofh.it> (permalink) |
| References | <rpYb8-6WM-7@gated-at.bofh.it> <rpYkN-70Z-9@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
On 20/04/16 12:03, Jon Hunter wrote:
> When mapping an IRQ, it is possible that a mapping for the IRQ already
> exists. If mapping does exist then there are the following issues with
> regard to the handling of the IRQ type settings ...
> 1. If the domain is part of a hierarchy, then:
> a. We do not check that the type settings for the existing mapping
> match those of the new mapping.
> b. We do not check to see if the type settings have been programmed
> yet (and they might not have been) and so we may never set the
> type.
> 2. If the domain is NOT part of a hierarchy, we will overwrite the
> current type settings programmed if they are different from the
> previous mapping. Please note that irq_create_mapping()
> calls irq_find_mapping() to check if a mapping already exists.
>
> Although, it may be unlikely that the type settings for a shared
> interrupt would not match, nonetheless we should check for this.
> Therefore, to fix this check if a mapping exists (regardless of whether
> the domain is part of a hierarchy or not) and if it does then:
> 1. Return the IRQ number if the type settings match or are not
> specified.
> 2. Program the type settings and return the IRQ number if the type
> settings have not been programmed yet.
> 3. Otherwise if the type setting do not match, then print a warning
> and don't return the IRQ number.
>
> Furthermore, add a warning if the type return by irq_domain_translate()
> has bits outside the sense mask set and then clear these bits. If these
> bits are not cleared then this will cause the comparision of the type
> settings for an existing mapping to fail with that of the new mapping
> even if the sense bit themselves match. The reason being is that the
> existing type settings are read by calling irq_get_trigger_type() which
> will clear any bits outside the sense mask. This will allow us to detect
> irqchips that are not correctly clearing these bits and fix them.
>
> Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
> ---
> kernel/irq/irqdomain.c | 38 +++++++++++++++++++++++++++++++++-----
> 1 file changed, 33 insertions(+), 5 deletions(-)
>
> diff --git a/kernel/irq/irqdomain.c b/kernel/irq/irqdomain.c
> index 245a485ffb61..88e9328b7aab 100644
> --- a/kernel/irq/irqdomain.c
> +++ b/kernel/irq/irqdomain.c
> @@ -592,15 +592,43 @@ unsigned int irq_create_fwspec_mapping(struct irq_fwspec *fwspec)
> if (irq_domain_translate(domain, fwspec, &hwirq, &type))
> return 0;
>
> - if (irq_domain_is_hierarchy(domain)) {
> + /*
> + * WARN if the irqchip returns a type with bits
> + * outside the sense mask set and clear these bits.
> + */
> + if (WARN_ON(type & ~IRQ_TYPE_SENSE_MASK))
> + type &= IRQ_TYPE_SENSE_MASK;
> +
> + /*
> + * If we've already configured this interrupt,
> + * don't do it again, or hell will break loose.
> + */
> + virq = irq_find_mapping(domain, hwirq);
> + if (virq) {
> /*
> - * If we've already configured this interrupt,
> - * don't do it again, or hell will break loose.
> + * If the trigger type is not specified or matches the
> + * current trigger type then we are done so return the
> + * interrupt number. Otherwise, if the trigger type does
> + * not match return 0.
I think I should have dropped this 'otherwise' sentence from here.
Jon
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH V2 00/14] Add support for Tegra210 AGIC Jon Hunter <jonathanh@nvidia.com> - 2016-04-20 13:10 +0200
[PATCH V2 12/14] irqchip/gic: Prepare for adding platform driver Jon Hunter <jonathanh@nvidia.com> - 2016-04-20 13:10 +0200
[PATCH V2 11/14] irqchip/gic: Pass GIC pointer to save/restore functions Jon Hunter <jonathanh@nvidia.com> - 2016-04-20 13:10 +0200
[PATCH V2 13/14] dt-bindings: arm-gic: Add documentation for Tegra210 AGIC Jon Hunter <jonathanh@nvidia.com> - 2016-04-20 13:10 +0200
Re: [PATCH V2 13/14] dt-bindings: arm-gic: Add documentation for Tegra210 AGIC Marc Zyngier <marc.zyngier@arm.com> - 2016-04-22 11:50 +0200
Re: [PATCH V2 13/14] dt-bindings: arm-gic: Add documentation for Tegra210 AGIC Mark Rutland <mark.rutland@arm.com> - 2016-04-22 12:10 +0200
Re: [PATCH V2 13/14] dt-bindings: arm-gic: Add documentation for Tegra210 AGIC Jon Hunter <jonathanh@nvidia.com> - 2016-04-22 13:20 +0200
Re: [PATCH V2 13/14] dt-bindings: arm-gic: Add documentation for Tegra210 AGIC Mark Rutland <mark.rutland@arm.com> - 2016-04-22 13:30 +0200
Re: [PATCH V2 13/14] dt-bindings: arm-gic: Add documentation for Tegra210 AGIC Jon Hunter <jonathanh@nvidia.com> - 2016-04-22 17:00 +0200
Re: [PATCH V2 13/14] dt-bindings: arm-gic: Add documentation for Tegra210 AGIC Jon Hunter <jonathanh@nvidia.com> - 2016-04-27 17:50 +0200
Re: [PATCH V2 13/14] dt-bindings: arm-gic: Add documentation for Tegra210 AGIC Mark Rutland <mark.rutland@arm.com> - 2016-04-27 19:40 +0200
Re: [PATCH V2 13/14] dt-bindings: arm-gic: Add documentation for Tegra210 AGIC Geert Uytterhoeven <geert@linux-m68k.org> - 2016-04-27 20:10 +0200
Re: [PATCH V2 13/14] dt-bindings: arm-gic: Add documentation for Tegra210 AGIC Jon Hunter <jonathanh@nvidia.com> - 2016-04-28 10:20 +0200
Re: [PATCH V2 13/14] dt-bindings: arm-gic: Add documentation for Tegra210 AGIC Geert Uytterhoeven <geert@linux-m68k.org> - 2016-04-28 10:40 +0200
Re: [PATCH V2 13/14] dt-bindings: arm-gic: Add documentation for Tegra210 AGIC Mark Rutland <mark.rutland@arm.com> - 2016-04-28 12:00 +0200
[PATCH V2 06/14] irqdomain: Don't set type when mapping an IRQ Jon Hunter <jonathanh@nvidia.com> - 2016-04-20 13:10 +0200
Re: [PATCH V2 06/14] irqdomain: Don't set type when mapping an IRQ Jon Hunter <jonathanh@nvidia.com> - 2016-04-21 17:50 +0200
Re: [PATCH V2 06/14] irqdomain: Don't set type when mapping an IRQ Marc Zyngier <marc.zyngier@arm.com> - 2016-04-22 10:30 +0200
Re: [PATCH V2 06/14] irqdomain: Don't set type when mapping an IRQ Jon Hunter <jonathanh@nvidia.com> - 2016-04-22 10:50 +0200
Re: [PATCH V2 06/14] irqdomain: Don't set type when mapping an IRQ Marc Zyngier <marc.zyngier@arm.com> - 2016-04-22 11:40 +0200
[PATCH V2 08/14] irqchip/gic: Don't initialise chip if mapping IO space fails Jon Hunter <jonathanh@nvidia.com> - 2016-04-20 13:10 +0200
[PATCH V2 09/14] irqchip/gic: Remove static irq_chip definition for eoimode1 Jon Hunter <jonathanh@nvidia.com> - 2016-04-20 13:10 +0200
[PATCH V2 01/14] irqchip/gic: Don't unnecessarily write the IRQ configuration Jon Hunter <jonathanh@nvidia.com> - 2016-04-20 13:20 +0200
[PATCH V2 04/14] irqdomain: Fix handling of type settings for existing mappings Jon Hunter <jonathanh@nvidia.com> - 2016-04-20 13:20 +0200
Re: [PATCH V2 04/14] irqdomain: Fix handling of type settings for existing mappings Jon Hunter <jonathanh@nvidia.com> - 2016-04-21 13:40 +0200
Re: [PATCH V2 04/14] irqdomain: Fix handling of type settings for existing mappings Marc Zyngier <marc.zyngier@arm.com> - 2016-04-22 10:20 +0200
[PATCH V2 02/14] irqchip/gic: WARN if setting the interrupt type for a PPI fails Jon Hunter <jonathanh@nvidia.com> - 2016-04-20 13:20 +0200
Re: [PATCH V2 02/14] irqchip/gic: WARN if setting the interrupt type for a PPI fails Marc Zyngier <marc.zyngier@arm.com> - 2016-04-22 11:00 +0200
csiph-web