Lines Matching refs:test
178 static int mmc_test_set_blksize(struct mmc_test_card *test, unsigned size) in mmc_test_set_blksize() argument
180 return mmc_set_blocklen(test->card, size); in mmc_test_set_blksize()
189 static void mmc_test_prepare_sbc(struct mmc_test_card *test, in mmc_test_prepare_sbc() argument
192 struct mmc_card *card = test->card; in mmc_test_prepare_sbc()
209 static void mmc_test_prepare_mrq(struct mmc_test_card *test, in mmc_test_prepare_mrq() argument
225 if (!mmc_card_blockaddr(test->card)) in mmc_test_prepare_mrq()
244 mmc_test_prepare_sbc(test, mrq, blocks); in mmc_test_prepare_mrq()
246 mmc_set_data_timeout(mrq->data, test->card); in mmc_test_prepare_mrq()
258 static int mmc_test_wait_busy(struct mmc_test_card *test) in mmc_test_wait_busy() argument
268 cmd.arg = test->card->rca << 16; in mmc_test_wait_busy()
271 ret = mmc_wait_for_cmd(test->card->host, &cmd, 0); in mmc_test_wait_busy()
277 if (test->card->host->caps & MMC_CAP_WAIT_WHILE_BUSY) in mmc_test_wait_busy()
279 mmc_hostname(test->card->host)); in mmc_test_wait_busy()
289 static int mmc_test_buffer_transfer(struct mmc_test_card *test, in mmc_test_buffer_transfer() argument
305 mmc_test_prepare_mrq(test, &mrq, &sg, 1, addr, 1, blksz, write); in mmc_test_buffer_transfer()
307 mmc_wait_for_req(test->card->host, &mrq); in mmc_test_buffer_transfer()
314 return mmc_test_wait_busy(test); in mmc_test_buffer_transfer()
533 static void mmc_test_save_transfer_result(struct mmc_test_card *test, in mmc_test_save_transfer_result() argument
539 if (!test->gr) in mmc_test_save_transfer_result()
552 list_add_tail(&tr->link, &test->gr->tr_lst); in mmc_test_save_transfer_result()
558 static void mmc_test_print_rate(struct mmc_test_card *test, uint64_t bytes, in mmc_test_print_rate() argument
571 mmc_hostname(test->card->host), sectors, sectors >> 1, in mmc_test_print_rate()
576 mmc_test_save_transfer_result(test, 1, sectors, ts, rate, iops); in mmc_test_print_rate()
582 static void mmc_test_print_avg_rate(struct mmc_test_card *test, uint64_t bytes, in mmc_test_print_avg_rate() argument
598 mmc_hostname(test->card->host), count, sectors, count, in mmc_test_print_avg_rate()
602 test->area.sg_len); in mmc_test_print_avg_rate()
604 mmc_test_save_transfer_result(test, count, sectors, ts, rate, iops); in mmc_test_print_avg_rate()
626 static int __mmc_test_prepare(struct mmc_test_card *test, int write, int val) in __mmc_test_prepare() argument
630 ret = mmc_test_set_blksize(test, 512); in __mmc_test_prepare()
635 memset(test->buffer, val, 512); in __mmc_test_prepare()
638 test->buffer[i] = i; in __mmc_test_prepare()
642 ret = mmc_test_buffer_transfer(test, test->buffer, i, 512, 1); in __mmc_test_prepare()
650 static int mmc_test_prepare_write(struct mmc_test_card *test) in mmc_test_prepare_write() argument
652 return __mmc_test_prepare(test, 1, 0xDF); in mmc_test_prepare_write()
655 static int mmc_test_prepare_read(struct mmc_test_card *test) in mmc_test_prepare_read() argument
657 return __mmc_test_prepare(test, 0, 0); in mmc_test_prepare_read()
660 static int mmc_test_cleanup(struct mmc_test_card *test) in mmc_test_cleanup() argument
662 return __mmc_test_prepare(test, 1, 0); in mmc_test_cleanup()
672 static void mmc_test_prepare_broken_mrq(struct mmc_test_card *test, in mmc_test_prepare_broken_mrq() argument
684 mrq->cmd->arg = test->card->rca << 16; in mmc_test_prepare_broken_mrq()
691 static int mmc_test_check_result(struct mmc_test_card *test, in mmc_test_check_result() argument
722 static int mmc_test_check_broken_result(struct mmc_test_card *test, in mmc_test_check_broken_result() argument
790 static int mmc_test_start_areq(struct mmc_test_card *test, in mmc_test_start_areq() argument
794 struct mmc_host *host = test->card->host; in mmc_test_start_areq()
805 err = mmc_test_wait_busy(test); in mmc_test_start_areq()
807 err = mmc_test_check_result(test, prev_mrq); in mmc_test_start_areq()
825 static int mmc_test_nonblock_transfer(struct mmc_test_card *test, in mmc_test_nonblock_transfer() argument
833 struct mmc_test_area *t = &test->area; in mmc_test_nonblock_transfer()
849 mmc_test_prepare_mrq(test, mrq, sg, t->sg_len, dev_addr, in mmc_test_nonblock_transfer()
851 ret = mmc_test_start_areq(test, mrq, prev_mrq); in mmc_test_nonblock_transfer()
863 ret = mmc_test_start_areq(test, NULL, prev_mrq); in mmc_test_nonblock_transfer()
873 static int mmc_test_simple_transfer(struct mmc_test_card *test, in mmc_test_simple_transfer() argument
886 mmc_test_prepare_mrq(test, &mrq, sg, sg_len, dev_addr, in mmc_test_simple_transfer()
889 mmc_wait_for_req(test->card->host, &mrq); in mmc_test_simple_transfer()
891 mmc_test_wait_busy(test); in mmc_test_simple_transfer()
893 return mmc_test_check_result(test, &mrq); in mmc_test_simple_transfer()
899 static int mmc_test_broken_transfer(struct mmc_test_card *test, in mmc_test_broken_transfer() argument
913 sg_init_one(&sg, test->buffer, blocks * blksz); in mmc_test_broken_transfer()
915 mmc_test_prepare_mrq(test, &mrq, &sg, 1, 0, blocks, blksz, write); in mmc_test_broken_transfer()
916 mmc_test_prepare_broken_mrq(test, &mrq, write); in mmc_test_broken_transfer()
918 mmc_wait_for_req(test->card->host, &mrq); in mmc_test_broken_transfer()
920 mmc_test_wait_busy(test); in mmc_test_broken_transfer()
922 return mmc_test_check_broken_result(test, &mrq); in mmc_test_broken_transfer()
930 static int mmc_test_transfer(struct mmc_test_card *test, in mmc_test_transfer() argument
939 test->scratch[i] = i; in mmc_test_transfer()
941 memset(test->scratch, 0, BUFFER_SIZE); in mmc_test_transfer()
944 sg_copy_from_buffer(sg, sg_len, test->scratch, BUFFER_SIZE); in mmc_test_transfer()
947 ret = mmc_test_set_blksize(test, blksz); in mmc_test_transfer()
951 ret = mmc_test_simple_transfer(test, sg, sg_len, dev_addr, in mmc_test_transfer()
959 ret = mmc_test_set_blksize(test, 512); in mmc_test_transfer()
970 memset(test->buffer, 0, sectors * 512); in mmc_test_transfer()
973 ret = mmc_test_buffer_transfer(test, in mmc_test_transfer()
974 test->buffer + i * 512, in mmc_test_transfer()
981 if (test->buffer[i] != (u8)i) in mmc_test_transfer()
986 if (test->buffer[i] != 0xDF) in mmc_test_transfer()
991 sg_copy_to_buffer(sg, sg_len, test->scratch, BUFFER_SIZE); in mmc_test_transfer()
994 if (test->scratch[i] != (u8)i) in mmc_test_transfer()
1014 static int mmc_test_basic_write(struct mmc_test_card *test) in mmc_test_basic_write() argument
1019 ret = mmc_test_set_blksize(test, 512); in mmc_test_basic_write()
1023 sg_init_one(&sg, test->buffer, 512); in mmc_test_basic_write()
1025 return mmc_test_simple_transfer(test, &sg, 1, 0, 1, 512, 1); in mmc_test_basic_write()
1028 static int mmc_test_basic_read(struct mmc_test_card *test) in mmc_test_basic_read() argument
1033 ret = mmc_test_set_blksize(test, 512); in mmc_test_basic_read()
1037 sg_init_one(&sg, test->buffer, 512); in mmc_test_basic_read()
1039 return mmc_test_simple_transfer(test, &sg, 1, 0, 1, 512, 0); in mmc_test_basic_read()
1042 static int mmc_test_verify_write(struct mmc_test_card *test) in mmc_test_verify_write() argument
1046 sg_init_one(&sg, test->buffer, 512); in mmc_test_verify_write()
1048 return mmc_test_transfer(test, &sg, 1, 0, 1, 512, 1); in mmc_test_verify_write()
1051 static int mmc_test_verify_read(struct mmc_test_card *test) in mmc_test_verify_read() argument
1055 sg_init_one(&sg, test->buffer, 512); in mmc_test_verify_read()
1057 return mmc_test_transfer(test, &sg, 1, 0, 1, 512, 0); in mmc_test_verify_read()
1060 static int mmc_test_multi_write(struct mmc_test_card *test) in mmc_test_multi_write() argument
1065 if (test->card->host->max_blk_count == 1) in mmc_test_multi_write()
1069 size = min(size, test->card->host->max_req_size); in mmc_test_multi_write()
1070 size = min(size, test->card->host->max_seg_size); in mmc_test_multi_write()
1071 size = min(size, test->card->host->max_blk_count * 512); in mmc_test_multi_write()
1076 sg_init_one(&sg, test->buffer, size); in mmc_test_multi_write()
1078 return mmc_test_transfer(test, &sg, 1, 0, size / 512, 512, 1); in mmc_test_multi_write()
1081 static int mmc_test_multi_read(struct mmc_test_card *test) in mmc_test_multi_read() argument
1086 if (test->card->host->max_blk_count == 1) in mmc_test_multi_read()
1090 size = min(size, test->card->host->max_req_size); in mmc_test_multi_read()
1091 size = min(size, test->card->host->max_seg_size); in mmc_test_multi_read()
1092 size = min(size, test->card->host->max_blk_count * 512); in mmc_test_multi_read()
1097 sg_init_one(&sg, test->buffer, size); in mmc_test_multi_read()
1099 return mmc_test_transfer(test, &sg, 1, 0, size / 512, 512, 0); in mmc_test_multi_read()
1102 static int mmc_test_pow2_write(struct mmc_test_card *test) in mmc_test_pow2_write() argument
1107 if (!test->card->csd.write_partial) in mmc_test_pow2_write()
1111 sg_init_one(&sg, test->buffer, i); in mmc_test_pow2_write()
1112 ret = mmc_test_transfer(test, &sg, 1, 0, 1, i, 1); in mmc_test_pow2_write()
1120 static int mmc_test_pow2_read(struct mmc_test_card *test) in mmc_test_pow2_read() argument
1125 if (!test->card->csd.read_partial) in mmc_test_pow2_read()
1129 sg_init_one(&sg, test->buffer, i); in mmc_test_pow2_read()
1130 ret = mmc_test_transfer(test, &sg, 1, 0, 1, i, 0); in mmc_test_pow2_read()
1138 static int mmc_test_weird_write(struct mmc_test_card *test) in mmc_test_weird_write() argument
1143 if (!test->card->csd.write_partial) in mmc_test_weird_write()
1147 sg_init_one(&sg, test->buffer, i); in mmc_test_weird_write()
1148 ret = mmc_test_transfer(test, &sg, 1, 0, 1, i, 1); in mmc_test_weird_write()
1156 static int mmc_test_weird_read(struct mmc_test_card *test) in mmc_test_weird_read() argument
1161 if (!test->card->csd.read_partial) in mmc_test_weird_read()
1165 sg_init_one(&sg, test->buffer, i); in mmc_test_weird_read()
1166 ret = mmc_test_transfer(test, &sg, 1, 0, 1, i, 0); in mmc_test_weird_read()
1174 static int mmc_test_align_write(struct mmc_test_card *test) in mmc_test_align_write() argument
1180 sg_init_one(&sg, test->buffer + i, 512); in mmc_test_align_write()
1181 ret = mmc_test_transfer(test, &sg, 1, 0, 1, 512, 1); in mmc_test_align_write()
1189 static int mmc_test_align_read(struct mmc_test_card *test) in mmc_test_align_read() argument
1195 sg_init_one(&sg, test->buffer + i, 512); in mmc_test_align_read()
1196 ret = mmc_test_transfer(test, &sg, 1, 0, 1, 512, 0); in mmc_test_align_read()
1204 static int mmc_test_align_multi_write(struct mmc_test_card *test) in mmc_test_align_multi_write() argument
1210 if (test->card->host->max_blk_count == 1) in mmc_test_align_multi_write()
1214 size = min(size, test->card->host->max_req_size); in mmc_test_align_multi_write()
1215 size = min(size, test->card->host->max_seg_size); in mmc_test_align_multi_write()
1216 size = min(size, test->card->host->max_blk_count * 512); in mmc_test_align_multi_write()
1222 sg_init_one(&sg, test->buffer + i, size); in mmc_test_align_multi_write()
1223 ret = mmc_test_transfer(test, &sg, 1, 0, size / 512, 512, 1); in mmc_test_align_multi_write()
1231 static int mmc_test_align_multi_read(struct mmc_test_card *test) in mmc_test_align_multi_read() argument
1237 if (test->card->host->max_blk_count == 1) in mmc_test_align_multi_read()
1241 size = min(size, test->card->host->max_req_size); in mmc_test_align_multi_read()
1242 size = min(size, test->card->host->max_seg_size); in mmc_test_align_multi_read()
1243 size = min(size, test->card->host->max_blk_count * 512); in mmc_test_align_multi_read()
1249 sg_init_one(&sg, test->buffer + i, size); in mmc_test_align_multi_read()
1250 ret = mmc_test_transfer(test, &sg, 1, 0, size / 512, 512, 0); in mmc_test_align_multi_read()
1258 static int mmc_test_xfersize_write(struct mmc_test_card *test) in mmc_test_xfersize_write() argument
1262 ret = mmc_test_set_blksize(test, 512); in mmc_test_xfersize_write()
1266 return mmc_test_broken_transfer(test, 1, 512, 1); in mmc_test_xfersize_write()
1269 static int mmc_test_xfersize_read(struct mmc_test_card *test) in mmc_test_xfersize_read() argument
1273 ret = mmc_test_set_blksize(test, 512); in mmc_test_xfersize_read()
1277 return mmc_test_broken_transfer(test, 1, 512, 0); in mmc_test_xfersize_read()
1280 static int mmc_test_multi_xfersize_write(struct mmc_test_card *test) in mmc_test_multi_xfersize_write() argument
1284 if (test->card->host->max_blk_count == 1) in mmc_test_multi_xfersize_write()
1287 ret = mmc_test_set_blksize(test, 512); in mmc_test_multi_xfersize_write()
1291 return mmc_test_broken_transfer(test, 2, 512, 1); in mmc_test_multi_xfersize_write()
1294 static int mmc_test_multi_xfersize_read(struct mmc_test_card *test) in mmc_test_multi_xfersize_read() argument
1298 if (test->card->host->max_blk_count == 1) in mmc_test_multi_xfersize_read()
1301 ret = mmc_test_set_blksize(test, 512); in mmc_test_multi_xfersize_read()
1305 return mmc_test_broken_transfer(test, 2, 512, 0); in mmc_test_multi_xfersize_read()
1310 static int mmc_test_write_high(struct mmc_test_card *test) in mmc_test_write_high() argument
1315 sg_set_page(&sg, test->highmem, 512, 0); in mmc_test_write_high()
1317 return mmc_test_transfer(test, &sg, 1, 0, 1, 512, 1); in mmc_test_write_high()
1320 static int mmc_test_read_high(struct mmc_test_card *test) in mmc_test_read_high() argument
1325 sg_set_page(&sg, test->highmem, 512, 0); in mmc_test_read_high()
1327 return mmc_test_transfer(test, &sg, 1, 0, 1, 512, 0); in mmc_test_read_high()
1330 static int mmc_test_multi_write_high(struct mmc_test_card *test) in mmc_test_multi_write_high() argument
1335 if (test->card->host->max_blk_count == 1) in mmc_test_multi_write_high()
1339 size = min(size, test->card->host->max_req_size); in mmc_test_multi_write_high()
1340 size = min(size, test->card->host->max_seg_size); in mmc_test_multi_write_high()
1341 size = min(size, test->card->host->max_blk_count * 512); in mmc_test_multi_write_high()
1347 sg_set_page(&sg, test->highmem, size, 0); in mmc_test_multi_write_high()
1349 return mmc_test_transfer(test, &sg, 1, 0, size / 512, 512, 1); in mmc_test_multi_write_high()
1352 static int mmc_test_multi_read_high(struct mmc_test_card *test) in mmc_test_multi_read_high() argument
1357 if (test->card->host->max_blk_count == 1) in mmc_test_multi_read_high()
1361 size = min(size, test->card->host->max_req_size); in mmc_test_multi_read_high()
1362 size = min(size, test->card->host->max_seg_size); in mmc_test_multi_read_high()
1363 size = min(size, test->card->host->max_blk_count * 512); in mmc_test_multi_read_high()
1369 sg_set_page(&sg, test->highmem, size, 0); in mmc_test_multi_read_high()
1371 return mmc_test_transfer(test, &sg, 1, 0, size / 512, 512, 0); in mmc_test_multi_read_high()
1376 static int mmc_test_no_highmem(struct mmc_test_card *test) in mmc_test_no_highmem() argument
1379 mmc_hostname(test->card->host)); in mmc_test_no_highmem()
1388 static int mmc_test_area_map(struct mmc_test_card *test, unsigned long sz, in mmc_test_area_map() argument
1391 struct mmc_test_area *t = &test->area; in mmc_test_area_map()
1423 mmc_hostname(test->card->host)); in mmc_test_area_map()
1430 static int mmc_test_area_transfer(struct mmc_test_card *test, in mmc_test_area_transfer() argument
1433 struct mmc_test_area *t = &test->area; in mmc_test_area_transfer()
1435 return mmc_test_simple_transfer(test, t->sg, t->sg_len, dev_addr, in mmc_test_area_transfer()
1442 static int mmc_test_area_io_seq(struct mmc_test_card *test, unsigned long sz, in mmc_test_area_io_seq() argument
1456 struct mmc_test_area *t = &test->area; in mmc_test_area_io_seq()
1467 ret = mmc_test_area_map(test, sz, max_scatter, min_sg_len, nonblock); in mmc_test_area_io_seq()
1474 ret = mmc_test_nonblock_transfer(test, dev_addr, write, count); in mmc_test_area_io_seq()
1477 ret = mmc_test_area_transfer(test, dev_addr, write); in mmc_test_area_io_seq()
1488 mmc_test_print_avg_rate(test, sz, count, &ts1, &ts2); in mmc_test_area_io_seq()
1493 static int mmc_test_area_io(struct mmc_test_card *test, unsigned long sz, in mmc_test_area_io() argument
1497 return mmc_test_area_io_seq(test, sz, dev_addr, write, max_scatter, in mmc_test_area_io()
1504 static int mmc_test_area_fill(struct mmc_test_card *test) in mmc_test_area_fill() argument
1506 struct mmc_test_area *t = &test->area; in mmc_test_area_fill()
1508 return mmc_test_area_io(test, t->max_tfr, t->dev_addr, 1, 0, 0); in mmc_test_area_fill()
1514 static int mmc_test_area_erase(struct mmc_test_card *test) in mmc_test_area_erase() argument
1516 struct mmc_test_area *t = &test->area; in mmc_test_area_erase()
1518 if (!mmc_can_erase(test->card)) in mmc_test_area_erase()
1521 return mmc_erase(test->card, t->dev_addr, t->max_sz >> 9, in mmc_test_area_erase()
1528 static int mmc_test_area_cleanup(struct mmc_test_card *test) in mmc_test_area_cleanup() argument
1530 struct mmc_test_area *t = &test->area; in mmc_test_area_cleanup()
1546 static int mmc_test_area_init(struct mmc_test_card *test, int erase, int fill) in mmc_test_area_init() argument
1548 struct mmc_test_area *t = &test->area; in mmc_test_area_init()
1552 ret = mmc_test_set_blksize(test, 512); in mmc_test_area_init()
1557 sz = (unsigned long)test->card->pref_erase << 9; in mmc_test_area_init()
1564 t->max_segs = test->card->host->max_segs; in mmc_test_area_init()
1565 t->max_seg_sz = test->card->host->max_seg_size; in mmc_test_area_init()
1569 if (t->max_tfr >> 9 > test->card->host->max_blk_count) in mmc_test_area_init()
1570 t->max_tfr = test->card->host->max_blk_count << 9; in mmc_test_area_init()
1571 if (t->max_tfr > test->card->host->max_req_size) in mmc_test_area_init()
1572 t->max_tfr = test->card->host->max_req_size; in mmc_test_area_init()
1600 t->dev_addr = mmc_test_capacity(test->card) / 2; in mmc_test_area_init()
1604 ret = mmc_test_area_erase(test); in mmc_test_area_init()
1610 ret = mmc_test_area_fill(test); in mmc_test_area_init()
1618 mmc_test_area_cleanup(test); in mmc_test_area_init()
1625 static int mmc_test_area_prepare(struct mmc_test_card *test) in mmc_test_area_prepare() argument
1627 return mmc_test_area_init(test, 0, 0); in mmc_test_area_prepare()
1633 static int mmc_test_area_prepare_erase(struct mmc_test_card *test) in mmc_test_area_prepare_erase() argument
1635 return mmc_test_area_init(test, 1, 0); in mmc_test_area_prepare_erase()
1641 static int mmc_test_area_prepare_fill(struct mmc_test_card *test) in mmc_test_area_prepare_fill() argument
1643 return mmc_test_area_init(test, 1, 1); in mmc_test_area_prepare_fill()
1654 static int mmc_test_best_performance(struct mmc_test_card *test, int write, in mmc_test_best_performance() argument
1657 struct mmc_test_area *t = &test->area; in mmc_test_best_performance()
1659 return mmc_test_area_io(test, t->max_tfr, t->dev_addr, write, in mmc_test_best_performance()
1666 static int mmc_test_best_read_performance(struct mmc_test_card *test) in mmc_test_best_read_performance() argument
1668 return mmc_test_best_performance(test, 0, 0); in mmc_test_best_read_performance()
1674 static int mmc_test_best_write_performance(struct mmc_test_card *test) in mmc_test_best_write_performance() argument
1676 return mmc_test_best_performance(test, 1, 0); in mmc_test_best_write_performance()
1682 static int mmc_test_best_read_perf_max_scatter(struct mmc_test_card *test) in mmc_test_best_read_perf_max_scatter() argument
1684 return mmc_test_best_performance(test, 0, 1); in mmc_test_best_read_perf_max_scatter()
1690 static int mmc_test_best_write_perf_max_scatter(struct mmc_test_card *test) in mmc_test_best_write_perf_max_scatter() argument
1692 return mmc_test_best_performance(test, 1, 1); in mmc_test_best_write_perf_max_scatter()
1698 static int mmc_test_profile_read_perf(struct mmc_test_card *test) in mmc_test_profile_read_perf() argument
1700 struct mmc_test_area *t = &test->area; in mmc_test_profile_read_perf()
1707 ret = mmc_test_area_io(test, sz, dev_addr, 0, 0, 1); in mmc_test_profile_read_perf()
1713 return mmc_test_area_io(test, sz, dev_addr, 0, 0, 1); in mmc_test_profile_read_perf()
1719 static int mmc_test_profile_write_perf(struct mmc_test_card *test) in mmc_test_profile_write_perf() argument
1721 struct mmc_test_area *t = &test->area; in mmc_test_profile_write_perf()
1726 ret = mmc_test_area_erase(test); in mmc_test_profile_write_perf()
1731 ret = mmc_test_area_io(test, sz, dev_addr, 1, 0, 1); in mmc_test_profile_write_perf()
1735 ret = mmc_test_area_erase(test); in mmc_test_profile_write_perf()
1740 return mmc_test_area_io(test, sz, dev_addr, 1, 0, 1); in mmc_test_profile_write_perf()
1746 static int mmc_test_profile_trim_perf(struct mmc_test_card *test) in mmc_test_profile_trim_perf() argument
1748 struct mmc_test_area *t = &test->area; in mmc_test_profile_trim_perf()
1754 if (!mmc_can_trim(test->card)) in mmc_test_profile_trim_perf()
1757 if (!mmc_can_erase(test->card)) in mmc_test_profile_trim_perf()
1763 ret = mmc_erase(test->card, dev_addr, sz >> 9, MMC_TRIM_ARG); in mmc_test_profile_trim_perf()
1767 mmc_test_print_rate(test, sz, &ts1, &ts2); in mmc_test_profile_trim_perf()
1771 ret = mmc_erase(test->card, dev_addr, sz >> 9, MMC_TRIM_ARG); in mmc_test_profile_trim_perf()
1775 mmc_test_print_rate(test, sz, &ts1, &ts2); in mmc_test_profile_trim_perf()
1779 static int mmc_test_seq_read_perf(struct mmc_test_card *test, unsigned long sz) in mmc_test_seq_read_perf() argument
1781 struct mmc_test_area *t = &test->area; in mmc_test_seq_read_perf()
1790 ret = mmc_test_area_io(test, sz, dev_addr, 0, 0, 0); in mmc_test_seq_read_perf()
1796 mmc_test_print_avg_rate(test, sz, cnt, &ts1, &ts2); in mmc_test_seq_read_perf()
1803 static int mmc_test_profile_seq_read_perf(struct mmc_test_card *test) in mmc_test_profile_seq_read_perf() argument
1805 struct mmc_test_area *t = &test->area; in mmc_test_profile_seq_read_perf()
1810 ret = mmc_test_seq_read_perf(test, sz); in mmc_test_profile_seq_read_perf()
1815 return mmc_test_seq_read_perf(test, sz); in mmc_test_profile_seq_read_perf()
1818 static int mmc_test_seq_write_perf(struct mmc_test_card *test, unsigned long sz) in mmc_test_seq_write_perf() argument
1820 struct mmc_test_area *t = &test->area; in mmc_test_seq_write_perf()
1825 ret = mmc_test_area_erase(test); in mmc_test_seq_write_perf()
1832 ret = mmc_test_area_io(test, sz, dev_addr, 1, 0, 0); in mmc_test_seq_write_perf()
1838 mmc_test_print_avg_rate(test, sz, cnt, &ts1, &ts2); in mmc_test_seq_write_perf()
1845 static int mmc_test_profile_seq_write_perf(struct mmc_test_card *test) in mmc_test_profile_seq_write_perf() argument
1847 struct mmc_test_area *t = &test->area; in mmc_test_profile_seq_write_perf()
1852 ret = mmc_test_seq_write_perf(test, sz); in mmc_test_profile_seq_write_perf()
1857 return mmc_test_seq_write_perf(test, sz); in mmc_test_profile_seq_write_perf()
1863 static int mmc_test_profile_seq_trim_perf(struct mmc_test_card *test) in mmc_test_profile_seq_trim_perf() argument
1865 struct mmc_test_area *t = &test->area; in mmc_test_profile_seq_trim_perf()
1871 if (!mmc_can_trim(test->card)) in mmc_test_profile_seq_trim_perf()
1874 if (!mmc_can_erase(test->card)) in mmc_test_profile_seq_trim_perf()
1878 ret = mmc_test_area_erase(test); in mmc_test_profile_seq_trim_perf()
1881 ret = mmc_test_area_fill(test); in mmc_test_profile_seq_trim_perf()
1888 ret = mmc_erase(test->card, dev_addr, sz >> 9, in mmc_test_profile_seq_trim_perf()
1895 mmc_test_print_avg_rate(test, sz, cnt, &ts1, &ts2); in mmc_test_profile_seq_trim_perf()
1911 static int mmc_test_rnd_perf(struct mmc_test_card *test, int write, int print, in mmc_test_rnd_perf() argument
1921 rnd_addr = mmc_test_capacity(test->card) / 4; in mmc_test_rnd_perf()
1922 range1 = rnd_addr / test->card->pref_erase; in mmc_test_rnd_perf()
1935 dev_addr = rnd_addr + test->card->pref_erase * ea + in mmc_test_rnd_perf()
1937 ret = mmc_test_area_io(test, sz, dev_addr, write, 0, 0); in mmc_test_rnd_perf()
1942 mmc_test_print_avg_rate(test, sz, cnt, &ts1, &ts2); in mmc_test_rnd_perf()
1946 static int mmc_test_random_perf(struct mmc_test_card *test, int write) in mmc_test_random_perf() argument
1948 struct mmc_test_area *t = &test->area; in mmc_test_random_perf()
1961 ret = mmc_test_rnd_perf(test, write, 0, sz); in mmc_test_random_perf()
1966 ret = mmc_test_rnd_perf(test, write, 1, sz); in mmc_test_random_perf()
1973 ret = mmc_test_rnd_perf(test, write, 0, sz); in mmc_test_random_perf()
1978 return mmc_test_rnd_perf(test, write, 1, sz); in mmc_test_random_perf()
1984 static int mmc_test_random_read_perf(struct mmc_test_card *test) in mmc_test_random_read_perf() argument
1986 return mmc_test_random_perf(test, 0); in mmc_test_random_read_perf()
1992 static int mmc_test_random_write_perf(struct mmc_test_card *test) in mmc_test_random_write_perf() argument
1994 return mmc_test_random_perf(test, 1); in mmc_test_random_write_perf()
1997 static int mmc_test_seq_perf(struct mmc_test_card *test, int write, in mmc_test_seq_perf() argument
2000 struct mmc_test_area *t = &test->area; in mmc_test_seq_perf()
2023 dev_addr = mmc_test_capacity(test->card) / 4; in mmc_test_seq_perf()
2031 ret = mmc_test_area_io(test, sz, dev_addr, write, in mmc_test_seq_perf()
2039 mmc_test_print_avg_rate(test, sz, cnt, &ts1, &ts2); in mmc_test_seq_perf()
2044 static int mmc_test_large_seq_perf(struct mmc_test_card *test, int write) in mmc_test_large_seq_perf() argument
2049 ret = mmc_test_seq_perf(test, write, 10 * 1024 * 1024, 1); in mmc_test_large_seq_perf()
2054 ret = mmc_test_seq_perf(test, write, 100 * 1024 * 1024, 1); in mmc_test_large_seq_perf()
2059 ret = mmc_test_seq_perf(test, write, 1000 * 1024 * 1024, 1); in mmc_test_large_seq_perf()
2070 static int mmc_test_large_seq_read_perf(struct mmc_test_card *test) in mmc_test_large_seq_read_perf() argument
2072 return mmc_test_large_seq_perf(test, 0); in mmc_test_large_seq_read_perf()
2078 static int mmc_test_large_seq_write_perf(struct mmc_test_card *test) in mmc_test_large_seq_write_perf() argument
2080 return mmc_test_large_seq_perf(test, 1); in mmc_test_large_seq_write_perf()
2083 static int mmc_test_rw_multiple(struct mmc_test_card *test, in mmc_test_rw_multiple() argument
2089 struct mmc_test_area *t = &test->area; in mmc_test_rw_multiple()
2093 if (size > mmc_test_capacity(test->card) / 2 * 512) in mmc_test_rw_multiple()
2094 size = mmc_test_capacity(test->card) / 2 * 512; in mmc_test_rw_multiple()
2097 dev_addr = mmc_test_capacity(test->card) / 4; in mmc_test_rw_multiple()
2109 if (mmc_can_erase(test->card) && in mmc_test_rw_multiple()
2111 ret = mmc_erase(test->card, dev_addr, in mmc_test_rw_multiple()
2112 size / 512, test->card->erase_arg); in mmc_test_rw_multiple()
2114 ret = mmc_erase(test->card, dev_addr, in mmc_test_rw_multiple()
2121 ret = mmc_test_area_io_seq(test, reqsize, dev_addr, in mmc_test_rw_multiple()
2133 static int mmc_test_rw_multiple_size(struct mmc_test_card *test, in mmc_test_rw_multiple_size() argument
2138 void *pre_req = test->card->host->ops->pre_req; in mmc_test_rw_multiple_size()
2139 void *post_req = test->card->host->ops->post_req; in mmc_test_rw_multiple_size()
2148 ret = mmc_test_rw_multiple(test, rw, rw->bs[i], rw->size, 0); in mmc_test_rw_multiple_size()
2155 static int mmc_test_rw_multiple_sg_len(struct mmc_test_card *test, in mmc_test_rw_multiple_sg_len() argument
2162 ret = mmc_test_rw_multiple(test, rw, 512 * 1024, rw->size, in mmc_test_rw_multiple_sg_len()
2173 static int mmc_test_profile_mult_write_blocking_perf(struct mmc_test_card *test) in mmc_test_profile_mult_write_blocking_perf() argument
2186 return mmc_test_rw_multiple_size(test, &test_data); in mmc_test_profile_mult_write_blocking_perf()
2192 static int mmc_test_profile_mult_write_nonblock_perf(struct mmc_test_card *test) in mmc_test_profile_mult_write_nonblock_perf() argument
2205 return mmc_test_rw_multiple_size(test, &test_data); in mmc_test_profile_mult_write_nonblock_perf()
2211 static int mmc_test_profile_mult_read_blocking_perf(struct mmc_test_card *test) in mmc_test_profile_mult_read_blocking_perf() argument
2224 return mmc_test_rw_multiple_size(test, &test_data); in mmc_test_profile_mult_read_blocking_perf()
2230 static int mmc_test_profile_mult_read_nonblock_perf(struct mmc_test_card *test) in mmc_test_profile_mult_read_nonblock_perf() argument
2243 return mmc_test_rw_multiple_size(test, &test_data); in mmc_test_profile_mult_read_nonblock_perf()
2249 static int mmc_test_profile_sglen_wr_blocking_perf(struct mmc_test_card *test) in mmc_test_profile_sglen_wr_blocking_perf() argument
2262 return mmc_test_rw_multiple_sg_len(test, &test_data); in mmc_test_profile_sglen_wr_blocking_perf()
2268 static int mmc_test_profile_sglen_wr_nonblock_perf(struct mmc_test_card *test) in mmc_test_profile_sglen_wr_nonblock_perf() argument
2281 return mmc_test_rw_multiple_sg_len(test, &test_data); in mmc_test_profile_sglen_wr_nonblock_perf()
2287 static int mmc_test_profile_sglen_r_blocking_perf(struct mmc_test_card *test) in mmc_test_profile_sglen_r_blocking_perf() argument
2300 return mmc_test_rw_multiple_sg_len(test, &test_data); in mmc_test_profile_sglen_r_blocking_perf()
2306 static int mmc_test_profile_sglen_r_nonblock_perf(struct mmc_test_card *test) in mmc_test_profile_sglen_r_nonblock_perf() argument
2319 return mmc_test_rw_multiple_sg_len(test, &test_data); in mmc_test_profile_sglen_r_nonblock_perf()
2325 static int mmc_test_reset(struct mmc_test_card *test) in mmc_test_reset() argument
2327 struct mmc_card *card = test->card; in mmc_test_reset()
2346 static int mmc_test_send_status(struct mmc_test_card *test, in mmc_test_send_status() argument
2352 if (!mmc_host_is_spi(test->card->host)) in mmc_test_send_status()
2353 cmd->arg = test->card->rca << 16; in mmc_test_send_status()
2356 return mmc_wait_for_cmd(test->card->host, cmd, 0); in mmc_test_send_status()
2359 static int mmc_test_ongoing_transfer(struct mmc_test_card *test, in mmc_test_ongoing_transfer() argument
2364 struct mmc_host *host = test->card->host; in mmc_test_ongoing_transfer()
2365 struct mmc_test_area *t = &test->area; in mmc_test_ongoing_transfer()
2381 mmc_test_prepare_mrq(test, mrq, t->sg, t->sg_len, dev_addr, t->blocks, in mmc_test_ongoing_transfer()
2393 ret = mmc_test_start_areq(test, mrq, NULL); in mmc_test_ongoing_transfer()
2405 cmd_ret = mmc_test_send_status(test, &rq->status); in mmc_test_ongoing_transfer()
2429 ret = mmc_test_start_areq(test, NULL, mrq); in mmc_test_ongoing_transfer()
2431 mmc_wait_for_req_done(test->card->host, mrq); in mmc_test_ongoing_transfer()
2450 mmc_hostname(test->card->host), status, cmd_ret); in mmc_test_ongoing_transfer()
2453 ret = mmc_test_check_result(test, mrq); in mmc_test_ongoing_transfer()
2457 ret = mmc_test_wait_busy(test); in mmc_test_ongoing_transfer()
2463 mmc_hostname(test->card->host), count, t->blocks); in mmc_test_ongoing_transfer()
2473 static int __mmc_test_cmds_during_tfr(struct mmc_test_card *test, in __mmc_test_cmds_during_tfr() argument
2477 struct mmc_test_area *t = &test->area; in __mmc_test_cmds_during_tfr()
2480 if (!(test->card->host->caps & MMC_CAP_CMD_DURING_TFR)) in __mmc_test_cmds_during_tfr()
2483 ret = mmc_test_area_map(test, sz, 0, 0, use_areq); in __mmc_test_cmds_during_tfr()
2487 ret = mmc_test_ongoing_transfer(test, t->dev_addr, use_sbc, 0, write, in __mmc_test_cmds_during_tfr()
2492 return mmc_test_ongoing_transfer(test, t->dev_addr, use_sbc, 1, write, in __mmc_test_cmds_during_tfr()
2496 static int mmc_test_cmds_during_tfr(struct mmc_test_card *test, int use_sbc, in mmc_test_cmds_during_tfr() argument
2499 struct mmc_test_area *t = &test->area; in mmc_test_cmds_during_tfr()
2504 ret = __mmc_test_cmds_during_tfr(test, sz, use_sbc, write, in mmc_test_cmds_during_tfr()
2515 static int mmc_test_cmds_during_read(struct mmc_test_card *test) in mmc_test_cmds_during_read() argument
2517 return mmc_test_cmds_during_tfr(test, 0, 0, 0); in mmc_test_cmds_during_read()
2523 static int mmc_test_cmds_during_write(struct mmc_test_card *test) in mmc_test_cmds_during_write() argument
2525 return mmc_test_cmds_during_tfr(test, 0, 1, 0); in mmc_test_cmds_during_write()
2531 static int mmc_test_cmds_during_read_cmd23(struct mmc_test_card *test) in mmc_test_cmds_during_read_cmd23() argument
2533 return mmc_test_cmds_during_tfr(test, 1, 0, 0); in mmc_test_cmds_during_read_cmd23()
2539 static int mmc_test_cmds_during_write_cmd23(struct mmc_test_card *test) in mmc_test_cmds_during_write_cmd23() argument
2541 return mmc_test_cmds_during_tfr(test, 1, 1, 0); in mmc_test_cmds_during_write_cmd23()
2547 static int mmc_test_cmds_during_read_cmd23_nonblock(struct mmc_test_card *test) in mmc_test_cmds_during_read_cmd23_nonblock() argument
2549 return mmc_test_cmds_during_tfr(test, 1, 0, 1); in mmc_test_cmds_during_read_cmd23_nonblock()
2555 static int mmc_test_cmds_during_write_cmd23_nonblock(struct mmc_test_card *test) in mmc_test_cmds_during_write_cmd23_nonblock() argument
2557 return mmc_test_cmds_during_tfr(test, 1, 1, 1); in mmc_test_cmds_during_write_cmd23_nonblock()
2935 static void mmc_test_run(struct mmc_test_card *test, int testcase) in mmc_test_run() argument
2940 mmc_hostname(test->card->host), mmc_card_id(test->card)); in mmc_test_run()
2942 mmc_claim_host(test->card->host); in mmc_test_run()
2951 mmc_hostname(test->card->host), i + 1, in mmc_test_run()
2955 ret = mmc_test_cases[i].prepare(test); in mmc_test_run()
2958 mmc_hostname(test->card->host), in mmc_test_run()
2969 gr->card = test->card; in mmc_test_run()
2979 test->gr = gr; in mmc_test_run()
2982 ret = mmc_test_cases[i].run(test); in mmc_test_run()
2986 mmc_hostname(test->card->host)); in mmc_test_run()
2990 mmc_hostname(test->card->host)); in mmc_test_run()
2994 mmc_hostname(test->card->host)); in mmc_test_run()
2998 mmc_hostname(test->card->host)); in mmc_test_run()
3002 mmc_hostname(test->card->host), ret); in mmc_test_run()
3010 ret = mmc_test_cases[i].cleanup(test); in mmc_test_run()
3013 mmc_hostname(test->card->host), in mmc_test_run()
3019 mmc_release_host(test->card->host); in mmc_test_run()
3022 mmc_hostname(test->card->host)); in mmc_test_run()
3089 struct mmc_test_card *test; local
3097 test = kzalloc(sizeof(*test), GFP_KERNEL);
3098 if (!test)
3107 test->card = card;
3109 test->buffer = kzalloc(BUFFER_SIZE, GFP_KERNEL);
3111 test->highmem = alloc_pages(GFP_KERNEL | __GFP_HIGHMEM, BUFFER_ORDER);
3115 if (test->buffer && test->highmem) {
3117 if (test->buffer) {
3120 mmc_test_run(test, testcase);
3125 __free_pages(test->highmem, BUFFER_ORDER);
3127 kfree(test->buffer);
3128 kfree(test);