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> |
Jeremy Fitzhardinge | 96f853e | 2013-08-09 19:51:58 +0530 | [diff] [blame] | 7 | #include <linux/jump_label.h> |
Jeremy Fitzhardinge | d5de884 | 2008-07-23 13:28:58 -0700 | [diff] [blame] | 8 | |
| 9 | #include <asm/paravirt.h> |
| 10 | |
Ingo Molnar | 62c7a1e | 2015-05-11 09:47:23 +0200 | [diff] [blame] | 11 | #ifdef CONFIG_QUEUED_SPINLOCKS |
Peter Zijlstra (Intel) | f233f7f | 2015-04-24 14:56:38 -0400 | [diff] [blame] | 12 | __visible void __native_queued_spin_unlock(struct qspinlock *lock) |
| 13 | { |
| 14 | native_queued_spin_unlock(lock); |
| 15 | } |
| 16 | |
| 17 | PV_CALLEE_SAVE_REGS_THUNK(__native_queued_spin_unlock); |
| 18 | |
| 19 | bool pv_is_native_spin_unlock(void) |
| 20 | { |
| 21 | return pv_lock_ops.queued_spin_unlock.func == |
| 22 | __raw_callee_save___native_queued_spin_unlock; |
| 23 | } |
| 24 | #endif |
| 25 | |
Jeremy Fitzhardinge | d5de884 | 2008-07-23 13:28:58 -0700 | [diff] [blame] | 26 | struct pv_lock_ops pv_lock_ops = { |
| 27 | #ifdef CONFIG_SMP |
Ingo Molnar | 62c7a1e | 2015-05-11 09:47:23 +0200 | [diff] [blame] | 28 | #ifdef CONFIG_QUEUED_SPINLOCKS |
Peter Zijlstra (Intel) | f233f7f | 2015-04-24 14:56:38 -0400 | [diff] [blame] | 29 | .queued_spin_lock_slowpath = native_queued_spin_lock_slowpath, |
| 30 | .queued_spin_unlock = PV_CALLEE_SAVE(__native_queued_spin_unlock), |
| 31 | .wait = paravirt_nop, |
| 32 | .kick = paravirt_nop, |
Ingo Molnar | 62c7a1e | 2015-05-11 09:47:23 +0200 | [diff] [blame] | 33 | #else /* !CONFIG_QUEUED_SPINLOCKS */ |
Jeremy Fitzhardinge | 354714d | 2013-08-09 19:51:55 +0530 | [diff] [blame] | 34 | .lock_spinning = __PV_IS_CALLEE_SAVE(paravirt_nop), |
Jeremy Fitzhardinge | 545ac13 | 2013-08-09 19:51:49 +0530 | [diff] [blame] | 35 | .unlock_kick = paravirt_nop, |
Ingo Molnar | 62c7a1e | 2015-05-11 09:47:23 +0200 | [diff] [blame] | 36 | #endif /* !CONFIG_QUEUED_SPINLOCKS */ |
Peter Zijlstra (Intel) | f233f7f | 2015-04-24 14:56:38 -0400 | [diff] [blame] | 37 | #endif /* SMP */ |
Jeremy Fitzhardinge | d5de884 | 2008-07-23 13:28:58 -0700 | [diff] [blame] | 38 | }; |
Jeremy Fitzhardinge | 25258ef | 2008-08-20 11:31:07 -0700 | [diff] [blame] | 39 | EXPORT_SYMBOL(pv_lock_ops); |
Jeremy Fitzhardinge | d5de884 | 2008-07-23 13:28:58 -0700 | [diff] [blame] | 40 | |
Jeremy Fitzhardinge | 96f853e | 2013-08-09 19:51:58 +0530 | [diff] [blame] | 41 | struct static_key paravirt_ticketlocks_enabled = STATIC_KEY_INIT_FALSE; |
| 42 | EXPORT_SYMBOL(paravirt_ticketlocks_enabled); |