~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/lib/raid6/s390vx.uc

Version: ~ [ linux-6.12-rc7 ] ~ [ linux-6.11.7 ] ~ [ linux-6.10.14 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.60 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.116 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.171 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.229 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.285 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.323 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.12 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

Diff markup

Differences between /lib/raid6/s390vx.uc (Architecture mips) and /lib/raid6/s390vx.uc (Architecture m68k)


  1 // SPDX-License-Identifier: GPL-2.0                 1 // SPDX-License-Identifier: GPL-2.0
  2 /*                                                  2 /*
  3  * raid6_vx$#.c                                     3  * raid6_vx$#.c
  4  *                                                  4  *
  5  * $#-way unrolled RAID6 gen/xor functions for      5  * $#-way unrolled RAID6 gen/xor functions for s390
  6  * based on the vector facility                     6  * based on the vector facility
  7  *                                                  7  *
  8  * Copyright IBM Corp. 2016                         8  * Copyright IBM Corp. 2016
  9  * Author(s): Martin Schwidefsky <schwidefsky@d      9  * Author(s): Martin Schwidefsky <schwidefsky@de.ibm.com>
 10  *                                                 10  *
 11  * This file is postprocessed using unroll.awk     11  * This file is postprocessed using unroll.awk.
 12  */                                                12  */
 13                                                    13 
 14 #include <linux/raid/pq.h>                         14 #include <linux/raid/pq.h>
 15 #include <asm/fpu.h>                               15 #include <asm/fpu.h>
 16                                                    16 
 17 #define NSIZE 16                                   17 #define NSIZE 16
 18                                                    18 
 19 static __always_inline void LOAD_CONST(void)       19 static __always_inline void LOAD_CONST(void)
 20 {                                                  20 {
 21         fpu_vrepib(24, 0x07);                      21         fpu_vrepib(24, 0x07);
 22         fpu_vrepib(25, 0x1d);                      22         fpu_vrepib(25, 0x1d);
 23 }                                                  23 }
 24                                                    24 
 25 /*                                                 25 /*
 26  * The SHLBYTE() operation shifts each of the      26  * The SHLBYTE() operation shifts each of the 16 bytes in
 27  * vector register y left by 1 bit and stores      27  * vector register y left by 1 bit and stores the result in
 28  * vector register x.                              28  * vector register x.
 29  */                                                29  */
 30 #define SHLBYTE(x, y)           fpu_vab(x, y,      30 #define SHLBYTE(x, y)           fpu_vab(x, y, y)
 31                                                    31 
 32 /*                                                 32 /*
 33  * For each of the 16 bytes in the vector regi     33  * For each of the 16 bytes in the vector register y the MASK()
 34  * operation returns 0xFF if the high bit of t     34  * operation returns 0xFF if the high bit of the byte is 1,
 35  * or 0x00 if the high bit is 0. The result is     35  * or 0x00 if the high bit is 0. The result is stored in vector
 36  * register x.                                     36  * register x.
 37  */                                                37  */
 38 #define MASK(x, y)              fpu_vesravb(x,     38 #define MASK(x, y)              fpu_vesravb(x, y, 24)
 39                                                    39 
 40 #define AND(x, y, z)            fpu_vn(x, y, z     40 #define AND(x, y, z)            fpu_vn(x, y, z)
 41 #define XOR(x, y, z)            fpu_vx(x, y, z     41 #define XOR(x, y, z)            fpu_vx(x, y, z)
 42 #define LOAD_DATA(x, ptr)       fpu_vlm(x, x +     42 #define LOAD_DATA(x, ptr)       fpu_vlm(x, x + $# - 1, ptr)
 43 #define STORE_DATA(x, ptr)      fpu_vstm(x, x      43 #define STORE_DATA(x, ptr)      fpu_vstm(x, x + $# - 1, ptr)
 44 #define COPY_VEC(x, y)          fpu_vlr(x, y)      44 #define COPY_VEC(x, y)          fpu_vlr(x, y)
 45                                                    45 
 46 static void raid6_s390vx$#_gen_syndrome(int di     46 static void raid6_s390vx$#_gen_syndrome(int disks, size_t bytes, void **ptrs)
 47 {                                                  47 {
 48         DECLARE_KERNEL_FPU_ONSTACK32(vxstate);     48         DECLARE_KERNEL_FPU_ONSTACK32(vxstate);
 49         u8 **dptr, *p, *q;                         49         u8 **dptr, *p, *q;
 50         int d, z, z0;                              50         int d, z, z0;
 51                                                    51 
 52         kernel_fpu_begin(&vxstate, KERNEL_VXR)     52         kernel_fpu_begin(&vxstate, KERNEL_VXR);
 53         LOAD_CONST();                              53         LOAD_CONST();
 54                                                    54 
 55         dptr = (u8 **) ptrs;                       55         dptr = (u8 **) ptrs;
 56         z0 = disks - 3;         /* Highest dat     56         z0 = disks - 3;         /* Highest data disk */
 57         p = dptr[z0 + 1];       /* XOR parity      57         p = dptr[z0 + 1];       /* XOR parity */
 58         q = dptr[z0 + 2];       /* RS syndrome     58         q = dptr[z0 + 2];       /* RS syndrome */
 59                                                    59 
 60         for (d = 0; d < bytes; d += $#*NSIZE)      60         for (d = 0; d < bytes; d += $#*NSIZE) {
 61                 LOAD_DATA(0,&dptr[z0][d]);         61                 LOAD_DATA(0,&dptr[z0][d]);
 62                 COPY_VEC(8+$$,0+$$);               62                 COPY_VEC(8+$$,0+$$);
 63                 for (z = z0 - 1; z >= 0; z--)      63                 for (z = z0 - 1; z >= 0; z--) {
 64                         MASK(16+$$,8+$$);          64                         MASK(16+$$,8+$$);
 65                         AND(16+$$,16+$$,25);       65                         AND(16+$$,16+$$,25);
 66                         SHLBYTE(8+$$,8+$$);        66                         SHLBYTE(8+$$,8+$$);
 67                         XOR(8+$$,8+$$,16+$$);      67                         XOR(8+$$,8+$$,16+$$);
 68                         LOAD_DATA(16,&dptr[z][     68                         LOAD_DATA(16,&dptr[z][d]);
 69                         XOR(0+$$,0+$$,16+$$);      69                         XOR(0+$$,0+$$,16+$$);
 70                         XOR(8+$$,8+$$,16+$$);      70                         XOR(8+$$,8+$$,16+$$);
 71                 }                                  71                 }
 72                 STORE_DATA(0,&p[d]);               72                 STORE_DATA(0,&p[d]);
 73                 STORE_DATA(8,&q[d]);               73                 STORE_DATA(8,&q[d]);
 74         }                                          74         }
 75         kernel_fpu_end(&vxstate, KERNEL_VXR);      75         kernel_fpu_end(&vxstate, KERNEL_VXR);
 76 }                                                  76 }
 77                                                    77 
 78 static void raid6_s390vx$#_xor_syndrome(int di     78 static void raid6_s390vx$#_xor_syndrome(int disks, int start, int stop,
 79                                         size_t     79                                         size_t bytes, void **ptrs)
 80 {                                                  80 {
 81         DECLARE_KERNEL_FPU_ONSTACK32(vxstate);     81         DECLARE_KERNEL_FPU_ONSTACK32(vxstate);
 82         u8 **dptr, *p, *q;                         82         u8 **dptr, *p, *q;
 83         int d, z, z0;                              83         int d, z, z0;
 84                                                    84 
 85         dptr = (u8 **) ptrs;                       85         dptr = (u8 **) ptrs;
 86         z0 = stop;              /* P/Q right s     86         z0 = stop;              /* P/Q right side optimization */
 87         p = dptr[disks - 2];    /* XOR parity      87         p = dptr[disks - 2];    /* XOR parity */
 88         q = dptr[disks - 1];    /* RS syndrome     88         q = dptr[disks - 1];    /* RS syndrome */
 89                                                    89 
 90         kernel_fpu_begin(&vxstate, KERNEL_VXR)     90         kernel_fpu_begin(&vxstate, KERNEL_VXR);
 91         LOAD_CONST();                              91         LOAD_CONST();
 92                                                    92 
 93         for (d = 0; d < bytes; d += $#*NSIZE)      93         for (d = 0; d < bytes; d += $#*NSIZE) {
 94                 /* P/Q data pages */               94                 /* P/Q data pages */
 95                 LOAD_DATA(0,&dptr[z0][d]);         95                 LOAD_DATA(0,&dptr[z0][d]);
 96                 COPY_VEC(8+$$,0+$$);               96                 COPY_VEC(8+$$,0+$$);
 97                 for (z = z0 - 1; z >= start; z     97                 for (z = z0 - 1; z >= start; z--) {
 98                         MASK(16+$$,8+$$);          98                         MASK(16+$$,8+$$);
 99                         AND(16+$$,16+$$,25);       99                         AND(16+$$,16+$$,25);
100                         SHLBYTE(8+$$,8+$$);       100                         SHLBYTE(8+$$,8+$$);
101                         XOR(8+$$,8+$$,16+$$);     101                         XOR(8+$$,8+$$,16+$$);
102                         LOAD_DATA(16,&dptr[z][    102                         LOAD_DATA(16,&dptr[z][d]);
103                         XOR(0+$$,0+$$,16+$$);     103                         XOR(0+$$,0+$$,16+$$);
104                         XOR(8+$$,8+$$,16+$$);     104                         XOR(8+$$,8+$$,16+$$);
105                 }                                 105                 }
106                 /* P/Q left side optimization     106                 /* P/Q left side optimization */
107                 for (z = start - 1; z >= 0; z-    107                 for (z = start - 1; z >= 0; z--) {
108                         MASK(16+$$,8+$$);         108                         MASK(16+$$,8+$$);
109                         AND(16+$$,16+$$,25);      109                         AND(16+$$,16+$$,25);
110                         SHLBYTE(8+$$,8+$$);       110                         SHLBYTE(8+$$,8+$$);
111                         XOR(8+$$,8+$$,16+$$);     111                         XOR(8+$$,8+$$,16+$$);
112                 }                                 112                 }
113                 LOAD_DATA(16,&p[d]);              113                 LOAD_DATA(16,&p[d]);
114                 XOR(16+$$,16+$$,0+$$);            114                 XOR(16+$$,16+$$,0+$$);
115                 STORE_DATA(16,&p[d]);             115                 STORE_DATA(16,&p[d]);
116                 LOAD_DATA(16,&q[d]);              116                 LOAD_DATA(16,&q[d]);
117                 XOR(16+$$,16+$$,8+$$);            117                 XOR(16+$$,16+$$,8+$$);
118                 STORE_DATA(16,&q[d]);             118                 STORE_DATA(16,&q[d]);
119         }                                         119         }
120         kernel_fpu_end(&vxstate, KERNEL_VXR);     120         kernel_fpu_end(&vxstate, KERNEL_VXR);
121 }                                                 121 }
122                                                   122 
123 static int raid6_s390vx$#_valid(void)             123 static int raid6_s390vx$#_valid(void)
124 {                                                 124 {
125         return cpu_has_vx();                      125         return cpu_has_vx();
126 }                                                 126 }
127                                                   127 
128 const struct raid6_calls raid6_s390vx$# = {       128 const struct raid6_calls raid6_s390vx$# = {
129         raid6_s390vx$#_gen_syndrome,              129         raid6_s390vx$#_gen_syndrome,
130         raid6_s390vx$#_xor_syndrome,              130         raid6_s390vx$#_xor_syndrome,
131         raid6_s390vx$#_valid,                     131         raid6_s390vx$#_valid,
132         "vx128x$#",                               132         "vx128x$#",
133         1                                         133         1
134 };                                                134 };
                                                      

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

sflogo.php