blob: 5b6bc7016c223e7496fc2645ae8b3434ef83b96b [file] [log] [blame]
Greg Kroah-Hartmanb2441312017-11-01 15:07:57 +01001/* SPDX-License-Identifier: GPL-2.0 */
H. Peter Anvin1965aae2008-10-22 22:26:29 -07002#ifndef _ASM_X86_SPINLOCK_H
3#define _ASM_X86_SPINLOCK_H
Glauber de Oliveira Costa2fed0c52008-01-30 13:30:33 +01004
Jeremy Fitzhardinge96f853e2013-08-09 19:51:58 +05305#include <linux/jump_label.h>
Arun Sharma600634972011-07-26 16:09:06 -07006#include <linux/atomic.h>
Thomas Gleixner1075cf72008-01-30 13:30:34 +01007#include <asm/page.h>
8#include <asm/processor.h>
Nick Piggin314cdbe2008-01-30 13:31:21 +01009#include <linux/compiler.h>
Jeremy Fitzhardinge74d4aff2008-07-07 12:07:50 -070010#include <asm/paravirt.h>
Jeremy Fitzhardinge96f853e2013-08-09 19:51:58 +053011#include <asm/bitops.h>
12
Thomas Gleixner1075cf72008-01-30 13:30:34 +010013/*
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 Weinberger83be4ff2012-08-14 14:47:37 -070019 * These are fair FIFO ticket locks, which support up to 2^16 CPUs.
Thomas Gleixner1075cf72008-01-30 13:30:34 +010020 *
21 * (the type definitions are in asm/spinlock_types.h)
22 */
23
Jeremy Fitzhardinge545ac132013-08-09 19:51:49 +053024/* How long a lock should spin before we consider blocking */
25#define SPIN_THRESHOLD (1 << 15)
26
Waiman Longd73a3392015-04-24 14:56:31 -040027#include <asm/qspinlock.h>
Thomas Gleixner1075cf72008-01-30 13:30:34 +010028
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 Long2ff810a2014-08-14 13:27:30 -040039 * On x86, we implement read-write locks using the generic qrwlock with
40 * x86 specific optimization.
Thomas Gleixner1075cf72008-01-30 13:30:34 +010041 */
42
Waiman Longbd01ec12014-02-03 13:18:57 +010043#include <asm/qrwlock.h>
Thomas Gleixner1075cf72008-01-30 13:30:34 +010044
H. Peter Anvin1965aae2008-10-22 22:26:29 -070045#endif /* _ASM_X86_SPINLOCK_H */