Lines Matching full:test

38  * Limit the test area size to the maximum MMC HC erase group size.  Note that
65 * @max_sz: test area size (in bytes)
110 * @card: card under test
111 * @testcase: number of test case
112 * @result: result of test run
126 * @card: card under test
136 * struct mmc_test_card - test information.
137 * @card: card under test
179 static int mmc_test_set_blksize(struct mmc_test_card *test, unsigned size) in mmc_test_set_blksize() argument
181 return mmc_set_blocklen(test->card, size); in mmc_test_set_blksize()
190 static void mmc_test_prepare_sbc(struct mmc_test_card *test, in mmc_test_prepare_sbc() argument
193 struct mmc_card *card = test->card; in mmc_test_prepare_sbc()
210 static void mmc_test_prepare_mrq(struct mmc_test_card *test, in mmc_test_prepare_mrq() argument
226 if (!mmc_card_blockaddr(test->card)) in mmc_test_prepare_mrq()
245 mmc_test_prepare_sbc(test, mrq, blocks); in mmc_test_prepare_mrq()
247 mmc_set_data_timeout(mrq->data, test->card); in mmc_test_prepare_mrq()
259 static int mmc_test_wait_busy(struct mmc_test_card *test) in mmc_test_wait_busy() argument
269 cmd.arg = test->card->rca << 16; in mmc_test_wait_busy()
272 ret = mmc_wait_for_cmd(test->card->host, &cmd, 0); in mmc_test_wait_busy()
278 if (test->card->host->caps & MMC_CAP_WAIT_WHILE_BUSY) in mmc_test_wait_busy()
280 mmc_hostname(test->card->host)); in mmc_test_wait_busy()
290 static int mmc_test_buffer_transfer(struct mmc_test_card *test, in mmc_test_buffer_transfer() argument
306 mmc_test_prepare_mrq(test, &mrq, &sg, 1, addr, 1, blksz, write); in mmc_test_buffer_transfer()
308 mmc_wait_for_req(test->card->host, &mrq); in mmc_test_buffer_transfer()
315 return mmc_test_wait_busy(test); in mmc_test_buffer_transfer()
534 static void mmc_test_save_transfer_result(struct mmc_test_card *test, in mmc_test_save_transfer_result() argument
540 if (!test->gr) in mmc_test_save_transfer_result()
553 list_add_tail(&tr->link, &test->gr->tr_lst); in mmc_test_save_transfer_result()
559 static void mmc_test_print_rate(struct mmc_test_card *test, uint64_t bytes, in mmc_test_print_rate() argument
572 mmc_hostname(test->card->host), sectors, sectors >> 1, in mmc_test_print_rate()
577 mmc_test_save_transfer_result(test, 1, sectors, ts, rate, iops); in mmc_test_print_rate()
583 static void mmc_test_print_avg_rate(struct mmc_test_card *test, uint64_t bytes, in mmc_test_print_avg_rate() argument
599 mmc_hostname(test->card->host), count, sectors, count, in mmc_test_print_avg_rate()
603 test->area.sg_len); in mmc_test_print_avg_rate()
605 mmc_test_save_transfer_result(test, count, sectors, ts, rate, iops); in mmc_test_print_avg_rate()
620 /* Test preparation and cleanup */
627 static int __mmc_test_prepare(struct mmc_test_card *test, int write) in __mmc_test_prepare() argument
631 ret = mmc_test_set_blksize(test, 512); in __mmc_test_prepare()
636 memset(test->buffer, 0xDF, 512); in __mmc_test_prepare()
639 test->buffer[i] = i; in __mmc_test_prepare()
643 ret = mmc_test_buffer_transfer(test, test->buffer, i, 512, 1); in __mmc_test_prepare()
651 static int mmc_test_prepare_write(struct mmc_test_card *test) in mmc_test_prepare_write() argument
653 return __mmc_test_prepare(test, 1); in mmc_test_prepare_write()
656 static int mmc_test_prepare_read(struct mmc_test_card *test) in mmc_test_prepare_read() argument
658 return __mmc_test_prepare(test, 0); in mmc_test_prepare_read()
661 static int mmc_test_cleanup(struct mmc_test_card *test) in mmc_test_cleanup() argument
665 ret = mmc_test_set_blksize(test, 512); in mmc_test_cleanup()
669 memset(test->buffer, 0, 512); in mmc_test_cleanup()
672 ret = mmc_test_buffer_transfer(test, test->buffer, i, 512, 1); in mmc_test_cleanup()
681 /* Test execution helpers */
687 static void mmc_test_prepare_broken_mrq(struct mmc_test_card *test, in mmc_test_prepare_broken_mrq() argument
699 mrq->cmd->arg = test->card->rca << 16; in mmc_test_prepare_broken_mrq()
706 static int mmc_test_check_result(struct mmc_test_card *test, in mmc_test_check_result() argument
737 static int mmc_test_check_broken_result(struct mmc_test_card *test, in mmc_test_check_broken_result() argument
805 static int mmc_test_start_areq(struct mmc_test_card *test, in mmc_test_start_areq() argument
809 struct mmc_host *host = test->card->host; in mmc_test_start_areq()
820 err = mmc_test_wait_busy(test); in mmc_test_start_areq()
822 err = mmc_test_check_result(test, prev_mrq); in mmc_test_start_areq()
840 static int mmc_test_nonblock_transfer(struct mmc_test_card *test, in mmc_test_nonblock_transfer() argument
848 struct mmc_test_area *t = &test->area; in mmc_test_nonblock_transfer()
864 mmc_test_prepare_mrq(test, mrq, sg, t->sg_len, dev_addr, in mmc_test_nonblock_transfer()
866 ret = mmc_test_start_areq(test, mrq, prev_mrq); in mmc_test_nonblock_transfer()
878 ret = mmc_test_start_areq(test, NULL, prev_mrq); in mmc_test_nonblock_transfer()
888 static int mmc_test_simple_transfer(struct mmc_test_card *test, in mmc_test_simple_transfer() argument
901 mmc_test_prepare_mrq(test, &mrq, sg, sg_len, dev_addr, in mmc_test_simple_transfer()
904 mmc_wait_for_req(test->card->host, &mrq); in mmc_test_simple_transfer()
906 mmc_test_wait_busy(test); in mmc_test_simple_transfer()
908 return mmc_test_check_result(test, &mrq); in mmc_test_simple_transfer()
914 static int mmc_test_broken_transfer(struct mmc_test_card *test, in mmc_test_broken_transfer() argument
928 sg_init_one(&sg, test->buffer, blocks * blksz); in mmc_test_broken_transfer()
930 mmc_test_prepare_mrq(test, &mrq, &sg, 1, 0, blocks, blksz, write); in mmc_test_broken_transfer()
931 mmc_test_prepare_broken_mrq(test, &mrq, write); in mmc_test_broken_transfer()
933 mmc_wait_for_req(test->card->host, &mrq); in mmc_test_broken_transfer()
935 mmc_test_wait_busy(test); in mmc_test_broken_transfer()
937 return mmc_test_check_broken_result(test, &mrq); in mmc_test_broken_transfer()
941 * Does a complete transfer test where data is also validated
945 static int mmc_test_transfer(struct mmc_test_card *test, in mmc_test_transfer() argument
954 test->scratch[i] = i; in mmc_test_transfer()
956 memset(test->scratch, 0, BUFFER_SIZE); in mmc_test_transfer()
959 sg_copy_from_buffer(sg, sg_len, test->scratch, BUFFER_SIZE); in mmc_test_transfer()
962 ret = mmc_test_set_blksize(test, blksz); in mmc_test_transfer()
966 ret = mmc_test_simple_transfer(test, sg, sg_len, dev_addr, in mmc_test_transfer()
974 ret = mmc_test_set_blksize(test, 512); in mmc_test_transfer()
985 memset(test->buffer, 0, sectors * 512); in mmc_test_transfer()
988 ret = mmc_test_buffer_transfer(test, in mmc_test_transfer()
989 test->buffer + i * 512, in mmc_test_transfer()
996 if (test->buffer[i] != (u8)i) in mmc_test_transfer()
1001 if (test->buffer[i] != 0xDF) in mmc_test_transfer()
1006 sg_copy_to_buffer(sg, sg_len, test->scratch, BUFFER_SIZE); in mmc_test_transfer()
1009 if (test->scratch[i] != (u8)i) in mmc_test_transfer()
1029 static int mmc_test_basic_write(struct mmc_test_card *test) in mmc_test_basic_write() argument
1034 ret = mmc_test_set_blksize(test, 512); in mmc_test_basic_write()
1038 sg_init_one(&sg, test->buffer, 512); in mmc_test_basic_write()
1040 return mmc_test_simple_transfer(test, &sg, 1, 0, 1, 512, 1); in mmc_test_basic_write()
1043 static int mmc_test_basic_read(struct mmc_test_card *test) in mmc_test_basic_read() argument
1048 ret = mmc_test_set_blksize(test, 512); in mmc_test_basic_read()
1052 sg_init_one(&sg, test->buffer, 512); in mmc_test_basic_read()
1054 return mmc_test_simple_transfer(test, &sg, 1, 0, 1, 512, 0); in mmc_test_basic_read()
1057 static int mmc_test_verify_write(struct mmc_test_card *test) in mmc_test_verify_write() argument
1061 sg_init_one(&sg, test->buffer, 512); in mmc_test_verify_write()
1063 return mmc_test_transfer(test, &sg, 1, 0, 1, 512, 1); in mmc_test_verify_write()
1066 static int mmc_test_verify_read(struct mmc_test_card *test) in mmc_test_verify_read() argument
1070 sg_init_one(&sg, test->buffer, 512); in mmc_test_verify_read()
1072 return mmc_test_transfer(test, &sg, 1, 0, 1, 512, 0); in mmc_test_verify_read()
1075 static int mmc_test_multi_write(struct mmc_test_card *test) in mmc_test_multi_write() argument
1080 if (test->card->host->max_blk_count == 1) in mmc_test_multi_write()
1084 size = min(size, test->card->host->max_req_size); in mmc_test_multi_write()
1085 size = min(size, test->card->host->max_seg_size); in mmc_test_multi_write()
1086 size = min(size, test->card->host->max_blk_count * 512); in mmc_test_multi_write()
1091 sg_init_one(&sg, test->buffer, size); in mmc_test_multi_write()
1093 return mmc_test_transfer(test, &sg, 1, 0, size / 512, 512, 1); in mmc_test_multi_write()
1096 static int mmc_test_multi_read(struct mmc_test_card *test) in mmc_test_multi_read() argument
1101 if (test->card->host->max_blk_count == 1) in mmc_test_multi_read()
1105 size = min(size, test->card->host->max_req_size); in mmc_test_multi_read()
1106 size = min(size, test->card->host->max_seg_size); in mmc_test_multi_read()
1107 size = min(size, test->card->host->max_blk_count * 512); in mmc_test_multi_read()
1112 sg_init_one(&sg, test->buffer, size); in mmc_test_multi_read()
1114 return mmc_test_transfer(test, &sg, 1, 0, size / 512, 512, 0); in mmc_test_multi_read()
1117 static int mmc_test_pow2_write(struct mmc_test_card *test) in mmc_test_pow2_write() argument
1122 if (!test->card->csd.write_partial) in mmc_test_pow2_write()
1126 sg_init_one(&sg, test->buffer, i); in mmc_test_pow2_write()
1127 ret = mmc_test_transfer(test, &sg, 1, 0, 1, i, 1); in mmc_test_pow2_write()
1135 static int mmc_test_pow2_read(struct mmc_test_card *test) in mmc_test_pow2_read() argument
1140 if (!test->card->csd.read_partial) in mmc_test_pow2_read()
1144 sg_init_one(&sg, test->buffer, i); in mmc_test_pow2_read()
1145 ret = mmc_test_transfer(test, &sg, 1, 0, 1, i, 0); in mmc_test_pow2_read()
1153 static int mmc_test_weird_write(struct mmc_test_card *test) in mmc_test_weird_write() argument
1158 if (!test->card->csd.write_partial) in mmc_test_weird_write()
1162 sg_init_one(&sg, test->buffer, i); in mmc_test_weird_write()
1163 ret = mmc_test_transfer(test, &sg, 1, 0, 1, i, 1); in mmc_test_weird_write()
1171 static int mmc_test_weird_read(struct mmc_test_card *test) in mmc_test_weird_read() argument
1176 if (!test->card->csd.read_partial) in mmc_test_weird_read()
1180 sg_init_one(&sg, test->buffer, i); in mmc_test_weird_read()
1181 ret = mmc_test_transfer(test, &sg, 1, 0, 1, i, 0); in mmc_test_weird_read()
1189 static int mmc_test_align_write(struct mmc_test_card *test) in mmc_test_align_write() argument
1195 sg_init_one(&sg, test->buffer + i, 512); in mmc_test_align_write()
1196 ret = mmc_test_transfer(test, &sg, 1, 0, 1, 512, 1); in mmc_test_align_write()
1204 static int mmc_test_align_read(struct mmc_test_card *test) in mmc_test_align_read() argument
1210 sg_init_one(&sg, test->buffer + i, 512); in mmc_test_align_read()
1211 ret = mmc_test_transfer(test, &sg, 1, 0, 1, 512, 0); in mmc_test_align_read()
1219 static int mmc_test_align_multi_write(struct mmc_test_card *test) in mmc_test_align_multi_write() argument
1225 if (test->card->host->max_blk_count == 1) in mmc_test_align_multi_write()
1229 size = min(size, test->card->host->max_req_size); in mmc_test_align_multi_write()
1230 size = min(size, test->card->host->max_seg_size); in mmc_test_align_multi_write()
1231 size = min(size, test->card->host->max_blk_count * 512); in mmc_test_align_multi_write()
1237 sg_init_one(&sg, test->buffer + i, size); in mmc_test_align_multi_write()
1238 ret = mmc_test_transfer(test, &sg, 1, 0, size / 512, 512, 1); in mmc_test_align_multi_write()
1246 static int mmc_test_align_multi_read(struct mmc_test_card *test) in mmc_test_align_multi_read() argument
1252 if (test->card->host->max_blk_count == 1) in mmc_test_align_multi_read()
1256 size = min(size, test->card->host->max_req_size); in mmc_test_align_multi_read()
1257 size = min(size, test->card->host->max_seg_size); in mmc_test_align_multi_read()
1258 size = min(size, test->card->host->max_blk_count * 512); in mmc_test_align_multi_read()
1264 sg_init_one(&sg, test->buffer + i, size); in mmc_test_align_multi_read()
1265 ret = mmc_test_transfer(test, &sg, 1, 0, size / 512, 512, 0); in mmc_test_align_multi_read()
1273 static int mmc_test_xfersize_write(struct mmc_test_card *test) in mmc_test_xfersize_write() argument
1277 ret = mmc_test_set_blksize(test, 512); in mmc_test_xfersize_write()
1281 return mmc_test_broken_transfer(test, 1, 512, 1); in mmc_test_xfersize_write()
1284 static int mmc_test_xfersize_read(struct mmc_test_card *test) in mmc_test_xfersize_read() argument
1288 ret = mmc_test_set_blksize(test, 512); in mmc_test_xfersize_read()
1292 return mmc_test_broken_transfer(test, 1, 512, 0); in mmc_test_xfersize_read()
1295 static int mmc_test_multi_xfersize_write(struct mmc_test_card *test) in mmc_test_multi_xfersize_write() argument
1299 if (test->card->host->max_blk_count == 1) in mmc_test_multi_xfersize_write()
1302 ret = mmc_test_set_blksize(test, 512); in mmc_test_multi_xfersize_write()
1306 return mmc_test_broken_transfer(test, 2, 512, 1); in mmc_test_multi_xfersize_write()
1309 static int mmc_test_multi_xfersize_read(struct mmc_test_card *test) in mmc_test_multi_xfersize_read() argument
1313 if (test->card->host->max_blk_count == 1) in mmc_test_multi_xfersize_read()
1316 ret = mmc_test_set_blksize(test, 512); in mmc_test_multi_xfersize_read()
1320 return mmc_test_broken_transfer(test, 2, 512, 0); in mmc_test_multi_xfersize_read()
1325 static int mmc_test_write_high(struct mmc_test_card *test) in mmc_test_write_high() argument
1330 sg_set_page(&sg, test->highmem, 512, 0); in mmc_test_write_high()
1332 return mmc_test_transfer(test, &sg, 1, 0, 1, 512, 1); in mmc_test_write_high()
1335 static int mmc_test_read_high(struct mmc_test_card *test) in mmc_test_read_high() argument
1340 sg_set_page(&sg, test->highmem, 512, 0); in mmc_test_read_high()
1342 return mmc_test_transfer(test, &sg, 1, 0, 1, 512, 0); in mmc_test_read_high()
1345 static int mmc_test_multi_write_high(struct mmc_test_card *test) in mmc_test_multi_write_high() argument
1350 if (test->card->host->max_blk_count == 1) in mmc_test_multi_write_high()
1354 size = min(size, test->card->host->max_req_size); in mmc_test_multi_write_high()
1355 size = min(size, test->card->host->max_seg_size); in mmc_test_multi_write_high()
1356 size = min(size, test->card->host->max_blk_count * 512); in mmc_test_multi_write_high()
1362 sg_set_page(&sg, test->highmem, size, 0); in mmc_test_multi_write_high()
1364 return mmc_test_transfer(test, &sg, 1, 0, size / 512, 512, 1); in mmc_test_multi_write_high()
1367 static int mmc_test_multi_read_high(struct mmc_test_card *test) in mmc_test_multi_read_high() argument
1372 if (test->card->host->max_blk_count == 1) in mmc_test_multi_read_high()
1376 size = min(size, test->card->host->max_req_size); in mmc_test_multi_read_high()
1377 size = min(size, test->card->host->max_seg_size); in mmc_test_multi_read_high()
1378 size = min(size, test->card->host->max_blk_count * 512); in mmc_test_multi_read_high()
1384 sg_set_page(&sg, test->highmem, size, 0); in mmc_test_multi_read_high()
1386 return mmc_test_transfer(test, &sg, 1, 0, size / 512, 512, 0); in mmc_test_multi_read_high()
1391 static int mmc_test_no_highmem(struct mmc_test_card *test) in mmc_test_no_highmem() argument
1393 pr_info("%s: Highmem not configured - test skipped\n", in mmc_test_no_highmem()
1394 mmc_hostname(test->card->host)); in mmc_test_no_highmem()
1403 static int mmc_test_area_map(struct mmc_test_card *test, unsigned long sz, in mmc_test_area_map() argument
1406 struct mmc_test_area *t = &test->area; in mmc_test_area_map()
1438 mmc_hostname(test->card->host)); in mmc_test_area_map()
1445 static int mmc_test_area_transfer(struct mmc_test_card *test, in mmc_test_area_transfer() argument
1448 struct mmc_test_area *t = &test->area; in mmc_test_area_transfer()
1450 return mmc_test_simple_transfer(test, t->sg, t->sg_len, dev_addr, in mmc_test_area_transfer()
1457 static int mmc_test_area_io_seq(struct mmc_test_card *test, unsigned long sz, in mmc_test_area_io_seq() argument
1471 struct mmc_test_area *t = &test->area; in mmc_test_area_io_seq()
1482 ret = mmc_test_area_map(test, sz, max_scatter, min_sg_len, nonblock); in mmc_test_area_io_seq()
1489 ret = mmc_test_nonblock_transfer(test, dev_addr, write, count); in mmc_test_area_io_seq()
1492 ret = mmc_test_area_transfer(test, dev_addr, write); in mmc_test_area_io_seq()
1503 mmc_test_print_avg_rate(test, sz, count, &ts1, &ts2); in mmc_test_area_io_seq()
1508 static int mmc_test_area_io(struct mmc_test_card *test, unsigned long sz, in mmc_test_area_io() argument
1512 return mmc_test_area_io_seq(test, sz, dev_addr, write, max_scatter, in mmc_test_area_io()
1517 * Write the test area entirely.
1519 static int mmc_test_area_fill(struct mmc_test_card *test) in mmc_test_area_fill() argument
1521 struct mmc_test_area *t = &test->area; in mmc_test_area_fill()
1523 return mmc_test_area_io(test, t->max_tfr, t->dev_addr, 1, 0, 0); in mmc_test_area_fill()
1527 * Erase the test area entirely.
1529 static int mmc_test_area_erase(struct mmc_test_card *test) in mmc_test_area_erase() argument
1531 struct mmc_test_area *t = &test->area; in mmc_test_area_erase()
1533 if (!mmc_can_erase(test->card)) in mmc_test_area_erase()
1536 return mmc_erase(test->card, t->dev_addr, t->max_sz >> 9, in mmc_test_area_erase()
1543 static int mmc_test_area_cleanup(struct mmc_test_card *test) in mmc_test_area_cleanup() argument
1545 struct mmc_test_area *t = &test->area; in mmc_test_area_cleanup()
1555 * Initialize an area for testing large transfers. The test area is set to the
1561 static int mmc_test_area_init(struct mmc_test_card *test, int erase, int fill) in mmc_test_area_init() argument
1563 struct mmc_test_area *t = &test->area; in mmc_test_area_init()
1567 ret = mmc_test_set_blksize(test, 512); in mmc_test_area_init()
1571 /* Make the test area size about 4MiB */ in mmc_test_area_init()
1572 sz = (unsigned long)test->card->pref_erase << 9; in mmc_test_area_init()
1579 t->max_segs = test->card->host->max_segs; in mmc_test_area_init()
1580 t->max_seg_sz = test->card->host->max_seg_size; in mmc_test_area_init()
1584 if (t->max_tfr >> 9 > test->card->host->max_blk_count) in mmc_test_area_init()
1585 t->max_tfr = test->card->host->max_blk_count << 9; in mmc_test_area_init()
1586 if (t->max_tfr > test->card->host->max_req_size) in mmc_test_area_init()
1587 t->max_tfr = test->card->host->max_req_size; in mmc_test_area_init()
1615 t->dev_addr = mmc_test_capacity(test->card) / 2; in mmc_test_area_init()
1619 ret = mmc_test_area_erase(test); in mmc_test_area_init()
1625 ret = mmc_test_area_fill(test); in mmc_test_area_init()
1633 mmc_test_area_cleanup(test); in mmc_test_area_init()
1638 * Prepare for large transfers. Do not erase the test area.
1640 static int mmc_test_area_prepare(struct mmc_test_card *test) in mmc_test_area_prepare() argument
1642 return mmc_test_area_init(test, 0, 0); in mmc_test_area_prepare()
1646 * Prepare for large transfers. Do erase the test area.
1648 static int mmc_test_area_prepare_erase(struct mmc_test_card *test) in mmc_test_area_prepare_erase() argument
1650 return mmc_test_area_init(test, 1, 0); in mmc_test_area_prepare_erase()
1654 * Prepare for large transfers. Erase and fill the test area.
1656 static int mmc_test_area_prepare_fill(struct mmc_test_card *test) in mmc_test_area_prepare_fill() argument
1658 return mmc_test_area_init(test, 1, 1); in mmc_test_area_prepare_fill()
1662 * Test best-case performance. Best-case performance is expected from
1669 static int mmc_test_best_performance(struct mmc_test_card *test, int write, in mmc_test_best_performance() argument
1672 struct mmc_test_area *t = &test->area; in mmc_test_best_performance()
1674 return mmc_test_area_io(test, t->max_tfr, t->dev_addr, write, in mmc_test_best_performance()
1681 static int mmc_test_best_read_performance(struct mmc_test_card *test) in mmc_test_best_read_performance() argument
1683 return mmc_test_best_performance(test, 0, 0); in mmc_test_best_read_performance()
1689 static int mmc_test_best_write_performance(struct mmc_test_card *test) in mmc_test_best_write_performance() argument
1691 return mmc_test_best_performance(test, 1, 0); in mmc_test_best_write_performance()
1697 static int mmc_test_best_read_perf_max_scatter(struct mmc_test_card *test) in mmc_test_best_read_perf_max_scatter() argument
1699 return mmc_test_best_performance(test, 0, 1); in mmc_test_best_read_perf_max_scatter()
1705 static int mmc_test_best_write_perf_max_scatter(struct mmc_test_card *test) in mmc_test_best_write_perf_max_scatter() argument
1707 return mmc_test_best_performance(test, 1, 1); in mmc_test_best_write_perf_max_scatter()
1713 static int mmc_test_profile_read_perf(struct mmc_test_card *test) in mmc_test_profile_read_perf() argument
1715 struct mmc_test_area *t = &test->area; in mmc_test_profile_read_perf()
1722 ret = mmc_test_area_io(test, sz, dev_addr, 0, 0, 1); in mmc_test_profile_read_perf()
1728 return mmc_test_area_io(test, sz, dev_addr, 0, 0, 1); in mmc_test_profile_read_perf()
1734 static int mmc_test_profile_write_perf(struct mmc_test_card *test) in mmc_test_profile_write_perf() argument
1736 struct mmc_test_area *t = &test->area; in mmc_test_profile_write_perf()
1741 ret = mmc_test_area_erase(test); in mmc_test_profile_write_perf()
1746 ret = mmc_test_area_io(test, sz, dev_addr, 1, 0, 1); in mmc_test_profile_write_perf()
1750 ret = mmc_test_area_erase(test); in mmc_test_profile_write_perf()
1755 return mmc_test_area_io(test, sz, dev_addr, 1, 0, 1); in mmc_test_profile_write_perf()
1761 static int mmc_test_profile_trim_perf(struct mmc_test_card *test) in mmc_test_profile_trim_perf() argument
1763 struct mmc_test_area *t = &test->area; in mmc_test_profile_trim_perf()
1769 if (!mmc_can_trim(test->card)) in mmc_test_profile_trim_perf()
1772 if (!mmc_can_erase(test->card)) in mmc_test_profile_trim_perf()
1778 ret = mmc_erase(test->card, dev_addr, sz >> 9, MMC_TRIM_ARG); in mmc_test_profile_trim_perf()
1782 mmc_test_print_rate(test, sz, &ts1, &ts2); in mmc_test_profile_trim_perf()
1786 ret = mmc_erase(test->card, dev_addr, sz >> 9, MMC_TRIM_ARG); in mmc_test_profile_trim_perf()
1790 mmc_test_print_rate(test, sz, &ts1, &ts2); in mmc_test_profile_trim_perf()
1794 static int mmc_test_seq_read_perf(struct mmc_test_card *test, unsigned long sz) in mmc_test_seq_read_perf() argument
1796 struct mmc_test_area *t = &test->area; in mmc_test_seq_read_perf()
1805 ret = mmc_test_area_io(test, sz, dev_addr, 0, 0, 0); in mmc_test_seq_read_perf()
1811 mmc_test_print_avg_rate(test, sz, cnt, &ts1, &ts2); in mmc_test_seq_read_perf()
1818 static int mmc_test_profile_seq_read_perf(struct mmc_test_card *test) in mmc_test_profile_seq_read_perf() argument
1820 struct mmc_test_area *t = &test->area; in mmc_test_profile_seq_read_perf()
1825 ret = mmc_test_seq_read_perf(test, sz); in mmc_test_profile_seq_read_perf()
1830 return mmc_test_seq_read_perf(test, sz); in mmc_test_profile_seq_read_perf()
1833 static int mmc_test_seq_write_perf(struct mmc_test_card *test, unsigned long sz) in mmc_test_seq_write_perf() argument
1835 struct mmc_test_area *t = &test->area; in mmc_test_seq_write_perf()
1840 ret = mmc_test_area_erase(test); in mmc_test_seq_write_perf()
1847 ret = mmc_test_area_io(test, sz, dev_addr, 1, 0, 0); in mmc_test_seq_write_perf()
1853 mmc_test_print_avg_rate(test, sz, cnt, &ts1, &ts2); in mmc_test_seq_write_perf()
1860 static int mmc_test_profile_seq_write_perf(struct mmc_test_card *test) in mmc_test_profile_seq_write_perf() argument
1862 struct mmc_test_area *t = &test->area; in mmc_test_profile_seq_write_perf()
1867 ret = mmc_test_seq_write_perf(test, sz); in mmc_test_profile_seq_write_perf()
1872 return mmc_test_seq_write_perf(test, sz); in mmc_test_profile_seq_write_perf()
1878 static int mmc_test_profile_seq_trim_perf(struct mmc_test_card *test) in mmc_test_profile_seq_trim_perf() argument
1880 struct mmc_test_area *t = &test->area; in mmc_test_profile_seq_trim_perf()
1886 if (!mmc_can_trim(test->card)) in mmc_test_profile_seq_trim_perf()
1889 if (!mmc_can_erase(test->card)) in mmc_test_profile_seq_trim_perf()
1893 ret = mmc_test_area_erase(test); in mmc_test_profile_seq_trim_perf()
1896 ret = mmc_test_area_fill(test); in mmc_test_profile_seq_trim_perf()
1903 ret = mmc_erase(test->card, dev_addr, sz >> 9, in mmc_test_profile_seq_trim_perf()
1910 mmc_test_print_avg_rate(test, sz, cnt, &ts1, &ts2); in mmc_test_profile_seq_trim_perf()
1926 static int mmc_test_rnd_perf(struct mmc_test_card *test, int write, int print, in mmc_test_rnd_perf() argument
1936 rnd_addr = mmc_test_capacity(test->card) / 4; in mmc_test_rnd_perf()
1937 range1 = rnd_addr / test->card->pref_erase; in mmc_test_rnd_perf()
1950 dev_addr = rnd_addr + test->card->pref_erase * ea + in mmc_test_rnd_perf()
1952 ret = mmc_test_area_io(test, sz, dev_addr, write, 0, 0); in mmc_test_rnd_perf()
1957 mmc_test_print_avg_rate(test, sz, cnt, &ts1, &ts2); in mmc_test_rnd_perf()
1961 static int mmc_test_random_perf(struct mmc_test_card *test, int write) in mmc_test_random_perf() argument
1963 struct mmc_test_area *t = &test->area; in mmc_test_random_perf()
1971 * the test twice with exactly the same I/O but outputting the in mmc_test_random_perf()
1976 ret = mmc_test_rnd_perf(test, write, 0, sz); in mmc_test_random_perf()
1981 ret = mmc_test_rnd_perf(test, write, 1, sz); in mmc_test_random_perf()
1988 ret = mmc_test_rnd_perf(test, write, 0, sz); in mmc_test_random_perf()
1993 return mmc_test_rnd_perf(test, write, 1, sz); in mmc_test_random_perf()
1999 static int mmc_test_random_read_perf(struct mmc_test_card *test) in mmc_test_random_read_perf() argument
2001 return mmc_test_random_perf(test, 0); in mmc_test_random_read_perf()
2007 static int mmc_test_random_write_perf(struct mmc_test_card *test) in mmc_test_random_write_perf() argument
2009 return mmc_test_random_perf(test, 1); in mmc_test_random_write_perf()
2012 static int mmc_test_seq_perf(struct mmc_test_card *test, int write, in mmc_test_seq_perf() argument
2015 struct mmc_test_area *t = &test->area; in mmc_test_seq_perf()
2038 dev_addr = mmc_test_capacity(test->card) / 4; in mmc_test_seq_perf()
2046 ret = mmc_test_area_io(test, sz, dev_addr, write, in mmc_test_seq_perf()
2054 mmc_test_print_avg_rate(test, sz, cnt, &ts1, &ts2); in mmc_test_seq_perf()
2059 static int mmc_test_large_seq_perf(struct mmc_test_card *test, int write) in mmc_test_large_seq_perf() argument
2064 ret = mmc_test_seq_perf(test, write, 10 * 1024 * 1024, 1); in mmc_test_large_seq_perf()
2069 ret = mmc_test_seq_perf(test, write, 100 * 1024 * 1024, 1); in mmc_test_large_seq_perf()
2074 ret = mmc_test_seq_perf(test, write, 1000 * 1024 * 1024, 1); in mmc_test_large_seq_perf()
2085 static int mmc_test_large_seq_read_perf(struct mmc_test_card *test) in mmc_test_large_seq_read_perf() argument
2087 return mmc_test_large_seq_perf(test, 0); in mmc_test_large_seq_read_perf()
2093 static int mmc_test_large_seq_write_perf(struct mmc_test_card *test) in mmc_test_large_seq_write_perf() argument
2095 return mmc_test_large_seq_perf(test, 1); in mmc_test_large_seq_write_perf()
2098 static int mmc_test_rw_multiple(struct mmc_test_card *test, in mmc_test_rw_multiple() argument
2104 struct mmc_test_area *t = &test->area; in mmc_test_rw_multiple()
2107 /* Set up test area */ in mmc_test_rw_multiple()
2108 if (size > mmc_test_capacity(test->card) / 2 * 512) in mmc_test_rw_multiple()
2109 size = mmc_test_capacity(test->card) / 2 * 512; in mmc_test_rw_multiple()
2112 dev_addr = mmc_test_capacity(test->card) / 4; in mmc_test_rw_multiple()
2123 /* prepare test area */ in mmc_test_rw_multiple()
2124 if (mmc_can_erase(test->card) && in mmc_test_rw_multiple()
2126 ret = mmc_erase(test->card, dev_addr, in mmc_test_rw_multiple()
2129 ret = mmc_erase(test->card, dev_addr, in mmc_test_rw_multiple()
2135 /* Run test */ in mmc_test_rw_multiple()
2136 ret = mmc_test_area_io_seq(test, reqsize, dev_addr, in mmc_test_rw_multiple()
2148 static int mmc_test_rw_multiple_size(struct mmc_test_card *test, in mmc_test_rw_multiple_size() argument
2153 void *pre_req = test->card->host->ops->pre_req; in mmc_test_rw_multiple_size()
2154 void *post_req = test->card->host->ops->post_req; in mmc_test_rw_multiple_size()
2163 ret = mmc_test_rw_multiple(test, rw, rw->bs[i], rw->size, 0); in mmc_test_rw_multiple_size()
2170 static int mmc_test_rw_multiple_sg_len(struct mmc_test_card *test, in mmc_test_rw_multiple_sg_len() argument
2177 ret = mmc_test_rw_multiple(test, rw, 512 * 1024, rw->size, in mmc_test_rw_multiple_sg_len()
2188 static int mmc_test_profile_mult_write_blocking_perf(struct mmc_test_card *test) in mmc_test_profile_mult_write_blocking_perf() argument
2201 return mmc_test_rw_multiple_size(test, &test_data); in mmc_test_profile_mult_write_blocking_perf()
2207 static int mmc_test_profile_mult_write_nonblock_perf(struct mmc_test_card *test) in mmc_test_profile_mult_write_nonblock_perf() argument
2220 return mmc_test_rw_multiple_size(test, &test_data); in mmc_test_profile_mult_write_nonblock_perf()
2226 static int mmc_test_profile_mult_read_blocking_perf(struct mmc_test_card *test) in mmc_test_profile_mult_read_blocking_perf() argument
2239 return mmc_test_rw_multiple_size(test, &test_data); in mmc_test_profile_mult_read_blocking_perf()
2245 static int mmc_test_profile_mult_read_nonblock_perf(struct mmc_test_card *test) in mmc_test_profile_mult_read_nonblock_perf() argument
2258 return mmc_test_rw_multiple_size(test, &test_data); in mmc_test_profile_mult_read_nonblock_perf()
2264 static int mmc_test_profile_sglen_wr_blocking_perf(struct mmc_test_card *test) in mmc_test_profile_sglen_wr_blocking_perf() argument
2277 return mmc_test_rw_multiple_sg_len(test, &test_data); in mmc_test_profile_sglen_wr_blocking_perf()
2283 static int mmc_test_profile_sglen_wr_nonblock_perf(struct mmc_test_card *test) in mmc_test_profile_sglen_wr_nonblock_perf() argument
2296 return mmc_test_rw_multiple_sg_len(test, &test_data); in mmc_test_profile_sglen_wr_nonblock_perf()
2302 static int mmc_test_profile_sglen_r_blocking_perf(struct mmc_test_card *test) in mmc_test_profile_sglen_r_blocking_perf() argument
2315 return mmc_test_rw_multiple_sg_len(test, &test_data); in mmc_test_profile_sglen_r_blocking_perf()
2321 static int mmc_test_profile_sglen_r_nonblock_perf(struct mmc_test_card *test) in mmc_test_profile_sglen_r_nonblock_perf() argument
2334 return mmc_test_rw_multiple_sg_len(test, &test_data); in mmc_test_profile_sglen_r_nonblock_perf()
2340 static int mmc_test_reset(struct mmc_test_card *test) in mmc_test_reset() argument
2342 struct mmc_card *card = test->card; in mmc_test_reset()
2362 static int mmc_test_send_status(struct mmc_test_card *test, in mmc_test_send_status() argument
2368 if (!mmc_host_is_spi(test->card->host)) in mmc_test_send_status()
2369 cmd->arg = test->card->rca << 16; in mmc_test_send_status()
2372 return mmc_wait_for_cmd(test->card->host, cmd, 0); in mmc_test_send_status()
2375 static int mmc_test_ongoing_transfer(struct mmc_test_card *test, in mmc_test_ongoing_transfer() argument
2380 struct mmc_host *host = test->card->host; in mmc_test_ongoing_transfer()
2381 struct mmc_test_area *t = &test->area; in mmc_test_ongoing_transfer()
2397 mmc_test_prepare_mrq(test, mrq, t->sg, t->sg_len, dev_addr, t->blocks, in mmc_test_ongoing_transfer()
2409 ret = mmc_test_start_areq(test, mrq, NULL); in mmc_test_ongoing_transfer()
2421 cmd_ret = mmc_test_send_status(test, &rq->status); in mmc_test_ongoing_transfer()
2445 ret = mmc_test_start_areq(test, NULL, mrq); in mmc_test_ongoing_transfer()
2447 mmc_wait_for_req_done(test->card->host, mrq); in mmc_test_ongoing_transfer()
2466 mmc_hostname(test->card->host), status, cmd_ret); in mmc_test_ongoing_transfer()
2469 ret = mmc_test_check_result(test, mrq); in mmc_test_ongoing_transfer()
2473 ret = mmc_test_wait_busy(test); in mmc_test_ongoing_transfer()
2479 mmc_hostname(test->card->host), count, t->blocks); in mmc_test_ongoing_transfer()
2489 static int __mmc_test_cmds_during_tfr(struct mmc_test_card *test, in __mmc_test_cmds_during_tfr() argument
2493 struct mmc_test_area *t = &test->area; in __mmc_test_cmds_during_tfr()
2496 if (!(test->card->host->caps & MMC_CAP_CMD_DURING_TFR)) in __mmc_test_cmds_during_tfr()
2499 ret = mmc_test_area_map(test, sz, 0, 0, use_areq); in __mmc_test_cmds_during_tfr()
2503 ret = mmc_test_ongoing_transfer(test, t->dev_addr, use_sbc, 0, write, in __mmc_test_cmds_during_tfr()
2508 return mmc_test_ongoing_transfer(test, t->dev_addr, use_sbc, 1, write, in __mmc_test_cmds_during_tfr()
2512 static int mmc_test_cmds_during_tfr(struct mmc_test_card *test, int use_sbc, in mmc_test_cmds_during_tfr() argument
2515 struct mmc_test_area *t = &test->area; in mmc_test_cmds_during_tfr()
2520 ret = __mmc_test_cmds_during_tfr(test, sz, use_sbc, write, in mmc_test_cmds_during_tfr()
2531 static int mmc_test_cmds_during_read(struct mmc_test_card *test) in mmc_test_cmds_during_read() argument
2533 return mmc_test_cmds_during_tfr(test, 0, 0, 0); in mmc_test_cmds_during_read()
2539 static int mmc_test_cmds_during_write(struct mmc_test_card *test) in mmc_test_cmds_during_write() argument
2541 return mmc_test_cmds_during_tfr(test, 0, 1, 0); in mmc_test_cmds_during_write()
2547 static int mmc_test_cmds_during_read_cmd23(struct mmc_test_card *test) in mmc_test_cmds_during_read_cmd23() argument
2549 return mmc_test_cmds_during_tfr(test, 1, 0, 0); in mmc_test_cmds_during_read_cmd23()
2555 static int mmc_test_cmds_during_write_cmd23(struct mmc_test_card *test) in mmc_test_cmds_during_write_cmd23() argument
2557 return mmc_test_cmds_during_tfr(test, 1, 1, 0); in mmc_test_cmds_during_write_cmd23()
2563 static int mmc_test_cmds_during_read_cmd23_nonblock(struct mmc_test_card *test) in mmc_test_cmds_during_read_cmd23_nonblock() argument
2565 return mmc_test_cmds_during_tfr(test, 1, 0, 1); in mmc_test_cmds_during_read_cmd23_nonblock()
2571 static int mmc_test_cmds_during_write_cmd23_nonblock(struct mmc_test_card *test) in mmc_test_cmds_during_write_cmd23_nonblock() argument
2573 return mmc_test_cmds_during_tfr(test, 1, 1, 1); in mmc_test_cmds_during_write_cmd23_nonblock()
2900 .name = "Reset test",
2951 static void mmc_test_run(struct mmc_test_card *test, int testcase) in mmc_test_run() argument
2956 mmc_hostname(test->card->host), mmc_card_id(test->card)); in mmc_test_run()
2958 mmc_claim_host(test->card->host); in mmc_test_run()
2966 pr_info("%s: Test case %d. %s...\n", in mmc_test_run()
2967 mmc_hostname(test->card->host), i + 1, in mmc_test_run()
2971 ret = mmc_test_cases[i].prepare(test); in mmc_test_run()
2974 mmc_hostname(test->card->host), in mmc_test_run()
2985 gr->card = test->card; in mmc_test_run()
2995 test->gr = gr; in mmc_test_run()
2998 ret = mmc_test_cases[i].run(test); in mmc_test_run()
3002 mmc_hostname(test->card->host)); in mmc_test_run()
3006 mmc_hostname(test->card->host)); in mmc_test_run()
3010 mmc_hostname(test->card->host)); in mmc_test_run()
3014 mmc_hostname(test->card->host)); in mmc_test_run()
3018 mmc_hostname(test->card->host), ret); in mmc_test_run()
3026 ret = mmc_test_cases[i].cleanup(test); in mmc_test_run()
3029 mmc_hostname(test->card->host), in mmc_test_run()
3035 mmc_release_host(test->card->host); in mmc_test_run()
3038 mmc_hostname(test->card->host)); in mmc_test_run()
3080 seq_printf(sf, "Test %d: %d\n", gr->testcase + 1, gr->result); in mtf_test_show()
3105 struct mmc_test_card *test; local
3113 test = kzalloc(sizeof(*test), GFP_KERNEL);
3114 if (!test)
3118 * Remove all test cases associated with given card. Thus we have only
3123 test->card = card;
3125 test->buffer = kzalloc(BUFFER_SIZE, GFP_KERNEL);
3127 test->highmem = alloc_pages(GFP_KERNEL | __GFP_HIGHMEM, BUFFER_ORDER);
3131 if (test->buffer && test->highmem) {
3133 if (test->buffer) {
3136 mmc_test_run(test, testcase);
3141 __free_pages(test->highmem, BUFFER_ORDER);
3143 kfree(test->buffer);
3144 kfree(test);
3219 ret = __mmc_test_register_dbgfs_file(card, "test", S_IWUSR | S_IRUGO,
3301 MODULE_DESCRIPTION("Multimedia Card (MMC) host test driver");