Pārlūkot izejas kodu

dmaengine: ti: k3-udma: Try to use the highest TPL channels for MEM_TO_MEM

When running memcpy test with big buffers:

echo 800000 > /sys/module/dmatest/parameters/test_buf_size
echo 2000 > /sys/module/dmatest/parameters/timeout
echo 20 > /sys/module/dmatest/parameters/iterations
echo 10 > /sys/module/dmatest/parameters/max_channels
echo 1 > /sys/module/dmatest/parameters/run

The throughput with normal channels is:
dmatest: dma1chan2-copy0: summary 200 tests, 0 failures 87 iops 308840 KB/s (0)

Using High Throughput channel with the same setup:
dmatest: dma1chan2-copy0: summary 200 tests, 0 failures 295 iops 1206172 KB/s (0)

The speed increase is about 4x.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
Peter Ujfalusi 7 gadi atpakaļ
vecāks
revīzija
4edb5193d9
1 mainītis faili ar 4 papildinājumiem un 2 dzēšanām
  1. 4 2
      drivers/dma/ti/k3-udma.c

+ 4 - 2
drivers/dma/ti/k3-udma.c

@@ -1216,6 +1216,7 @@ static int udma_get_rchan(struct udma_chan *uc)
 static int udma_get_chan_pair(struct udma_chan *uc)
 static int udma_get_chan_pair(struct udma_chan *uc)
 {
 {
 	struct udma_dev *ud = uc->ud;
 	struct udma_dev *ud = uc->ud;
+	struct udma_match_data *match_data = ud->match_data;
 	int chan_id, end;
 	int chan_id, end;
 
 
 	if ((uc->tchan && uc->rchan) && uc->tchan->id == uc->rchan->id) {
 	if ((uc->tchan && uc->rchan) && uc->tchan->id == uc->rchan->id) {
@@ -1236,8 +1237,9 @@ static int udma_get_chan_pair(struct udma_chan *uc)
 
 
 	/* Can be optimized, but let's have it like this for now */
 	/* Can be optimized, but let's have it like this for now */
 	end = min(ud->tchan_cnt, ud->rchan_cnt);
 	end = min(ud->tchan_cnt, ud->rchan_cnt);
-	for (chan_id = ud->match_data->level_start_idx[UDMA_TP_NORMAL];
-	     chan_id < end; chan_id++) {
+	/* Try to use the highest TPL channel pair for MEM_TO_MEM channels */
+	chan_id = match_data->level_start_idx[match_data->tpl_levels - 1];
+	for (; chan_id < end; chan_id++) {
 		if (!test_bit(chan_id, ud->tchan_map) &&
 		if (!test_bit(chan_id, ud->tchan_map) &&
 		    !test_bit(chan_id, ud->rchan_map))
 		    !test_bit(chan_id, ud->rchan_map))
 			break;
 			break;