x86, pvticketlock: When paravirtualizing ticket locks, increment by 2
[pandora-kernel.git] / arch / x86 / include / asm / spinlock_types.h
1 #ifndef _ASM_X86_SPINLOCK_TYPES_H
2 #define _ASM_X86_SPINLOCK_TYPES_H
3
4 #include <linux/types.h>
5
6 #ifdef CONFIG_PARAVIRT_SPINLOCKS
7 #define __TICKET_LOCK_INC       2
8 #else
9 #define __TICKET_LOCK_INC       1
10 #endif
11
12 #if (CONFIG_NR_CPUS < (256 / __TICKET_LOCK_INC))
13 typedef u8  __ticket_t;
14 typedef u16 __ticketpair_t;
15 #else
16 typedef u16 __ticket_t;
17 typedef u32 __ticketpair_t;
18 #endif
19
20 #define TICKET_LOCK_INC ((__ticket_t)__TICKET_LOCK_INC)
21
22 #define TICKET_SHIFT    (sizeof(__ticket_t) * 8)
23
24 typedef struct arch_spinlock {
25         union {
26                 __ticketpair_t head_tail;
27                 struct __raw_tickets {
28                         __ticket_t head, tail;
29                 } tickets;
30         };
31 } arch_spinlock_t;
32
33 #define __ARCH_SPIN_LOCK_UNLOCKED       { { 0 } }
34
35 #include <asm/rwlock.h>
36
37 #endif /* _ASM_X86_SPINLOCK_TYPES_H */