| 1 |
/* SPDX-License-Identifier: GPL-2.0-or-later */ |
| 2 |
/* |
| 3 |
* include/asm/xor.h |
| 4 |
* |
| 5 |
* High speed xor_block operation for RAID4/5 utilizing the |
| 6 |
* UltraSparc Visual Instruction Set and Niagara block-init |
| 7 |
* twin-load instructions. |
| 8 |
* |
| 9 |
* Copyright (C) 1997, 1999 Jakub Jelinek ([email protected]) |
| 10 |
* Copyright (C) 2006 David S. Miller <[email protected]> |
| 11 |
*/ |
| 12 |
|
| 13 |
#include <asm/spitfire.h> |
| 14 |
|
| 15 |
void xor_vis_2(unsigned long bytes, unsigned long * __restrict p1, |
| 16 |
const unsigned long * __restrict p2); |
| 17 |
void xor_vis_3(unsigned long bytes, unsigned long * __restrict p1, |
| 18 |
const unsigned long * __restrict p2, |
| 19 |
const unsigned long * __restrict p3); |
| 20 |
void xor_vis_4(unsigned long bytes, unsigned long * __restrict p1, |
| 21 |
const unsigned long * __restrict p2, |
| 22 |
const unsigned long * __restrict p3, |
| 23 |
const unsigned long * __restrict p4); |
| 24 |
void xor_vis_5(unsigned long bytes, unsigned long * __restrict p1, |
| 25 |
const unsigned long * __restrict p2, |
| 26 |
const unsigned long * __restrict p3, |
| 27 |
const unsigned long * __restrict p4, |
| 28 |
const unsigned long * __restrict p5); |
| 29 |
|
| 30 |
/* XXX Ugh, write cheetah versions... -DaveM */ |
| 31 |
|
| 32 |
static struct xor_block_template xor_block_VIS = { |
| 33 |
.name = "VIS", |
| 34 |
.do_2 = xor_vis_2, |
| 35 |
.do_3 = xor_vis_3, |
| 36 |
.do_4 = xor_vis_4, |
| 37 |
.do_5 = xor_vis_5, |
| 38 |
}; |
| 39 |
|
| 40 |
void xor_niagara_2(unsigned long bytes, unsigned long * __restrict p1, |
| 41 |
const unsigned long * __restrict p2); |
| 42 |
void xor_niagara_3(unsigned long bytes, unsigned long * __restrict p1, |
| 43 |
const unsigned long * __restrict p2, |
| 44 |
const unsigned long * __restrict p3); |
| 45 |
void xor_niagara_4(unsigned long bytes, unsigned long * __restrict p1, |
| 46 |
const unsigned long * __restrict p2, |
| 47 |
const unsigned long * __restrict p3, |
| 48 |
const unsigned long * __restrict p4); |
| 49 |
void xor_niagara_5(unsigned long bytes, unsigned long * __restrict p1, |
| 50 |
const unsigned long * __restrict p2, |
| 51 |
const unsigned long * __restrict p3, |
| 52 |
const unsigned long * __restrict p4, |
| 53 |
const unsigned long * __restrict p5); |
| 54 |
|
| 55 |
static struct xor_block_template xor_block_niagara = { |
| 56 |
.name = "Niagara", |
| 57 |
.do_2 = xor_niagara_2, |
| 58 |
.do_3 = xor_niagara_3, |
| 59 |
.do_4 = xor_niagara_4, |
| 60 |
.do_5 = xor_niagara_5, |
| 61 |
}; |
| 62 |
|
| 63 |
#undef XOR_TRY_TEMPLATES |
| 64 |
#define XOR_TRY_TEMPLATES \ |
| 65 |
do { \ |
| 66 |
xor_speed(&xor_block_VIS); \ |
| 67 |
xor_speed(&xor_block_niagara); \ |
| 68 |
} while (0) |
| 69 |
|
| 70 |
/* For VIS for everything except Niagara. */ |
| 71 |
#define XOR_SELECT_TEMPLATE(FASTEST) \ |
| 72 |
((tlb_type == hypervisor && \ |
| 73 |
(sun4v_chip_type == SUN4V_CHIP_NIAGARA1 || \ |
| 74 |
sun4v_chip_type == SUN4V_CHIP_NIAGARA2 || \ |
| 75 |
sun4v_chip_type == SUN4V_CHIP_NIAGARA3 || \ |
| 76 |
sun4v_chip_type == SUN4V_CHIP_NIAGARA4 || \ |
| 77 |
sun4v_chip_type == SUN4V_CHIP_NIAGARA5)) ? \ |
| 78 |
&xor_block_niagara : \ |
| 79 |
&xor_block_VIS) |