1 /* SPDX-License-Identifier: GPL-2.0 */ << 2 /* NGpage.S: Niagara optimize clear and copy p 1 /* NGpage.S: Niagara optimize clear and copy page. 3 * 2 * 4 * Copyright (C) 2006 (davem@davemloft.net) 3 * Copyright (C) 2006 (davem@davemloft.net) 5 */ 4 */ 6 5 7 #include <asm/asi.h> 6 #include <asm/asi.h> 8 #include <asm/page.h> 7 #include <asm/page.h> 9 8 10 .text 9 .text 11 .align 32 10 .align 32 12 11 13 /* This is heavily simplified from the 12 /* This is heavily simplified from the sun4u variants 14 * because Niagara does not have any D 13 * because Niagara does not have any D-cache aliasing issues 15 * and also we don't need to use the F 14 * and also we don't need to use the FPU in order to implement 16 * an optimal page copy/clear. 15 * an optimal page copy/clear. 17 */ 16 */ 18 17 19 NGcopy_user_page: /* %o0=dest, %o1=src, 18 NGcopy_user_page: /* %o0=dest, %o1=src, %o2=vaddr */ 20 save %sp, -192, %sp !! 19 prefetch [%o1 + 0x00], #one_read 21 rd %asi, %g3 !! 20 mov 8, %g1 22 wr %g0, ASI_BLK_INIT_QUAD !! 21 mov 16, %g2 >> 22 mov 24, %g3 23 set PAGE_SIZE, %g7 23 set PAGE_SIZE, %g7 24 prefetch [%i1 + 0x00], #one_rea << 25 prefetch [%i1 + 0x40], #one_rea << 26 24 27 1: prefetch [%i1 + 0x80], #one_rea !! 25 1: ldda [%o1 + %g0] ASI_BLK_INIT_QUAD_LDD_P, %o2 28 prefetch [%i1 + 0xc0], #one_rea !! 26 ldda [%o1 + %g2] ASI_BLK_INIT_QUAD_LDD_P, %o4 29 ldda [%i1 + 0x00] %asi, %o2 !! 27 prefetch [%o1 + 0x40], #one_read 30 ldda [%i1 + 0x10] %asi, %o4 !! 28 add %o1, 32, %o1 31 ldda [%i1 + 0x20] %asi, %l2 !! 29 stxa %o2, [%o0 + %g0] ASI_BLK_INIT_QUAD_LDD_P 32 ldda [%i1 + 0x30] %asi, %l4 !! 30 stxa %o3, [%o0 + %g1] ASI_BLK_INIT_QUAD_LDD_P 33 stxa %o2, [%i0 + 0x00] %asi !! 31 ldda [%o1 + %g0] ASI_BLK_INIT_QUAD_LDD_P, %o2 34 stxa %o3, [%i0 + 0x08] %asi !! 32 stxa %o4, [%o0 + %g2] ASI_BLK_INIT_QUAD_LDD_P 35 stxa %o4, [%i0 + 0x10] %asi !! 33 stxa %o5, [%o0 + %g3] ASI_BLK_INIT_QUAD_LDD_P 36 stxa %o5, [%i0 + 0x18] %asi !! 34 ldda [%o1 + %g2] ASI_BLK_INIT_QUAD_LDD_P, %o4 37 stxa %l2, [%i0 + 0x20] %asi !! 35 add %o1, 32, %o1 38 stxa %l3, [%i0 + 0x28] %asi !! 36 add %o0, 32, %o0 39 stxa %l4, [%i0 + 0x30] %asi !! 37 stxa %o2, [%o0 + %g0] ASI_BLK_INIT_QUAD_LDD_P 40 stxa %l5, [%i0 + 0x38] %asi !! 38 stxa %o3, [%o0 + %g1] ASI_BLK_INIT_QUAD_LDD_P 41 ldda [%i1 + 0x40] %asi, %o2 !! 39 stxa %o4, [%o0 + %g2] ASI_BLK_INIT_QUAD_LDD_P 42 ldda [%i1 + 0x50] %asi, %o4 !! 40 stxa %o5, [%o0 + %g3] ASI_BLK_INIT_QUAD_LDD_P 43 ldda [%i1 + 0x60] %asi, %l2 !! 41 subcc %g7, 64, %g7 44 ldda [%i1 + 0x70] %asi, %l4 << 45 stxa %o2, [%i0 + 0x40] %asi << 46 stxa %o3, [%i0 + 0x48] %asi << 47 stxa %o4, [%i0 + 0x50] %asi << 48 stxa %o5, [%i0 + 0x58] %asi << 49 stxa %l2, [%i0 + 0x60] %asi << 50 stxa %l3, [%i0 + 0x68] %asi << 51 stxa %l4, [%i0 + 0x70] %asi << 52 stxa %l5, [%i0 + 0x78] %asi << 53 add %i1, 128, %i1 << 54 subcc %g7, 128, %g7 << 55 bne,pt %xcc, 1b 42 bne,pt %xcc, 1b 56 add %i0, 128, %i0 !! 43 add %o0, 32, %o0 57 wr %g3, 0x0, %asi << 58 membar #Sync 44 membar #Sync 59 ret !! 45 retl 60 restore !! 46 nop 61 47 62 .align 32 !! 48 .globl NGclear_page, NGclear_user_page 63 .globl NGclear_page << 64 .globl NGclear_user_page << 65 NGclear_page: /* %o0=dest */ 49 NGclear_page: /* %o0=dest */ 66 NGclear_user_page: /* %o0=dest, %o1=vaddr 50 NGclear_user_page: /* %o0=dest, %o1=vaddr */ 67 rd %asi, %g3 !! 51 mov 8, %g1 68 wr %g0, ASI_BLK_INIT_QUAD !! 52 mov 16, %g2 >> 53 mov 24, %g3 69 set PAGE_SIZE, %g7 54 set PAGE_SIZE, %g7 70 55 71 1: stxa %g0, [%o0 + 0x00] %asi !! 56 1: stxa %g0, [%o0 + %g0] ASI_BLK_INIT_QUAD_LDD_P 72 stxa %g0, [%o0 + 0x08] %asi !! 57 stxa %g0, [%o0 + %g1] ASI_BLK_INIT_QUAD_LDD_P 73 stxa %g0, [%o0 + 0x10] %asi !! 58 stxa %g0, [%o0 + %g2] ASI_BLK_INIT_QUAD_LDD_P 74 stxa %g0, [%o0 + 0x18] %asi !! 59 stxa %g0, [%o0 + %g3] ASI_BLK_INIT_QUAD_LDD_P 75 stxa %g0, [%o0 + 0x20] %asi !! 60 add %o0, 32, %o0 76 stxa %g0, [%o0 + 0x28] %asi !! 61 stxa %g0, [%o0 + %g0] ASI_BLK_INIT_QUAD_LDD_P 77 stxa %g0, [%o0 + 0x30] %asi !! 62 stxa %g0, [%o0 + %g1] ASI_BLK_INIT_QUAD_LDD_P 78 stxa %g0, [%o0 + 0x38] %asi !! 63 stxa %g0, [%o0 + %g2] ASI_BLK_INIT_QUAD_LDD_P 79 stxa %g0, [%o0 + 0x40] %asi !! 64 stxa %g0, [%o0 + %g3] ASI_BLK_INIT_QUAD_LDD_P 80 stxa %g0, [%o0 + 0x48] %asi !! 65 subcc %g7, 64, %g7 81 stxa %g0, [%o0 + 0x50] %asi << 82 stxa %g0, [%o0 + 0x58] %asi << 83 stxa %g0, [%o0 + 0x60] %asi << 84 stxa %g0, [%o0 + 0x68] %asi << 85 stxa %g0, [%o0 + 0x70] %asi << 86 stxa %g0, [%o0 + 0x78] %asi << 87 stxa %g0, [%o0 + 0x80] %asi << 88 stxa %g0, [%o0 + 0x88] %asi << 89 stxa %g0, [%o0 + 0x90] %asi << 90 stxa %g0, [%o0 + 0x98] %asi << 91 stxa %g0, [%o0 + 0xa0] %asi << 92 stxa %g0, [%o0 + 0xa8] %asi << 93 stxa %g0, [%o0 + 0xb0] %asi << 94 stxa %g0, [%o0 + 0xb8] %asi << 95 stxa %g0, [%o0 + 0xc0] %asi << 96 stxa %g0, [%o0 + 0xc8] %asi << 97 stxa %g0, [%o0 + 0xd0] %asi << 98 stxa %g0, [%o0 + 0xd8] %asi << 99 stxa %g0, [%o0 + 0xe0] %asi << 100 stxa %g0, [%o0 + 0xe8] %asi << 101 stxa %g0, [%o0 + 0xf0] %asi << 102 stxa %g0, [%o0 + 0xf8] %asi << 103 subcc %g7, 256, %g7 << 104 bne,pt %xcc, 1b 66 bne,pt %xcc, 1b 105 add %o0, 256, %o0 !! 67 add %o0, 32, %o0 106 wr %g3, 0x0, %asi << 107 membar #Sync 68 membar #Sync 108 retl 69 retl 109 nop 70 nop 110 71 111 #define BRANCH_ALWAYS 0x10680000 72 #define BRANCH_ALWAYS 0x10680000 112 #define NOP 0x01000000 73 #define NOP 0x01000000 113 #define NG_DO_PATCH(OLD, NEW) \ 74 #define NG_DO_PATCH(OLD, NEW) \ 114 sethi %hi(NEW), %g1; \ 75 sethi %hi(NEW), %g1; \ 115 or %g1, %lo(NEW), %g1; \ 76 or %g1, %lo(NEW), %g1; \ 116 sethi %hi(OLD), %g2; \ 77 sethi %hi(OLD), %g2; \ 117 or %g2, %lo(OLD), %g2; \ 78 or %g2, %lo(OLD), %g2; \ 118 sub %g1, %g2, %g1; \ 79 sub %g1, %g2, %g1; \ 119 sethi %hi(BRANCH_ALWAYS), %g3; \ 80 sethi %hi(BRANCH_ALWAYS), %g3; \ 120 sll %g1, 11, %g1; \ 81 sll %g1, 11, %g1; \ 121 srl %g1, 11 + 2, %g1; \ 82 srl %g1, 11 + 2, %g1; \ 122 or %g3, %lo(BRANCH_ALWAYS), %g3; 83 or %g3, %lo(BRANCH_ALWAYS), %g3; \ 123 or %g3, %g1, %g3; \ 84 or %g3, %g1, %g3; \ 124 stw %g3, [%g2]; \ 85 stw %g3, [%g2]; \ 125 sethi %hi(NOP), %g3; \ 86 sethi %hi(NOP), %g3; \ 126 or %g3, %lo(NOP), %g3; \ 87 or %g3, %lo(NOP), %g3; \ 127 stw %g3, [%g2 + 0x4]; \ 88 stw %g3, [%g2 + 0x4]; \ 128 flush %g2; 89 flush %g2; 129 90 130 .globl niagara_patch_pageops 91 .globl niagara_patch_pageops 131 .type niagara_patch_pageops,#functio 92 .type niagara_patch_pageops,#function 132 niagara_patch_pageops: 93 niagara_patch_pageops: 133 NG_DO_PATCH(copy_user_page, NGcopy_use 94 NG_DO_PATCH(copy_user_page, NGcopy_user_page) 134 NG_DO_PATCH(_clear_page, NGclear_page) 95 NG_DO_PATCH(_clear_page, NGclear_page) 135 NG_DO_PATCH(clear_user_page, NGclear_u 96 NG_DO_PATCH(clear_user_page, NGclear_user_page) 136 retl 97 retl 137 nop 98 nop 138 .size niagara_patch_pageops,.-niagar 99 .size niagara_patch_pageops,.-niagara_patch_pageops
Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.