irqchip/gic: WARN if setting the interrupt type for a PPI fails
[cascardo/linux.git] / drivers / irqchip / irq-gic-common.c
index f174ce0..97c0028 100644 (file)
@@ -50,14 +50,26 @@ int gic_configure_irq(unsigned int irq, unsigned int type,
        else if (type & IRQ_TYPE_EDGE_BOTH)
                val |= confmask;
 
+       /* If the current configuration is the same, then we are done */
+       if (val == oldval)
+               return 0;
+
        /*
         * Write back the new configuration, and possibly re-enable
-        * the interrupt. If we tried to write a new configuration and failed,
-        * return an error.
+        * the interrupt. If we fail to write a new configuration for
+        * an SPI then WARN and return an error. If we fail to write the
+        * configuration for a PPI this is most likely because the GIC
+        * does not allow us to set the configuration or we are in a
+        * non-secure mode, and hence it may not be catastrophic.
         */
        writel_relaxed(val, base + GIC_DIST_CONFIG + confoff);
-       if (readl_relaxed(base + GIC_DIST_CONFIG + confoff) != val && val != oldval)
-               ret = -EINVAL;
+       if (readl_relaxed(base + GIC_DIST_CONFIG + confoff) != val) {
+               if (WARN_ON(irq >= 32))
+                       ret = -EINVAL;
+               else
+                       pr_warn("GIC: PPI%d is secure or misconfigured\n",
+                               irq - 16);
+       }
 
        if (sync_access)
                sync_access();