Skip to content

Commit cf5adce

Browse files
committed
[SPARC64]: Niagara-2 optimized copies.
The bzero/memset implementation stays the same as Niagara-1. Signed-off-by: David S. Miller <[email protected]>
1 parent 0fdb7f9 commit cf5adce

File tree

8 files changed

+716
-1
lines changed

8 files changed

+716
-1
lines changed

arch/sparc64/kernel/head.S

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -501,7 +501,7 @@ niagara_tlb_fixup:
501501
cmp %g1, SUN4V_CHIP_NIAGARA1
502502
be,pt %xcc, niagara_patch
503503
cmp %g1, SUN4V_CHIP_NIAGARA2
504-
be,pt %xcc, niagara_patch
504+
be,pt %xcc, niagara2_patch
505505
nop
506506

507507
call generic_patch_copyops
@@ -512,6 +512,15 @@ niagara_tlb_fixup:
512512
nop
513513

514514
ba,a,pt %xcc, 80f
515+
niagara2_patch:
516+
call niagara2_patch_copyops
517+
nop
518+
call niagara_patch_bzero
519+
nop
520+
call niagara2_patch_pageops
521+
nop
522+
523+
ba,a,pt %xcc, 80f
515524

516525
niagara_patch:
517526
call niagara_patch_copyops

arch/sparc64/lib/Makefile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ lib-y := PeeCeeI.o copy_page.o clear_page.o strlen.o strncmp.o \
1313
U3memcpy.o U3copy_from_user.o U3copy_to_user.o U3patch.o \
1414
NGmemcpy.o NGcopy_from_user.o NGcopy_to_user.o NGpatch.o \
1515
NGpage.o NGbzero.o \
16+
NG2memcpy.o NG2copy_from_user.o NG2copy_to_user.o NG2patch.o \
17+
NG2page.o \
1618
GENmemcpy.o GENcopy_from_user.o GENcopy_to_user.o GENpatch.o \
1719
GENpage.o GENbzero.o \
1820
copy_in_user.o user_fixup.o memmove.o \

arch/sparc64/lib/NG2copy_from_user.S

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
/* NG2copy_from_user.S: Niagara-2 optimized copy from userspace.
2+
*
3+
* Copyright (C) 2007 David S. Miller ([email protected])
4+
*/
5+
6+
#define EX_LD(x) \
7+
98: x; \
8+
.section .fixup; \
9+
.align 4; \
10+
99: wr %g0, ASI_AIUS, %asi;\
11+
retl; \
12+
mov 1, %o0; \
13+
.section __ex_table,"a";\
14+
.align 4; \
15+
.word 98b, 99b; \
16+
.text; \
17+
.align 4;
18+
19+
#ifndef ASI_AIUS
20+
#define ASI_AIUS 0x11
21+
#endif
22+
23+
#ifndef ASI_BLK_AIUS_4V
24+
#define ASI_BLK_AIUS_4V 0x17
25+
#endif
26+
27+
#define FUNC_NAME NG2copy_from_user
28+
#define LOAD(type,addr,dest) type##a [addr] %asi, dest
29+
#define LOAD_BLK(addr,dest) ldda [addr] ASI_BLK_AIUS_4V, dest
30+
#define EX_RETVAL(x) 0
31+
32+
#ifdef __KERNEL__
33+
#define PREAMBLE \
34+
rd %asi, %g1; \
35+
cmp %g1, ASI_AIUS; \
36+
bne,pn %icc, memcpy_user_stub; \
37+
nop
38+
#endif
39+
40+
#include "NG2memcpy.S"

arch/sparc64/lib/NG2copy_to_user.S

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
/* NG2copy_to_user.S: Niagara-2 optimized copy to userspace.
2+
*
3+
* Copyright (C) 2007 David S. Miller ([email protected])
4+
*/
5+
6+
#define EX_ST(x) \
7+
98: x; \
8+
.section .fixup; \
9+
.align 4; \
10+
99: wr %g0, ASI_AIUS, %asi;\
11+
retl; \
12+
mov 1, %o0; \
13+
.section __ex_table,"a";\
14+
.align 4; \
15+
.word 98b, 99b; \
16+
.text; \
17+
.align 4;
18+
19+
#ifndef ASI_AIUS
20+
#define ASI_AIUS 0x11
21+
#endif
22+
23+
#ifndef ASI_BLK_AIUS_4V
24+
#define ASI_BLK_AIUS_4V 0x17
25+
#endif
26+
27+
#ifndef ASI_BLK_INIT_QUAD_LDD_AIUS
28+
#define ASI_BLK_INIT_QUAD_LDD_AIUS 0x23
29+
#endif
30+
31+
#define FUNC_NAME NG2copy_to_user
32+
#define STORE(type,src,addr) type##a src, [addr] ASI_AIUS
33+
#define STORE_ASI ASI_BLK_INIT_QUAD_LDD_AIUS
34+
#define STORE_BLK(src,addr) stda src, [addr] ASI_BLK_AIUS_4V
35+
#define EX_RETVAL(x) 0
36+
37+
#ifdef __KERNEL__
38+
/* Writing to %asi is _expensive_ so we hardcode it.
39+
* Reading %asi to check for KERNEL_DS is comparatively
40+
* cheap.
41+
*/
42+
#define PREAMBLE \
43+
rd %asi, %g1; \
44+
cmp %g1, ASI_AIUS; \
45+
bne,pn %icc, memcpy_user_stub; \
46+
nop
47+
#endif
48+
49+
#include "NG2memcpy.S"

0 commit comments

Comments
 (0)