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

TOMOYO Linux Cross Reference
Linux/lib/raid6/recov_s390xc.c

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/recov_s390xc.c (Version linux-6.12-rc7) and /lib/raid6/recov_s390xc.c (Version linux-4.10.17)


  1 // SPDX-License-Identifier: GPL-2.0            << 
  2 /*                                                  1 /*
  3  * RAID-6 data recovery in dual failure mode b      2  * RAID-6 data recovery in dual failure mode based on the XC instruction.
  4  *                                                  3  *
  5  * Copyright IBM Corp. 2016                         4  * Copyright IBM Corp. 2016
  6  * Author(s): Martin Schwidefsky <schwidefsky@      5  * Author(s): Martin Schwidefsky <schwidefsky@de.ibm.com>
  7  */                                                 6  */
  8                                                     7 
  9 #include <linux/export.h>                           8 #include <linux/export.h>
 10 #include <linux/raid/pq.h>                          9 #include <linux/raid/pq.h>
 11                                                    10 
 12 static inline void xor_block(u8 *p1, u8 *p2)       11 static inline void xor_block(u8 *p1, u8 *p2)
 13 {                                                  12 {
 14         typedef struct { u8 _[256]; } addrtype     13         typedef struct { u8 _[256]; } addrtype;
 15                                                    14 
 16         asm volatile(                              15         asm volatile(
 17                 "       xc      0(256,%[p1]),0     16                 "       xc      0(256,%[p1]),0(%[p2])\n"
 18                 : "+m" (*(addrtype *) p1) : "m     17                 : "+m" (*(addrtype *) p1) : "m" (*(addrtype *) p2),
 19                   [p1] "a" (p1), [p2] "a" (p2)     18                   [p1] "a" (p1), [p2] "a" (p2) : "cc");
 20 }                                                  19 }
 21                                                    20 
 22 /* Recover two failed data blocks. */              21 /* Recover two failed data blocks. */
 23 static void raid6_2data_recov_s390xc(int disks     22 static void raid6_2data_recov_s390xc(int disks, size_t bytes, int faila,
 24                 int failb, void **ptrs)            23                 int failb, void **ptrs)
 25 {                                                  24 {
 26         u8 *p, *q, *dp, *dq;                       25         u8 *p, *q, *dp, *dq;
 27         const u8 *pbmul;        /* P multiplie     26         const u8 *pbmul;        /* P multiplier table for B data */
 28         const u8 *qmul;         /* Q multiplie     27         const u8 *qmul;         /* Q multiplier table (for both) */
 29         int i;                                     28         int i;
 30                                                    29 
 31         p = (u8 *)ptrs[disks-2];                   30         p = (u8 *)ptrs[disks-2];
 32         q = (u8 *)ptrs[disks-1];                   31         q = (u8 *)ptrs[disks-1];
 33                                                    32 
 34         /* Compute syndrome with zero for the      33         /* Compute syndrome with zero for the missing data pages
 35            Use the dead data pages as temporar     34            Use the dead data pages as temporary storage for
 36            delta p and delta q */                  35            delta p and delta q */
 37         dp = (u8 *)ptrs[faila];                    36         dp = (u8 *)ptrs[faila];
 38         ptrs[faila] = (void *)raid6_empty_zero     37         ptrs[faila] = (void *)raid6_empty_zero_page;
 39         ptrs[disks-2] = dp;                        38         ptrs[disks-2] = dp;
 40         dq = (u8 *)ptrs[failb];                    39         dq = (u8 *)ptrs[failb];
 41         ptrs[failb] = (void *)raid6_empty_zero     40         ptrs[failb] = (void *)raid6_empty_zero_page;
 42         ptrs[disks-1] = dq;                        41         ptrs[disks-1] = dq;
 43                                                    42 
 44         raid6_call.gen_syndrome(disks, bytes,      43         raid6_call.gen_syndrome(disks, bytes, ptrs);
 45                                                    44 
 46         /* Restore pointer table */                45         /* Restore pointer table */
 47         ptrs[faila]   = dp;                        46         ptrs[faila]   = dp;
 48         ptrs[failb]   = dq;                        47         ptrs[failb]   = dq;
 49         ptrs[disks-2] = p;                         48         ptrs[disks-2] = p;
 50         ptrs[disks-1] = q;                         49         ptrs[disks-1] = q;
 51                                                    50 
 52         /* Now, pick the proper data tables */     51         /* Now, pick the proper data tables */
 53         pbmul = raid6_gfmul[raid6_gfexi[failb-     52         pbmul = raid6_gfmul[raid6_gfexi[failb-faila]];
 54         qmul  = raid6_gfmul[raid6_gfinv[raid6_     53         qmul  = raid6_gfmul[raid6_gfinv[raid6_gfexp[faila]^raid6_gfexp[failb]]];
 55                                                    54 
 56         /* Now do it... */                         55         /* Now do it... */
 57         while (bytes) {                            56         while (bytes) {
 58                 xor_block(dp, p);                  57                 xor_block(dp, p);
 59                 xor_block(dq, q);                  58                 xor_block(dq, q);
 60                 for (i = 0; i < 256; i++)          59                 for (i = 0; i < 256; i++)
 61                         dq[i] = pbmul[dp[i]] ^     60                         dq[i] = pbmul[dp[i]] ^ qmul[dq[i]];
 62                 xor_block(dp, dq);                 61                 xor_block(dp, dq);
 63                 p += 256;                          62                 p += 256;
 64                 q += 256;                          63                 q += 256;
 65                 dp += 256;                         64                 dp += 256;
 66                 dq += 256;                         65                 dq += 256;
 67                 bytes -= 256;                      66                 bytes -= 256;
 68         }                                          67         }
 69 }                                                  68 }
 70                                                    69 
 71 /* Recover failure of one data block plus the      70 /* Recover failure of one data block plus the P block */
 72 static void raid6_datap_recov_s390xc(int disks     71 static void raid6_datap_recov_s390xc(int disks, size_t bytes, int faila,
 73                 void **ptrs)                       72                 void **ptrs)
 74 {                                                  73 {
 75         u8 *p, *q, *dq;                            74         u8 *p, *q, *dq;
 76         const u8 *qmul;         /* Q multiplie     75         const u8 *qmul;         /* Q multiplier table */
 77         int i;                                     76         int i;
 78                                                    77 
 79         p = (u8 *)ptrs[disks-2];                   78         p = (u8 *)ptrs[disks-2];
 80         q = (u8 *)ptrs[disks-1];                   79         q = (u8 *)ptrs[disks-1];
 81                                                    80 
 82         /* Compute syndrome with zero for the      81         /* Compute syndrome with zero for the missing data page
 83            Use the dead data page as temporary     82            Use the dead data page as temporary storage for delta q */
 84         dq = (u8 *)ptrs[faila];                    83         dq = (u8 *)ptrs[faila];
 85         ptrs[faila] = (void *)raid6_empty_zero     84         ptrs[faila] = (void *)raid6_empty_zero_page;
 86         ptrs[disks-1] = dq;                        85         ptrs[disks-1] = dq;
 87                                                    86 
 88         raid6_call.gen_syndrome(disks, bytes,      87         raid6_call.gen_syndrome(disks, bytes, ptrs);
 89                                                    88 
 90         /* Restore pointer table */                89         /* Restore pointer table */
 91         ptrs[faila]   = dq;                        90         ptrs[faila]   = dq;
 92         ptrs[disks-1] = q;                         91         ptrs[disks-1] = q;
 93                                                    92 
 94         /* Now, pick the proper data tables */     93         /* Now, pick the proper data tables */
 95         qmul  = raid6_gfmul[raid6_gfinv[raid6_     94         qmul  = raid6_gfmul[raid6_gfinv[raid6_gfexp[faila]]];
 96                                                    95 
 97         /* Now do it... */                         96         /* Now do it... */
 98         while (bytes) {                            97         while (bytes) {
 99                 xor_block(dq, q);                  98                 xor_block(dq, q);
100                 for (i = 0; i < 256; i++)          99                 for (i = 0; i < 256; i++)
101                         dq[i] = qmul[dq[i]];      100                         dq[i] = qmul[dq[i]];
102                 xor_block(p, dq);                 101                 xor_block(p, dq);
103                 p += 256;                         102                 p += 256;
104                 q += 256;                         103                 q += 256;
105                 dq += 256;                        104                 dq += 256;
106                 bytes -= 256;                     105                 bytes -= 256;
107         }                                         106         }
108 }                                                 107 }
109                                                   108 
110                                                   109 
111 const struct raid6_recov_calls raid6_recov_s39    110 const struct raid6_recov_calls raid6_recov_s390xc = {
112         .data2 = raid6_2data_recov_s390xc,        111         .data2 = raid6_2data_recov_s390xc,
113         .datap = raid6_datap_recov_s390xc,        112         .datap = raid6_datap_recov_s390xc,
114         .valid = NULL,                            113         .valid = NULL,
115         .name = "s390xc",                         114         .name = "s390xc",
116         .priority = 1,                            115         .priority = 1,
117 };                                                116 };
118                                                   117 

~ [ 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