aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDan Williams <dan.j.williams@intel.com>2013-11-06 19:30:02 -0500
committerDan Williams <dan.j.williams@intel.com>2013-11-14 14:04:39 -0500
commita9e554957de406d6adc581731f571b8a1503f6b0 (patch)
tree2db53413a9c3d112d5eff349502ada0743917981
parenta310d037b8d06755c62bb4878c00d19490af5550 (diff)
dmatest: support xor-only, or pq-only channels in tests
Currently we only test raid channels that happen to also have 'copy' capability. Search for capable channels that do not have DMA_MEMCPY. Note the return value from run_threaded_test never really made sense because it could return errors after successfully starting tests. We already have the test results per channel so missing channels can be detected at that time. Acked-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Signed-off-by: Dan Williams <dan.j.williams@intel.com>
-rw-r--r--drivers/dma/dmatest.c58
1 files changed, 32 insertions, 26 deletions
diff --git a/drivers/dma/dmatest.c b/drivers/dma/dmatest.c
index c5048671daf7..ea829659149a 100644
--- a/drivers/dma/dmatest.c
+++ b/drivers/dma/dmatest.c
@@ -734,31 +734,20 @@ static bool filter(struct dma_chan *chan, void *param)
734 return true; 734 return true;
735} 735}
736 736
737static int run_threaded_test(struct dmatest_info *info) 737static void request_channels(struct dmatest_info *info,
738 enum dma_transaction_type type)
738{ 739{
739 dma_cap_mask_t mask; 740 dma_cap_mask_t mask;
740 struct dma_chan *chan;
741 struct dmatest_params *params = &info->params;
742 int err = 0;
743
744 /* Copy test parameters */
745 params->buf_size = test_buf_size;
746 strlcpy(params->channel, strim(test_channel), sizeof(params->channel));
747 strlcpy(params->device, strim(test_device), sizeof(params->device));
748 params->threads_per_chan = threads_per_chan;
749 params->max_channels = max_channels;
750 params->iterations = iterations;
751 params->xor_sources = xor_sources;
752 params->pq_sources = pq_sources;
753 params->timeout = timeout;
754 741
755 dma_cap_zero(mask); 742 dma_cap_zero(mask);
756 dma_cap_set(DMA_MEMCPY, mask); 743 dma_cap_set(type, mask);
757 for (;;) { 744 for (;;) {
745 struct dmatest_params *params = &info->params;
746 struct dma_chan *chan;
747
758 chan = dma_request_channel(mask, filter, params); 748 chan = dma_request_channel(mask, filter, params);
759 if (chan) { 749 if (chan) {
760 err = dmatest_add_channel(info, chan); 750 if (dmatest_add_channel(info, chan)) {
761 if (err) {
762 dma_release_channel(chan); 751 dma_release_channel(chan);
763 break; /* add_channel failed, punt */ 752 break; /* add_channel failed, punt */
764 } 753 }
@@ -768,9 +757,27 @@ static int run_threaded_test(struct dmatest_info *info)
768 info->nr_channels >= params->max_channels) 757 info->nr_channels >= params->max_channels)
769 break; /* we have all we need */ 758 break; /* we have all we need */
770 } 759 }
771 return err;
772} 760}
773 761
762static void run_threaded_test(struct dmatest_info *info)
763{
764 struct dmatest_params *params = &info->params;
765
766 /* Copy test parameters */
767 params->buf_size = test_buf_size;
768 strlcpy(params->channel, strim(test_channel), sizeof(params->channel));
769 strlcpy(params->device, strim(test_device), sizeof(params->device));
770 params->threads_per_chan = threads_per_chan;
771 params->max_channels = max_channels;
772 params->iterations = iterations;
773 params->xor_sources = xor_sources;
774 params->pq_sources = pq_sources;
775 params->timeout = timeout;
776
777 request_channels(info, DMA_MEMCPY);
778 request_channels(info, DMA_XOR);
779 request_channels(info, DMA_PQ);
780}
774 781
775static void stop_threaded_test(struct dmatest_info *info) 782static void stop_threaded_test(struct dmatest_info *info)
776{ 783{
@@ -788,19 +795,19 @@ static void stop_threaded_test(struct dmatest_info *info)
788 info->nr_channels = 0; 795 info->nr_channels = 0;
789} 796}
790 797
791static int restart_threaded_test(struct dmatest_info *info, bool run) 798static void restart_threaded_test(struct dmatest_info *info, bool run)
792{ 799{
793 /* we might be called early to set run=, defer running until all 800 /* we might be called early to set run=, defer running until all
794 * parameters have been evaluated 801 * parameters have been evaluated
795 */ 802 */
796 if (!info->did_init) 803 if (!info->did_init)
797 return 0; 804 return;
798 805
799 /* Stop any running test first */ 806 /* Stop any running test first */
800 stop_threaded_test(info); 807 stop_threaded_test(info);
801 808
802 /* Run test with new parameters */ 809 /* Run test with new parameters */
803 return run_threaded_test(info); 810 run_threaded_test(info);
804} 811}
805 812
806static bool is_threaded_test_run(struct dmatest_info *info) 813static bool is_threaded_test_run(struct dmatest_info *info)
@@ -850,7 +857,7 @@ static int dmatest_run_set(const char *val, const struct kernel_param *kp)
850 if (is_threaded_test_run(info)) 857 if (is_threaded_test_run(info))
851 ret = -EBUSY; 858 ret = -EBUSY;
852 else if (dmatest_run) 859 else if (dmatest_run)
853 ret = restart_threaded_test(info, dmatest_run); 860 restart_threaded_test(info, dmatest_run);
854 861
855 mutex_unlock(&info->lock); 862 mutex_unlock(&info->lock);
856 863
@@ -860,11 +867,10 @@ static int dmatest_run_set(const char *val, const struct kernel_param *kp)
860static int __init dmatest_init(void) 867static int __init dmatest_init(void)
861{ 868{
862 struct dmatest_info *info = &test_info; 869 struct dmatest_info *info = &test_info;
863 int ret = 0;
864 870
865 if (dmatest_run) { 871 if (dmatest_run) {
866 mutex_lock(&info->lock); 872 mutex_lock(&info->lock);
867 ret = run_threaded_test(info); 873 run_threaded_test(info);
868 mutex_unlock(&info->lock); 874 mutex_unlock(&info->lock);
869 } 875 }
870 876
@@ -873,7 +879,7 @@ static int __init dmatest_init(void)
873 */ 879 */
874 info->did_init = true; 880 info->did_init = true;
875 881
876 return ret; 882 return 0;
877} 883}
878/* when compiled-in wait for drivers to load first */ 884/* when compiled-in wait for drivers to load first */
879late_initcall(dmatest_init); 885late_initcall(dmatest_init);