1*b2441318SGreg Kroah-Hartman /* SPDX-License-Identifier: GPL-2.0 */ 21965aae3SH. Peter Anvin #ifndef _ASM_X86_SPINLOCK_H 31965aae3SH. Peter Anvin #define _ASM_X86_SPINLOCK_H 4bb898558SAl Viro 596f853eaSJeremy Fitzhardinge #include <linux/jump_label.h> 660063497SArun Sharma #include <linux/atomic.h> 7bb898558SAl Viro #include <asm/page.h> 8bb898558SAl Viro #include <asm/processor.h> 9bb898558SAl Viro #include <linux/compiler.h> 10bb898558SAl Viro #include <asm/paravirt.h> 1196f853eaSJeremy Fitzhardinge #include <asm/bitops.h> 1296f853eaSJeremy Fitzhardinge 13bb898558SAl Viro /* 14bb898558SAl Viro * Your basic SMP spinlocks, allowing only a single CPU anywhere 15bb898558SAl Viro * 16bb898558SAl Viro * Simple spin lock operations. There are two variants, one clears IRQ's 17bb898558SAl Viro * on the local processor, one does not. 18bb898558SAl Viro * 1983be4ffaSRichard Weinberger * These are fair FIFO ticket locks, which support up to 2^16 CPUs. 20bb898558SAl Viro * 21bb898558SAl Viro * (the type definitions are in asm/spinlock_types.h) 22bb898558SAl Viro */ 23bb898558SAl Viro 24545ac138SJeremy Fitzhardinge /* How long a lock should spin before we consider blocking */ 25545ac138SJeremy Fitzhardinge #define SPIN_THRESHOLD (1 << 15) 26545ac138SJeremy Fitzhardinge 27d73a3397SWaiman Long #include <asm/qspinlock.h> 28bb898558SAl Viro 29bb898558SAl Viro /* 30bb898558SAl Viro * Read-write spinlocks, allowing multiple readers 31bb898558SAl Viro * but only one writer. 32bb898558SAl Viro * 33bb898558SAl Viro * NOTE! it is quite common to have readers in interrupts 34bb898558SAl Viro * but no interrupt writers. For those circumstances we 35bb898558SAl Viro * can "mix" irq-safe locks - any writer needs to get a 36bb898558SAl Viro * irq-safe write-lock, but readers can get non-irqsafe 37bb898558SAl Viro * read-locks. 38bb898558SAl Viro * 392ff810a7SWaiman Long * On x86, we implement read-write locks using the generic qrwlock with 402ff810a7SWaiman Long * x86 specific optimization. 41bb898558SAl Viro */ 42bb898558SAl Viro 43bd01ec1aSWaiman Long #include <asm/qrwlock.h> 44bb898558SAl Viro 451965aae3SH. Peter Anvin #endif /* _ASM_X86_SPINLOCK_H */ 46