1 // SPDX-License-Identifier: GPL-2.0
3 * Optimized xor_block operation for RAID4/5
5 * Copyright IBM Corp. 2016
6 * Author(s): Martin Schwidefsky <schwidefsky@de.ibm.com>
9 #include <linux/types.h>
10 #include <linux/export.h>
11 #include <linux/raid/xor.h>
14 static void xor_xc_2(unsigned long bytes
, unsigned long *p1
, unsigned long *p2
)
23 "0: xc 0(256,%1),0(%2)\n"
29 "2: xc 0(1,%1),0(%2)\n"
31 : : "d" (bytes
), "a" (p1
), "a" (p2
)
32 : "0", "1", "cc", "memory");
35 static void xor_xc_3(unsigned long bytes
, unsigned long *p1
, unsigned long *p2
,
45 "0: xc 0(256,%1),0(%2)\n"
46 " xc 0(256,%1),0(%3)\n"
54 "2: xc 0(1,%1),0(%2)\n"
57 : "+d" (bytes
), "+a" (p1
), "+a" (p2
), "+a" (p3
)
58 : : "0", "1", "cc", "memory");
61 static void xor_xc_4(unsigned long bytes
, unsigned long *p1
, unsigned long *p2
,
62 unsigned long *p3
, unsigned long *p4
)
71 "0: xc 0(256,%1),0(%2)\n"
72 " xc 0(256,%1),0(%3)\n"
73 " xc 0(256,%1),0(%4)\n"
83 "2: xc 0(1,%1),0(%2)\n"
87 : "+d" (bytes
), "+a" (p1
), "+a" (p2
), "+a" (p3
), "+a" (p4
)
88 : : "0", "1", "cc", "memory");
91 static void xor_xc_5(unsigned long bytes
, unsigned long *p1
, unsigned long *p2
,
92 unsigned long *p3
, unsigned long *p4
, unsigned long *p5
)
94 /* Get around a gcc oddity */
95 register unsigned long *reg7
asm ("7") = p5
;
104 "0: xc 0(256,%1),0(%2)\n"
105 " xc 0(256,%1),0(%3)\n"
106 " xc 0(256,%1),0(%4)\n"
107 " xc 0(256,%1),0(%5)\n"
119 "2: xc 0(1,%1),0(%2)\n"
120 " xc 0(1,%1),0(%3)\n"
121 " xc 0(1,%1),0(%4)\n"
122 " xc 0(1,%1),0(%5)\n"
124 : "+d" (bytes
), "+a" (p1
), "+a" (p2
), "+a" (p3
), "+a" (p4
),
126 : : "0", "1", "cc", "memory");
129 struct xor_block_template xor_block_xc
= {
136 EXPORT_SYMBOL(xor_block_xc
);