lib/raid/xor/alpha/xor.c

Source file repositories/reference/linux-study-clean/lib/raid/xor/alpha/xor.c

File Facts

System
Linux kernel
Corpus path
lib/raid/xor/alpha/xor.c
Extension
.c
Size
21973 bytes
Lines
849
Domain
Kernel Services
Bucket
lib
Inferred role
Kernel Services: implementation source
Status
source implementation candidate

Why This File Exists

Shared kernel service surface used by multiple subsystems, including helpers, cryptography, virtualization support, and async I/O infrastructure.

Dependency Surface

Detected Declarations

Annotated Snippet

// SPDX-License-Identifier: GPL-2.0-or-later
/*
 * Optimized XOR parity functions for alpha EV5 and EV6
 */
#include "xor_impl.h"
#include "xor_arch.h"

extern void
xor_alpha_2(unsigned long bytes, unsigned long * __restrict p1,
	    const unsigned long * __restrict p2);
extern void
xor_alpha_3(unsigned long bytes, unsigned long * __restrict p1,
	    const unsigned long * __restrict p2,
	    const unsigned long * __restrict p3);
extern void
xor_alpha_4(unsigned long bytes, unsigned long * __restrict p1,
	    const unsigned long * __restrict p2,
	    const unsigned long * __restrict p3,
	    const unsigned long * __restrict p4);
extern void
xor_alpha_5(unsigned long bytes, unsigned long * __restrict p1,
	    const unsigned long * __restrict p2,
	    const unsigned long * __restrict p3,
	    const unsigned long * __restrict p4,
	    const unsigned long * __restrict p5);

extern void
xor_alpha_prefetch_2(unsigned long bytes, unsigned long * __restrict p1,
		     const unsigned long * __restrict p2);
extern void
xor_alpha_prefetch_3(unsigned long bytes, unsigned long * __restrict p1,
		     const unsigned long * __restrict p2,
		     const unsigned long * __restrict p3);
extern void
xor_alpha_prefetch_4(unsigned long bytes, unsigned long * __restrict p1,
		     const unsigned long * __restrict p2,
		     const unsigned long * __restrict p3,
		     const unsigned long * __restrict p4);
extern void
xor_alpha_prefetch_5(unsigned long bytes, unsigned long * __restrict p1,
		     const unsigned long * __restrict p2,
		     const unsigned long * __restrict p3,
		     const unsigned long * __restrict p4,
		     const unsigned long * __restrict p5);

asm("								\n\
	.text							\n\
	.align 3						\n\
	.ent xor_alpha_2					\n\
xor_alpha_2:							\n\
	.prologue 0						\n\
	srl $16, 6, $16						\n\
	.align 4						\n\
2:								\n\
	ldq $0,0($17)						\n\
	ldq $1,0($18)						\n\
	ldq $2,8($17)						\n\
	ldq $3,8($18)						\n\
								\n\
	ldq $4,16($17)						\n\
	ldq $5,16($18)						\n\
	ldq $6,24($17)						\n\
	ldq $7,24($18)						\n\
								\n\
	ldq $19,32($17)						\n\
	ldq $20,32($18)						\n\
	ldq $21,40($17)						\n\
	ldq $22,40($18)						\n\
								\n\
	ldq $23,48($17)						\n\
	ldq $24,48($18)						\n\
	ldq $25,56($17)						\n\
	xor $0,$1,$0		# 7 cycles from $1 load		\n\
								\n\
	ldq $27,56($18)						\n\
	xor $2,$3,$2						\n\
	stq $0,0($17)						\n\
	xor $4,$5,$4						\n\
								\n\
	stq $2,8($17)						\n\
	xor $6,$7,$6						\n\
	stq $4,16($17)						\n\
	xor $19,$20,$19						\n\
								\n\
	stq $6,24($17)						\n\
	xor $21,$22,$21						\n\
	stq $19,32($17)						\n\
	xor $23,$24,$23						\n\
								\n\
	stq $21,40($17)						\n\

Annotation

Implementation Notes