Orange Pi5 kernel

Deprecated Linux kernel 5.10.110 for OrangePi 5/5B/5+ boards

3 Commits   0 Branches   0 Tags
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   1) // SPDX-License-Identifier: GPL-2.0-only
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   2) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   3)  * asynchronous raid6 recovery self test
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   4)  * Copyright (c) 2009, Intel Corporation.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   5)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   6)  * based on drivers/md/raid6test/test.c:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   7)  * 	Copyright 2002-2007 H. Peter Anvin
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   8)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   9) #include <linux/async_tx.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  10) #include <linux/gfp.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  11) #include <linux/mm.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  12) #include <linux/random.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  13) #include <linux/module.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  14) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  15) #undef pr
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  16) #define pr(fmt, args...) pr_info("raid6test: " fmt, ##args)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  17) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  18) #define NDISKS 64 /* Including P and Q */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  19) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  20) static struct page *dataptrs[NDISKS];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  21) unsigned int dataoffs[NDISKS];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  22) static addr_conv_t addr_conv[NDISKS];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  23) static struct page *data[NDISKS+3];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  24) static struct page *spare;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  25) static struct page *recovi;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  26) static struct page *recovj;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  27) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  28) static void callback(void *param)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  29) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  30) 	struct completion *cmp = param;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  31) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  32) 	complete(cmp);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  33) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  34) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  35) static void makedata(int disks)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  36) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  37) 	int i;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  38) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  39) 	for (i = 0; i < disks; i++) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  40) 		prandom_bytes(page_address(data[i]), PAGE_SIZE);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  41) 		dataptrs[i] = data[i];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  42) 		dataoffs[i] = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  43) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  44) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  45) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  46) static char disk_type(int d, int disks)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  47) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  48) 	if (d == disks - 2)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  49) 		return 'P';
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  50) 	else if (d == disks - 1)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  51) 		return 'Q';
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  52) 	else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  53) 		return 'D';
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  54) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  55) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  56) /* Recover two failed blocks. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  57) static void raid6_dual_recov(int disks, size_t bytes, int faila, int failb,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  58) 		struct page **ptrs, unsigned int *offs)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  59) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  60) 	struct async_submit_ctl submit;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  61) 	struct completion cmp;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  62) 	struct dma_async_tx_descriptor *tx = NULL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  63) 	enum sum_check_flags result = ~0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  64) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  65) 	if (faila > failb)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  66) 		swap(faila, failb);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  67) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  68) 	if (failb == disks-1) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  69) 		if (faila == disks-2) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  70) 			/* P+Q failure.  Just rebuild the syndrome. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  71) 			init_async_submit(&submit, 0, NULL, NULL, NULL, addr_conv);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  72) 			tx = async_gen_syndrome(ptrs, offs,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  73) 					disks, bytes, &submit);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  74) 		} else {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  75) 			struct page *blocks[NDISKS];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  76) 			struct page *dest;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  77) 			int count = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  78) 			int i;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  79) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  80) 			BUG_ON(disks > NDISKS);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  81) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  82) 			/* data+Q failure.  Reconstruct data from P,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  83) 			 * then rebuild syndrome
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  84) 			 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  85) 			for (i = disks; i-- ; ) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  86) 				if (i == faila || i == failb)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  87) 					continue;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  88) 				blocks[count++] = ptrs[i];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  89) 			}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  90) 			dest = ptrs[faila];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  91) 			init_async_submit(&submit, ASYNC_TX_XOR_ZERO_DST, NULL,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  92) 					  NULL, NULL, addr_conv);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  93) 			tx = async_xor(dest, blocks, 0, count, bytes, &submit);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  94) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  95) 			init_async_submit(&submit, 0, tx, NULL, NULL, addr_conv);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  96) 			tx = async_gen_syndrome(ptrs, offs,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  97) 					disks, bytes, &submit);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  98) 		}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  99) 	} else {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 100) 		if (failb == disks-2) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 101) 			/* data+P failure. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 102) 			init_async_submit(&submit, 0, NULL, NULL, NULL, addr_conv);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 103) 			tx = async_raid6_datap_recov(disks, bytes,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 104) 					faila, ptrs, offs, &submit);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 105) 		} else {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 106) 			/* data+data failure. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 107) 			init_async_submit(&submit, 0, NULL, NULL, NULL, addr_conv);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 108) 			tx = async_raid6_2data_recov(disks, bytes,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 109) 					faila, failb, ptrs, offs, &submit);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 110) 		}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 111) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 112) 	init_completion(&cmp);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 113) 	init_async_submit(&submit, ASYNC_TX_ACK, tx, callback, &cmp, addr_conv);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 114) 	tx = async_syndrome_val(ptrs, offs,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 115) 			disks, bytes, &result, spare, 0, &submit);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 116) 	async_tx_issue_pending(tx);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 117) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 118) 	if (wait_for_completion_timeout(&cmp, msecs_to_jiffies(3000)) == 0)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 119) 		pr("%s: timeout! (faila: %d failb: %d disks: %d)\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 120) 		   __func__, faila, failb, disks);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 121) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 122) 	if (result != 0)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 123) 		pr("%s: validation failure! faila: %d failb: %d sum_check_flags: %x\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 124) 		   __func__, faila, failb, result);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 125) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 126) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 127) static int test_disks(int i, int j, int disks)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 128) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 129) 	int erra, errb;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 130) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 131) 	memset(page_address(recovi), 0xf0, PAGE_SIZE);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 132) 	memset(page_address(recovj), 0xba, PAGE_SIZE);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 133) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 134) 	dataptrs[i] = recovi;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 135) 	dataptrs[j] = recovj;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 136) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 137) 	raid6_dual_recov(disks, PAGE_SIZE, i, j, dataptrs, dataoffs);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 138) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 139) 	erra = memcmp(page_address(data[i]), page_address(recovi), PAGE_SIZE);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 140) 	errb = memcmp(page_address(data[j]), page_address(recovj), PAGE_SIZE);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 141) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 142) 	pr("%s(%d, %d): faila=%3d(%c)  failb=%3d(%c)  %s\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 143) 	   __func__, i, j, i, disk_type(i, disks), j, disk_type(j, disks),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 144) 	   (!erra && !errb) ? "OK" : !erra ? "ERRB" : !errb ? "ERRA" : "ERRAB");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 145) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 146) 	dataptrs[i] = data[i];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 147) 	dataptrs[j] = data[j];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 148) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 149) 	return erra || errb;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 150) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 151) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 152) static int test(int disks, int *tests)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 153) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 154) 	struct dma_async_tx_descriptor *tx;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 155) 	struct async_submit_ctl submit;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 156) 	struct completion cmp;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 157) 	int err = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 158) 	int i, j;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 159) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 160) 	recovi = data[disks];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 161) 	recovj = data[disks+1];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 162) 	spare  = data[disks+2];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 163) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 164) 	makedata(disks);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 165) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 166) 	/* Nuke syndromes */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 167) 	memset(page_address(data[disks-2]), 0xee, PAGE_SIZE);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 168) 	memset(page_address(data[disks-1]), 0xee, PAGE_SIZE);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 169) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 170) 	/* Generate assumed good syndrome */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 171) 	init_completion(&cmp);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 172) 	init_async_submit(&submit, ASYNC_TX_ACK, NULL, callback, &cmp, addr_conv);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 173) 	tx = async_gen_syndrome(dataptrs, dataoffs, disks, PAGE_SIZE, &submit);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 174) 	async_tx_issue_pending(tx);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 175) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 176) 	if (wait_for_completion_timeout(&cmp, msecs_to_jiffies(3000)) == 0) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 177) 		pr("error: initial gen_syndrome(%d) timed out\n", disks);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 178) 		return 1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 179) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 180) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 181) 	pr("testing the %d-disk case...\n", disks);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 182) 	for (i = 0; i < disks-1; i++)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 183) 		for (j = i+1; j < disks; j++) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 184) 			(*tests)++;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 185) 			err += test_disks(i, j, disks);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 186) 		}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 187) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 188) 	return err;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 189) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 190) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 191) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 192) static int raid6_test(void)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 193) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 194) 	int err = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 195) 	int tests = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 196) 	int i;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 197) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 198) 	for (i = 0; i < NDISKS+3; i++) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 199) 		data[i] = alloc_page(GFP_KERNEL);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 200) 		if (!data[i]) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 201) 			while (i--)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 202) 				put_page(data[i]);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 203) 			return -ENOMEM;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 204) 		}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 205) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 206) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 207) 	/* the 4-disk and 5-disk cases are special for the recovery code */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 208) 	if (NDISKS > 4)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 209) 		err += test(4, &tests);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 210) 	if (NDISKS > 5)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 211) 		err += test(5, &tests);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 212) 	/* the 11 and 12 disk cases are special for ioatdma (p-disabled
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 213) 	 * q-continuation without extended descriptor)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 214) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 215) 	if (NDISKS > 12) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 216) 		err += test(11, &tests);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 217) 		err += test(12, &tests);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 218) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 219) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 220) 	/* the 24 disk case is special for ioatdma as it is the boudary point
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 221) 	 * at which it needs to switch from 8-source ops to 16-source
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 222) 	 * ops for continuation (assumes DMA_HAS_PQ_CONTINUE is not set)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 223) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 224) 	if (NDISKS > 24)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 225) 		err += test(24, &tests);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 226) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 227) 	err += test(NDISKS, &tests);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 228) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 229) 	pr("\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 230) 	pr("complete (%d tests, %d failure%s)\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 231) 	   tests, err, err == 1 ? "" : "s");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 232) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 233) 	for (i = 0; i < NDISKS+3; i++)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 234) 		put_page(data[i]);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 235) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 236) 	return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 237) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 238) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 239) static void raid6_test_exit(void)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 240) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 241) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 242) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 243) /* when compiled-in wait for drivers to load first (assumes dma drivers
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 244)  * are also compliled-in)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 245)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 246) late_initcall(raid6_test);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 247) module_exit(raid6_test_exit);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 248) MODULE_AUTHOR("Dan Williams <dan.j.williams@intel.com>");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 249) MODULE_DESCRIPTION("asynchronous RAID-6 recovery self tests");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 250) MODULE_LICENSE("GPL");