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>
13 static void xor_xc_2(unsigned long bytes
, unsigned long *p1
, unsigned long *p2
)
22 "0: xc 0(256,%1),0(%2)\n"
28 "2: xc 0(1,%1),0(%2)\n"
30 : : "d" (bytes
), "a" (p1
), "a" (p2
)
31 : "0", "1", "cc", "memory");
34 static void xor_xc_3(unsigned long bytes
, unsigned long *p1
, unsigned long *p2
,
44 "0: xc 0(256,%1),0(%2)\n"
45 " xc 0(256,%1),0(%3)\n"
53 "2: xc 0(1,%1),0(%2)\n"
56 : "+d" (bytes
), "+a" (p1
), "+a" (p2
), "+a" (p3
)
57 : : "0", "1", "cc", "memory");
60 static void xor_xc_4(unsigned long bytes
, unsigned long *p1
, unsigned long *p2
,
61 unsigned long *p3
, unsigned long *p4
)
70 "0: xc 0(256,%1),0(%2)\n"
71 " xc 0(256,%1),0(%3)\n"
72 " xc 0(256,%1),0(%4)\n"
82 "2: xc 0(1,%1),0(%2)\n"
86 : "+d" (bytes
), "+a" (p1
), "+a" (p2
), "+a" (p3
), "+a" (p4
)
87 : : "0", "1", "cc", "memory");
90 static void xor_xc_5(unsigned long bytes
, unsigned long *p1
, unsigned long *p2
,
91 unsigned long *p3
, unsigned long *p4
, unsigned long *p5
)
93 /* Get around a gcc oddity */
94 register unsigned long *reg7
asm ("7") = p5
;
103 "0: xc 0(256,%1),0(%2)\n"
104 " xc 0(256,%1),0(%3)\n"
105 " xc 0(256,%1),0(%4)\n"
106 " xc 0(256,%1),0(%5)\n"
118 "2: xc 0(1,%1),0(%2)\n"
119 " xc 0(1,%1),0(%3)\n"
120 " xc 0(1,%1),0(%4)\n"
121 " xc 0(1,%1),0(%5)\n"
123 : "+d" (bytes
), "+a" (p1
), "+a" (p2
), "+a" (p3
), "+a" (p4
),
125 : : "0", "1", "cc", "memory");
128 struct xor_block_template xor_block_xc
= {
135 EXPORT_SYMBOL(xor_block_xc
);