Jeremy Fitzhardinge | d5de884 | 2008-07-23 13:28:58 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Split spinlock implementation out into its own file, so it can be |
| 3 | * compiled in a FTRACE-compatible way. |
| 4 | */ |
| 5 | #include <linux/spinlock.h> |
| 6 | #include <linux/module.h> |
| 7 | |
| 8 | #include <asm/paravirt.h> |
| 9 | |
Jeremy Fitzhardinge | 63d3a75 | 2008-08-19 13:19:36 -0700 | [diff] [blame] | 10 | static void default_spin_lock_flags(struct raw_spinlock *lock, unsigned long flags) |
| 11 | { |
| 12 | __raw_spin_lock(lock); |
| 13 | } |
| 14 | |
Jeremy Fitzhardinge | d5de884 | 2008-07-23 13:28:58 -0700 | [diff] [blame] | 15 | struct pv_lock_ops pv_lock_ops = { |
| 16 | #ifdef CONFIG_SMP |
| 17 | .spin_is_locked = __ticket_spin_is_locked, |
| 18 | .spin_is_contended = __ticket_spin_is_contended, |
| 19 | |
| 20 | .spin_lock = __ticket_spin_lock, |
Jeremy Fitzhardinge | 63d3a75 | 2008-08-19 13:19:36 -0700 | [diff] [blame] | 21 | .spin_lock_flags = default_spin_lock_flags, |
Jeremy Fitzhardinge | d5de884 | 2008-07-23 13:28:58 -0700 | [diff] [blame] | 22 | .spin_trylock = __ticket_spin_trylock, |
| 23 | .spin_unlock = __ticket_spin_unlock, |
| 24 | #endif |
| 25 | }; |
Jeremy Fitzhardinge | 25258ef | 2008-08-20 11:31:07 -0700 | [diff] [blame^] | 26 | EXPORT_SYMBOL(pv_lock_ops); |
Jeremy Fitzhardinge | d5de884 | 2008-07-23 13:28:58 -0700 | [diff] [blame] | 27 | |
| 28 | void __init paravirt_use_bytelocks(void) |
| 29 | { |
| 30 | #ifdef CONFIG_SMP |
| 31 | pv_lock_ops.spin_is_locked = __byte_spin_is_locked; |
| 32 | pv_lock_ops.spin_is_contended = __byte_spin_is_contended; |
| 33 | pv_lock_ops.spin_lock = __byte_spin_lock; |
| 34 | pv_lock_ops.spin_trylock = __byte_spin_trylock; |
| 35 | pv_lock_ops.spin_unlock = __byte_spin_unlock; |
| 36 | #endif |
| 37 | } |