The attached patch permits the FRV architecture to make use of the xchg()
based mutex, overriding the use of xchg() with something based on the FRV
SWAP/SWAPI atomic op instructions. Note that xchg() in FRV is not actually
based on SWAP/SWAPI at the moment.
The patch also renames DECLARE_MUTEX*() for this arch to DECLARE_SEM_MUTEX*().
Signed-Off-By: David Howells <[email protected]>
---
warthog>diffstat -p1 mutex-frv-2615rc5-2.diff
arch/frv/Kconfig | 4 ++++
arch/frv/kernel/irq.c | 2 +-
include/asm-frv/system.h | 19 +++++++++++++++++++
3 files changed, 24 insertions(+), 1 deletion(-)
diff -uNrp linux-2.6.15-rc5/arch/frv/Kconfig linux-2.6.15-rc5-mutex/arch/frv/Kconfig
--- linux-2.6.15-rc5/arch/frv/Kconfig 2005-08-30 13:56:10.000000000 +0100
+++ linux-2.6.15-rc5-mutex/arch/frv/Kconfig 2005-12-16 17:40:50.000000000 +0000
@@ -10,6 +10,10 @@ config UID16
bool
default y
+config ARCH_XCHG_MUTEX
+ bool
+ default y
+
config RWSEM_GENERIC_SPINLOCK
bool
default y
diff -uNrp linux-2.6.15-rc5/include/asm-frv/system.h linux-2.6.15-rc5-mutex/include/asm-frv/system.h
--- linux-2.6.15-rc5/include/asm-frv/system.h 2005-06-22 13:52:26.000000000 +0100
+++ linux-2.6.15-rc5-mutex/include/asm-frv/system.h 2005-12-16 21:43:32.000000000 +0000
@@ -99,6 +99,25 @@ do { \
((__get_PSR() & PSR_PIL) >= PSR_PIL_14)
/*
+ * mutex implementation
+ */
+#define __mutex_trylock(mutex) \
+({ \
+ int oldstate; \
+ \
+ asm volatile("swap%I0 %M0,%1" \
+ : "+m"(mutex->state), "=r"(oldstate) \
+ : "1"(1) \
+ : "memory"); \
+ \
+ oldstate == 0; \
+})
+
+#define __mutex_release(mutex) do { (mutex)->state = 0; } while(0)
+
+#define mutex_is_locked(mutex) ((mutex)->state)
+
+/*
* Force strict CPU ordering.
*/
#define nop() asm volatile ("nop"::)
diff -uNrp linux-2.6.15-rc5/arch/frv/kernel/irq.c linux-2.6.15-rc5-mutex/arch/frv/kernel/irq.c
--- linux-2.6.15-rc5/arch/frv/kernel/irq.c 2005-03-02 12:07:44.000000000 +0000
+++ linux-2.6.15-rc5-mutex/arch/frv/kernel/irq.c 2005-12-15 17:14:56.000000000 +0000
@@ -503,7 +503,7 @@ void free_irq(unsigned int irq, void *de
* unassigned IRQ will cause GxICR_DETECT to be set
*/
-static DECLARE_MUTEX(probe_sem);
+static DECLARE_SEM_MUTEX(probe_sem);
/**
* probe_irq_on - begin an interrupt autodetect
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[Index of Archives]
[Kernel Newbies]
[Netfilter]
[Bugtraq]
[Photo]
[Stuff]
[Gimp]
[Yosemite News]
[MIPS Linux]
[ARM Linux]
[Linux Security]
[Linux RAID]
[Video 4 Linux]
[Linux for the blind]
[Linux Resources]