|
@@ -21,6 +21,8 @@
|
|
|
|
|
|
#include "irq-gic-common.h"
|
|
|
|
|
|
+static DEFINE_RAW_SPINLOCK(irq_controller_lock);
|
|
|
+
|
|
|
static const struct gic_kvm_info *gic_kvm_info;
|
|
|
|
|
|
const struct gic_kvm_info *gic_get_kvm_info(void)
|
|
@@ -53,11 +55,13 @@ int gic_configure_irq(unsigned int irq, unsigned int type,
|
|
|
u32 confoff = (irq / 16) * 4;
|
|
|
u32 val, oldval;
|
|
|
int ret = 0;
|
|
|
+ unsigned long flags;
|
|
|
|
|
|
/*
|
|
|
* Read current configuration register, and insert the config
|
|
|
* for "irq", depending on "type".
|
|
|
*/
|
|
|
+ raw_spin_lock_irqsave(&irq_controller_lock, flags);
|
|
|
val = oldval = readl_relaxed(base + GIC_DIST_CONFIG + confoff);
|
|
|
if (type & IRQ_TYPE_LEVEL_MASK)
|
|
|
val &= ~confmask;
|
|
@@ -65,8 +69,10 @@ int gic_configure_irq(unsigned int irq, unsigned int type,
|
|
|
val |= confmask;
|
|
|
|
|
|
/* If the current configuration is the same, then we are done */
|
|
|
- if (val == oldval)
|
|
|
+ if (val == oldval) {
|
|
|
+ raw_spin_unlock_irqrestore(&irq_controller_lock, flags);
|
|
|
return 0;
|
|
|
+ }
|
|
|
|
|
|
/*
|
|
|
* Write back the new configuration, and possibly re-enable
|
|
@@ -84,6 +90,7 @@ int gic_configure_irq(unsigned int irq, unsigned int type,
|
|
|
pr_warn("GIC: PPI%d is secure or misconfigured\n",
|
|
|
irq - 16);
|
|
|
}
|
|
|
+ raw_spin_unlock_irqrestore(&irq_controller_lock, flags);
|
|
|
|
|
|
if (sync_access)
|
|
|
sync_access();
|