Greg Kroah-Hartman | b244131 | 2017-11-01 15:07:57 +0100 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0 */ |
H. Peter Anvin | 1965aae | 2008-10-22 22:26:29 -0700 | [diff] [blame] | 2 | #ifndef _ASM_X86_SPINLOCK_H |
| 3 | #define _ASM_X86_SPINLOCK_H |
Glauber de Oliveira Costa | 2fed0c5 | 2008-01-30 13:30:33 +0100 | [diff] [blame] | 4 | |
Jeremy Fitzhardinge | 96f853e | 2013-08-09 19:51:58 +0530 | [diff] [blame] | 5 | #include <linux/jump_label.h> |
Arun Sharma | 60063497 | 2011-07-26 16:09:06 -0700 | [diff] [blame] | 6 | #include <linux/atomic.h> |
Thomas Gleixner | 1075cf7 | 2008-01-30 13:30:34 +0100 | [diff] [blame] | 7 | #include <asm/page.h> |
| 8 | #include <asm/processor.h> |
Nick Piggin | 314cdbe | 2008-01-30 13:31:21 +0100 | [diff] [blame] | 9 | #include <linux/compiler.h> |
Jeremy Fitzhardinge | 74d4aff | 2008-07-07 12:07:50 -0700 | [diff] [blame] | 10 | #include <asm/paravirt.h> |
Jeremy Fitzhardinge | 96f853e | 2013-08-09 19:51:58 +0530 | [diff] [blame] | 11 | #include <asm/bitops.h> |
| 12 | |
Thomas Gleixner | 1075cf7 | 2008-01-30 13:30:34 +0100 | [diff] [blame] | 13 | /* |
| 14 | * Your basic SMP spinlocks, allowing only a single CPU anywhere |
| 15 | * |
| 16 | * Simple spin lock operations. There are two variants, one clears IRQ's |
| 17 | * on the local processor, one does not. |
| 18 | * |
Richard Weinberger | 83be4ff | 2012-08-14 14:47:37 -0700 | [diff] [blame] | 19 | * These are fair FIFO ticket locks, which support up to 2^16 CPUs. |
Thomas Gleixner | 1075cf7 | 2008-01-30 13:30:34 +0100 | [diff] [blame] | 20 | * |
| 21 | * (the type definitions are in asm/spinlock_types.h) |
| 22 | */ |
| 23 | |
Jeremy Fitzhardinge | 545ac13 | 2013-08-09 19:51:49 +0530 | [diff] [blame] | 24 | /* How long a lock should spin before we consider blocking */ |
| 25 | #define SPIN_THRESHOLD (1 << 15) |
| 26 | |
Waiman Long | d73a339 | 2015-04-24 14:56:31 -0400 | [diff] [blame] | 27 | #include <asm/qspinlock.h> |
Thomas Gleixner | 1075cf7 | 2008-01-30 13:30:34 +0100 | [diff] [blame] | 28 | |
| 29 | /* |
| 30 | * Read-write spinlocks, allowing multiple readers |
| 31 | * but only one writer. |
| 32 | * |
| 33 | * NOTE! it is quite common to have readers in interrupts |
| 34 | * but no interrupt writers. For those circumstances we |
| 35 | * can "mix" irq-safe locks - any writer needs to get a |
| 36 | * irq-safe write-lock, but readers can get non-irqsafe |
| 37 | * read-locks. |
| 38 | * |
Waiman Long | 2ff810a | 2014-08-14 13:27:30 -0400 | [diff] [blame] | 39 | * On x86, we implement read-write locks using the generic qrwlock with |
| 40 | * x86 specific optimization. |
Thomas Gleixner | 1075cf7 | 2008-01-30 13:30:34 +0100 | [diff] [blame] | 41 | */ |
| 42 | |
Waiman Long | bd01ec1 | 2014-02-03 13:18:57 +0100 | [diff] [blame] | 43 | #include <asm/qrwlock.h> |
Thomas Gleixner | 1075cf7 | 2008-01-30 13:30:34 +0100 | [diff] [blame] | 44 | |
H. Peter Anvin | 1965aae | 2008-10-22 22:26:29 -0700 | [diff] [blame] | 45 | #endif /* _ASM_X86_SPINLOCK_H */ |