From 141d73f7d15830c118db618a7c6e915f7ff6e849 Mon Sep 17 00:00:00 2001 From: "David S. Miller" Date: Mon, 27 Oct 2003 10:26:34 -0800 Subject: [SPARC]: Add AIO syscalls, 32-bit compat handling will come later. --- include/asm-sparc/unistd.h | 11 ++++++++--- include/asm-sparc64/unistd.h | 11 ++++++++--- 2 files changed, 16 insertions(+), 6 deletions(-) (limited to 'include') diff --git a/include/asm-sparc/unistd.h b/include/asm-sparc/unistd.h index 47c2e1e266c2..044ab5ab5747 100644 --- a/include/asm-sparc/unistd.h +++ b/include/asm-sparc/unistd.h @@ -284,10 +284,15 @@ #define __NR_timer_delete 265 #define __NR_timer_create 266 /* #define __NR_vserver 267 Reserved for VSERVER */ -/* WARNING: You MAY NOT add syscall numbers larger than 267, since +#define __NR_io_setup 268 +#define __NR_io_destroy 268 +#define __NR_io_submit 269 +#define __NR_io_cancel 270 +#define __NR_io_getevents 271 +/* WARNING: You MAY NOT add syscall numbers larger than 271, since * all of the syscall tables in the Sparc kernel are - * sized to have 267 entries (starting at zero). Therefore - * find a free slot in the 0-266 range. + * sized to have 272 entries (starting at zero). Therefore + * find a free slot in the 0-271 range. */ #define _syscall0(type,name) \ diff --git a/include/asm-sparc64/unistd.h b/include/asm-sparc64/unistd.h index f666fed20caa..defdb109015b 100644 --- a/include/asm-sparc64/unistd.h +++ b/include/asm-sparc64/unistd.h @@ -286,10 +286,15 @@ #define __NR_timer_delete 265 #define __NR_timer_create 266 /* #define __NR_vserver 267 Reserved for VSERVER */ -/* WARNING: You MAY NOT add syscall numbers larger than 267, since +#define __NR_io_setup 268 +#define __NR_io_destroy 268 +#define __NR_io_submit 269 +#define __NR_io_cancel 270 +#define __NR_io_getevents 271 +/* WARNING: You MAY NOT add syscall numbers larger than 271, since * all of the syscall tables in the Sparc kernel are - * sized to have 267 entries (starting at zero). Therefore - * find a free slot in the 0-266 range. + * sized to have 272 entries (starting at zero). Therefore + * find a free slot in the 0-271 range. */ #define _syscall0(type,name) \ -- cgit v1.2.3 From 04c439f8ca4459de204892ec7eb67e095afc4291 Mon Sep 17 00:00:00 2001 From: "David S. Miller" Date: Mon, 27 Oct 2003 16:24:23 -0800 Subject: [SPARC64]: Get preempt building and working again. - HAVE_DEC_LOCK depends on SMP - Trap return preemption check needs interrupt disabled check - Implement write_trylock - Fix in_atomic() definition when PREEMPT enabled --- arch/sparc64/Kconfig | 2 +- arch/sparc64/kernel/rtrap.S | 7 ++++++- arch/sparc64/kernel/sparc64_ksyms.c | 1 + arch/sparc64/lib/rwlock.S | 22 ++++++++++++++++++++++ include/asm-sparc64/hardirq.h | 3 ++- include/asm-sparc64/spinlock.h | 2 ++ 6 files changed, 34 insertions(+), 3 deletions(-) (limited to 'include') diff --git a/arch/sparc64/Kconfig b/arch/sparc64/Kconfig index 6065f69f701c..af748abc7ae0 100644 --- a/arch/sparc64/Kconfig +++ b/arch/sparc64/Kconfig @@ -813,7 +813,7 @@ config DEBUG_SPINLOCK # the generic version in that case. config HAVE_DEC_LOCK bool - depends on !DEBUG_SPINLOCK + depends on SMP && !DEBUG_SPINLOCK default y config DEBUG_SPINLOCK_SLEEP diff --git a/arch/sparc64/kernel/rtrap.S b/arch/sparc64/kernel/rtrap.S index 97f596873c0a..b58afaeca193 100644 --- a/arch/sparc64/kernel/rtrap.S +++ b/arch/sparc64/kernel/rtrap.S @@ -270,9 +270,14 @@ to_kernel: #ifdef CONFIG_PREEMPT ldsw [%g6 + TI_PRE_COUNT], %l5 brnz %l5, kern_fpucheck + ldx [%g6 + TI_FLAGS], %l5 + andcc %l5, _TIF_NEED_RESCHED, %g0 + be,pt %xcc, kern_fpucheck + srl %l4, 20, %l5 + cmp %l5, 0 + bne,pn %xcc, kern_fpucheck sethi %hi(PREEMPT_ACTIVE), %l6 stw %l6, [%g6 + TI_PRE_COUNT] - wrpr 0, %pil call schedule nop ba,pt %xcc, rtrap diff --git a/arch/sparc64/kernel/sparc64_ksyms.c b/arch/sparc64/kernel/sparc64_ksyms.c index 34fcdf186b9e..a9d77fb4b0e7 100644 --- a/arch/sparc64/kernel/sparc64_ksyms.c +++ b/arch/sparc64/kernel/sparc64_ksyms.c @@ -136,6 +136,7 @@ EXPORT_SYMBOL(__read_lock); EXPORT_SYMBOL(__read_unlock); EXPORT_SYMBOL(__write_lock); EXPORT_SYMBOL(__write_unlock); +EXPORT_SYMBOL(__write_trylock); #endif /* Hard IRQ locking */ diff --git a/arch/sparc64/lib/rwlock.S b/arch/sparc64/lib/rwlock.S index 56edad121be7..ffbf75bc3bc7 100644 --- a/arch/sparc64/lib/rwlock.S +++ b/arch/sparc64/lib/rwlock.S @@ -63,5 +63,27 @@ __write_lock: /* %o0 = lock_ptr */ be,pt %icc, 99b membar #StoreLoad | #StoreStore ba,a,pt %xcc, 1b + + .globl __write_trylock +__write_trylock: /* %o0 = lock_ptr */ + sethi %hi(0x80000000), %g2 +1: lduw [%o0], %g5 + brnz,pn %g5, __write_trylock_fail +4: or %g5, %g2, %g7 + + cas [%o0], %g5, %g7 + cmp %g5, %g7 + be,pt %icc, __write_trylock_succeed + membar #StoreLoad | #StoreStore + + ba,pt %xcc, 1b + nop +__write_trylock_succeed: + retl + mov 1, %o0 + +__write_trylock_fail: + retl + mov 0, %o0 rwlock_impl_end: diff --git a/include/asm-sparc64/hardirq.h b/include/asm-sparc64/hardirq.h index 97e43a160b3b..b57dd3df9965 100644 --- a/include/asm-sparc64/hardirq.h +++ b/include/asm-sparc64/hardirq.h @@ -79,7 +79,8 @@ typedef struct { #define irq_enter() (preempt_count() += HARDIRQ_OFFSET) #ifdef CONFIG_PREEMPT -# define in_atomic() (preempt_count() != kernel_locked()) +# include +# define in_atomic() ((preempt_count() & ~PREEMPT_ACTIVE) != kernel_locked()) # define IRQ_EXIT_OFFSET (HARDIRQ_OFFSET-1) #else # define in_atomic() (preempt_count() != 0) diff --git a/include/asm-sparc64/spinlock.h b/include/asm-sparc64/spinlock.h index 8bdc07cfad6f..201472fc01bc 100644 --- a/include/asm-sparc64/spinlock.h +++ b/include/asm-sparc64/spinlock.h @@ -118,11 +118,13 @@ extern void __read_lock(rwlock_t *); extern void __read_unlock(rwlock_t *); extern void __write_lock(rwlock_t *); extern void __write_unlock(rwlock_t *); +extern int __write_trylock(rwlock_t *); #define _raw_read_lock(p) __read_lock(p) #define _raw_read_unlock(p) __read_unlock(p) #define _raw_write_lock(p) __write_lock(p) #define _raw_write_unlock(p) __write_unlock(p) +#define _raw_write_trylock(p) __write_trylock(p) #else /* !(CONFIG_DEBUG_SPINLOCK) */ -- cgit v1.2.3