Skip to content

Commit d61a38b

Browse files
daniel-hellstromdavem330
authored andcommitted
sparc32, leon: must protect IRQ controller register with spinlock
The LEON interrupt controller has one single mask register for all IRQs per CPU, even though the genirq layer protects us from accessing the same IRQ at the same time other IRQs share the same mask register and may thus interfere. Some other IRQ controllers has a mask register or similar per IRQ instead which makes spinlocks unncessary. Signed-off-by: Daniel Hellstrom <daniel@gaisler.com> Acked-by: Sam Ravnborg <sam@ravnborg.org> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent 6baa9b2 commit d61a38b

1 file changed

Lines changed: 7 additions & 7 deletions

File tree

‎arch/sparc/kernel/leon_kernel.c‎

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ int leondebug_irq_disable;
3131
int leon_debug_irqout;
3232
static int dummy_master_l10_counter;
3333
unsigned long amba_system_id;
34+
static DEFINE_SPINLOCK(leon_irq_lock);
3435

3536
unsigned long leon3_gptimer_irq; /* interrupt controller irq number */
3637
unsigned long leon3_gptimer_idx; /* Timer Index (0..6) within Timer Core */
@@ -88,22 +89,21 @@ static void leon_unmask_irq(struct irq_data *data)
8889
unsigned long mask, flags;
8990

9091
mask = (unsigned long)data->chip_data;
91-
local_irq_save(flags);
92+
spin_lock_irqsave(&leon_irq_lock, flags);
9293
LEON3_BYPASS_STORE_PA(LEON_IMASK,
9394
(LEON3_BYPASS_LOAD_PA(LEON_IMASK) | (mask)));
94-
local_irq_restore(flags);
95+
spin_unlock_irqrestore(&leon_irq_lock, flags);
9596
}
9697

9798
static void leon_mask_irq(struct irq_data *data)
9899
{
99100
unsigned long mask, flags;
100101

101102
mask = (unsigned long)data->chip_data;
102-
local_irq_save(flags);
103+
spin_lock_irqsave(&leon_irq_lock, flags);
103104
LEON3_BYPASS_STORE_PA(LEON_IMASK,
104105
(LEON3_BYPASS_LOAD_PA(LEON_IMASK) & ~(mask)));
105-
local_irq_restore(flags);
106-
106+
spin_unlock_irqrestore(&leon_irq_lock, flags);
107107
}
108108

109109
static unsigned int leon_startup_irq(struct irq_data *data)
@@ -383,10 +383,10 @@ void leon_enable_irq_cpu(unsigned int irq_nr, unsigned int cpu)
383383
{
384384
unsigned long mask, flags, *addr;
385385
mask = get_irqmask(irq_nr);
386-
local_irq_save(flags);
386+
spin_lock_irqsave(&leon_irq_lock, flags);
387387
addr = (unsigned long *)&(leon3_irqctrl_regs->mask[cpu]);
388388
LEON3_BYPASS_STORE_PA(addr, (LEON3_BYPASS_LOAD_PA(addr) | (mask)));
389-
local_irq_restore(flags);
389+
spin_unlock_irqrestore(&leon_irq_lock, flags);
390390
}
391391

392392
#endif

0 commit comments

Comments
 (0)