On 03/17/2016 08:18 PM, Jon Hunter wrote:
On 17/03/16 14:19, Jon Hunter wrote:
When mapping an IRQ, if a mapping already exists, then we simply return
the virtual IRQ number. However, we do not check that the type settings
for the existing mapping match those for the mapping that is about to be
created. It may be unlikely that the type settings would not match, but
check for this and don't return a valid IRQ mapping if the type settings
do not match.
WARN 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@xxxxxxxxxx>
---
kernel/irq/irqdomain.c | 59 ++++++++++++++++++++++++++++++++++++--------------
1 file changed, 43 insertions(+), 16 deletions(-)
diff --git a/kernel/irq/irqdomain.c b/kernel/irq/irqdomain.c
index 3a519a01118b..0ea285baa619 100644
--- a/kernel/irq/irqdomain.c
+++ b/kernel/irq/irqdomain.c
@@ -549,6 +549,13 @@ static int irq_domain_translate(struct irq_domain *d,
fwspec->param, fwspec->param_count,
hwirq, type);
+ /*
+ * 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;
Not sure that this warn and in this place make sense.
type will come unchanged here from caller irq_create_fwspec_mapping()
[...]
--
regards,
-grygorii
--
To unsubscribe from this list: send the line "unsubscribe linux-tegra" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html