DMA Engine development
 help / color / mirror / Atom feed
From: Shunsuke Mie <mie@igel.co.jp>
To: Gustavo Pimentel <gustavo.pimentel@synopsys.com>
Cc: "Vinod Koul" <vkoul@kernel.org>,
	"Lorenzo Pieralisi" <lpieralisi@kernel.org>,
	"Krzysztof Wilczyński" <kw@linux.com>,
	"Manivannan Sadhasivam" <mani@kernel.org>,
	"Kishon Vijay Abraham I" <kishon@kernel.org>,
	"Arnd Bergmann" <arnd@arndb.de>,
	"Greg Kroah-Hartman" <gregkh@linuxfoundation.org>,
	"Bjorn Helgaas" <bhelgaas@google.com>,
	"Shunsuke Mie" <mie@igel.co.jp>,
	"Kunihiko Hayashi" <hayashi.kunihiko@socionext.com>,
	"Yoshihiro Shimoda" <yoshihiro.shimoda.uh@renesas.com>,
	"Frank Li" <Frank.Li@nxp.com>,
	linux-kernel@vger.kernel.org, dmaengine@vger.kernel.org,
	linux-pci@vger.kernel.org
Subject: [RFC PATCH 03/11] pci: endpoint: function/pci-epf-test: Unify a range of time measurement
Date: Fri, 17 Mar 2023 20:32:30 +0900	[thread overview]
Message-ID: <20230317113238.142970-4-mie@igel.co.jp> (raw)
In-Reply-To: <20230317113238.142970-1-mie@igel.co.jp>

This test code measures a time of data transfer. Some measurements include
print, preparation and error checking. Change to measure during data
tansfer.

Signed-off-by: Shunsuke Mie <mie@igel.co.jp>
---
 drivers/pci/endpoint/functions/pci-epf-test.c | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/drivers/pci/endpoint/functions/pci-epf-test.c b/drivers/pci/endpoint/functions/pci-epf-test.c
index 172e5ac0bd96..6955a3d2eb7e 100644
--- a/drivers/pci/endpoint/functions/pci-epf-test.c
+++ b/drivers/pci/endpoint/functions/pci-epf-test.c
@@ -356,7 +356,6 @@ static int pci_epf_test_copy(struct pci_epf_test *epf_test)
 		goto err_dst_addr;
 	}
 
-	ktime_get_ts64(&start);
 	use_dma = !!(reg->flags & FLAG_USE_DMA);
 	if (use_dma) {
 		if (!epf_test->dma_supported) {
@@ -371,9 +370,11 @@ static int pci_epf_test_copy(struct pci_epf_test *epf_test)
 			goto err_map_addr;
 		}
 
+		ktime_get_ts64(&start);
 		ret = pci_epf_test_data_transfer(epf_test, dst_phys_addr,
 						 src_phys_addr, reg->size, 0,
 						 DMA_MEM_TO_MEM);
+		ktime_get_ts64(&end);
 		if (ret)
 			dev_err(dev, "Data transfer failed\n");
 	} else {
@@ -385,11 +386,13 @@ static int pci_epf_test_copy(struct pci_epf_test *epf_test)
 			goto err_map_addr;
 		}
 
+		ktime_get_ts64(&start);
 		memcpy_fromio(buf, src_addr, reg->size);
 		memcpy_toio(dst_addr, buf, reg->size);
+		ktime_get_ts64(&end);
 		kfree(buf);
 	}
-	ktime_get_ts64(&end);
+
 	pci_epf_test_print_rate("COPY", reg->size, &start, &end, use_dma);
 
 err_map_addr:
@@ -467,9 +470,9 @@ static int pci_epf_test_read(struct pci_epf_test *epf_test)
 		ret = pci_epf_test_data_transfer(epf_test, dst_phys_addr,
 						 phys_addr, reg->size,
 						 reg->src_addr, DMA_DEV_TO_MEM);
+		ktime_get_ts64(&end);
 		if (ret)
 			dev_err(dev, "Data transfer failed\n");
-		ktime_get_ts64(&end);
 
 		dma_unmap_single(dma_dev, dst_phys_addr, reg->size,
 				 DMA_FROM_DEVICE);
@@ -556,14 +559,13 @@ static int pci_epf_test_write(struct pci_epf_test *epf_test)
 		}
 
 		ktime_get_ts64(&start);
-
 		ret = pci_epf_test_data_transfer(epf_test, phys_addr,
 						 src_phys_addr, reg->size,
 						 reg->dst_addr,
 						 DMA_MEM_TO_DEV);
+		ktime_get_ts64(&end);
 		if (ret)
 			dev_err(dev, "Data transfer failed\n");
-		ktime_get_ts64(&end);
 
 		dma_unmap_single(dma_dev, src_phys_addr, reg->size,
 				 DMA_TO_DEVICE);
-- 
2.25.1


  parent reply	other threads:[~2023-03-17 11:33 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-17 11:32 [RFC PATCH 00/11] Introduce a test for continuous transfer Shunsuke Mie
2023-03-17 11:32 ` [RFC PATCH 01/11] misc: pci_endpoint_test: Aggregate irq_type checking Shunsuke Mie
2023-03-17 11:32 ` [RFC PATCH 02/11] misc: pci_endpoint_test: Remove an unused variable Shunsuke Mie
2023-03-17 11:32 ` Shunsuke Mie [this message]
2023-03-17 11:32 ` [RFC PATCH 04/11] PCI: endpoint: functions/pci-epf-test: Move common difinitions to header file Shunsuke Mie
2023-03-17 11:32 ` [RFC PATCH 05/11] MAINTAINERS: Add a header file for pci-epf-test Shunsuke Mie
2023-03-17 11:32 ` [RFC PATCH 06/11] misc: pci_endpoint_test: Use a common header file between endpoint driver Shunsuke Mie
2023-03-17 14:47   ` [EXT] " Frank Li
2023-04-04 10:11     ` Shunsuke Mie
2023-03-17 11:32 ` [RFC PATCH 07/11] PCI: endpoint: functions/pci-epf-test: Extend the test for continuous transfers Shunsuke Mie
2023-03-17 11:32 ` [RFC PATCH 08/11] misc: pci_endpoint_test: Support a test of continuous transfer Shunsuke Mie
2023-03-17 11:32 ` [RFC PATCH 09/11] tools: PCI: Add 'C' option to support " Shunsuke Mie
2023-03-17 11:32 ` [RFC PATCH 10/11] dmaengine: dw-edma: Fix to change for " Shunsuke Mie
2023-03-17 11:32 ` [RFC PATCH 11/11] dmaengine: dw-edma: Fix to enable to issue dma request on DMA processing Shunsuke Mie
2023-03-31  5:38 ` [RFC PATCH 00/11] Introduce a test for continuous transfer Manivannan Sadhasivam
2023-04-04  9:57   ` Shunsuke Mie

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230317113238.142970-4-mie@igel.co.jp \
    --to=mie@igel.co.jp \
    --cc=Frank.Li@nxp.com \
    --cc=arnd@arndb.de \
    --cc=bhelgaas@google.com \
    --cc=dmaengine@vger.kernel.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=gustavo.pimentel@synopsys.com \
    --cc=hayashi.kunihiko@socionext.com \
    --cc=kishon@kernel.org \
    --cc=kw@linux.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=lpieralisi@kernel.org \
    --cc=mani@kernel.org \
    --cc=vkoul@kernel.org \
    --cc=yoshihiro.shimoda.uh@renesas.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox