summaryrefslogtreecommitdiffstats
path: root/arch/sparc/lib
Commit message (Collapse)AuthorAgeFilesLines
* sparc: Support atomic64_dec_if_positive properly.David S. Miller2012-11-092-1/+16
| | | | | | | | | | | Sparc32 already supported it, as a consequence of using the generic atomic64 implementation. And the sparc64 implementation is rather trivial. This allows us to set ARCH_HAS_ATOMIC64_DEC_IF_POSITIVE for all of sparc, and avoid the annoying warning from lib/atomic64_test.c Signed-off-by: David S. Miller <davem@davemloft.net>
* sparc64: Niagara-4 bzero/memset, plus use MRU stores in page copy.David S. Miller2012-10-055-11/+156
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This adds optimized memset/bzero/page-clear routines for Niagara-4. We basically can do what powerpc has been able to do for a decade (via the "dcbz" instruction), which is use cache line clearing stores for bzero and memsets with a 'c' argument of zero. As long as we make the cache initializing store to each 32-byte subblock of the L2 cache line, it works. As with other Niagara-4 optimized routines, the key is to make sure to avoid any usage of the %asi register, as reads and writes to it cost at least 50 cycles. For the user clear cases, we don't use these new routines, we use the Niagara-1 variants instead. Those have to use %asi in an unavoidable way. A Niagara-4 8K page clear costs just under 600 cycles. Add definitions of the MRU variants of the cache initializing store ASIs. By default, cache initializing stores install the line as Least Recently Used. If we know we're going to use the data immediately (which is true for page copies and clears) we can use the Most Recently Used variant, to decrease the likelyhood of the lines being evicted before they get used. Signed-off-by: David S. Miller <davem@davemloft.net>
* Merge git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linuxDavid S. Miller2012-10-028-0/+538
|\ | | | | | | | | | | | | | | There's a Niagara 2 memcpy fix in this tree and I have a Kconfig fix from Dave Jones which requires the sparc-next changes which went upstream yesterday. Signed-off-by: David S. Miller <davem@davemloft.net>
| * sparc64: Fix trailing whitespace in NG4 memcpy.David S. Miller2012-09-281-3/+3
| | | | | | | | Signed-off-by: David S. Miller <davem@davemloft.net>
| * sparc64: Fix comment type in NG4 copy from user.David S. Miller2012-09-271-1/+1
| | | | | | | | | | | | Noticed by Greg Onufer. Signed-off-by: David S. Miller <davem@davemloft.net>
| * sparc64: Add SPARC-T4 optimized memcpy.David S. Miller2012-09-277-0/+534
| | | | | | | | | | | | | | | | | | | | | | | | | | Before After -------------- -------------- bw_tcp: 1288.53 MB/sec 1637.77 MB/sec bw_pipe: 1517.18 MB/sec 2107.61 MB/sec bw_unix: 1838.38 MB/sec 2640.91 MB/sec make -s -j128 allmodconfig 5min 49sec 5min 31sec Signed-off-by: David S. Miller <davem@davemloft.net>
| * sparc64: Add SHA1 driver making use of the 'sha1' instruction.David S. Miller2012-08-201-0/+4
| | | | | | | | | | Signed-off-by: David S. Miller <davem@davemloft.net> Acked-by: Herbert Xu <herbert@gondor.apana.org.au>
* | sparc64: Fix return value of Niagara-2 memcpy.David S. Miller2012-09-271-23/+23
|/ | | | | | | | | It gets clobbered by the kernel's VISEntryHalf, so we have to save it in a different register than the set clobbered by that macro. The instance in glibc is OK and doesn't have this problem. Signed-off-by: David S. Miller <davem@davemloft.net>
* sparc64: Consistently use fsrc2 rather than fmovd in optimized asm.David S. Miller2012-06-273-66/+66
| | | | | | Because fsrc2, unlike fmovd, does not update the %fsr register. Signed-off-by: David S. Miller <davem@davemloft.net>
* sparc: use the new generic strnlen_user() functionDavid Miller2012-05-264-209/+0
| | | | | | | This throws away the sparc-specific functions in favor of the generic optimized version. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
* lib: Sparc's strncpy_from_user is generic enough, move under lib/David S. Miller2012-05-241-144/+0
| | | | | | | | | | | | | | To use this, an architecture simply needs to: 1) Provide a user_addr_max() implementation via asm/uaccess.h 2) Add "select GENERIC_STRNCPY_FROM_USER" to their arch Kcnfig 3) Remove the existing strncpy_from_user() implementation and symbol exports their architecture had. Signed-off-by: David S. Miller <davem@davemloft.net> Acked-by: David Howells <dhowells@redhat.com>
* kernel: Move REPEAT_BYTE definition into linux/kernel.hDavid S. Miller2012-05-241-2/+1
| | | | | | | And make sure that everything using it explicitly includes that header file. Signed-off-by: David S. Miller <davem@davemloft.net>
* sparc: Increase portability of strncpy_from_user() implementation.David S. Miller2012-05-241-5/+27
| | | | | | | | | | | | | | Hide details of maximum user address calculation in a new asm/uaccess.h interface named user_addr_max(). Provide little-endian implementation in find_zero(), which should work but can probably be improved. Abstrace alignment check behind IS_UNALIGNED() macro. Kill double-semicolon, noticed by David Howells. Signed-off-by: David S. Miller <davem@davemloft.net>
* sparc: Optimize strncpy_from_user() zero byte search.David S. Miller2012-05-231-29/+21
| | | | | | | | | | | | | | | Compute a mask that will only have 0x80 in the bytes which had a zero in them. The formula is: ~(((x & 0x7f7f7f7f) + 0x7f7f7f7f) | x | 0x7f7f7f7f) In the inner word iteration, we have to compute the "x | 0x7f7f7f7f" part, so we can reuse that in the above calculation. Once we have this mask, we perform divide and conquer to find the highest 0x80 location. Signed-off-by: David S. Miller <davem@davemloft.net>
* sparc: Add full proper error handling to strncpy_from_user().David S. Miller2012-05-225-184/+133
| | | | | | | | | | | | Linus removed the end-of-address-space hackery from fs/namei.c:do_getname() so we really have to validate these edge conditions and cannot cheat any more (as x86 used to as well). Move to a common C implementation like x86 did. And if both src and dst are sufficiently aligned we'll do word at a time copies and checks as well. Signed-off-by: David S. Miller <davem@davemloft.net>
* sparc32: Add ucmpdi2.o to obj-y instead of lib-y.David S. Miller2012-05-191-2/+2
| | | | | | | Otherwise if no references exist in the static kernel image, we won't export the symbol properly to modules. Signed-off-by: David S. Miller <davem@davemloft.net>
* sparc32: add ucmpdi2Sam Ravnborg2012-05-192-1/+20
| | | | | | | | | | | | | | Based on copy from microblaze add ucmpdi2 implementation. This fixes build of niu driver which failed with: drivers/built-in.o: In function `niu_get_nfc': niu.c:(.text+0x91494): undefined reference to `__ucmpdi2' This driver will never be used on a sparc32 system, but patch added to fix build breakage with all*config builds. Signed-off-by: Sam Ravnborg <sam@ravnborg.org> Signed-off-by: David S. Miller <davem@davemloft.net>
* sparc32: Kill off software 32-bit multiply/divide routines.David S. Miller2012-05-1511-1810/+7
| | | | | | | | | | | | | For the explicit calls to .udiv/.umul in assembler, I made a mechanical (read as: safe) transformation. I didn't attempt to make any simplifications. In particular, __ndelay and __udelay can be simplified significantly. Some of the %y reads are unnecessary and these routines have no need any longer for allocating a register window, they can be leaf functions. Signed-off-by: David S. Miller <davem@davemloft.net>
* sparc32: Kill btfixup for xchg()'s 'swap' instruction.David S. Miller2012-05-132-25/+1
| | | | | | | | | | We always have this instruction available, so no need to use btfixup for it any more. This also eradicates the whole of atomic_32.S and thus the __atomic_begin and __atomic_end symbols completely. Signed-off-by: David S. Miller <davem@davemloft.net>
* sparc: Convert some assembler over to linakge.h's ENTRY/ENDPROCDavid S. Miller2012-05-1115-143/+97
| | | | | | Use those, instead of doing it all by hand. Signed-off-by: David S. Miller <davem@davemloft.net>
* sparc32: Remove inline strncmp "optimization" for constant counts.David S. Miller2012-05-112-7/+1
| | | | | | Let the compiler do stuff like this. Signed-off-by: David S. Miller <davem@davemloft.net>
* sparc32: drop sun4c specific ___xchg32 implementationSam Ravnborg2012-05-111-20/+0
| | | | | Signed-off-by: Sam Ravnborg <sam@ravnborg.org> Signed-off-by: David S. Miller <davem@davemloft.net>
* lib: Fix multiple definitions of clz_tabDavid Miller2012-02-021-15/+1
| | | | | | | | | | | | Both sparc 32-bit's software divide assembler and MPILIB provide clz_tab[] with identical contents. Break it out into a seperate object file and select it when SPARC32 or MPILIB is set. Reported-by: Al Viro <viro@ZenIV.linux.org.uk> Signed-off-by: David S. Miller <davem@davemloft.net> Signed-off-by: James Morris <jmorris@namei.org>
* Merge tag 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mst/vhostLinus Torvalds2012-01-101-23/+0
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | lib: use generic pci_iomap on all architectures Many architectures don't want to pull in iomap.c, so they ended up duplicating pci_iomap from that file. That function isn't trivial, and we are going to modify it https://lkml.org/lkml/2011/11/14/183 so the duplication hurts. This reduces the scope of the problem significantly, by moving pci_iomap to a separate file and referencing that from all architectures. * tag 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mst/vhost: alpha: drop pci_iomap/pci_iounmap from pci-noop.c mn10300: switch to GENERIC_PCI_IOMAP mn10300: add missing __iomap markers frv: switch to GENERIC_PCI_IOMAP tile: switch to GENERIC_PCI_IOMAP tile: don't panic on iomap sparc: switch to GENERIC_PCI_IOMAP sh: switch to GENERIC_PCI_IOMAP powerpc: switch to GENERIC_PCI_IOMAP parisc: switch to GENERIC_PCI_IOMAP mips: switch to GENERIC_PCI_IOMAP microblaze: switch to GENERIC_PCI_IOMAP arm: switch to GENERIC_PCI_IOMAP alpha: switch to GENERIC_PCI_IOMAP lib: add GENERIC_PCI_IOMAP lib: move GENERIC_IOMAP to lib/Kconfig Fix up trivial conflicts due to changes nearby in arch/{m68k,score}/Kconfig
| * sparc: switch to GENERIC_PCI_IOMAPMichael S. Tsirkin2011-12-041-23/+0
| | | | | | | | | | | | | | | | sparc copied pci_iomap from generic code, probably to avoid pulling the rest of iomap.c in. Since that's in a separate file now, we can reuse the common implementation. Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
* | sparc32: drop unused atomic24 supportSam Ravnborg2011-12-272-61/+0
|/ | | | | | | atomic24 support was used to semaphores in the past - but is no longer used. Signed-off-by: Sam Ravnborg <sam@ravnborg.org> Signed-off-by: David S. Miller <davem@davemloft.net>
* sparc32: Correct the return value of memcpy.David S. Miller2011-10-201-15/+7
| | | | | | | Properly return the original destination buffer pointer. Signed-off-by: David S. Miller <davem@davemloft.net> Tested-by: Kjetil Oftedal <oftedal@gmail.com>
* sparc32: Remove uses of %g7 in memcpy implementation.David S. Miller2011-10-201-87/+92
| | | | | | | | | This is setting things up so that we can correct the return value, so that it properly returns the original destination buffer pointer. Signed-off-by: David S. Miller <davem@davemloft.net> Tested-by: Kjetil Oftedal <oftedal@gmail.com>
* sparc32: Remove non-kernel code from memcpy implementation.David S. Miller2011-10-201-605/+2
| | | | | Signed-off-by: David S. Miller <davem@davemloft.net> Tested-by: Kjetil Oftedal <oftedal@gmail.com>
* sparc: Fix __atomic_add_unless() return value.Josip Rodin2011-08-041-1/+1
| | | | Signed-off-by: David S. Miller <davem@davemloft.net>
* sparc: Use popc when possible for ffs/__ffs/ffz.David S. Miller2011-08-022-1/+85
| | | | Signed-off-by: David S. Miller <davem@davemloft.net>
* sparc: Use popc if possible for hweight routines.David S. Miller2011-08-022-1/+52
| | | | | | Just like powerpc, we code patch at boot time. Signed-off-by: David S. Miller <davem@davemloft.net>
* sparc: Minor tweaks to Niagara page copy/clear.David S. Miller2011-08-023-101/+76
| | | | | | | | | | Don't use floating point on Niagara2, use the traditional plain Niagara code instead. Unroll Niagara loops to 128 bytes for copy, and 256 bytes for clear. Signed-off-by: David S. Miller <davem@davemloft.net>
* sparc: rename atomic_add_unlessStephen Rothwell2011-07-271-2/+2
| | | | | | | | | | | | Should have been done in commit 1af08a1407f4 ("This is in preparation for more generic atomic"). Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au> Cc: Arun Sharma <asharma@fb.com> Cc: David Miller <davem@davemloft.net> Cc: "Hans-Christian Egtvedt" <hans-christian.egtvedt@atmel.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
* atomic: use <linux/atomic.h>Arun Sharma2011-07-261-1/+1
| | | | | | | | | | | | | | This allows us to move duplicated code in <asm/atomic.h> (atomic_inc_not_zero() for now) to <linux/atomic.h> Signed-off-by: Arun Sharma <asharma@fb.com> Reviewed-by: Eric Dumazet <eric.dumazet@gmail.com> Cc: Ingo Molnar <mingo@elte.hu> Cc: David Miller <davem@davemloft.net> Cc: Eric Dumazet <eric.dumazet@gmail.com> Acked-by: Mike Frysinger <vapier@gentoo.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
* Merge branch 'master' of ↵David S. Miller2011-05-201-3/+9
|\ | | | | | | master.kernel.org:/pub/scm/linux/kernel/git/davem/sparc-2.6
| * sparc32: Fixed unaligned memory copying in function ↵Tkhai Kirill2011-05-111-3/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | __csum_partial_copy_sparc_generic When we are in the label cc_dword_align, registers %o0 and %o1 have the same last 2 bits, but it's not guaranteed one of them is zero. So we can get unaligned memory access in label ccte. Example of parameters which lead to this: %o0=0x7ff183e9, %o1=0x8e709e7d, %g1=3 With the parameters I had a memory corruption, when the additional 5 bytes were rewritten. This patch corrects the error. One comment to the patch. We don't care about the third bit in %o1, because cc_end_cruft stores word or less. Signed-off-by: Tkhai Kirill <tkhai@yandex.ru> Signed-off-by: David S. Miller <davem@davemloft.net>
* | sparc32: removed unused code, implemented by generic codeDaniel Hellstrom2011-04-212-205/+0
|/ | | | | Signed-off-by: Daniel Hellstrom <daniel@gaisler.com> Signed-off-by: David S. Miller <davem@davemloft.net>
* Merge branch 'core-locking-for-linus' of ↵Linus Torvalds2011-03-151-1/+1
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip * 'core-locking-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip: rtmutex: tester: Remove the remaining BKL leftovers lockdep/timers: Explain in detail the locking problems del_timer_sync() may cause rtmutex: Simplify PI algorithm and make highest prio task get lock rwsem: Remove redundant asmregparm annotation rwsem: Move duplicate function prototypes to linux/rwsem.h rwsem: Unify the duplicate rwsem_is_locked() inlines rwsem: Move duplicate init macros and functions to linux/rwsem.h rwsem: Move duplicate struct rwsem declaration to linux/rwsem.h x86: Cleanup rwsem_count_t typedef rwsem: Cleanup includes locking: Remove deprecated lock initializers cred: Replace deprecated spinlock initialization kthread: Replace deprecated spinlock initialization xtensa: Replace deprecated spinlock initialization um: Replace deprecated spinlock initialization sparc: Replace deprecated spinlock initialization mips: Replace deprecated spinlock initialization cris: Replace deprecated spinlock initialization alpha: Replace deprecated spinlock initialization rtmutex-tester: Remove BKL tests
| * sparc: Replace deprecated spinlock initializationThomas Gleixner2011-01-271-1/+1
| | | | | | | | | | | | | | | | SPIN_LOCK_UNLOCK is deprecated. Use the lockdep capable variant instead. Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Acked-by: David S. Miller <davem@davemloft.net>
* | sparc: use bitmap_set()Akinobu Mita2011-02-081-3/+2
|/ | | | | | | | | Use bitmap_set() instead of calling __set_bit() each bit. Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com> Cc: "David S. Miller" <davem@davemloft.net> Cc: sparclinux@vger.kernel.org Signed-off-by: David S. Miller <davem@davemloft.net>
* sparc64: Make lock backoff really a NOP on UP builds.David S. Miller2010-08-182-14/+14
| | | | | | | | | | | As noticed by Mikulas Patocka, the backoff macros don't completely nop out for UP builds, we still get a branch always and a delay slot nop. Fix this by making the branch to the backoff spin loop selective, then we can nop out the spin loop completely. Signed-off-by: David S. Miller <davem@davemloft.net>
* sparc64: simple microoptimizations for atomic functionsMikulas Patocka2010-08-181-12/+8
| | | | | | | | | Simple microoptimizations for sparc64 atomic functions: Save one instruction by using a delay slot. Use %g1 instead of %g7, because %g1 is written earlier. Signed-off-by: Mikulas Patocka <mpatocka@redhat.com> Signed-off-by: David S. Miller <davem@davemloft.net>
* sparc64: Make rwsems 64-bit.David S. Miller2010-08-172-164/+1
| | | | | | | | | | | | | | | | | | | | Basically tip-off the powerpc code, use a 64-bit type and atomic64_t interfaces for the implementation. This gets us off of the by-hand asm code I wrote, which frankly I think probably ruins I-cache hit rates. The idea was the keep the call chains less deep, but anything taking the rw-semaphores probably is also calling other stuff and therefore already has allocated a stack-frame. So no real stack frame savings ever. Ben H. has posted patches to make powerpc use 64-bit too and with some abstractions we can probably use a shared header file somewhere. With suggestions from Sam Ravnborg. Signed-off-by: David S. Miller <davem@davemloft.net>
* sparc64: Allocate sufficient stack space in ftrace stubs.David S. Miller2010-04-131-4/+4
| | | | | | | | | | | | | 128 bytes is sufficient for the register window save area, but the calling conventions allow the callee to save up to 6 incoming argument registers into the stack frame after the register window save area. This means a minimal stack frame is 176 bytes (128 + (6 * 8)). This fixes random crashes when using the function tracer. Reported-by: Frederic Weisbecker <fweisbec@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
* sparc64: Add function graph tracer support.David S. Miller2010-04-121-6/+56
| | | | Signed-off-by: David S. Miller <davem@davemloft.net>
* sparc64: Give a stack frame to the ftrace call sites.David S. Miller2010-04-121-15/+16
| | | | | | | | | | | It's the only way we'll be able to implement the function graph tracer properly. A positive is that we no longer have to worry about the linker over-optimizing the tail call, since we don't use a tail call any more. Signed-off-by: David S. Miller <davem@davemloft.net>
* sparc64: Kill CONFIG_STACK_DEBUG code.David S. Miller2010-04-121-74/+0
| | | | | | The generic stack tracer does this job just as well. Signed-off-by: David S. Miller <davem@davemloft.net>
* sparc64: Add HAVE_FUNCTION_TRACE_MCOUNT_TEST and tidy up.David S. Miller2010-04-121-7/+15
| | | | | | | | | | | | | | Check function_trace_stop at ftrace_caller Toss mcount_call and dummy call of ftrace_stub, unnecessary. Document problems we'll have if the final kernel image link ever turns on relaxation. Properly size 'ftrace_call' so it looks right when inspecting instructions under gdb et al. Signed-off-by: David S. Miller <davem@davemloft.net>
* sparc: Stop trying to be so fancy and use __builtin_{memcpy,memset}()David S. Miller2009-12-105-13/+2
| | | | | | | This mirrors commit ff60fab71bb3b4fdbf8caf57ff3739ffd0887396 (x86: Use __builtin_memset and __builtin_memcpy for memset/memcpy) Signed-off-by: David S. Miller <davem@davemloft.net>
OpenPOWER on IntegriCloud