Skip to content

Commit

Permalink
locking, ARM: Annotate low level hw locks as raw
Browse files Browse the repository at this point in the history
Annotate the low level hardware locks which must not be preempted.

In mainline this change documents the low level nature of
the lock - otherwise there's no functional difference. Lockdep
and Sparse checking will work as usual.

Signed-off-by: Thomas Gleixner <[email protected]>
Cc: Russell King <[email protected]>
Signed-off-by: Ingo Molnar <[email protected]>
  • Loading branch information
KAGA-KOKO authored and Ingo Molnar committed Sep 13, 2011
1 parent a1741e7 commit bd31b85
Show file tree
Hide file tree
Showing 18 changed files with 110 additions and 110 deletions.
26 changes: 13 additions & 13 deletions arch/arm/common/gic.c
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
#include <asm/mach/irq.h>
#include <asm/hardware/gic.h>

static DEFINE_SPINLOCK(irq_controller_lock);
static DEFINE_RAW_SPINLOCK(irq_controller_lock);

/* Address of GIC 0 CPU interface */
void __iomem *gic_cpu_base_addr __read_mostly;
Expand Down Expand Up @@ -82,30 +82,30 @@ static void gic_mask_irq(struct irq_data *d)
{
u32 mask = 1 << (d->irq % 32);

spin_lock(&irq_controller_lock);
raw_spin_lock(&irq_controller_lock);
writel_relaxed(mask, gic_dist_base(d) + GIC_DIST_ENABLE_CLEAR + (gic_irq(d) / 32) * 4);
if (gic_arch_extn.irq_mask)
gic_arch_extn.irq_mask(d);
spin_unlock(&irq_controller_lock);
raw_spin_unlock(&irq_controller_lock);
}

static void gic_unmask_irq(struct irq_data *d)
{
u32 mask = 1 << (d->irq % 32);

spin_lock(&irq_controller_lock);
raw_spin_lock(&irq_controller_lock);
if (gic_arch_extn.irq_unmask)
gic_arch_extn.irq_unmask(d);
writel_relaxed(mask, gic_dist_base(d) + GIC_DIST_ENABLE_SET + (gic_irq(d) / 32) * 4);
spin_unlock(&irq_controller_lock);
raw_spin_unlock(&irq_controller_lock);
}

static void gic_eoi_irq(struct irq_data *d)
{
if (gic_arch_extn.irq_eoi) {
spin_lock(&irq_controller_lock);
raw_spin_lock(&irq_controller_lock);
gic_arch_extn.irq_eoi(d);
spin_unlock(&irq_controller_lock);
raw_spin_unlock(&irq_controller_lock);
}

writel_relaxed(gic_irq(d), gic_cpu_base(d) + GIC_CPU_EOI);
Expand All @@ -129,7 +129,7 @@ static int gic_set_type(struct irq_data *d, unsigned int type)
if (type != IRQ_TYPE_LEVEL_HIGH && type != IRQ_TYPE_EDGE_RISING)
return -EINVAL;

spin_lock(&irq_controller_lock);
raw_spin_lock(&irq_controller_lock);

if (gic_arch_extn.irq_set_type)
gic_arch_extn.irq_set_type(d, type);
Expand All @@ -154,7 +154,7 @@ static int gic_set_type(struct irq_data *d, unsigned int type)
if (enabled)
writel_relaxed(enablemask, base + GIC_DIST_ENABLE_SET + enableoff);

spin_unlock(&irq_controller_lock);
raw_spin_unlock(&irq_controller_lock);

return 0;
}
Expand Down Expand Up @@ -182,10 +182,10 @@ static int gic_set_affinity(struct irq_data *d, const struct cpumask *mask_val,
mask = 0xff << shift;
bit = 1 << (cpu + shift);

spin_lock(&irq_controller_lock);
raw_spin_lock(&irq_controller_lock);
val = readl_relaxed(reg) & ~mask;
writel_relaxed(val | bit, reg);
spin_unlock(&irq_controller_lock);
raw_spin_unlock(&irq_controller_lock);

return IRQ_SET_MASK_OK;
}
Expand Down Expand Up @@ -215,9 +215,9 @@ static void gic_handle_cascade_irq(unsigned int irq, struct irq_desc *desc)

chained_irq_enter(chip, desc);

spin_lock(&irq_controller_lock);
raw_spin_lock(&irq_controller_lock);
status = readl_relaxed(chip_data->cpu_base + GIC_CPU_INTACK);
spin_unlock(&irq_controller_lock);
raw_spin_unlock(&irq_controller_lock);

gic_irq = (status & 0x3ff);
if (gic_irq == 1023)
Expand Down
6 changes: 3 additions & 3 deletions arch/arm/include/asm/dma.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,18 +34,18 @@
#define DMA_MODE_CASCADE 0xc0
#define DMA_AUTOINIT 0x10

extern spinlock_t dma_spin_lock;
extern raw_spinlock_t dma_spin_lock;

static inline unsigned long claim_dma_lock(void)
{
unsigned long flags;
spin_lock_irqsave(&dma_spin_lock, flags);
raw_spin_lock_irqsave(&dma_spin_lock, flags);
return flags;
}

static inline void release_dma_lock(unsigned long flags)
{
spin_unlock_irqrestore(&dma_spin_lock, flags);
raw_spin_unlock_irqrestore(&dma_spin_lock, flags);
}

/* Clear the 'DMA Pointer Flip Flop'.
Expand Down
4 changes: 2 additions & 2 deletions arch/arm/include/asm/mmu.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
typedef struct {
#ifdef CONFIG_CPU_HAS_ASID
unsigned int id;
spinlock_t id_lock;
raw_spinlock_t id_lock;
#endif
unsigned int kvm_seq;
} mm_context_t;
Expand All @@ -16,7 +16,7 @@ typedef struct {

/* init_mm.context.id_lock should be initialized. */
#define INIT_MM_CONTEXT(name) \
.context.id_lock = __SPIN_LOCK_UNLOCKED(name.context.id_lock),
.context.id_lock = __RAW_SPIN_LOCK_UNLOCKED(name.context.id_lock),
#else
#define ASID(mm) (0)
#endif
Expand Down
2 changes: 1 addition & 1 deletion arch/arm/kernel/dma.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@

#include <asm/mach/dma.h>

DEFINE_SPINLOCK(dma_spin_lock);
DEFINE_RAW_SPINLOCK(dma_spin_lock);
EXPORT_SYMBOL(dma_spin_lock);

static dma_t *dma_chan[MAX_DMA_CHANNELS];
Expand Down
6 changes: 3 additions & 3 deletions arch/arm/kernel/smp.c
Original file line number Diff line number Diff line change
Expand Up @@ -538,7 +538,7 @@ static void percpu_timer_stop(void)
}
#endif

static DEFINE_SPINLOCK(stop_lock);
static DEFINE_RAW_SPINLOCK(stop_lock);

/*
* ipi_cpu_stop - handle IPI from smp_send_stop()
Expand All @@ -547,10 +547,10 @@ static void ipi_cpu_stop(unsigned int cpu)
{
if (system_state == SYSTEM_BOOTING ||
system_state == SYSTEM_RUNNING) {
spin_lock(&stop_lock);
raw_spin_lock(&stop_lock);
printk(KERN_CRIT "CPU%u: stopping\n", cpu);
dump_stack();
spin_unlock(&stop_lock);
raw_spin_unlock(&stop_lock);
}

set_cpu_online(cpu, false);
Expand Down
20 changes: 10 additions & 10 deletions arch/arm/kernel/traps.c
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@ static int __die(const char *str, int err, struct thread_info *thread, struct pt
return ret;
}

static DEFINE_SPINLOCK(die_lock);
static DEFINE_RAW_SPINLOCK(die_lock);

/*
* This function is protected against re-entrancy.
Expand All @@ -267,7 +267,7 @@ void die(const char *str, struct pt_regs *regs, int err)

oops_enter();

spin_lock_irq(&die_lock);
raw_spin_lock_irq(&die_lock);
console_verbose();
bust_spinlocks(1);
ret = __die(str, err, thread, regs);
Expand All @@ -277,7 +277,7 @@ void die(const char *str, struct pt_regs *regs, int err)

bust_spinlocks(0);
add_taint(TAINT_DIE);
spin_unlock_irq(&die_lock);
raw_spin_unlock_irq(&die_lock);
oops_exit();

if (in_interrupt())
Expand All @@ -302,24 +302,24 @@ void arm_notify_die(const char *str, struct pt_regs *regs,
}

static LIST_HEAD(undef_hook);
static DEFINE_SPINLOCK(undef_lock);
static DEFINE_RAW_SPINLOCK(undef_lock);

void register_undef_hook(struct undef_hook *hook)
{
unsigned long flags;

spin_lock_irqsave(&undef_lock, flags);
raw_spin_lock_irqsave(&undef_lock, flags);
list_add(&hook->node, &undef_hook);
spin_unlock_irqrestore(&undef_lock, flags);
raw_spin_unlock_irqrestore(&undef_lock, flags);
}

void unregister_undef_hook(struct undef_hook *hook)
{
unsigned long flags;

spin_lock_irqsave(&undef_lock, flags);
raw_spin_lock_irqsave(&undef_lock, flags);
list_del(&hook->node);
spin_unlock_irqrestore(&undef_lock, flags);
raw_spin_unlock_irqrestore(&undef_lock, flags);
}

static int call_undef_hook(struct pt_regs *regs, unsigned int instr)
Expand All @@ -328,12 +328,12 @@ static int call_undef_hook(struct pt_regs *regs, unsigned int instr)
unsigned long flags;
int (*fn)(struct pt_regs *regs, unsigned int instr) = NULL;

spin_lock_irqsave(&undef_lock, flags);
raw_spin_lock_irqsave(&undef_lock, flags);
list_for_each_entry(hook, &undef_hook, node)
if ((instr & hook->instr_mask) == hook->instr_val &&
(regs->ARM_cpsr & hook->cpsr_mask) == hook->cpsr_val)
fn = hook->fn;
spin_unlock_irqrestore(&undef_lock, flags);
raw_spin_unlock_irqrestore(&undef_lock, flags);

return fn ? fn(regs, instr) : 1;
}
Expand Down
2 changes: 1 addition & 1 deletion arch/arm/mach-footbridge/include/mach/hardware.h
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@
#define CPLD_FLASH_WR_ENABLE 1

#ifndef __ASSEMBLY__
extern spinlock_t nw_gpio_lock;
extern raw_spinlock_t nw_gpio_lock;
extern void nw_gpio_modify_op(unsigned int mask, unsigned int set);
extern void nw_gpio_modify_io(unsigned int mask, unsigned int in);
extern unsigned int nw_gpio_read(void);
Expand Down
14 changes: 7 additions & 7 deletions arch/arm/mach-footbridge/netwinder-hw.c
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ static inline void wb977_ww(int reg, int val)
/*
* This is a lock for accessing ports GP1_IO_BASE and GP2_IO_BASE
*/
DEFINE_SPINLOCK(nw_gpio_lock);
DEFINE_RAW_SPINLOCK(nw_gpio_lock);
EXPORT_SYMBOL(nw_gpio_lock);

static unsigned int current_gpio_op;
Expand Down Expand Up @@ -327,9 +327,9 @@ static inline void wb977_init_gpio(void)
/*
* Set Group1/Group2 outputs
*/
spin_lock_irqsave(&nw_gpio_lock, flags);
raw_spin_lock_irqsave(&nw_gpio_lock, flags);
nw_gpio_modify_op(-1, GPIO_RED_LED | GPIO_FAN);
spin_unlock_irqrestore(&nw_gpio_lock, flags);
raw_spin_unlock_irqrestore(&nw_gpio_lock, flags);
}

/*
Expand Down Expand Up @@ -390,9 +390,9 @@ static void __init cpld_init(void)
{
unsigned long flags;

spin_lock_irqsave(&nw_gpio_lock, flags);
raw_spin_lock_irqsave(&nw_gpio_lock, flags);
nw_cpld_modify(-1, CPLD_UNMUTE | CPLD_7111_DISABLE);
spin_unlock_irqrestore(&nw_gpio_lock, flags);
raw_spin_unlock_irqrestore(&nw_gpio_lock, flags);
}

static unsigned char rwa_unlock[] __initdata =
Expand Down Expand Up @@ -616,9 +616,9 @@ static int __init nw_hw_init(void)
cpld_init();
rwa010_init();

spin_lock_irqsave(&nw_gpio_lock, flags);
raw_spin_lock_irqsave(&nw_gpio_lock, flags);
nw_gpio_modify_op(GPIO_RED_LED|GPIO_GREEN_LED, DEFAULT_LEDS);
spin_unlock_irqrestore(&nw_gpio_lock, flags);
raw_spin_unlock_irqrestore(&nw_gpio_lock, flags);
}
return 0;
}
Expand Down
10 changes: 5 additions & 5 deletions arch/arm/mach-footbridge/netwinder-leds.c
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,13 @@
static char led_state;
static char hw_led_state;

static DEFINE_SPINLOCK(leds_lock);
static DEFINE_RAW_SPINLOCK(leds_lock);

static void netwinder_leds_event(led_event_t evt)
{
unsigned long flags;

spin_lock_irqsave(&leds_lock, flags);
raw_spin_lock_irqsave(&leds_lock, flags);

switch (evt) {
case led_start:
Expand Down Expand Up @@ -117,12 +117,12 @@ static void netwinder_leds_event(led_event_t evt)
break;
}

spin_unlock_irqrestore(&leds_lock, flags);
raw_spin_unlock_irqrestore(&leds_lock, flags);

if (led_state & LED_STATE_ENABLED) {
spin_lock_irqsave(&nw_gpio_lock, flags);
raw_spin_lock_irqsave(&nw_gpio_lock, flags);
nw_gpio_modify_op(GPIO_RED_LED | GPIO_GREEN_LED, hw_led_state);
spin_unlock_irqrestore(&nw_gpio_lock, flags);
raw_spin_unlock_irqrestore(&nw_gpio_lock, flags);
}
}

Expand Down
6 changes: 3 additions & 3 deletions arch/arm/mach-integrator/core.c
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ static struct amba_pl010_data integrator_uart_data = {

#define CM_CTRL IO_ADDRESS(INTEGRATOR_HDR_CTRL)

static DEFINE_SPINLOCK(cm_lock);
static DEFINE_RAW_SPINLOCK(cm_lock);

/**
* cm_control - update the CM_CTRL register.
Expand All @@ -217,10 +217,10 @@ void cm_control(u32 mask, u32 set)
unsigned long flags;
u32 val;

spin_lock_irqsave(&cm_lock, flags);
raw_spin_lock_irqsave(&cm_lock, flags);
val = readl(CM_CTRL) & ~mask;
writel(val | set, CM_CTRL);
spin_unlock_irqrestore(&cm_lock, flags);
raw_spin_unlock_irqrestore(&cm_lock, flags);
}

EXPORT_SYMBOL(cm_control);
Expand Down
Loading

0 comments on commit bd31b85

Please sign in to comment.