Commit | Line | Data |
---|---|---|
1965aae3 PA |
1 | #ifndef _ASM_X86_SPINLOCK_H |
2 | #define _ASM_X86_SPINLOCK_H | |
2fed0c50 | 3 | |
96f853ea | 4 | #include <linux/jump_label.h> |
60063497 | 5 | #include <linux/atomic.h> |
1075cf7a TG |
6 | #include <asm/page.h> |
7 | #include <asm/processor.h> | |
314cdbef | 8 | #include <linux/compiler.h> |
74d4affd | 9 | #include <asm/paravirt.h> |
96f853ea JF |
10 | #include <asm/bitops.h> |
11 | ||
1075cf7a TG |
12 | /* |
13 | * Your basic SMP spinlocks, allowing only a single CPU anywhere | |
14 | * | |
15 | * Simple spin lock operations. There are two variants, one clears IRQ's | |
16 | * on the local processor, one does not. | |
17 | * | |
83be4ffa | 18 | * These are fair FIFO ticket locks, which support up to 2^16 CPUs. |
1075cf7a TG |
19 | * |
20 | * (the type definitions are in asm/spinlock_types.h) | |
21 | */ | |
22 | ||
545ac138 JF |
23 | /* How long a lock should spin before we consider blocking */ |
24 | #define SPIN_THRESHOLD (1 << 15) | |
25 | ||
d73a3397 | 26 | #include <asm/qspinlock.h> |
1075cf7a TG |
27 | |
28 | /* | |
29 | * Read-write spinlocks, allowing multiple readers | |
30 | * but only one writer. | |
31 | * | |
32 | * NOTE! it is quite common to have readers in interrupts | |
33 | * but no interrupt writers. For those circumstances we | |
34 | * can "mix" irq-safe locks - any writer needs to get a | |
35 | * irq-safe write-lock, but readers can get non-irqsafe | |
36 | * read-locks. | |
37 | * | |
2ff810a7 WL |
38 | * On x86, we implement read-write locks using the generic qrwlock with |
39 | * x86 specific optimization. | |
1075cf7a TG |
40 | */ |
41 | ||
bd01ec1a | 42 | #include <asm/qrwlock.h> |
1075cf7a | 43 | |
e5931943 TG |
44 | #define arch_read_lock_flags(lock, flags) arch_read_lock(lock) |
45 | #define arch_write_lock_flags(lock, flags) arch_write_lock(lock) | |
f5f7eac4 | 46 | |
0199c4e6 TG |
47 | #define arch_spin_relax(lock) cpu_relax() |
48 | #define arch_read_relax(lock) cpu_relax() | |
49 | #define arch_write_relax(lock) cpu_relax() | |
1075cf7a | 50 | |
1965aae3 | 51 | #endif /* _ASM_X86_SPINLOCK_H */ |