mirror of
https://github.com/tbsdtv/linux_media.git
synced 2025-07-23 12:43:29 +02:00
mmiowb: Hook up mmiowb helpers to spinlocks and generic I/O accessors
Removing explicit calls to mmiowb() from driver code means that we must now call into the generic mmiowb_spin_{lock,unlock}() functions from the core spinlock code. In order to elide barriers following critical sections without any I/O writes, we also hook into the asm-generic I/O routines. Acked-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Will Deacon <will.deacon@arm.com>
This commit is contained in:
@@ -57,6 +57,7 @@
|
||||
#include <linux/stringify.h>
|
||||
#include <linux/bottom_half.h>
|
||||
#include <asm/barrier.h>
|
||||
#include <asm/mmiowb.h>
|
||||
|
||||
|
||||
/*
|
||||
@@ -178,6 +179,7 @@ static inline void do_raw_spin_lock(raw_spinlock_t *lock) __acquires(lock)
|
||||
{
|
||||
__acquire(lock);
|
||||
arch_spin_lock(&lock->raw_lock);
|
||||
mmiowb_spin_lock();
|
||||
}
|
||||
|
||||
#ifndef arch_spin_lock_flags
|
||||
@@ -189,15 +191,22 @@ do_raw_spin_lock_flags(raw_spinlock_t *lock, unsigned long *flags) __acquires(lo
|
||||
{
|
||||
__acquire(lock);
|
||||
arch_spin_lock_flags(&lock->raw_lock, *flags);
|
||||
mmiowb_spin_lock();
|
||||
}
|
||||
|
||||
static inline int do_raw_spin_trylock(raw_spinlock_t *lock)
|
||||
{
|
||||
return arch_spin_trylock(&(lock)->raw_lock);
|
||||
int ret = arch_spin_trylock(&(lock)->raw_lock);
|
||||
|
||||
if (ret)
|
||||
mmiowb_spin_lock();
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static inline void do_raw_spin_unlock(raw_spinlock_t *lock) __releases(lock)
|
||||
{
|
||||
mmiowb_spin_unlock();
|
||||
arch_spin_unlock(&lock->raw_lock);
|
||||
__release(lock);
|
||||
}
|
||||
|
Reference in New Issue
Block a user